diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/CrossMapCell.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/CrossMapCell.java index 4e3ab3d53..9ec1ee978 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/CrossMapCell.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/CrossMapCell.java @@ -14,6 +14,8 @@ public class CrossMapCell { // 一次性事件 private Map permanents = new ConcurrentHashMap<>(); + private Map behaviorTriggers = new ConcurrentHashMap<>(); + public Set getMissionIds() { return missionIds; } @@ -25,4 +27,8 @@ public class CrossMapCell { public Map getPermanents() { return permanents; } + + public Map getBehaviorTriggers() { + return behaviorTriggers; + } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java index c0dfa56dc..411d6761b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java @@ -282,6 +282,14 @@ public class MapLogic { newMap.put(xy, cellValue); } } + if (crossMapCell != null) { + for (Map.Entry entry : crossMapCell.getBehaviorTriggers().entrySet()) { + if (entry.getValue().getEventId() == -1) { + continue; + } + newMap.put(entry.getKey(), entry.getValue()); + } + } if (user.getPlayerInfoManager().getMapId() == 100) { SGameSetting sGameSetting = SGameSetting.getGameSetting(); int xy = CellUtil.xy2Pos(sGameSetting.getBornPosition()[0], sGameSetting.getBornPosition()[1]); @@ -573,12 +581,16 @@ public class MapLogic { } // LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextEventId=>{}, eventBehaviorCommon=>{} {} sOptionConfig.getReward()=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(), // cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextEventId, eventBehaviorCommon,eventUpdateResponse.getDrop(), sOptionConfig.getReward()); - saveRefreshInfo(mapManager.getCurMapId(), mapManager, mapPointConfig, cell == null ? -1 : cell.getEventId()); + saveRefreshInfo(mapManager.getCurMapId(), mapManager, mapPointConfig, cell); LOGGER.info("updatEvent() uid=>{},nextEventId={},eventId={}", uid, nextEventId, cell == null ? 0 : cell.getEventId()); MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true); } - public void saveRefreshInfo(int mapId, MapManager mapManager, MapPointConfig mapPointConfig, int nextEventId) throws Exception { + public void saveRefreshInfo(int mapId, MapManager mapManager, MapPointConfig mapPointConfig, Cell cell) throws Exception { + int nextEventId = -1; + if (cell != null) { + nextEventId = cell.getEventId(); + } CrossMapCell crossMapCell = mapManager.getCrossMapInfos().get(mapId); if (crossMapCell == null) { crossMapCell = new CrossMapCell(); @@ -605,9 +617,12 @@ public class MapLogic { return; } } - crossMapCell.getPermanents().put(mapPointConfig.getId(), nextEventId); + crossMapCell.getPermanents().put(mapPointConfig.getId(), cell.getEventId()); } - mapManager.updateCrossMapInfos(mapManager.getCurMapId(), crossMapCell); + if (crossMapCell.getBehaviorTriggers().containsKey(cell.getCellId())) { + crossMapCell.getBehaviorTriggers().put(cell.getCellId(), cell); + } + mapManager.updateCrossMapInfos(mapId, crossMapCell); } private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) { diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java index 3307eb220..87df4c4e1 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/BehaviorUtil.java @@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.hero.HeroLogic; import com.ljsd.jieling.protocols.CommonProto; import com.ljsd.jieling.protocols.FightInfoProto; import com.ljsd.jieling.protocols.MapInfoProto; +import com.ljsd.jieling.util.CellUtil; import com.ljsd.jieling.util.MonsterUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,6 +83,18 @@ public class BehaviorUtil { } } + public static void addBehaviorInfo(int needDistoryPointId, MapManager mapManager, int mapId, int x, int y) throws Exception { + CrossMapCell crossMapCell = mapManager.getCrossMapInfos().get(mapId); + if (crossMapCell == null) { + crossMapCell = new CrossMapCell(); + } + int xy = CellUtil.xy2Pos(x, y); + MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(needDistoryPointId); + Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId()); + crossMapCell.getBehaviorTriggers().put(xy,cellValue); + mapManager.updateCrossMapInfos(mapId, crossMapCell); + } + /** * 销毁指定事件点坐标 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java index d24e46010..b33f69d42 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/MonitorMissionAndDestroyPointBehavior.java @@ -49,8 +49,7 @@ public class MonitorMissionAndDestroyPointBehavior extends BaseBehavior { } } } else { - MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[j][3]); - MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[j][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); + BehaviorUtil.addBehaviorInfo(behaviorTypeValues[j][0], user.getMapManager(), behaviorTypeValues[j][3], behaviorTypeValues[j][1], behaviorTypeValues[j][2]); } } return true; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java index 145089fb4..6e6ee18c3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/OpenMissionBehavior.java @@ -28,8 +28,7 @@ public class OpenMissionBehavior extends BaseBehavior { Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId()); user.getMapManager().addOrUpdateCell(xy, cellValue); } else { - MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[1][3]); - MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[1][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); + BehaviorUtil.addBehaviorInfo(behaviorTypeValues[1][0], user.getMapManager(), behaviorTypeValues[1][3], behaviorTypeValues[1][1], behaviorTypeValues[1][2]); } return true; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java index f1bbaabea..cd818f410 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyBehavior.java @@ -31,8 +31,7 @@ public class ThirtyBehavior extends BaseBehavior { } return true; } else { - MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[1][3]); - MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[0][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); + BehaviorUtil.addBehaviorInfo(behaviorTypeValues[1][0], user.getMapManager(), behaviorTypeValues[1][3], behaviorTypeValues[1][1], behaviorTypeValues[1][2]); } return true; }