Merge branch 'master' of 60.1.1.230:backend/jieling_server

back_recharge
wangyuan 2019-01-28 18:21:22 +08:00
commit 788aa617e5
18 changed files with 734 additions and 310 deletions

View File

@ -1,158 +1,159 @@
Id BackpackOrNot ItemType ItemBaseType Quantity IsStacking
int bool int int int bool
1 false 0 0 1 true
2 false 0 0 2 true
3 false 0 0 3 true
4 true 0 4 4 true
5 true 0 4 5 true
6 true 0 4 1 true
7 true 0 3 2 true
8 true 0 3 3 true
9 true 0 3 4 true
10 true 0 3 5 true
11 true 0 3 1 true
12 true 0 3 2 true
13 true 0 3 3 true
14 false 0 0 4 true
15 false 0 0 5 true
16 false 0 0 1 true
17 false 0 0 2 true
18 false 0 0 3 true
19 true 0 4 4 true
20 true 0 4 5 true
1001 true 0 2 1 true
1002 true 0 2 2 true
1003 true 0 2 3 true
1004 true 0 2 4 true
1005 true 0 2 5 true
1006 true 0 2 1 true
1007 true 0 2 2 true
1008 true 0 2 3 true
1009 true 0 2 4 true
1010 true 0 4 5 true
1011 true 0 4 1 true
1012 true 0 4 2 true
1013 true 0 4 3 true
1014 true 0 4 4 true
1015 true 0 4 5 true
1016 true 0 4 1 true
1017 true 0 4 2 true
1018 true 0 4 3 true
1019 true 0 4 4 true
1020 true 0 4 5 true
1021 true 0 4 1 true
1501 true 0 2 2 true
1502 true 0 2 3 true
1503 true 0 2 4 true
1504 true 0 4 5 true
1505 true 0 4 1 true
1506 true 0 4 2 true
1507 true 0 4 3 true
2001 true 0 2 4 true
2002 true 0 2 5 true
2003 true 0 2 1 true
2004 true 0 2 2 true
10001 false 1 0 5 false
10002 false 1 0 5 false
10003 false 1 0 5 false
10004 false 1 0 5 false
10005 false 1 0 5 false
10006 false 1 0 5 false
10007 false 1 0 5 false
10008 false 1 0 5 false
10009 false 1 0 5 false
10010 false 1 0 5 false
10011 false 1 0 5 false
10012 false 1 0 5 false
10013 false 1 0 5 false
10014 false 1 0 5 false
10015 false 1 0 5 false
10016 false 1 0 5 false
10017 false 1 0 5 false
10018 false 1 0 5 false
10019 false 1 0 5 false
10020 false 1 0 5 false
10021 false 1 0 5 false
10022 false 1 0 5 false
10023 false 1 0 5 false
10024 false 1 0 5 false
10025 false 1 0 5 false
10026 false 1 0 5 false
10027 false 1 0 5 false
10028 false 1 0 5 false
10029 false 1 0 5 false
10030 false 1 0 5 false
10031 false 1 0 5 false
10032 false 1 0 5 false
10033 false 1 0 5 false
10034 false 1 0 5 false
10035 false 1 0 5 false
10036 false 1 0 5 false
10037 false 1 0 5 false
10038 false 1 0 5 false
10039 false 1 0 5 false
10040 false 1 0 5 false
10041 false 1 0 5 false
10042 false 1 0 5 false
10043 false 1 0 5 false
10044 false 1 0 5 false
10045 false 1 0 5 false
10046 false 1 0 5 false
10047 false 1 0 5 false
10048 false 1 0 5 false
10049 false 1 0 5 false
10050 false 1 0 5 false
10051 false 1 0 5 false
10052 false 1 0 5 false
11001 true 2 5 5 true
11002 true 2 5 5 true
11003 true 2 5 5 true
11004 true 2 5 5 true
11005 true 2 5 5 true
11006 true 2 5 5 true
11007 true 2 5 5 true
11008 true 2 5 5 true
11009 true 2 5 5 true
11010 true 2 5 5 true
11011 true 2 5 5 true
11012 true 2 5 5 true
11013 true 2 5 5 true
11014 true 2 5 5 true
11015 true 2 5 5 true
11016 true 2 5 5 true
11017 true 2 5 5 true
11018 true 2 5 5 true
11019 true 2 5 5 true
11020 true 2 5 5 true
11021 true 2 5 5 true
11022 true 2 5 5 true
11023 true 2 5 5 true
11024 true 2 5 5 true
11025 true 2 5 5 true
11026 true 2 5 5 true
11027 true 2 5 5 true
11028 true 2 5 5 true
11029 true 2 5 5 true
11030 true 2 5 5 true
11031 true 2 5 5 true
11032 true 2 5 5 true
11033 true 2 5 5 true
11034 true 2 5 5 true
11035 true 2 5 5 true
11036 true 2 5 5 true
11037 true 2 5 5 true
11038 true 2 5 5 true
11039 true 2 5 5 true
11040 true 2 5 5 true
11041 true 2 5 5 true
11042 true 2 5 5 true
11043 true 2 5 5 true
11044 true 2 5 5 true
11045 true 2 5 5 true
11046 true 2 5 5 true
11047 true 2 5 5 true
11048 true 2 5 5 true
11049 true 2 5 5 true
11050 true 2 5 5 true
11051 true 2 5 5 true
11052 true 2 5 5 true
Id BackpackOrNot ItemType ItemBaseType Quantity Isopen Price UseType RewardGroup UsePerCount
int bool int int int bool mut,int#int,1 int int int
1 false 0 0 1 false null 0 0 0
2 false 0 0 2 false null 0 0 0
3 false 0 0 3 false null 0 0 0
4 true 0 4 4 false null 0 0 0
5 true 0 4 5 false null 0 0 0
6 true 0 4 1 false null 0 0 0
7 true 0 3 2 false null 0 0 0
8 true 0 3 3 false null 0 0 0
9 true 0 3 4 false null 0 0 0
10 true 0 3 5 false null 0 0 0
11 true 0 3 1 false null 0 0 0
12 true 0 3 2 false null 0 0 0
13 true 0 3 3 false null 0 0 0
14 false 0 0 4 false null 0 0 0
15 false 0 0 5 false null 0 0 0
16 false 0 0 1 false null 0 0 0
17 false 0 0 2 false null 0 0 0
18 false 0 0 3 false null 0 0 0
19 true 0 4 4 false null 0 0 0
20 true 0 4 5 false null 0 0 0
1001 true 0 2 1 false null 0 0 0
1002 true 0 2 2 false null 0 0 0
1003 true 0 2 3 false null 0 0 0
1004 true 0 2 4 false null 0 0 0
1005 true 0 2 5 false null 0 0 0
1006 true 0 2 1 false null 0 0 0
1007 true 0 2 2 false null 0 0 0
1008 true 0 2 3 false null 0 0 0
1009 true 0 2 4 false null 0 0 0
1010 true 0 4 5 false null 0 0 0
1011 true 0 4 1 false null 0 0 0
1012 true 0 4 2 false null 0 0 0
1013 true 0 4 3 false null 0 0 0
1014 true 0 4 4 false null 0 0 0
1015 true 0 4 5 false null 0 0 0
1016 true 0 4 1 false null 0 0 0
1017 true 0 4 2 false null 0 0 0
1018 true 0 4 3 false null 0 0 0
1019 true 0 4 4 false null 0 0 0
1020 true 0 4 5 false null 0 0 0
1021 true 0 4 1 false null 0 0 0
1501 true 0 2 2 false null 0 0 0
1502 true 0 2 3 false null 0 0 0
1503 true 0 2 4 false null 0 0 0
1504 true 0 4 5 false null 0 0 0
1505 true 0 4 1 false null 0 0 0
1506 true 0 4 2 false null 0 0 0
1507 true 0 4 3 false null 0 0 0
2001 true 0 2 4 false null 0 0 0
2002 true 0 2 5 false null 0 0 0
2003 true 0 2 1 false null 0 0 0
2004 true 0 2 2 false null 0 0 0
10001 false 1 0 5 false null 0 0 0
10002 false 1 0 5 false null 0 0 0
10003 false 1 0 5 false null 0 0 0
10004 false 1 0 5 false null 0 0 0
10005 false 1 0 5 false null 0 0 0
10006 false 1 0 5 false null 0 0 0
10007 false 1 0 5 false null 0 0 0
10008 false 1 0 5 false null 0 0 0
10009 false 1 0 5 false null 0 0 0
10010 false 1 0 5 false null 0 0 0
10011 false 1 0 5 false null 0 0 0
10012 false 1 0 5 false null 0 0 0
10013 false 1 0 5 false null 0 0 0
10014 false 1 0 5 false null 0 0 0
10015 false 1 0 5 false null 0 0 0
10016 false 1 0 5 false null 0 0 0
10017 false 1 0 5 false null 0 0 0
10018 false 1 0 5 false null 0 0 0
10019 false 1 0 5 false null 0 0 0
10020 false 1 0 5 false null 0 0 0
10021 false 1 0 5 false null 0 0 0
10022 false 1 0 5 false null 0 0 0
10023 false 1 0 5 false null 0 0 0
10024 false 1 0 5 false null 0 0 0
10025 false 1 0 5 false null 0 0 0
10026 false 1 0 5 false null 0 0 0
10027 false 1 0 5 false null 0 0 0
10028 false 1 0 5 false null 0 0 0
10029 false 1 0 5 false null 0 0 0
10030 false 1 0 5 false null 0 0 0
10031 false 1 0 5 false null 0 0 0
10032 false 1 0 5 false null 0 0 0
10033 false 1 0 5 false null 0 0 0
10034 false 1 0 5 false null 0 0 0
10035 false 1 0 5 false null 0 0 0
10036 false 1 0 5 false null 0 0 0
10037 false 1 0 5 false null 0 0 0
10038 false 1 0 5 false null 0 0 0
10039 false 1 0 5 false null 0 0 0
10040 false 1 0 5 false null 0 0 0
10041 false 1 0 5 false null 0 0 0
10042 false 1 0 5 false null 0 0 0
10043 false 1 0 5 false null 0 0 0
10044 false 1 0 5 false null 0 0 0
10045 false 1 0 5 false null 0 0 0
10046 false 1 0 5 false null 0 0 0
10047 false 1 0 5 false null 0 0 0
10048 false 1 0 5 false null 0 0 0
10049 false 1 0 5 false null 0 0 0
10050 false 1 0 5 false null 0 0 0
10051 false 1 0 5 false null 0 0 0
10052 false 1 0 5 false null 0 0 0
11001 true 2 5 5 false 14#1000 1 101 50
11002 true 2 5 5 false 14#1001 1 102 50
11003 true 2 5 5 false 14#1002 1 103 50
11004 true 2 5 5 false 14#1003 1 104 50
11005 true 2 5 5 false 14#1004 1 105 50
11006 true 2 5 5 false 14#1005 1 106 50
11007 true 2 5 5 false 14#1006 1 107 50
11008 true 2 5 5 false 14#1007 1 108 50
11009 true 2 5 5 false 14#1008 1 109 50
11010 true 2 5 5 false 14#1009 1 110 50
11011 true 2 5 5 false 14#1010 1 111 50
11012 true 2 5 5 false 14#1011 1 112 50
11013 true 2 5 5 false 14#1012 1 113 50
11014 true 2 5 5 false 14#1013 1 114 50
11015 true 2 5 5 false 14#1014 1 115 50
11016 true 2 5 5 false 14#1015 1 116 50
11017 true 2 5 5 false 14#1016 1 117 50
11018 true 2 5 5 false 14#1017 1 118 50
11019 true 2 5 5 false 14#1018 1 119 50
11020 true 2 5 5 false 14#1019 1 120 50
11021 true 2 5 5 false 14#1020 1 121 50
11022 true 2 5 5 false 14#1021 1 122 50
11023 true 2 5 5 false 14#1022 1 123 50
11024 true 2 5 5 false 14#1023 1 124 40
11025 true 2 5 5 false 14#1024 1 125 40
11026 true 2 5 5 false 14#1025 1 126 40
11027 true 2 5 5 false 14#1026 1 127 40
11028 true 2 5 5 false 14#1027 1 128 40
11029 true 2 5 5 false 14#1028 1 129 40
11030 true 2 5 5 false 14#1029 1 130 40
11031 true 2 5 5 false 14#1030 1 131 40
11032 true 2 5 5 false 14#1031 1 132 40
11033 true 2 5 5 false 14#1032 1 133 40
11034 true 2 5 5 false 14#1033 1 134 40
11035 true 2 5 5 false 14#1034 1 135 40
11036 true 2 5 5 false 14#1035 1 136 40
11037 true 2 5 5 false 14#1036 1 137 40
11038 true 2 5 5 false 14#1037 1 138 40
11039 true 2 5 5 false 14#1038 1 139 40
11040 true 2 5 5 false 14#1039 1 140 40
11041 true 2 5 5 false 14#1040 1 141 40
11042 true 2 5 5 false 14#1041 1 142 40
11043 true 2 5 5 false 14#1042 1 143 40
11044 true 2 5 5 false 14#1043 1 144 40
11045 true 2 5 5 false 14#1044 1 145 40
11046 true 2 5 5 false 14#1045 1 146 40
11047 true 2 5 5 false 14#1046 1 147 30
11048 true 2 5 5 false 14#1047 1 148 30
11049 true 2 5 5 false 14#1048 1 149 30
11050 true 2 5 5 false 14#1049 1 150 30
11051 true 2 5 5 false 14#1050 1 151 30
11052 true 2 5 5 false 14#1051 1 152 30
400001 true 0 3 5 false 14#1000 1 2 1

