back_recharge
gaojie 2019-02-22 11:54:15 +08:00
commit 16a064bd6d
22 changed files with 843 additions and 297 deletions

View File

@ -65,3 +65,24 @@ int mut,int#int,1
101063 101074
101064 101075
101065 101076
101066 101077
101067 101078#101079
101068 101080
101069 101081
101070 101082
101071 101083#101084
101072 101085
101073 101086
101074 101081
101075 101082
101076 101083#101084
101077 101085
101078 101086
101079 101081
101080 101082
101081 101083#101084
101082 101085
101083 101086
101084 101087
101085 101088
101086 101077

View File

@ -1,11 +1,12 @@
Id Info Size MoveConfused EnergyConfused OpenRule
int string mut,int#int,1 int int string
101 战乱荒林 20#10 1 10
102 林渊深处 20#10 2 10
103 三途津 20#15 2 20
104 青龙门 15#20 2 20
101 战乱荒林 20#30 1 10
102 林渊深处 10#20 2 10
103 三途津 15#20 2 20
104 青龙门 20#15 2 20
105 风见原野 20#20 2 20
106 荒芜丘陵 20#10 2 20
107 观澜港 20#15 2 20
106 荒芜丘陵 10#20 2 20
107 观澜港 15#20 2 20
108 白叶渡 20#20 2 20
109 荆棘流域 30#30 2 20
110 中心枢纽 10#20 2 20

View File

@ -11,138 +11,137 @@ int int int int int int
101009 5 3 1 0 101007
101010 5 3 1 0 101007
101011 5 3 1 0 101065
101012 5 3 1 0 101065
101013 8 2 1 0 0
102001 1 2 1 0 0
102002 1 2 1 0 0
102003 1 2 1 0 0
102004 1 2 1 0 0
102005 2 2 1 0 0
102006 2 2 1 0 0
102007 2 1 1 0 0
102008 2 2 1 0 0
102009 2 1 1 0 0
102010 3 2 1 0 0
102011 5 3 1 0 0
102012 5 3 1 0 0
102013 5 3 1 0 0
102014 5 3 1 0 0
102015 5 3 1 0 0
103001 1 2 1 0 0
103002 1 2 1 0 0
103003 1 2 1 0 0
103004 2 2 1 0 0
103005 2 1 1 0 0
103006 2 2 1 0 0
103007 2 1 1 0 0
103008 2 1 1 0 0
103009 2 2 1 0 0
103010 3 2 1 0 0
103011 4 2 1 0 0
103012 5 3 1 0 0
103013 5 3 1 0 0
103014 5 3 1 0 0
103015 5 3 1 0 0
103016 5 3 1 0 0
103017 5 3 1 0 0
103018 5 3 1 0 0
103019 5 3 1 0 0
103020 5 3 1 0 0
103021 5 3 1 0 0
103022 5 3 1 0 0
103023 8 2 1 0 0
104001 1 2 1 0 0
104002 1 2 1 0 0
104003 1 2 1 0 0
104004 2 2 1 0 0
104005 2 1 1 0 0
104006 2 2 1 0 0
104007 2 1 1 0 0
104008 2 1 1 0 0
104009 2 2 1 0 0
104010 2 2 1 0 0
104011 2 2 1 0 0
104012 3 2 1 0 0
104013 5 3 1 0 0
104014 5 3 1 0 0
104015 5 3 1 0 0
104016 5 3 1 0 0
104017 5 3 1 0 0
104018 5 3 1 0 0
104019 8 2 1 0 0
105001 1 2 1 0 0
105002 1 2 1 0 0
105003 1 2 1 0 0
105004 2 2 1 0 0
105005 2 1 1 0 0
105006 2 2 1 0 0
105007 2 1 1 0 0
105008 2 1 1 0 0
105009 2 2 1 0 0
105010 2 2 1 0 0
105011 2 2 1 0 0
105012 2 1 1 0 0
105013 3 2 1 0 0
105014 5 3 1 0 0
105015 5 3 1 0 0
105016 5 3 1 0 0
105017 5 3 1 0 0
105018 5 3 1 0 0
105019 5 3 1 0 0
105020 5 3 1 0 0
105021 4 2 1 0 0
105022 8 2 1 0 0
106001 1 2 1 0 0
106002 1 2 1 0 0
106003 2 2 1 0 0
106004 2 1 1 0 0
106005 2 2 1 0 0
106006 3 2 1 0 0
106007 5 3 1 0 0
106008 5 3 1 0 0
106009 5 3 1 0 0
106010 5 3 1 0 0
106011 5 3 1 0 0
106012 5 3 1 0 0
106013 8 2 1 0 0
107001 1 2 1 0 0
107002 1 2 1 0 0
107003 2 2 1 0 0
107004 2 1 1 0 0
107005 2 2 1 0 0
107006 2 2 1 0 0
107007 2 1 1 0 0
107008 2 2 1 0 0
107009 3 2 1 0 0
107010 5 3 1 0 0
107011 5 3 1 0 0
107012 5 3 1 0 0
107013 5 3 1 0 0
107014 5 3 1 0 0
107015 5 3 1 0 0
107016 5 3 1 0 0
107017 5 3 1 0 0
107018 5 3 1 0 0
107019 5 3 1 0 0
107020 5 3 1 0 0
107021 5 3 1 0 0
107022 5 3 1 0 0
107023 8 2 1 0 0
108001 1 2 1 0 0
108002 1 2 1 0 0
108003 1 2 1 0 0
108004 2 2 1 0 0
108005 2 1 1 0 0
108006 2 2 1 0 0
108007 2 2 1 0 0
108008 2 1 1 0 0
108009 2 2 1 0 0
108010 2 2 1 0 0
108011 3 2 1 0 0
108012 4 2 1 0 0
108013 5 3 1 0 0
108014 5 3 1 0 0
108015 5 3 1 0 0
108016 5 3 1 0 0
108017 5 3 1 0 0
108018 8 2 1 0 0
101014 5 1 2 0 101067
101015 5 3 2 0 101069
101016 5 3 2 0 101071
101017 5 3 2 0 101073
101018 5 3 2 0 101074
101019 5 3 2 0 101076
101020 5 3 2 0 101078
101021 5 3 2 0 101079
101022 5 3 2 0 101081
101023 5 3 2 0 101083
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0

View File

@ -1,53 +1,31 @@
id Event Groups
int int mut,int#int,2
1 101007 9#17
2 101013 1#19
3 101013 2#19
4 101013 1#20
5 101013 2#20
6 101013 1#3
7 101013 8#7
8 101013 10#7
9 101013 3#20
10 101013 10#16
11 101013 8#17
12 101013 1#18
13 101002 8#3|9#3|8#4|7#5|7#6
14 101001 2#14|3#14|2#15|3#15
15 101001 7#18|8#18|8#19
16 101002 4#10|4#11
17 101010 2#17
18 101013 9#15
19 101013 10#15
20 101013 8#16
21 101013 9#8
22 101013 10#8
23 101013 2#1
24 101011 8#8
25 101012 7#15
26 101013 1#1
27 101013 3#1
28 101013 4#1
29 101013 5#1
30 101013 1#2
31 101013 2#2
32 101013 3#2
33 101013 4#2
34 101001 4#18|3#19
35 101013 2#3|1#4
36 101013 7#17
37 101013 9#7
38 101013 4#20
39 101013 9#16
40 101008 8#2
41 101009 10#10
42 101004 1#11|2#11|1#12|2#12|5#17|6#17|6#18
43 101005 10#20
44 101006 4#3
45 101007 5#4
46 101001 8#11|9#11|8#12|9#12
47 101001 1#6|2#6|1#7|2#7
48 101002 6#1|5#2|6#2
49 101002 5#7|6#7|5#8|6#8
50 101003 10#4|10#5
51 101002 6#13|6#14
1 101010 11#25
2 101011 14#10
3 101014 17#24
4 101001 3#18|3#19
5 101004 8#25|9#25|9#26
6 101008 16#15
7 101009 20#14
8 101004 1#11|2#11|1#12|2#12|5#17|6#17|6#18
9 101001 14#20|15#20|14#21|15#21
10 101005 20#30
11 101007 6#5
12 101002 8#3|9#3|8#4|7#5|7#6
13 101001 8#11|9#11|8#12|9#12
14 101004 14#26|15#26|15#27
15 101001 1#6|2#6|1#7|2#7
16 101001 2#14|3#14|2#15|3#15
17 101002 6#1|5#2|6#2
18 101001 14#5|15#5|14#6|15#6
19 101004 11#6|12#6|12#7
20 101002 5#7|6#7|5#8|6#8
21 101001 7#18|8#18|8#19
22 101001 19#26|20#26|19#27|20#27
23 101002 19#3|20#3|19#4|20#4
24 101003 17#6|18#7
25 101002 4#10|4#11
26 101002 17#11|18#11|17#12|18#12
27 101002 6#13|6#14
28 101002 13#13|14#13|13#14|14#14
29 101002 18#18|19#18|18#19|19#19

View File

@ -1,26 +1,27 @@
id Event Groups
int int mut,int#int,2
1 101010 9#11
2 101008 2#2
3 102009 4#5|5#5|4#6|5#6
4 101009 7#16
5 102006 8#12|9#12|8#13|9#13
6 102005 5#17|6#17|5#18|6#18
7 101005 2#20
8 102008 1#8|2#8|1#9|2#9
9 101007 10#1
10 102007 1#14|2#14|1#15|2#15
11 101002 1#5|2#5|1#6|2#6
12 101011 5#9
13 101001 6#7|7#7|6#8|7#8
14 101001 2#17|3#17|2#18|3#18
15 102004 3#1|1#2|4#2
16 101002 4#3|5#3|4#4|5#4
17 101002 7#4|8#4|7#5|8#5
18 102003 9#6|10#6|9#7|10#7
19 102003 3#7|4#7|3#8|4#8
20 102003 2#10|3#10|2#11|3#11
21 102003 5#12|6#12|5#13|6#13
22 102003 9#14|10#14|9#15|10#15
23 101002 9#17|10#17|9#18|10#18
24 101002 6#19|7#19|6#20|7#20
2 102009 4#5|5#5|4#6|5#6
3 102006 8#12|9#12|8#13|9#13
4 102005 5#17|6#17|5#18|6#18
5 102008 1#8|2#8|1#9|2#9
6 102007 1#14|2#14|1#15|2#15
7 101011 5#9
8 101012 4#15
9 102004 3#1|1#2|4#2
10 102003 9#6|10#6|9#7|10#7
11 102003 3#7|4#7|3#8|4#8
12 102003 2#10|3#10|2#11|3#11
13 102003 5#12|6#12|5#13|6#13
14 102003 9#14|10#14|9#15|10#15
15 101008 2#2
16 101009 7#16
17 101005 2#20
18 101007 10#1
19 101002 1#5|2#5|1#6|2#6
20 101001 6#7|7#7|6#8|7#8
21 101001 2#17|3#17|2#18|3#18
22 101002 4#3|5#3|4#4|5#4
23 101002 7#4|8#4|7#5|8#5
24 101002 9#17|10#17|9#18|10#18
25 101002 6#19|7#19|6#20|7#20

View File

@ -48,31 +48,30 @@ int int mut,int#int,2
46 101013 9#4
47 101013 10#4
48 101013 10#5
49 101013 10#6
50 101013 10#7
49 101013 10#7
50 103021 6#4|15#10
51 103001 12#4|13#4|12#5|13#5
52 103021 15#10
53 103002 3#3|3#4
54 103020 11#14
55 101004 5#18|5#19
56 103022 5#14
57 101013 9#8
58 101013 11#11
59 101013 8#9
60 101013 5#15
61 101013 12#10
62 101013 9#11
63 101013 4#16
64 101013 3#17
65 101008 8#3
66 101009 9#10
67 101013 1#20
68 101004 10#1|11#1|12#1|13#1
69 103002 9#17|9#18
70 101005 1#5
71 103001 14#17|14#18
72 101007 15#3
73 103001 6#5|7#5|6#6|7#6
74 103002 12#11|12#12
75 101004 1#13|1#14
76 103002 3#11|4#11|3#12|4#12
52 103002 3#3|3#4
53 103020 11#14
54 101004 5#18|5#19
55 103022 5#14
56 101013 9#8
57 101013 11#11
58 101013 8#9
59 101013 5#15
60 101013 12#10
61 101013 9#11
62 101013 4#16
63 101013 3#17
64 101008 8#3
65 101009 9#10
66 101013 1#20
67 101004 10#1|11#1|12#1|13#1
68 103002 9#17|9#18
69 101005 1#5
70 103001 14#17|14#18
71 101007 15#3
72 103001 6#5|7#5|6#6|7#6
73 103002 12#11|12#12
74 101004 1#13|1#14
75 103002 3#11|4#11|3#12|4#12

View File

@ -0,0 +1,6 @@
Id Type MissionNum Reward OpenRules
int int int int mut,int#int,1
1 1 4 0 null
2 2 4 0 null
0 0 0 0 null
0 0 0 0 null

View File

@ -2,7 +2,7 @@ Id Type Values
int int mut,int#int,2
1 2 1503#1
2 1 101008#101061
0 0 null
3 4 2#3
0 0 null
0 0 null
0 0 null

View File

