fix hero diaplay level

back_recharge
wangyuan 2019-11-07 15:40:03 +08:00
parent de35a2dde7
commit 371d47063a
2 changed files with 17 additions and 10 deletions

View File

@ -37,6 +37,7 @@ import org.springframework.stereotype.Component;
import util.ClassLoaderHelper;
import java.lang.reflect.Type;
import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
@ -231,7 +232,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
}
public void processReconnect(ISession session){
public void processReconnect(ISession session) throws Exception {
String key = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE, Integer.toString(session.getUid()));
Type type = new TypeToken<Map<Integer, ISession.IndicationMsg>>(){}.getType();
Object indicationInRedis = RedisUtil.getInstence().get(key);
@ -270,6 +271,11 @@ public class ProtocolsManager implements ProtocolsAbstract {
}
LOGGER.info("the uid={} reconnect,the maxid={} ",session.getUid(),maxMsgId);
User userInMem = UserManager.getUserInMem(session.getUid());
if(userInMem!=null){
userInMem.getPlayerInfoManager().setLoginTime(TimeUtils.now());
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}
MessageUtil.sendMessageWithoutBack(session,1, MessageTypeProto.MessageType.RECONNECT_RESPONSE_VALUE,null,true);
}
@ -393,15 +399,16 @@ public class ProtocolsManager implements ProtocolsAbstract {
GameMessageHandler.currentSessions.remove(session.getUid());
try {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
playerInfoManager.setOffLineTime(TimeUtils.now());
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
playerInfoManager.addOnlineTime(onlineTime);
//更新在线时长
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.OnlineReward,(int)(onlineTime/TimeUtils.ONE_SECOND));
GuildLogic.updateMyPos(user);
MongoUtil.getInstence().lastUpdate();
if(session.getFiveReady()==1){
PlayerManager playerInfoManager = user.getPlayerInfoManager();
playerInfoManager.setOffLineTime(TimeUtils.now());
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
playerInfoManager.addOnlineTime(onlineTime);
//更新在线时长
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.OnlineReward,(int)(onlineTime/TimeUtils.ONE_SECOND));
MongoUtil.getInstence().lastUpdate();
}
backUpMsgToRedis(session);
// 下线处理的逻辑需要添加在这里
} catch (Exception e) {

View File

@ -111,7 +111,7 @@ public class CBean2Proto {
.setId(String.valueOf(scHero.getId()))
.setHeroId(scHero.getId())
.setLevel(sArenaRobotConfig.getRoleLv())
.setStar(scHero.getStar())
.setStar(sArenaRobotConfig.getStarOfHeroMap().get(scHero.getId()))
.setBreakId(sArenaRobotConfig.getBreakId())
.build();
}