View File

@ -1,3 +1,56 @@
Id IsUpset RewardItem RewardMaxNum Loop
int int mut,int#int,1 int int
1 2 1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50#51#52#53#54#55#56 1 0
1 2 1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50#51#52 1 0
2 2 1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50#51#52 1 0
101 1 101 1 0
102 1 102 1 0
103 1 103 1 0
104 1 104 1 0
105 1 105 1 0
106 1 106 1 0
107 1 107 1 0
108 1 108 1 0
109 1 109 1 0
110 1 110 1 0
111 1 111 1 0
112 1 112 1 0
113 1 113 1 0
114 1 114 1 0
115 1 115 1 0
116 1 116 1 0
117 1 117 1 0
118 1 118 1 0
119 1 119 1 0
120 1 120 1 0
121 1 121 1 0
122 1 122 1 0
123 1 123 1 0
124 1 124 1 0
125 1 125 1 0
126 1 126 1 0
127 1 127 1 0
128 1 128 1 0
129 1 129 1 0
130 1 130 1 0
131 1 131 1 0
132 1 132 1 0
133 1 133 1 0
134 1 134 1 0
135 1 135 1 0
136 1 136 1 0
137 1 137 1 0
138 1 138 1 0
139 1 139 1 0
140 1 140 1 0
141 1 141 1 0
142 1 142 1 0
143 1 143 1 0
144 1 144 1 0
145 1 145 1 0
146 1 146 1 0
147 1 147 1 0
148 1 148 1 0
149 1 149 1 0
150 1 150 1 0
151 1 151 1 0
152 1 152 1 0

View File

@ -1,58 +1,106 @@
id itemId Chance GrowChance RandomMin RandomMax
int int int int int int
1 10001 100 0 1 1
2 10002 100 0 1 1
3 10003 100 0 1 1
4 10004 100 0 1 1
5 10005 100 0 1 1
6 10006 100 0 1 1
7 10007 100 0 1 1
8 10008 100 0 1 1
9 10009 100 0 1 1
10 10010 100 0 1 1
11 10011 100 0 1 1
12 10012 100 0 1 1
13 10013 100 0 1 1
14 10014 100 0 1 1
15 10015 100 0 1 1
16 10016 100 0 1 1
17 10017 100 0 1 1
18 10018 100 0 1 1
19 10019 100 0 1 1
20 10020 100 0 1 1
21 10021 100 0 1 1
22 10022 100 0 1 1
23 10023 100 0 1 1
24 10024 100 0 1 1
25 10025 100 0 1 1
26 10026 100 0 1 1
27 10027 100 0 1 1
28 10028 100 0 1 1
29 10029 100 0 1 1
30 10030 100 0 1 1
31 10031 100 0 1 1
32 10032 100 0 1 1
33 10033 100 0 1 1
34 10034 100 0 1 1
35 10035 100 0 1 1
36 10036 100 0 1 1
37 10037 100 0 1 1
38 10038 100 0 1 1
39 10039 100 0 1 1
40 10040 100 0 1 1
41 10041 100 0 1 1
42 10042 100 0 1 1
43 10043 100 0 1 1
44 10044 100 0 1 1
45 10045 100 0 1 1
46 10046 100 0 1 1
47 10047 100 0 1 1
48 10048 100 0 1 1
49 10049 100 0 1 1
50 10050 100 0 1 1
51 10051 100 0 1 1
52 10052 100 0 1 1
53 10053 100 0 1 1
54 10054 100 0 1 1
55 10055 100 0 1 1
56 10056 100 0 1 1
Id ItemId Chance GrowChance RandomMin RandomMax
int int int float int int
1 10001 100 1 1 1
2 10002 100 1 1 1
3 10003 100 1 1 1
4 10004 100 1 1 1
5 10005 100 1 1 1
6 10006 100 1 1 1
7 10007 100 1 1 1
8 10008 100 1 1 1
9 10009 100 1 1 1
10 10010 100 1 1 1
11 10011 100 1 1 1
12 10012 100 1 1 1
13 10013 100 1 1 1
14 10014 100 1 1 1
15 10015 100 1 1 1
16 10016 100 1 1 1
17 10017 100 1 1 1
18 10018 100 1 1 1
19 10019 100 1 1 1
20 10020 100 1 1 1
21 10021 100 1 1 1
22 10022 100 1 1 1
23 10023 100 1 1 1
24 10024 100 1 1 1
25 10025 100 1 1 1
26 10026 100 1 1 1
27 10027 100 1 1 1
28 10028 100 1 1 1
29 10029 100 1 1 1
30 10030 100 1 1 1
31 10031 100 1 1 1
32 10032 100 1 1 1
33 10033 100 1 1 1
34 10034 100 1 1 1
35 10035 100 1 1 1
36 10036 100 1 1 1
37 10037 100 1 1 1
38 10038 100 1 1 1
39 10039 100 1 1 1
40 10040 100 1 1 1
41 10041 100 1 1 1
42 10042 100 1 1 1
43 10043 100 1 1 1
44 10044 100 1 1 1
45 10045 100 1 1 1
46 10046 100 1 1 1
47 10047 100 1 1 1
48 10048 100 1 1 1
49 10049 100 1 1 1
50 10050 100 1 1 1
51 10051 100 1 1 1
52 10052 100 1 1 1
101 10001 100 1 1 1
102 10002 100 1 1 1
103 10003 100 1 1 1
104 10004 100 1 1 1
105 10005 100 1 1 1
106 10006 100 1 1 1
107 10007 100 1 1 1
108 10008 100 1 1 1
109 10009 100 1 1 1
110 10010 100 1 1 1
111 10011 100 1 1 1
112 10012 100 1 1 1
113 10013 100 1 1 1
114 10014 100 1 1 1
115 10015 100 1 1 1
116 10016 100 1 1 1
117 10017 100 1 1 1
118 10018 100 1 1 1
119 10019 100 1 1 1
120 10020 100 1 1 1
121 10021 100 1 1 1
122 10022 100 1 1 1
123 10023 100 1 1 1
124 10024 100 1 1 1
125 10025 100 1 1 1
126 10026 100 1 1 1
127 10027 100 1 1 1
128 10028 100 1 1 1
129 10029 100 1 1 1
130 10030 100 1 1 1
131 10031 100 1 1 1
132 10032 100 1 1 1
133 10033 100 1 1 1
134 10034 100 1 1 1
135 10035 100 1 1 1
136 10036 100 1 1 1
137 10037 100 1 1 1
138 10038 100 1 1 1
139 10039 100 1 1 1
140 10040 100 1 1 1
141 10041 100 1 1 1
142 10042 100 1 1 1
143 10043 100 1 1 1
144 10044 100 1 1 1
145 10045 100 1 1 1
146 10046 100 1 1 1
147 10047 100 1 1 1
148 10048 100 1 1 1
149 10049 100 1 1 1
150 10050 100 1 1 1
151 10051 100 1 1 1
152 10052 100 1 1 1

