fix bloody
parent
02d5e966bb
commit
3086a1f5bc
|
@ -93,8 +93,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
|
|||
MessageUtil.sendErrorCode(session,0,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
return;
|
||||
}
|
||||
//处理多设备重登
|
||||
dealRepeatLogin(session.getUid());
|
||||
//刷新token
|
||||
refreshToken(session);
|
||||
//踢下线
|
||||
|
@ -110,11 +108,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
|
|||
dealHeartBeat(session);
|
||||
return;
|
||||
}
|
||||
//检查token
|
||||
// if (checkToken(session,packetNetData) != 0 ){
|
||||
// MessageUtil.sendErrorCode(session,0,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if( packetNetData.getMsgId()== MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||
processReconnect(session);
|
||||
|
@ -122,9 +115,7 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
|
|||
return;
|
||||
}
|
||||
|
||||
if (checkIndex(session,packetNetData) != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("request commond : " + packetNetData.getMsgId());
|
||||
BaseHandler baseHandler = handlers.get(packetNetData.getMsgId());
|
||||
if (baseHandler == null) {
|
||||
|
@ -212,36 +203,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
|
||||
|
||||
private int dealRepeatLogin(int uid) {
|
||||
if (OnlineUserManager.checkUidOnline(uid)){
|
||||
ISession iSession = OnlineUserManager.getSessionByUid(uid);
|
||||
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
||||
iSession.setOfflineType(ErrorCode.reloginCode);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
||||
int index = packetNetData.getIndex();
|
||||
if (iSession.getIndex() >= index){
|
||||
byte[] message = iSession.getCacheMessage(index);
|
||||
if (message==null &&( packetNetData.getMsgId() != MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() != MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE)){
|
||||
//TODO error
|
||||
LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||
return 1;
|
||||
}else {
|
||||
LOGGER.info("the uid={},the msg={} reback",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||
iSession.writeAndFlush(message);
|
||||
return 1;
|
||||
}
|
||||
}else {
|
||||
iSession.setIndex(index);
|
||||
iSession.setLoginTime(System.currentTimeMillis());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void ackIndication(ISession iSession, int ackId) {
|
||||
LOGGER.info("the uid={},the ackId={}",iSession.getUid(),ackId);
|
||||
iSession.clearIndication(ackId);
|
||||
|
|
|
@ -46,7 +46,9 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer,SGlobalSystemConfig> sGlobalSystemConfigMapTmp = new HashMap<>();
|
||||
if( GameApplication.serverConfig == null){
|
||||
return;
|
||||
}
|
||||
Map<Integer, SGlobalSystemConfig> config = STableManager.getConfig(SGlobalSystemConfig.class);
|
||||
Iterator<Map.Entry<Integer, SGlobalSystemConfig>> iterator = config.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
|
|
|
@ -193,7 +193,6 @@ public class BloodLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
BloodyInfo bloodyInfo = user.getBloodyInfo();
|
||||
bloodyInfo.setScore(99999);
|
||||
Map<Integer, SBloodyBattleTreasure> sBloodyBattleTreasureMap = SBloodyBattleTreasure.sBloodyBattleTreasureMap;
|
||||
RoomProto.GetBloodyScoreInfoResponse.Builder builder = RoomProto.GetBloodyScoreInfoResponse.newBuilder().setScore(bloodyInfo.getScore()).setHadBuy(bloodyInfo.getHadBuy());
|
||||
if(bloodyInfo.getStateInfo().isEmpty()){
|
||||
|
@ -302,12 +301,11 @@ public class BloodLogic {
|
|||
}
|
||||
|
||||
public void calBloodyMissionInfo(User user,SortDataBean sortDataBean) throws Exception {
|
||||
int killNums = sortDataBean.getKillNums();
|
||||
BloodyInfo bloodyInfo = user.getBloodyInfo();
|
||||
bloodyInfo.setKillNums(bloodyInfo.getKillNums() + 9999);
|
||||
bloodyInfo.setKillNums(bloodyInfo.getKillNums());
|
||||
int changeScore = calScore(sortDataBean);
|
||||
if(changeScore>0){
|
||||
bloodyInfo.setScore(bloodyInfo.getScore() + calScore(sortDataBean));
|
||||
bloodyInfo.setScore(bloodyInfo.getScore() + changeScore);
|
||||
}
|
||||
MissionEventDistributor.requestStart();
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_END);
|
||||
|
|
|
@ -298,7 +298,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
||||
iSession.setOfflineType(ErrorCode.reloginCode);
|
||||
backUpMsgToRedis(iSession);
|
||||
offLine(iSession);
|
||||
OnlineUserManager.userOffline(uid);
|
||||
LOGGER.info("the channel={}",iSession.getCtx().channel());
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -351,6 +352,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
LOGGER.info("player offLine ...");
|
||||
ISession session = (ISession) gameSession;
|
||||
synchronized (session) {
|
||||
if(session.getOfflineType() == ErrorCode.reloginCode){
|
||||
return;
|
||||
}
|
||||
User user = UserManager.getUserInMem(session.getUid());
|
||||
if(user == null){
|
||||
return;
|
||||
|
@ -358,9 +362,6 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,1);
|
||||
LOGGER.info("player={} offLine ...",user.getId());
|
||||
if(session.getOfflineType() == ErrorCode.reloginCode){
|
||||
return;
|
||||
}
|
||||
OnlineUserManager.userOffline(session.getUid());
|
||||
if (session.getCtx() != null) {
|
||||
GameMessageHandler.allChannels.remove(session.getCtx().channel());
|
||||
|
|
Loading…
Reference in New Issue