diff --git a/conf/server/LotteryRewardConfig.txt b/conf/server/LotteryRewardConfig.txt index a371d0953..12c3e5c6c 100644 --- a/conf/server/LotteryRewardConfig.txt +++ b/conf/server/LotteryRewardConfig.txt @@ -16,7 +16,7 @@ int mut,int#int,1 int int int,int#int,1 15 10015#1 1 11 null 16 10016#1 1 0 null 17 10017#1 1 0 null -18 10018#1 1 5 null +18 10018#1 1 0 null 19 10019#1 1 5 null 20 10020#1 1 0 null 21 10021#1 1 95 null @@ -31,7 +31,7 @@ int mut,int#int,1 int int int,int#int,1 30 10030#1 1 0 null 31 10031#1 1 0 null 32 10032#1 1 0 null -33 10033#1 1 95 null +33 10033#1 1 0 null 34 10034#1 1 95 null 35 10035#1 1 0 null 36 10036#1 1 0 null @@ -44,13 +44,13 @@ int mut,int#int,1 int int int,int#int,1 43 10043#1 1 0 null 44 10044#1 1 0 null 45 10045#1 1 0 null -46 10046#1 1 600 null -47 10047#1 1 600 null -48 10048#1 1 600 null -49 10049#1 1 600 null -50 10050#1 1 600 null -51 10051#1 1 600 null -52 10052#1 1 600 null +46 10046#1 1 0 null +47 10047#1 1 100 null +48 10048#1 1 100 null +49 10049#1 1 100 null +50 10050#1 1 100 null +51 10051#1 1 0 null +52 10052#1 1 0 null 57 10001#1 11 20 null 58 10007#1 11 0 null 59 10010#1 11 0 null @@ -99,3 +99,5 @@ int mut,int#int,1 int int int,int#int,1 102 12010#8 14 50 null 103 12010#12 14 50 null 104 12010#10 14 50 null +110 10015#1 20 100 null +111 10004#1 21 100 null diff --git a/conf/server/LotterySpecialConfig.txt b/conf/server/LotterySpecialConfig.txt new file mode 100644 index 000000000..df3813f69 --- /dev/null +++ b/conf/server/LotterySpecialConfig.txt @@ -0,0 +1,4 @@ +Id Type Count Min_num Max_num pool_id +int int int int int int +1 11 5 1 1 20 +2 11 15 1 1 21 diff --git a/conf/server/RewardItemConfig.txt b/conf/server/RewardItemConfig.txt index fbb694f93..23d88c1fe 100644 --- a/conf/server/RewardItemConfig.txt +++ b/conf/server/RewardItemConfig.txt @@ -1,79 +1,79 @@ Id ItemId Chance GrowChance RandomMin RandomMax int int int float int int 100 3001 14400 1.0 0 0 -101 3001 100 1.0 1 1 -102 3002 100 1.0 1 1 -103 3003 100 1.0 1 1 -104 3004 100 1.0 1 1 -105 3005 100 1.0 1 1 -106 3006 100 1.0 1 1 -107 3007 100 1.0 1 1 -108 3008 100 1.0 1 1 -109 3009 100 1.0 1 1 -110 3010 100 1.0 1 1 -111 3011 100 1.0 1 1 -112 3012 100 1.0 1 1 -113 3013 100 1.0 1 1 -114 3014 100 1.0 1 1 -115 3015 100 1.0 1 1 -116 3016 100 1.0 1 1 -117 3017 100 1.0 1 1 -118 3018 100 1.0 1 1 -201 3101 100 1.0 1 1 -202 3102 100 1.0 1 1 -203 3103 100 1.0 1 1 -204 3104 100 1.0 1 1 -205 3105 100 1.0 1 1 -206 3106 100 1.0 1 1 -207 3107 100 1.0 1 1 -208 3108 100 1.0 1 1 -209 3109 100 1.0 1 1 -210 3110 100 1.0 1 1 -211 3111 100 1.0 1 1 -212 3112 100 1.0 1 1 -213 3113 100 1.0 1 1 -214 3114 100 1.0 1 1 -215 3115 100 1.0 1 1 -216 3116 100 1.0 1 1 -217 3117 100 1.0 1 1 -218 3118 100 1.0 1 1 -301 3201 100 1.0 1 1 -302 3202 100 1.0 1 1 -303 3203 100 1.0 1 1 -304 3204 100 1.0 1 1 -305 3205 100 1.0 1 1 -306 3206 100 1.0 1 1 -307 3207 100 1.0 1 1 -308 3208 100 1.0 1 1 -309 3209 100 1.0 1 1 -310 3210 100 1.0 1 1 -311 3211 100 1.0 1 1 -312 3212 100 1.0 1 1 -313 3213 100 1.0 1 1 -314 3214 100 1.0 1 1 -315 3215 100 1.0 1 1 -316 3216 100 1.0 1 1 -317 3217 100 1.0 1 1 -318 3218 100 1.0 1 1 -401 3301 100 1.0 1 1 -402 3302 100 1.0 1 1 -403 3303 100 1.0 1 1 -404 3304 100 1.0 1 1 -405 3305 100 1.0 1 1 -406 3306 100 1.0 1 1 -407 3307 100 1.0 1 1 -408 3308 100 1.0 1 1 -409 3309 100 1.0 1 1 -410 3310 100 1.0 1 1 -411 3311 100 1.0 1 1 -412 3312 100 1.0 1 1 -413 3313 100 1.0 1 1 -414 3314 100 1.0 1 1 -415 3315 100 1.0 1 1 -416 3316 100 1.0 1 1 -417 3317 100 1.0 1 1 -418 3318 100 1.0 1 1 -1000 3 100 1.0 100 100 +101 3001 100 1.0 0 1 +102 3002 100 1.0 0 1 +103 3003 100 1.0 0 1 +104 3004 100 1.0 0 1 +105 3005 100 1.0 0 1 +106 3006 100 1.0 0 1 +107 3007 100 1.0 0 1 +108 3008 100 1.0 0 1 +109 3009 100 1.0 0 1 +110 3010 100 1.0 0 1 +111 3011 100 1.0 0 1 +112 3012 100 1.0 0 1 +113 3013 100 1.0 0 1 +114 3014 100 1.0 0 1 +115 3015 100 1.0 0 1 +116 3016 100 1.0 0 1 +117 3017 100 1.0 0 1 +118 3018 100 1.0 0 1 +201 3101 100 1.0 0 1 +202 3102 100 1.0 0 1 +203 3103 100 1.0 0 1 +204 3104 100 1.0 0 1 +205 3105 100 1.0 0 1 +206 3106 100 1.0 0 1 +207 3107 100 1.0 0 1 +208 3108 100 1.0 0 1 +209 3109 100 1.0 0 1 +210 3110 100 1.0 0 1 +211 3111 100 1.0 0 1 +212 3112 100 1.0 0 1 +213 3113 100 1.0 0 1 +214 3114 100 1.0 0 1 +215 3115 100 1.0 0 1 +216 3116 100 1.0 0 1 +217 3117 100 1.0 0 1 +218 3118 100 1.0 0 1 +301 3201 100 1.0 0 1 +302 3202 100 1.0 0 1 +303 3203 100 1.0 0 1 +304 3204 100 1.0 0 1 +305 3205 100 1.0 0 1 +306 3206 100 1.0 0 1 +307 3207 100 1.0 0 1 +308 3208 100 1.0 0 1 +309 3209 100 1.0 0 1 +310 3210 100 1.0 0 1 +311 3211 100 1.0 0 1 +312 3212 100 1.0 0 1 +313 3213 100 1.0 0 1 +314 3214 100 1.0 0 1 +315 3215 100 1.0 0 1 +316 3216 100 1.0 0 1 +317 3217 100 1.0 0 1 +318 3218 100 1.0 0 1 +401 3301 100 1.0 0 1 +402 3302 100 1.0 0 1 +403 3303 100 1.0 0 1 +404 3304 100 1.0 0 1 +405 3305 100 1.0 0 1 +406 3306 100 1.0 0 1 +407 3307 100 1.0 0 1 +408 3308 100 1.0 0 1 +409 3309 100 1.0 0 1 +410 3310 100 1.0 0 1 +411 3311 100 1.0 0 1 +412 3312 100 1.0 0 1 +413 3313 100 1.0 0 1 +414 3314 100 1.0 0 1 +415 3315 100 1.0 0 1 +416 3316 100 1.0 0 1 +417 3317 100 1.0 0 1 +418 3318 100 1.0 0 1 +1000 3 100 1.0 3 7 1001 3 100 1.0 3 7 1002 3 100 1.0 3 7 1003 3 100 1.0 3 7 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SLotterySpecialConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SLotterySpecialConfig.java new file mode 100644 index 000000000..d9eb254d4 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SLotterySpecialConfig.java @@ -0,0 +1,72 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Table(name ="LotterySpecialConfig") +public class SLotterySpecialConfig implements BaseConfig { + + private int id; + + private int type; + + private int count; + + private int min_num; + + private int max_num; + + private int pool_id; + + private static Map> lotterySpecialConfigMap; + + + @Override + public void init() throws Exception { + Map config = STableManager.getConfig(SLotterySpecialConfig.class); + Map> lotterySpecialConfigMapTmp = new HashMap<>(); + for(SLotterySpecialConfig sLotterySpecialConfig : config.values()){ + int type = sLotterySpecialConfig.getType(); + if(!lotterySpecialConfigMapTmp.containsKey(type)){ + lotterySpecialConfigMapTmp.put(type,new ArrayList<>()); + } + lotterySpecialConfigMapTmp.get(type).add(sLotterySpecialConfig); + } + lotterySpecialConfigMap = lotterySpecialConfigMapTmp; + } + + public static List getLotterySpecialConfigListByType(int type) { + return lotterySpecialConfigMap.get(type); + } + + public int getId() { + return id; + } + + public int getType() { + return type; + } + + public int getCount() { + return count; + } + + public int getMin_num() { + return min_num; + } + + public int getMax_num() { + return max_num; + } + + public int getpool_id() { + return pool_id; + } + + +} \ No newline at end of file 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 d4fc115b6..8e13271cd 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 @@ -11,11 +11,19 @@ public class HeroManager extends MongoBase { private Map heroMap; + Map totalCount; + public HeroManager() { heroMap = new HashMap(); + totalCount = new HashMap(); this.setRootCollection(User._COLLECTION_NAME); } + public void updateRandCount(int type,int count){ + updateString("totalCount." + type, count); + totalCount.put(type,count); + } + public Map getItemMap() { return heroMap; } @@ -46,4 +54,7 @@ public class HeroManager extends MongoBase { return heroMap; } + public Map getTotalCount() { + return totalCount; + } } 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 7ef383203..f0089b5a6 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 @@ -4,6 +4,7 @@ import com.ljsd.GameApplication; import com.ljsd.jieling.config.*; import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.globals.Global; +import com.ljsd.jieling.logic.STableManager; import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.UserManager; @@ -104,9 +105,16 @@ public class HeroLogic { length+=tenTimesMustGetItem.length; } int[][] dropHeroAndItem = new int[length][]; + int randCount = 0; + Map totalCount = heroManager.getTotalCount(); + if (totalCount.containsKey(type)) { + randCount = totalCount.get(type); + } int j=0; for(int i=0;i list = SLotterySpecialConfig.getLotterySpecialConfigListByType(type); + if (list == null) { + return 0; + } + int poolId = 0; + for (SLotterySpecialConfig data : list) { + if (randCount % data.getCount() != 0) { + continue; + } + int n = randCount / data.getCount(); + if (n < data.getMin_num()) { + continue; + } + if (data.getMax_num() == 0 || n <= data.getMax_num()) { + poolId = data.getpool_id(); + break; + } + } + return poolId; + } + private int getPooId(SLotterySetting sLotterySetting, int pooId) throws Exception { int[][] diamondBoxContain = sLotterySetting.getDiamondBoxContain(); int totalWeight = 0;