地图提交
parent
c062ebb996
commit
f6d8b7322c
|
|
@ -1,18 +0,0 @@
|
|||
id event groups
|
||||
int int mut,int#int,2
|
||||
1 102011 13#8|13#9|14#8|14#9
|
||||
2 101010 10#5
|
||||
3 102010 18#5|18#6|19#5|19#6
|
||||
4 102013 9#1|9#2|10#1|10#2
|
||||
5 102001 2#3|3#1|3#4
|
||||
6 101001 4#4|4#5|5#4|5#5|5#7|5#8|6#1|6#2|6#7|6#8|7#1|7#2|18#9|18#10|19#9|19#10|20#6|20#7
|
||||
7 102012 13#1|13#2|14#1|14#2
|
||||
8 102004 7#9|7#10|8#3|8#4|8#9|8#10|9#3|9#4|11#2|11#3|12#2|12#3|13#5|13#6|14#5|14#6|15#9|15#10|16#9|16#10
|
||||
9 102015 9#8|10#8
|
||||
10 102014 6#4|6#5|7#4|7#5
|
||||
11 101005 8#6|8#7|9#6|9#7|18#2|18#3|19#2|19#3
|
||||
12 102016 15#3|16#3
|
||||
13 101006 3#2
|
||||
14 101007 2#10
|
||||
15 101008 17#7
|
||||
16 101009 12#9
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
id event groups
|
||||
int int mut,int#int,2
|
||||
1 201012 5#3|5#4|6#3|6#4
|
||||
2 101010 9#8
|
||||
3 101011 16#7
|
||||
4 101001 2#6|3#5|3#6|4#8|4#9|5#8|6#7|7#7|8#5|8#6|9#5|9#6|11#4|12#4|14#6|15#6|16#3|16#4|17#3|17#4
|
||||
5 101002 12#1|12#2|13#1|13#2|18#5|18#6|19#6
|
||||
6 101003 4#4
|
||||
7 101004 5#10|6#10
|
||||
8 101005 7#1|7#2|8#1|8#2|11#8|11#9|12#8|12#9|14#2|14#3|14#9|14#10|15#2|15#3|15#9|15#10|19#4|19#7|19#8|20#3|20#8
|
||||
9 101006 3#8
|
||||
10 101007 5#5
|
||||
11 101008 11#10
|
||||
12 101009 18#2
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
Id Style Refresh
|
||||
int int int
|
||||
101001 1 2
|
||||
101002 3 2
|
||||
101003 5 2
|
||||
101004 9 2
|
||||
101005 1 2
|
||||
101006 6 3
|
||||
101007 7 3
|
||||
101008 6 2
|
||||
101009 6 3
|
||||
101010 8 2
|
||||
101011 8 2
|
||||
101012 4 2
|
||||
102001 9 2
|
||||
102002 1 2
|
||||
102003 1 2
|
||||
102004 1 2
|
||||
102005 6 3
|
||||
102006 6 3
|
||||
102007 6 3
|
||||
102008 6 3
|
||||
102009 6 3
|
||||
102010 3 1
|
||||
102011 3 2
|
||||
102012 3 2
|
||||
102013 3 1
|
||||
102014 3 2
|
||||
102015 2 2
|
||||
102016 2 2
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
id length width
|
||||
int int int
|
||||
1 10 20
|
||||
|
|
@ -6,14 +6,15 @@ import com.ljsd.jieling.logic.Table;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "1.MapConfig")
|
||||
@Table(name = "MapConfig")
|
||||
public class SCMapConfig implements BaseConfig {
|
||||
public static Map<Integer, SCMapConfig> sCMapSize;
|
||||
private int id;
|
||||
private String info;
|
||||
private int[] size; // 0:行 1列
|
||||
private int confused; //地图消耗
|
||||
private int moveConfused; //地图消耗
|
||||
private String openRule; // 开启条件
|
||||
private int energyConfused;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sCMapSize = STableManager.getConfig(SCMapConfig.class);
|
||||
|
|
@ -31,8 +32,12 @@ public class SCMapConfig implements BaseConfig {
|
|||
return size;
|
||||
}
|
||||
|
||||
public int getConfused() {
|
||||
return confused;
|
||||
public int getMoveConfused() {
|
||||
return moveConfused;
|
||||
}
|
||||
|
||||
public int getEnergyConfused() {
|
||||
return energyConfused;
|
||||
}
|
||||
|
||||
public String getOpenRule() {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ import com.ljsd.jieling.logic.Table;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "2.MapEventsConfig")
|
||||
public class SCMapEvent implements BaseConfig{
|
||||
@Table(name = "MapEventsConfig")
|
||||
public class SCMapEventsConfig implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SCMapEvent> scMapEventMap;
|
||||
public static Map<Integer, SCMapEventsConfig> scMapEventMap;
|
||||
|
||||
/**
|
||||
* 大事件id
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* "事件点类型
|
||||
|
|
@ -23,10 +26,14 @@ public class SCMapEvent implements BaseConfig{
|
|||
* 3一次性
|
||||
*/
|
||||
private int refresh;
|
||||
private int triggerRules;
|
||||
private boolean isSchedule;
|
||||
|
||||
private int exploreValues;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
scMapEventMap = STableManager.getConfig(SCMapEvent.class);
|
||||
scMapEventMap = STableManager.getConfig(SCMapEventsConfig.class);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
|
@ -40,4 +47,16 @@ public class SCMapEvent implements BaseConfig{
|
|||
public int getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public int getTriggerRules() {
|
||||
return triggerRules;
|
||||
}
|
||||
|
||||
public boolean isSchedule() {
|
||||
return isSchedule;
|
||||
}
|
||||
|
||||
public int getExploreValues() {
|
||||
return exploreValues;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "MapEventsItemConfig")
|
||||
public class SCMapEventsItemConfig implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SCMapEventsItemConfig> scMapEventsItemConfigMap;
|
||||
|
||||
public static Map<Integer, Map<Integer, SCMapEventsItemConfig>> scMapEventsItemConfigs;
|
||||
|
||||
private int id;
|
||||
/**
|
||||
*"小事件id
|
||||
*/
|
||||
private int eventsId;
|
||||
/**
|
||||
* 排序
|
||||
* */
|
||||
private int sort;
|
||||
/**
|
||||
* 事件内容
|
||||
*/
|
||||
private String contents;
|
||||
/**
|
||||
* 奖励
|
||||
*/
|
||||
private String reward;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
scMapEventsItemConfigMap = STableManager.getConfig(SCMapEventsItemConfig.class);
|
||||
scMapEventsItemConfigs = new HashMap<>(scMapEventsItemConfigMap.size());
|
||||
for (SCMapEventsItemConfig eventsItemConfigEntry : scMapEventsItemConfigMap.values()){
|
||||
if (!scMapEventsItemConfigs.containsKey(eventsItemConfigEntry.getEventId())) {
|
||||
scMapEventsItemConfigs.put(eventsItemConfigEntry.getEventId(), new HashMap<>());
|
||||
}
|
||||
scMapEventsItemConfigs.get(eventsItemConfigEntry.getEventId()).put(eventsItemConfigEntry.getSort(), eventsItemConfigEntry);
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getEventId() {
|
||||
return eventsId;
|
||||
}
|
||||
|
||||
public int getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public String getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
@Table(name = "MissionEventsItemConfig")
|
||||
public class SCMissionEventsItemConfig implements BaseConfig {
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,13 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Cell {
|
||||
|
||||
private Set<Integer> eventIds = Sets.newConcurrentHashSet();;
|
||||
private Map<Integer, Integer> eventIds = new ConcurrentHashMap();
|
||||
|
||||
private boolean isFinish;
|
||||
|
||||
public Set<Integer> getEventIds() {
|
||||
public Map<Integer, Integer> getEventIds() {
|
||||
return eventIds;
|
||||
}
|
||||
|
||||
public boolean isFinish() {
|
||||
return isFinish;
|
||||
}
|
||||
|
||||
public void setFinish(boolean finish) {
|
||||
isFinish = finish;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,39 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
public class EventType {
|
||||
// 事件点类型 1怪物 2怪物群 3矿 4入口 5出口 6一次性事件 7重复事件 8npc 9地图boss
|
||||
/**
|
||||
* 大事件点类型
|
||||
* 1怪物 2矿 3出生点 4出口 5连续事件 6行脚商人 7宝箱 8阻挡点
|
||||
*/
|
||||
public static final int monster = 1;
|
||||
public static final int monsters = 2;
|
||||
public static final int mine = 3;
|
||||
public static final int enter = 4;
|
||||
public static final int exit = 5;
|
||||
public static final int disposable = 6;
|
||||
public static final int repeated = 7;
|
||||
public static final int npc = 8;
|
||||
public static final int boss = 8;
|
||||
public static final int mine = 2;
|
||||
public static final int enter = 3;
|
||||
public static final int exit = 4;
|
||||
public static final int continuity = 5;
|
||||
public static final int businessman = 6;
|
||||
public static final int box = 7;
|
||||
public static final int obstacle = 8;
|
||||
|
||||
/**
|
||||
* 小事件类型
|
||||
* 1战斗
|
||||
* 2判断属性(属性id#(0,-1,1)#num
|
||||
* 3消耗物品
|
||||
* 5侦察
|
||||
* 6离开
|
||||
* 7做选择不同跳转文本
|
||||
* 8行动到某张地图某坐标点
|
||||
* 9吃buff
|
||||
* 10走进度条
|
||||
*/
|
||||
public static final int fight = 1;
|
||||
public static final int attribute = 2;
|
||||
public static final int useItem = 3;
|
||||
// public static final int scout = 4;
|
||||
public static final int scout = 5;
|
||||
public static final int leave = 6;
|
||||
public static final int dialogue = 7;
|
||||
public static final int jump = 8;
|
||||
public static final int eatBuff = 9;
|
||||
// public static final int obstacle = 10;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
public class LittleEventType {
|
||||
|
||||
/**
|
||||
* 1 战斗
|
||||
* 2 判断属性(属性id#(0,-1,1)#num
|
||||
* 3 消耗物品
|
||||
* 4 做选择给奖励
|
||||
* 5 侦察
|
||||
* 6 离开
|
||||
* 7 做选择不同跳转文本
|
||||
*/
|
||||
public static final int fight = 1;
|
||||
public static final int attribute = 2;
|
||||
public static final int item = 3;
|
||||
public static final int reward = 4;
|
||||
public static final int scout = 5;
|
||||
public static final int leave = 6;
|
||||
public static final int choice = 7;
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.ljsd.jieling.config.SCMap;
|
||||
import com.ljsd.jieling.config.SCMapEventsItemConfig;
|
||||
import com.ljsd.jieling.logic.dao.MapManager;
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
|
@ -7,16 +9,12 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.config.SCMap;
|
||||
import com.ljsd.jieling.config.SCMapEvent;
|
||||
import com.ljsd.jieling.config.SCMapEventsConfig;
|
||||
import com.ljsd.jieling.util.ToolsUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
public class MapLogic {
|
||||
|
||||
|
|
@ -47,6 +45,16 @@ public class MapLogic {
|
|||
if (mapManager.getCurMapId() == 0) {
|
||||
mapManager = initMap( 1);
|
||||
user.setMapManager(mapManager);
|
||||
} else {
|
||||
if (mapId > mapManager.getCurMapId()) {
|
||||
mapManager = initMap(mapManager.getCurMapId());
|
||||
} else {
|
||||
mapManager = initMap(mapId);
|
||||
if (mapManager == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
user.setMapManager(mapManager);
|
||||
}
|
||||
MapInfoProto.MapInfo.MapEnterResponse mapEnterResponse = MapInfoProto.MapInfo.MapEnterResponse
|
||||
.newBuilder()
|
||||
|
|
@ -56,9 +64,6 @@ public class MapLogic {
|
|||
|
||||
|
||||
private MapManager initMap(int mapId) throws Exception {
|
||||
if (mapId == 0) {
|
||||
mapId = 1;
|
||||
}
|
||||
Map<Integer, SCMap> scMap = SCMap.sCMap.get(mapId);
|
||||
if (scMap == null) {
|
||||
return null;
|
||||
|
|
@ -71,12 +76,12 @@ public class MapLogic {
|
|||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
Cell cellValue = new Cell();
|
||||
cellValue.getEventIds().add(scMap1.getEvent());
|
||||
cellValue.getEventIds().put(scMap1.getEvent(), 0);
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = ToolsUtil.xy2Pos(x, y);
|
||||
SCMapEvent scMapEvent = SCMapEvent.scMapEventMap.get(scMap1.getEvent());
|
||||
SCMapEventsConfig scMapEvent = SCMapEventsConfig.scMapEventMap.get(scMap1.getEvent());
|
||||
if (scMapEvent.getStyle() == EventType.enter) {
|
||||
mapManager.setCurXY(xy);
|
||||
}
|
||||
|
|
@ -87,37 +92,104 @@ public class MapLogic {
|
|||
|
||||
|
||||
/**
|
||||
* 完成事件,保存事件点
|
||||
* 更新事件点
|
||||
* @param uid
|
||||
* @param xy
|
||||
*/
|
||||
public void finishEvent(int uid, int xy) throws Exception {
|
||||
// get db
|
||||
MapManager cMap = null;
|
||||
Cell cell = cMap.getMapInfo().get(xy);
|
||||
public void updateEvent(int uid, int xy, int bigEventId, int smallEventId, int choice) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Cell cell = mapManager.getMapInfo().get(xy);
|
||||
if (cell == null) {
|
||||
LOGGER.info("xy is wrong =>{}", xy);
|
||||
return;
|
||||
}
|
||||
if (cell.getEventIds().isEmpty()) {
|
||||
LOGGER.info("no event eventId");
|
||||
return;
|
||||
}
|
||||
cMap.setCurXY(xy);
|
||||
cell.setFinish(true);
|
||||
SCMapEvent scMapEvent = SCMapEvent.scMapEventMap.get(cell.getEventIds());
|
||||
// 如果是出口开启跳转到下个关卡
|
||||
if (scMapEvent.getStyle() == EventType.disposable) {
|
||||
Map<Integer, List<Integer>> crossMapInfos = cMap.getCrossMapInfos();
|
||||
if (!crossMapInfos.containsKey(cMap.getCurMapId())) {
|
||||
crossMapInfos.put(cMap.getCurMapId(), new ArrayList<>());
|
||||
mapManager.setCurXY(xy);
|
||||
Map<Integer, Integer> eventIds = cell.getEventIds();
|
||||
if (!eventIds.containsKey(bigEventId)) {
|
||||
LOGGER.info("no this event eventId=>{}", bigEventId);
|
||||
return;
|
||||
}
|
||||
int schedule = eventIds.get(bigEventId);
|
||||
if (schedule == -1 || schedule >= smallEventId) {
|
||||
LOGGER.info("event is finished,bigEventId=>{} smallEventId=>{}", bigEventId, smallEventId);
|
||||
return;
|
||||
}
|
||||
SCMapEventsConfig scMapEvent = SCMapEventsConfig.scMapEventMap.get(bigEventId);
|
||||
SCMapEventsItemConfig scMapEventsItemConfig = SCMapEventsItemConfig.scMapEventsItemConfigs.get(bigEventId).get(smallEventId);
|
||||
if (scMapEventsItemConfig == null) {
|
||||
LOGGER.info("no scMapEventsItemConfig bigEventId=>{} smallEventId=>{}",bigEventId, smallEventId);
|
||||
return;
|
||||
}
|
||||
String[] contents = scMapEventsItemConfig.getContents().split("\\|");
|
||||
if (choice < contents.length - 1 || contents.length - 1 < choice) {
|
||||
LOGGER.info("no this choice =>{} scMapEventsItemConfig.getContents()=>{}",choice, scMapEventsItemConfig.getContents());
|
||||
return;
|
||||
}
|
||||
String[] eventArr = contents[choice].split("#");
|
||||
switch (scMapEvent.getStyle()) {
|
||||
case EventType.monster:{
|
||||
break;
|
||||
}
|
||||
case EventType.continuity:{
|
||||
switch (Integer.parseInt(eventArr[0])) {
|
||||
case EventType.fight:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.attribute:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.useItem:
|
||||
case EventType.scout:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.leave:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.dialogue:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.jump:{
|
||||
|
||||
break;
|
||||
}
|
||||
case EventType.eatBuff:{
|
||||
|
||||
break;
|
||||
} default:{
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
crossMapInfos.get(cMap.getCurMapId()).addAll(cell.getEventIds());
|
||||
}
|
||||
if (smallEventId + 1 >= contents.length - 1){
|
||||
cell.getEventIds().put(bigEventId, -1);
|
||||
} else {
|
||||
cell.getEventIds().put(bigEventId, schedule + 1);
|
||||
}
|
||||
|
||||
// 如果是传送门开启跳转到下个关卡
|
||||
// if (scMapEvent.getStyle() == EventType.exit) {
|
||||
// Map<Integer, List<Integer>> crossMapInfos = cMap.getCrossMapInfos();
|
||||
// if (!crossMapInfos.containsKey(cMap.getCurMapId())) {
|
||||
// crossMapInfos.put(cMap.getCurMapId(), new ArrayList<>());
|
||||
// }
|
||||
// crossMapInfos.get(cMap.getCurMapId()).addAll(cell.getEventIds());
|
||||
// }
|
||||
if (scMapEvent.getStyle() == EventType.exit) {
|
||||
initMap(cMap.getCurMapId() + 1);
|
||||
initMap(mapManager.getCurMapId() + 1);
|
||||
return;
|
||||
}
|
||||
cell.setFinish(true);
|
||||
// save db
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 MapUpdateEventRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_ENTER_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue