From 0f51ad7600fdd2988848015e9acc8eb00d3294b7 Mon Sep 17 00:00:00 2001 From: "PC-202302260912\\Administrator" <1769111741@qq.com> Date: Thu, 2 Nov 2023 17:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BC=E7=89=A9=E5=92=8C=E4=BF=AE=E4=BB=99?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/hero/HeroLogic.java | 162 +++++++++++------- .../newRechargeInfo/NewRechargeInfo.java | 7 +- .../src/main/java/config/SXiuXian.java | 18 +- 3 files changed, 118 insertions(+), 69 deletions(-) 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 b3f337999..34b7921fa 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 @@ -2361,50 +2361,31 @@ public class HeroLogic { * 主角技能数据 */ public void getPlayerFightUnitInfo (User user, List pokemonList) { - StringBuilder builder = new StringBuilder(); - HashMap attrMap = new HashMap<>(); + HeroManager heroManager = user.getHeroManager(); + PlayerManager playerManager = user.getPlayerInfoManager(); - List list = user.getHeroManager().getTransformationList().values().stream().filter(v -> v.getStatus() == 1).collect(Collectors.toList()); + // 主角技能 + StringBuilder skillBuilder = new StringBuilder(); + List list = heroManager.getTransformationList().values().stream().filter(v -> v.getStatus() == 1).collect(Collectors.toList()); for (TransformationInfo info : list) { - try { - // 拼接技能 - SChangingCard card = SChangingCard.map.get(info.getCardId()); - builder.append(info.getIndex()).append("#").append(card.getSkill()[info.getStar()]).append("|"); - // 获取属性 - calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel()); - }catch (Exception e){ - LOGGER.error("获取主角技能报错:{}", e.getMessage(),e); - } + SChangingCard card = SChangingCard.map.get(info.getCardId()); + skillBuilder.append(info.getIndex()).append("#").append(card.getSkill()[info.getStar()]).append("|"); } - - // 技能 String skill = ""; - if (builder.length() >= 1){ - skill = builder.substring(0, builder.length()-1); + if (skillBuilder.length() >= 1){ + skill = skillBuilder.substring(0, skillBuilder.length()-1); } - // 玩家本身的主角属性 - SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); - combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap); - - // 主角礼物属性 - Set giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); - for (Integer id : giftEquipList) { - SEquipConfig config = SEquipConfig.equipConfigMap.get(id); - if (config == null){ - continue; - } - combinedAttribute(config.getPlayerProperty(), attrMap); - } - - // 属性 + // 主角属性 + HashMap attrMap = new HashMap<>(); + calPlayerAttribute(attrMap, user); String property = getPlayerProperty(attrMap); CommonProto.FightUnitInfo skillInfo = CommonProto.FightUnitInfo .newBuilder() .setUnitId("0") .setPosition(100) - .setStar(user.getPlayerInfoManager().getLevel()) + .setStar(playerManager.getLevel()) .setProperty(property) .setUnitSkillIds(skill) .build(); @@ -2803,31 +2784,20 @@ public class HeroLogic { } private void applyPlayerAndSkill(Map heroAllAttribute, User user){ - // ... 主角和主角技能 ... + // ... 主角属性和主角技能 ... SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); if (playerLevelConfig != null){ combinedAttribute(playerLevelConfig.getPropList(), heroAllAttribute); - combinedAttribute(playerLevelConfig.getPlayerPropList(), heroAllAttribute); } - // 变身卡加成 / 主角技能 + // 主角技能 for (TransformationInfo info : user.getHeroManager().getTransformationList().values()) { - // 主角属性 - calPlayerAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); // 英雄属性 - calPlayerCardAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); + calPlayerCardToHeroAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); } - // 礼物主角属性 - Set playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); - Map configMap = SEquipConfig.equipConfigMap; - for (Integer id : playerGiftEquipList) { - SEquipConfig config = configMap.get(id); - if (config == null){ - continue; - } - combinedAttribute(config.getPlayerProperty(), heroAllAttribute); - } + // 主角属性加成 + calPlayerAttribute(heroAllAttribute, user); } // private void applyWorkShopTechnologyAttribute(Map heroAllAttribute, int heroTempId, User user){ @@ -2975,19 +2945,39 @@ public class HeroLogic { private void applyGiftEquipAttribute(Map heroAllAttribute, Hero hero, User user){ // ... 礼物装备 ... - Set heroGiftEquipList = hero.getHeroGiftEquipList(); - Set playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); - HashSet set = new HashSet<>(); - set.addAll(heroGiftEquipList); - set.addAll(playerGiftEquipList); + HashMap giftAttrMap = new HashMap<>(); Map configMap = SEquipConfig.equipConfigMap; - for (Integer id : set) { + int heroGiftUp = 0; + + // 主角属性计算,并计算对英雄礼物加成值 + Set playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); + for (Integer id : playerGiftEquipList) { SEquipConfig config = configMap.get(id); if (config == null){ continue; } - combinedAttribute(config.getProperty(), heroAllAttribute); + heroGiftUp += config.getHeroGitUp(); + if (config.getProperty() != null){ + for (int[] ints : config.getProperty()) { + giftAttrMap.put(ints[0], giftAttrMap.getOrDefault(ints[0],0L)+ints[1]); + } + } } + + // 英雄属性计算 + Set heroGiftEquipList = hero.getHeroGiftEquipList(); + for (Integer id : heroGiftEquipList) { + SEquipConfig config = configMap.get(id); + if (config == null || config.getProperty() == null){ + continue; + } + for (int[] ints : config.getProperty()) { + long value = Math.round(ints[1] * (1 + heroGiftUp / 10000d)); + giftAttrMap.put(ints[0], giftAttrMap.getOrDefault(ints[0],0L)+value); + } + } + + combinedAttribute(giftAttrMap, heroAllAttribute); } /** @@ -3085,15 +3075,19 @@ public class HeroLogic { } } + /** + * ... 修行和修仙 ... + * @param heroAllAttribute + * @param user + */ private void applyXiuxingAndXiuxianAttribute(Map heroAllAttribute, User user){ - // ... 修行和修仙 ... - // 修行等级属性加成 Map xiuXianMap = STableManager.getConfig(SXiuXian.class); int practiceLevel = user.getHeroManager().getPracticeLevel(); for (SXiuXian v : xiuXianMap.values()) { - if (practiceLevel >= v.getId() && v.getTotalPros() != null) { - combinedAttribute(v.getTotalPros(), heroAllAttribute); + int[][] totalPros = v.getTotalPros(); + if (practiceLevel >= v.getId() && totalPros != null) { + combinedAttribute(totalPros, heroAllAttribute); } } @@ -3854,7 +3848,46 @@ public class HeroLogic { } /** - * 计算主角的属性 + * 计算主角属性 + */ + public void calPlayerAttribute(Map attrMap, User user) { + PlayerManager playerInfoManager = user.getPlayerInfoManager(); + HeroManager heroManager = user.getHeroManager(); + + // 主角等级属性 + SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(playerInfoManager.getLevel()); + if (playerLevelConfig != null){ + combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap); + } + + // 主角变身卡属性 + for (TransformationInfo info : heroManager.getTransformationList().values()) { + calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel()); + } + + // 主角礼物属性 + Set playerGiftEquipList = playerInfoManager.getPlayerGiftEquipList(); + Map configMap = SEquipConfig.equipConfigMap; + for (Integer id : playerGiftEquipList) { + SEquipConfig config = configMap.get(id); + if (config != null){ + combinedAttribute(config.getPlayerProperty(), attrMap); + } + } + + // 修行 + Map xiuXianMap = SXiuXian.map; + int practiceLevel = heroManager.getPracticeLevel(); + for (SXiuXian xiuXian : xiuXianMap.values()) { + int[][] playerProperty = xiuXian.getPlayerProperty(); + if (practiceLevel >= xiuXian.getId() && playerProperty != null) { + combinedAttribute(playerProperty, attrMap); + } + } + } + + /** + * 计算变身卡主角属性 */ public void calPlayerAttribute(Map attrMap, int tmpId, int star, int level) { try { @@ -3875,7 +3908,14 @@ public class HeroLogic { } } - public void calPlayerCardAttribute(Map attrMap, int tmpId, int star, int level) { + /** + * 计算变身卡英雄属性 + * @param attrMap + * @param tmpId + * @param star + * @param level + */ + public void calPlayerCardToHeroAttribute(Map attrMap, int tmpId, int star, int level) { try { // 身外化身加成 Map changingCardMap = STableManager.getConfig(SChangingCard.class); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java index ac0be1e28..ed710cad3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java @@ -48,11 +48,14 @@ public class NewRechargeInfo extends MongoBase { public List getTimeLimitBagList(){ List list = new ArrayList<>(); for(AbstractWelfareBag bag : timeLimitMap.values()){ - if(bag.isOpen() && bag.getEndTime() > 0){ + if(bag != null && bag.isOpen() && bag.getEndTime() > 0){ list.add(bag); } } for(AbstractWelfareBag bag : receiveMap.values()){ + if (bag == null){ + continue; + } if(!(bag instanceof ReceiveWelfareBag)){ continue; } @@ -61,7 +64,7 @@ public class NewRechargeInfo extends MongoBase { } } for(AbstractWelfareBag bag : pushMap.values()){ - if(bag.isOpen() && bag.getEndTime() > 0){ + if(bag != null && bag.isOpen() && bag.getEndTime() > 0){ list.add(bag); } } diff --git a/tablemanager/src/main/java/config/SXiuXian.java b/tablemanager/src/main/java/config/SXiuXian.java index 2498a1cc8..3ba4f812c 100644 --- a/tablemanager/src/main/java/config/SXiuXian.java +++ b/tablemanager/src/main/java/config/SXiuXian.java @@ -4,7 +4,6 @@ import manager.STableManager; import manager.Table; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; @Table(name ="XiuXian") @@ -20,6 +19,8 @@ public class SXiuXian implements BaseConfig { private int[][] totalPros; + private int[][] playerProperty; + private String nameFontColor; private int needStarNum; @@ -34,14 +35,15 @@ public class SXiuXian implements BaseConfig { private int playerSkillLvMax; + + public static Map map = new HashMap<>(); // 目前只为主角修行等级属性使用 - public static Map> sXiuXianMap; + public static Map> sXiuXianMap = new HashMap<>(); @Override public void init() throws Exception { - sXiuXianMap = new HashMap<>(); - Map config = STableManager.getConfig(SXiuXian.class); - for (Map.Entry integerSXiuXianEntry : config.entrySet()) { + map = STableManager.getConfig(SXiuXian.class); + for (Map.Entry integerSXiuXianEntry : map.entrySet()) { SXiuXian value = integerSXiuXianEntry.getValue(); if (!sXiuXianMap.containsKey(value.getRealmId())) { sXiuXianMap.put(value.getRealmId(), new HashMap<>(1)); @@ -73,7 +75,11 @@ public class SXiuXian implements BaseConfig { return totalPros; } - public int getNeedStarNum() { + public int[][] getPlayerProperty() { + return playerProperty; + } + + public int getNeedStarNum() { return needStarNum; }