关卡,角色升级
parent
419a5c569e
commit
f7942c0c1e
|
@ -0,0 +1,151 @@
|
||||||
|
Id Precondition LevelLimit MonsterGroup Cost PreLevelCost Exp RandomReward RankTime MaxCountPerDay RecommendFightAbility
|
||||||
|
int int int int mut,int#int,2 mut,int#int,2 int mut,int#int,1 int int int
|
||||||
|
1011 0 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1021 1011 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1031 1021 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1041 1031 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1051 1041 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1012 1051 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1022 1012 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1032 1022 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1042 1032 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1052 1042 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1013 1052 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1023 1013 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1033 1023 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1043 1033 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
1053 1043 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2011 1053 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2021 2011 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2031 2021 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2041 2031 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2051 2041 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2012 2051 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2022 2012 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2032 2022 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2042 2032 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2052 2042 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2013 2052 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2023 2013 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2033 2023 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2043 2033 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
2053 2043 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3011 2053 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3021 3011 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3031 3021 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3041 3031 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3051 3041 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3012 3051 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3022 3012 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3032 3022 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3042 3032 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3052 3042 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3013 3052 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3023 3013 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3033 3023 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3043 3033 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
3053 3043 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4011 3053 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4021 4011 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4031 4021 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4041 4031 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4051 4041 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4012 4051 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4022 4012 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4032 4022 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4042 4032 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4052 4042 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4013 4052 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4023 4013 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4033 4023 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4043 4033 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
4053 4043 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5011 4053 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5021 5011 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5031 5021 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5041 5031 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5051 5041 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5012 5051 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5022 5012 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5032 5022 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5042 5032 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5052 5042 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5013 5052 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5023 5013 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5033 5023 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5043 5033 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
5053 5043 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6011 5053 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6021 6011 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6031 6021 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6041 6031 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6051 6041 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6012 6051 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6022 6012 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6032 6022 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6042 6032 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6052 6042 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6013 6052 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6023 6013 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6033 6023 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6043 6033 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
6053 6043 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7011 6053 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7021 7011 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7031 7021 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7041 7031 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7051 7041 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7012 7051 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7022 7012 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7032 7022 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7042 7032 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7052 7042 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7013 7052 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7023 7013 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7033 7023 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7043 7033 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
7053 7043 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8011 7053 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8021 8011 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8031 8021 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8041 8031 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8051 8041 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8012 8051 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8022 8012 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8032 8022 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8042 8032 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8052 8042 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8013 8052 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8023 8013 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8033 8023 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8043 8033 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
8053 8043 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9011 8053 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9021 9011 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9031 9021 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9041 9031 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9051 9041 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9012 9051 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9022 9012 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9032 9022 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9042 9032 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9052 9042 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9013 9052 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9023 9013 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9033 9023 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9043 9033 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
9053 9043 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10011 9053 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10021 10011 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10031 10021 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10041 10031 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10051 10041 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10012 10051 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10022 10012 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10032 10022 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10042 10032 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10052 10042 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10013 10052 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10023 10013 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10033 10023 0 1002 2#6 2#1 6 2000#2001 180 0 100
|
||||||
|
10043 10033 0 10001 2#6 2#1 6 2000#2001 180 0 100
|
|
@ -0,0 +1,122 @@
|
||||||
|
PlayerLv Exp MaxEnergy AddEnergy
|
||||||
|
int int int int
|
||||||
|
1 8 80 0
|
||||||
|
2 8 80 2
|
||||||
|
3 8 80 3
|
||||||
|
4 8 80 4
|
||||||
|
5 8 85 5
|
||||||
|
6 8 85 6
|
||||||
|
7 8 85 7
|
||||||
|
8 8 85 8
|
||||||
|
9 8 85 9
|
||||||
|
10 8 90 10
|
||||||
|
11 8 90 11
|
||||||
|
12 26 90 12
|
||||||
|
13 30 90 13
|
||||||
|
14 36 90 14
|
||||||
|
15 42 95 15
|
||||||
|
16 48 95 16
|
||||||
|
17 58 95 17
|
||||||
|
18 68 95 18
|
||||||
|
19 80 95 19
|
||||||
|
20 100 100 20
|
||||||
|
21 120 100 21
|
||||||
|
22 140 100 22
|
||||||
|
23 162 100 23
|
||||||
|
24 185 100 24
|
||||||
|
25 210 110 25
|
||||||
|
26 240 110 26
|
||||||
|
27 264 110 27
|
||||||
|
28 284 120 28
|
||||||
|
29 300 120 29
|
||||||
|
30 330 120 30
|
||||||
|
31 360 120 31
|
||||||
|
32 390 120 32
|
||||||
|
33 420 120 33
|
||||||
|
34 430 120 34
|
||||||
|
35 460 120 35
|
||||||
|
36 490 120 36
|
||||||
|
37 520 120 37
|
||||||
|
38 480 120 38
|
||||||
|
39 500 120 39
|
||||||
|
40 505 120 40
|
||||||
|
41 535 120 41
|
||||||
|
42 575 120 42
|
||||||
|
43 615 120 43
|
||||||
|
44 655 120 44
|
||||||
|
45 700 120 45
|
||||||
|
46 750 120 46
|
||||||
|
47 800 120 47
|
||||||
|
48 855 120 48
|
||||||
|
49 910 120 49
|
||||||
|
50 970 120 50
|
||||||
|
51 1035 120 51
|
||||||
|
52 1100 120 52
|
||||||
|
53 1170 120 53
|
||||||
|
54 1240 120 54
|
||||||
|
55 1320 120 55
|
||||||
|
56 1400 120 56
|
||||||
|
57 1485 120 57
|
||||||
|
58 1570 120 58
|
||||||
|
59 1765 120 59
|
||||||
|
60 1960 130 60
|
||||||
|
61 2160 130 61
|
||||||
|
62 2265 130 62
|
||||||
|
63 2370 130 63
|
||||||
|
64 2485 130 64
|
||||||
|
65 2600 130 65
|
||||||
|
66 2725 130 66
|
||||||
|
67 2850 130 67
|
||||||
|
68 2980 130 68
|
||||||
|
69 3115 130 69
|
||||||
|
70 3260 140 70
|
||||||
|
71 3405 140 71
|
||||||
|
72 3555 140 72
|
||||||
|
73 3710 140 73
|
||||||
|
74 3870 140 74
|
||||||
|
75 4035 140 75
|
||||||
|
76 4210 140 76
|
||||||
|
77 4385 140 77
|
||||||
|
78 4565 140 78
|
||||||
|
79 4955 140 79
|
||||||
|
80 5150 140 80
|
||||||
|
81 5350 140 81
|
||||||
|
82 5555 140 82
|
||||||
|
83 5765 140 83
|
||||||
|
84 5985 140 84
|
||||||
|
85 6205 140 85
|
||||||
|
86 6435 140 86
|
||||||
|
87 6675 140 87
|
||||||
|
88 6915 140 88
|
||||||
|
89 7465 140 89
|
||||||
|
90 7720 140 90
|
||||||
|
91 7980 140 91
|
||||||
|
92 8250 140 92
|
||||||
|
93 8525 140 93
|
||||||
|
94 8810 140 94
|
||||||
|
95 9100 140 95
|
||||||
|
96 9395 140 96
|
||||||
|
97 9700 140 97
|
||||||
|
98 10010 140 98
|
||||||
|
99 10525 140 99
|
||||||
|
100 10855 150 100
|
||||||
|
101 11185 150 101
|
||||||
|
102 11525 150 102
|
||||||
|
103 11875 150 103
|
||||||
|
104 12230 150 104
|
||||||
|
105 12595 150 105
|
||||||
|
106 12965 150 106
|
||||||
|
107 13345 150 107
|
||||||
|
108 13735 150 108
|
||||||
|
109 14130 150 109
|
||||||
|
110 14535 150 110
|
||||||
|
111 14950 150 111
|
||||||
|
112 15370 150 112
|
||||||
|
113 15800 150 113
|
||||||
|
114 16235 150 114
|
||||||
|
115 16685 150 115
|
||||||
|
116 17140 150 116
|
||||||
|
117 17605 150 117
|
||||||
|
118 18075 150 118
|
||||||
|
119 18560 150 119
|
||||||
|
120 9999999 150 120
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.ljsd.jieling.config;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
import com.ljsd.jieling.logic.dao.LevelDifficulty;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
|
||||||
|
@Table(name ="LevelDifficultyConfig")
|
||||||
|
public class SLevelDifficultyConfig implements BaseConfig {
|
||||||
|
private static Map<Integer, SLevelDifficultyConfig> sLevelDifficultyConfigMap;
|
||||||
|
private static Map<Integer, LevelDifficulty> levelDifficultyMap;
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int precondition;
|
||||||
|
|
||||||
|
private int levelLimit;
|
||||||
|
|
||||||
|
private int monsterGroup;
|
||||||
|
|
||||||
|
private int[][] cost;
|
||||||
|
|
||||||
|
private int[][] preLevelCost;
|
||||||
|
|
||||||
|
private int money;
|
||||||
|
|
||||||
|
private int exp;
|
||||||
|
|
||||||
|
private int[] randomReward;
|
||||||
|
|
||||||
|
private int rankTime;
|
||||||
|
|
||||||
|
private int maxCountPerDay;
|
||||||
|
|
||||||
|
private int recommendFightAbility;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
sLevelDifficultyConfigMap = STableManager.getConfig(SLevelDifficultyConfig.class);
|
||||||
|
Map<Integer, LevelDifficulty> levelDifficultyMap = new ConcurrentHashMap<>();
|
||||||
|
for (Map.Entry<Integer, SLevelDifficultyConfig> entry : sLevelDifficultyConfigMap.entrySet()) {
|
||||||
|
String fightId = String.valueOf(entry.getKey());
|
||||||
|
int length = fightId.length();
|
||||||
|
int areaId = Integer.parseInt(fightId.substring(0, 1));
|
||||||
|
int type = Integer.parseInt(fightId.substring(length - 1, length));
|
||||||
|
LevelDifficulty levelDifficulty = new LevelDifficulty();
|
||||||
|
levelDifficulty.setAreaId(areaId);
|
||||||
|
levelDifficulty.setFightId(Integer.parseInt(fightId));
|
||||||
|
levelDifficulty.setType(type);
|
||||||
|
levelDifficultyMap.put(entry.getKey(),levelDifficulty);
|
||||||
|
levelDifficultyMap.put(entry.getKey(),levelDifficulty);
|
||||||
|
}
|
||||||
|
SLevelDifficultyConfig.levelDifficultyMap = levelDifficultyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrecondition() {
|
||||||
|
return precondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevelLimit() {
|
||||||
|
return levelLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMonsterGroup() {
|
||||||
|
return monsterGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getCost() {
|
||||||
|
return cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getPreLevelCost() {
|
||||||
|
return preLevelCost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMoney() {
|
||||||
|
return money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExp() {
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getRandomReward() {
|
||||||
|
return randomReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRankTime() {
|
||||||
|
return rankTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxCountPerDay() {
|
||||||
|
return maxCountPerDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRecommendFightAbility() {
|
||||||
|
return recommendFightAbility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, SLevelDifficultyConfig> getsLevelDifficultyConfigMap() {
|
||||||
|
return sLevelDifficultyConfigMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, LevelDifficulty> getLevelDifficultyMap() {
|
||||||
|
return levelDifficultyMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.ljsd.jieling.config;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="PlayerLevelConfig")
|
||||||
|
public class SPlayerLevelConfig implements BaseConfig {
|
||||||
|
|
||||||
|
public static Map<Integer, SPlayerLevelConfig> sPlayerLevelConfigMap;
|
||||||
|
private int playerLv;
|
||||||
|
|
||||||
|
private int exp;
|
||||||
|
|
||||||
|
private int maxEnergy;
|
||||||
|
|
||||||
|
private int addEnergy;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
sPlayerLevelConfigMap = STableManager.getConfig(SPlayerLevelConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getPlayerLv() {
|
||||||
|
return playerLv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExp() {
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxEnergy() {
|
||||||
|
return maxEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAddEnergy() {
|
||||||
|
return addEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, SPlayerLevelConfig> getsPlayerLevelConfigMap() {
|
||||||
|
return sPlayerLevelConfigMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,4 +21,9 @@ public interface Global {
|
||||||
//sysMail state
|
//sysMail state
|
||||||
int SYS_MAIL_STATE_NEW = 1; //未发布
|
int SYS_MAIL_STATE_NEW = 1; //未发布
|
||||||
int SYS_MAIL_STATE_LAUCHED = 2; // 已完成
|
int SYS_MAIL_STATE_LAUCHED = 2; // 已完成
|
||||||
|
|
||||||
|
//关卡状态
|
||||||
|
int FIGHT_OPEND = 2;
|
||||||
|
int FIGHT_OPEND_NO_CLEARANCE = 3;
|
||||||
|
int FIGHT_CLEARANCE = 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,14 @@ public class FightEndRequestHandler extends BaseHandler {
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
byte[] message = netData.parseClientProtoNetData();
|
byte[] message = netData.parseClientProtoNetData();
|
||||||
FightInfoProto.FightEndRequest fightEndRequest = FightInfoProto.FightEndRequest.parseFrom(message);
|
FightInfoProto.FightEndRequest fightEndRequest = FightInfoProto.FightEndRequest.parseFrom(message);
|
||||||
int monsterGroupId = fightEndRequest.getMonsterGroupId();
|
// int monsterGroupId = fightEndRequest.getMonsterGroupId();
|
||||||
String frames = fightEndRequest.getFrames();
|
String frames = fightEndRequest.getFrames();
|
||||||
MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
int type = fightEndRequest.getType();
|
||||||
|
int fightId = fightEndRequest.getFightId();
|
||||||
|
if (type == 1){
|
||||||
|
MapLogic.getInstance().endDifficultyFight(iSession, frames,fightId ,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||||
|
}else{
|
||||||
|
MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ljsd.jieling.handler.map;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GetAllLeveDifficultyInfostHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
MapLogic.getInstance().getAllLeveDifficultyInfos(iSession,MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_RESPONSE_VALUE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,9 +8,8 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
import com.ljsd.jieling.handler.mission.Mission;
|
import com.ljsd.jieling.handler.mission.Mission;
|
||||||
import com.ljsd.jieling.logic.dao.Hero;
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
|
@ -27,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class MapLogic {
|
public class MapLogic {
|
||||||
|
|
||||||
|
@ -1161,4 +1161,210 @@ public class MapLogic {
|
||||||
MapInfoProto.TakeMapBoxResponse build = MapInfoProto.TakeMapBoxResponse.newBuilder().setDrop(drop).build();
|
MapInfoProto.TakeMapBoxResponse build = MapInfoProto.TakeMapBoxResponse.newBuilder().setDrop(drop).build();
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,build,true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MAP_MISSION_BOX_RESPONSE_VALUE,build,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有关卡信息
|
||||||
|
* @param iSession
|
||||||
|
* @param msgId
|
||||||
|
*/
|
||||||
|
public void getAllLeveDifficultyInfos(ISession iSession, int msgId) throws Exception {
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
LevelDifficultyManager levelDifficultyManager = user.getLevelDifficultyManager();
|
||||||
|
Map<Integer, LevelDifficulty> levelDifficultyInfosMap = levelDifficultyManager.getLevelDifficultyInfosMap();
|
||||||
|
if (levelDifficultyInfosMap.size() ==0){
|
||||||
|
levelDifficultyInfosMap = initLevelDifficultyInfo(user ,levelDifficultyManager);
|
||||||
|
}
|
||||||
|
List<Integer> getOpenAreaIds = levelDifficultyManager.getOpenAreaIds();
|
||||||
|
List<CommonProto.LevelDifficultyInfos> levelDifficultyInfos = new CopyOnWriteArrayList<>();
|
||||||
|
for (Integer areaId : getOpenAreaIds){
|
||||||
|
CommonProto.LevelDifficultyInfos.Builder levelDifficultyInfosBuilder = CommonProto.LevelDifficultyInfos.newBuilder();
|
||||||
|
levelDifficultyInfosBuilder.setAreaId(areaId);
|
||||||
|
List<CommonProto.LevelDifficulty> builderList = new CopyOnWriteArrayList<>();
|
||||||
|
for (Map.Entry<Integer,LevelDifficulty> entry :levelDifficultyInfosMap.entrySet()){
|
||||||
|
LevelDifficulty levelDifficulty = entry.getValue();
|
||||||
|
if (levelDifficulty.getAreaId() != areaId){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CommonProto.LevelDifficulty.Builder lLevelDifficultyBuilder = CommonProto.LevelDifficulty.newBuilder();
|
||||||
|
lLevelDifficultyBuilder.setFightId(levelDifficulty.getFightId());
|
||||||
|
lLevelDifficultyBuilder.setState(levelDifficulty.getState());
|
||||||
|
lLevelDifficultyBuilder.setNum(levelDifficulty.getChallengeTimes());
|
||||||
|
lLevelDifficultyBuilder.setType(levelDifficulty.getType());
|
||||||
|
builderList.add(lLevelDifficultyBuilder.build());
|
||||||
|
}
|
||||||
|
levelDifficultyInfosBuilder.addAllLevelDifficulty(builderList);
|
||||||
|
levelDifficultyInfos.add(levelDifficultyInfosBuilder.build());
|
||||||
|
}
|
||||||
|
MapInfoProto.getAllLevelDifficultyInfosResponse.Builder builder = MapInfoProto.getAllLevelDifficultyInfosResponse.newBuilder();
|
||||||
|
builder.addAllLevelDifficultyInfos(levelDifficultyInfos);
|
||||||
|
MessageUtil.sendMessage(iSession,1, msgId,builder.build(),true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Integer, LevelDifficulty> initLevelDifficultyInfo(User user,LevelDifficultyManager levelDifficultyManager) {
|
||||||
|
Map<Integer, LevelDifficulty> levelDifficultyMap = SLevelDifficultyConfig.getLevelDifficultyMap();
|
||||||
|
for (Map.Entry<Integer, LevelDifficulty> entry :levelDifficultyMap.entrySet()){
|
||||||
|
LevelDifficulty levelDifficulty = entry.getValue();
|
||||||
|
int fightId = levelDifficulty.getFightId();
|
||||||
|
SLevelDifficultyConfig sLevelDifficultyConfig = SLevelDifficultyConfig.getsLevelDifficultyConfigMap().get(fightId);
|
||||||
|
if (sLevelDifficultyConfig.getPrecondition()!= 0 ||sLevelDifficultyConfig.getLevelLimit() > user.getPlayerInfoManager().getLevel()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
levelDifficultyManager.newLevelDifficulty(fightId,levelDifficulty.getType(),levelDifficulty.getAreaId());
|
||||||
|
}
|
||||||
|
return levelDifficultyManager.getLevelDifficultyInfosMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关卡开始战斗
|
||||||
|
* @param session
|
||||||
|
* @param fightId
|
||||||
|
*/
|
||||||
|
public void startLevelDifficultyFight(ISession session, int fightId,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
LevelDifficultyManager levelDifficultyManager = user.getLevelDifficultyManager();
|
||||||
|
LevelDifficulty levelDifficulty = levelDifficultyManager.getLevelDifficultyInfosMap().get(fightId);
|
||||||
|
if (levelDifficulty ==null){
|
||||||
|
LOGGER.info("startLevelDifficultyFight==> uid={},fightId, levelDifficulty is null ",uid,fightId);
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "关卡未开启");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SLevelDifficultyConfig sLevelDifficultyConfig = SLevelDifficultyConfig.getsLevelDifficultyConfigMap().get(fightId);
|
||||||
|
if (levelDifficulty.getChallengeTimes() >= sLevelDifficultyConfig.getMaxCountPerDay()){
|
||||||
|
LOGGER.info("startLevelDifficultyFight==>uid={},fightId={} challengeTimes={},MaxTime={}",uid,fightId,levelDifficulty.getChallengeTimes(),sLevelDifficultyConfig.getMaxCountPerDay());
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "次数不足");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean flag = ItemUtil.fightItemCost(user, sLevelDifficultyConfig.getCost());
|
||||||
|
if (!flag){
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "道具不足");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//扣除预先道具
|
||||||
|
ItemUtil.fightItemCost(user,sLevelDifficultyConfig.getPreLevelCost());
|
||||||
|
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||||
|
BehaviorUtil.getLevelDifficultyifficuFightInfo(user,sLevelDifficultyConfig.getMonsterGroup(),teamId,fightStartResponse);
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关卡结束战斗
|
||||||
|
* @param session
|
||||||
|
* @param messageType
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void endDifficultyFight(ISession session, String frames, int fightId ,MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
String key = RedisKey.getKey(RedisKey.FIGHT, user.getId() , false);
|
||||||
|
Map<Object , Object> valueMap = RedisUtil.getInstence().hmget(key);
|
||||||
|
RedisUtil.getInstence().del(key);
|
||||||
|
if (valueMap == null || valueMap.isEmpty()) {
|
||||||
|
LOGGER.info("endFight() uid=>{} not start fight", uid);
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "此战斗已结算过!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int seed = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_SEED));
|
||||||
|
// int monsterGroupId = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||||
|
CommonProto.FightTeamInfo.Builder builder = CommonProto.FightTeamInfo.newBuilder();
|
||||||
|
JsonFormat.merge((String)valueMap.get(RedisKey.FIGHT_HEROES), builder);
|
||||||
|
CommonProto.FightTeamInfo fightTeamInfo = builder.build();
|
||||||
|
CommonProto.FightTeamInfo.Builder monsterBuilder = CommonProto.FightTeamInfo.newBuilder();
|
||||||
|
JsonFormat.merge((String)valueMap.get(RedisKey.FIGHT_MONSTERS), monsterBuilder);
|
||||||
|
CommonProto.FightTeamInfo monsterTeam = monsterBuilder.build();
|
||||||
|
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>();
|
||||||
|
monsterTeamList.add(monsterTeam);
|
||||||
|
|
||||||
|
SLevelDifficultyConfig sLevelDifficultyConfig = SLevelDifficultyConfig.getsLevelDifficultyConfigMap().get(fightId);
|
||||||
|
if (sLevelDifficultyConfig == null) {
|
||||||
|
LOGGER.info("endFight() uid=>{} fightId=>{} SLevelDifficultyConfig == null", uid, fightId);
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo,monsterTeamList);
|
||||||
|
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||||
|
|
||||||
|
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||||
|
|
||||||
|
List<Integer> remainHp = new ArrayList<>(5);
|
||||||
|
for (int i = 1; i < checkResult.length; i++) {
|
||||||
|
remainHp.add(checkResult[i]);
|
||||||
|
}
|
||||||
|
//校验结果码 1:胜利
|
||||||
|
int resultCode = checkResult[0];
|
||||||
|
if (resultCode == -1){
|
||||||
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗异常!");
|
||||||
|
return;
|
||||||
|
}else if(resultCode == 0){
|
||||||
|
// 失败处理
|
||||||
|
resetMapInfo(user,true);
|
||||||
|
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||||
|
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
|
||||||
|
.newBuilder()
|
||||||
|
.setResult(resultCode)
|
||||||
|
.setDrop(dropBuilder)
|
||||||
|
.addAllRemainHpList(remainHp)
|
||||||
|
.build();
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ItemUtil.itemCost(user, sLevelDifficultyConfig.getCost());
|
||||||
|
//玩家升级
|
||||||
|
userLevelUp(user,sLevelDifficultyConfig.getExp());
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sLevelDifficultyConfig.getRandomReward(), 1, 1);
|
||||||
|
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||||
|
fightEndResponse.setDrop(drop);
|
||||||
|
fightEndResponse.setResult(resultCode);
|
||||||
|
// fightEndResponse.addAllRemainHpList(remainHp);
|
||||||
|
fightEndResponse.build();
|
||||||
|
// updateMapMission(user.getMapManager(),EventType.fightEvent,0,monsterGroupId);
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家升级
|
||||||
|
* @param user
|
||||||
|
* @param addExp
|
||||||
|
*/
|
||||||
|
public void userLevelUp(User user, int addExp) throws Exception {
|
||||||
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
|
if (addExp <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int maxExp = 11;
|
||||||
|
if (playerInfoManager.getExp() >= maxExp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int curExp = MathUtils.setBetweenWithMax(playerInfoManager.getExp() + addExp, 0, maxExp);
|
||||||
|
int oldLevel = playerInfoManager.getLevel();
|
||||||
|
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel + 1);
|
||||||
|
int levelUpExp;
|
||||||
|
if (sPlayerLevelConfig == null) {
|
||||||
|
levelUpExp = maxExp;
|
||||||
|
} else {
|
||||||
|
levelUpExp = sPlayerLevelConfig.getExp();
|
||||||
|
}
|
||||||
|
while (curExp >= levelUpExp && curExp <= maxExp) {
|
||||||
|
playerInfoManager.setLevel(playerInfoManager.getLevel() + 1);
|
||||||
|
//达到指定等级给邀请人加任务数量
|
||||||
|
sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel + 1);
|
||||||
|
if (sPlayerLevelConfig == null) {
|
||||||
|
levelUpExp = Integer.MAX_VALUE;
|
||||||
|
} else {
|
||||||
|
levelUpExp = sPlayerLevelConfig.getExp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
playerInfoManager.setExp(levelUpExp);
|
||||||
|
if (playerInfoManager.getLevel() > oldLevel) {
|
||||||
|
for (int level = oldLevel + 1; level <= playerInfoManager.getLevel(); level++) {
|
||||||
|
sPlayerLevelConfig= SPlayerLevelConfig.getsPlayerLevelConfigMap().get(level);
|
||||||
|
playerInfoManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.handler.map;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -17,6 +19,15 @@ public class StartFightRequestHandler extends BaseHandler{
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
byte[] message = netData.parseClientProtoNetData();
|
byte[] message = netData.parseClientProtoNetData();
|
||||||
// FightInfoProto.FightStartRequest fightEndRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
// FightInfoProto.FightStartRequest fightEndRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
||||||
MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
FightInfoProto.FightStartRequest fightStartRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
||||||
|
int type = fightStartRequest.getType();
|
||||||
|
int fightId = fightStartRequest.getFightId();
|
||||||
|
int teamId = fightStartRequest.getFightId();
|
||||||
|
if (type ==1){
|
||||||
|
MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||||
|
}else{
|
||||||
|
MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,4 +247,49 @@ public class BehaviorUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void getLevelDifficultyifficuFightInfo(User user,int groupId,int teamId, FightInfoProto.FightStartResponse.Builder fightStartRespons) {
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
|
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||||
|
CommonProto.FightData.Builder fightData = CommonProto.FightData.newBuilder();
|
||||||
|
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
StringBuilder skillSb = new StringBuilder();
|
||||||
|
StringBuilder propertySb = new StringBuilder();
|
||||||
|
String heroSkill = HeroLogic.getInstance().getHeroSkills(hero,skillSb).toString();
|
||||||
|
String property = HeroLogic.getInstance().getHeroProperty(user,hero,propertySb).toString();
|
||||||
|
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||||
|
.newBuilder()
|
||||||
|
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||||
|
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
|
||||||
|
.setProperty(property.substring(0, property.length()-1))
|
||||||
|
.build();
|
||||||
|
heroFightInfos.add(heroFightInfo);
|
||||||
|
}
|
||||||
|
CommonProto.FightTeamInfo fightTeamInfo = CommonProto.FightTeamInfo.
|
||||||
|
newBuilder()
|
||||||
|
.addAllFightUnitList(heroFightInfos)
|
||||||
|
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user,teamId))
|
||||||
|
.build();
|
||||||
|
fightData.setHeroFightInfos(fightTeamInfo);
|
||||||
|
|
||||||
|
//monster
|
||||||
|
List<CommonProto.FightUnitInfo> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||||
|
String monsterTeamSkill = MonsterUtil.getMonsterTeamSkillByGroup(groupId);
|
||||||
|
List<CommonProto.FightTeamInfo> monsterGroupList = new ArrayList<>();
|
||||||
|
CommonProto.FightTeamInfo monsterTeamInfo = CommonProto.FightTeamInfo
|
||||||
|
.newBuilder()
|
||||||
|
.addAllFightUnitList(monsterByGroup)
|
||||||
|
.setTeamSkillList(monsterTeamSkill)
|
||||||
|
.build();
|
||||||
|
monsterGroupList.add(monsterTeamInfo);
|
||||||
|
fightData.addAllMonsterList(monsterGroupList);
|
||||||
|
|
||||||
|
//设置战斗随机种子
|
||||||
|
int seed = (int)(System.currentTimeMillis()/1000);
|
||||||
|
fightData.setFightSeed(seed);
|
||||||
|
fightStartRespons.setFightData(fightData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
import com.ljsd.jieling.globals.Global;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
|
public class LevelDifficulty extends MongoBase {
|
||||||
|
|
||||||
|
private int areaId;
|
||||||
|
|
||||||
|
private int fightId;
|
||||||
|
|
||||||
|
private int state; //2 已开启 3:已打过未通过,=4:已通过
|
||||||
|
|
||||||
|
private int challengeTimes;
|
||||||
|
|
||||||
|
private int type; //1:简单 2:中等 3:困难
|
||||||
|
|
||||||
|
public LevelDifficulty(){
|
||||||
|
//绑定关系
|
||||||
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LevelDifficulty(int fightId,int type,int areaId){
|
||||||
|
// this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
this.areaId = areaId;
|
||||||
|
this.fightId = fightId;
|
||||||
|
this.state = Global.FIGHT_OPEND;
|
||||||
|
this.challengeTimes = 0;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFightId(int fightId) {
|
||||||
|
updateString("fightId", fightId);
|
||||||
|
this.fightId = fightId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(int state) {
|
||||||
|
updateString("state", state);
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChallengeTimes(int challengeTimes) {
|
||||||
|
updateString("challengeTimes", challengeTimes);
|
||||||
|
this.challengeTimes = challengeTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
updateString("type", type);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaId(int areaId) {
|
||||||
|
updateString("areaId", areaId);
|
||||||
|
this.areaId = areaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFightId() {
|
||||||
|
return fightId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getChallengeTimes() {
|
||||||
|
return challengeTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAreaId() {
|
||||||
|
return areaId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
public class LevelDifficultyManager extends MongoBase {
|
||||||
|
|
||||||
|
private Map<Integer,LevelDifficulty> levelDifficultyInfosMap = new ConcurrentHashMap<>();
|
||||||
|
private List<Integer> openAreaIds = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
public void addLevelDifficulty(LevelDifficulty LevelDifficulty) {
|
||||||
|
LevelDifficulty.init(String.valueOf(LevelDifficulty.getFightId()), getMongoKey() + ".levelDifficultyInfosMap." + LevelDifficulty.getFightId());
|
||||||
|
updateString("levelDifficultyInfosMap." + LevelDifficulty.getFightId(), LevelDifficulty);
|
||||||
|
levelDifficultyInfosMap.put(LevelDifficulty.getFightId(), LevelDifficulty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, LevelDifficulty> getLevelDifficultyInfosMap() {
|
||||||
|
return levelDifficultyInfosMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LevelDifficulty newLevelDifficulty(int fightId,int type,int areaId) {
|
||||||
|
LevelDifficulty levelDifficulty = new LevelDifficulty(fightId,type,areaId);
|
||||||
|
addLevelDifficulty(levelDifficulty);
|
||||||
|
addOpendAreaid(areaId);
|
||||||
|
return levelDifficulty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevelDifficultyInfosMap(Map<Integer, LevelDifficulty> levelDifficultyInfosMap) {
|
||||||
|
this.levelDifficultyInfosMap = levelDifficultyInfosMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getOpenAreaIds() {
|
||||||
|
return openAreaIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOpendAreaid(int openAreaId) {
|
||||||
|
if (!this.openAreaIds.contains(openAreaId)){
|
||||||
|
this.openAreaIds.add(openAreaId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,6 +39,8 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
private String clientVersion;
|
private String clientVersion;
|
||||||
|
|
||||||
|
private int maxStamina ; // 最大体力
|
||||||
|
|
||||||
private Map<Integer,Integer> guidePoints = new HashMap<>();
|
private Map<Integer,Integer> guidePoints = new HashMap<>();
|
||||||
|
|
||||||
public PlayerManager(){
|
public PlayerManager(){
|
||||||
|
@ -170,5 +172,8 @@ public class PlayerManager extends MongoBase {
|
||||||
guidePoints.put(type,id);
|
guidePoints.put(type,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxStamina(int maxStamina) {
|
||||||
|
updateString("maxStamina.", maxStamina);
|
||||||
|
this.maxStamina = maxStamina;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
import com.ljsd.jieling.config.SGameSetting;
|
import com.ljsd.jieling.config.SGameSetting;
|
||||||
import com.ljsd.jieling.config.SMissionEventsConfig;
|
import com.ljsd.jieling.config.SMissionEventsConfig;
|
||||||
|
import com.ljsd.jieling.config.SPlayerLevelConfig;
|
||||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
import com.ljsd.jieling.handler.map.MapManager;
|
import com.ljsd.jieling.handler.map.MapManager;
|
||||||
import com.ljsd.jieling.handler.mission.Mission;
|
import com.ljsd.jieling.handler.mission.Mission;
|
||||||
|
@ -67,6 +68,7 @@ public class UserManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initPlayer(User user) throws Exception {
|
private static void initPlayer(User user) throws Exception {
|
||||||
|
SGameSetting gameSetting = SGameSetting.getGameSetting();
|
||||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||||
playerManager.setNickName("戒灵666");
|
playerManager.setNickName("戒灵666");
|
||||||
playerManager.setLevel(1);
|
playerManager.setLevel(1);
|
||||||
|
@ -79,7 +81,8 @@ public class UserManager {
|
||||||
playerManager.setChargeGem(666);
|
playerManager.setChargeGem(666);
|
||||||
playerManager.updateGuidePoint(1,1);
|
playerManager.updateGuidePoint(1,1);
|
||||||
playerManager.setCreateTime(TimeUtils.now());
|
playerManager.setCreateTime(TimeUtils.now());
|
||||||
SGameSetting gameSetting = SGameSetting.getGameSetting();
|
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
|
||||||
|
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
||||||
ItemUtil.drop(user,gameSetting.getBornItem());
|
ItemUtil.drop(user,gameSetting.getBornItem());
|
||||||
MissionManager missionManager = user.getMissionManager();
|
MissionManager missionManager = user.getMissionManager();
|
||||||
Mission mission = new Mission();
|
Mission mission = new Mission();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.db.mongo.MongoKey;
|
||||||
import com.ljsd.jieling.handler.map.MapManager;
|
import com.ljsd.jieling.handler.map.MapManager;
|
||||||
import com.ljsd.jieling.handler.mission.MissionManager;
|
import com.ljsd.jieling.handler.mission.MissionManager;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.util.TimeUtils;
|
import com.ljsd.jieling.util.TimeUtils;
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
|
@ -36,6 +37,7 @@ public class User {
|
||||||
|
|
||||||
private WorkShopController workShopController;
|
private WorkShopController workShopController;
|
||||||
|
|
||||||
|
private LevelDifficultyManager levelDifficultyManager; // 关卡信息
|
||||||
|
|
||||||
//构造函数必须要声明,否则从mongodb读出来反编译成类不通过
|
//构造函数必须要声明,否则从mongodb读出来反编译成类不通过
|
||||||
public User(){
|
public User(){
|
||||||
|
@ -55,6 +57,7 @@ public class User {
|
||||||
this.adventureManager = new AdventureManager();
|
this.adventureManager = new AdventureManager();
|
||||||
this.pokemonManager = new PokemonManager();
|
this.pokemonManager = new PokemonManager();
|
||||||
this.workShopController = new WorkShopController();
|
this.workShopController = new WorkShopController();
|
||||||
|
this.levelDifficultyManager = new LevelDifficultyManager();
|
||||||
|
|
||||||
//綁定关系
|
//綁定关系
|
||||||
this.playerManager.init(id, MongoKey.playerManager);
|
this.playerManager.init(id, MongoKey.playerManager);
|
||||||
|
@ -68,6 +71,7 @@ public class User {
|
||||||
this.adventureManager.init(id, MongoKey.adventureManager);
|
this.adventureManager.init(id, MongoKey.adventureManager);
|
||||||
this.pokemonManager.init(id, MongoKey.pokemonManager);
|
this.pokemonManager.init(id, MongoKey.pokemonManager);
|
||||||
this.workShopController.init(id, MongoKey.workShopController);
|
this.workShopController.init(id, MongoKey.workShopController);
|
||||||
|
this.levelDifficultyManager.init(id, MongoKey.workShopController);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -157,4 +161,12 @@ public class User {
|
||||||
public void setLoginTime(long loginTime) {
|
public void setLoginTime(long loginTime) {
|
||||||
this.loginTime = loginTime;
|
this.loginTime = loginTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LevelDifficultyManager getLevelDifficultyManager() {
|
||||||
|
return levelDifficultyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevelDifficultyManager(LevelDifficultyManager levelDifficultyManager) {
|
||||||
|
this.levelDifficultyManager = levelDifficultyManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,7 +469,6 @@ public class ItemUtil {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static boolean itemCost(User user,int[][] costItems) throws Exception {
|
public static boolean itemCost(User user,int[][] costItems) throws Exception {
|
||||||
|
|
||||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
selectCost(costItems,itemMap);
|
selectCost(costItems,itemMap);
|
||||||
boolean result = checkCost(user, itemMap);
|
boolean result = checkCost(user, itemMap);
|
||||||
|
@ -608,4 +607,20 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
dropRewardMap = dropMap;
|
dropRewardMap = dropMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 战斗消耗校验
|
||||||
|
* @param user
|
||||||
|
* @param costItems
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean fightItemCost(User user,int[][] costItems) {
|
||||||
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
selectCost(costItems,itemMap);
|
||||||
|
boolean result = checkCost(user, itemMap);
|
||||||
|
if (!result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue