地图探索修改
parent
b3a7c9838f
commit
6db6e061a5
|
@ -4,7 +4,7 @@ int int mut,int#int,2
|
||||||
2 3 1#5#3
|
2 3 1#5#3
|
||||||
3 3 1#2#3
|
3 3 1#2#3
|
||||||
4 1 1#101016#101112
|
4 1 1#101016#101112
|
||||||
5 1 1#102022#102065
|
5 1 1#102022#102061
|
||||||
6 2 1503#1
|
6 2 1503#1
|
||||||
7 3 1#3#3
|
7 3 1#3#3
|
||||||
8 3 1#4#3
|
8 3 1#4#3
|
||||||
|
|
|
@ -44,8 +44,7 @@ public class MapPointConfig implements BaseConfig{
|
||||||
private int initialEventId;
|
private int initialEventId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消耗行动力
|
* 触发事件消耗行动力
|
||||||
* 1:移动消耗行动力,触发事件不消耗 2:移动不消耗,触发事件消耗
|
|
||||||
*/
|
*/
|
||||||
private int confused;
|
private int confused;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ public class Cell extends MongoBase {
|
||||||
|
|
||||||
private int eventId;
|
private int eventId;
|
||||||
|
|
||||||
|
private boolean isCostStep;
|
||||||
|
|
||||||
public Cell() {
|
public Cell() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,4 +44,12 @@ public class Cell extends MongoBase {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCostStep() {
|
||||||
|
return isCostStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCostStep(boolean costStep) {
|
||||||
|
updateString("isCostStep", isCostStep);
|
||||||
|
isCostStep = costStep;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,16 +242,20 @@ public class MapLogic {
|
||||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int leftStep = mapManager.getTotalStep() - cells.size();
|
SCMapConfig scMapConfig = SCMapConfig.getsCMapSize().get(mapManager.getCurMapId());
|
||||||
if (leftStep <= 0) {
|
int moveConfused = scMapConfig.getMoveConfused();
|
||||||
leftStep = 0;
|
if (moveConfused > 0) {
|
||||||
resetMapInfo(user, false);
|
int leftStep = mapManager.getTotalStep() - cells.size() * moveConfused;
|
||||||
LOGGER.info("updateMap() uid=>{}, leftStep=>{}", uid, leftStep);
|
if (leftStep <= 0) {
|
||||||
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder().build();
|
leftStep = 0;
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true);
|
resetMapInfo(user, false);
|
||||||
return;
|
LOGGER.info("updateMap() uid=>{}, leftStep=>{}", uid, leftStep);
|
||||||
|
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder().build();
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mapManager.setTotalStep(leftStep);
|
||||||
}
|
}
|
||||||
mapManager.setTotalStep(leftStep);
|
|
||||||
Cell cell = mapManager.getMapInfo().get(curXY);
|
Cell cell = mapManager.getMapInfo().get(curXY);
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
cell = mapManager.getMapInfo().get(triggerXY);
|
cell = mapManager.getMapInfo().get(triggerXY);
|
||||||
|
@ -279,6 +283,7 @@ public class MapLogic {
|
||||||
* @param optionId
|
* @param optionId
|
||||||
*/
|
*/
|
||||||
public void updateEvent(ISession session, int eventId, int optionId, MessageTypeProto.MessageType messageType) throws Exception {
|
public void updateEvent(ISession session, int eventId, int optionId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
LOGGER.info("updateEvent() client param eventId=>{} optionId=>{}", eventId, optionId);
|
||||||
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();
|
||||||
|
@ -338,14 +343,15 @@ public class MapLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 2:移动不消耗,触发事件消耗
|
// 触发消耗
|
||||||
// if (mapPointConfig.getConfuced() == 2) {
|
if (mapPointConfig.getConfused() > 0 && !cell.isCostStep()) {
|
||||||
// if (mapManager.getTotalStep() < ) {
|
if (mapManager.getTotalStep() < mapPointConfig.getConfused()) {
|
||||||
// LOGGER.info("sOptionConfig == null=>{}", optionId);
|
LOGGER.info("sOptionConfig step not enough leftStep=>{} needStep=>{}", mapManager.getTotalStep(), mapPointConfig.getConfused());
|
||||||
// MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
mapManager.setTotalStep(mapManager.getTotalStep() - mapPointConfig.getConfused());
|
||||||
|
}
|
||||||
int behaviorType = sOptionConfig.getBehaviorType();
|
int behaviorType = sOptionConfig.getBehaviorType();
|
||||||
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
||||||
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||||
|
@ -359,7 +365,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int jumpType = sOptionConfig.getJumpType();
|
int jumpType = sOptionConfig.getJumpType();
|
||||||
int nextPoint = 0;
|
int nextEventId = 0;
|
||||||
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
||||||
switch (jumpType) {
|
switch (jumpType) {
|
||||||
// 1 无条件跳转,对应事件点
|
// 1 无条件跳转,对应事件点
|
||||||
|
@ -367,7 +373,7 @@ public class MapLogic {
|
||||||
case 1:
|
case 1:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:{
|
case 6:{
|
||||||
nextPoint = jumpTypeValues[0][0];
|
nextEventId = jumpTypeValues[0][0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 2 权重跳转,1001#1002|0.2#0.8
|
// 2 权重跳转,1001#1002|0.2#0.8
|
||||||
|
@ -376,9 +382,9 @@ public class MapLogic {
|
||||||
case 9:{
|
case 9:{
|
||||||
int ranom = MathUtils.randomInt(100) + 1;
|
int ranom = MathUtils.randomInt(100) + 1;
|
||||||
if (ranom >= jumpTypeValues[1][0]) {
|
if (ranom >= jumpTypeValues[1][0]) {
|
||||||
nextPoint = jumpTypeValues[0][0];
|
nextEventId = jumpTypeValues[0][0];
|
||||||
} else {
|
} else {
|
||||||
nextPoint = jumpTypeValues[0][1];
|
nextEventId = jumpTypeValues[0][1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -392,16 +398,12 @@ public class MapLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nextPoint = getNextPoint(user, mapManager, jumpTypeValues, sOptionAddConditions);
|
nextEventId = getNextPoint(user, mapManager, jumpTypeValues, sOptionAddConditions);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 4 不跳转,关闭界面
|
// 4 不跳转,关闭界面
|
||||||
case 4:{
|
case 4:{
|
||||||
nextPoint = cell.getEventId();
|
nextEventId = cell.getEventId();
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 11:{
|
|
||||||
nextPoint = cell.getEventId();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:{
|
default:{
|
||||||
|
@ -415,8 +417,9 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测该事件点是否已被销毁
|
// 检测该事件点是否已被销毁
|
||||||
if (cell != null) {
|
if (cell != null && nextEventId != 0) {
|
||||||
cell.setEventId(nextPoint);
|
cell.setCostStep(true);
|
||||||
|
cell.setEventId(nextEventId);
|
||||||
mapManager.addOrUpdateCell(mapManager.getCurXY(), cell);
|
mapManager.addOrUpdateCell(mapManager.getCurXY(), cell);
|
||||||
}
|
}
|
||||||
if (behaviorType == EventType.dun && eventUpdateResponse.getMissionCount() > 0) {
|
if (behaviorType == EventType.dun && eventUpdateResponse.getMissionCount() > 0) {
|
||||||
|
@ -443,37 +446,84 @@ public class MapLogic {
|
||||||
.addAllEventBehaviorValues(eventBehaviorValuesList)
|
.addAllEventBehaviorValues(eventBehaviorValuesList)
|
||||||
.build();
|
.build();
|
||||||
eventUpdateResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
eventUpdateResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
||||||
eventUpdateResponse.setEventId(nextPoint);
|
eventUpdateResponse.setEventId(nextEventId);
|
||||||
|
eventUpdateResponse.setLeftStep(mapManager.getTotalStep());
|
||||||
if (dropBuilder != null) {
|
if (dropBuilder != null) {
|
||||||
eventUpdateResponse.setDrop(dropBuilder);
|
eventUpdateResponse.setDrop(dropBuilder);
|
||||||
}
|
}
|
||||||
LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextPoint=>{}, eventBehaviorCommon=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(),
|
LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextEventId=>{}, eventBehaviorCommon=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(),
|
||||||
cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextPoint, eventBehaviorCommon);
|
cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextEventId, eventBehaviorCommon);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) {
|
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) {
|
||||||
int nextPoint = 0;
|
int nextEventId = 0;
|
||||||
switch (sOptionAddConditions.getType()) {
|
switch (sOptionAddConditions.getType()) {
|
||||||
// 1 完成事件点,即进度100%
|
// 1 完成事件点,即进度100%
|
||||||
case 1:{
|
case 1:{
|
||||||
int doneEvent = sOptionAddConditions.getValues()[0][0];
|
int condition = sOptionAddConditions.getValues()[0][0];
|
||||||
for (Cell cell1 : mapManager.getMapInfo().values()) {
|
// 0或 1和
|
||||||
if (cell1.getPointId() == doneEvent) {
|
if (condition == 1) {
|
||||||
if (cell1.getEventId() >= sOptionAddConditions.getValues()[0][1]) {
|
Set<Integer> flags = new HashSet<>();
|
||||||
nextPoint = jumpTypeValues[0][0];
|
int rand = 0;
|
||||||
|
for (int i = 1; i < sOptionAddConditions.getValues()[0].length; i++) {
|
||||||
|
rand++;
|
||||||
|
int eventId = sOptionAddConditions.getValues()[0][i];
|
||||||
|
i++;
|
||||||
|
for (Cell cell1 : mapManager.getMapInfo().values()) {
|
||||||
|
if (cell1.getPointId() == eventId) {
|
||||||
|
if (cell1.getEventId() >= sOptionAddConditions.getValues()[0][i]) {
|
||||||
|
flags.add(i);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
if (flags.size() > 0 && flags.size() >= rand) {
|
||||||
|
nextEventId = jumpTypeValues[0][0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Set<Integer> flags = new HashSet<>();
|
||||||
|
for (int i = 1; i < sOptionAddConditions.getValues()[0].length; i++) {
|
||||||
|
int eventId = sOptionAddConditions.getValues()[0][i];
|
||||||
|
i++;
|
||||||
|
for (Cell cell1 : mapManager.getMapInfo().values()) {
|
||||||
|
if (cell1.getPointId() == eventId) {
|
||||||
|
if (cell1.getEventId() >= sOptionAddConditions.getValues()[0][i]) {
|
||||||
|
flags.add(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flags.size() > 0) {
|
||||||
|
nextEventId = jumpTypeValues[0][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 2 物品数量
|
// 2 物品数量
|
||||||
case 2:{
|
case 2:{
|
||||||
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
int[][] values = sOptionAddConditions.getValues();
|
||||||
|
for (int i = 0; i < values[0].length; i++) {
|
||||||
|
itemMap.put(values[0][i], values[0][i++]);
|
||||||
|
}
|
||||||
|
boolean b = ItemUtil.checkCost(user, itemMap);
|
||||||
|
if (b) {
|
||||||
|
nextEventId = jumpTypeValues[0][0];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 3 角色属性
|
// 3 角色属性
|
||||||
case 3:{
|
case 3:{
|
||||||
|
int[][] values = sOptionAddConditions.getValues();
|
||||||
|
// 1: 全队 0: 最高
|
||||||
|
if (values[0][0] == 1) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 完成某个任务的第几步
|
// 完成某个任务的第几步
|
||||||
|
@ -481,23 +531,23 @@ public class MapLogic {
|
||||||
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
|
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
|
||||||
Set<Integer> takeRewardMissions = user.getMissionManager().getTakeRewardMissions();
|
Set<Integer> takeRewardMissions = user.getMissionManager().getTakeRewardMissions();
|
||||||
if (finishMissions.contains(sOptionAddConditions.getValues()[0][0]) || takeRewardMissions.contains(sOptionAddConditions.getValues()[0][0])) {
|
if (finishMissions.contains(sOptionAddConditions.getValues()[0][0]) || takeRewardMissions.contains(sOptionAddConditions.getValues()[0][0])) {
|
||||||
nextPoint = jumpTypeValues[0][0];
|
nextEventId = jumpTypeValues[0][0];
|
||||||
}
|
}
|
||||||
if (nextPoint == 0) {
|
if (nextEventId == 0) {
|
||||||
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
|
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
|
||||||
Mission mission = doingMissions.get(sOptionAddConditions.getValues()[0][0]);
|
Mission mission = doingMissions.get(sOptionAddConditions.getValues()[0][0]);
|
||||||
if (mission == null || mission.getMissionStep() < jumpTypeValues[0][1]) {
|
if (mission == null || mission.getMissionStep() < jumpTypeValues[0][1]) {
|
||||||
nextPoint = jumpTypeValues[0][1];
|
nextEventId = jumpTypeValues[0][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
nextPoint = jumpTypeValues[0][1];
|
nextEventId = jumpTypeValues[0][1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nextPoint;
|
return nextEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommonProto.Mission getMission(Mission mission) {
|
public CommonProto.Mission getMission(Mission mission) {
|
||||||
|
@ -548,6 +598,7 @@ public class MapLogic {
|
||||||
mapManager.setWalkCells(new HashSet<>());
|
mapManager.setWalkCells(new HashSet<>());
|
||||||
mapManager.setCurXY(0);
|
mapManager.setCurXY(0);
|
||||||
mapManager.setCurMapId(0);
|
mapManager.setCurMapId(0);
|
||||||
|
mapManager.setTotalStep(0);
|
||||||
if (needTemporaryItem) {
|
if (needTemporaryItem) {
|
||||||
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
|
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
|
||||||
if (temporaryItems != null) {
|
if (temporaryItems != null) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class MapManager extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCrossMapInfos(int key, CrossMapCell crossMapCell) throws Exception {
|
public void updateCrossMapInfos(int key, CrossMapCell crossMapCell) throws Exception {
|
||||||
updateString("mapInfo." + key, crossMapCell);
|
updateString("crossMapInfos." + key, crossMapCell);
|
||||||
crossMapInfos.put(key, crossMapCell);
|
crossMapInfos.put(key, crossMapCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class BehaviorUtil {
|
||||||
if (mapPointConfig.getRefresh() == 3) {
|
if (mapPointConfig.getRefresh() == 3) {
|
||||||
crossMapCell.getPermanents().add(needDistoryPointId);
|
crossMapCell.getPermanents().add(needDistoryPointId);
|
||||||
}
|
}
|
||||||
|
mapManager.updateCrossMapInfos(mapManager.getCurMapId(), crossMapCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkCost(User user, Map<Integer, Integer> itemMap) {
|
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) {
|
||||||
if (itemMap == null) {
|
if (itemMap == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue