back_recharge
jiahuiwen 2019-01-23 16:05:25 +08:00
parent 4d1ae3caf3
commit d897a8e24a
2 changed files with 89 additions and 71 deletions

View File

@ -1,63 +1,67 @@
Id EventsId Order Contents Reward Jump OpenRules UnfinishInfo Id EventsId Order Contents Reward Jump
int int int mut,int#int,2 mut,int#int,2 mut,int#int,2 mut,int#int,2 string int int int mut,int#int,2 mut,int#int,2 mut,int#int,2
1 101001 0 1#10101 1 null null 1 101001 0 1#10101 1 null
2 101002 0 1#10102 1 null null 2 101002 0 1#10102 1 null
3 101003 0 1#10103 1 null null 3 101003 0 1#10103 1 null
4 101004 0 3#1200#1|6#100 2#0 null null 4 101004 0 3#1200#1|6#100 2#0 null
5 101005 0 11#0|6#1 null null 5 101005 0 11#0|6#1 null null
6 101006 0 11#102|6#1 null null 6 101006 0 11#102|6#1 null null
7 101007 0 3#2#0|6#100 10100700 1#1 null 7 101007 0 3#2#0|6#100 10100700 1#1
8 101007 1 3#2#0|6#100 10100701 1#2 null 8 101007 1 3#2#0|6#100 10100701 1#2
9 101007 2 3#2#0|6#100 10100702 1#3 null 9 101007 2 3#2#0|6#100 10100702 1#3
10 101007 3 3#2#0 10100703 1#4 null 10 101007 3 3#2#0 10100703 1#4
11 101007 4 3#2#0 10100704 1#5 null 11 101007 4 3#2#0 10100704 1#5
12 101007 5 3#2#0|6#100 10100705 1#6 null 12 101007 5 3#2#0|6#100 10100705 1#6
13 101007 6 3#2#0 10100706 1#7 null 13 101007 6 3#2#0 10100706 1#7
14 101007 7 3#2#0|6#100 10100707 1#8 null 14 101007 7 3#2#0|6#100 10100707 1#8
15 101007 9 3#2#0 10100708 1#9 1#101008 一片茂密的草丛,草丛中可能潜藏着未知的危险,还是先去确认声音来源吧。 15 101007 8 3#2#0 10100708 1#9
16 101007 10 3#2#0 10100709 1#10 null 16 101007 9 3#2#0 10100709 1#10
17 101007 11 3#2#0 10100710 1#11 null 17 101007 10 3#2#0 10100710 1#11
18 101007 12 3#2#0 10100711 1#12 null 18 101007 11 3#2#0 10100711 1#12
19 101007 13 3#2#0 10100712 1#13 null 19 101007 12 3#2#0 10100712 1#13
20 101007 14 3#2#0 10100713 1#14 null 20 101007 13 3#2#0 10100713 1#14
21 101007 15 3#2#0 10100714 1#15 null 21 101007 14 3#2#0 10100714 1#15
22 101007 16 1#10101 10100715 1#16 null 22 101007 15 1#10101 10100715 1#16
23 101007 17 3#2#0 10100716 1#17 null 23 101007 16 null 10100716 1#17
24 101007 18 3#2#0 10100717 1#18 null 24 101007 17 3#2#0 10100717 1#18
25 101007 19 3#2#0 10100718 1#19 null 25 101007 18 3#2#0 10100718 1#19
26 101007 20 3#2#0 10100719 null null 26 101007 19 null 10100719 1#20
27 101008 0 null 1#1 null 27 101007 20 3#2#0 10100720 1#21
28 101008 1 null 1#2 null 28 101007 21 null 10100721 1#22
29 101008 2 null 1#3 null 29 101007 22 3#2#0 10100722 null
30 101008 3 null 1#4 null 30 101008 0 3#2#0|6#100 10100800 1#1
31 101008 4 null 1#5 null 31 101008 1 3#2#0|6#100 10100801 1#2
32 101008 5 null 1#6 null 32 101008 2 3#2#0|6#100 10100802 1#3
33 101008 6 null 1#7 null 33 101008 3 3#2#0|6#100 10100803 1#4
34 101008 7 null 1#8 null 34 101008 4 3#2#0|6#100 10100804 1#5
35 101008 8 null 1#9 null 35 101008 5 3#2#0 10100805 1#6
36 101008 9 null 1#10 null 36 101008 6 3#2#0 10100806 1#7
37 101008 10 null 1#11 null 37 101008 7 3#2#0|6#100 10100807 1#8
38 101008 11 null 1#12 null 38 101008 8 3#2#0 10100808 1#9
39 101008 12 null 1#13 null 39 101008 9 3#2#0 10100809 1#10
40 101008 13 null 1#14 null 40 101008 10 3#2#0 10100810 1#11
41 101008 14 null 1#15 null 41 101008 11 3#2#0 10100811 1#12
42 101008 15 null 1#16 null 42 101008 12 3#2#0 10100812 1#13
43 101008 16 null 1#17 null 43 101008 13 3#2#0 10100813 1#14
44 101008 17 null 1#18 null 44 101008 14 3#2#0 10100814 1#15
45 101008 18 null 1#19 null 45 101008 15 3#2#0 10100815 1#16
46 101008 19 null 1#20 null 46 101008 16 3#2#0 10100816 1#17
47 101008 20 null 1#21 null 47 101008 17 3#2#0 10100817 1#18
48 101008 21 null 1#22 null 48 101008 18 3#2#0 10100818 1#19
49 101008 22 null 1#23 null 49 101008 19 3#2#0 10100819 1#20
50 101008 23 null 1#24 null 50 101008 20 3#2#0 10100820 1#21
51 101008 24 null 1#25 null 51 101008 21 3#2#0 10100821 1#22
52 101008 25 null 1#26 null 52 101008 22 3#2#0 10100822 1#23
53 101008 26 null 1#27 null 53 101008 23 3#2#0 10100823 1#24
54 101008 27 null 1#28 null 54 101008 24 3#2#0 10100824 1#25
55 101008 28 null 1#29 null 55 101008 25 3#2#0 10100825 1#26
56 101008 29 null 1#30 null 56 101008 26 3#2#0 10100826 1#27
57 101008 30 null 1#31 null 57 101008 27 3#2#0 10100827 1#28
58 101008 31 null 1#32 null 58 101008 28 3#2#0|6#100 10100828 1#29
59 101008 32 null null null 59 101008 29 3#2#0 10100829 1#30
60 101009 0 null null null 60 101008 30 3#2#0 10100830 1#31
61 101010 0 null null null 61 101008 31 3#2#0 10100831 1#32
62 101008 32 3#2#0|6#100 10100832 null
63 101009 0 3#2#0 null null
64 101010 0 3#2#0 null null
65 101011 0 3#2#0 null null

