fix arena season
parent
d57017535f
commit
c8a03c009d
|
@ -128,7 +128,7 @@ public class ArenaLogic {
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
int score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason), Integer.toString(enemyId)).intValue();
|
int score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason), Integer.toString(enemyId)).intValue();
|
||||||
if(score == -1){
|
if(score == -1){
|
||||||
score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason-1), Integer.toString(enemyId)).intValue();
|
score = SArenaSetting.getSArenaSetting().getScore();
|
||||||
}
|
}
|
||||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||||
.setUid(enemyId)
|
.setUid(enemyId)
|
||||||
|
@ -168,16 +168,8 @@ public class ArenaLogic {
|
||||||
int myscoreChange=0;
|
int myscoreChange=0;
|
||||||
int defScoreChange=0;
|
int defScoreChange=0;
|
||||||
|
|
||||||
if(arenaManager.getCount() != 0){
|
if(arenaManager.getCount() != 0) {
|
||||||
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(uid)).intValue();
|
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason), Integer.toString(uid)).intValue();
|
||||||
}else{
|
|
||||||
if(curSeason>1){
|
|
||||||
int lastScore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason - 1), Integer.toString(uid)).intValue();
|
|
||||||
if(lastScore!=-1){
|
|
||||||
myscore = lastScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||||
|
|
||||||
|
@ -192,15 +184,17 @@ public class ArenaLogic {
|
||||||
defScore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(challengeUid)).intValue();
|
defScore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(challengeUid)).intValue();
|
||||||
defScoreChange = calScore(defScore, myscore,fightResult==1?0:1);
|
defScoreChange = calScore(defScore, myscore,fightResult==1?0:1);
|
||||||
myscoreChange = calScore(myscore, defScore,fightResult);
|
myscoreChange = calScore(myscore, defScore,fightResult);
|
||||||
arenaRecord.setAttackId(uid);
|
if(defUser.getArenaManager().getCount()!=0){
|
||||||
arenaRecord.setDefScore(defScoreChange);
|
arenaRecord.setAttackId(uid);
|
||||||
arenaRecord.setAttackForce( HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE,false));
|
arenaRecord.setDefScore(defScoreChange);
|
||||||
arenaRecord.setCreateTime((int)(System.currentTimeMillis()/1000));
|
arenaRecord.setAttackForce( HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE,false));
|
||||||
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,uid));
|
arenaRecord.setCreateTime((int)(System.currentTimeMillis()/1000));
|
||||||
arenaRecord.setFightResult(fightResult^1);
|
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,uid));
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.ARENA_RRECORD,Integer.toString(challengeUid),arenaRecord.getId(),arenaRecord);
|
arenaRecord.setFightResult(fightResult^1);
|
||||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(challengeUid),defScoreChange);
|
RedisUtil.getInstence().putMapEntry(RedisKey.ARENA_RRECORD,Integer.toString(challengeUid),arenaRecord.getId(),arenaRecord);
|
||||||
MessageUtil.sendRedIndication(challengeUid,GlobalsDef.ARENA_CHALLENGE_TYPE);
|
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(challengeUid),defScoreChange);
|
||||||
|
MessageUtil.sendRedIndication(challengeUid,GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(challengeUid);
|
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(challengeUid);
|
||||||
fightResult = getFightResultByPersonToRobot(user, teamId,sArenaRobotConfig,skipFight,builder);
|
fightResult = getFightResultByPersonToRobot(user, teamId,sArenaRobotConfig,skipFight,builder);
|
||||||
|
@ -616,7 +610,6 @@ public class ArenaLogic {
|
||||||
title = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_title");
|
title = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_title");
|
||||||
}
|
}
|
||||||
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK,Integer.toString(curSeason), 0, -1);
|
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK,Integer.toString(curSeason), 0, -1);
|
||||||
int nextSeason = curSeason + 1;
|
|
||||||
if(type == GlobalsDef.ARENA_SEASON_REWARD){
|
if(type == GlobalsDef.ARENA_SEASON_REWARD){
|
||||||
curSeason=0;
|
curSeason=0;
|
||||||
}
|
}
|
||||||
|
@ -652,9 +645,6 @@ public class ArenaLogic {
|
||||||
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(type == GlobalsDef.ARENA_SEASON_REWARD){
|
|
||||||
RedisUtil.getInstence().updateZsetScores(RedisKey.ARENA_RANK,Integer.toString(nextSeason),arenaRankInfo);
|
|
||||||
}
|
|
||||||
MongoUtil.getInstence().lastUpdate();
|
MongoUtil.getInstence().lastUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue