add pokemon
parent
1b6811a4be
commit
00cf1b77da
|
@ -211,8 +211,9 @@ public class RedisKey {
|
|||
public final static String CHAMPION_FINAL_TEAM_INFO = "CHAMPION_FINAL_TEAM_INFO";
|
||||
|
||||
|
||||
public final static String CHAMPION_BET_MINE = "CHAMPION_BET_MINE"; // 我的竞猜
|
||||
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息
|
||||
public final static String CHAMPION_BET_MINE = "CHAMPION_BET_MINE"; // 我的竞猜 selectIdForRedis value: winUid
|
||||
public final static String CHAMPION_BET_DETAIL = "CHAMPION_BET_DETAIL"; // 我的竞猜 selectUid + ":" +winUid
|
||||
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息 selectUid + ":" +winUid
|
||||
public final static String CHAMPION_FINAL_RECODED_IDS = "CHAMPION_FINAL_RECODED_IDS"; // 巅峰赛決賽信息
|
||||
|
||||
public final static String PIDGIDTEMP = "PIDGIDTEMP";
|
||||
|
|
|
@ -469,14 +469,10 @@ public class ChampionshipLogic {
|
|||
if(progress%10%4 != 0){
|
||||
fightResult =-1;
|
||||
}
|
||||
int myGuessID = arenaRecord.getAttackId();
|
||||
Integer coins = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), selectIdForRedis + ":" +myGuessID, Integer.class);
|
||||
if(coins == null) {
|
||||
myGuessID = arenaRecord.getDefUid();
|
||||
coins = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), selectIdForRedis + ":" +myGuessID, Integer.class);
|
||||
}
|
||||
if(coins == null){
|
||||
myGuessID = 0;
|
||||
int myGuessID = 0;
|
||||
String guessUidStr = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), selectIdForRedis, String.class);
|
||||
if(!StringUtil.isEmpty(guessUidStr)) {
|
||||
myGuessID = Integer.parseInt(guessUidStr);
|
||||
}
|
||||
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder()
|
||||
.setMyInfo(getChampionBattleInfo(arenaRecord.getAttackId()))
|
||||
|
@ -695,7 +691,17 @@ public class ChampionshipLogic {
|
|||
}
|
||||
String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user, snapTeamId);
|
||||
fightInfo.setPokenmonSkills(pokenmonSkills);
|
||||
// RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_FIGHT, "", String.valueOf(uid), fightInfo);
|
||||
List<TeamPosForPokenInfo> teamPosForPokenInfos = user.getTeamPosManager().getTeamPosForPoken().get(snapTeamId);
|
||||
if(teamPosForPokenInfos!=null){
|
||||
List<Integer> pokens = new ArrayList<>();
|
||||
for(TeamPosForPokenInfo teamPosForPokenInfo : teamPosForPokenInfos){
|
||||
pokens.add(teamPosForPokenInfo.getPokenId());
|
||||
}
|
||||
fightInfo.setPokenmonIds(pokens);
|
||||
}
|
||||
|
||||
|
||||
|
||||
memberInfo.setFightInfo(fightInfo);
|
||||
joinMembers.put(memberInfo.getUid(),memberInfo);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_JOIN,"",String.valueOf(uid),memberInfo);
|
||||
|
@ -760,12 +766,17 @@ public class ChampionshipLogic {
|
|||
String selectUid = getSelectIdForRedis();
|
||||
if(progress%10%4!=1 || StringUtil.isEmpty(selectUid)){
|
||||
LOGGER.error("the uid={} not in time",uid);
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
String alreadyCoins = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), selectUid, String.class);
|
||||
if(!StringUtil.isEmpty(alreadyCoins)){
|
||||
LOGGER.error("the uid={} guess winner={} had guessed",uid,winUid);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", selectUid, ArenaRecord.class);
|
||||
if(arenaRecord.getAttackId()!=winUid && arenaRecord.getDefUid()!=winUid){
|
||||
LOGGER.error("the uid={} guess winner={} is not exists",uid,winUid);
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
User user = UserManager.getUser(uid);
|
||||
int[] arenaItem = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getArenaItem();
|
||||
|
@ -776,9 +787,9 @@ public class ChampionshipLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
//我下注信息
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_MINE,Integer.toString(uid),selectUid +":" + winUid,chip);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_MINE,Integer.toString(uid),selectUid,winUid);
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.CHAMPION_BET_ALL,"",selectUid +":" + winUid,chip);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_MINE,selectUid +":" + winUid,Integer.toString(uid),chip);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_BET_DETAIL,selectUid +":" + winUid,Integer.toString(uid),chip);
|
||||
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_BET_GUESS_RESPONSE_VALUE,null,true);
|
||||
|
||||
|
@ -793,7 +804,7 @@ public class ChampionshipLogic {
|
|||
String betAllKey = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_ALL, "");
|
||||
Set<String> betDetails = RedisUtil.getInstence().getZset(betAllKey, 0, -1);
|
||||
for(String betInfo : betDetails){
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_MINE, betInfo));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_DETAIL, betInfo));
|
||||
}
|
||||
delKeys.add(betAllKey);
|
||||
}
|
||||
|
@ -820,7 +831,7 @@ public class ChampionshipLogic {
|
|||
Double failCoins = RedisUtil.getInstence().getZSetScore(RedisKey.CHAMPION_BET_ALL, "", selectUid + ":" + failUid);
|
||||
|
||||
double winRate = (winCoins + failCoins) / winCoins;
|
||||
Map<Integer, Integer> betPersonInfoMap = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_BET_MINE, selectUid + ":" + winUid, Integer.class, Integer.class);
|
||||
Map<Integer, Integer> betPersonInfoMap = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_BET_DETAIL, selectUid + ":" + winUid, Integer.class, Integer.class);
|
||||
betPersonInfoMap.forEach((betUid,coins)->{
|
||||
try {
|
||||
User user = UserManager.getUser(betUid);
|
||||
|
@ -851,16 +862,10 @@ public class ChampionshipLogic {
|
|||
*/
|
||||
public static void viewMGuessHistory(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
Map<String, Integer> betHistorys = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), String.class, Integer.class);
|
||||
Map<String, String> betHistorys = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), String.class, String.class);
|
||||
ArenaInfoProto.ChampionGetAllMyBetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetAllMyBetInfoResponse.newBuilder();
|
||||
if(!betHistorys.isEmpty()){
|
||||
List<String> guessIds = new ArrayList<>(betHistorys.size());
|
||||
betHistorys.forEach((idAndBet,coins)->{
|
||||
String[] idAndBetSplit = idAndBet.split(":");
|
||||
String id = idAndBetSplit[0];
|
||||
guessIds.add(id);
|
||||
});
|
||||
List<Object> ids = new ArrayList<>(guessIds);
|
||||
List<Object> ids = new ArrayList<>(betHistorys.keySet());
|
||||
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
||||
String selectIdForRedis = getSelectIdForRedis();
|
||||
Map<Integer, SArenaRobotConfig> arenaRobotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
|
@ -891,8 +896,8 @@ public class ChampionshipLogic {
|
|||
if(fightResult == 0){
|
||||
winner = arenaRecord.getDefUid();
|
||||
}
|
||||
Integer coins = betHistorys.get(arenaRecord.getId()+ ":" + winner);
|
||||
if(coins!=null){
|
||||
String guessUid = betHistorys.get(arenaRecord.getId());
|
||||
if(!StringUtil.isEmpty(guessUid) && guessUid.equals(winner)){
|
||||
guessState = 2;
|
||||
}
|
||||
// betDetailBuilder.setFightData(CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||
|
|
Loading…
Reference in New Issue