From 41f90ab191045d3c1c22f78c4bc5dc04f7c2cfa5 Mon Sep 17 00:00:00 2001 From: wangyuan Date: Thu, 28 May 2020 11:39:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=89=8B=E6=95=B0=E6=8D=AE=E5=88=A4?= =?UTF-8?q?=E7=A9=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/championship/ChampionshipLogic.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/championship/ChampionshipLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/championship/ChampionshipLogic.java index 81ddd55c4..314bbfe47 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/championship/ChampionshipLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/championship/ChampionshipLogic.java @@ -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);