对手数据判空处理
parent
79daca78ee
commit
41f90ab191
|
@ -477,22 +477,26 @@ public class ChampionshipLogic {
|
|||
builder.setJoinState(1);
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid));
|
||||
Object latestKey = RedisUtil.getInstence().lGetIndex(key, -1);
|
||||
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", latestKey.toString(), ArenaRecord.class);
|
||||
int enemyId = arenaRecord.getDefUid();
|
||||
int attackId = arenaRecord.getAttackId();
|
||||
int fightResult = arenaRecord.getFightResult();
|
||||
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder();
|
||||
if(roundTimes == arenaRecord.getRoundTims() && (progress%10%4 != 3 || fightResult==-2)){
|
||||
fightResult =-1;
|
||||
if(latestKey!=null){
|
||||
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", latestKey.toString(), ArenaRecord.class);
|
||||
int enemyId = arenaRecord.getDefUid();
|
||||
int attackId = arenaRecord.getAttackId();
|
||||
int fightResult = arenaRecord.getFightResult();
|
||||
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder();
|
||||
if(roundTimes == arenaRecord.getRoundTims() && (progress%10%4 != 3 || fightResult==-2)){
|
||||
fightResult =-1;
|
||||
}
|
||||
if(fightResult!=-1){
|
||||
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||
}
|
||||
builder.setChampionBattleInfo(builder1
|
||||
.setMyInfo(getChampionBattleInfo(attackId))
|
||||
.setEnemyInfo(getChampionBattleInfo(enemyId))
|
||||
.setResult(fightResult)
|
||||
.build());
|
||||
}
|
||||
if(fightResult!=-1){
|
||||
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||
}
|
||||
builder.setChampionBattleInfo(builder1
|
||||
.setMyInfo(getChampionBattleInfo(attackId))
|
||||
.setEnemyInfo(getChampionBattleInfo(enemyId))
|
||||
.setResult(fightResult)
|
||||
.build());
|
||||
|
||||
|
||||
|
||||
}
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_GET_RESPONSE_VALUE,builder.build(),true);
|
||||
|
|
Loading…
Reference in New Issue