@ -1,6 +1,6 @@
Id AddConditionID BehaviorType BehaviorTypeValues Reward JumpType JumpTypeValues
int int int mut,int#int,2 mut,int#int,2 int mut,int#int,2
101001 1 2 1503#1 null 5 null
101001 1 2 1503#1 null 4 null
101002 0 0 null null 4 null
101003 0 5 0 null 4 null
101004 0 0 null null 4 null
@ -22,19 +22,19 @@ int int int mut,int#int,2 mut,int#int,2 int mut,int#int,2
101020 0 0 null null 1 101016
101021 0 0 null null 1 101017
101022 0 0 null null 1 101018
101023 0 0 null null 1 101019
101023 0 0 null null 5 101019
101024 0 0 null null 1 101020
101025 0 0 null null 1 101021
101026 0 0 null null 1 101022
101027 0 0 null null 6 101023
101028 0 0 null null 6 101024
101027 0 0 null null 5 101023
101028 0 0 null null 5 101024
101029 0 0 null null 1 101025
101030 0 0 null null 6 101026
101031 0 0 null null 6 101027
101030 0 0 null null 1 101026
101031 0 0 null null 5 101027
101032 0 0 null null 1 101028
101033 0 0 null null 6 101029
101033 0 0 null null 1 101029
101034 0 0 null null 1 101030
101035 0 5 0 null 5 null
101035 0 11 1#1#101#1010#101011 null 4 null
101036 0 0 null null 6 101014
101037 0 0 null null 1 101033
101038 0 0 null null 4 null
@ -75,4 +75,16 @@ int int int mut,int#int,2 mut,int#int,2 int mut,int#int,2
101073 0 0 null null 1 101063
101074 0 0 null null 1 101064
101075 0 0 null null 6 101061
101076 0 0 null null 4 null
101076 0 1 10101 null 1 101086
101077 0 9 1 null 4 null
101078 0 7 2#101015#101016#101017#101018#101019#101020#101021#101022#101023 null 3 101084#101068|1#3
101079 0 0 null null 4 null
101080 0 0 null null 4 null
101081 0 1 10101 null 1 101070
101082 0 9 2 1001#5000 4 null
101083 0 9 2 1001#5000 4 null
101084 0 1 10101 null 1 101072
101085 0 9 2 1001#5000 4 null
101086 0 9 2 1003#50 4 null
101087 0 14 1001#1500#2 1005#30 1 101085
101088 0 0 null null 4 null

View File

@ -1,11 +0,0 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.Table;
@Table(name = "MissionEventsConfig")
public class SCMissionEventsConfig implements BaseConfig {
@Override
public void init() throws Exception {
}
}

View File

