Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
3ef8b5766b
|
@ -89,6 +89,7 @@ public class HandlerLogicThread extends Thread{
|
|||
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1423,21 +1423,8 @@ public class HeroLogic {
|
|||
throw new Exception("英雄不存在或无装备"+heroId+"size"+equipIds.size());
|
||||
}
|
||||
|
||||
int[] equipSignUnlock = SGameSetting.getGameSetting().getEquipSignUnlock();
|
||||
if(equipSignUnlock[0]==1){
|
||||
if(user.getPlayerInfoManager().getLevel()<equipSignUnlock[0]){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_WEAR_RESPONSE_VALUE,"玩家等级不够,无法装备!限制"+equipSignUnlock[0]+"级");
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
if(hero.getStar()<equipSignUnlock[1]){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_WEAR_RESPONSE_VALUE,"妖灵师等级不够,无法装备!限制"+equipSignUnlock[1]+"级");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//类型检查
|
||||
Map<Integer,Integer> currentType = new HashMap<>(); //pos2type
|
||||
|
||||
for (Map.Entry<Integer, String> entry: hero.getSoulEquipByPositionMap().entrySet()) {
|
||||
|
||||
SoulEquip equip = user.getEquipManager().getSoulEquipMap().get(entry.getValue());
|
||||
|
@ -1448,15 +1435,15 @@ public class HeroLogic {
|
|||
if (null == cfg ) {
|
||||
throw new Exception("装备配置不存在" + equip.getCfgId());
|
||||
}
|
||||
currentType.put(entry.getKey(),cfg.getType());
|
||||
if(equipIds.size()!=6){
|
||||
currentType.put(entry.getKey(),cfg.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check same type
|
||||
//check pos 开启
|
||||
//条件不足 放过
|
||||
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
|
||||
if(!checkPosAccess(soulEquipPos.getPosition(),user,hero)){
|
||||
if (!checkPosAccess(soulEquipPos.getPosition(), user, hero)) {
|
||||
continue;
|
||||
}
|
||||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(soulEquipPos.getEquipId());
|
||||
|
@ -1464,32 +1451,32 @@ public class HeroLogic {
|
|||
throw new Exception("装备不存在" + soulEquipPos.getEquipId());
|
||||
}
|
||||
SEquipSign cfg = SEquipSign.getsEquipSignMap().get(soulEquip.getCfgId());
|
||||
if (null == cfg ) {
|
||||
if (null == cfg) {
|
||||
throw new Exception("装备配置不存在" + soulEquip.getCfgId());
|
||||
}
|
||||
|
||||
if(currentType.keySet().contains(soulEquipPos.getPosition())&¤tType.get(soulEquipPos.getPosition())!=cfg.getType()){
|
||||
if(currentType.values().contains(cfg.getType())){
|
||||
continue;
|
||||
}
|
||||
if (currentType.keySet().contains(soulEquipPos.getPosition())) {
|
||||
currentType.remove(soulEquipPos.getPosition());
|
||||
}
|
||||
currentType.put(soulEquipPos.getPosition(),cfg.getType());
|
||||
if (currentType.values().contains(cfg.getType())) {
|
||||
MessageUtil.sendErrorResponse(session, 0, MessageTypeProto.MessageType.SOUL_EQUIP_WEAR_RESPONSE_VALUE, "魂印类型重复");
|
||||
return;
|
||||
}
|
||||
currentType.put(soulEquipPos.getPosition(), cfg.getType());
|
||||
}
|
||||
|
||||
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
|
||||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(soulEquipPos.getEquipId());
|
||||
soulEquip.setHeroId(heroId);
|
||||
}
|
||||
|
||||
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
|
||||
if(hero.getSoulEquipByPositionMap().containsKey(soulEquipPos.getPosition())){
|
||||
if (hero.getSoulEquipByPositionMap().containsKey(soulEquipPos.getPosition())) {
|
||||
String id = hero.getSoulEquipByPositionMap().get(soulEquipPos.getPosition());
|
||||
SoulEquip oldEquip = user.getEquipManager().getSoulEquipMap().get(id);
|
||||
if (null != oldEquip && !oldEquip.getId().equals( soulEquipPos.getEquipId())) {
|
||||
SoulEquip oldEquip = user.getEquipManager().getSoulEquipMap().get(id);
|
||||
if (null != oldEquip && !oldEquip.getId().equals(soulEquipPos.getEquipId())) {
|
||||
oldEquip.setHeroId("");
|
||||
}
|
||||
}
|
||||
hero.updateSoulEquipPositionMap(soulEquipPos.getPosition(),soulEquipPos.getEquipId());
|
||||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(soulEquipPos.getEquipId());
|
||||
soulEquip.setHeroId(heroId);
|
||||
hero.updateSoulEquipPositionMap(soulEquipPos.getPosition(), soulEquipPos.getEquipId());
|
||||
}
|
||||
|
||||
//发送成功消息
|
||||
|
|
|
@ -274,20 +274,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
int uid = packetNetData.getUserId();
|
||||
int token = packetNetData.getToken();
|
||||
session.setUid(uid);
|
||||
String tokenKey = RedisKey.getKey(RedisKey.TOKEN, String.valueOf(uid),false);
|
||||
if(null==tokenKey||tokenKey.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
String tokenK = (String)RedisUtil.getInstence().get(tokenKey);
|
||||
if(null==tokenK||tokenK.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
int serverToken = Integer.parseInt((String)RedisUtil.getInstence().get(tokenKey));
|
||||
if (token == serverToken){
|
||||
session.setToken(token);
|
||||
session.setUserLoginTime(System.currentTimeMillis()/1000);
|
||||
return true;
|
||||
}
|
||||
session.setToken(token);
|
||||
session.setUserLoginTime(System.currentTimeMillis()/1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -303,10 +291,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
|
||||
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
||||
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||
return 0;
|
||||
}
|
||||
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)){
|
||||
if (message==null){
|
||||
//TODO error
|
||||
LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||
return 1;
|
||||
|
@ -346,27 +337,14 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
LOGGER.info("player offLine ...");
|
||||
ISession session = (ISession) gameSession;
|
||||
synchronized (session) {
|
||||
//输出日志
|
||||
// PrintStream ps= null;
|
||||
// try {
|
||||
// ps = new PrintStream("tmp/game.txt");
|
||||
// Map<MessageTypeProto.MessageType, String> gameMessageForLogin = ProtocolsManager.gameMessageForLogin;
|
||||
// for (Map.Entry<MessageTypeProto.MessageType, String> entry :gameMessageForLogin.entrySet()){
|
||||
// String value = entry.getValue();
|
||||
// ps.println(value);
|
||||
// }
|
||||
// ps.close();
|
||||
// } catch (FileNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
OnlineUserManager.userOffline(session.getUid());
|
||||
User user = UserManager.getUserInMem(session.getUid());
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,1);
|
||||
|
||||
LOGGER.info("player={} offLine ...",user.getId());
|
||||
if(session.getOfflineType() == ErrorCode.reloginCode){
|
||||
return;
|
||||
}
|
||||
|
@ -381,7 +359,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
|
||||
GameMessageHandler.currentSessions.remove(session.getUid());
|
||||
try {
|
||||
OnlineUserManager.userOffline(session.getUid());
|
||||
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
playerInfoManager.setOffLineTime(TimeUtils.now());
|
||||
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
|
||||
|
|
Loading…
Reference in New Issue