保存信息

back_recharge
jiahuiwen 2019-04-08 17:14:10 +08:00
parent 6bd50b34de
commit 37f085b31c
4 changed files with 19 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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