销毁事件点 需要保存事件信息
parent
88b30cf287
commit
126df5e58b
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
|
@ -10,7 +9,6 @@ import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
|||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.MailManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -929,10 +927,10 @@ public class MapLogic {
|
|||
fightEndResponse.addAllMission(eventUpdateResponse.getMissionList());
|
||||
}
|
||||
if (destoryId != 0) {
|
||||
BehaviorUtil.distoryPoint(user, destoryId);
|
||||
BehaviorUtil.destoryPoint(user, destoryId);
|
||||
}
|
||||
if (destoryXY != 0) {
|
||||
BehaviorUtil.distoryApointXY(user, destoryXY);
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
}
|
||||
if (nextEventId != 0) {
|
||||
int triggerXY = user.getMapManager().getTriggerXY();
|
||||
|
|
|
@ -32,7 +32,7 @@ public class BehaviorUtil {
|
|||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void distoryPoint(User user, int needDistoryPointId) throws Exception {
|
||||
public static void destoryPoint(User user, int needDistoryPointId) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
Set<Integer> needDelete = new HashSet<>();
|
||||
|
@ -56,6 +56,10 @@ public class BehaviorUtil {
|
|||
}
|
||||
mapManager.setMapInfo(mapInfo);
|
||||
|
||||
addRefreshInfo(needDistoryPointId, mapManager);
|
||||
}
|
||||
|
||||
private static void addRefreshInfo(int needDistoryPointId, MapManager mapManager) throws Exception {
|
||||
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(needDistoryPointId);
|
||||
/**
|
||||
* 事件点的刷新规则
|
||||
|
@ -84,11 +88,13 @@ public class BehaviorUtil {
|
|||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void distoryApointXY(User user, int destoryXY) throws Exception {
|
||||
public static void destoryApointXY(User user, int destoryXY) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
mapInfo.remove(destoryXY);
|
||||
mapManager.setMapInfo(mapInfo);
|
||||
Cell cell = mapInfo.get(destoryXY);
|
||||
if (cell != null) {
|
||||
addRefreshInfo(cell.getPointId(), mapManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,9 +207,13 @@ public class BehaviorUtil {
|
|||
* 销毁当前点
|
||||
* @param user
|
||||
*/
|
||||
public static void destoryCurPoint(User user) {
|
||||
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
|
||||
mapInfo.remove(user.getMapManager().getCurXY());
|
||||
public static void destoryCurPoint(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
Cell cell = mapInfo.get(mapManager.getCurXY());
|
||||
if (cell != null) {
|
||||
addRefreshInfo(cell.getPointId(), mapManager);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,16 +28,7 @@ public class DestroyMissionBehavior extends BaseBehavior {
|
|||
return false;
|
||||
}
|
||||
CheckMissionReturn checkMissionReturn = MissionLogic.getInstance().checkMission(mission, user);
|
||||
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
|
||||
mapInfo.remove(user.getMapManager().getCurXY());
|
||||
if (checkMissionReturn.newEventId != null && !checkMissionReturn.newEventId.isEmpty()) {
|
||||
String[] split = checkMissionReturn.newEventId .split("#");
|
||||
Cell cellUpdate = mapInfo.get(Integer.parseInt(split[0]));
|
||||
if (cellUpdate != null) {
|
||||
cellUpdate.setEventId(Integer.parseInt(split[1]));
|
||||
}
|
||||
}
|
||||
user.getMapManager().setMapInfo(mapInfo);
|
||||
BehaviorUtil.destoryCurPoint(user);
|
||||
for (Mission cmission : checkMissionReturn.missions){
|
||||
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(cmission);
|
||||
eventUpdateResponse.addMission(missionProto);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class DestroyPointBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.distoryPoint(user, behaviorTypeValues[0][0]);
|
||||
BehaviorUtil.destoryPoint(user, behaviorTypeValues[0][0]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class MonitorMissionAndDestroyPointBehavior extends BaseBehavior {
|
|||
// 1#101011|101#13#18#101012|101#12#13#101009
|
||||
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
// 销毁事件点
|
||||
BehaviorUtil.distoryPoint(user, behaviorTypeValues[0][1]);
|
||||
BehaviorUtil.destoryPoint(user, behaviorTypeValues[0][1]);
|
||||
// 开新事件 新事件需要和任务绑定
|
||||
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
|
||||
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class UseItemAndDestroyBehavior extends BaseBehavior {
|
|||
if (!isEnough) {
|
||||
return isEnough;
|
||||
}
|
||||
BehaviorUtil.distoryPoint(user, behaviorTypeValues[0][2]);
|
||||
BehaviorUtil.destoryPoint(user, behaviorTypeValues[0][2]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue