back_recharge
parent
8ce37171b1
commit
97878442d8
|
@ -0,0 +1,59 @@
|
|||
Id Option
|
||||
int mut,int#int,1
|
||||
101001 10101
|
||||
101002 10102
|
||||
101003 10104
|
||||
101004 101001#101002
|
||||
101005 101003#101004
|
||||
101006 101005#101006
|
||||
101007 101007#101008
|
||||
101008 101009#101010
|
||||
101009 101011#101012
|
||||
101010 101013
|
||||
101011 101014
|
||||
101012 101015#101016
|
||||
101013 101017
|
||||
101014 101018#101019
|
||||
101015 101020
|
||||
101016 101021
|
||||
101017 101022
|
||||
101018 101023
|
||||
101019 101024
|
||||
101020 101025
|
||||
101021 101026
|
||||
101022 101027
|
||||
101023 101028
|
||||
101024 101029
|
||||
101025 101030
|
||||
101026 101031
|
||||
101027 101032
|
||||
101028 101033
|
||||
101029 101034
|
||||
101030 101035
|
||||
101029 101036#101037
|
||||
101030 101036#101037
|
||||
101031 101036#101037
|
||||
101032 101036#101037
|
||||
101033 101036#101037
|
||||
101034 null
|
||||
101035 null
|
||||
101036 null
|
||||
101037 null
|
||||
101038 null
|
||||
101039 null
|
||||
101040 null
|
||||
101041 null
|
||||
101042 null
|
||||
101043 null
|
||||
101044 null
|
||||
101045 null
|
||||
101046 null
|
||||
101047 null
|
||||
101048 null
|
||||
101049 null
|
||||
101050 null
|
||||
101051 null
|
||||
101052 null
|
||||
101053 null
|
||||
101054 null
|
||||
101055 null
|
|
@ -0,0 +1,148 @@
|
|||
Id Style Refresh TriggerRules ExploreValues InitialEventId
|
||||
int int int int int int
|
||||
101001 1 2 1 0 101001
|
||||
101002 1 2 1 0 101002
|
||||
101003 1 2 1 0 101003
|
||||
101004 2 3 1 0 101004
|
||||
101005 3 2 1 0 101005
|
||||
101006 4 2 1 0 101006
|
||||
101007 5 3 1 0 101007
|
||||
101008 5 4 1 0 101029
|
||||
101009 5 3 1 0 101030
|
||||
101010 5 3 1 0 101031
|
||||
101011 5 3 1 0 101032
|
||||
101012 5 3 1 0 101033
|
||||
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
|
|
@ -1,44 +1,44 @@
|
|||
id Event Groups
|
||||
int int mut,int#int,2
|
||||
1 101013 1#19
|
||||
2 101013 2#19
|
||||
3 101013 1#20
|
||||
4 101013 2#20
|
||||
5 101013 1#3
|
||||
6 101013 8#7
|
||||
7 101013 10#7
|
||||
8 101013 3#20
|
||||
9 101013 10#16
|
||||
10 101013 8#17
|
||||
11 101013 1#18
|
||||
12 101002 8#3|9#3|8#4|7#5|7#6
|
||||
13 101001 2#14|3#14|2#15|3#15
|
||||
14 101001 7#18|8#18|8#19
|
||||
15 101002 4#10|4#11
|
||||
16 101010 2#17
|
||||
17 101013 9#15
|
||||
18 101013 10#15
|
||||
19 101013 8#16
|
||||
20 101013 9#8
|
||||
21 101013 10#8
|
||||
22 101013 2#1
|
||||
23 101011 8#8
|
||||
24 101012 7#15
|
||||
25 101013 1#1
|
||||
26 101013 3#1
|
||||
27 101013 4#1
|
||||
28 101013 5#1
|
||||
29 101013 1#2
|
||||
30 101013 2#2
|
||||
31 101013 3#2
|
||||
32 101013 4#2
|
||||
33 101001 4#18|3#19
|
||||
34 101013 2#3|1#4
|
||||
35 101013 7#17
|
||||
36 101013 9#7
|
||||
37 101013 4#20
|
||||
38 101013 9#16
|
||||
39 101013 9#17
|
||||
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
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
Id Type Values
|
||||
int int mut,int#int,2
|
||||
1 2 1503#1
|
||||
2 1 101008
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
||||
0 0 null
|
|
@ -0,0 +1,39 @@
|
|||
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 4 null
|
||||
101002 0 0 null null 4 null
|
||||
101003 0 0 null null 5 null
|
||||
101004 0 0 null null 4 null
|
||||
101005 0 0 null null 6 102
|
||||
101006 0 0 null null 4 null
|
||||
101007 0 0 null null 1 101008
|
||||
101008 0 0 null null 4 null
|
||||
101009 0 0 null null 1 101009
|
||||
101010 0 0 null null 4 null
|
||||
101011 0 0 null null 1 101010
|
||||
101012 0 0 null null 4 null
|
||||
101013 0 0 null null 1 101011
|
||||
101014 0 0 null null 1 101012
|
||||
101015 0 0 null null 1 101013
|
||||
101016 0 0 null null 4 null
|
||||
101017 0 0 null null 1 101014
|
||||
101018 0 0 null null 3 101015#101028|2
|
||||
101019 0 0 null null 4 null
|
||||
101020 0 0 null null 3 101016
|
||||
101021 0 0 null null 3 101017
|
||||
101022 0 0 null null 3 101018
|
||||
101023 0 0 null null 3 101019
|
||||
101024 0 0 null null 3 101020
|
||||
101025 0 0 null null 3 101021
|
||||
101026 0 0 null null 3 101022
|
||||
101027 0 0 null null 3 101023
|
||||
101028 0 0 null null 1 101024
|
||||
101029 0 0 null null 3 101025
|
||||
101030 0 0 null null 3 101026
|
||||
101031 0 0 null null 3 101027
|
||||
101032 0 0 null null 3 101028
|
||||
101033 0 0 null null 3 101029
|
||||
101034 0 0 null null 3 101030
|
||||
101035 0 0 null null 5 null
|
||||
101036 1 2 1503#1 null 4 null
|
||||
101037 0 0 null null 4 null
|
|
@ -0,0 +1,28 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="EventPointConfig")
|
||||
public class SEventPointConfig implements BaseConfig {
|
||||
public static Map<Integer, SEventPointConfig> sEventPointConfigMap;
|
||||
private int id;
|
||||
|
||||
private int[] option;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sEventPointConfigMap = STableManager.getConfig(SEventPointConfig.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getOption() {
|
||||
return option;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "OptionConfig")
|
||||
public class SMapPointConfig implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SMapPointConfig> sMapPointConfigMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sMapPointConfigMap = STableManager.getConfig(SMapPointConfig.class);
|
||||
}
|
||||
}
|
|
@ -29,6 +29,8 @@ public class SOptionConfig implements BaseConfig{
|
|||
|
||||
private int[][] jumpTypeValues;
|
||||
|
||||
private int addConditionID;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -56,4 +58,8 @@ public class SOptionConfig implements BaseConfig{
|
|||
public int[][] getJumpTypeValues() {
|
||||
return jumpTypeValues;
|
||||
}
|
||||
|
||||
public int getAddConditionID() {
|
||||
return addConditionID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,17 +6,17 @@ public class Cell extends MongoBase {
|
|||
|
||||
private int cellId;
|
||||
|
||||
private int eventId;
|
||||
private int pointId;
|
||||
|
||||
private int state;
|
||||
private int eventId;
|
||||
|
||||
public Cell() {
|
||||
}
|
||||
|
||||
public Cell(int cellId, int eventId, int state) {
|
||||
public Cell(int cellId, int eventId, int pointId) {
|
||||
this.cellId = cellId;
|
||||
this.pointId = pointId;
|
||||
this.eventId = eventId;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public int getCellId() {
|
||||
|
@ -27,12 +27,17 @@ public class Cell extends MongoBase {
|
|||
return eventId;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
public int getPointId() {
|
||||
return pointId;
|
||||
}
|
||||
|
||||
public void setState(int state) throws Exception {
|
||||
updateString("state", state);
|
||||
this.state = state;
|
||||
public void setPointId(int pointId) throws Exception {
|
||||
updateString("pointId", pointId);
|
||||
this.pointId = pointId;
|
||||
}
|
||||
|
||||
public void setEventId(int eventId) throws Exception {
|
||||
updateString("eventId", eventId);
|
||||
this.eventId = eventId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MapUpdateEventRequestHandler extends BaseHandler {
|
||||
public class EventUpdateRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_UDPATE_EVENT_REQUEST;
|
||||
return MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapUpdateEventRequest mapEnterRequest = MapInfoProto.MapUpdateEventRequest.parseFrom(message);
|
||||
MapLogic.getInstance().updateEvent(iSession, mapEnterRequest.getCurXY(), mapEnterRequest.getChoice(), mapEnterRequest.getCellsList(), MessageTypeProto.MessageType.MAP_UDPATE_EVENT_RESPONSE);
|
||||
MapInfoProto.EventUpdateRequest eventUpdateRequest = MapInfoProto.EventUpdateRequest.parseFrom(message);
|
||||
MapLogic.getInstance().updateEvent(iSession, eventUpdateRequest.getEventId(), eventUpdateRequest.getOptionId(), MessageTypeProto.MessageType.EVENT_UPDATE_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map;
|
|||
|
||||
import com.ljsd.jieling.config.SCMap;
|
||||
import com.ljsd.jieling.config.MapPointConfig;
|
||||
import com.ljsd.jieling.config.SEventPointConfig;
|
||||
import com.ljsd.jieling.config.SOptionConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -91,7 +92,7 @@ public class MapLogic {
|
|||
.newBuilder()
|
||||
.setCellId(entry.getKey())
|
||||
.setEventId(cell.getEventId())
|
||||
.setState(cell.getState())
|
||||
.setPointId(cell.getPointId())
|
||||
.build();
|
||||
cells.add(cellProto);
|
||||
}
|
||||
|
@ -116,7 +117,7 @@ public class MapLogic {
|
|||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap1.getEvent());
|
||||
Cell cellValue = new Cell(xy, scMap1.getEvent(), mapPointConfig.getInitialEventId());
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
if (mapPointConfig.getStyle() == EventType.enter) {
|
||||
mapManager.setCurXY(xy);
|
||||
}
|
||||
|
@ -126,6 +127,9 @@ public class MapLogic {
|
|||
newMap.put(xy, cellValue);
|
||||
}
|
||||
}
|
||||
if (mapManager.getCurMapId() > mapManager.getMaxMapId()) {
|
||||
mapManager.setMaxMapId(mapManager.getCurMapId());
|
||||
}
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setTypeEight(spicelMap);
|
||||
}
|
||||
|
@ -187,17 +191,9 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新事件点
|
||||
*
|
||||
* @param session
|
||||
* @param xy
|
||||
*/
|
||||
public void updateEvent(ISession session, int xy, int choice, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
Set<Integer> cellSet = new HashSet<>(cells);
|
||||
if (cells.size() != cellSet.size()) {
|
||||
LOGGER.info("cells has repeated");
|
||||
public void updateMap(ISession session, int curXY, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
if (cells.isEmpty()) {
|
||||
LOGGER.info("cells.isEmpty()");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
|
@ -209,23 +205,73 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(xy);
|
||||
Cell cell = mapManager.getMapInfo().get(curXY);
|
||||
if (cell == null) {
|
||||
LOGGER.info("xy is wrong =>{}", xy);
|
||||
LOGGER.info("xy is wrong =>{}", curXY);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
mapManager.addWalkCells(new HashSet<>(cells));
|
||||
mapManager.setCurXY(curXY);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新事件点
|
||||
* optionConfig Id
|
||||
* @param session
|
||||
* @param optionId
|
||||
*/
|
||||
public void updateEvent(ISession session, int eventId, int optionId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("mapManager.getMapInfo() == null");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
if (cell == null) {
|
||||
LOGGER.info("cell == null xy is wrong =>{}", mapManager.getCurXY());
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
mapManager.setCurXY(xy);
|
||||
int bigEventId = cell.getEventId();
|
||||
int schedule = cell.getState();
|
||||
if (eventId != bigEventId) {
|
||||
LOGGER.info("eventId != bigEventId =>{} {}", eventId, bigEventId);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
SEventPointConfig sEventPointConfig = SEventPointConfig.sEventPointConfigMap.get(eventId);
|
||||
if (sEventPointConfig == null) {
|
||||
LOGGER.info("sEventPointConfig == null");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
boolean can = false;
|
||||
for (int i = 0; i < option.length; i++) {
|
||||
if (option[i] == optionId) {
|
||||
can = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!can) {
|
||||
LOGGER.info("option =>{} optionId=>{}", option, optionId);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int schedule = cell.getPointId();
|
||||
if (schedule == -1) {
|
||||
LOGGER.info("event is finished,bigEventId=>{} smallEventId=>{}", bigEventId, -1);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(choice);
|
||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||
if (sOptionConfig == null) {
|
||||
LOGGER.info("no this event=>{}", choice);
|
||||
LOGGER.info("sOptionConfig == null=>{}", optionId);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
|
@ -277,7 +323,7 @@ public class MapLogic {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,6 +352,7 @@ public class MapLogic {
|
|||
}
|
||||
// 4 不跳转,关闭界面
|
||||
case 4:{
|
||||
nextPoint = -1;
|
||||
break;
|
||||
}
|
||||
// 5 返回主城
|
||||
|
@ -320,9 +367,9 @@ public class MapLogic {
|
|||
break;
|
||||
}
|
||||
}
|
||||
MapInfoProto.MapUpdateEventResponse.Builder mapUpdateEventResponse = MapInfoProto.MapUpdateEventResponse.newBuilder();
|
||||
cell.setState(nextPoint);
|
||||
mapManager.addOrUpdateCell(xy, cell);
|
||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||
cell.setEventId(nextPoint);
|
||||
mapManager.addOrUpdateCell(mapManager.getCurXY(), cell);
|
||||
int[][] reward = sOptionConfig.getReward();
|
||||
List<CommonProto.Item> rewards = new ArrayList<>();
|
||||
if (reward != null && reward.length > 0) {
|
||||
|
@ -342,11 +389,48 @@ public class MapLogic {
|
|||
// user.getPlayerInfoManager().setMapId(user.getPlayerInfoManager().getMapId() + 1);
|
||||
// return;
|
||||
// }
|
||||
mapUpdateEventResponse.setCurXY(xy);
|
||||
mapUpdateEventResponse.setEventSchedule(cell.getState());
|
||||
mapUpdateEventResponse.addAllItems(rewards);
|
||||
LOGGER.info("updateEvent success xy=>{}, state=>{}", xy, cell.getState());
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateEventResponse.build(), true);
|
||||
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
|
||||
for (int i = 0; i < sOptionConfig.getBehaviorTypeValues().length; i++) {
|
||||
CommonProto.EventBehaviorValues.Builder eventBehaviorValues = CommonProto.EventBehaviorValues
|
||||
.newBuilder();
|
||||
for (int j = 0; j < sOptionConfig.getBehaviorTypeValues()[i].length; j++) {
|
||||
eventBehaviorValues.addBehaviorValues(sOptionConfig.getBehaviorTypeValues()[i][j]);
|
||||
}
|
||||
eventBehaviorValuesList.add(eventBehaviorValues.build());
|
||||
}
|
||||
CommonProto.EventBehaviorCommon eventBehaviorCommon = CommonProto.EventBehaviorCommon
|
||||
.newBuilder()
|
||||
.setBehaviorType(sOptionConfig.getBehaviorType())
|
||||
.addAllEventBehaviorValues(eventBehaviorValuesList)
|
||||
.build();
|
||||
eventUpdateResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
||||
eventUpdateResponse.setEventId(cell.getEventId());
|
||||
LOGGER.info("updateEvent success xy=>{}, getPointId=>{} eventId={}", mapManager.getCurXY(), cell.getPointId(), cell.getEventId());
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出地图
|
||||
* @param session
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void outMap(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("mapManager.getMapInfo() == null");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
mapManager.setMapInfo(new HashMap<>());
|
||||
mapManager.setHeroes(new HashSet<>());
|
||||
mapManager.setTypeEight(new HashMap<>());
|
||||
mapManager.setWalkCells(new HashSet<>());
|
||||
mapManager.setCurXY(0);
|
||||
mapManager.setCurMapId(0);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
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.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MapOutRequestHandler extends BaseHandler{
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_OUT_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().outMap(iSession, MessageTypeProto.MessageType.MAP_OUT_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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 MapUpdateRequestHandler extends BaseHandler{
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_UDPATE_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapUpdateRequest mapEnterRequest = MapInfoProto.MapUpdateRequest.parseFrom(message);
|
||||
MapLogic.getInstance().updateMap(iSession, mapEnterRequest.getCurXY(), mapEnterRequest.getCellsList(), MessageTypeProto.MessageType.MAP_UDPATE_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ package com.ljsd.jieling.logic.dao;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.handler.map.Cell;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -17,12 +18,16 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private int curXY;
|
||||
|
||||
private int maxMapId;
|
||||
|
||||
private Set<String> heroes;
|
||||
|
||||
private Map<Integer, Cell> mapInfo;
|
||||
|
||||
private Map<Integer, Cell> typeEight;
|
||||
|
||||
private Set<Integer> walkCells;
|
||||
|
||||
private Map<Integer, List<Integer>> crossMapInfos = new ConcurrentHashMap<>();
|
||||
|
||||
public Map<Integer, Cell> getMapInfo() {
|
||||
|
@ -83,4 +88,31 @@ public class MapManager extends MongoBase {
|
|||
updateString( "heroes", heroes);
|
||||
this.heroes = heroes;
|
||||
}
|
||||
|
||||
public Set<Integer> getWalkCells() {
|
||||
return walkCells;
|
||||
}
|
||||
|
||||
public void setWalkCells(Set<Integer> walkCells) throws Exception {
|
||||
updateString( "walkCells", walkCells);
|
||||
this.walkCells = walkCells;
|
||||
}
|
||||
|
||||
public void addWalkCells(Set<Integer> walkCells) throws Exception {
|
||||
updateString( "walkCells", walkCells);
|
||||
if (this.walkCells == null) {
|
||||
this.walkCells = walkCells;
|
||||
} else {
|
||||
this.walkCells.addAll(walkCells);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxMapId() {
|
||||
return maxMapId;
|
||||
}
|
||||
|
||||
public void setMaxMapId(int maxMapId) throws Exception {
|
||||
updateString( "maxMapId", maxMapId);
|
||||
this.maxMapId = maxMapId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -403,7 +403,7 @@ public class HeroLogic {
|
|||
|
||||
//todo 计算英雄战斗力 战斗力 = 生命*0.7 + (护甲 + 魔坑)*5 + 攻击 *10 + (暴击率 + 效果命中率 )*5 +(属性攻击率 + 属性防御率)*30
|
||||
public int calHeoForce(Hero hero){
|
||||
double heroBaseForce = calHeroAttribute(hero, GlobalsDef.HP_TYPE) * 0.7 + (calHeroAttribute(hero, GlobalsDef.PhysicalDefence_TYPE) + calHeroAttribute(hero, GlobalsDef.MagicDefence_TYPE)) * 5 + calHeroAttribute(hero, GlobalsDef.ATTACK_TYPE) * 10;
|
||||
double heroBaseForce = calHeroAttribute(hero, GlobalsDef.HP_TYPE) * 0.7 + (calHeroAttribute(hero, GlobalsDef.PHYSICAL_DEFENCE_TYPE) + calHeroAttribute(hero, GlobalsDef.MAGIC_DEFENCE_TYPE)) * 5 + calHeroAttribute(hero, GlobalsDef.ATTACK_TYPE) * 10;
|
||||
//todo 计算装备加成
|
||||
float equipAddForce =0.0f;
|
||||
int result = (int) (heroBaseForce + equipAddForce);
|
||||
|
|
Loading…
Reference in New Issue