巅峰赛时间修改
parent
b7fe433994
commit
f409c43ab6
|
@ -38,7 +38,7 @@ public class TreasureActivity extends AbstractActivity {
|
|||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
LOGGER.info("戒灵秘宝初始化...");
|
||||
if(user.getPlayerInfoManager().getHadBuyTreasure() == 0){
|
||||
if(user.getPlayerInfoManager().getHadBuyTreasure() == 1){
|
||||
LOGGER.info("戒灵秘宝初始化...reset buy");
|
||||
user.getPlayerInfoManager().setHadBuyTreasure(0);
|
||||
Map<Integer, Integer> buyGoodsTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes();
|
||||
|
|
|
@ -502,7 +502,7 @@ public class ChampionshipLogic {
|
|||
|
||||
public static void getChampionBetInfo(ISession session,int type) throws Exception {
|
||||
int uid = session.getUid();
|
||||
if(progress==-1){
|
||||
if(progress==-1 || schedule==1){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
String selectIdForRedis = getSelectIdForRedis();
|
||||
|
@ -1217,28 +1217,33 @@ public class ChampionshipLogic {
|
|||
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
|
||||
public void work(User user) throws Exception {
|
||||
if(!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)){
|
||||
return;
|
||||
}
|
||||
ItemUtil.drop(user, itemNum, BIReason.CHAMPIION_BET_REWARD);
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_GUESSS_UIDS,"",sendIds);
|
||||
|
||||
|
||||
snapPlayFightInfo();
|
||||
selectBetTeam();
|
||||
if(schedule==2){
|
||||
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
|
||||
public void work(User user) throws Exception {
|
||||
if(!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)){
|
||||
return;
|
||||
}
|
||||
ItemUtil.drop(user, itemNum, BIReason.CHAMPIION_BET_REWARD);
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_GUESSS_UIDS,"",sendIds);
|
||||
selectBetTeam();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1354,17 +1359,25 @@ public class ChampionshipLogic {
|
|||
long now = TimeUtils.now();
|
||||
long startTime = timeControllerOfFunction.getStartTime();
|
||||
SChampionshipSetting sChampionshipSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting();
|
||||
int duration = sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
|
||||
int progressState=getProgress((int)((now - startTime)/1000%duration +1));
|
||||
long round = (now - startTime) /1000/ duration + 1;
|
||||
int durationSelect = sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
|
||||
int durationFinal = durationSelect+ sChampionshipSetting.getGuessTime() ;
|
||||
int progressState=getProgress((int)((now - startTime)/1000%durationSelect +1));
|
||||
long round = (now - startTime) /1000/ durationSelect + 1;
|
||||
roundTimes = (int) round;
|
||||
long diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
|
||||
int progressTmp;
|
||||
|
||||
if(diff<=0){ //选拔赛
|
||||
//竞猜阶段取消,改成直接战斗
|
||||
progressState = progressState==1?2:progressState;
|
||||
progressTmp =100 + roundTimes*10 + progressState;
|
||||
schedule=1;
|
||||
}else {//决赛
|
||||
long passTIme = (now - startTime - (sChampionshipSetting.getTrialsGroup() - 1) * 1000L * durationSelect )/1000;
|
||||
round = passTIme / durationFinal + sChampionshipSetting.getTrialsGroup() ;
|
||||
roundTimes = (int) round ;
|
||||
diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
|
||||
progressState=getProgress((int)(passTIme%durationFinal +1));
|
||||
int totalWiner =sChampionshipSetting.getChampionshipPlayer()/ sChampionshipSetting.getTrialsGroup() * sChampionshipSetting.getTrialsGroupWinner();
|
||||
if(diff>totalWiner || Math.pow(2,diff)>totalWiner){
|
||||
schedule=2;
|
||||
|
@ -1386,7 +1399,11 @@ public class ChampionshipLogic {
|
|||
if(progressTmp == progress){
|
||||
return;
|
||||
}
|
||||
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(progressState));
|
||||
if(schedule ==1) {
|
||||
endTime = (int)( startTime/1000 + (round-1)*durationSelect + getDuratimeByProgressState(progressState));
|
||||
}else{
|
||||
endTime = (int)( startTime/1000 + (sChampionshipSetting.getTrialsGroup()-1)*durationSelect + (round-sChampionshipSetting.getTrialsGroup())*durationFinal + getDuratimeByProgressState(progressState));
|
||||
}
|
||||
progress = progressTmp;
|
||||
if(isServerStart){
|
||||
return;
|
||||
|
@ -1400,7 +1417,7 @@ public class ChampionshipLogic {
|
|||
}
|
||||
});
|
||||
}
|
||||
if(progress%10%4==1){ //竞猜阶段 后台自动运行战斗
|
||||
if(progress%10%4==1 || (schedule==1 && progress%10%4==2)){ //竞猜阶段 后台自动运行战斗
|
||||
ThreadManager.getScheduledExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -1419,7 +1436,9 @@ public class ChampionshipLogic {
|
|||
public void run() {
|
||||
try {
|
||||
scoreToRedis();
|
||||
sendBetReward();
|
||||
if(schedule==2){
|
||||
sendBetReward();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1442,12 +1461,12 @@ public class ChampionshipLogic {
|
|||
return sChampionshipSetting.getPrepareTime();
|
||||
}
|
||||
if(progressState == 1){
|
||||
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime();
|
||||
return sChampionshipSetting.getPrepareTime() +(schedule==2? sChampionshipSetting.getGuessTime():0);
|
||||
}
|
||||
if(progressState == 2){
|
||||
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime();
|
||||
}
|
||||
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
|
||||
return sChampionshipSetting.getPrepareTime() + (schedule==2? sChampionshipSetting.getGuessTime():0) + sChampionshipSetting.getBattleTime();
|
||||
}
|
||||
return sChampionshipSetting.getPrepareTime() + (schedule==2? sChampionshipSetting.getGuessTime():0) + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue