back_recharge
jiahuiwen 2019-04-08 20:41:34 +08:00
parent afd2df23c1
commit 982a34d49e
6 changed files with 41 additions and 10 deletions

View File

@ -14,6 +14,8 @@ public class CrossMapCell {
// 一次性事件
private Map<Integer, Integer> permanents = new ConcurrentHashMap<>();
private Map<Integer, Cell> behaviorTriggers = new ConcurrentHashMap<>();
public Set<Integer> getMissionIds() {
return missionIds;
}
@ -25,4 +27,8 @@ public class CrossMapCell {
public Map<Integer, Integer> getPermanents() {
return permanents;
}
public Map<Integer, Cell> getBehaviorTriggers() {
return behaviorTriggers;
}
}

View File

@ -282,6 +282,14 @@ public class MapLogic {
newMap.put(xy, cellValue);
}
}
if (crossMapCell != null) {
for (Map.Entry<Integer, Cell> 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) {

View File

@ -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);
}
/**
*

View File

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

View File

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

View File

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