秘盒跨赛季不需要重置次数
parent
03468ddcfc
commit
18c2b0fc21
|
@ -1,9 +1,11 @@
|
|||
package com.ljsd.jieling.logic;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class OnlineUserManager {
|
||||
|
@ -12,6 +14,7 @@ public class OnlineUserManager {
|
|||
|
||||
public static Map<Integer, PlayerManager> onlineUserMap = new ConcurrentHashMap<>(10000);
|
||||
|
||||
public static Set<Integer> orderAdventureUids= Sets.newConcurrentHashSet();
|
||||
|
||||
public static void userOnline(int uid, ISession session) {
|
||||
sessionMap.put(uid, session);
|
||||
|
@ -19,6 +22,7 @@ public class OnlineUserManager {
|
|||
|
||||
public static void userOffline(int uid) {
|
||||
sessionMap.remove(uid);
|
||||
orderAdventureUids.remove(uid);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ public class ActivityLogic {
|
|||
return;
|
||||
}
|
||||
if(secretBoxManager.getCurSeason() != secretBoxSeasonTimes){
|
||||
flushSecretBox(secretBoxManager);
|
||||
flushSecretBoxOfSeasonChange(secretBoxManager);
|
||||
}
|
||||
List<PlayerInfoProto.SecretBoxFreeUseInfo> secretBoxFreeUseInfoList = new ArrayList<>(2);
|
||||
Map<Integer, Integer> freeUseInfos = secretBoxManager.getFreeUseInfos();
|
||||
|
@ -300,16 +300,10 @@ public class ActivityLogic {
|
|||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_SECRETBOX_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
public void flushSecretBox( SecretBoxManager secretBoxManager){
|
||||
public void flushSecretBoxOfSeasonChange(SecretBoxManager secretBoxManager){
|
||||
secretBoxManager.setCount(0);
|
||||
secretBoxManager.setDayCount(0);
|
||||
secretBoxManager.setCurSeason(secretBoxSeasonTimes);
|
||||
List<Integer> idsBySeasonId = SDifferDemonsBoxSetting.getIdsBySeasonId(secretBoxSeasonTimes);
|
||||
Map<Integer,Integer> freeUseMap = new HashMap<>(idsBySeasonId.size());
|
||||
for(int id:idsBySeasonId){
|
||||
freeUseMap.put(id,0);
|
||||
}
|
||||
secretBoxManager.setFreeUseInfos(freeUseMap);
|
||||
secretBoxManager.setDayCount(0);
|
||||
}
|
||||
|
||||
public void randomSecretBox(ISession session,int id) throws Exception {
|
||||
|
@ -321,6 +315,9 @@ public class ActivityLogic {
|
|||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE,"activity_close");
|
||||
return;
|
||||
}
|
||||
if(secretBoxManager.getCurSeason() != secretBoxSeasonTimes){
|
||||
flushSecretBoxOfSeasonChange(secretBoxManager);
|
||||
}
|
||||
int randCount = sDifferDemonsBoxSetting.getSecondaryCost();
|
||||
if(secretBoxManager.getDayCount() + randCount > sDifferDemonsBoxSetting.getMaxNum()){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE,"今日抽取已达上限");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.fight;
|
||||
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -29,7 +30,7 @@ import java.util.*;
|
|||
public class CombatLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CombatLogic.class);
|
||||
|
||||
public Set<Integer> orderAdventureUids= new HashSet<>();
|
||||
|
||||
|
||||
private CombatLogic(){}
|
||||
|
||||
|
@ -180,7 +181,7 @@ public class CombatLogic {
|
|||
adventureManager.setFlushBossTime(nowMs + flushBossNextTime *1000);
|
||||
}
|
||||
}
|
||||
orderAdventureUids.add(uid);
|
||||
OnlineUserManager.orderAdventureUids.add(uid);
|
||||
builder.setNextBossFlushTime(flushBossNextTime).setBuyTimsPerDay(adventureManager.getBuyTimsPerDay()).setDayChallengeTimes(adventureManager.getDayChallengeTimes());
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
@ -494,7 +495,7 @@ public class CombatLogic {
|
|||
.build();
|
||||
FightInfoProto.AdventureBossFindIndication adventureBossFindIndication = FightInfoProto.AdventureBossFindIndication.newBuilder().setAdventureBossSimpleInfo(build).build();
|
||||
|
||||
for(Integer uid:orderAdventureUids){
|
||||
for(Integer uid:OnlineUserManager.orderAdventureUids){
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
|
||||
if(sessionByUid!=null){
|
||||
MessageUtil.sendMessage(sessionByUid,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_FIND_INDICATION_VALUE,adventureBossFindIndication,true);
|
||||
|
|
|
@ -341,7 +341,6 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
|
||||
GameMessageHandler.currentSessions.remove(session.getUid());
|
||||
CombatLogic.getInstance().orderAdventureUids.remove(session.getUid());
|
||||
|
||||
try {
|
||||
OnlineUserManager.userOffline(session.getUid());
|
||||
|
|
Loading…
Reference in New Issue