table fix

wangyuan 2019-03-04 09:20:45 +08:00
parent 7610346352
commit e9dc4a0439
6 changed files with 203 additions and 117 deletions

View File

@ -1,103 +1,103 @@
Id Exp Promote FoodExp AddNum PoolRate AddSuccessRate
int int mut,int#int,1 int float mut,float#float,1 float
0 0 null 0 int null 0.0
1 1000 1#1 0 int null 0.0
2 1500 2#1 0 int null 0.0
3 2000 3#1 0 int null 0.0
4 2500 4#1 0 int null 0.0
5 2500 5#1 0 int null 0.0
6 3500 1#3 0 int null 0.0
7 4000 2#3 0 int null 0.0
8 4500 3#3 0 int null 0.0
9 5000 4#3 0 int null 0.0
10 5500 5#3 0 int null 0.0
11 6000 1#6 0 int null 0.0
12 6500 2#6 0 int null 0.0
13 7000 3#6 0 int null 0.0
14 7500 4#6 0 int null 0.0
15 8000 5#6 0 int null 0.0
16 8500 1#10 0 int null 0.0
17 9000 2#10 0 int null 0.0
18 9500 3#10 0 int null 0.0
19 10000 4#10 0 int null 0.0
20 10500 5#10 0 int null 0.0
21 11000 1#15 0 int null 0.0
22 11500 2#15 0 int null 0.0
23 12000 3#15 0 int null 0.0
24 12500 4#15 0 int null 0.0
25 13000 5#15 0 int null 0.0
26 13500 1#21 0 int null 0.0
27 14000 2#21 0 int null 0.0
28 14500 3#21 0 int null 0.0
29 15000 4#21 0 int null 0.0
30 15500 5#21 0 int null 0.0
31 16000 1#28 0 int null 0.0
32 16500 2#28 0 int null 0.0
33 17000 3#28 0 int null 0.0
34 17500 4#28 0 int null 0.0
35 18000 5#28 0 int null 0.0
36 18500 1#36 0 int null 0.0
37 19000 2#36 0 int null 0.0
38 19500 3#36 0 int null 0.0
39 20000 4#36 0 int null 0.0
40 20500 5#36 0 int null 0.0
41 21000 1#45 0 int null 0.0
42 21500 2#45 0 int null 0.0
43 22000 3#45 0 int null 0.0
44 22500 4#45 0 int null 0.0
45 23000 5#45 0 int null 0.0
46 23500 1#55 0 int null 0.0
47 24000 2#55 0 int null 0.0
48 24500 3#55 0 int null 0.0
49 25000 4#55 0 int null 0.0
50 25500 5#55 0 int null 0.0
51 26000 1#65 0 int null 0.0
52 26500 2#65 0 int null 0.0
53 27000 3#65 0 int null 0.0
54 27500 4#65 0 int null 0.0
55 28000 5#65 0 int null 0.0
56 28500 1#76 0 int null 0.0
57 29000 2#76 0 int null 0.0
58 29500 3#76 0 int null 0.0
59 30000 4#76 0 int null 0.0
60 30500 5#76 0 int null 0.0
61 31000 1#88 0 int null 0.0
62 31500 2#88 0 int null 0.0
63 32000 3#88 0 int null 0.0
64 32500 4#88 0 int null 0.0
65 33000 5#88 0 int null 0.0
66 33500 1#101 0 int null 0.0
67 34000 2#101 0 int null 0.0
68 34500 3#101 0 int null 0.0
69 35000 4#101 0 int null 0.0
70 35500 5#101 0 int null 0.0
71 36000 1#115 0 int null 0.0
72 36500 2#115 0 int null 0.0
73 37000 3#115 0 int null 0.0
74 37500 4#115 0 int null 0.0
75 38000 5#115 0 int null 0.0
76 38500 1#130 0 int null 0.0
77 39000 2#130 0 int null 0.0
78 39500 3#130 0 int null 0.0
79 40000 4#130 0 int null 0.0
80 40500 5#130 0 int null 0.0
81 41000 1#146 0 int null 0.0
82 41500 2#146 0 int null 0.0
83 42000 3#146 0 int null 0.0
84 42500 4#146 0 int null 0.0
85 43000 5#146 0 int null 0.0
86 43500 1#163 0 int null 0.0
87 44000 2#163 0 int null 0.0
88 44500 3#163 0 int null 0.0
89 45000 4#163 0 int null 0.0
90 45500 5#163 0 int null 0.0
91 46000 1#181 0 int null 0.0
92 46500 2#181 0 int null 0.0
93 47000 3#181 0 int null 0.0
94 47500 4#181 0 int null 0.0
95 48000 5#181 0 int null 0.0
96 48500 1#200 0 int null 0.0
97 49000 2#200 0 int null 0.0
98 49500 3#200 0 int null 0.0
99 50000 4#200 0 int null 0.0
100 50500 5#200 0 int null 0.0
0 0 null 0 0.0 null 0.0
1 1000 1#1 0 0.0 null 0.0
2 1500 2#1 0 0.0 null 0.0
3 2000 3#1 0 0.0 null 0.0
4 2500 4#1 0 0.0 null 0.0
5 2500 5#1 0 0.0 null 0.0
6 3500 1#3 0 0.0 null 0.0
7 4000 2#3 0 0.0 null 0.0
8 4500 3#3 0 0.0 null 0.0
9 5000 4#3 0 0.0 null 0.0
10 5500 5#3 0 0.0 null 0.0
11 6000 1#6 0 0.0 null 0.0
12 6500 2#6 0 0.0 null 0.0
13 7000 3#6 0 0.0 null 0.0
14 7500 4#6 0 0.0 null 0.0
15 8000 5#6 0 0.0 null 0.0
16 8500 1#10 0 0.0 null 0.0
17 9000 2#10 0 0.0 null 0.0
18 9500 3#10 0 0.0 null 0.0
19 10000 4#10 0 0.0 null 0.0
20 10500 5#10 0 0.0 null 0.0
21 11000 1#15 0 0.0 null 0.0
22 11500 2#15 0 0.0 null 0.0
23 12000 3#15 0 0.0 null 0.0
24 12500 4#15 0 0.0 null 0.0
25 13000 5#15 0 0.0 null 0.0
26 13500 1#21 0 0.0 null 0.0
27 14000 2#21 0 0.0 null 0.0
28 14500 3#21 0 0.0 null 0.0
29 15000 4#21 0 0.0 null 0.0
30 15500 5#21 0 0.0 null 0.0
31 16000 1#28 0 0.0 null 0.0
32 16500 2#28 0 0.0 null 0.0
33 17000 3#28 0 0.0 null 0.0
34 17500 4#28 0 0.0 null 0.0
35 18000 5#28 0 0.0 null 0.0
36 18500 1#36 0 0.0 null 0.0
37 19000 2#36 0 0.0 null 0.0
38 19500 3#36 0 0.0 null 0.0
39 20000 4#36 0 0.0 null 0.0
40 20500 5#36 0 0.0 null 0.0
41 21000 1#45 0 0.0 null 0.0
42 21500 2#45 0 0.0 null 0.0
43 22000 3#45 0 0.0 null 0.0
44 22500 4#45 0 0.0 null 0.0
45 23000 5#45 0 0.0 null 0.0
46 23500 1#55 0 0.0 null 0.0
47 24000 2#55 0 0.0 null 0.0
48 24500 3#55 0 0.0 null 0.0
49 25000 4#55 0 0.0 null 0.0
50 25500 5#55 0 0.0 null 0.0
51 26000 1#65 0 0.0 null 0.0
52 26500 2#65 0 0.0 null 0.0
53 27000 3#65 0 0.0 null 0.0
54 27500 4#65 0 0.0 null 0.0
55 28000 5#65 0 0.0 null 0.0
56 28500 1#76 0 0.0 null 0.0
57 29000 2#76 0 0.0 null 0.0
58 29500 3#76 0 0.0 null 0.0
59 30000 4#76 0 0.0 null 0.0
60 30500 5#76 0 0.0 null 0.0
61 31000 1#88 0 0.0 null 0.0
62 31500 2#88 0 0.0 null 0.0
63 32000 3#88 0 0.0 null 0.0
64 32500 4#88 0 0.0 null 0.0
65 33000 5#88 0 0.0 null 0.0
66 33500 1#101 0 0.0 null 0.0
67 34000 2#101 0 0.0 null 0.0
68 34500 3#101 0 0.0 null 0.0
69 35000 4#101 0 0.0 null 0.0
70 35500 5#101 0 0.0 null 0.0
71 36000 1#115 0 0.0 null 0.0
72 36500 2#115 0 0.0 null 0.0
73 37000 3#115 0 0.0 null 0.0
74 37500 4#115 0 0.0 null 0.0
75 38000 5#115 0 0.0 null 0.0
76 38500 1#130 0 0.0 null 0.0
77 39000 2#130 0 0.0 null 0.0
78 39500 3#130 0 0.0 null 0.0
79 40000 4#130 0 0.0 null 0.0
80 40500 5#130 0 0.0 null 0.0
81 41000 1#146 0 0.0 null 0.0
82 41500 2#146 0 0.0 null 0.0
83 42000 3#146 0 0.0 null 0.0
84 42500 4#146 0 0.0 null 0.0
85 43000 5#146 0 0.0 null 0.0
86 43500 1#163 0 0.0 null 0.0
87 44000 2#163 0 0.0 null 0.0
88 44500 3#163 0 0.0 null 0.0
89 45000 4#163 0 0.0 null 0.0
90 45500 5#163 0 0.0 null 0.0
91 46000 1#181 0 0.0 null 0.0
92 46500 2#181 0 0.0 null 0.0
93 47000 3#181 0 0.0 null 0.0
94 47500 4#181 0 0.0 null 0.0
95 48000 5#181 0 0.0 null 0.0
96 48500 1#200 0 0.0 null 0.0
97 49000 2#200 0 0.0 null 0.0
98 49500 3#200 0 0.0 null 0.0
99 50000 4#200 0 0.0 null 0.0
100 50500 5#200 0 0.0 null 0.0