View File

@ -14,7 +14,11 @@ public class SItem implements BaseConfig {
private int itemType;
private int itemBaseType; //道具类型(该道具在哪个背包显示)
private int quantity;
private boolean isStacking;
private int[] price;
private int useType; //使用类型0不使用 1掉落组 2N选1
private int rewardGroup;
private int usePerCount;
private boolean isopen;
@Override
public void init() throws Exception {
@ -45,7 +49,23 @@ public class SItem implements BaseConfig {
return quantity;
}
public boolean isStacking() {
return isStacking;
public int[] getPrice() {
return price;
}
public int getUseType() {
return useType;
}
public int getRewardGroup() {
return rewardGroup;
}
public int getUsePerCount() {
return usePerCount;
}
public boolean isIsopen() {
return isopen;
}
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import com.ljsd.jieling.util.ItemUtil;
import java.util.Map;
@ -26,6 +27,8 @@ public class SRewardGroup implements BaseConfig {
@Override
public void init() throws Exception {
sRewardItemMap = STableManager.getConfig(SRewardGroup.class);
ItemUtil.initDropReward();
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import com.ljsd.jieling.util.ItemUtil;
import java.util.Map;
@ -11,13 +12,14 @@ public class SRewardItem implements BaseConfig {
private int id;
private int itemId;
private int chance; //获取概率
private int growChance; //成长概率 针对特殊处理,如果不获取,则获取概率增加
private float growChance; //成长概率 针对特殊处理,如果不获取,则获取概率增加
private int randomMin; //获取数量最小值
private int randomMax; //获取数量最大值
@Override
public void init() throws Exception {
sDropMap = STableManager.getConfig(SRewardItem.class);
ItemUtil.initDropReward();
}
@ -37,7 +39,7 @@ public class SRewardItem implements BaseConfig {
return chance;
}
public int getGrowChance() {
public float getGrowChance() {
return growChance;
}

View File

@ -2,9 +2,9 @@ package com.ljsd.jieling.globals;
public interface GlobalItemType {
//掉落物品类型
int ALL_DROP = 0; //全部掉落
int WEIGHT_DROP = 1; //随机掉落
int SUCCESSIVELY_RANDOM = 2; // 依次随机
int ALL_DROP = 1; //全部掉落
int WEIGHT_DROP = 2; //随机掉落
int SUCCESSIVELY_RANDOM = 3; // 依次随机
// 物品类型
int GEM = 3; // 钻石Id(充值获得)
@ -12,5 +12,10 @@ public interface GlobalItemType {
int CARD = 1; // 卡牌
int CARD_FRAGMENT = 2; // 卡牌碎片
int EQUIP = 3; //装备
int RANDOM_ITME = 5; // 随机道具
//物品使用类型
int NO_USE = 0 ; //不使用
int RANDOM_USE = 1; // 随机使用
}

View File

@ -1,6 +1,6 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.util.MailUtil;
import com.ljsd.jieling.logic.Mail.MailLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -31,7 +31,7 @@ public class GetAllMailHandler extends BaseHandler {
int msgIndex = netData.getIndex();
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={}",
userId, token,msgId,msgIndex);
List<CommonProto.Mail> allUserMail = MailUtil.getInstance().getAllUserMail(userId);
List<CommonProto.Mail> allUserMail = MailLogic.getInstance().getAllUserMail(userId);
PlayerInfoProto.GetAllMailInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetAllMailInfoResponse.newBuilder()
.addAllMialList(allUserMail)
.build();

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.logic.hero.HeroLogic;
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.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class HeroComposeHandler extends BaseHandler{
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.HERO_COMPOSE_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] bytes = netData.parseClientProtoNetData();
HeroInfoProto.HeroComposeRequest heroComposeRequest = HeroInfoProto.HeroComposeRequest.parseFrom(bytes);
CommonProto.Item item = heroComposeRequest.getItem();
HeroLogic.getInstance().heroCompose(iSession,item);
}
}

View File

@ -4,8 +4,7 @@ import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.MailUtil;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.logic.Mail.MailLogic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -31,7 +30,7 @@ public class ReadMailHandler extends BaseHandler {
userId, token,msgId,msgIndex);
PlayerInfoProto.MailReadRequest mailReadRequest = PlayerInfoProto.MailReadRequest.parseFrom(message);
String mailId = mailReadRequest.getMailId();
MailUtil.getInstance().readMail(iSession,mailId);
MailLogic.getInstance().readMail(iSession,mailId);
}
}

View File

@ -5,7 +5,7 @@ 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.MailUtil;
import com.ljsd.jieling.logic.Mail.MailLogic;
import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,7 +34,7 @@ public class TakeMailHandler extends BaseHandler {
userId, token,msgId,msgIndex);
PlayerInfoProto.TakeMailRequest takeMailRequest = PlayerInfoProto.TakeMailRequest.parseFrom(message);
List<String> mailIdsList = takeMailRequest.getMailIdsList();
CommonProto.Drop.Builder dropBuilder = MailUtil.getInstance().takeMail(mailIdsList, userId);
CommonProto.Drop.Builder dropBuilder = MailLogic.getInstance().takeMail(mailIdsList, userId);
PlayerInfoProto.TakeMailResponse takeMailResponse = PlayerInfoProto.TakeMailResponse.newBuilder()
.setDrop(dropBuilder)
.buildPartial();

View File

@ -0,0 +1,44 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.User;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.item.ItemLogic;
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.List;
@Component
public class UseAndPriceItemHandler extends BaseHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(UseAndPriceItemHandler.class);
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
PlayerInfoProto.UseAndPriceItemRequest useAndPriceItemRequest
= PlayerInfoProto.UseAndPriceItemRequest.parseFrom(netData.parseClientProtoNetData());
int type = useAndPriceItemRequest.getType();
CommonProto.Item item = useAndPriceItemRequest.getItem();
if (type == 0){
ItemLogic.getInstance().useItem(iSession,item);
}else{
ItemLogic.getInstance().priceItem(iSession,item);
}
}
}

View File

@ -1,27 +1,28 @@
package com.ljsd.jieling.util;
package com.ljsd.jieling.logic.Mail;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
public class MailUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(MailUtil.class);
public class MailLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(MailLogic.class);
private MailUtil(){}
private MailLogic(){}
public static class Instance {
public final static MailUtil instance = new MailUtil();
public final static MailLogic instance = new MailLogic();
}
public static MailUtil getInstance() {
return MailUtil.Instance.instance;
public static MailLogic getInstance() {
return MailLogic.Instance.instance;
}
/**

View File

@ -2,7 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.LjsdMongoTemplate;
import com.ljsd.jieling.util.MailUtil;
import com.ljsd.jieling.logic.Mail.MailLogic;
import com.ljsd.jieling.util.TimeUtils;
import org.springframework.context.ConfigurableApplicationContext;
@ -28,7 +28,7 @@ public class MailingSystemManager {
int nowTime = (int)(TimeUtils.now()/1000);
mailingSystem.getSysMailManager().addSystemMail(new SysMail(1));
MailingSystemManager.ljsdMongoTemplate.lastUpdate();
MailUtil.getInstance().sendSystemMail("开服邮件",new ArrayList<>(),"DSKGSD",nowTime,"1#5000|2#100",30*24*60*60,"IDIP",0,"0");
MailLogic.getInstance().sendSystemMail("开服邮件",new ArrayList<>(),"DSKGSD",nowTime,"1#5000|2#100",30*24*60*60,"IDIP",0,"0");
}
}

View File

@ -5,6 +5,7 @@ import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.HeroInfoProto;
@ -14,6 +15,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class HeroLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
@ -114,12 +116,10 @@ public class HeroLogic {
}
if( itemType == 2) {
Item item = itemManager.getItem(itemId);
if (item == null){
if (item == null) {
item = itemManager.newItem(itemId, itemNum);
}else{
if(sItem.isStacking()){
item.setItemNum(item.getItemNum() + itemNum);
}
} else {
item.setItemNum(item.getItemNum() + itemNum);
}
items.add(CBean2Proto.getItem(item));
}
@ -541,6 +541,30 @@ public class HeroLogic {
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,null,true);
}
/**
*
* @param iSession
* @param item
*/
public void heroCompose(ISession iSession, CommonProto.Item item) throws Exception {
int msgId = MessageTypeProto.MessageType.HERO_COMPOSE_RESPONSE_VALUE;
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
int itemId = item.getItemId();
int itemNum = item.getItemNum();
SItem sItem = SItem.getsItemMap().get(itemId);
boolean result = ItemUtil.checkCost(user, sItem, itemNum);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
}
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId,itemNum);
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap );
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
.newBuilder()
.setDrop(drop)
.build();
MessageUtil.sendMessage(iSession,1,msgId,heroComposeResponse,true); }
//异妖相关 组件放置升级
public void pokenmonUpLevel(ISession session,int pokemonId,int comonpentId) throws Exception {

View File

@ -0,0 +1,92 @@
package com.ljsd.jieling.logic.item;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.globals.GlobalItemType;
import com.ljsd.jieling.logic.dao.*;
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.*;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class ItemLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(ItemLogic.class);
private ItemLogic(){}
public static class Instance {
public final static ItemLogic instance = new ItemLogic();
}
public static ItemLogic getInstance() {
return ItemLogic.Instance.instance;
}
/**
*
* @param iSession
* @param item
* @throws Exception
*/
public void priceItem(ISession iSession,CommonProto.Item item) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
int itemId = item.getItemId();
int itemNum = item.getItemNum();
SItem sItem = SItem.getsItemMap().get(itemId);
if (sItem == null){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
return;
}
String costItem = itemId + "#"+ itemNum;
int[][] costItemArr = StringUtil.parseFiledInt2(costItem);
boolean result = ItemUtil.itemCost(user, costItemArr);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
return;
}
int[] prices = sItem.getPrice();
int priceItemId = prices[0];
int priceItemNum = prices[1] * itemNum;
String priceReward = priceItemId+"#"+priceItemNum;
int[][] ints = StringUtil.parseFiledInt2(priceReward);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, ints);
sendUseAndPriceItemMessage(iSession, msgId, drop);
}
private void sendUseAndPriceItemMessage(ISession iSession, int msgId, CommonProto.Drop.Builder drop) {
PlayerInfoProto.UseAndPriceItemResponse useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder()
.setDrop(drop)
.build();
MessageUtil.sendMessage(iSession, 1,msgId, useAndPriceItemResponse, true);
}
/**
* 使
* @param iSession
* @param item
*/
public void useItem(ISession iSession, CommonProto.Item item) throws Exception {
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
int itemId = item.getItemId();
int itemNum = item.getItemNum();
SItem sItem = SItem.getsItemMap().get(itemId);
boolean result = ItemUtil.checkCost(user, sItem, itemNum);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
}
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId,itemNum);
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user,randomMap);
sendUseAndPriceItemMessage(iSession, msgId, drop);
}
}

View File

@ -10,9 +10,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
public class ItemUtil {
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
//掉落
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr) throws Exception {
@ -20,17 +22,21 @@ public class ItemUtil {
Map<Integer, Integer> itemMap = new HashMap<>();
Map<Integer, Integer> cardMap = new HashMap<>();
Map<Integer,Integer> equipMap = new HashMap<>();
selectItemArr(itemArr,cardMap,itemMap,equipMap);
Map<Integer,Integer> randomMap = new HashMap<>();
selectItemArr(itemArr,cardMap,itemMap,equipMap,randomMap);
useRandomItem(user,randomMap);
addItem(user,itemMap,dropBuilder);
addCard(user,cardMap,dropBuilder);
addEquip(user,equipMap,dropBuilder);
return dropBuilder;
}
private static void selectItemArr(int[][] itemArr, Map<Integer, Integer> cardMap, Map<Integer, Integer> itemMap,Map<Integer,Integer> equipMap) {
private static void selectItemArr(int[][] itemArr, Map<Integer, Integer> cardMap, Map<Integer, Integer>
itemMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap) {
for (int[] items : itemArr){
getMap(items[0],items[1], itemMap, cardMap,equipMap,1);
getMap(items[0],items[1], itemMap, cardMap,equipMap,randomMap,1);
}
}
@ -40,15 +46,18 @@ public class ItemUtil {
Map<Integer, Integer> itemMap = new HashMap<>();
Map<Integer, Integer> cardMap = new HashMap<>();
Map<Integer, Integer> equipMap = new HashMap<>();
Map<Integer,Integer> randomMap = new HashMap<>();
for (int dropGroupId :dropGroupIds){
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(dropGroupId);
if (sRewardGroup == null){
continue;
}
selectDrop(sRewardGroup,itemMap,cardMap,equipMap,dropRatio);
selectDrop(sRewardGroup,itemMap,cardMap,equipMap,randomMap,dropRatio);
}
useRandomItem(user,randomMap);
addItem(user,itemMap,dropBuilder);
addCard(user,cardMap,dropBuilder);
addEquip(user,equipMap,dropBuilder);
return dropBuilder;
}
public static CommonProto.Drop.Builder drop(User user, Map<int [],Float> dropGroupAndRatioMap) throws Exception {
@ -60,86 +69,81 @@ public class ItemUtil {
}
return dropBuilder;
}
private static void selectDrop(SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) {
int[] rewardItem = sRewardGroup.getRewardItem();
StringBuilder rewardStr = new StringBuilder();
StringBuilder weight = new StringBuilder();
for (int dropId :rewardItem){
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(dropId);
if (sRewardItem == null){
continue;
}
if (rewardStr.length() == 0){
rewardStr = new StringBuilder(String.valueOf(sRewardItem.getItemId()));
}else{
rewardStr.append("#").append(sRewardItem.getItemId());
}
if (weight.length() == 0){
weight = new StringBuilder(String.valueOf(sRewardItem.getChance()));
}else{
weight.append("#").append(sRewardItem.getItemId());
}
}
private static void selectDrop(SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap , float dropRatio) {
String dropInfo = dropRewardMap.get(sRewardGroup.getId());
String rewardStr = dropInfo.split("\\|")[0];
String weight = dropInfo.split("\\|")[1];
switch (sRewardGroup.getIsUpset()) {
case GlobalItemType.ALL_DROP:
getMap(StringUtil.parseFiledInt(rewardStr.toString()),itemMap,cardMap,equipMap,dropRatio);
getMap(StringUtil.parseFiledInt(rewardStr),itemMap,cardMap,equipMap,randomMap,dropRatio);
break;
case GlobalItemType.WEIGHT_DROP:
getRandomMap(sRewardGroup.getRewardMaxNum(),rewardStr.toString().split("#"),weight.toString().split("#"),
itemMap,equipMap,cardMap,dropRatio);
getRandomMap(sRewardGroup.getRewardMaxNum(),rewardStr.split("#"),weight.split("#"),
itemMap,equipMap,cardMap,randomMap,dropRatio);
break;
case GlobalItemType.SUCCESSIVELY_RANDOM:
getSuccessivelyRandmoMap(sRewardGroup,rewardStr.toString().split("#"),weight.toString().split("#"),
itemMap,cardMap,equipMap,dropRatio);
getSuccessivelyRandmoMap(sRewardGroup,rewardStr.split("#"),weight.split("#"),
itemMap,cardMap,equipMap,randomMap,dropRatio);
break;
default:
break;
}
}
private static void getSuccessivelyRandmoMap(SRewardGroup sRewardGroup,String[] rewardArr,String[] weightArr, Map<Integer, Integer> itemMap,
Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) {
private static void getSuccessivelyRandmoMap(SRewardGroup sRewardGroup,String[]
rewardArr,String[] weightArr, Map<Integer, Integer> itemMap,Map<Integer, Integer>
cardMap, Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap,float dropRatio) {
for (int i = 0 ; i < sRewardGroup.getRewardMaxNum();i++){
int itemId = 0;
int id = 0;
for (int j = 0 ; j < sRewardGroup.getLoop();i++){
int index = MathUtils.randomForStrArray(weightArr);
itemId = Integer.parseInt(rewardArr[index]);
if (itemId ==Integer.parseInt(rewardArr[j])){
id = Integer.parseInt(rewardArr[index]);
if (id ==Integer.parseInt(rewardArr[j])){
break;
}
}
if (0 == itemId){
if (0 == id){
int index = MathUtils.randomForStrArray(weightArr);
itemId = Integer.parseInt(rewardArr[index]);
id = Integer.parseInt(rewardArr[index]);
}
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(itemId);
int itemNum = MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax());
getMap(itemId,itemNum ,itemMap, cardMap,equipMap,dropRatio);
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
int itemNum = getItemNum(sRewardItem);
getMap(sRewardItem.getItemId(),itemNum ,itemMap, cardMap,equipMap,randomMap,dropRatio);
}
}
private static void getRandomMap(int randomItemNum ,String[] rewardArr,String[] weightArr, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,
Map<Integer,Integer> equipMap,float dropRatio) {
Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
for (int i = 0 ; i < randomItemNum;i++){
int index = MathUtils.randomForStrArray(weightArr);
int itemId = Integer.parseInt(rewardArr[index]);
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(itemId);
int itemNum = MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax());
getMap(itemId,itemNum, itemMap, cardMap,equipMap,dropRatio);
int id = Integer.parseInt(rewardArr[index]);
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
int itemNum = getItemNum(sRewardItem);
getMap(sRewardItem.getItemId(),itemNum, itemMap, cardMap,equipMap,randomMap,dropRatio);
}
}
private static void getMap(int[] itemInfo, Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) {
for (int itemId :itemInfo){
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(itemId);
int itemNum = MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax());
getMap(itemId,itemNum,itemMap, cardMap,equipMap,dropRatio);
/**
*
* @param sRewardItem
* @return
*/
private static int getItemNum(SRewardItem sRewardItem) {
return MathUtils.numRount(MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax()) * sRewardItem.getGrowChance());
}
private static void getMap(int[] itemInfo, Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
for (int id :itemInfo){
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
int itemNum = getItemNum(sRewardItem);
getMap(sRewardItem.getItemId(),itemNum,itemMap, cardMap,equipMap,randomMap,dropRatio);
}
}
private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,float dropRatio) {
private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap,
Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap ,Map<Integer,Integer> randomMap,float dropRatio) {
SItem sItem = SItem.getsItemMap().get(itemId);
int itemType =getItemType(sItem.getItemType());
int itemType =getItemType(sItem);
switch (itemType) {
case GlobalItemType.ITEM:
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
@ -150,16 +154,25 @@ public class ItemUtil {
case GlobalItemType.EQUIP:
putcountMap(itemId, itemNum, cardMap);
break;
case GlobalItemType.RANDOM_ITME:
putcountMap(itemId, itemNum, randomMap);
break;
default:
break;
}
}
private static int getItemType(int itemType) {
switch (itemType) {
private static int getItemType(SItem sItem) {
int itemType = sItem.getItemType();
switch (sItem.getItemType()) {
case GlobalItemType.CARD_FRAGMENT:
itemType = GlobalItemType.ITEM;
break;
case GlobalItemType.RANDOM_ITME:
if (!sItem.isIsopen()){
itemType = GlobalItemType.ITEM;
}
break;
default:
break;
}
@ -185,12 +198,10 @@ public class ItemUtil {
continue;
}
Item item = itemManager.getItem(entry.getKey());
if (item == null){
if (item == null) {
item = itemManager.newItem(entry.getKey(), entry.getValue());
}else{
if(sItem.isStacking()){
item.setItemNum(item.getItemNum() + entry.getValue());
}
} else {
item.setItemNum(item.getItemNum() + entry.getValue());
}
itemProtoList.add(CBean2Proto.getItem(item));
}
@ -342,7 +353,7 @@ public class ItemUtil {
int itemId = costItem[0];
int itemNum = costItem[1];
SItem sItem = SItem.getsItemMap().get(itemId);
int itemType = getItemType(sItem.getItemType());
int itemType = getItemType(sItem);
switch (itemType) {
case GlobalItemType.GEM:
putcountMap(itemId,itemNum,moneyMap);
@ -355,4 +366,80 @@ public class ItemUtil {
}
}
}
/**
* 使
* @param user
* @param randomMap
* @return
* @throws Exception
*/
public static CommonProto.Drop.Builder useRandomItem(User user,Map<Integer,Integer> randomMap) throws Exception {
StringBuilder dropIds = new StringBuilder();
for (Map.Entry<Integer,Integer> entry : randomMap.entrySet()){
int itemId = entry.getKey();
int itemNum = entry.getValue();
SItem sItem = SItem.getsItemMap().get(itemId);
for (int i = 0; i < itemNum; i++){
if (dropIds.length() == 0){
dropIds = new StringBuilder(String.valueOf(sItem.getRewardGroup()));
}else{
dropIds.append("#").append(sItem.getRewardGroup());
}
}
}
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
if (!dropIds.toString().isEmpty()){
int[] ints = StringUtil.parseFiledInt(dropIds.toString());
drop = ItemUtil.drop(user, ints, 1);
}
return drop;
}
public static boolean checkCost(User user ,SItem sItem , int itemNum) throws Exception {
if (sItem == null){
return false;
}
if (sItem.getUseType() == GlobalItemType.NO_USE){
return false;
}
String costItem = sItem.getId() +"#"+ itemNum;
int[][] ints = StringUtil.parseFiledInt2(costItem);
return ItemUtil.itemCost(user, ints);
}
public static void initDropReward() {
Map<Integer, SRewardGroup> sRewardGroupMap = SRewardGroup.getsRewardItemMap();
Map<Integer, SRewardItem> sRewardItemMap = SRewardItem.getsDropMap();
if (sRewardGroupMap == null){
return;
}
if (sRewardItemMap == null){
return;
}
Map<Integer,String> dropMap = new ConcurrentHashMap<>();
for (Map.Entry<Integer,SRewardGroup> entry :sRewardGroupMap.entrySet()){
SRewardGroup sRewardGroup = entry.getValue();
int[] rewardItem = sRewardGroup.getRewardItem();
StringBuilder rewardStr = new StringBuilder();
StringBuilder weight = new StringBuilder();
for (int dropId :rewardItem){
SRewardItem sRewardItem =sRewardItemMap.get(dropId);
if (sRewardItem == null){
continue;
}
if (rewardStr.length() == 0){
rewardStr = new StringBuilder(String.valueOf(sRewardItem.getId()));
}else{
rewardStr.append("#").append(sRewardItem.getId());
}
if (weight.length() == 0){
weight = new StringBuilder(String.valueOf(sRewardItem.getChance()));
}else{
weight.append("#").append(sRewardItem.getChance());
}
dropMap.put(sRewardGroup.getId(),rewardStr +"|"+weight);
}
}
dropRewardMap = dropMap;
}
}

View File

@ -18,7 +18,7 @@ public class NettyClient {
private static final Logger LOGGER = LoggerFactory.getLogger(NettyClient.class);
private static int uid = 10000026;
private static int uid = 10000061;
private static int msgIndex = 1;
private static int token=543242;
@ -41,15 +41,33 @@ public class NettyClient {
LOGGER.info(gameMessage.toString());
//---------------------------------------------------------------------------------------------------------
handler.sendRequest_jieling(makeFinalMessage(gameMessage, MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE));
handler.sendRequest_jieling(makeFinalMessage(gameMessage, MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE));
// handler.sendRequest_jieling(makeFinalMessage(getHero(), MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE));
// handler.sendRequest_jieling(makeFinalMessage(getRandomHero(), MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE));
// for (int i = 1000; i< 1500;i++){
handler.sendRequest_jieling(makeFinalMessage(gmRequest(0), MessageTypeProto.MessageType.GM_REQUEST_VALUE));
// handler.sendRequest_jieling(makeFinalMessage(gmRequest(11001), MessageTypeProto.MessageType.GM_REQUEST_VALUE));
handler.sendRequest_jieling(makeFinalMessage(useAndPriceItemRequest(0,11001,2), MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_REQUEST_VALUE));
// handler.sendRequest_jieling(makeFinalMessage(heroComperRequest(1001,10), MessageTypeProto.MessageType.HERO_COMPOSE_REQUEST_VALUE));
// }
}
private static MessageLite heroComperRequest(int itemId, int itemNum) {
CommonProto.Item item = CommonProto.Item.newBuilder()
.setItemId(itemId)
.setItemNum(itemNum)
.build();
return HeroInfoProto.HeroComposeRequest.newBuilder().setItem(item).build();
}
private static MessageLite useAndPriceItemRequest(int type ,int itemId , int itemNum) {
CommonProto.Item item = CommonProto.Item.newBuilder()
.setItemId(itemId)
.setItemNum(itemNum)
.build();
return PlayerInfoProto.UseAndPriceItemRequest.newBuilder().setType(type).setItem(item).build();
}
public static HeroInfoProto.GetHeroListInfoRequest getHero(){
return HeroInfoProto.GetHeroListInfoRequest.newBuilder().setNum(1).setStr("111").build();
}
@ -73,7 +91,7 @@ public class NettyClient {
}
public static CommonProto.GMCommand gmRequest(int itemId){
return CommonProto.GMCommand.newBuilder().setCommand("3#"+1+"#10000").build();
return CommonProto.GMCommand.newBuilder().setCommand("1#"+itemId+"#10").build();
}