Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
edb330f0fd
|
@ -1,2 +1,58 @@
|
|||
Id BornItem
|
||||
int mut,int#int,2
|
||||
Id BornItem SpeedFormula
|
||||
int mut,int#int,2 mut,int#int,1
|
||||
1 2#1000#2|3#1#4 0#0#10#1
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
0 null null
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
Id Level CharacterLevelPara Consume
|
||||
int int float mut,int#int,2
|
||||
1 1 1 2#0|1100#0
|
||||
2 2 1 2#500|1100#60
|
||||
3 3 1 2#600|1100#70
|
||||
4 4 1 2#700|1100#80
|
||||
5 5 1 2#800|1100#90
|
||||
6 6 1 2#900|1100#100
|
||||
7 7 1 2#1000|1100#110
|
||||
8 8 1 2#1100|1100#120
|
||||
9 9 1 2#1200|1100#130
|
||||
10 10 1 2#1300|1100#140
|
||||
11 11 1 2#1400|1100#150
|
||||
12 12 1 2#1500|1100#160
|
||||
13 13 1 2#1600|1100#170
|
||||
14 14 1 2#1700|1100#180
|
||||
15 15 1 2#1800|1100#190
|
||||
16 16 1 2#1900|1100#200
|
||||
17 17 1 2#2000|1100#210
|
||||
18 18 1 2#2100|1100#220
|
||||
19 19 1 2#2200|1100#230
|
||||
20 20 1 2#2300|1100#240
|
||||
21 21 1 2#2400|1100#250
|
||||
22 22 1 2#2500|1100#260
|
||||
23 23 1 2#2600|1100#270
|
||||
24 24 1 2#2700|1100#280
|
||||
25 25 1 2#2800|1100#290
|
||||
26 26 1 2#2900|1100#300
|
||||
27 27 2 2#3000|1100#310
|
||||
28 28 2 2#3100|1100#320
|
||||
29 29 2 2#3200|1100#330
|
||||
30 30 2 2#3300|1100#340
|
||||
31 31 2 2#3500|1100#350
|
||||
32 32 2 2#3700|1100#360
|
||||
33 33 2 2#3900|1100#370
|
||||
34 34 2 2#4100|1100#380
|
||||
35 35 2 2#4300|1100#390
|
||||
36 36 2 2#4500|1100#400
|
||||
37 37 2 2#4700|1100#410
|
||||
38 38 2 2#4900|1100#420
|
||||
39 39 2 2#5100|1100#430
|
||||
40 40 2 2#5300|1100#440
|
||||
41 41 2 2#5500|1100#450
|
||||
42 42 2 2#5700|1100#460
|
||||
43 43 2 2#5900|1100#470
|
||||
44 44 2 2#6100|1100#480
|
||||
45 45 2 2#6300|1100#490
|
||||
46 46 2 2#6500|1100#500
|
||||
47 47 2 2#6700|1100#510
|
||||
48 48 2 2#6900|1100#520
|
||||
49 49 2 2#7100|1100#530
|
||||
50 50 2 2#7300|1100#540
|
||||
51 51 2 2#7500|1100#550
|
||||
52 52 3 2#7700|1100#560
|
||||
53 53 3 2#7900|1100#570
|
||||
54 54 3 2#8100|1100#580
|
||||
55 55 3 2#8300|1100#590
|
||||
56 56 3 2#8500|1100#600
|
||||
57 57 3 2#8700|1100#610
|
||||
58 58 3 2#8900|1100#620
|
||||
59 59 3 2#9100|1100#630
|
||||
60 60 3 2#9300|1100#640
|
||||
61 61 3 2#10000|1100#650
|
||||
62 62 3 2#10700|1100#660
|
||||
63 63 3 2#11400|1100#670
|
||||
64 64 3 2#12100|1100#680
|
||||
65 65 3 2#12800|1100#690
|
||||
66 66 3 2#13500|1100#700
|
||||
67 67 3 2#14200|1100#710
|
||||
68 68 3 2#14900|1100#720
|
||||
69 69 3 2#15600|1100#730
|
||||
70 70 3 2#16300|1100#740
|
||||
71 71 3 2#17000|1100#750
|
||||
72 72 3 2#17700|1100#760
|
||||
73 73 3 2#18400|1100#770
|
||||
74 74 3 2#19100|1100#780
|
||||
75 75 3 2#19800|1100#790
|
||||
76 76 3 2#20500|1100#800
|
||||
77 77 3 2#21200|1100#810
|
||||
78 78 4 2#21900|1100#820
|
||||
79 79 4 2#22600|1100#830
|
||||
80 80 4 2#23300|1100#840
|
||||
81 81 4 2#24000|1100#850
|
||||
82 82 4 2#24700|1100#860
|
||||
83 83 4 2#25400|1100#870
|
||||
84 84 4 2#26100|1100#880
|
||||
85 85 4 2#26800|1100#890
|
||||
86 86 4 2#27500|1100#900
|
||||
87 87 4 2#28200|1100#910
|
||||
88 88 4 2#28900|1100#920
|
||||
89 89 4 2#29600|1100#930
|
||||
90 90 4 2#30300|1100#940
|
||||
91 91 4 2#31000|1100#950
|
||||
92 92 4 2#31700|1100#960
|
||||
93 93 4 2#32400|1100#970
|
||||
94 94 4 2#33100|1100#980
|
||||
95 95 4 2#33800|1100#990
|
||||
96 96 4 2#34500|1100#1000
|
||||
97 97 4 2#35200|1100#1010
|
||||
98 98 4 2#35900|1100#1020
|
||||
99 99 4 2#36600|1100#1030
|
||||
100 100 5 2#37300|1100#1040
|
||||
101 101 5 2#38000|1100#1140
|
||||
102 102 5 2#39000|1100#1240
|
||||
103 103 5 2#40000|1100#1340
|
||||
104 104 5 2#41000|1100#1440
|
||||
105 105 6 2#42000|1100#1540
|
||||
106 106 6 2#43000|1100#1640
|
||||
107 107 6 2#44000|1100#1740
|
||||
108 108 6 2#45000|1100#1840
|
||||
109 109 6 2#46000|1100#1940
|
||||
110 110 7 2#47000|1100#2040
|
||||
111 111 7 2#48000|1100#2140
|
||||
112 112 7 2#49000|1100#2240
|
||||
113 113 7 2#50000|1100#2340
|
||||
114 114 7 2#51000|1100#2440
|
||||
115 115 8 2#52000|1100#2540
|
||||
116 116 8 2#53000|1100#2640
|
||||
117 117 8 2#54000|1100#2740
|
||||
118 118 8 2#55000|1100#2840
|
||||
119 119 8 2#56000|1100#2940
|
||||
120 120 9 2#57000|1100#3040
|
||||
121 121 9 2#58000|1100#3140
|
||||
122 122 9 2#59000|1100#3240
|
||||
123 123 9 2#60000|1100#3340
|
||||
124 124 9 2#61000|1100#3440
|
||||
125 125 10 2#62000|1100#3540
|
||||
126 126 10 2#63000|1100#3640
|
||||
127 127 10 2#64000|1100#3740
|
||||
128 128 10 2#65000|1100#3840
|
||||
129 129 10 2#66000|1100#3940
|
||||
130 130 11 2#67000|1100#4040
|
||||
131 131 11 2#68000|1100#4140
|
||||
132 132 11 2#69000|1100#4240
|
||||
133 133 11 2#70000|1100#4340
|
||||
134 134 11 2#71000|1100#4440
|
||||
135 135 12 2#72000|1100#4540
|
||||
136 136 12 2#73000|1100#4640
|
||||
137 137 12 2#74000|1100#4740
|
||||
138 138 12 2#75000|1100#4840
|
||||
139 139 12 2#76000|1100#4940
|
||||
140 140 13 2#77000|1100#5040
|
||||
141 141 13 2#80000|1100#5340
|
||||
142 142 13 2#83000|1100#5640
|
||||
143 143 13 2#86000|1100#5940
|
||||
144 144 13 2#89000|1100#6240
|
||||
145 145 13 2#92000|1100#6540
|
||||
146 146 13 2#95000|1100#6840
|
||||
147 147 14 2#98000|1100#7140
|
||||
148 148 14 2#101000|1100#7440
|
||||
149 149 14 2#104000|1100#7740
|
||||
150 150 14 2#107000|1100#8040
|
||||
151 151 14 2#110000|1100#8340
|
||||
152 152 14 2#113000|1100#8640
|
||||
153 153 15 2#116000|1100#8940
|
||||
154 154 15 2#119000|1100#9240
|
||||
155 155 15 2#122000|1100#9540
|
||||
156 156 15 2#125000|1100#9840
|
||||
157 157 15 2#128000|1100#10140
|
||||
158 158 15 2#131000|1100#10440
|
||||
159 159 16 2#134000|1100#10740
|
||||
160 160 16 2#137000|1100#11040
|
||||
161 161 16 2#140000|1100#11340
|
||||
162 162 16 2#145000|1100#11640
|
||||
163 163 16 2#150000|1100#11940
|
||||
164 164 16 2#155000|1100#12240
|
||||
165 165 17 2#160000|1100#12540
|
||||
166 166 17 2#165000|1100#12840
|
||||
167 167 17 2#170000|1100#13140
|
||||
168 168 17 2#175000|1100#13440
|
||||
169 169 17 2#180000|1100#13740
|
||||
170 170 17 2#185000|1100#14040
|
||||
171 171 18 2#190000|1100#14340
|
||||
172 172 18 2#195000|1100#14640
|
||||
173 173 18 2#200000|1100#14940
|
||||
174 174 18 2#205000|1100#15240
|
||||
175 175 18 2#210000|1100#15540
|
||||
176 176 18 2#215000|1100#15840
|
||||
177 177 19 2#220000|1100#16140
|
||||
178 178 19 2#225000|1100#16440
|
||||
179 179 19 2#230000|1100#16740
|
||||
180 180 19 2#235000|1100#17040
|
||||
181 181 19 2#240000|1100#17340
|
||||
182 182 19 2#245000|1100#17640
|
||||
183 183 20 2#250000|1100#17940
|
||||
184 184 20 2#255000|1100#18240
|
||||
185 185 20 2#260000|1100#18540
|
||||
186 186 20 2#265000|1100#18840
|
||||
187 187 20 2#270000|1100#19140
|
||||
188 188 20 2#275000|1100#19440
|
||||
189 189 21 2#280000|1100#19740
|
||||
190 190 21 2#285000|1100#20040
|
||||
191 191 21 2#290000|1100#20340
|
||||
192 192 21 2#295000|1100#20640
|
||||
193 193 21 2#300000|1100#20940
|
||||
194 194 21 2#305000|1100#21240
|
||||
195 195 22 2#310000|1100#21540
|
||||
196 196 22 2#315000|1100#21840
|
||||
197 197 22 2#320000|1100#22140
|
||||
198 198 22 2#325000|1100#22440
|
||||
199 199 22 2#330000|1100#22740
|
||||
200 200 22 2#335000|1100#22980
|
||||
201 201 22 2#340000|1100#23580
|
||||
202 202 23 2#345000|1100#24180
|
||||
203 203 23 2#350000|1100#24780
|
||||
204 204 23 2#355000|1100#25380
|
||||
205 205 23 2#360000|1100#25980
|
||||
206 206 23 2#365000|1100#26580
|
||||
207 207 23 2#370000|1100#27180
|
||||
208 208 24 2#375000|1100#27780
|
||||
209 209 24 2#380000|1100#28380
|
||||
210 210 24 2#385000|1100#28980
|
||||
211 211 24 2#390000|1100#29580
|
||||
212 212 24 2#395000|1100#30180
|
||||
213 213 24 2#400000|1100#30780
|
||||
214 214 25 2#405000|1100#31380
|
||||
215 215 25 2#410000|1100#31980
|
||||
216 216 25 2#415000|1100#32580
|
||||
217 217 25 2#420000|1100#33180
|
||||
218 218 25 2#425000|1100#33780
|
||||
219 219 25 2#430000|1100#34380
|
||||
220 220 26 2#435000|1100#34980
|
||||
221 221 26 2#440000|1100#35580
|
||||
222 222 26 2#445000|1100#36180
|
||||
223 223 26 2#450000|1100#36780
|
||||
224 224 26 2#455000|1100#37380
|
||||
225 225 26 2#460000|1100#37980
|
||||
226 226 27 2#465000|1100#38580
|
||||
227 227 27 2#470000|1100#39180
|
||||
228 228 27 2#475000|1100#39780
|
||||
229 229 27 2#480000|1100#40380
|
||||
230 230 27 2#485000|1100#40980
|
||||
231 231 27 2#490000|1100#41580
|
||||
232 232 28 2#495000|1100#42180
|
||||
233 233 28 2#500000|1100#42780
|
||||
234 234 28 2#505000|1100#43380
|
||||
235 235 28 2#510000|1100#43980
|
||||
236 236 28 2#515000|1100#44580
|
||||
237 237 28 2#520000|1100#45180
|
||||
238 238 29 2#525000|1100#45780
|
||||
239 239 29 2#530000|1100#46380
|
||||
240 240 29 2#535000|1100#46980
|
||||
241 241 29 2#540000|1100#47580
|
||||
242 242 29 2#545000|1100#48180
|
||||
243 243 29 2#550000|1100#48780
|
||||
244 244 30 2#555000|1100#49380
|
||||
245 245 30 2#560000|1100#49980
|
||||
246 246 30 2#565000|1100#50580
|
||||
247 247 30 2#570000|1100#51180
|
||||
248 248 30 2#575000|1100#51780
|
||||
249 249 30 2#580000|1100#52380
|
||||
250 250 31 2#585000|1100#52980
|
|
@ -14,6 +14,7 @@ import com.ljsd.jieling.network.NettyServerAutoConfiguration;
|
|||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISessionFactory;
|
||||
import com.ljsd.jieling.thread.ThreadManager;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -96,6 +97,7 @@ public class GameApplication {
|
|||
serverConfigTmp.setCacheOpenTime(date.getTime());
|
||||
serverConfig = serverConfigTmp;
|
||||
}
|
||||
KeyGenUtils.setMachineNum(serverConfiguration.getServerProperties().getNum());
|
||||
try {
|
||||
LOGGER.info("main->CoreApplication start...");
|
||||
ISessionFactory sessionFactory = new ISessionFactory();
|
||||
|
|
|
@ -12,13 +12,14 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private int[][] bornItem;
|
||||
|
||||
private int[] speedFormula;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -27,5 +28,18 @@ public class SGameSetting implements BaseConfig {
|
|||
return bornItem;
|
||||
}
|
||||
|
||||
public int[] getSpeedFormula() {
|
||||
return speedFormula;
|
||||
}
|
||||
|
||||
public float calSpeed(float speed){
|
||||
float result = 0.0f;
|
||||
int length = speedFormula.length;
|
||||
for(int i=0;i< speedFormula.length;i++){
|
||||
double pow = Math.pow(speed, --length);
|
||||
result += speedFormula[i]*pow;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,10 +16,13 @@ public class SHeroLevlConfig implements BaseConfig{
|
|||
|
||||
private float characterLevelPara;
|
||||
|
||||
private int[][] consume;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sHeroLevlConfigMap = STableManager.getConfig(SHeroLevlConfig.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,4 +45,8 @@ public class SHeroLevlConfig implements BaseConfig{
|
|||
public float getCharacterLevelPara() {
|
||||
return characterLevelPara;
|
||||
}
|
||||
|
||||
public int[][] getConsume() {
|
||||
return consume;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ public class ServerProperties {
|
|||
|
||||
private String openTime;
|
||||
|
||||
private int num;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -58,6 +60,14 @@ public class ServerProperties {
|
|||
this.openTime = openTime;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerProperties{" +
|
||||
|
@ -66,6 +76,7 @@ public class ServerProperties {
|
|||
", channel='" + channel + '\'' +
|
||||
", isLAN=" + isLAN +
|
||||
", openTime=" + openTime +
|
||||
", num=" + num +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ public interface GlobalItemType {
|
|||
int SUCCESSIVELY_RANDOM = 2; // 依次随机
|
||||
|
||||
// 物品类型
|
||||
int GEM = 1; // 钻石Id(充值获得)
|
||||
int ITEM = 10; //道具
|
||||
int CARD = 11; // 卡牌
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
|
@ -34,27 +36,8 @@ public class GetAllItemHandler extends BaseHandler {
|
|||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,getItemInfoRequest.getNum(),getItemInfoRequest.getStr());
|
||||
|
||||
List<CommonProto.Item> itemList = new ArrayList<>();
|
||||
CommonProto.Item item1 = CommonProto.Item.newBuilder()
|
||||
.setItemId(1)
|
||||
.setItemNum(111)
|
||||
.build();
|
||||
CommonProto.Item item2 = CommonProto.Item.newBuilder()
|
||||
.setItemId(2)
|
||||
.setItemNum(222)
|
||||
.build();
|
||||
CommonProto.Item item3 = CommonProto.Item.newBuilder()
|
||||
.setItemId(3)
|
||||
.setItemNum(333)
|
||||
.build();
|
||||
|
||||
|
||||
itemList.add(item1);
|
||||
itemList.add(item2);
|
||||
itemList.add(item3);
|
||||
|
||||
// User user = UserManager.getUserForLogin(userId);
|
||||
// List<CommonProto.Item> itemList = ItemUtil.getAllItem(user);
|
||||
User user = UserManager.getUserForLogin(userId);
|
||||
List<CommonProto.Item> itemList = ItemUtil.getAllItem(user);
|
||||
PlayerInfoProto.GetItemInfoResponse getItemInfoResponse = PlayerInfoProto.GetItemInfoResponse.newBuilder()
|
||||
.addAllItemlist(itemList)
|
||||
.build();
|
||||
|
|
|
@ -2,7 +2,10 @@ package com.ljsd.jieling.logic.dao;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SCHero;
|
||||
import com.ljsd.jieling.config.SHeroLevlConfig;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -17,17 +20,6 @@ public class Hero extends MongoBase {
|
|||
|
||||
private int star;
|
||||
|
||||
|
||||
private float hp;
|
||||
|
||||
private float attack;
|
||||
|
||||
private float pDefence;
|
||||
|
||||
private float mDefence;
|
||||
|
||||
private float speed;
|
||||
|
||||
private List<Integer> skillList;
|
||||
|
||||
private List<Equip> equipList;
|
||||
|
@ -35,22 +27,36 @@ public class Hero extends MongoBase {
|
|||
public Hero(){}
|
||||
|
||||
public Hero(String uid,int heroTid){
|
||||
this.id = uid + "" + heroTid;
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO,uid);
|
||||
SCHero scHero = SCHero.getsCHero().get(heroTid);
|
||||
this.templateId = scHero.getId();
|
||||
this.level = 1;
|
||||
this.star = 1;
|
||||
this.hp = scHero.getHp();
|
||||
this.attack = scHero.getAttack();
|
||||
this.pDefence = scHero.getPhysicalDefence();
|
||||
this.mDefence = scHero.getMagicDefence();
|
||||
this.speed = scHero.getSpeed();
|
||||
this.skillList = new ArrayList<>();
|
||||
this.equipList = new ArrayList<>();
|
||||
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
|
||||
if(skillIds!=null && skillIds.isEmpty()){
|
||||
this.skillList.addAll(skillIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void upStar(int upStar) throws Exception {
|
||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
|
||||
if(skillIds!=null && skillIds.isEmpty()){
|
||||
if(this.skillList!=null){
|
||||
skillList.clear();
|
||||
}else{
|
||||
this.skillList = new ArrayList<>();
|
||||
}
|
||||
this.skillList.addAll(skillIds);
|
||||
}
|
||||
this.star += upStar;
|
||||
updateString("star",star);
|
||||
updateString("skillList",skillList);
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
|
@ -72,30 +78,6 @@ public class Hero extends MongoBase {
|
|||
this.star = star;
|
||||
}
|
||||
|
||||
public void setHp(float hp) throws Exception {
|
||||
updateString("hp",hp);
|
||||
this.hp = hp;
|
||||
}
|
||||
|
||||
public void setAttack(float attack) throws Exception {
|
||||
updateString("attack",attack);
|
||||
this.attack = attack;
|
||||
}
|
||||
|
||||
public void setpDefence(float pDefence) throws Exception {
|
||||
updateString("pDefence",pDefence);
|
||||
this.pDefence = pDefence;
|
||||
}
|
||||
|
||||
public void setmDefence(float mDefence) throws Exception {
|
||||
updateString("mDefence",mDefence);
|
||||
this.mDefence = mDefence;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) throws Exception {
|
||||
updateString("speed",speed);
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -113,27 +95,6 @@ public class Hero extends MongoBase {
|
|||
return star;
|
||||
}
|
||||
|
||||
public float getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
public float getAttack() {
|
||||
return attack;
|
||||
}
|
||||
|
||||
public float getpDefence() {
|
||||
return pDefence;
|
||||
}
|
||||
|
||||
public float getmDefence() {
|
||||
return mDefence;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
|
||||
public List<Integer> getSkillList() {
|
||||
return skillList;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.ljsd.jieling.logic.hero;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.SItem;
|
||||
import com.ljsd.jieling.config.SLotteryRewardConfig;
|
||||
import com.ljsd.jieling.config.SLotterySetting;
|
||||
import com.ljsd.jieling.config.ServerConfig;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
@ -196,6 +193,28 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
|
||||
public void upHeroLevel(ISession session,String heroId) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
if( null == hero){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//校验消耗
|
||||
int oldLevel = hero.getLevel();
|
||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(oldLevel);
|
||||
int[][] consume = sHeroLevlConfig.getConsume();
|
||||
|
||||
hero.setLevel( oldLevel + 1);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -43,11 +43,6 @@ public class CBean2Proto {
|
|||
.setHeroId(hero.getTemplateId())
|
||||
.setLevel(hero.getLevel())
|
||||
.setStar(hero.getStar())
|
||||
.setHp((int)hero.getHp())
|
||||
.setAttack((int)hero.getAttack())
|
||||
.setPDefence((int)hero.getpDefence())
|
||||
.setMDefence((int)hero.getmDefence())
|
||||
.setSpeed((int)hero.getSpeed())
|
||||
.addAllSkillIdList(hero.getSkillList())
|
||||
.addAllEquipIdList(getHeroEquip(hero.getEquipList()))
|
||||
.build();
|
||||
|
|
|
@ -200,4 +200,73 @@ public class ItemUtil {
|
|||
heroList.add(CBean2Proto.getHero(hero));
|
||||
}
|
||||
|
||||
|
||||
public static boolean itemCost(User user,int[][] costItems) throws Exception {
|
||||
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> moneyMap = new HashMap<>();
|
||||
selectCost(costItems,itemMap,moneyMap);
|
||||
boolean result = checkCost(user, itemMap, moneyMap);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItem(user, itemMap);
|
||||
useMoney(user, moneyMap);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void useMoney(User user, Map<Integer, Integer> moneyMap) throws Exception {
|
||||
for (Map.Entry<Integer, Integer> entry : moneyMap.entrySet()) {
|
||||
int itemId = entry.getKey();
|
||||
int itemNum = entry.getValue();
|
||||
if (itemId==GlobalItemType.GEM){
|
||||
user.getPlayerInfoManager().setGem(user.getPlayerInfoManager().getGem() - itemNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkCost(User user, Map<Integer, Integer> itemMap, Map<Integer, Integer> moneyMap) {
|
||||
if (itemMap != null) {
|
||||
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
||||
Item item = user.getItemManager().getItem(entry.getKey());
|
||||
if (item == null || item.getItemNum() < entry.getValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (moneyMap != null) {
|
||||
for (Map.Entry<Integer, Integer> entry : moneyMap.entrySet()) {
|
||||
int count = 0;
|
||||
if (entry.getKey() == GlobalItemType.GEM) {
|
||||
count = user.getPlayerInfoManager().getGem();
|
||||
}
|
||||
if (count < entry.getValue()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private static void selectCost(int[][] costItems, Map<Integer, Integer> itemMap, Map<Integer, Integer> moneyMap) {
|
||||
for (int[] costItem : costItems){
|
||||
int itemId = costItem[0];
|
||||
int itemNum = costItem[1];
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
switch (sItem.getItemType()) {
|
||||
case GlobalItemType.GEM:
|
||||
putcountMap(itemId,itemNum,moneyMap);
|
||||
break;
|
||||
case GlobalItemType.ITEM:
|
||||
putcountMap(itemId,itemNum,itemMap);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
public class KeyGenUtils {
|
||||
//机器码
|
||||
private static String machineNum;
|
||||
|
||||
private static Object uuidLock = new Object();
|
||||
private static Integer uuidIndex = 0;
|
||||
private static long uuidPreTimeStamp = 0;
|
||||
|
||||
public static String produceIdByModule(UUIDEnum uuidEnum, String userId){
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(userId);
|
||||
stringBuffer.append(machineNum);
|
||||
if (uuidEnum.getValue()<=9){
|
||||
stringBuffer.append(0).append(uuidEnum.getValue());
|
||||
}else {
|
||||
stringBuffer.append(uuidEnum.getValue());
|
||||
}
|
||||
long timestamp = 0;
|
||||
int index = 0;
|
||||
//必须加锁,否则多线程会有问题
|
||||
//因是基于用户的,理论上可以不加锁,用户的处理在一个线程中
|
||||
synchronized(uuidLock) {
|
||||
timestamp = System.currentTimeMillis() / 1000;
|
||||
if (timestamp > uuidPreTimeStamp) {
|
||||
uuidIndex = 0;
|
||||
uuidPreTimeStamp = timestamp;
|
||||
}
|
||||
index = uuidIndex++;
|
||||
}
|
||||
|
||||
stringBuffer.append(timestamp);
|
||||
//不是用format,仅仅是为了提高效率
|
||||
if(index < 10){
|
||||
stringBuffer.append("000");
|
||||
} else if(index < 100){
|
||||
stringBuffer.append("00");
|
||||
} else if(index < 1000){
|
||||
stringBuffer.append("0");
|
||||
}
|
||||
stringBuffer.append(index);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static void setMachineNum(int machineNum) {
|
||||
if(machineNum/10 == 0){
|
||||
KeyGenUtils.machineNum = "0" + machineNum;
|
||||
}else{
|
||||
KeyGenUtils.machineNum = machineNum +"";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -147,4 +147,11 @@ public class StringUtil {
|
|||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static boolean isEmpty(String source){
|
||||
if( source == null || source.isEmpty()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
public enum UUIDEnum {
|
||||
HERO(0),
|
||||
EQUIP(1);
|
||||
|
||||
private int value;
|
||||
UUIDEnum( int value ){
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#server info
|
||||
server.id = 10180
|
||||
server.openTime = 20190101000101
|
||||
server.num = 1
|
||||
|
||||
|
||||
# redis config
|
||||
|
|
|
@ -154,7 +154,7 @@ public class ExcelUtils {
|
|||
int rownum = sheet.getLastRowNum();
|
||||
FileWriter fw = new FileWriter(path + sheetName + ".txt");
|
||||
PrintWriter out = new PrintWriter(fw);
|
||||
for (int i = 0; i < rownum; i++) {
|
||||
for (int i = 0; i <= rownum; i++) {
|
||||
if (i == 2 || i == 3 || i == 4 ||i == 5||i == 6){
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package network.client;
|
|||
import com.google.protobuf.MessageLite;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
@ -20,6 +18,7 @@ import java.util.concurrent.LinkedBlockingDeque;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.ljsd.jieling.protocols.MessageTypeProto.MessageType.GET_HEROINFO_RESPONSE_VALUE;
|
||||
import static com.ljsd.jieling.protocols.MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE;
|
||||
|
||||
/**
|
||||
* Created by justin on 14-8-12.
|
||||
|
@ -120,6 +119,15 @@ public class NettyTCPClientHandler extends SimpleChannelInboundHandler<Object> {
|
|||
// System.out.println("--->>>>" + heroListCount);
|
||||
}
|
||||
|
||||
|
||||
if(msgId == HERO_RAND_RESPONSE_VALUE){
|
||||
HeroInfoProto.HeroRandResponse heroRandResponse = HeroInfoProto.HeroRandResponse.parseFrom(packetData);
|
||||
int heroListCount = heroRandResponse.getHeroListCount();
|
||||
// int heroListCount = getHeroInfoResponse.getHeroListCount();
|
||||
//int heroListCount = getHeroInfoResponse.getHeroListCount();
|
||||
// System.out.println("--->>>>" + heroListCount);
|
||||
}
|
||||
|
||||
System.out.println("back hartbeat id : "+msgId);
|
||||
|
||||
//System.out.println(JsonFormat.printToString());
|
||||
|
|
Loading…
Reference in New Issue