地图任务 配置表提交

back_recharge
jiahuiwen 2019-02-22 11:48:16 +08:00
parent 46d7a7c9e6
commit d7cd38d409
10 changed files with 144 additions and 91 deletions

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

@ -19,7 +19,7 @@ int int int int int int
101018 5 3 2 0 101074
101019 5 3 2 0 101076
101020 5 3 2 0 101078
101021 5 3 2 0 10179
101021 5 3 2 0 101079
101022 5 3 2 0 101081
101023 5 3 2 0 101083
0 0 0 0 0 0

View File

@ -1,52 +1,31 @@
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
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 2#14|3#14|2#15|3#15
14 101001 7#18|8#18|8#19
15 101002 4#10|4#11
16 101010 4#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 101013 1#1
24 101013 3#1
25 101013 4#1
26 101013 5#1
27 101013 1#2
28 101013 2#2
29 101013 3#2
30 101013 4#2
31 101014 5#11
32 101001 3#18|3#19
33 101013 2#3|1#4
34 101013 7#17
35 101013 9#7
36 101013 4#20
37 101013 9#16
38 101013 9#17
39 101008 8#2
40 101009 10#10
41 101004 1#11|2#11|1#12|2#12|5#17|6#17|6#18
42 101005 10#20
43 101006 4#3
44 101007 5#4
45 101001 8#11|9#11|8#12|9#12
46 101001 1#6|2#6|1#7|2#7
47 101002 6#1|5#2|6#2
48 101002 5#7|6#7|5#8|6#8
49 101003 3#5|4#6
50 101002 6#13|6#14
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

@ -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

@ -90,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);
@ -116,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);
@ -150,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()
@ -212,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);
}
@ -317,7 +323,8 @@ public class MapLogic {
int i = 0;
Random random = new Random();
while (newDunEventIds.size() < 3) {
int newDunEventId = behaviorTypeValues[0][random.nextInt(behaviorTypeValues[0].length - 1) + 1];
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++;
@ -330,8 +337,8 @@ public class MapLogic {
}
i = 0;
while (newDunEvents.size() < 3) {
int x = random.nextInt(mapSize[0]);
int y = random.nextInt(mapSize[1]);
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;
@ -348,8 +355,8 @@ public class MapLogic {
Mission mission = new Mission();
mission.setMissionId(behaviorTypeValues[0][0]);
mission.setMissionStep(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);
@ -371,9 +378,16 @@ public class MapLogic {
if (mission == null) {
break;
}
MissionLogic.getInstance().checkMission(mission, user);
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
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;
@ -482,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];
@ -501,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
@ -537,26 +557,29 @@ public class MapLogic {
if (openMission != null) {
eventUpdateResponse.setMission(openMission);
}
LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}", mapManager.getCurXY(), cell.getPointId(), cell.getEventId());
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().getEventId());
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(state == null ? "" : state.toString())
.setState(states)
.build();
return openMission;
}

View File

@ -12,6 +12,8 @@ public class Mission extends MongoBase {
private int missionStep;
private String missionInfo;
private Map<Integer, Cell> missionInfos = new ConcurrentHashMap<>();
public int getMissionId() {
@ -33,4 +35,13 @@ public class Mission extends MongoBase {
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

@ -45,19 +45,21 @@ public class MissionLogic {
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().getEventId());
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(state.toString())
.setState(states)
.build();
missionGetAllResponse.addMissions(mission);
}
@ -88,19 +90,25 @@ public class MissionLogic {
return false;
}
public int checkMission(Mission mission, User user) throws Exception {
SMissionEventsConfig sMissionEventsConfig = SMissionEventsConfig.sMissionEventsConfigMap.get(mission.getMissionId());
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);
if (mission.getMissionStep() >= sMissionEventsConfig.getMissionNum()) {
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);
return mission.getMissionId();
} else {
user.getMissionManager().updateOneDoingMissions(mission.getMissionId(), mission);
}
return 0;
return newEventId;
}
@ -114,7 +122,8 @@ public class MissionLogic {
user.getMissionManager().updateFinishMissions(finishMissions);
user.getMissionManager().addTakeRewardMissions(missionId);
SMissionEventsConfig sMissionEventsConfig = SMissionEventsConfig.sMissionEventsConfigMap.get(missionId);
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();//ItemUtil.drop(user, new int[][]);
int[] reward = {sMissionEventsConfig.getReward()};
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, 1);
MissionInfoProto.TakeMissionResponse takeMissionResponse =
MissionInfoProto.TakeMissionResponse
.newBuilder()

View File

@ -32,6 +32,11 @@ public class MissionManager extends MongoBase {
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);

View File

@ -212,7 +212,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{