fix data
parent
ecd3695037
commit
8b249ba977
|
@ -109,7 +109,7 @@ public class ChampionshipLogic {
|
|||
.setAttackName(attackName)
|
||||
.setDefName(defName)
|
||||
.setFightResult(fightResult)
|
||||
.setRoundTImes(arenaRecord.getRoundTims()-1)
|
||||
.setRoundTImes(arenaRecord.getRoundTims())
|
||||
.setTeamId(teamId)
|
||||
.setId(arenaRecord.getId())
|
||||
.setIsGUess(isGuess)
|
||||
|
@ -448,6 +448,7 @@ public class ChampionshipLogic {
|
|||
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)){
|
||||
|
@ -457,7 +458,7 @@ public class ChampionshipLogic {
|
|||
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
|
||||
}
|
||||
builder.setChampionBattleInfo(builder1
|
||||
.setMyInfo(getChampionBattleInfo(uid))
|
||||
.setMyInfo(getChampionBattleInfo(attackId))
|
||||
.setEnemyInfo(getChampionBattleInfo(enemyId))
|
||||
.setResult(fightResult)
|
||||
.build());
|
||||
|
@ -613,6 +614,7 @@ public class ChampionshipLogic {
|
|||
List<ArenaRecord> myArenaRecordInfos = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
for(ArenaRecord arenaRecord : myArenaRecordInfos){
|
||||
int attackUid = arenaRecord.getAttackId();
|
||||
int enemyId = arenaRecord.getDefUid();
|
||||
int fightResult = arenaRecord.getFightResult();
|
||||
if(roundTimes == arenaRecord.getRoundTims()){
|
||||
|
@ -624,8 +626,13 @@ public class ChampionshipLogic {
|
|||
fightResult =-1;
|
||||
}
|
||||
int enemyType = robotConfigMap.containsKey(enemyId)?0:1;
|
||||
int attackType = robotConfigMap.containsKey(attackUid)?0:1;
|
||||
CommonProto.ArenaEnemy arenaEnemy = ArenaLogic.getInstance().getArenaEnemy(enemyId, enemyType);
|
||||
ArenaInfoProto.ChampionTwoEnemInfo build = ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setBlueEnemy(arenaEnemy).setRoundTimes(arenaRecord.getRoundTims())
|
||||
CommonProto.ArenaEnemy attackInfo = ArenaLogic.getInstance().getArenaEnemy(attackUid, attackType);
|
||||
ArenaInfoProto.ChampionTwoEnemInfo build = ArenaInfoProto.ChampionTwoEnemInfo.newBuilder()
|
||||
.setBlueEnemy(attackInfo)
|
||||
.setRedEnemy(arenaEnemy)
|
||||
.setRoundTimes(arenaRecord.getRoundTims())
|
||||
.setFightResult(fightResult)
|
||||
.setId(arenaRecord.getId())
|
||||
.build();
|
||||
|
@ -944,12 +951,12 @@ public class ChampionshipLogic {
|
|||
guessState = 2;
|
||||
Double winnerCoins = RedisUtil.getInstence().getZSetScore(RedisKey.CHAMPION_BET_ALL, "", arenaRecord.getId() + ":" + winner);
|
||||
Double loseCoins = RedisUtil.getInstence().getZSetScore(RedisKey.CHAMPION_BET_ALL, "", arenaRecord.getId() + ":" + loseer);
|
||||
myWinCoins = (int)(winnerCoins/(winnerCoins+loseCoins)*mineBetCoins);
|
||||
myWinCoins = (int)((winnerCoins+loseCoins)/winnerCoins*mineBetCoins);
|
||||
}
|
||||
}
|
||||
|
||||
builder.addChampionMyBetDetails(betDetailBuilder.setBetResult(guessState)
|
||||
.setEnemyPairInfo(ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setRedEnemy(attackEnemy).setBlueEnemy(defEnemy).setFightResult(fightResult).setId(arenaRecord.getId()).setRoundTimes(arenaRecord.getRoundTims()))
|
||||
.setEnemyPairInfo(ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setRedEnemy(defEnemy).setBlueEnemy(attackEnemy).setFightResult(fightResult).setId(arenaRecord.getId()).setRoundTimes(arenaRecord.getRoundTims()))
|
||||
.setMyBetCoins(mineBetCoins)
|
||||
.setMyWinCoins(myWinCoins)
|
||||
|
||||
|
@ -982,7 +989,7 @@ public class ChampionshipLogic {
|
|||
|
||||
|
||||
/**
|
||||
* 1.选出参战人员
|
||||
* 1.选出参战人员 人永远是进攻方
|
||||
*/
|
||||
public static void selectToBattle(){
|
||||
RedisUtil.getInstence().del(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_CUR_JOIN_IDS,""));
|
||||
|
@ -1001,11 +1008,11 @@ public class ChampionshipLogic {
|
|||
MemberInfo memberInfoDef =joinMembers.get(memberOfOneTeam.get(joinIndexBlue));
|
||||
int attackUid = memberInfoAttack.getUid();
|
||||
int defUid = memberInfoDef.getUid();
|
||||
int type = memberInfoAttack.getType() + memberInfoDef.getType();
|
||||
if(memberInfoAttack.getType() == 1){
|
||||
attackUid = memberInfoDef.getUid();
|
||||
defUid = memberInfoAttack.getUid();
|
||||
attackUid = memberInfoDef.getUid();
|
||||
defUid = memberInfoAttack.getUid();
|
||||
}
|
||||
int type = memberInfoAttack.getType() + memberInfoDef.getType();
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,memberInfoAttack.getUid()));
|
||||
arenaRecord.setAttackId(attackUid);
|
||||
|
@ -1300,28 +1307,22 @@ public class ChampionshipLogic {
|
|||
long diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
|
||||
int progressTmp;
|
||||
|
||||
if(diff<0){ //选拔赛
|
||||
if(diff<=0){ //选拔赛
|
||||
progressTmp =100 + roundTimes*10 + progressState;
|
||||
schedule=1;
|
||||
}else {//决赛
|
||||
int totalWiner =sChampionshipSetting.getChampionshipPlayer()/ sChampionshipSetting.getTrialsGroup() * sChampionshipSetting.getTrialsGroupWinner();
|
||||
if(diff>totalWiner){
|
||||
if(isServerStart){
|
||||
schedule=2;
|
||||
progress= -2;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(Math.pow(2,diff)>=totalWiner){
|
||||
if(isServerStart){
|
||||
schedule=2;
|
||||
if(diff>totalWiner || Math.pow(2,diff)>=totalWiner){
|
||||
schedule=2;
|
||||
if(progress!=-2){
|
||||
progress= -2;
|
||||
sendAllProgressUpdate();
|
||||
}
|
||||
progress= -2;
|
||||
return;
|
||||
}
|
||||
|
||||
progressTmp = 200 + (int)(diff+1)*10 + progressState;
|
||||
progressTmp = 200 + (int)(diff)*10 + progressState;
|
||||
if(schedule==1){ // 刚开始进入决赛,选拔出选手
|
||||
selectToJoinFinal();
|
||||
}
|
||||
|
@ -1347,6 +1348,10 @@ public class ChampionshipLogic {
|
|||
scoreToRedis();
|
||||
sendBetReward();
|
||||
}
|
||||
sendAllProgressUpdate();
|
||||
}
|
||||
|
||||
public static void sendAllProgressUpdate(){
|
||||
ArenaInfoProto.ChampionProgressUpdateIndication build = ArenaInfoProto.ChampionProgressUpdateIndication.newBuilder().setEndTime(endTime).setProgress(progress).build();
|
||||
//向全服玩家广播进度变更信息
|
||||
for(ISession session : OnlineUserManager.sessionMap.values()){
|
||||
|
|
|
@ -101,15 +101,20 @@ public class FightUtil {
|
|||
}
|
||||
|
||||
}
|
||||
if( fightEvent.getFightType()!=GameFightType.Arena2RobotFight){
|
||||
if(fightTeamInfo==null){
|
||||
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
||||
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap());
|
||||
if(fightTeamInfo==null){
|
||||
if( fightEvent.getFightType()!=GameFightType.Arena2RobotFight){
|
||||
if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
|
||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||
}else{
|
||||
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
||||
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap());
|
||||
}
|
||||
}else{
|
||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||
}
|
||||
}else{
|
||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getDefUid());
|
||||
}
|
||||
|
||||
|
||||
LuaValue getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(fightEvent.getFrames());
|
||||
int[] fightResult = CheckFight.getInstance().checkFight(fightSeed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());
|
||||
|
|
Loading…
Reference in New Issue