From 7637c763ad3e71201b0bc3797d2b28c013e500ce Mon Sep 17 00:00:00 2001 From: jiahuiwen <1024696487@qq.com> Date: Mon, 29 Apr 2019 18:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=91=E5=8A=A0=E4=B8=AA=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/handler/map/MapLogic.java | 11 ++++++---- .../handler/map/behavior/BehaviorUtil.java | 20 +++++++++++++++---- .../map/behavior/ThirtyThreeBehavior.java | 2 ++ 3 files changed, 25 insertions(+), 8 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 1c82da384..5d0b225b7 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 @@ -197,6 +197,7 @@ public class MapLogic { .build(); mapEnterResponse.addHeroInfos(heroInfo); } + LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId()); MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true); } @@ -363,7 +364,7 @@ public class MapLogic { .setEventId(cell.getEventId()) .setLeftTime(getLeftTime(user)) .build(); - LOGGER.info("enterMap() uid=>{} mapId =>{} ", uid, mapManager.getCurMapId()); + LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId()); mapManager.updateFoodBufferByStep(cells.size()); MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true); } @@ -471,10 +472,12 @@ public class MapLogic { // 战斗事件需要放到战斗胜利 if (baseBehavior == null || !baseBehavior.isFightBehavior()) { // 检测该事件点是否已被销毁 - if (cell != null && nextEventId != 0) { + if (cell != null) { nextEventId = getNextEventId(user, cell, sOptionConfig); - cell.setEventId(nextEventId); - mapManager.addOrUpdateCell(cell.getCellId(), cell); + if (nextEventId != 0) { + cell.setEventId(nextEventId); + mapManager.addOrUpdateCell(cell.getCellId(), cell); + } } } updateMapMission(mapManager,EventType.updateOptionalEvent, optionId,0); 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 0435e4960..5d1576724 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 @@ -47,7 +47,15 @@ public class BehaviorUtil { mapManager.setMapInfo(mapInfo); } - + /** + * 增加新事件点 + * @param needDistoryPointId + * @param mapManager + * @param mapId + * @param x + * @param y + * @throws Exception + */ public static void addBehaviorInfo(int needDistoryPointId, MapManager mapManager, int mapId, int x, int y) throws Exception { int xy = CellUtil.xy2Pos(x, y); MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(needDistoryPointId); @@ -71,7 +79,11 @@ public class BehaviorUtil { } } - + /** + * 准备战斗 groupId#pointId + * @param uid + * @param readyInfo + */ public static void fightReady(String uid, String readyInfo) { String key = RedisKey.getKey(RedisKey.FIGHT_READY, uid, false); RedisUtil.getInstence().set(key, readyInfo, RedisKey.EXPIRE_TIME); @@ -160,7 +172,7 @@ public class BehaviorUtil { } /** - * 更新任务 + * 更新事件时 更新任务 */ public static boolean updateMission(User user, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { Mission mission = user.getMapManager().getMission(); @@ -179,7 +191,7 @@ public class BehaviorUtil { } /** - * 更新任务 + * 战斗结束更新任务 */ public static boolean updateMissionEndFight(User user, FightInfoProto.FightEndResponse.Builder fightEndResponseBuilder) throws Exception { Mission mission = user.getMapManager().getMission(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java index 3603db76f..26dda6d65 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/behavior/ThirtyThreeBehavior.java @@ -4,7 +4,9 @@ import com.ljsd.jieling.handler.map.EventType; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.protocols.FightInfoProto; import com.ljsd.jieling.protocols.MapInfoProto; +import org.springframework.stereotype.Component; +@Component public class ThirtyThreeBehavior extends BaseBehavior { @Override public int getBehaviorType() {