@ -0,0 +1,51 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="MissionEventsConfig")
public class SMissionEventsConfig implements BaseConfig {
public static Map<Integer, SMissionEventsConfig> sMissionEventsConfigMap;
private int id;
private int type;
private int missionNum;
private int reward;
private int[] openRules;
@Override
public void init() throws Exception {
sMissionEventsConfigMap = STableManager.getConfig(SMissionEventsConfig.class);
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getMissionNum() {
return missionNum;
}
public int getReward() {
return reward;
}
public int[] getOpenRules() {
return openRules;
}
}

View File

@ -23,7 +23,7 @@ public class SOptionConfig implements BaseConfig{
private int[][] behaviorTypeValues;
private int[][] reward;
private int reward;
private int jumpType;
@ -47,7 +47,7 @@ public class SOptionConfig implements BaseConfig{
return behaviorTypeValues;
}
public int[][] getReward() {
public int getReward() {
return reward;
}

View File

@ -0,0 +1,25 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="SkillConfig")
public class SSkillConfig implements BaseConfig {
private int id;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
}

View File

@ -18,20 +18,40 @@ public class EventType {
/**
*
* 1
* id
* 2
* id#
* 3
* 4
* id#
* 5
* 0 id#x,y
* 6
* 7
*
* 7 (
* id#id#id#id
* 8 buff
* 9
* buff id
* 9
* id
* 10
* id#num#id#
* 11 (
* id#id#id#id#id#id#id
* 13
* id
* 14
* id##id
*/
public static final int fight = 1;
public static final int useItem = 2;
public static final int scout = 3;
public static final int leave = 4;
public static final int jump = 5;
public static final int dialogue = 7;
public static final int dun = 7;
public static final int eatBuff = 8;
public static final int destroyMission = 9;
public static final int monitorMission = 10;
public static final int openMission = 11;
public static final int finishMission = 13;
public static final int useItemMission = 14;
}

View File

@ -4,10 +4,9 @@ import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.MapManager;
import com.ljsd.jieling.logic.dao.User;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.handler.mission.MissionLogic;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -91,7 +90,6 @@ public class MapLogic {
CommonProto.Cell cellProto = CommonProto.Cell
.newBuilder()
.setCellId(entry.getKey())
.setEventId(cell.getEventId())
.setPointId(cell.getPointId())
.build();
cells.add(cellProto);
@ -117,6 +115,10 @@ public class MapLogic {
int y = scMap1.getGroups()[randomIndex][1];
int xy = CellUtil.xy2Pos(x, y);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap1.getEvent());
if (mapPointConfig == null) {
LOGGER.info("========scMap1.getEvent()======>{}", scMap1.getEvent());
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
if (mapPointConfig.getStyle() == EventType.enter) {
mapManager.setCurXY(xy);
@ -151,7 +153,7 @@ public class MapLogic {
float physicalDefence = HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.PHYSICAL_DEFENCE_TYPE);
float magicDefence = HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.MAGIC_DEFENCE_TYPE);
float hp = HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.HP_TYPE);
float speed = HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.HP_TYPE);
float speed = HeroLogic.getInstance().calHeroAttribute(hero, GlobalsDef.SPEED_TYPE);
CommonProto.Hero heroProto = CBean2Proto.getHero(hero);
CommonProto.HeroFightInfo heroFightInfo = CommonProto.HeroFightInfo
.newBuilder()
@ -213,7 +215,10 @@ public class MapLogic {
}
mapManager.addWalkCells(new HashSet<>(cells));
mapManager.setCurXY(curXY);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder()
.setEventId(cell.getEventId())
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true);
}
@ -283,6 +288,7 @@ public class MapLogic {
boolean isSuccess = false;
int behaviorType = sOptionConfig.getBehaviorType();
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
CommonProto.Mission openMission = null;
switch (behaviorType) {
case EventType.fight: {
// heroFightInfos = fightStart(uid, bigEventId, user);
@ -305,8 +311,56 @@ public class MapLogic {
}
break;
}
case EventType.dialogue: {
case EventType.dun: {
boolean hasMission = MissionLogic.getInstance().hasMission(user, behaviorTypeValues[0][0]);
if (hasMission) {
break;
}
SCMapConfig scMapConfig = SCMapConfig.getsCMapSize().get(mapManager.getCurMapId());
int[] mapSize = scMapConfig.getSize();
Map<Integer, Cell> newDunEvents = new HashMap<>();
Map<Integer, MapPointConfig> newDunEventIds = new HashMap<>();
int i = 0;
Random random = new Random();
while (newDunEventIds.size() < 3) {
int randomIndex = random.nextInt(behaviorTypeValues[0].length - 3) + 3;
int newDunEventId = behaviorTypeValues[0][randomIndex];
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(newDunEventId);
newDunEventIds.put(newDunEventIds.size(), mapPointConfig);
i++;
if (i >= 1000) {
break;
}
}
if (newDunEventIds.size() < 3) {
break;
}
i = 0;
while (newDunEvents.size() < 3) {
int x = random.nextInt(mapSize[0]) + 1;
int y = random.nextInt(mapSize[1]) + 1;
int xy = CellUtil.xy2Pos(x, y);
if (mapManager.getMapInfo().containsKey(xy)) {
continue;
}
MapPointConfig mapPointConfig = newDunEventIds.get(newDunEvents.size());
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
newDunEvents.put(xy, cellValue);
i++;
if (i >= 1000) {
break;
}
}
mapManager.getMapInfo().putAll(newDunEvents);
Mission mission = new Mission();
mission.setMissionId(behaviorTypeValues[0][0]);
mission.setMissionStep(0);
mission.getMissionInfos().putAll(newDunEvents);
mission.setMissionInfo(mapManager.getCurXY() + "#" + behaviorTypeValues[0][2] + "#" + behaviorTypeValues[0][1]);
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
doingMissions.put(behaviorTypeValues[0][0], mission);
user.getMissionManager().updateDoingMissions(doingMissions);
openMission = getMission(newDunEvents, mission);
break;
}
case EventType.jump: {
@ -317,6 +371,78 @@ public class MapLogic {
}
break;
}
case EventType.destroyMission: {
isSuccess = true;
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null) {
break;
}
String newEventId = MissionLogic.getInstance().checkMission(mission, user);
Map<Integer, Cell> mapInfo = new HashMap<>(mapManager.getMapInfo());
mapInfo.remove(mapManager.getCurXY());
if (newEventId != null && !newEventId.isEmpty()) {
String[] split = newEventId.split("#");
Cell cellUpdate = mapInfo.get(Integer.parseInt(split[0]));
if (cellUpdate != null) {
cellUpdate.setEventId(Integer.parseInt(split[1]));
}
}
mapManager.setMapInfo(mapInfo);
openMission = getMission(null, mission);
break;
}
case EventType.monitorMission: {
isSuccess = true;
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null) {
break;
}
MissionLogic.getInstance().checkMission(mission, user);
openMission = getMission(null, mission);
break;
}
case EventType.openMission: {
isSuccess = true;
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null) {
break;
}
MissionLogic.getInstance().checkMission(mission, user);
openMission = getMission(null, mission);
// TODO 还要开新事件
break;
}
case EventType.finishMission: {
isSuccess = true;
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null) {
break;
}
MissionLogic.getInstance().checkMission(mission, user);
openMission = getMission(null, mission);
break;
}
case EventType.useItemMission: {
isSuccess = true;
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null) {
break;
}
boolean checkCost = ItemUtil.itemCost(user, behaviorTypeValues);
if (!checkCost) {
break;
}
MissionLogic.getInstance().checkMission(mission, user);
openMission = getMission(null, mission);
break;
}
default: {
break;
}
@ -370,9 +496,23 @@ public class MapLogic {
// 2 物品数量
} else if (sOptionAddConditions.getType() == 2) {
} else {
// 3 角色属性
} else if (sOptionAddConditions.getType() == 3){
// 完成某个任务的第几步
} else if (sOptionAddConditions.getType() == 4){
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
Set<Integer> takeRewardMissions = user.getMissionManager().getTakeRewardMissions();
if (finishMissions.contains(sOptionAddConditions.getValues()[0][0]) || takeRewardMissions.contains(sOptionAddConditions.getValues()[0][0])) {
nextPoint = jumpTypeValues[0][0];
}
if (nextPoint == 0) {
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(sOptionAddConditions.getValues()[0][0]);
if (mission == null || mission.getMissionStep() < jumpTypeValues[0][1]) {
nextPoint = jumpTypeValues[0][1];
}
}
}
if (nextPoint == 0) {
nextPoint = jumpTypeValues[0][1];
@ -389,20 +529,12 @@ public class MapLogic {
}
}
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
if (behaviorType != EventType.jump) {
if (behaviorType != EventType.jump && behaviorType != EventType.destroyMission) {
cell.setEventId(nextPoint);
mapManager.addOrUpdateCell(mapManager.getCurXY(), cell);
}
int[][] reward = sOptionConfig.getReward();
CommonProto.Drop.Builder dropBuilder = null;
if (reward != null && reward.length > 0) {
Map<Integer, Integer> itemMap = new HashMap<>();
dropBuilder = CommonProto.Drop.newBuilder();
for (int i = 0; i < reward.length; i++) {
itemMap.put(reward[i][0], reward[i][1]);
}
ItemUtil.addItem(user, itemMap, dropBuilder);
}
int[] reward = {sOptionConfig.getReward()};
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, reward, 1);
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
for (int i = 0; i < sOptionConfig.getBehaviorTypeValues().length; i++) {
CommonProto.EventBehaviorValues.Builder eventBehaviorValues = CommonProto.EventBehaviorValues
@ -422,10 +554,36 @@ public class MapLogic {
if (dropBuilder != null) {
eventUpdateResponse.setDrop(dropBuilder);
}
LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}", mapManager.getCurXY(), cell.getPointId(), cell.getEventId());
if (openMission != null) {
eventUpdateResponse.setMission(openMission);
}
LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextPoint=>{}", mapManager.getCurXY(), cell.getPointId(),
cell.getEventId(), eventUpdateResponse.getMission(), nextPoint);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
}
private CommonProto.Mission getMission(Map<Integer, Cell> newDunEvents, Mission mission) {
CommonProto.Mission openMission;
StringBuilder state = null;
String states = "";
if (newDunEvents != null) {
state = new StringBuilder();
for (Map.Entry<Integer, Cell> cellEntry : newDunEvents.entrySet()) {
state.append(cellEntry.getKey());
state.append("#");
state.append(cellEntry.getValue().getPointId());
state.append("|");
}
states = state.toString().substring(0, state.toString().length() - 1);
}
openMission = CommonProto.Mission.newBuilder()
.setItemId(mission.getMissionId())
.setMissionStep(mission.getMissionStep())
.setState(states)
.build();
return openMission;
}
/**
* 退
* @param session

View File

@ -0,0 +1,47 @@
package com.ljsd.jieling.handler.mission;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.handler.map.Cell;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Mission extends MongoBase {
private int missionId;
private int missionStep;
private String missionInfo;
private Map<Integer, Cell> missionInfos = new ConcurrentHashMap<>();
public int getMissionId() {
return missionId;
}
public void setMissionId(int missionId) {
this.missionId = missionId;
}
public int getMissionStep() {
return missionStep;
}
public void setMissionStep(int missionStep) {
this.missionStep = missionStep;
}
public Map<Integer, Cell> getMissionInfos() {
return missionInfos;
}
public String getMissionInfo() {
return missionInfo;
}
public void setMissionInfo(String missionInfo) throws Exception {
updateString("missionInfo", missionInfo);
this.missionInfo = missionInfo;
}
}

View File

@ -0,0 +1,20 @@
package com.ljsd.jieling.handler.mission;
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.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class MissionGetAllRequestHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.MISSION_GET_ALL_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
MissionLogic.getInstance().getAllMissions(iSession, MessageTypeProto.MessageType.MISSION_GET_ALL_RESPONSE);
}
}

View File

@ -0,0 +1,135 @@
package com.ljsd.jieling.handler.mission;
import com.ljsd.jieling.config.SMissionEventsConfig;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.logic.dao.User;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.MissionInfoProto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.Set;
public class MissionLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(MissionLogic.class);
private MissionLogic() {
}
/**
*
*
* @return
*/
public static MissionLogic getInstance() {
return MissionLogic.Instance.instance;
}
public static class Instance {
public final static MissionLogic instance = new MissionLogic();
}
public void getAllMissions(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
MissionManager missionManager = user.getMissionManager();
Map<Integer, Mission> doingMissions = missionManager.getDoingMissions();
Set<Integer> finishMissions = missionManager.getFinishMissions();
MissionInfoProto.MissionGetAllResponse.Builder missionGetAllResponse = MissionInfoProto.MissionGetAllResponse.newBuilder();
for (Mission doingMission : doingMissions.values()) {
StringBuilder state = new StringBuilder();
String states = "";
if (!doingMission.getMissionInfos().isEmpty()) {
for (Map.Entry<Integer, Cell> cellEntry : doingMission.getMissionInfos().entrySet()) {
state.append(cellEntry.getKey());
state.append("#");
state.append(cellEntry.getValue().getPointId());
state.append("|");
}
states = state.toString().substring(0, state.toString().length() - 1);
}
CommonProto.Mission mission = CommonProto.Mission
.newBuilder()
.setMissionStep(doingMission.getMissionStep())
.setItemId(doingMission.getMissionId())
.setState(states)
.build();
missionGetAllResponse.addMissions(mission);
}
for (int finishMission : finishMissions) {
SMissionEventsConfig sMissionEventsConfig = SMissionEventsConfig.sMissionEventsConfigMap.get(finishMission);
CommonProto.Mission mission = CommonProto.Mission
.newBuilder()
.setMissionStep(sMissionEventsConfig.getMissionNum())
.setItemId(finishMission)
.setState("")
.build();
missionGetAllResponse.addMissions(mission);
}
MessageUtil.sendMessage(session, 1, messageType.getNumber(), missionGetAllResponse.build(), true);
}
public boolean hasMission(User user, int missionId) {
MissionManager missionManager = user.getMissionManager();
if (missionManager.getTakeRewardMissions().contains(missionId)){
return true;
}
if (missionManager.getDoingMissions().containsKey(missionId)) {
return true;
}
if (missionManager.getTakeRewardMissions().contains(missionId)) {
return true;
}
return false;
}
public String checkMission(Mission mission, User user) throws Exception {
String[] split1 = mission.getMissionInfo().split("#");
int needCount = Integer.parseInt(split1[2]);
mission.setMissionStep(mission.getMissionStep() + 1);
String newEventId = null;
if (mission.getMissionStep() >= needCount) {
if (mission.getMissionInfo() != null) {
newEventId = mission.getMissionInfo();
}
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
doingMissions.remove(mission.getMissionId());
user.getMissionManager().updateDoingMissions(doingMissions);
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
finishMissions.add(mission.getMissionId());
user.getMissionManager().updateFinishMissions(finishMissions);
} else {
user.getMissionManager().updateOneDoingMissions(mission.getMissionId(), mission);
}
return newEventId;
}
public void takeMissionReward(ISession session, int missionId, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
if (!finishMissions.contains(missionId)) {
return;
}
finishMissions.remove(missionId);
user.getMissionManager().updateFinishMissions(finishMissions);
user.getMissionManager().addTakeRewardMissions(missionId);
SMissionEventsConfig sMissionEventsConfig = SMissionEventsConfig.sMissionEventsConfigMap.get(missionId);
int[] reward = {sMissionEventsConfig.getReward()};
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, 1);
MissionInfoProto.TakeMissionResponse takeMissionResponse =
MissionInfoProto.TakeMissionResponse
.newBuilder()
.setDrop(drop)
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), takeMissionResponse, true);
}
}

View File

@ -0,0 +1,49 @@
package com.ljsd.jieling.handler.mission;
import com.google.common.collect.Sets;
import com.ljsd.common.mogodb.MongoBase;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class MissionManager extends MongoBase {
private Map<Integer, Mission> doingMissions = new ConcurrentHashMap<>();
private Set<Integer> finishMissions = Sets.newConcurrentHashSet();
private Set<Integer> takeRewardMissions = Sets.newConcurrentHashSet();
public Map<Integer, Mission> getDoingMissions() {
return doingMissions;
}
public Set<Integer> getFinishMissions() {
return finishMissions;
}
public Set<Integer> getTakeRewardMissions() {
return takeRewardMissions;
}
public void updateDoingMissions(Map<Integer, Mission> doingMissions) throws Exception {
this.doingMissions = doingMissions;
updateString( "doingMissions", doingMissions);
}
public void updateOneDoingMissions(int missionId, Mission mission) throws Exception {
this.doingMissions.put(missionId, mission);
updateString( "doingMissions." + missionId, mission);
}
public void updateFinishMissions(Set<Integer> finishMissions) throws Exception {
this.finishMissions = finishMissions;
updateString( "finishMissions", finishMissions);
}
public void addTakeRewardMissions(int missionId) throws Exception {
takeRewardMissions.add(missionId);
updateString( "takeRewardMissions", takeRewardMissions);
}
}

View File

@ -0,0 +1,24 @@
package com.ljsd.jieling.handler.mission;
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.MessageTypeProto;
import com.ljsd.jieling.protocols.MissionInfoProto;
import org.springframework.stereotype.Component;
@Component
public class MissionTakeRewardRequestHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.MISSION_TAKE_REWARD_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] message = netData.parseClientProtoNetData();
MissionInfoProto.TakeMissionRewardRequest takeMissionRewardRequest = MissionInfoProto.TakeMissionRewardRequest.parseFrom(message);
int missionId = takeMissionRewardRequest.getMissionId();
MissionLogic.getInstance().takeMissionReward(iSession, missionId, MessageTypeProto.MessageType.MISSION_TAKE_REWARD_RESPONSE);
}
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.LjsdMongoTemplate;
import com.ljsd.common.mogodb.MongoRoot;
import com.ljsd.jieling.handler.mission.MissionManager;
public class User extends MongoRoot {
public static final String _COLLECTION_NAME = "user";
@ -15,6 +16,8 @@ public class User extends MongoRoot {
private MapManager mapManager;
private MissionManager missionManager;
private TeamPosManager teamPosManager;
private MailManager mailManager;
@ -35,6 +38,7 @@ public class User extends MongoRoot {
this.itemManager = itemManager;
this.heroManager = heroManager;
this.mapManager = mapManager;
this.missionManager = new MissionManager();
this.teamPosManager = new TeamPosManager();
this.mailManager = new MailManager();
this.equipManager = new EquipManager();
@ -46,6 +50,7 @@ public class User extends MongoRoot {
this.itemManager.init(this, "itemManager", false);
this.heroManager.init(this, "heroManager", false);
this.mapManager.init(this, "mapManager", false);
this.missionManager.init(this, "missionManager", false);
this.teamPosManager.init(this,"teamPosManager",false);
this.mailManager.init(this,"mailManager",false);
this.equipManager.init(this,"equipManager",false);
@ -59,6 +64,7 @@ public class User extends MongoRoot {
this.itemManager = new ItemManager();
this.heroManager = new HeroManager();
this.mapManager = new MapManager();
this.missionManager = new MissionManager();
this.equipManager = new EquipManager();
this.adventureManager = new AdventureManager();
this.pokemonManager = new PokemonManager();
@ -68,6 +74,7 @@ public class User extends MongoRoot {
heroManager.init(this, "heroManager", false);
mapManager.init(this, "mapManager", false);
equipManager.init(this,"equipManager",false);
missionManager.init(this, "missionManager", false);
adventureManager.init(this,"adventureManager",false);
pokemonManager.init(this,"pokemonManager",false);
}
@ -144,4 +151,8 @@ public class User extends MongoRoot {
public PokemonManager getPokemonManager() {
return pokemonManager;
}
public MissionManager getMissionManager() {
return missionManager;
}
}

View File

@ -229,7 +229,7 @@ public class ItemUtil {
dropBuilder.addAllItemlist(itemProtoList);
}
//todo 为了测试 日后要删掉
UserManager.ljsdMongoTemplate.lastUpdate();
// UserManager.ljsdMongoTemplate.lastUpdate();
}
public static void useItem(User user,Map<Integer,Integer> useItemMap) throws Exception{