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