View File

@ -3,6 +3,9 @@ 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 ="MysteryFoodPoolConfig")
@ -18,14 +21,33 @@ public class SMysteryFoodPoolConfig implements BaseConfig {
private int pool;
@Override
private static Map<Integer,List<SMysteryFoodPoolConfig>> sMysteryFoodPoolConfigByPoolMap;
private static Map<Integer,Integer> totalWeightByPoolMap;
@Override
public void init() throws Exception {
Map<Integer, List<SMysteryFoodPoolConfig>> result = new HashMap<>();
Map<Integer, SMysteryFoodPoolConfig> config = STableManager.getConfig(SMysteryFoodPoolConfig.class);
for(SMysteryFoodPoolConfig sMysteryFoodPoolConfig : config.values()){
int pool = sMysteryFoodPoolConfig.getPool();
if(result.containsKey(pool)){
result.put(pool,new ArrayList<>());
}
result.get(pool).add(sMysteryFoodPoolConfig);
}
sMysteryFoodPoolConfigByPoolMap = result;
}
public static List<SMysteryFoodPoolConfig> getsMysteryFoodPoolConfigByPoold(int poolId) {
return sMysteryFoodPoolConfigByPoolMap.get(poolId);
}
public int getId() {
public static int getTotalWeightByPool(int pool) {
return totalWeightByPoolMap.get(pool);
}
public int getId() {
return id;
}

View File

@ -14,24 +14,34 @@ public class SMysteryFoodSetting implements BaseConfig {
private int failExp;
private int num;
private static SMysteryFoodSetting sMysteryFoodSetting;
@Override
public void init() throws Exception {
Map<Integer, SMysteryFoodSetting> config = STableManager.getConfig(SMysteryFoodSetting.class);
sMysteryFoodSetting = config.get(1);
}
public static SMysteryFoodSetting getsMysteryFoodSetting() {
return sMysteryFoodSetting;
}
public int getId() {
public int getId() {
return id;
}
public float[] getAddRate() {
public float[] getAddRate() {
return addRate;
}
public int getFailExp() {
public int getFailExp() {
return failExp;
}
public int getNum() {
return num;
}
}

View File

@ -15,6 +15,14 @@ public class SWorkShopSetting implements BaseConfig {
private int[] promote;
private int foodExp;
private float addNum;
private float[] poolRate;
private float addSuccessRate;
private Map<Integer,Integer> promoteMap;
private static int maxExp;
@ -75,4 +83,20 @@ public class SWorkShopSetting implements BaseConfig {
public void setExp(int exp) {
this.exp = exp;
}
public int getFoodExp() {
return foodExp;
}
public float getAddNum() {
return addNum;
}
public float[] getPoolRate() {
return poolRate;
}
public float getAddSuccessRate() {
return addSuccessRate;
}
}

View File

@ -1,9 +1,6 @@
package com.ljsd.jieling.logic.item;
import com.ljsd.jieling.config.SEquipConfig;
import com.ljsd.jieling.config.SWorkShopEquipmentConfig;
import com.ljsd.jieling.config.SWorkShopFoundationConfig;
import com.ljsd.jieling.config.SWorkShopRebuildConfig;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.globals.GlobalItemType;
import com.ljsd.jieling.logic.dao.Equip;
import com.ljsd.jieling.logic.dao.EquipManager;
@ -12,6 +9,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -19,7 +17,7 @@ import org.slf4j.LoggerFactory;
import java.util.*;
/**
*
*
*/
public class WorkShopLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(WorkShopLogic.class);
@ -34,7 +32,39 @@ public class WorkShopLogic {
return WorkShopLogic.Instance.instance;
}
private SMysteryFoodPoolConfig randomFromFoodPool(int poolId){
List<SMysteryFoodPoolConfig> sMysteryFoodPoolConfigs = SMysteryFoodPoolConfig.getsMysteryFoodPoolConfigByPoold(poolId);
int totalWeightByPool = SMysteryFoodPoolConfig.getTotalWeightByPool(poolId);
int randomWeight = MathUtils.randomInt(totalWeightByPool) + 1;
int weight=0;
for(SMysteryFoodPoolConfig sMysteryFoodPoolConfig:sMysteryFoodPoolConfigs){
weight += sMysteryFoodPoolConfig.getWeight();
if(randomWeight>=weight){
return sMysteryFoodPoolConfig;
}
}
return null;
}
public void makeFood(ISession session,List<Integer> materials,int nums){
SMysteryFoodSetting sMysteryFoodSetting = SMysteryFoodSetting.getsMysteryFoodSetting();
if(sMysteryFoodSetting.getNum() != materials.size()){
return;
}
float[] addRate = sMysteryFoodSetting.getAddRate();
//算出概率
float myRate = 0.2f;
int totalWeight = 100;
//成功
if(MathUtils.randomInt(totalWeight) < totalWeight*myRate){
}
//失败 熟练度加成
int failExp = sMysteryFoodSetting.getFailExp();
}
private void times2Array(int [][] array,int times){
for(int[] a :array){

View File

@ -1,5 +1,5 @@
#server info
server.id = 10212
server.id = 10215
server.openTime = 20190101000101
server.num = 1
@ -30,7 +30,7 @@ spring.redis.expireTime = -1
#spring.data.mongodb.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/ysj_wx_1
#spring.data.mongodb2.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/develop_ysj_wx_1
#mongodb2 develop
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10212
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10215
mongodb.options.maxWaitTime = 120000
mongodb.options.connectTimeout = 1000
mongodb.options.socketTimeout = 0