randhero
parent
483dabee0e
commit
a1e84b5a16
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SLotterySpecialConfig> config = STableManager.getConfig(SLotterySpecialConfig.class);
|
||||
Map<Integer, List<SLotterySpecialConfig>> 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<SLotterySpecialConfig> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -11,11 +11,19 @@ public class HeroManager extends MongoBase {
|
|||
|
||||
private Map<String, Hero> heroMap;
|
||||
|
||||
Map<Integer, Integer> 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<String, Hero> getItemMap() {
|
||||
return heroMap;
|
||||
}
|
||||
|
@ -46,4 +54,7 @@ public class HeroManager extends MongoBase {
|
|||
return heroMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Integer, Integer> totalCount = heroManager.getTotalCount();
|
||||
if (totalCount.containsKey(type)) {
|
||||
randCount = totalCount.get(type);
|
||||
}
|
||||
int j=0;
|
||||
for(int i=0;i<perCount;i++){
|
||||
if(!isSpecial){
|
||||
randCount++;
|
||||
pooId = getSpecialPoolByRandcount(type, randCount);
|
||||
if(pooId==0&&!isSpecial){
|
||||
pooId = getPooId(sLotterySetting, pooId);
|
||||
}
|
||||
LOGGER.info("the uid={},the type={},the poolId={}",uid,type,pooId);
|
||||
|
@ -115,17 +123,42 @@ public class HeroLogic {
|
|||
dropHeroAndItem[j++] = reward;
|
||||
}
|
||||
}
|
||||
|
||||
heroManager.updateRandCount(type,randCount);
|
||||
if(tenTimesMustGetItem!=null){
|
||||
for(int i=0;i<tenTimesMustGetItem.length;i++){
|
||||
dropHeroAndItem[j++] = tenTimesMustGetItem[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropHeroAndItem);
|
||||
HeroInfoProto.HeroRandResponse heroRandResponse = HeroInfoProto.HeroRandResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, heroRandResponse, true);
|
||||
}
|
||||
|
||||
private int getSpecialPoolByRandcount(int type, int randCount) {
|
||||
List<SLotterySpecialConfig> 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;
|
||||
|
|
Loading…
Reference in New Issue