神将可控制进入版本时间优化

back_recharge
jiahuiwen 2022-02-15 11:34:25 +08:00
parent b4f4c43a0e
commit 802a85021e
3 changed files with 12 additions and 26 deletions

View File

@ -463,7 +463,6 @@ public class HeroLogic {
if (user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index + 1) == false) { if (user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index + 1) == false) {
return sLotteryRewardConfig.getReward(); return sLotteryRewardConfig.getReward();
} }
int[] result = new int[2]; int[] result = new int[2];
result[0] = user.getHeroManager().getBeautyBagCardInfoMap().get(index + 1); result[0] = user.getHeroManager().getBeautyBagCardInfoMap().get(index + 1);
result[1] = sLotteryRewardConfig.getReward()[1]; result[1] = sLotteryRewardConfig.getReward()[1];
@ -1077,8 +1076,15 @@ public class HeroLogic {
public static SLotteryRewardConfig randomHeroByPoolId(int poolId, User user) { public static SLotteryRewardConfig randomHeroByPoolId(int poolId, User user) {
List<SLotteryRewardConfig> sLotteryRewardConfigs = new ArrayList<>(); List<SLotteryRewardConfig> sLotteryRewardConfigs = new ArrayList<>();
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId); List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId);
if (sLotteryRewardConfigListByPoolId == null || sLotteryRewardConfigListByPoolId.isEmpty()) {
return null;
}
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolIds = new ArrayList<>(sLotteryRewardConfigListByPoolId);
long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime();
long now = TimeUtils.now();
int days = TimeUtils.differentDays(cacheOpenTime, now);
int totalCountByPoolId = 0; int totalCountByPoolId = 0;
for (SLotteryRewardConfig sLotteryRewardConfig : sLotteryRewardConfigListByPoolId) { for (SLotteryRewardConfig sLotteryRewardConfig : sLotteryRewardConfigListByPoolIds) {
int[] openRules = sLotteryRewardConfig.getOpenRules(); int[] openRules = sLotteryRewardConfig.getOpenRules();
boolean canAdd = true; boolean canAdd = true;
if (openRules != null && openRules.length > 0) { if (openRules != null && openRules.length > 0) {
@ -1091,6 +1097,9 @@ public class HeroLogic {
case 2: case 2:
canAdd = user.getPlayerInfoManager().getLevel() > openValue; canAdd = user.getPlayerInfoManager().getLevel() > openValue;
break; break;
case 3:
canAdd = days >= openValue;
break;
default: { default: {
break; break;
} }

View File

@ -1452,16 +1452,6 @@ public class ItemUtil {
LOGGER.info("addCard uid={} no this hero={}", user.getId(), heroStar[0]); LOGGER.info("addCard uid={} no this hero={}", user.getId(), heroStar[0]);
return; 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]); Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]);
if (reason != BIReason.HERO_RETURN) { if (reason != BIReason.HERO_RETURN) {
if (hero.getStar() == GlobalsDef.WUJINGMIBAO_STAR){ if (hero.getStar() == GlobalsDef.WUJINGMIBAO_STAR){

View File

@ -25,38 +25,25 @@ public class SLotteryRewardConfig implements BaseConfig {
private int star; private int star;
// 所有卡池
private static Map<Integer, List<SLotteryRewardConfig>> sLotteryRewardConfigsByPoolId; private static Map<Integer, List<SLotteryRewardConfig>> sLotteryRewardConfigsByPoolId;
private static Map<Integer, Integer> sLotteryRewardWeightByPoolId;
public static List<SLotteryRewardConfig> getSLotteryRewardConfigListByPoolId(int poolId) { public static List<SLotteryRewardConfig> getSLotteryRewardConfigListByPoolId(int poolId) {
return sLotteryRewardConfigsByPoolId.get(poolId); return sLotteryRewardConfigsByPoolId.get(poolId);
} }
public static int getTotalCountByPoolId(int poolId) {
return sLotteryRewardWeightByPoolId.get(poolId);
}
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer, SLotteryRewardConfig> config = STableManager.getConfig(SLotteryRewardConfig.class); Map<Integer, SLotteryRewardConfig> config = STableManager.getConfig(SLotteryRewardConfig.class);
Map<Integer, Integer> sLotteryRewardWeightByPoolIdTmp = new HashMap<>();
Map<Integer, List<SLotteryRewardConfig>> sLotteryRewardConfigsByPoolIdTmp = new HashMap<>(); Map<Integer, List<SLotteryRewardConfig>> sLotteryRewardConfigsByPoolIdTmp = new HashMap<>();
for(SLotteryRewardConfig sLotteryRewardConfig : config.values()){ for(SLotteryRewardConfig sLotteryRewardConfig : config.values()){
int pool = sLotteryRewardConfig.getPool(); int pool = sLotteryRewardConfig.getPool();
int weight = sLotteryRewardConfig.getWeight();
if(!sLotteryRewardConfigsByPoolIdTmp.containsKey(pool)){ if(!sLotteryRewardConfigsByPoolIdTmp.containsKey(pool)){
sLotteryRewardConfigsByPoolIdTmp.put(pool,new ArrayList<>()); sLotteryRewardConfigsByPoolIdTmp.put(pool,new ArrayList<>());
} }
sLotteryRewardConfigsByPoolIdTmp.get(pool).add(sLotteryRewardConfig); sLotteryRewardConfigsByPoolIdTmp.get(pool).add(sLotteryRewardConfig);
if(!sLotteryRewardWeightByPoolIdTmp.containsKey(pool)){
sLotteryRewardWeightByPoolIdTmp.put(pool,0);
}
sLotteryRewardWeightByPoolIdTmp.put(pool,sLotteryRewardWeightByPoolIdTmp.get(pool) + weight);
} }
sLotteryRewardWeightByPoolId = sLotteryRewardWeightByPoolIdTmp;
sLotteryRewardConfigsByPoolId = sLotteryRewardConfigsByPoolIdTmp; sLotteryRewardConfigsByPoolId = sLotteryRewardConfigsByPoolIdTmp;
} }