|
|
|
@ -359,10 +359,35 @@ public class ChampionshipLogic {
|
|
|
|
|
joinUids.add(uid);
|
|
|
|
|
User user = UserManager.getUser(uid);
|
|
|
|
|
SChampionshipReward sChampionshipReward = rewardsMap.get(rank);
|
|
|
|
|
if(user.getArenaManager().getTopMaxRank()==0 || user.getArenaManager().getTopMaxRank()>rank){
|
|
|
|
|
user.getArenaManager().setTopMaxRank(rank);
|
|
|
|
|
}
|
|
|
|
|
String title = SErrorCodeEerverConfig.getI18NMessage("champion_reward_title");
|
|
|
|
|
String content = SErrorCodeEerverConfig.getI18NMessage("champion_reward_txt",new Object[]{rank++});
|
|
|
|
|
MailLogic.getInstance().sendMail(user.getId(),title,content,ItemUtil.getMailReward(sChampionshipReward.getSeasonReward()),nowTime, Global.MAIL_EFFECTIVE_TIME);
|
|
|
|
|
}
|
|
|
|
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
|
|
|
|
SChampionshipSetting sChampionshipSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting();
|
|
|
|
|
int arenaItemId =sChampionshipSetting.getArenaItem()[0];
|
|
|
|
|
int rewardItemId =sChampionshipSetting.getArenaItem()[1];
|
|
|
|
|
Map<Integer, Integer> sendIds = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_GUESSS_UIDS, "", Integer.class, Integer.class);
|
|
|
|
|
for(Integer sendId : sendIds.keySet()){
|
|
|
|
|
User user = UserManager.getUser(sendId);
|
|
|
|
|
Item item = user.getItemManager().getItem(arenaItemId);
|
|
|
|
|
int itemNum = item.getItemNum();
|
|
|
|
|
if(item!=null && itemNum>0){
|
|
|
|
|
int[][] costs = new int[1][];
|
|
|
|
|
costs[0] = new int[2];
|
|
|
|
|
costs[0][0] =arenaItemId;
|
|
|
|
|
costs[0][1] =itemNum;
|
|
|
|
|
ItemUtil.itemCost(user,costs,BIReason.CHAMPIONM_EXCHANGE_CONSUME,0);
|
|
|
|
|
Map<Integer,Integer> itemReward = new HashMap<>(1);
|
|
|
|
|
itemReward.put(rewardItemId,itemNum/sChampionshipSetting.getExchangeItem());
|
|
|
|
|
ItemUtil.addItem(user,itemReward,null,BIReason.CHAMPIONM_EXCHANGE_REWARD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
|
|
|
|
clearReidsWhenEnd(joinUids);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -373,6 +398,7 @@ public class ChampionshipLogic {
|
|
|
|
|
* 用于测试使用
|
|
|
|
|
*/
|
|
|
|
|
public static void whenStart() throws Exception {
|
|
|
|
|
schedule=1;
|
|
|
|
|
start();
|
|
|
|
|
for(int i=1;i<8;i++){
|
|
|
|
|
roundTimes=i;
|
|
|
|
@ -392,6 +418,8 @@ public class ChampionshipLogic {
|
|
|
|
|
scoreToRedis();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
roundTimes=13;
|
|
|
|
|
progress=-2;
|
|
|
|
|
|
|
|
|
|
// close();
|
|
|
|
|
|
|
|
|
@ -418,7 +446,7 @@ public class ChampionshipLogic {
|
|
|
|
|
int teamId = (index++ % groupNums);
|
|
|
|
|
memberOfTeamTmp.get(teamId).add(memberInfo.getUid());
|
|
|
|
|
if(teamUpdate){
|
|
|
|
|
memberInfo.setTeamId(teamId*100);
|
|
|
|
|
memberInfo.setTeamId(teamId*100+memberInfo.getTeamId());
|
|
|
|
|
}else{
|
|
|
|
|
memberInfo.setTeamId(teamId);
|
|
|
|
|
}
|
|
|
|
@ -439,10 +467,15 @@ public class ChampionshipLogic {
|
|
|
|
|
int uid = session.getUid();
|
|
|
|
|
//组装数据
|
|
|
|
|
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue();
|
|
|
|
|
ArenaInfoProto.ChampionGetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetInfoResponse.newBuilder().setProgress(progress).setEndTime(endTime).setMyrank(myRank);
|
|
|
|
|
int topMaxRank = UserManager.getUser(uid).getArenaManager().getTopMaxRank();
|
|
|
|
|
ArenaInfoProto.ChampionGetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetInfoResponse.newBuilder().setProgress(progress).setEndTime(endTime).setMyrank(myRank).setMaxRank(topMaxRank);
|
|
|
|
|
if(myRank!=-1){
|
|
|
|
|
if(progress == -2 || progress/100 == 2){
|
|
|
|
|
MemberInfo memberInfo = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_JOIN, "", Integer.toString(uid), MemberInfo.class);
|
|
|
|
|
builder.setMyscore(memberInfo.getScore());
|
|
|
|
|
}else{
|
|
|
|
|
builder.setMyscore(RedisUtil.getInstence().getZSetScore(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue());
|
|
|
|
|
}
|
|
|
|
|
builder.setJoinState(1);
|
|
|
|
|
String key = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid));
|
|
|
|
|
Object latestKey = RedisUtil.getInstence().lGetIndex(key, -1);
|
|
|
|
@ -513,7 +546,7 @@ public class ChampionshipLogic {
|
|
|
|
|
}
|
|
|
|
|
MemberInfo memberInfo = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_JOIN, "", Integer.toString(uid), MemberInfo.class);
|
|
|
|
|
FamilyFightInfo fightInfo = memberInfo.getFightInfo();
|
|
|
|
|
if(fightInfo == null){
|
|
|
|
|
if(fightInfo == null || progress%10%4 == 0){
|
|
|
|
|
return PlayerLogic.getInstance().getUserTeamOneInfo(uid,201);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -618,7 +651,7 @@ public class ChampionshipLogic {
|
|
|
|
|
int enemyId = arenaRecord.getDefUid();
|
|
|
|
|
int fightResult = arenaRecord.getFightResult();
|
|
|
|
|
if(roundTimes == arenaRecord.getRoundTims()){
|
|
|
|
|
if(progress%10%4 != 0 || fightResult==-2){
|
|
|
|
|
if(progress%10%4 != 3 || fightResult==-2){
|
|
|
|
|
fightResult =-1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -839,6 +872,7 @@ public class ChampionshipLogic {
|
|
|
|
|
delKeys.add( RedisUtil.getInstence().getKey(RedisKey.CHAMPION_FINAL_TEAM_INFO, ""));
|
|
|
|
|
delKeys.add( RedisUtil.getInstence().getKey(RedisKey.CHAMPION_RANK, ""));
|
|
|
|
|
delKeys.add( RedisUtil.getInstence().getKey(RedisKey.CHAMPION_FINAL_RECODED_IDS, ""));
|
|
|
|
|
delKeys.add( RedisUtil.getInstence().getKey(RedisKey.CHAMPION_GUESSS_UIDS, ""));
|
|
|
|
|
|
|
|
|
|
//我的历史结果
|
|
|
|
|
joinUids.forEach(uid->{
|
|
|
|
@ -1055,10 +1089,6 @@ public class ChampionshipLogic {
|
|
|
|
|
int attackUid = memberInfoAttack.getUid();
|
|
|
|
|
int defUid = memberInfoDef.getUid();
|
|
|
|
|
int type = memberInfoAttack.getType() + memberInfoDef.getType();
|
|
|
|
|
if(memberInfoAttack.getType() == 1){
|
|
|
|
|
attackUid = memberInfoDef.getUid();
|
|
|
|
|
defUid = memberInfoAttack.getUid();
|
|
|
|
|
}
|
|
|
|
|
ArenaRecord arenaRecord = new ArenaRecord();
|
|
|
|
|
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,memberInfoAttack.getUid()));
|
|
|
|
|
arenaRecord.setAttackId(attackUid);
|
|
|
|
@ -1164,8 +1194,10 @@ public class ChampionshipLogic {
|
|
|
|
|
public static void switchBet(int functionId) throws Exception {
|
|
|
|
|
int[][] itemNum = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getItemNum();
|
|
|
|
|
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(functionId);
|
|
|
|
|
Map<String,Integer> sendIds = new HashMap<>();
|
|
|
|
|
OnlineUserManager.sessionMap.values().forEach(session->{
|
|
|
|
|
try {
|
|
|
|
|
sendIds.put(Integer.toString(session.getUid()),1);
|
|
|
|
|
User user = UserManager.getUser(session.getUid());
|
|
|
|
|
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AyncWorkerRunnable() {
|
|
|
|
|
@Override
|
|
|
|
@ -1182,7 +1214,7 @@ public class ChampionshipLogic {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_GUESSS_UIDS,"",sendIds);
|
|
|
|
|
snapPlayFightInfo();
|
|
|
|
|
selectBetTeam();
|
|
|
|
|
}
|
|
|
|
@ -1312,7 +1344,7 @@ public class ChampionshipLogic {
|
|
|
|
|
schedule=1;
|
|
|
|
|
}else {//决赛
|
|
|
|
|
int totalWiner =sChampionshipSetting.getChampionshipPlayer()/ sChampionshipSetting.getTrialsGroup() * sChampionshipSetting.getTrialsGroupWinner();
|
|
|
|
|
if(diff>totalWiner || Math.pow(2,diff)>=totalWiner){
|
|
|
|
|
if(diff>totalWiner || Math.pow(2,diff)>totalWiner){
|
|
|
|
|
schedule=2;
|
|
|
|
|
if(progress!=-2){
|
|
|
|
|
progress= -2;
|
|
|
|
|