From 802a85021e443fa1ace3fb0ab56027f32819dfd5 Mon Sep 17 00:00:00 2001 From: jiahuiwen Date: Tue, 15 Feb 2022 11:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=9E=E5=B0=86=E5=8F=AF=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E7=89=88=E6=9C=AC=E6=97=B6=E9=97=B4=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ljsd/jieling/logic/hero/HeroLogic.java | 13 +++++++++++-- .../main/java/com/ljsd/jieling/util/ItemUtil.java | 10 ---------- .../main/java/config/SLotteryRewardConfig.java | 15 +-------------- 3 files changed, 12 insertions(+), 26 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 3b7e93d06..a12b478b1 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 @@ -463,7 +463,6 @@ public class HeroLogic { if (user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index + 1) == false) { return sLotteryRewardConfig.getReward(); } - int[] result = new int[2]; result[0] = user.getHeroManager().getBeautyBagCardInfoMap().get(index + 1); result[1] = sLotteryRewardConfig.getReward()[1]; @@ -1077,8 +1076,15 @@ public class HeroLogic { public static SLotteryRewardConfig randomHeroByPoolId(int poolId, User user) { List sLotteryRewardConfigs = new ArrayList<>(); List sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId); + if (sLotteryRewardConfigListByPoolId == null || sLotteryRewardConfigListByPoolId.isEmpty()) { + return null; + } + List sLotteryRewardConfigListByPoolIds = new ArrayList<>(sLotteryRewardConfigListByPoolId); + long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); + long now = TimeUtils.now(); + int days = TimeUtils.differentDays(cacheOpenTime, now); int totalCountByPoolId = 0; - for (SLotteryRewardConfig sLotteryRewardConfig : sLotteryRewardConfigListByPoolId) { + for (SLotteryRewardConfig sLotteryRewardConfig : sLotteryRewardConfigListByPoolIds) { int[] openRules = sLotteryRewardConfig.getOpenRules(); boolean canAdd = true; if (openRules != null && openRules.length > 0) { @@ -1091,6 +1097,9 @@ public class HeroLogic { case 2: canAdd = user.getPlayerInfoManager().getLevel() > openValue; break; + case 3: + canAdd = days >= openValue; + break; default: { break; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java index e9ad5ca15..201e25359 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java @@ -1452,16 +1452,6 @@ public class ItemUtil { LOGGER.info("addCard uid={} no this hero={}", user.getId(), heroStar[0]); return; } - if (scHero.getVersion() > 0) { - long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); - long now = TimeUtils.now(); - int days = TimeUtils.differentDays(cacheOpenTime, now); - if (days < scHero.getVersion()) { - LOGGER.info("addCard uid={} scHero.getVersion()={} days={}", user.getId(), scHero.getVersion(), days); - // 出版本外英雄替换为 乾达婆 - heroStar[0] = 10074; - } - } Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]); if (reason != BIReason.HERO_RETURN) { if (hero.getStar() == GlobalsDef.WUJINGMIBAO_STAR){ diff --git a/tablemanager/src/main/java/config/SLotteryRewardConfig.java b/tablemanager/src/main/java/config/SLotteryRewardConfig.java index 667be6c48..dfe5159f4 100644 --- a/tablemanager/src/main/java/config/SLotteryRewardConfig.java +++ b/tablemanager/src/main/java/config/SLotteryRewardConfig.java @@ -25,38 +25,25 @@ public class SLotteryRewardConfig implements BaseConfig { private int star; + // 所有卡池 private static Map> sLotteryRewardConfigsByPoolId; - private static Map sLotteryRewardWeightByPoolId; public static List getSLotteryRewardConfigListByPoolId(int poolId) { return sLotteryRewardConfigsByPoolId.get(poolId); } - public static int getTotalCountByPoolId(int poolId) { - return sLotteryRewardWeightByPoolId.get(poolId); - } @Override public void init() throws Exception { Map config = STableManager.getConfig(SLotteryRewardConfig.class); - Map sLotteryRewardWeightByPoolIdTmp = new HashMap<>(); Map> sLotteryRewardConfigsByPoolIdTmp = new HashMap<>(); for(SLotteryRewardConfig sLotteryRewardConfig : config.values()){ int pool = sLotteryRewardConfig.getPool(); - int weight = sLotteryRewardConfig.getWeight(); - if(!sLotteryRewardConfigsByPoolIdTmp.containsKey(pool)){ sLotteryRewardConfigsByPoolIdTmp.put(pool,new ArrayList<>()); } - sLotteryRewardConfigsByPoolIdTmp.get(pool).add(sLotteryRewardConfig); - - if(!sLotteryRewardWeightByPoolIdTmp.containsKey(pool)){ - sLotteryRewardWeightByPoolIdTmp.put(pool,0); - } - sLotteryRewardWeightByPoolIdTmp.put(pool,sLotteryRewardWeightByPoolIdTmp.get(pool) + weight); } - sLotteryRewardWeightByPoolId = sLotteryRewardWeightByPoolIdTmp; sLotteryRewardConfigsByPoolId = sLotteryRewardConfigsByPoolIdTmp; }