diff --git a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java index a45006813..b2ebe6bb4 100644 --- a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java +++ b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java @@ -102,10 +102,10 @@ public class CheckFight { args.set("maxRound",maxTime); LuaValue result = func.call( args,fightData,optionData); int status = result.get("result").toint(); - int duration = result.get("duration").toint(); + long duration = result.get("duration").tolong(); long[] resultCache = new long[8];//对方阵容走配置 Todo 后面结构走配置 - resultCache[0]= (long) status; - resultCache[1]= (long) duration; + resultCache[0]= status; + resultCache[1]= duration; LOGGER.info(" lua check test fight result : "+ status); for (int i = 1; i <= result.length(); i++) { long tolong = result.rawget(i).tolong(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/json/ConfMessage.java b/serverlogic/src/main/java/com/ljsd/jieling/config/json/ConfMessage.java index b5ca794e0..dc7d95adb 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/json/ConfMessage.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/json/ConfMessage.java @@ -20,7 +20,7 @@ public class ConfMessage { File file = new File("conf/plat-configure.json"); // File file = new File("C://ljsd/gameserver_new/conf/plat-configure.json"); if (!file.exists()) { - LOGGER.error("the file plat-configure.json is not exists"); +// LOGGER.error("the file plat-configure.json is not exists"); return; } InputStream in = new FileInputStream(file); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/globals/GlobalGm.java b/serverlogic/src/main/java/com/ljsd/jieling/globals/GlobalGm.java index 8105dbd55..85b44b7c5 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/globals/GlobalGm.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/globals/GlobalGm.java @@ -28,5 +28,6 @@ public interface GlobalGm { // int TECNOLOGY_MAX = 21;//科技树一键满级 // int POKEMAN_MAX = 22;//一键获得所有满级异妖 int HARD_STAGE =25;//一键通关山河社稷图特定关卡之前的所有关卡 + int FOUR_SPIRITS =26;//一键通关山河社稷图特定关卡之前的所有关卡 } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java index a37504c81..79f35308b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java @@ -60,7 +60,7 @@ public class GMRequestHandler extends BaseHandler{ CommonProto.GMCommand gmCommand = CommonProto.GMCommand.parseFrom(message); String command = gmCommand.getCommand(); int uid = iSession.getUid(); - LOGGER.error("gm commond is {}",command); + LOGGER.info("gm commond is {}",command); // if(command.startsWith("//check_fight")){ // FIGHT_LOGGER.error(command); // CommonProto.GmResponse.Builder gmBuilder = CommonProto.GmResponse.newBuilder(); @@ -97,9 +97,9 @@ public class GMRequestHandler extends BaseHandler{ MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true); return; } - if(!GameApplication.serverProperties.isDebug()){ - throw new ErrorCodeException("In a formal setting"); - } +// if(!GameApplication.serverProperties.isDebug()){ +// throw new ErrorCodeException("In a formal setting"); +// } if (!command.contains("#") || command.split("#").length < 3) { LOGGER.error("wrong command :" + command); return; @@ -456,6 +456,12 @@ public class GMRequestHandler extends BaseHandler{ HardStageLogic.test(cUser,id); HardStageLogic.sendHardStageIndication(cUser); break; + case GlobalGm.FOUR_SPIRITS: + //四灵试炼跳关 + prarm1 = Integer.parseInt(commandArray[1]); + prarm2 = Integer.parseInt(commandArray[2]); + cUser.getPlayerInfoManager().updateFourChallengeByIndex(prarm1, prarm2); + break; default: break; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengGetInfoRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengGetInfoRequestHandler.java index 4ed5d85a9..1feab5931 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengGetInfoRequestHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengGetInfoRequestHandler.java @@ -8,14 +8,14 @@ import rpc.protocols.HeroInfoProto; import rpc.protocols.MessageTypeProto; @Component -public class HongmengGetInfoRequestHandler extends BaseHandler { +public class HongmengGetInfoRequestHandler extends BaseHandler { @Override public MessageTypeProto.MessageType getMessageCode() { return MessageTypeProto.MessageType.HONGMENG_GET_INFO_REQUEST; } @Override - public void processWithProto(ISession session, HeroInfoProto.ResonanceRequest proto) throws Exception { - HeroLogic.getInstance().getHongmengInfo(session, MessageTypeProto.MessageType.HONGMENG_GET_INFO_RESPONSE); + public void processWithProto(ISession session, HeroInfoProto.GetHongmengInfoRequest proto) throws Exception { + HeroLogic.getInstance().addOrUpdateHongmeng(session, true); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java index b29d46c0a..9f98105aa 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java @@ -537,6 +537,9 @@ public class GlobalDataManaager implements IManager { public TimeControllerOfFunction getOpenTimeOfFuntionCacheByType(FunctionIdEnum functionIdEnum ) { + if (functionIdEnum == null){ + return null; + } List ids = SGlobalSystemConfig.idsByType.get(functionIdEnum.getFunctionType()); if(ids!=null && !ids.isEmpty()){ for(Integer id : ids){ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java index 65d911519..ede809c89 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java @@ -82,7 +82,7 @@ public enum ActivityTypeEnum { SUPERFUND328(ActivityType.SUPERFUND328,SuperFundActivity::new),//超值基金328 PREPARE_FIFTEEN_ACTIVITY(ActivityType.PREPARE_FIFTEEN_ACTIVITY,DefaultEmptyActivity::new),//超值基金328 THEME_ACTIVITY_SHOP(ActivityType.THEME_ACTIVITY_SHOP,DefaultEmptyActivity::new), - //XUN_BAO_MI_ZONG(ActivityType.XUN_BAO_MI_ZONG,XunBaoMiZongActivity::new) + XUN_BAO_MI_ZONG(ActivityType.XUN_BAO_MI_ZONG,XunBaoMiZongActivity::new) ; private int type; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/GuildMyInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/GuildMyInfo.java index 05ff019e2..bfb4e66f2 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/GuildMyInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/GuildMyInfo.java @@ -20,7 +20,7 @@ public class GuildMyInfo extends MongoBase { private long preMoveTimestamp; //上次更新时间 private int maxBossHurt; //工会boss最高伤害 private int lastHurt; //上一次伤害 - private Map deathMaxDamage = new HashMap<>(); + private Map deathMaxDamage = new HashMap<>(); //公会祭祀 private int fetetype;//祭祀类型 @@ -201,11 +201,11 @@ public class GuildMyInfo extends MongoBase { updateString("guildSkill",guildSkill); } - public Map getDeathMaxDamage() { + public Map getDeathMaxDamage() { return deathMaxDamage; } - public void setDeathMaxDamage(int pathId, int damage) { + public void setDeathMaxDamage(int pathId, Long damage) { deathMaxDamage.put(pathId,damage); updateString("deathMaxDamage",deathMaxDamage); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/CrossDeathPathLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/CrossDeathPathLogic.java index 3552a34a4..0d2b9912c 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/CrossDeathPathLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/CrossDeathPathLogic.java @@ -84,16 +84,17 @@ public class CrossDeathPathLogic { /** * 添加跨服排行 - * @param uid - * @param damage - * @param guildId - * @param pathId */ - void addCrossDeathPathRank(int uid, int damage, int guildId, int pathId) throws Exception { + void addCrossDeathPathRank(DeathPathTask task) throws Exception { + long damage = task.getDamage(); + int uid = task.getUid(); + int pathId = task.getPathId(); + int guildId = task.getGuildId(); + RedisUtil redisUtil = RedisUtil.getInstence(); //操作每个关的公会、个人数据 BigDecimal decimal = new BigDecimal(String.valueOf(damage)).divide(new BigDecimal(String.valueOf(Math.pow(10,15)))); - long everyGuildChangeScore = (long)damage*1000; + long everyGuildChangeScore = damage*1000; AbstractRank everyPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_EVERY_PERSON_RANK.getType()); if(redisUtil.getZSetScore(everyPerson.getCrossRedisKey(),String.valueOf(pathId), String.valueOf(uid), false)==-1){ //记录人数操作 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathLogic.java index b03c2c316..eae8b3e80 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathLogic.java @@ -361,7 +361,7 @@ public class DeathPathLogic { SGuildWarConfig config = STableManager.getConfig(SGuildWarConfig.class).get(pathId); PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.DEATH_PATH_TEAM, SGuildSetting.sGuildSetting.getWarTime(), "", GameFightType.DeathPathChallenge, config.getMonsterId(), 3); FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent); - int damage = (int) fightResult.getCheckResult()[1]; + long damage = fightResult.getCheckResult()[1]; CommonProto.FightData fightData = CommonProto.FightData.newBuilder() .setFightMaxTime(SGuildSetting.sGuildSetting.getWarTime()) .setFightSeed(fightResult.getSeed()) @@ -388,8 +388,8 @@ public class DeathPathLogic { RedisUtil.getInstence().putMapEntry(RedisKey.GUILD_INFO_CACHE,"",String.valueOf(guildId),guildInfoCache); CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getReward(), BIReason.DEATH_PATH_CHALLENGE); - Map deathMaxDamage = user.getGuildMyInfo().getDeathMaxDamage(); - int maxDamage = deathMaxDamage.getOrDefault(pathId, 0); + Map deathMaxDamage = user.getGuildMyInfo().getDeathMaxDamage(); + long maxDamage = deathMaxDamage.getOrDefault(pathId, 0L); Family.ChallengeDeathPathResponse response = Family.ChallengeDeathPathResponse.newBuilder().setDamage(damage).setFightData(fightData).setDrop(drop).setHistoryMax(maxDamage).build(); if(!deathMaxDamage.containsKey(pathId)||deathMaxDamage.get(pathId)0){ try { - CrossDeathPathLogic.getInstance().addCrossDeathPathRank(task.getUid(),task.getDamage(),task.getGuildId(),task.getPathId()); + CrossDeathPathLogic.getInstance().addCrossDeathPathRank(task); LOGGER.info("==================跨服十绝阵上榜处理:{}",task.toString()); } catch (Exception e) { LOGGER.error("==================跨服十绝阵上榜异常:{}",e.getMessage()); @@ -516,9 +516,9 @@ public class DeathPathLogic { .setPathId(pathId).setServerName(serverName).build(); Family.DeathPathFirstChangeIndication indication = Family.DeathPathFirstChangeIndication.newBuilder().setChangeInfo(info).build(); GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.DEATH_PATH_FIRST_CHANGE_INDICATION,indication); - }else{ + }/*else{ LOGGER.error("Exception公会信息为空,不能发送推送,公会id为{}",n.getValue()); - } + }*/ } LOGGER.info("信息修改,需要推送"); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathTask.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathTask.java index b3d636b8e..a32db07f4 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathTask.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/DeathPathTask.java @@ -10,13 +10,13 @@ public class DeathPathTask { private int guildId; - private int damage; + private long damage; private int pathId; private int groupId; - public DeathPathTask(int uid, int guildId, int damage, int pathId,int groupId) { + public DeathPathTask(int uid, int guildId, long damage, int pathId,int groupId) { this.uid = uid; this.guildId = guildId; this.damage = damage; @@ -40,11 +40,11 @@ public class DeathPathTask { this.guildId = guildId; } - public int getDamage() { + public long getDamage() { return damage; } - public void setDamage(int damage) { + public void setDamage(long damage) { this.damage = damage; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/passiveSkillCal/PassiveskillCalEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/passiveSkillCal/PassiveskillCalEnum.java index ddc7b67d2..36d02c635 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/passiveSkillCal/PassiveskillCalEnum.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/passiveSkillCal/PassiveskillCalEnum.java @@ -1,6 +1,8 @@ package com.ljsd.jieling.logic.fight.passiveSkillCal; import com.ljsd.jieling.core.GlobalsDef; +import com.ljsd.jieling.logic.dao.UserManager; +import com.ljsd.jieling.logic.dao.root.User; import config.SCHero; import config.SPropertyConfig; @@ -52,10 +54,15 @@ public enum PassiveskillCalEnum { heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+extraValue); }), HEROAFTER100ADD(171,(config,hero,heroSkillAdMap)->{ + int uid = Integer.parseInt(hero.getId().substring(0, 8)); + User user = UserManager.getUserInMem(uid); + if (user == null){ + return; + } float[] value = config.getValue(); int battlePropertyId = (int) value[0]; SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId); - int level = hero.getOriginalLevel(); + int level = hero.getLevel(user.getHeroManager()); int times=level-100; if(times<=0){ return; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroAttributeEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroAttributeEnum.java index e684c423a..688f357fc 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroAttributeEnum.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroAttributeEnum.java @@ -17,6 +17,10 @@ public enum HeroAttributeEnum { TreatFacter(58), DifferDemonsReduceFactor(59), AntiCritDamageFactor(60), + HP_ADD_PERCENT(61), // 血量 加成百分比 + ATTACK_ADD_PERCENT(62), // 攻击 加成百分比 + PHYSICAL_DEFENCE_ADD_PERCENT(63), // 护甲 加成百分比 + MAGIC_DEFENCE_ADD_PERCENT(64), // 魔抗 加成百分比 DifferDemonsBocusFactor(66), CurHpExtra(67), CurHpSpecialExtra(68), @@ -34,6 +38,7 @@ public enum HeroAttributeEnum { LandDamageReduceFactor(110), LightDamageReduceFactor(111), DarkDamageReduceFactor(112), + CritDamageReduceFactor(113), // 暴伤减免 EquipForce(9999), ; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index 119848b07..c04277657 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -2747,11 +2747,11 @@ public class HeroLogic{ public int calForce( Map heroAllAttribute ){ double result = 0; + // 旧战力计算 for(Map.Entry item : heroAllAttribute.entrySet()){ Integer propertyId = item.getKey(); float propertyValue = item.getValue(); if(propertyId == HeroAttributeEnum.EquipForce.getPropertyId()){ -// LOGGER.info("the equipScore={}",propertyValue); continue; } SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId); @@ -2761,9 +2761,52 @@ public class HeroLogic{ float score = sPropertyConfig.getScore(); result += propertyValue*score; -// LOGGER.info("the propertyId={} the value is ={},propertyValue={},score={},result ={},the value={}",propertyId,propertyValue*score,propertyValue,score,result,propertyValue*score); } -// System.out.println(result); + + +// SPropertyConfig sPropertyConfigHP = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.Hp.getPropertyId()); +// float hpScore = sPropertyConfigHP.getScore(); +// SPropertyConfig sPropertyConfigAttack = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.Attack.getPropertyId()); +// float attackScore = sPropertyConfigAttack.getScore(); +// SPropertyConfig sPropertyConfigPhysicalDefence = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.PhysicalDefence.getPropertyId()); +// float pdScore = sPropertyConfigPhysicalDefence.getScore(); +// SPropertyConfig sPropertyConfigMagicDefence = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.MagicDefence.getPropertyId()); +// float mdScore = sPropertyConfigMagicDefence.getScore(); +// +// // 新战力计算2021 9 17 +// // 面板最大生命值 +// float xishu = 10000; +// float finalHp = heroAllAttribute.getOrDefault(HeroAttributeEnum.Hp.getPropertyId(), 0L).floatValue(); +// // 面板攻击 +// float finalAttack = heroAllAttribute.getOrDefault(HeroAttributeEnum.Attack.getPropertyId(), 0L).floatValue(); +// // 面板护甲 +// float finalPhysicalDefence = heroAllAttribute.getOrDefault(HeroAttributeEnum.PhysicalDefence.getPropertyId(), 0L).floatValue(); +// // 面板魔抗 +// float magicDefence = heroAllAttribute.getOrDefault(HeroAttributeEnum.MagicDefence.getPropertyId(), 0L).floatValue(); +// // 伤害加成 +// float damageBocusFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.DamageBocusFactor.getPropertyId(), 0L).floatValue(); +// // 伤害减免 +// float damageReduceFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.DamageReduceFactor.getPropertyId(), 0L).floatValue(); +// // 命中几率 +// float hit = heroAllAttribute.getOrDefault(HeroAttributeEnum.Hit.getPropertyId(), 0L).floatValue(); +// // 闪避几率 +// float dodge = heroAllAttribute.getOrDefault(HeroAttributeEnum.Dodge.getPropertyId(), 0L).floatValue(); +// // 暴击几率 +// float critFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.CritFactor.getPropertyId(), 0L).floatValue(); +// // 抗暴几率 +// float antiCritDamageFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.AntiCritDamageFactor.getPropertyId(), 0L).floatValue(); +// // 暴伤加成 +// float critDamageFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.CritDamageFactor.getPropertyId(), 0L).floatValue(); +// // 暴伤减免 +// float critDamageReduceFactor = heroAllAttribute.getOrDefault(HeroAttributeEnum.CritDamageReduceFactor.getPropertyId(), 0L).floatValue(); +// // 受疗加成 +// float cureFacter = heroAllAttribute.getOrDefault(HeroAttributeEnum.CureFacter.getPropertyId(), 0L).floatValue(); +// // 治疗加成 +// float treatFacter = heroAllAttribute.getOrDefault(HeroAttributeEnum.TreatFacter.getPropertyId(), 0L).floatValue(); +// +// result = (finalHp * hpScore + finalAttack * attackScore + finalPhysicalDefence * pdScore + magicDefence * mdScore) +// * (1 + (damageBocusFactor + damageReduceFactor + hit + dodge + critFactor + +// antiCritDamageFactor + critDamageFactor + critDamageReduceFactor + cureFacter + treatFacter) / 2 / xishu); return (int)result; } @@ -4316,243 +4359,236 @@ public class HeroLogic{ if(isInTeam(user,heroId,1)){ Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid())); } - - MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); } // ================================共鸣、鸿蒙碑========================= // /** - * 获取鸿蒙阵信息 + * 推送鸿蒙阵信息 * @param session - * @param messageType * @throws Exception */ - public void getHongmengInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception { - // 刷新鸿蒙阵 - addOrUpdateHongmeng(session); - - HeroInfoProto.GetHongmengInfoResponse getHongmengInfoResponse = HeroInfoProto.GetHongmengInfoResponse.newBuilder().build(); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), getHongmengInfoResponse); + public void addOrUpdateHongmeng(ISession session) throws Exception { + addOrUpdateHongmeng(session,false); } /** * 添加或更新鸿蒙守卫 * @param session + * @param judge true:返回,false:推送 */ - public void addOrUpdateHongmeng(ISession session) throws Exception { + public void addOrUpdateHongmeng(ISession session, boolean judge) throws Exception { User user = UserManager.getUser(session.getUid()); + HeroInfoProto.HongmengInfoIndication.Builder hongmengInfoIndication = HeroInfoProto.HongmengInfoIndication.newBuilder(); - // 鸿蒙阵开启条件 SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.HongMeng.getFunctionType()); boolean open = HandlerLogicThread.checkOpen(user, sGlobalSystemConfig); - if (!open) { - return; - } + // 鸿蒙阵开启条件 + if (open) { + /** ========================== 共鸣信息初始化 =========================== **/ + // 限制表 鸿蒙守卫数量#鸿蒙碑使者等级 + String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#"); - /** ========================== 共鸣信息初始化 =========================== **/ - // 限制表 鸿蒙守卫数量#鸿蒙碑使者等级 - String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#"); + Map hongmengs = new HashMap<>(Integer.parseInt(openLevel[0])); + int defaultValue = 1000; + // 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 -1:不用卸下装备,其他表示装备星级 + HongMengAddAttribute hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue); + // 只要任意鸿蒙守卫未穿戴魂宝/灵宝,或强化等级为0,便不会触发对应宝物的共鸣 + HongMengAddAttribute soulEquip = new HongMengAddAttribute(0, defaultValue); + HongMengAddAttribute spiritEquip = new HongMengAddAttribute(0, defaultValue); - Map hongmengs = new HashMap<>(Integer.parseInt(openLevel[0])); - int defaultValue = 1000; - // 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 -1:不用卸下装备,其他表示装备星级 - HongMengAddAttribute hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue); - // 只要任意鸿蒙守卫未穿戴魂宝/灵宝,或强化等级为0,便不会触发对应宝物的共鸣 - HongMengAddAttribute soulEquip = new HongMengAddAttribute(0, defaultValue); - HongMengAddAttribute spiritEquip = new HongMengAddAttribute(0, defaultValue); + // 共鸣等级=鸿蒙守卫中最低的等级 + HongMengAddAttribute resonanceLevel = new HongMengAddAttribute(0, defaultValue); - // 共鸣等级=鸿蒙守卫中最低的等级 - HongMengAddAttribute resonanceLevel = new HongMengAddAttribute(0, defaultValue); + // 共鸣法宝=鸿蒙守卫中法宝强化最低等级 + HongMengAddAttribute especialEquipLevel = new HongMengAddAttribute(0, defaultValue); - // 共鸣法宝=鸿蒙守卫中法宝强化最低等级 - HongMengAddAttribute especialEquipLevel = new HongMengAddAttribute(0, defaultValue); + /** ========================== 开始处理玩家信息,更 =========================== **/ + HeroManager heroManager = user.getHeroManager(); + // 共鸣英雄池 + Map resonances = heroManager.getResonances(); + // 第一个格子免费开启 + if (!resonances.containsKey(1)) { + resonances.put(1, ""); + heroManager.setResonances(resonances); + // 成就任务 + user.getUserMissionManager().onGameEvent(user,GameEvent.HONGMENG_RESONANCE_LATTICE,resonances.size()); + } - /** ========================== 开始处理玩家信息,更 =========================== **/ - HeroManager heroManager = user.getHeroManager(); - // 共鸣英雄池 - Map resonances = heroManager.getResonances(); - // 第一个格子免费开启 - if (!resonances.containsKey(1)) { - resonances.put(1, ""); - heroManager.setResonances(resonances); - // 成就任务 - user.getUserMissionManager().onGameEvent(user,GameEvent.HONGMENG_RESONANCE_LATTICE,resonances.size()); - } + // 获取玩家全部英雄 + Collection values = heroManager.getHeroMap().values(); + List heroes = new ArrayList<>(values); - // 获取玩家全部英雄 - Collection values = heroManager.getHeroMap().values(); - List heroes = new ArrayList<>(values); + // 是否开启鸿蒙碑 + int tabletMax = 0; + // 是否为鸿蒙碑 + if (heroManager.getHongmengTablet() > 0){ + // 等级 + resonanceLevel.value = heroManager.getHongmengTablet(); + tabletMax = heroManager.getHongmengMaxLevelByInt(); + }else { + // 玩家英雄背包按等级排序 + Collections.sort(heroes); - // 是否开启鸿蒙碑 - int tabletMax = 0; - // 是否为鸿蒙碑 - if (heroManager.getHongmengTablet() > 0){ - // 等级 - resonanceLevel.value = heroManager.getHongmengTablet(); - tabletMax = heroManager.getHongmengMaxLevelByInt(); - }else { - // 玩家英雄背包按等级排序 - Collections.sort(heroes); + for (int i = 0; i < heroes.size(); i++) { + Hero hero = heroes.get(i); + resonances.forEach((k,v)->{ + if (v.equals(hero.getId())){ + try { + // 共鸣格子更新 + unLoadResonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, k, 0); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + // 是否开启鸿蒙碑 + if (hero.getOriginalLevel() >= Integer.parseInt(openLevel[1])) { + tabletMax++; + } + // 等级 + hongmengLevel(resonanceLevel, hero); + hongmengs.put(i+1, hero.getId()); + if (hongmengs.size() >= Integer.parseInt(openLevel[0])) { + break; + } + } - for (int i = 0; i < heroes.size(); i++) { - Hero hero = heroes.get(i); - resonances.forEach((k,v)->{ - if (v.equals(hero.getId())){ - try { - // 共鸣格子更新 - unLoadResonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, k, 0); - } catch (Exception e) { - e.printStackTrace(); + // 更新鸿蒙使者 + heroManager.setHongmengGuards(hongmengs); + + // 鸿蒙碑,觉醒限制 + if (tabletMax >= Integer.parseInt(openLevel[0]) && heroManager.getHongmengTablet() == 0) { + // 开启鸿蒙碑 + heroManager.setHongmengTablet(Integer.parseInt(openLevel[1])); + for (String resetLevelId : heroManager.getHongmengGuards().values()) { + Hero hero = heroManager.getHero(resetLevelId); + if (hero == null) { + continue; + } + hero.setLevel(1); + hero.setBreakId(0); + } + // 初始化鸿蒙碑等级上限 + for (Hero hero:heroes){ + if (hero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) { + heroManager.addHongmengMaxLevel(hero.getTemplateId()); } } - }); - // 是否开启鸿蒙碑 - if (hero.getOriginalLevel() >= Integer.parseInt(openLevel[1])) { - tabletMax++; - } - // 等级 - hongmengLevel(resonanceLevel, hero); - hongmengs.put(i+1, hero.getId()); - if (hongmengs.size() >= Integer.parseInt(openLevel[0])) { - break; + tabletMax = heroManager.getHongmengMaxLevelByInt(); + resonanceLevel.heroTid = 0; + resonanceLevel.value = heroManager.getHongmengTablet(); + + // 鸿蒙碑新手引导推送 + HeroInfoProto.HongmengSteleNewHandIndication.Builder builder = HeroInfoProto.HongmengSteleNewHandIndication.newBuilder().setState(1); + MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_STELE_NEW_HAND_INDICATION.getNumber(),builder.build(),true); } } - // 更新鸿蒙使者 - heroManager.setHongmengGuards(hongmengs); - - // 鸿蒙碑,觉醒限制 - if (tabletMax >= Integer.parseInt(openLevel[0]) && heroManager.getHongmengTablet() == 0) { - // 开启鸿蒙碑 - heroManager.setHongmengTablet(Integer.parseInt(openLevel[1])); - for (String resetLevelId : heroManager.getHongmengGuards().values()) { - Hero hero = heroManager.getHero(resetLevelId); - if (hero == null) { - continue; - } - hero.setLevel(1); - hero.setBreakId(0); - } - // 初始化鸿蒙碑等级上限 - for (Hero hero:heroes){ - if (hero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) { - heroManager.addHongmengMaxLevel(hero.getTemplateId()); - } - } - tabletMax = heroManager.getHongmengMaxLevelByInt(); - resonanceLevel.heroTid = 0; - resonanceLevel.value = heroManager.getHongmengTablet(); - - // 鸿蒙碑新手引导推送 - HeroInfoProto.HongmengSteleNewHandIndication.Builder builder = HeroInfoProto.HongmengSteleNewHandIndication.newBuilder().setState(1); - MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_STELE_NEW_HAND_INDICATION.getNumber(),builder.build(),true); - } - } - - // 不够6个无法开启鸿蒙阵 + // 不够6个无法开启鸿蒙阵 /*if (hongmengs.size() < Integer.parseInt(openLevel[0])) { return; }*/ - // 守卫/使者英雄池 - Map guards = heroManager.getHongmengGuards(); - // 英雄装备 - Map equipMap = user.getEquipManager().getEquipMap(); + // 守卫/使者英雄池 + Map guards = heroManager.getHongmengGuards(); + // 英雄装备 + Map equipMap = user.getEquipManager().getEquipMap(); - if (guards.size() >= Integer.parseInt(openLevel[0])){ - for (int i = 0; i < guards.size(); i++) { - Hero hero = user.getHeroManager().getHero(guards.get(i+1)); - if (hero == null){ - // 找不到英雄,不存在这些共鸣属性 - hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue); - soulEquip = new HongMengAddAttribute(0, defaultValue); - spiritEquip = new HongMengAddAttribute(0, defaultValue); - especialEquipLevel = new HongMengAddAttribute(0, defaultValue); - break; + if (guards.size() >= Integer.parseInt(openLevel[0])){ + for (int i = 0; i < guards.size(); i++) { + Hero hero = user.getHeroManager().getHero(guards.get(i+1)); + if (hero == null){ + // 找不到英雄,不存在这些共鸣属性 + hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue); + soulEquip = new HongMengAddAttribute(0, defaultValue); + spiritEquip = new HongMengAddAttribute(0, defaultValue); + especialEquipLevel = new HongMengAddAttribute(0, defaultValue); + break; + } + // 装备 + hongmengEquip(hongMengAddAttributeEquip, hero); + // 魂宝 灵宝 + soulOrSpirit(soulEquip, 1, equipMap, hero); + soulOrSpirit(spiritEquip, 2, equipMap, hero); + // 法宝 + especialAdd(especialEquipLevel, hero); } - // 装备 - hongmengEquip(hongMengAddAttributeEquip, hero); - // 魂宝 灵宝 - soulOrSpirit(soulEquip, 1, equipMap, hero); - soulOrSpirit(spiritEquip, 2, equipMap, hero); - // 法宝 - especialAdd(especialEquipLevel, hero); } - } - /*** ============================= 计算共鸣信息 ==================================== **/ - Map resonanceAddition = heroManager.getResonanceAddition(); - resonanceAddition.clear(); - if (resonanceLevel.value == defaultValue) { - resonanceLevel.value = -1; - } - if (hongMengAddAttributeEquip.value == defaultValue) { - hongMengAddAttributeEquip.value = -1; - } - if (soulEquip.value == defaultValue) { - soulEquip.value = -1; - } - if (spiritEquip.value == defaultValue) { - spiritEquip.value = -1; - } - if (especialEquipLevel.value == defaultValue) { - especialEquipLevel.value = -1; - } - resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel); - resonanceAddition.put(HongMengAttributeEnum.EQUIP, hongMengAddAttributeEquip); - resonanceAddition.put(HongMengAttributeEnum.SOUL_EQUIP, soulEquip); - resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip); - resonanceAddition.put(HongMengAttributeEnum.MAGIC_WEAPON, especialEquipLevel); - heroManager.setResonanceAddition(resonanceAddition); + /*** ============================= 计算共鸣信息 ==================================== **/ + Map resonanceAddition = heroManager.getResonanceAddition(); + resonanceAddition.clear(); + if (resonanceLevel.value == defaultValue) { + resonanceLevel.value = -1; + } + if (hongMengAddAttributeEquip.value == defaultValue) { + hongMengAddAttributeEquip.value = -1; + } + if (soulEquip.value == defaultValue) { + soulEquip.value = -1; + } + if (spiritEquip.value == defaultValue) { + spiritEquip.value = -1; + } + if (especialEquipLevel.value == defaultValue) { + especialEquipLevel.value = -1; + } + resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel); + resonanceAddition.put(HongMengAttributeEnum.EQUIP, hongMengAddAttributeEquip); + resonanceAddition.put(HongMengAttributeEnum.SOUL_EQUIP, soulEquip); + resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip); + resonanceAddition.put(HongMengAttributeEnum.MAGIC_WEAPON, especialEquipLevel); + heroManager.setResonanceAddition(resonanceAddition); - /*** ============================= 开始组装鸿蒙阵信息 ==================================== **/ - // 当前时间,秒 - long now = TimeUtils.now()/1000; - // 鸿蒙守卫 - List hongmengGuardsProto = new ArrayList<>(); - Map hongmengGuards = heroManager.getHongmengGuards(); - Map hongmengGuardTime = heroManager.getHongmengGuardTime(); - for (Map.Entry entry : hongmengGuards.entrySet()) { - HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder() - .setGridId(entry.getKey()) - .setHeroId(entry.getValue()) - .setTime(hongmengGuardTime.containsKey(entry.getKey()) ? (hongmengGuardTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengGuardTime.get(entry.getKey()) - now)) : 0) - .build(); - hongmengGuardsProto.add(hongmengHeroInfo); + /*** ============================= 开始组装鸿蒙阵信息 ==================================== **/ + // 当前时间,秒 + long now = TimeUtils.now()/1000; + // 鸿蒙守卫 + List hongmengGuardsProto = new ArrayList<>(); + Map hongmengGuards = heroManager.getHongmengGuards(); + Map hongmengGuardTime = heroManager.getHongmengGuardTime(); + for (Map.Entry entry : hongmengGuards.entrySet()) { + HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder() + .setGridId(entry.getKey()) + .setHeroId(entry.getValue()) + .setTime(hongmengGuardTime.containsKey(entry.getKey()) ? (hongmengGuardTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengGuardTime.get(entry.getKey()) - now)) : 0) + .build(); + hongmengGuardsProto.add(hongmengHeroInfo); + } + // 共鸣属性 + List hongmengAdditions = new ArrayList<>(); + for (Map.Entry entry : resonanceAddition.entrySet()) { + HeroInfoProto.HongmengAddition hongmengAddition = HeroInfoProto.HongmengAddition + .newBuilder() + .setAdditionType(entry.getKey().getPropertyId()) + .setValue(entry.getValue().value) + .setHeroTid(entry.getValue().heroTid) + .build(); + hongmengAdditions.add(hongmengAddition); + } + // 共鸣使者 + List hongmengResonancesProto = new ArrayList<>(); + Map hongmengResonances = heroManager.getResonances(); + Map hongmengResonanceTime = heroManager.getResonancesTime(); + for (Map.Entry entry : hongmengResonances.entrySet()) { + HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder() + .setGridId(entry.getKey()) + .setHeroId(entry.getValue()) + .setTime(hongmengResonanceTime.containsKey(entry.getKey()) ? (hongmengResonanceTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengResonanceTime.get(entry.getKey()) - now)) : 0) + .build(); + hongmengResonancesProto.add(hongmengHeroInfo); + } + hongmengInfoIndication.addAllHongmengGuards(hongmengGuardsProto).addAllHongmengAdditions(hongmengAdditions) + .addAllHongmengResonacnes(hongmengResonancesProto).setHongmengTabletMax(tabletMax).build(); } - // 共鸣属性 - List hongmengAdditions = new ArrayList<>(); - for (Map.Entry entry : resonanceAddition.entrySet()) { - HeroInfoProto.HongmengAddition hongmengAddition = HeroInfoProto.HongmengAddition - .newBuilder() - .setAdditionType(entry.getKey().getPropertyId()) - .setValue(entry.getValue().value) - .setHeroTid(entry.getValue().heroTid) - .build(); - hongmengAdditions.add(hongmengAddition); + // 返回协议 + if (judge){ + MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_GET_INFO_RESPONSE_VALUE, hongmengInfoIndication.build(), true); + }else { + MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION_VALUE,hongmengInfoIndication.build(),true); } - // 共鸣使者 - List hongmengResonancesProto = new ArrayList<>(); - Map hongmengResonances = heroManager.getResonances(); - Map hongmengResonanceTime = heroManager.getResonancesTime(); - for (Map.Entry entry : hongmengResonances.entrySet()) { - HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder() - .setGridId(entry.getKey()) - .setHeroId(entry.getValue()) - .setTime(hongmengResonanceTime.containsKey(entry.getKey()) ? (hongmengResonanceTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengResonanceTime.get(entry.getKey()) - now)) : 0) - .build(); - hongmengResonancesProto.add(hongmengHeroInfo); - } - HeroInfoProto.HongmengInfoIndication hongmengInfoIndication = HeroInfoProto.HongmengInfoIndication.newBuilder() - .addAllHongmengGuards(hongmengGuardsProto) - .addAllHongmengAdditions(hongmengAdditions) - .addAllHongmengResonacnes(hongmengResonancesProto) - .setHongmengTabletMax(tabletMax) - .build(); - - MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION.getNumber(),hongmengInfoIndication,true); } /**