探索修改

back_recharge
jiahuiwen 2019-04-12 19:42:32 +08:00
parent ab96501d1c
commit 4ba216f2e3
9 changed files with 67 additions and 26 deletions

View File

@ -1,4 +1,5 @@
Id OpenRule MapTime ReviveTime Id OpenRule MapTime ReviveTime
int mut,int#int,2 int mut,int#int,1 int mut,int#int,2 int mut,int#int,1
100 0#0 600 0#0#0#10
101 0#0 600 0#0#0#10 101 0#0 600 0#0#0#10
102 0#0 600 0#0#0#10 102 0#0 600 0#0#0#10

View File

@ -0,0 +1,19 @@
Id MissionNum Reward
int int int
1 3 2000
2 5 2001
3 4 2024
4 3 2002
5 6 2025
6 3 2003
7 5 2004
8 3 2005
9 2 2006
10 2 2007
11 1 2008
12 2 2009
101 4 2002
102 3 2002
103 1 2002
104 8 2002
0 0 0

View File

@ -5,7 +5,7 @@ import com.ljsd.jieling.logic.Table;
import java.util.Map; import java.util.Map;
@Table(name ="MissionEventsConfig") @Table(name ="ChallengeMissionEventsConfig")
public class SMissionEventsConfig implements BaseConfig { public class SMissionEventsConfig implements BaseConfig {
public static Map<Integer, SMissionEventsConfig> sMissionEventsConfigMap; public static Map<Integer, SMissionEventsConfig> sMissionEventsConfigMap;

View File

@ -93,6 +93,17 @@ public class MapLogic {
return; return;
} }
SChallengeMapConfig scMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId); SChallengeMapConfig scMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId);
if (scMapConfig == null) {
LOGGER.info("enterMap() uid=>{} sChallengeConfig == null =>{} ", uid, mapId);
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在");
return;
}
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapId);
if (sChallengeConfig == null) {
LOGGER.info("enterMap() uid=>{} sChallengeConfig == null =>{} ", uid, mapId);
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在");
return;
}
// if (scMapConfig == null || scMapConfig.getOpenRule() == null || scMapConfig.getOpenRule().length == 0) { // if (scMapConfig == null || scMapConfig.getOpenRule() == null || scMapConfig.getOpenRule().length == 0) {
// LOGGER.info("enterMap() uid=>{} mapId=>{}, scMapConfig.getOpenRule()=>{}", uid, mapId, scMapConfig == null ? "" : scMapConfig.getOpenRule()); // LOGGER.info("enterMap() uid=>{} mapId=>{}, scMapConfig.getOpenRule()=>{}", uid, mapId, scMapConfig == null ? "" : scMapConfig.getOpenRule());
// MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), ""); // MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
@ -281,6 +292,11 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
if (mapManager.getStartExporeTime() == 0) {
LOGGER.info("mapManager.getStartExporeTime() == 0");
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "未开始探索");
return;
}
if (getLeftTime(user) <= 0) { if (getLeftTime(user) <= 0) {
LOGGER.info("updateMap() uid=>{}, no step=>{}", uid, getLeftTime(user)); LOGGER.info("updateMap() uid=>{}, no step=>{}", uid, getLeftTime(user));
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
@ -326,6 +342,11 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
if (mapManager.getStartExporeTime() == 0) {
LOGGER.info("mapManager.getStartExporeTime() == 0");
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "未开始探索");
return;
}
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY()); Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell == null) { if (cell == null) {
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY()); LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
@ -484,7 +505,7 @@ public class MapLogic {
} }
// LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextEventId=>{}, eventBehaviorCommon=>{} {} sOptionConfig.getReward()=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(), // 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()); // cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextEventId, eventBehaviorCommon,eventUpdateResponse.getDrop(), sOptionConfig.getReward());
LOGGER.info("updatEvent() uid=>{},nextEventId={},eventId={}", uid, nextEventId, cell == null ? 0 : cell.getEventId()); LOGGER.info("updatEvent() uid=>{},nextEventId={},eventId={},mission=>{}", uid, nextEventId, cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMission());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
} }
@ -665,6 +686,7 @@ public class MapLogic {
mapManager.setTriggerXY(0); mapManager.setTriggerXY(0);
mapManager.setFoodBufferMap(new HashMap<>()); mapManager.setFoodBufferMap(new HashMap<>());
TemporaryItems temporaryItems = mapManager.getTemporaryItems(); TemporaryItems temporaryItems = mapManager.getTemporaryItems();
mapManager.setMission(null);
if (temporaryItems != null) { if (temporaryItems != null) {
ItemUtil.addTemporaryItemToBag(user, temporaryItems, needTemporaryItem); ItemUtil.addTemporaryItemToBag(user, temporaryItems, needTemporaryItem);
mapManager.setTemporaryItems(null); mapManager.setTemporaryItems(null);
@ -819,7 +841,7 @@ public class MapLogic {
if (missionId != 0) { if (missionId != 0) {
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder(); MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
BehaviorUtil.updateMission(user, missionId, eventUpdateResponse); BehaviorUtil.updateMission(user, missionId, eventUpdateResponse);
fightEndResponse.addAllMission(eventUpdateResponse.getMissionList()); fightEndResponse.setMission(eventUpdateResponse.getMission());
} }
if (destoryId != 0) { if (destoryId != 0) {
BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), destoryId); BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), destoryId);
@ -1033,7 +1055,7 @@ public class MapLogic {
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId()); SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
long startExporeTime = user.getMapManager().getStartExporeTime(); long startExporeTime = user.getMapManager().getStartExporeTime();
if (startExporeTime == 0) { if (startExporeTime == 0) {
return 0; return -1;
} }
int useTime = (int) ((TimeUtils.now() - startExporeTime) / 1000); int useTime = (int) ((TimeUtils.now() - startExporeTime) / 1000);
if (useTime >= sChallengeConfig.getMapTime()) { if (useTime >= sChallengeConfig.getMapTime()) {
@ -1058,7 +1080,7 @@ public class MapLogic {
} else { } else {
user.getMapManager().setMission(mission); user.getMapManager().setMission(mission);
} }
checkMissionReturn.missions.add(mission); checkMissionReturn.mission = mission;
return checkMissionReturn; return checkMissionReturn;
} }
@ -1072,8 +1094,13 @@ public class MapLogic {
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager(); MapManager mapManager = user.getMapManager();
if (mapManager.getMapInfo() == null) { if (mapManager.getMapInfo() == null) {
LOGGER.info("mapManager.getMapInfo() == null"); LOGGER.info("startExplorte mapManager.getMapInfo() == null");
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "未进入地图");
return;
}
if (mapManager.getStartExporeTime() > 0) {
LOGGER.info("startExplorte mapManager.getStartExporeTime() > 0 =>{}", mapManager.getStartExporeTime());
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "已开始探索");
return; return;
} }
mapManager.setStartExporeTime(TimeUtils.now()); mapManager.setStartExporeTime(TimeUtils.now());

View File

@ -44,7 +44,7 @@ public class MapManager extends MongoBase {
private long startExporeTime; private long startExporeTime;
private boolean missionIsFinish; private int userTime;
private Mission mission; private Mission mission;
@ -249,13 +249,13 @@ public class MapManager extends MongoBase {
this.startExporeTime = startExporeTime; this.startExporeTime = startExporeTime;
} }
public boolean isMissionIsFinish() { public int getUserTime() {
return missionIsFinish; return userTime;
} }
public void setMissionIsFinish(boolean missionIsFinish) { public void setUserTime(int userTime) {
updateString("missionIsFinish", missionIsFinish); updateString("userTime", userTime);
this.missionIsFinish = missionIsFinish; this.userTime = userTime;
} }
public Mission getMission() { public Mission getMission() {

View File

@ -162,16 +162,14 @@ public class BehaviorUtil {
/** /**
* *
*/ */
public static boolean updateMission(User user, int missionId, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception{ public static boolean updateMission(User user, int missionId, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Mission mission = user.getMapManager().getMission(); Mission mission = user.getMapManager().getMission();
if (mission == null) { if (mission == null) {
return false; return false;
} }
CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(mission, user); CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(mission, user);
for (Mission missions : checkMissionReturn.missions) { CommonProto.Mission missionProto = MapLogic.getInstance().getMission(checkMissionReturn.mission);
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(missions); eventUpdateResponse.setMission(missionProto);
eventUpdateResponse.addMission(missionProto);
}
return true; return true;
} }

View File

@ -9,8 +9,6 @@ import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MapInfoProto; import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map;
@Component @Component
public class DestroyMissionBehavior extends BaseBehavior { public class DestroyMissionBehavior extends BaseBehavior {
@Override @Override
@ -26,10 +24,8 @@ public class DestroyMissionBehavior extends BaseBehavior {
} }
CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(mission, user); CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(mission, user);
BehaviorUtil.destoryCurPoint(user); BehaviorUtil.destoryCurPoint(user);
for (Mission cmission : checkMissionReturn.missions){ CommonProto.Mission missionProto = MapLogic.getInstance().getMission(checkMissionReturn.mission);
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(cmission); eventUpdateResponse.setMission(missionProto);
eventUpdateResponse.addMission(missionProto);
}
return true; return true;
} }
} }

View File

@ -7,6 +7,6 @@ import java.util.List;
public class CheckMissionReturn { public class CheckMissionReturn {
public String newEventId; public String newEventId;
public List<Mission> missions = new ArrayList<>(); public Mission mission;
public CommonProto.Drop.Builder drop; public CommonProto.Drop.Builder drop;
} }

View File

@ -173,7 +173,7 @@ public class PlayerManager extends MongoBase {
} }
public void setMaxStamina(int maxStamina) { public void setMaxStamina(int maxStamina) {
updateString("maxStamina.", maxStamina); updateString("maxStamina", maxStamina);
this.maxStamina = maxStamina; this.maxStamina = maxStamina;
} }
} }