back_recharge
lvxinran 2019-12-23 18:04:24 +08:00
commit f777bd44d4
4 changed files with 59 additions and 12 deletions

View File

@ -216,6 +216,8 @@ public class RedisKey {
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息 selectUid + ":" +winUid
public final static String CHAMPION_FINAL_RECODED_IDS = "CHAMPION_FINAL_RECODED_IDS"; // 巅峰赛決賽信息
public final static String CHAMPION_GUESSS_UIDS = "CHAMPION_GUESSS_UIDS"; // 巅峰赛发送竞猜币信息
public final static String PIDGIDTEMP = "PIDGIDTEMP";

View File

@ -101,6 +101,8 @@ public interface BIReason {
int CHAMPIION_BET_WIN_REWARD = 60 ; // 巅峰赛竞猜赢取
int CHAMPIONM_EXCHANGE_REWARD = 1050;//巅峰赛兑换奖励
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
@ -194,6 +196,8 @@ public interface BIReason {
int MISSING_ROOM_ACCELERATE_CONSUME = 1049;//迷宫寻宝加速消耗
int CHAMPIONM_EXCHANGE_CONSUME = 1050;//巅峰赛兑换

View File

@ -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){
MemberInfo memberInfo = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_JOIN, "", Integer.toString(uid), MemberInfo.class);
builder.setMyscore(memberInfo.getScore());
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;

View File

@ -22,6 +22,8 @@ public class ArenaManager extends MongoBase {
private int season;
private int topMaxRank=0; // 我的历史最高排名
private List<ArenaEnemy> arenaEnemies;
@ -92,7 +94,14 @@ public class ArenaManager extends MongoBase {
updateString("count",count);
updateString("flushTime",flushTime);
updateString("flushNums",flushNums);
}
public int getTopMaxRank() {
return topMaxRank;
}
public void setTopMaxRank(int topMaxRank) {
this.topMaxRank = topMaxRank;
updateString("topMaxRank",topMaxRank);
}
}