From 37f085b31ce4fb1a4f39572cbc0ca3aa45a1a7d3 Mon Sep 17 00:00:00 2001 From: jiahuiwen <1024696487@qq.com> Date: Mon, 8 Apr 2019 17:14:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ljsd/jieling/handler/map/MapLogic.java | 18 +++++++++--------- .../MonitorMissionAndDestroyPointBehavior.java | 4 +++- .../map/behavior/OpenMissionBehavior.java | 4 +++- .../handler/map/behavior/ThirtyBehavior.java | 6 ++++-- 4 files changed, 19 insertions(+), 13 deletions(-) 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 e90106b3a..c0dfa56dc 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 @@ -573,19 +573,19 @@ 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(pointId, mapManager, mapPointConfig, cell == null ? -1 : cell.getEventId()); + saveRefreshInfo(mapManager.getCurMapId(), mapManager, mapPointConfig, cell == null ? -1 : cell.getEventId()); 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 optionId, MapManager mapManager, MapPointConfig mapPointConfig, int nextEventId) throws Exception { - CrossMapCell crossMapCell = mapManager.getCrossMapInfos().get(mapManager.getCurMapId()); + public void saveRefreshInfo(int mapId, MapManager mapManager, MapPointConfig mapPointConfig, int nextEventId) throws Exception { + CrossMapCell crossMapCell = mapManager.getCrossMapInfos().get(mapId); if (crossMapCell == null) { crossMapCell = new CrossMapCell(); } if (mapPointConfig.getRefresh() == 1) { - if (crossMapCell.getDayRefreshs().containsKey(optionId)) { - int saveEventId = crossMapCell.getDayRefreshs().get(optionId); + if (crossMapCell.getDayRefreshs().containsKey(mapPointConfig.getId())) { + int saveEventId = crossMapCell.getDayRefreshs().get(mapPointConfig.getId()); if (saveEventId == -1) { return; } @@ -593,11 +593,11 @@ public class MapLogic { return; } } - crossMapCell.getDayRefreshs().put(optionId, nextEventId); + crossMapCell.getDayRefreshs().put(mapPointConfig.getId(), nextEventId); } if (mapPointConfig.getRefresh() == 3) { - if (crossMapCell.getPermanents().containsKey(optionId)) { - int saveEventId = crossMapCell.getPermanents().get(optionId); + if (crossMapCell.getPermanents().containsKey(mapPointConfig.getId())) { + int saveEventId = crossMapCell.getPermanents().get(mapPointConfig.getId()); if (saveEventId == -1) { return; } @@ -605,7 +605,7 @@ public class MapLogic { return; } } - crossMapCell.getPermanents().put(optionId, nextEventId); + crossMapCell.getPermanents().put(mapPointConfig.getId(), nextEventId); } mapManager.updateCrossMapInfos(mapManager.getCurMapId(), 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 1bb14e64f..d24e46010 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 @@ -4,6 +4,7 @@ import com.ljsd.jieling.config.MapPointConfig; import com.ljsd.jieling.handler.map.Cell; import com.ljsd.jieling.handler.map.CrossMapCell; import com.ljsd.jieling.handler.map.EventType; +import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.handler.mission.Mission; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.protocols.MapInfoProto; @@ -48,7 +49,8 @@ public class MonitorMissionAndDestroyPointBehavior extends BaseBehavior { } } } else { - BehaviorUtil.addRefreshInfo(behaviorTypeValues[j][3], user.getMapManager(), behaviorTypeValues[j][0]); + MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[j][3]); + MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[j][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); } } 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 4839165b9..145089fb4 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 @@ -3,6 +3,7 @@ package com.ljsd.jieling.handler.map.behavior; import com.ljsd.jieling.config.MapPointConfig; import com.ljsd.jieling.handler.map.Cell; import com.ljsd.jieling.handler.map.EventType; +import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.protocols.MapInfoProto; import com.ljsd.jieling.util.CellUtil; @@ -27,7 +28,8 @@ public class OpenMissionBehavior extends BaseBehavior { Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId()); user.getMapManager().addOrUpdateCell(xy, cellValue); } else { - BehaviorUtil.addRefreshInfo(behaviorTypeValues[1][3], user.getMapManager(), behaviorTypeValues[1][0]); + MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[1][3]); + MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[1][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); } 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 997b97c09..f1bbaabea 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 @@ -3,6 +3,7 @@ package com.ljsd.jieling.handler.map.behavior; import com.ljsd.jieling.config.MapPointConfig; import com.ljsd.jieling.handler.map.Cell; import com.ljsd.jieling.handler.map.EventType; +import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.protocols.MapInfoProto; @@ -30,8 +31,9 @@ public class ThirtyBehavior extends BaseBehavior { } return true; } else { - BehaviorUtil.addRefreshInfo(behaviorTypeValues[0][3], user.getMapManager(), behaviorTypeValues[0][0]); + MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(behaviorTypeValues[1][3]); + MapLogic.getInstance().saveRefreshInfo(behaviorTypeValues[0][0], user.getMapManager(), mapPointConfig, mapPointConfig.getInitialEventId()); } - return false; + return true; } }