View File

@ -52,9 +52,9 @@ public class MapLogic {
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager(); MapManager mapManager = user.getMapManager();
if (mapManager.getCurMapId() == 0) { if (mapManager.getCurMapId() == 0) {
if (heroInfosList == null || heroInfosList.isEmpty()) { // if (heroInfosList == null || heroInfosList.isEmpty()) {
return; // return;
} // }
Map<String, Integer> heroes = new HashMap<>(heroInfosList.size()); Map<String, Integer> heroes = new HashMap<>(heroInfosList.size());
for (MapInfoProto.HeroInfo heroInfo : heroInfosList) { for (MapInfoProto.HeroInfo heroInfo : heroInfosList) {
heroes.put(heroInfo.getHeroId(), heroInfo.getHeroHp()); heroes.put(heroInfo.getHeroId(), heroInfo.getHeroHp());
@ -156,14 +156,21 @@ public class MapLogic {
Set<Integer> cellSet = new HashSet<>(cells); Set<Integer> cellSet = new HashSet<>(cells);
if (cells.size() != cellSet.size()) { if (cells.size() != cellSet.size()) {
LOGGER.info("cells has repeated"); LOGGER.info("cells has repeated");
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
int uid = session.getUid(); int uid = session.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager(); 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(xy); Cell cell = mapManager.getMapInfo().get(xy);
if (cell == null) { if (cell == null) {
LOGGER.info("xy is wrong =>{}", xy); LOGGER.info("xy is wrong =>{}", xy);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
mapManager.setCurXY(xy); mapManager.setCurXY(xy);
@ -171,28 +178,33 @@ public class MapLogic {
int schedule = cell.getState(); int schedule = cell.getState();
if (schedule == -1) { if (schedule == -1) {
LOGGER.info("event is finished,bigEventId=>{} smallEventId=>{}", bigEventId, -1); LOGGER.info("event is finished,bigEventId=>{} smallEventId=>{}", bigEventId, -1);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
Map<Integer, SCMapEventsItemConfig> integerSCMapEventsItemConfigMap = SCMapEventsItemConfig.scMapEventsItemConfigs.get(bigEventId); Map<Integer, SCMapEventsItemConfig> integerSCMapEventsItemConfigMap = SCMapEventsItemConfig.scMapEventsItemConfigs.get(bigEventId);
if (integerSCMapEventsItemConfigMap == null) { if (integerSCMapEventsItemConfigMap == null) {
LOGGER.info("no this event=>{}", bigEventId); LOGGER.info("no this event=>{}", bigEventId);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
SCMapEventsItemConfig scMapEventsItemConfig = integerSCMapEventsItemConfigMap.get(schedule); SCMapEventsItemConfig scMapEventsItemConfig = integerSCMapEventsItemConfigMap.get(schedule);
if (scMapEventsItemConfig == null) { if (scMapEventsItemConfig == null) {
LOGGER.info("no scMapEventsItemConfig bigEventId=>{} smallEventId=>{}", bigEventId, schedule); LOGGER.info("no scMapEventsItemConfig bigEventId=>{} smallEventId=>{}", bigEventId, schedule);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
int[][] contents = scMapEventsItemConfig.getContents(); int[][] contents = scMapEventsItemConfig.getContents();
if (choice < contents.length - 1 || contents.length - 1 < choice) { if (choice < 0 || contents.length < choice) {
LOGGER.info("no this choice =>{} scMapEventsItemConfig.getContents()=>{}", choice, scMapEventsItemConfig.getContents()); LOGGER.info("no this choice =>{} scMapEventsItemConfig.getContents()=>{}", choice, scMapEventsItemConfig.getContents());
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
int[] eventArr = contents[choice]; int[] eventArr = contents[choice - 1];
boolean isSuccess = false; boolean isSuccess = false;
switch (eventArr[0]) { switch (eventArr[0]) {
case EventType.fight: { case EventType.fight: {
fightStart(uid, bigEventId); fightStart(uid, bigEventId);
isSuccess = true;
break; break;
} }
case EventType.attribute: { case EventType.attribute: {
@ -237,21 +249,22 @@ public class MapLogic {
} }
MapInfoProto.MapUpdateEventResponse.Builder mapUpdateEventResponse = MapInfoProto.MapUpdateEventResponse.newBuilder(); MapInfoProto.MapUpdateEventResponse.Builder mapUpdateEventResponse = MapInfoProto.MapUpdateEventResponse.newBuilder();
if (!isSuccess) { if (!isSuccess) {
MessageUtil.sendMessage(session, 0, messageType.getNumber(), mapUpdateEventResponse.build(), true); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
if (scMapEventsItemConfig.getJump() == null || scMapEventsItemConfig.getJump().length == 0) { if (scMapEventsItemConfig.getJump() == null || scMapEventsItemConfig.getJump().length == 0) {
cell.setState(schedule + 1); cell.setState(-1);
} else { } else {
int[][] jumps = scMapEventsItemConfig.getJump(); int[][] jumps = scMapEventsItemConfig.getJump();
for (int i = 0; i < jumps.length; i++) { for (int i = 0; i < jumps.length; i++) {
int[] jump = jumps[i]; int[] jump = jumps[i];
if (jump[0] == choice - 1) { if (jump[0] == choice) {
cell.setState(jump[1]); cell.setState(jump[1]);
break; break;
} }
} }
} }
mapManager.addOrUpdateCell(xy, cell);
int[][] reward = scMapEventsItemConfig.getReward(); int[][] reward = scMapEventsItemConfig.getReward();
List<CommonProto.Item> rewards = new ArrayList<>(); List<CommonProto.Item> rewards = new ArrayList<>();
if (reward != null && reward.length > 0) { if (reward != null && reward.length > 0) {
@ -273,6 +286,7 @@ public class MapLogic {
mapUpdateEventResponse.setCurXY(xy); mapUpdateEventResponse.setCurXY(xy);
mapUpdateEventResponse.setEventSchedule(cell.getState()); mapUpdateEventResponse.setEventSchedule(cell.getState());
mapUpdateEventResponse.addAllItems(rewards); mapUpdateEventResponse.addAllItems(rewards);
LOGGER.info("updateEvent success xy=>{}, state=>{}", xy, cell.getState());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateEventResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateEventResponse.build(), true);
} }