diff --git a/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java b/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java index a3e0fa2c3..c9c843df9 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java @@ -298,8 +298,4 @@ public interface BIReason { int SKIN_USE_CONSUME = 1073;//激活皮肤消耗 int SUB_ACTIVITY_CONSUME = 1074;//易经宝库 int SUB_ACTIVITY_CONSUME_FINISH = 1075;//易经宝库活动结束补发消耗 - - int OPEN_HONGMENG_GRAID = 1076; // 开鸿蒙阵格子消耗 - int CLEAR_HONGMENG_GRAID = 1077; // 清鸿蒙阵格子cd - int HONGMENG_UPGRIDE = 1078; // 鸿蒙碑升级消耗 } \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java index f64bb2df4..ea684f496 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java @@ -20,7 +20,6 @@ import com.ljsd.jieling.logic.activity.event.UserOnlineEvent; import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.root.GlobalSystemControl; import com.ljsd.jieling.logic.dao.root.User; -import com.ljsd.jieling.logic.hero.HongMengAttributeEnum; import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.logic.question.QuestionLogic; @@ -78,8 +77,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ BuyGoodsLogic.initOwernBagInfo(user); // Poster.getPoster().dispatchEvent(new UserOnlineEvent(userId)); user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0); - long now = TimeUtils.now(); - playerInfoManager.setLoginTime(now); + playerInfoManager.setLoginTime(TimeUtils.now()); Map guidePoints = playerInfoManager.getGuidePoints(); Map vipInfo = playerInfoManager.getVipInfo(); List list = new ArrayList<>(); @@ -121,8 +119,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ .setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum()) .setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build(); RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo(); - HeroManager heroManager = user.getHeroManager(); - Map totalCountMap = heroManager.getTotalCount(); + Map totalCountMap = user.getHeroManager().getTotalCount(); int alreadyCount =0; for(Integer id : STableManager.getFigureConfig(HeroStaticConfig.class).getRandomHeroIds()){ Integer count = totalCountMap.get(id); @@ -147,7 +144,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ questState=user.getQuestionManager().getQuestState(); } //图鉴信息 - Map heroHandBook = heroManager.getHeroHandBook(); + Map heroHandBook = user.getHeroManager().getHeroHandBook(); List heroHandBookList = new ArrayList<>(); heroHandBook.forEach((k,v)->heroHandBookList.add(CommonProto.EveryHeroHandBook.newBuilder().setHeroId(k).setMaxStar(v).build())); @@ -189,27 +186,8 @@ public class GetPlayerInfoHandler extends BaseHandler{ user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000)); Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID)); } - List hongmengHeroInfos = new ArrayList<>(); - Map resonances = heroManager.getResonances(); - Map resonancesTime = heroManager.getResonancesTime(); - for (Map.Entry entry : resonances.entrySet()) { - PlayerInfoProto.HongmengHeroInfo hongmengHeroInfo = PlayerInfoProto.HongmengHeroInfo.newBuilder() - .setGridId(entry.getKey()) - .setHeroId(entry.getValue()) - .setTime(resonancesTime.containsKey(entry.getKey()) ? (resonancesTime.get(entry.getKey()) - now < 0 ? 0 : (resonancesTime.get(entry.getKey()) - now) / 1000) : 0) - .build(); - hongmengHeroInfos.add(hongmengHeroInfo); - } - List hongmengAdditions = new ArrayList<>(); - Map resonanceAddition = heroManager.getResonanceAddition(); - for (Map.Entry entry : resonanceAddition.entrySet()) { - PlayerInfoProto.HongmengAddition hongmengAddition = PlayerInfoProto.HongmengAddition - .newBuilder() - .setAdditionType(entry.getKey().getPropertyId()) - .setValue(entry.getValue()) - .build(); - hongmengAdditions.add(hongmengAddition); - } + + StoreLogic.reloadStoreInfo(user,7);//重载功能商店 PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder() @@ -229,7 +207,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ .setTreasureLevel(playerInfoManager.getTreasureLevel()) .setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(playerInfoManager.getSign()+1).setState(playerInfoManager.getSignTotay()).build()) .setMonsterAttackTime(user.getMapManager().getLastMonsterAttack()) - .setFirstTenth(heroManager.getFirstTenth()) + .setFirstTenth(user.getHeroManager().getFirstTenth()) .setIsDayFirst(playerInfoManager.getIsdayFirst()) .setEndInfo(endless) .setPlayerBindPhone(playerBindPhone) @@ -244,10 +222,6 @@ public class GetPlayerInfoHandler extends BaseHandler{ .setExpeditionLeve(user.getExpeditionManager().getExpeditionLeve()) .setHadLuckTime( user.getPlayerInfoManager().getLuckWheelLimitTime()) .setHadAdvanceLuckTime(user.getPlayerInfoManager().getLuckAdvanceWheelLimitTime()) - .addAllHongmengGuards(heroManager.getHongmengGuard()) - .setHongmengTablet(heroManager.getHongmengTablet()) - .addAllHongmengHeroInfos(hongmengHeroInfos) - .addAllHongmengAdditions(hongmengAdditions) .build(); ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType()); try { diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengCleanTimeRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengCleanTimeRequestHandler.java deleted file mode 100644 index 7a561a257..000000000 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengCleanTimeRequestHandler.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ljsd.jieling.handler.hero; - -import com.ljsd.jieling.handler.BaseHandler; -import com.ljsd.jieling.logic.hero.HeroLogic; -import com.ljsd.jieling.network.session.ISession; -import com.ljsd.jieling.protocols.HeroInfoProto; -import com.ljsd.jieling.protocols.MessageTypeProto; -import org.springframework.stereotype.Component; - -@Component -public class HongmengCleanTimeRequestHandler extends BaseHandler { - @Override - public MessageTypeProto.MessageType getMessageCode() { - return MessageTypeProto.MessageType.HONGMENG_CLEAN_TIME_RESQUEST; - } - - @Override - public void processWithProto(ISession session, HeroInfoProto.CleanResonanceTimeRequest proto) throws Exception { - int gridId = proto.getGridId(); - HeroLogic.getInstance().cleanTime(session, MessageTypeProto.MessageType.HONGMENG_CLEAN_TIME_RESPONSE, gridId); - } -} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengOpenResonanceRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengOpenResonanceRequestHandler.java deleted file mode 100644 index 9ee1869a6..000000000 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengOpenResonanceRequestHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ljsd.jieling.handler.hero; - -import com.ljsd.jieling.handler.BaseHandler; -import com.ljsd.jieling.logic.hero.HeroLogic; -import com.ljsd.jieling.network.session.ISession; -import com.ljsd.jieling.protocols.HeroInfoProto; -import com.ljsd.jieling.protocols.MessageTypeProto; -import org.springframework.stereotype.Component; - -@Component -public class HongmengOpenResonanceRequestHandler extends BaseHandler { - @Override - public MessageTypeProto.MessageType getMessageCode() { - return MessageTypeProto.MessageType.HONGMENG_OPEN_RESONANCE_REQUEST; - } - - @Override - public void processWithProto(ISession session, HeroInfoProto.OpenResonanceRequest proto) throws Exception { - HeroLogic.getInstance().openResonance(session, MessageTypeProto.MessageType.HONGMENG_OPEN_RESONANCE_RESPONSE, proto.getGridId()); - } -} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengResonanceRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengResonanceRequestHandler.java deleted file mode 100644 index 4a6d523c1..000000000 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengResonanceRequestHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.ljsd.jieling.handler.hero; - -import com.ljsd.jieling.handler.BaseHandler; -import com.ljsd.jieling.logic.hero.HeroLogic; -import com.ljsd.jieling.network.session.ISession; -import com.ljsd.jieling.protocols.HeroInfoProto; -import com.ljsd.jieling.protocols.MessageTypeProto; -import org.springframework.stereotype.Component; - -@Component -public class HongmengResonanceRequestHandler extends BaseHandler { - @Override - public MessageTypeProto.MessageType getMessageCode() { - return MessageTypeProto.MessageType.HONGMENG_RESONANCE_REQUEST; - } - - @Override - public void processWithProto(ISession session, HeroInfoProto.ResonanceRequest proto) throws Exception { - if (proto.getType() == 1) { - HeroLogic.getInstance().resonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, proto.getHeroId(), proto.getGridId()); - } else { - HeroLogic.getInstance().unLoadResonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, proto.getGridId()); - } - } -} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengUpgradRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengUpgradRequestHandler.java deleted file mode 100644 index 048683baf..000000000 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/hero/HongmengUpgradRequestHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ljsd.jieling.handler.hero; - -import com.google.protobuf.GeneratedMessage; -import com.ljsd.jieling.handler.BaseHandler; -import com.ljsd.jieling.logic.hero.HeroLogic; -import com.ljsd.jieling.network.session.ISession; -import com.ljsd.jieling.protocols.MessageTypeProto; -import org.springframework.stereotype.Component; - -@Component -public class HongmengUpgradRequestHandler extends BaseHandler { - @Override - public MessageTypeProto.MessageType getMessageCode() { - return MessageTypeProto.MessageType.HONGMENG_UPGRADE_REQUEST; - } - - @Override - public void processWithProto(ISession iSession, GeneratedMessage proto) throws Exception { - HeroLogic.getInstance().updateHongmengTablet(iSession, MessageTypeProto.MessageType.HONGMENG_UPGRADE_RESPONSE); - } -} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java index 86764eccd..602be14da 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java @@ -1,13 +1,13 @@ package com.ljsd.jieling.logic.dao; import com.ljsd.common.mogodb.MongoBase; +import com.ljsd.jieling.db.mongo.MongoKey; import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.activity.event.RemoveHeroEvent; import com.ljsd.jieling.logic.dao.root.User; -import com.ljsd.jieling.logic.hero.HongMengAttributeEnum; -import org.luaj.vm2.ast.Str; -import java.util.*; +import java.util.HashMap; +import java.util.Map; public class HeroManager extends MongoBase { @@ -30,19 +30,6 @@ public class HeroManager extends MongoBase { this.setRootCollection(User._COLLECTION_NAME); } - // 鸿蒙守卫 - private List hongmengGuard = new ArrayList<>(); - // 共鸣英雄<格子id,英雄id> - private Map resonances = new HashMap<>(); - // 共鸣英雄<格子id,冷却时间> - private Map resonancesTime = new HashMap<>(); - // 共鸣加成 - private Map resonanceAddition = new HashMap<>(); - // 鸿蒙碑等级 - private int hongmengTablet; - // 鸿蒙碑最大等级 - private Set hongmengMaxLevel = new HashSet<>(); - public void updateRandCount(int type,int count){ updateString("totalCount." + type, count); totalCount.put(type,count); @@ -142,64 +129,5 @@ public class HeroManager extends MongoBase { skinInfo.remove(skinId); removeString(getMongoKey()+"skinInfo."+skinId); } - - public List getHongmengGuard() { - return hongmengGuard; - } - - public void setHongmengGuard(List hongmengGuard) { - this.hongmengGuard = hongmengGuard; - updateString("hongmengGuard", hongmengGuard); - } - - public Map getResonances() { - return resonances; - } - - public void setResonances(Map resonances) { - this.resonances = resonances; - updateString("resonances", resonances); - } - - public void updateResonances(int index, String heroId) { - this.resonances.put(index, heroId); - updateString("resonances."+ index, heroId); - } - - public Map getResonancesTime() { - return resonancesTime; - } - - public void updateResonancesTime(int index, long time) { - this.resonancesTime.put(index, time); - updateString("resonancesTime."+ index, time); - } - - public Map getResonanceAddition() { - return resonanceAddition; - } - - public void setResonanceAddition(Map resonanceAddition) { - this.resonanceAddition = resonanceAddition; - updateString("resonanceAddition", resonanceAddition); - } - - public int getHongmengTablet() { - return hongmengTablet; - } - - public void setHongmengTablet(int hongmengTablet) { - this.hongmengTablet = hongmengTablet; - updateString("hongmengTablet", hongmengTablet); - } - - public Set getHongmengMaxLevel() { - return hongmengMaxLevel; - } - - public void setHongmengMaxLevel(Set hongmengMaxLevel) { - this.hongmengMaxLevel = hongmengMaxLevel; - updateString("hongmengMaxLevel", hongmengMaxLevel); - } } 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 b87c419c7..10b901d2a 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 @@ -1,15 +1,18 @@ package com.ljsd.jieling.logic.hero; +import com.ljsd.GameApplication; import com.ljsd.jieling.chat.logic.ChatLogic; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig; import com.ljsd.jieling.core.GlobalsDef; +import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.exception.ErrorCode; import com.ljsd.jieling.exception.ErrorCodeException; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.Global; + import com.ljsd.jieling.globals.GlobalItemType; import com.ljsd.jieling.jbean.ActivityMission; import com.ljsd.jieling.jbean.ActivityProgressInfo; @@ -26,6 +29,7 @@ import com.ljsd.jieling.logic.fight.CombatLogic; import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum; import com.ljsd.jieling.logic.item.ItemLogic; import com.ljsd.jieling.logic.mission.GameEvent; +import com.ljsd.jieling.logic.mission.MissionLoigc; import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.network.server.ProtocolsManager; import com.ljsd.jieling.network.session.ISession; @@ -36,6 +40,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto; import com.ljsd.jieling.util.*; import config.*; import manager.STableManager; +import org.luaj.vm2.ast.Str; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import util.MathUtils; @@ -46,6 +51,7 @@ import java.math.BigDecimal; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; public class HeroLogic{ @@ -3266,6 +3272,7 @@ public class HeroLogic{ * 灵兽涅槃 * @param session * @param pokemonId + * @param level * @param messageType * @throws Exception */ @@ -3400,287 +3407,4 @@ public class HeroLogic{ MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); } - - // ================共鸣、鸿蒙碑========= - /** - * 添加或更新鸿蒙守卫 - * @param user - */ - public void addOrUpdateHongmeng(User user) { - if (user.getPlayerInfoManager().getLevel() < SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_OPENLEVEL)) { - return; - } - HeroManager heroManager = user.getHeroManager(); - Collection values = heroManager.getHeroMap().values(); - List heroes = new ArrayList<>(values); - Collections.sort(heroes, new Comparator() { - @Override - public int compare(Hero hero1, Hero hero2) { - int compareValue = hero1.getLevel() - hero2.getLevel(); - if (compareValue != 0) { - return compareValue; - } - return Integer.compare(hero1.getStar(), hero2.getStar()); - } - }); - List hongmengs = heroManager.getHongmengGuard(); - hongmengs.clear(); - // 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 1:不卸下装备 - int isUnloadEquip = 1; - - // 只要任意鸿蒙守卫未穿戴魂宝/灵宝,或强化等级为0,便不会触发对应宝物的共鸣 - int soulEquip = 1000; - int spiritEquip = 1000; - - // 共鸣等级=鸿蒙守卫中最低的等级 - int resonanceLevel = 1000; - - // 共鸣法宝=鸿蒙守卫中法宝强化最低等级 - int especialEquipLevel = 100; - - // 是否开启鸿蒙碑 - int tablet = 1; - Collection values2 = heroManager.getResonances().values(); - Map equipMap = user.getEquipManager().getEquipMap(); - String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#"); - for (int i = 0; i < heroes.size(); i++) { - Hero hero = heroes.get(i); - if (values2.contains(hero.getId())) { - continue; - } - if (hero.getEquipByPositionMap().size() != 4) { - isUnloadEquip = 0; - } - if (hero.getJewelInfo().isEmpty()) { - soulEquip = 0; - spiritEquip = 0; - } else { - for (String jewel : hero.getJewelInfo()) { - PropertyItem propertyItem = equipMap.get(jewel); - if (propertyItem == null) { - soulEquip = 0; - spiritEquip = 0; - } else { - SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(propertyItem.getEquipId()); - if (config == null) { - continue; - } - // getLocation 1魂宝 2灵宝 - if (config.getLocation() == 1) { - soulEquip = propertyItem.getLevel() < soulEquip ? propertyItem.getLevel() : soulEquip; - } else { - spiritEquip = propertyItem.getLevel() < soulEquip ? propertyItem.getLevel() : soulEquip; - } - } - } - } - if (hero.getEspecialEquipLevel() < especialEquipLevel) { - especialEquipLevel = hero.getEspecialEquipLevel(); - } - if (hero.getLevel() < Integer.parseInt(openLevel[1])) { - tablet = 0; - } - if (hero.getLevel() < resonanceLevel) { - resonanceLevel = hero.getLevel(); - } - hongmengs.add(hero.getId()); - if (hongmengs.size() >= Integer.parseInt(openLevel[0])) { - break; - } - } - if (hongmengs.size() < Integer.parseInt(openLevel[0])) { - return; - } - heroManager.setHongmengGuard(hongmengs); - // 计算共鸣属性 - Map resonanceAddition = heroManager.getResonanceAddition(); - resonanceAddition.clear(); - resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel); - resonanceAddition.put(HongMengAttributeEnum.EQUIP, isUnloadEquip); - resonanceAddition.put(HongMengAttributeEnum.SOUL_EQUIP, soulEquip); - resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip); - resonanceAddition.put(HongMengAttributeEnum.MAGIC_WEAPON, especialEquipLevel); - heroManager.setResonanceAddition(resonanceAddition); - // 鸿蒙碑 - if (tablet == 1 && heroManager.getHongmengTablet() == 0) { - // 开启鸿蒙碑 - heroManager.setHongmengTablet(Integer.parseInt(openLevel[1])); - } - } - - /** - * 开启共鸣区域格子 - * @param session - * @param messageType - * @throws Exception - */ - public void openResonance(ISession session, MessageTypeProto.MessageType messageType, int graidId) throws Exception { - User user = UserManager.getUser(session.getUid()); - HeroManager heroManager = user.getHeroManager(); - Map resonances = heroManager.getResonances(); - if (resonances.containsKey(graidId)) { - LOGGER.info("openResonance uid=>{} has open=>{}", user.getId(), graidId); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Hongmeng hongmeng = Hongmeng.hongmengs.get(graidId); - if (hongmeng == null) { - LOGGER.info("openResonance uid=>{} graidId not exist=>{}", user.getId(), graidId); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Map cost1 = new HashMap<>(1); - cost1.put(hongmeng.getPropPrice()[0], hongmeng.getPropPrice()[1]); - boolean checkCost1 = ItemUtil.checkCost(user, cost1); - if (checkCost1) { - ItemUtil.itemCost(user, cost1, BIReason.OPEN_HONGMENG_GRAID, graidId); - } else { - Map cost2 = new HashMap<>(1); - cost2.put(hongmeng.getMoneyPrice()[0], hongmeng.getMoneyPrice()[1]); - boolean checkCost2 = ItemUtil.checkCost(user, cost2); - if (!checkCost2) { - LOGGER.info("openResonance uid=>{} cost item not enough=>{}", user.getId(), graidId); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - ItemUtil.itemCost(user, cost2, BIReason.OPEN_HONGMENG_GRAID, graidId); - } - resonances.put(graidId, ""); - heroManager.setResonances(resonances); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), null); - } - - - /** - * 共鸣 - * @param session - * @param messageType - * @param heroId 需要共鸣的神将id - * @param index 需要放的共鸣区位置 - */ - public void resonance(ISession session, MessageTypeProto.MessageType messageType, String heroId, int index) throws Exception { - User user = UserManager.getUser(session.getUid()); - HeroManager heroManager = user.getHeroManager(); - Hero hero = heroManager.getHeroMap().get(heroId); - if (hero == null) { - LOGGER.info("resonance uid=>{} no the heroId=>{}", user.getId(), heroId); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - if (heroManager.getHongmengGuard().contains(heroId)) { - LOGGER.info("resonance uid=>{} the heroId=>{} is HongmengGuard", user.getId(), heroId); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Map resonances = heroManager.getResonances(); - String resonanceInfo = resonances.get(index); - if (resonanceInfo == null || !resonanceInfo.isEmpty()) { - LOGGER.info("resonance uid=>{} the index not open=>{}", user.getId(), index); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Map resonancesTime = heroManager.getResonancesTime(); - if (resonancesTime.get(index) != null && resonancesTime.get(index) > TimeUtils.now()) { - LOGGER.info("resonance uid=>{} time =>{}", user.getId(), resonancesTime.get(index)); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - // 添加到共鸣区 - heroManager.updateResonances(index, heroId); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), null); - } - - - /** - * 卸下共鸣英雄 - * @param session - * @param messageType - * @param index - * @throws Exception - */ - public void unLoadResonance(ISession session, MessageTypeProto.MessageType messageType, int index) throws Exception{ - User user = UserManager.getUser(session.getUid()); - HeroManager heroManager = user.getHeroManager(); - Map resonances = heroManager.getResonances(); - String resonanceInfo = resonances.get(index); - if (resonanceInfo == null || resonanceInfo.isEmpty()) { - LOGGER.info("unLoadResonance uid=>{} the index not open=>{}", user.getId(), index); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Hero hero = heroManager.getHero(resonanceInfo); - if (hero == null) { - LOGGER.info("unLoadResonance uid=>{} cur hero is null {}", user.getId(), resonanceInfo); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - heroManager.updateResonances(index, ""); - heroManager.updateResonancesTime(index, TimeUtils.now() + SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_LATTICE_WAIT_TIME) * 1000); - heroManager.updateResonances(index, resonanceInfo); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), null); - } - - /** - * 花费妖晶清除共鸣冷却时间 - * @param session - * @param messageType - * @param index - * @throws Exception - */ - public void cleanTime(ISession session, MessageTypeProto.MessageType messageType, int index) throws Exception { - User user = UserManager.getUser(session.getUid()); - HeroManager heroManager = user.getHeroManager(); - Map resonances = heroManager.getResonances(); - String resonanceInfo = resonances.get(index); - if (resonanceInfo == null) { - LOGGER.info("cleanTime uid=>{} the index not open=>{}", user.getId(), index); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - Map resonancesTime = heroManager.getResonancesTime(); - Long unloadTime = resonancesTime.get(index); - if (unloadTime == null || unloadTime <= TimeUtils.now()) { - LOGGER.info("cleanTime uid=>{} time =>{}", user.getId(), unloadTime); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - String[] stringValue = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_LATTICE_PRICE).split("#"); - long time = unloadTime - TimeUtils.now(); - int count = (int) (time / 1000 * Integer.parseInt(stringValue[0])); - Map cost = new HashMap<>(1); - cost.put(Integer.parseInt(stringValue[1]), count); - boolean checkCost = ItemUtil.checkCost(user, cost); - if (!checkCost) { - LOGGER.info("cleanTime uid=>{} item not enough =>{}", user.getId(), unloadTime); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - ItemUtil.itemCost(user, cost, BIReason.CLEAR_HONGMENG_GRAID, index); - heroManager.updateResonancesTime(index, 0L); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), null); - } - - /** - * 升级鸿蒙碑 - * @param session - * @param messageType - * @throws Exception - */ - public void updateHongmengTablet(ISession session, MessageTypeProto.MessageType messageType) throws Exception { - User user = UserManager.getUser(session.getUid()); - HeroManager heroManager = user.getHeroManager(); - if (heroManager.getHongmengTablet() == 0) { - LOGGER.info("updateHongmengTablet uid=>{} HongmengTablet not open=>{}", user.getId(), 0); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - String[] split = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#"); - int maxLevel = heroManager.getHongmengMaxLevel().size() * SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_ONEHERO_OPENLEVEL) + Integer.parseInt(split[0]); - if (heroManager.getHongmengTablet() >= maxLevel) { - LOGGER.info("updateHongmengTablet uid=>{} curLevel={} maxLevel =>{}", user.getId(), heroManager.getHongmengTablet(), maxLevel); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - int nextLevel = heroManager.getHongmengTablet() + 1; - HongmengUP hongmengUP = HongmengUP.hongmengUPLevels.get(nextLevel); - if (hongmengUP == null) { - LOGGER.info("updateHongmengTablet uid=>{} curLevel={} maxLevel =>{} nextLevel=>{}", user.getId(), heroManager.getHongmengTablet(), maxLevel, nextLevel); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - int[][] levelUp = hongmengUP.getLevelUp(); - boolean b = ItemUtil.itemCost(user, levelUp, BIReason.HONGMENG_UPGRIDE, nextLevel); - if (!b) { - LOGGER.info("updateHongmengTablet uid=>{} nextLevel=>{} need item not enough", user.getId(), nextLevel); - throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); - } - heroManager.setHongmengTablet(nextLevel); - MessageUtil.sendMessage(session, 1, messageType.getNumber(), null); - } - } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HongMengAttributeEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HongMengAttributeEnum.java deleted file mode 100644 index 64619049e..000000000 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HongMengAttributeEnum.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ljsd.jieling.logic.hero; - -/** - * 鸿蒙阵 加成类型 - */ -public enum HongMengAttributeEnum { - - LEVEL(1), - EQUIP(2), - SOUL_EQUIP(3), // 魂宝 - SPIRIT_EQUIP(4),// 灵宝 - MAGIC_WEAPON(5), // 法宝 - ; - private int propertyId; - - HongMengAttributeEnum(int propertyId) { - this.propertyId = propertyId; - } - - public int getPropertyId() { - return propertyId; - } -} diff --git a/tablemanager/src/main/java/config/Hongmeng.java b/tablemanager/src/main/java/config/Hongmeng.java deleted file mode 100644 index 20e43e99d..000000000 --- a/tablemanager/src/main/java/config/Hongmeng.java +++ /dev/null @@ -1,40 +0,0 @@ -package config; - -import manager.STableManager; -import manager.Table; - -import java.util.Map; - -@Table(name = "Hongmeng") -public class Hongmeng implements BaseConfig{ - - public static Map hongmengs; - - private int id; - - private int[] propPrice; - - private int[] moneyPrice; - - - @Override - public void init() throws Exception { - hongmengs = STableManager.getConfig(Hongmeng.class); - } - - public Hongmeng getHongmengById(int id){ - return hongmengs.get(id); - } - - public int getId() { - return id; - } - - public int[] getPropPrice() { - return propPrice; - } - - public int[] getMoneyPrice() { - return moneyPrice; - } -} diff --git a/tablemanager/src/main/java/config/HongmengUP.java b/tablemanager/src/main/java/config/HongmengUP.java deleted file mode 100644 index 932eebff2..000000000 --- a/tablemanager/src/main/java/config/HongmengUP.java +++ /dev/null @@ -1,44 +0,0 @@ -package config; - -import manager.STableManager; -import manager.Table; - -import java.util.HashMap; -import java.util.Map; - -@Table(name = "HongmengUP") -public class HongmengUP implements BaseConfig{ - - public static Map hongmengUPs; - - public static Map hongmengUPLevels; - - private int id; - - private int hongmengLevel; - - private int[][] levelUp; - - - @Override - public void init() throws Exception { - hongmengUPs = STableManager.getConfig(HongmengUP.class); - hongmengUPLevels = new HashMap<>(); - for (HongmengUP hongmengUP : hongmengUPs.values()) { - hongmengUPLevels.put(hongmengUP.getHongmengLevel(), hongmengUP); - } - } - - public int getId() { - return id; - } - - - public int getHongmengLevel() { - return hongmengLevel; - } - - public int[][] getLevelUp() { - return levelUp; - } -} diff --git a/tablemanager/src/main/java/config/SSpecialConfig.java b/tablemanager/src/main/java/config/SSpecialConfig.java index 0daa472bf..58288b87d 100644 --- a/tablemanager/src/main/java/config/SSpecialConfig.java +++ b/tablemanager/src/main/java/config/SSpecialConfig.java @@ -69,11 +69,6 @@ public class SSpecialConfig implements BaseConfig { public static final String GUILD_WAR_ISOPEN = "Guild_war_isopen";//老公会战是否开启 public static final String LUCKYTURNDAILYLIMIT = "LuckyTurnDailyLimit";//幸运探宝每日上限 - public static final String HONGMENG_OPENLEVEL = "Hongmeng_OpenLevel";//鸿蒙阵开启等级 - public static final String HONGMENG_LATTICE_WAIT_TIME = "Hongmeng_Lattice_Waitingtime";//鸿蒙阵每个格子冷却时间(s) - public static final String HONGMENG_LATTICE_PRICE = "Hongmeng_Lattice_Price";//鸿蒙阵格子刷新价格s - public static final String HONGMENG_UPGRADE_LIMIT = "Hongmeng_upgrade_limit";//鸿蒙阵升级开启限制 - public static final String HONGMENG_ONEHERO_OPENLEVEL = "Hongmeng_Onehero_OpenLevel";//鸿蒙阵每个觉醒神将提升的等级 public static final String REPLACE_ITEM_ID = "replace_item_id";//置换玉道具ID public static final String REPLACE_COST = "replace_cost";//置换玉消耗