reconnect endlessmap

back_recharge
wangyuan 2019-11-21 16:14:45 +08:00
parent 28efc91bc9
commit 56338b360f
2 changed files with 20 additions and 8 deletions

View File

@ -3258,17 +3258,21 @@ public class MapLogic {
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
User user = UserManager.getUser(entry.getValue().getUid());
MapManager mapManager = user.getMapManager();
mapManager.setEndlessMapInfo(new EndlessMapInfo());
if(mapManager.getCurMapId()!=0&&SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
MessageUtil.sendIndicationMessage(entry.getValue(),1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
resetMapInfo(user,false);
}
endLessClear(entry.getValue());
}
updateEndlessSeason(0);
}
public void endLessClear(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
MapManager mapManager = user.getMapManager();
mapManager.setEndlessMapInfo(new EndlessMapInfo());
if(mapManager.getCurMapId()!=0&&SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
resetMapInfo(user,false);
}
}
public void clearEndlessItem(User user) throws Exception {
SEndlessMapConfig config = SEndlessMapConfig.sEndlessMapConfigMap.get(MapLogic.getEndlessMapId());
int[] mapItem = config.getMapItem();
@ -3345,4 +3349,8 @@ public class MapLogic {
UserManager.getUser(session.getUid()).getMapManager().updateEndlessSkipFight(type);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
public static int getEndlessSeason() {
return endlessSeason;
}
}

View File

@ -10,6 +10,7 @@ import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.GlobalDataManaager;
@ -299,6 +300,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
PlayerInfoProto.UpdateBagIndication build = PlayerInfoProto.UpdateBagIndication.newBuilder().addAllItem(allItemList).setType(0).build();
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.UPDATE_BAG_INDICATION_VALUE,build,true);
}
if(userInMem.getMapManager().getEndlessMapInfo().getSeason()!=MapLogic.getEndlessSeason()){
MapLogic.getInstance().endLessClear(session);
}
MongoUtil.getLjsdMongoTemplate().lastUpdate();
} catch (Exception e) {
LOGGER.error("the uid={} processFlush wrong ,e={}",session.getUid(),e);