back_recharge
parent
ab03ce293e
commit
18431a9ccd
|
@ -1,63 +1,63 @@
|
||||||
Id EventsId Order Contents Reward Jump OpenRules
|
Id EventsId Order Contents Reward Jump OpenRules UnfinishInfo
|
||||||
int int int mut,int#int,2 mut,int#int,2 mut,int#int,2 mut,int#int,2
|
int int int mut,int#int,2 mut,int#int,2 mut,int#int,2 mut,int#int,2 string
|
||||||
1 101001 1 1#10101 1 null null
|
1 101001 0 1#10101 1 null null
|
||||||
2 101002 1 1#10102 1 null null
|
2 101002 0 1#10102 1 null null
|
||||||
3 101003 1 1#10103 1 null null
|
3 101003 0 1#10103 1 null null
|
||||||
4 101004 1 3#1200#1|6#100 2#0 null null
|
4 101004 0 3#1200#1|6#100 2#0 null null
|
||||||
5 101005 1 11#0|6#1 null null null
|
5 101005 0 11#0|6#1 null null
|
||||||
6 101006 1 11#102|6#1 null null null
|
6 101006 0 11#102|6#1 null null
|
||||||
7 101007 0 3#2#0|6#100 null 1#1 null
|
7 101007 0 3#2#0|6#100 10100700 1#1 null
|
||||||
8 101007 1 3#2#0|6#100 null 1#2 null
|
8 101007 1 3#2#0|6#100 10100701 1#2 null
|
||||||
9 101007 2 3#2#0|6#100 null 1#3 null
|
9 101007 2 3#2#0|6#100 10100702 1#3 null
|
||||||
10 101007 3 null null 1#4 null
|
10 101007 3 3#2#0 10100703 1#4 null
|
||||||
11 101007 4 null null 1#5 null
|
11 101007 4 3#2#0 10100704 1#5 null
|
||||||
12 101007 5 3#2#0|6#100 null 1#6 null
|
12 101007 5 3#2#0|6#100 10100705 1#6 null
|
||||||
13 101007 6 null null 1#7 null
|
13 101007 6 3#2#0 10100706 1#7 null
|
||||||
14 101007 7 null null 1#8 null
|
14 101007 7 3#2#0|6#100 10100707 1#8 null
|
||||||
15 101007 8 null null 1#9 null
|
15 101007 9 3#2#0 10100708 1#9 1#101008 一片茂密的草丛,草丛中可能潜藏着未知的危险,还是先去确认声音来源吧。
|
||||||
16 101007 9 null null 1#10 null
|
16 101007 10 3#2#0 10100709 1#10 null
|
||||||
17 101007 10 null null 1#11 null
|
17 101007 11 3#2#0 10100710 1#11 null
|
||||||
18 101007 11 null null 1#12 null
|
18 101007 12 3#2#0 10100711 1#12 null
|
||||||
19 101007 12 null null 1#13 null
|
19 101007 13 3#2#0 10100712 1#13 null
|
||||||
20 101007 13 null null 1#14 null
|
20 101007 14 3#2#0 10100713 1#14 null
|
||||||
21 101007 14 null null 1#15 null
|
21 101007 15 3#2#0 10100714 1#15 null
|
||||||
22 101007 15 null null 1#16 null
|
22 101007 16 1#10101 10100715 1#16 null
|
||||||
23 101007 16 null null 1#17 null
|
23 101007 17 3#2#0 10100716 1#17 null
|
||||||
24 101007 17 null null 1#18 null
|
24 101007 18 3#2#0 10100717 1#18 null
|
||||||
25 101007 18 null null 1#19 null
|
25 101007 19 3#2#0 10100718 1#19 null
|
||||||
26 101007 19 null null null null
|
26 101007 20 3#2#0 10100719 null null
|
||||||
27 101008 0 null null 1#1 null
|
27 101008 0 null 1#1 null
|
||||||
28 101008 1 null null 1#2 null
|
28 101008 1 null 1#2 null
|
||||||
29 101008 2 null null 1#3 null
|
29 101008 2 null 1#3 null
|
||||||
30 101008 3 null null 1#4 null
|
30 101008 3 null 1#4 null
|
||||||
31 101008 4 null null 1#5 null
|
31 101008 4 null 1#5 null
|
||||||
32 101008 5 null null 1#6 null
|
32 101008 5 null 1#6 null
|
||||||
33 101008 6 null null 1#7 null
|
33 101008 6 null 1#7 null
|
||||||
34 101008 7 null null 1#8 null
|
34 101008 7 null 1#8 null
|
||||||
35 101008 8 null null 1#9 null
|
35 101008 8 null 1#9 null
|
||||||
36 101008 9 null null 1#10 null
|
36 101008 9 null 1#10 null
|
||||||
37 101008 10 null null 1#11 null
|
37 101008 10 null 1#11 null
|
||||||
38 101008 11 null null 1#12 null
|
38 101008 11 null 1#12 null
|
||||||
39 101008 12 null null 1#13 null
|
39 101008 12 null 1#13 null
|
||||||
40 101008 13 null null 1#14 null
|
40 101008 13 null 1#14 null
|
||||||
41 101008 14 null null 1#15 null
|
41 101008 14 null 1#15 null
|
||||||
42 101008 15 null null 1#16 null
|
42 101008 15 null 1#16 null
|
||||||
43 101008 16 null null 1#17 null
|
43 101008 16 null 1#17 null
|
||||||
44 101008 17 null null 1#18 null
|
44 101008 17 null 1#18 null
|
||||||
45 101008 18 null null 1#19 null
|
45 101008 18 null 1#19 null
|
||||||
46 101008 19 null null 1#20 null
|
46 101008 19 null 1#20 null
|
||||||
47 101008 20 null null 1#21 null
|
47 101008 20 null 1#21 null
|
||||||
48 101008 21 null null 1#22 null
|
48 101008 21 null 1#22 null
|
||||||
49 101008 22 null null 1#23 null
|
49 101008 22 null 1#23 null
|
||||||
50 101008 23 null null 1#24 null
|
50 101008 23 null 1#24 null
|
||||||
51 101008 24 null null 1#25 null
|
51 101008 24 null 1#25 null
|
||||||
52 101008 25 null null 1#26 null
|
52 101008 25 null 1#26 null
|
||||||
53 101008 26 null null 1#27 null
|
53 101008 26 null 1#27 null
|
||||||
54 101008 27 null null 1#28 null
|
54 101008 27 null 1#28 null
|
||||||
55 101008 28 null null 1#29 null
|
55 101008 28 null 1#29 null
|
||||||
56 101008 29 null null 1#30 null
|
56 101008 29 null 1#30 null
|
||||||
57 101008 30 null null 1#31 null
|
57 101008 30 null 1#31 null
|
||||||
58 101008 31 null null 1#32 null
|
58 101008 31 null 1#32 null
|
||||||
59 101008 32 null null null null
|
59 101008 32 null null null
|
||||||
60 101009 1 null null null null
|
60 101009 0 null null null
|
||||||
61 101010 1 null null null null
|
61 101010 0 null null null
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ljsd.jieling.handler.map;
|
package com.ljsd.jieling.handler.map;
|
||||||
|
|
||||||
public class Cell {
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
|
||||||
|
public class Cell extends MongoBase {
|
||||||
|
|
||||||
private int cellId;
|
private int cellId;
|
||||||
|
|
||||||
|
@ -8,6 +10,9 @@ public class Cell {
|
||||||
|
|
||||||
private int state;
|
private int state;
|
||||||
|
|
||||||
|
public Cell() {
|
||||||
|
}
|
||||||
|
|
||||||
public Cell(int cellId, int eventId, int state) {
|
public Cell(int cellId, int eventId, int state) {
|
||||||
this.cellId = cellId;
|
this.cellId = cellId;
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
|
@ -18,23 +23,16 @@ public class Cell {
|
||||||
return cellId;
|
return cellId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCellId(int cellId) {
|
|
||||||
this.cellId = cellId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEventId() {
|
public int getEventId() {
|
||||||
return eventId;
|
return eventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventId(int eventId) {
|
|
||||||
this.eventId = eventId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getState() {
|
public int getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setState(int state) {
|
public void setState(int state) throws Exception {
|
||||||
|
updateString("state", state);
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.config.SCMapEventsConfig;
|
||||||
import com.ljsd.jieling.config.SCMapEventsItemConfig;
|
import com.ljsd.jieling.config.SCMapEventsItemConfig;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
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.MapManager;
|
||||||
import com.ljsd.jieling.logic.dao.User;
|
import com.ljsd.jieling.logic.dao.User;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
@ -14,6 +15,7 @@ import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.util.CellUtil;
|
import com.ljsd.jieling.util.CellUtil;
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -50,6 +52,17 @@ 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()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, Integer> heroes = new HashMap<>(heroInfosList.size());
|
||||||
|
for (MapInfoProto.HeroInfo heroInfo : heroInfosList) {
|
||||||
|
heroes.put(heroInfo.getHeroId(), heroInfo.getHeroHp());
|
||||||
|
}
|
||||||
|
if (heroes.size() != heroInfosList.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mapManager.setHeroHps(heroes);
|
||||||
user.getPlayerInfoManager().setMapId(101);
|
user.getPlayerInfoManager().setMapId(101);
|
||||||
mapManager.setCurMapId(101);
|
mapManager.setCurMapId(101);
|
||||||
initMap(mapManager);
|
initMap(mapManager);
|
||||||
|
@ -132,22 +145,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用物品(包括侦察和吃buff)
|
|
||||||
*/
|
|
||||||
public void useItem(int uid){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 离开
|
|
||||||
*/
|
|
||||||
public void leave(int uid){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新事件点
|
* 更新事件点
|
||||||
|
@ -155,7 +152,7 @@ public class MapLogic {
|
||||||
* @param session
|
* @param session
|
||||||
* @param xy
|
* @param xy
|
||||||
*/
|
*/
|
||||||
public void updateEvent(ISession session, int xy, int bigEventId, int choice, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
|
public void updateEvent(ISession session, int xy, int choice, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
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");
|
||||||
|
@ -170,17 +167,18 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mapManager.setCurXY(xy);
|
mapManager.setCurXY(xy);
|
||||||
if (cell.getEventId() != bigEventId) {
|
int bigEventId = cell.getEventId();
|
||||||
LOGGER.info("no this event eventId=>{}", bigEventId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCMapEventsConfig scMapEvent = SCMapEventsConfig.scMapEventMap.get(bigEventId);
|
Map<Integer, SCMapEventsItemConfig> integerSCMapEventsItemConfigMap = SCMapEventsItemConfig.scMapEventsItemConfigs.get(bigEventId);
|
||||||
SCMapEventsItemConfig scMapEventsItemConfig = SCMapEventsItemConfig.scMapEventsItemConfigs.get(bigEventId).get(schedule);
|
if (integerSCMapEventsItemConfigMap == null) {
|
||||||
|
LOGGER.info("no this event=>{}", bigEventId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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);
|
||||||
return;
|
return;
|
||||||
|
@ -191,13 +189,22 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int[] eventArr = contents[choice];
|
int[] eventArr = contents[choice];
|
||||||
|
boolean isSuccess = false;
|
||||||
switch (eventArr[0]) {
|
switch (eventArr[0]) {
|
||||||
case EventType.fight: {
|
case EventType.fight: {
|
||||||
fightStart(uid, bigEventId);
|
fightStart(uid, bigEventId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EventType.attribute: {
|
case EventType.attribute: {
|
||||||
|
Map<String, Integer> heroHps = mapManager.getHeroHps();
|
||||||
|
for (Map.Entry<String, Integer> entry : heroHps.entrySet()) {
|
||||||
|
if (entry.getValue() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Hero hero = user.getHeroManager().getHero(entry.getKey());
|
||||||
|
// eventArr[1]
|
||||||
|
}
|
||||||
|
isSuccess = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EventType.eatBuff:
|
case EventType.eatBuff:
|
||||||
|
@ -206,10 +213,14 @@ public class MapLogic {
|
||||||
Map<Integer, Integer> useItems = new HashMap<>();
|
Map<Integer, Integer> useItems = new HashMap<>();
|
||||||
useItems.put(eventArr[1], eventArr[2]);
|
useItems.put(eventArr[1], eventArr[2]);
|
||||||
ItemUtil.useItem(user, useItems);
|
ItemUtil.useItem(user, useItems);
|
||||||
|
isSuccess = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EventType.leave: {
|
case EventType.leave: {
|
||||||
|
int randomInt = MathUtils.randomInt(100) + 1;
|
||||||
|
if (randomInt <= eventArr[1]) {
|
||||||
|
isSuccess = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EventType.dialogue: {
|
case EventType.dialogue: {
|
||||||
|
@ -224,6 +235,11 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MapInfoProto.MapUpdateEventResponse.Builder mapUpdateEventResponse = MapInfoProto.MapUpdateEventResponse.newBuilder();
|
||||||
|
if (!isSuccess) {
|
||||||
|
MessageUtil.sendMessage(session, 0, messageType.getNumber(), mapUpdateEventResponse.build(), true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (scMapEventsItemConfig.getJump() == null || scMapEventsItemConfig.getJump().length == 0) {
|
if (scMapEventsItemConfig.getJump() == null || scMapEventsItemConfig.getJump().length == 0) {
|
||||||
cell.setState(schedule + 1);
|
cell.setState(schedule + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -237,6 +253,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int[][] reward = scMapEventsItemConfig.getReward();
|
int[][] reward = scMapEventsItemConfig.getReward();
|
||||||
|
List<CommonProto.Item> rewards = new ArrayList<>();
|
||||||
if (reward != null && reward.length > 0) {
|
if (reward != null && reward.length > 0) {
|
||||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
// ItemUtil.addItem(user, itemMap);
|
// ItemUtil.addItem(user, itemMap);
|
||||||
|
@ -249,10 +266,14 @@ public class MapLogic {
|
||||||
// }
|
// }
|
||||||
// crossMapInfos.get(cMap.getCurMapId()).addAll(cell.getEventIds());
|
// crossMapInfos.get(cMap.getCurMapId()).addAll(cell.getEventIds());
|
||||||
// }
|
// }
|
||||||
if (scMapEvent.getStyle() == EventType.portal) {
|
// if (scMapEvent.getStyle() == EventType.portal) {
|
||||||
user.getPlayerInfoManager().setMapId(user.getPlayerInfoManager().getMapId() + 1);
|
// user.getPlayerInfoManager().setMapId(user.getPlayerInfoManager().getMapId() + 1);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
mapUpdateEventResponse.setCurXY(xy);
|
||||||
|
mapUpdateEventResponse.setEventSchedule(cell.getState());
|
||||||
|
mapUpdateEventResponse.addAllItems(rewards);
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateEventResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ public class MapUpdateEventRequestHandler 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();
|
||||||
MapInfoProto.MapUpdateEventRequest mapEnterRequest = MapInfoProto.MapUpdateEventRequest.parseFrom(message);
|
MapInfoProto.MapUpdateEventRequest mapEnterRequest = MapInfoProto.MapUpdateEventRequest.parseFrom(message);
|
||||||
MapLogic.getInstance().updateEvent(iSession, mapEnterRequest.getCurXY(), mapEnterRequest.getBigEventId(), mapEnterRequest.getChoice(), mapEnterRequest.getCellsList(), MessageTypeProto.MessageType.MAP_UDPATE_EVENT_RESPONSE);
|
MapLogic.getInstance().updateEvent(iSession, mapEnterRequest.getCurXY(), mapEnterRequest.getChoice(), mapEnterRequest.getCellsList(), MessageTypeProto.MessageType.MAP_UDPATE_EVENT_RESPONSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,4 +73,13 @@ public class MapManager extends MongoBase {
|
||||||
updateString( "typeEight", typeEight);
|
updateString( "typeEight", typeEight);
|
||||||
this.typeEight = typeEight;
|
this.typeEight = typeEight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> getHeroHps() {
|
||||||
|
return heroHps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeroHps(Map<String, Integer> heroHps) throws Exception {
|
||||||
|
updateString( "heroHps", heroHps);
|
||||||
|
this.heroHps = heroHps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue