地图修改
parent
992ed00675
commit
a500703394
|
@ -60,6 +60,11 @@ public class RedisKey {
|
|||
* sub_key
|
||||
*/
|
||||
public static final String NEED_DESORY_ID = "NEED_DESORY_ID";
|
||||
/**
|
||||
* 需要销毁的坐标
|
||||
* sub_key
|
||||
*/
|
||||
public static final String NEED_DESORY_XY = "NEED_DESORY_XY";
|
||||
|
||||
/**
|
||||
* 过期事件
|
||||
|
|
|
@ -523,10 +523,8 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
String key = RedisKey.getKey(RedisKey.FIGHT, user.getId() , false);
|
||||
Map<Object , Object> valueMap = RedisUtil.getInstence().hmget(key);
|
||||
CommonProto.Drop.Builder dropBuilder = null;
|
||||
if (valueMap == null || valueMap.isEmpty()) {
|
||||
if (sOptionConfig.getReward().length > 0) {
|
||||
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 1);
|
||||
}
|
||||
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
|
||||
|
@ -549,8 +547,8 @@ public class MapLogic {
|
|||
if (dropBuilder != null) {
|
||||
eventUpdateResponse.setDrop(dropBuilder);
|
||||
}
|
||||
// LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextEventId=>{}, eventBehaviorCommon=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(),
|
||||
// cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextEventId, eventBehaviorCommon);
|
||||
// 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, nextEventId);
|
||||
updateMapMission(mapManager,EventType.updateEvent,pointId,0);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
|
||||
|
@ -795,7 +793,7 @@ public class MapLogic {
|
|||
}
|
||||
String fightReadyKey = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid), false);
|
||||
String fightReady = (String) RedisUtil.getInstence().get(fightReadyKey);
|
||||
int groupId;
|
||||
int groupId, destoryXY = 0;
|
||||
String missionId = "0", destroyId = "0";
|
||||
if (fightReady != null) {
|
||||
String[] split = fightReady.split("#");
|
||||
|
@ -815,9 +813,10 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
groupId = option[0];
|
||||
destoryXY = mapManager.getTriggerXY();
|
||||
}
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, missionId, destroyId);
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, missionId, destroyId, destoryXY);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
|
@ -838,7 +837,6 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "此战斗已结算过!");
|
||||
return;
|
||||
}
|
||||
|
||||
int seed = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_SEED));
|
||||
int monsterGroupId = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||
CommonProto.FightTeamInfo.Builder builder = CommonProto.FightTeamInfo.newBuilder();
|
||||
|
@ -869,7 +867,6 @@ public class MapLogic {
|
|||
for (int i = 1; i < checkResult.length; i++) {
|
||||
remainHp.add(checkResult[i]);
|
||||
}
|
||||
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode == -1){
|
||||
|
@ -904,6 +901,7 @@ public class MapLogic {
|
|||
fightEndResponse.build();
|
||||
int missionId = Integer.parseInt((String)valueMap.get(RedisKey.NEED_MISSION_ID));
|
||||
int destoryId = Integer.parseInt((String)valueMap.get(RedisKey.NEED_DESORY_ID));
|
||||
int destoryXY = Integer.parseInt((String)valueMap.get(RedisKey.NEED_DESORY_XY));
|
||||
if (missionId != 0) {
|
||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||
BehaviorUtil.updateMission(user, missionId, eventUpdateResponse);
|
||||
|
@ -912,10 +910,12 @@ public class MapLogic {
|
|||
if (destoryId != 0) {
|
||||
BehaviorUtil.distoryPoint(user, destoryId);
|
||||
}
|
||||
if (destoryXY != 0) {
|
||||
BehaviorUtil.distoryApointXY(user, destoryXY);
|
||||
}
|
||||
updateMapMission(user.getMapManager(),EventType.fightEvent,0,monsterGroupId);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} drop=>{}", uid, sMonsterGroup.getRewardgroup(), fightEndResponse.getDrop());
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,6 +69,19 @@ public class BehaviorUtil {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 销毁指定事件点坐标
|
||||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void distoryApointXY(User user, int destoryXY) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
mapInfo.remove(destoryXY);
|
||||
mapManager.setMapInfo(mapInfo);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -81,7 +94,7 @@ public class BehaviorUtil {
|
|||
* @param fightStartRespons
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String missionId, String destoryId) throws Exception {
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String missionId, String destoryId, int destoryXY) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
int teamId = mapManager.getTeamId();
|
||||
|
@ -139,6 +152,7 @@ public class BehaviorUtil {
|
|||
fightInfo.put(RedisKey.FIGHT_GROUPID, Integer.toString(groupId));
|
||||
fightInfo.put(RedisKey.NEED_MISSION_ID, missionId);
|
||||
fightInfo.put(RedisKey.NEED_DESORY_ID, destoryId);
|
||||
fightInfo.put(RedisKey.NEED_DESORY_XY, Integer.toString(destoryXY));
|
||||
RedisUtil.getInstence().hmset(key, fightInfo, RedisKey.EXPIRE_TIME);
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ public class DestroyPointAndBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.distoryPoint(user, behaviorTypeValues[0][1]);
|
||||
// TODO 监视地图
|
||||
|
||||
// 怪物组id#任务id#需要销毁事件id
|
||||
String readyInfo = Integer.toString(behaviorTypeValues[0][1]) + "#" + 0 + "#" + behaviorTypeValues[0][1];
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class FightAndDestroyPointBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// 怪物组id#任务id#需要销毁事件id
|
||||
String readyInfo = Integer.toString(behaviorTypeValues[0][1]) + "#" + Integer.toString(behaviorTypeValues[0][0]) + "#" + behaviorTypeValues[0][2];
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
// 放在战斗胜利后
|
||||
|
|
Loading…
Reference in New Issue