back_recharge
zhangshanxue 2020-05-29 13:40:37 +08:00
commit 778d1f07cf
1 changed files with 19 additions and 15 deletions

View File

@ -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);