优化地图行为,并增加三个新行为
parent
ac596f4612
commit
6992512d3b
|
@ -61,27 +61,10 @@ public class RedisKey {
|
|||
public static final String FIGHT_GROUPID = "GROUPID";
|
||||
|
||||
/**
|
||||
* 需要推进的任务id
|
||||
* 需要战斗胜利后处理的
|
||||
* sub_key
|
||||
*/
|
||||
public static final String NEED_MISSION_ID = "NEED_MISSION_ID";
|
||||
|
||||
/**
|
||||
* 需要销毁的事件点id
|
||||
* sub_key
|
||||
*/
|
||||
public static final String NEED_DESORY_ID = "NEED_DESORY_ID";
|
||||
/**
|
||||
* 需要销毁的坐标
|
||||
* sub_key
|
||||
*/
|
||||
public static final String NEED_DESORY_XY = "NEED_DESORY_XY";
|
||||
|
||||
/**
|
||||
* 战斗事件更新eventId 放在战斗胜利之后
|
||||
* sub_key
|
||||
*/
|
||||
public static final String NEXT_EVENT_ID = "NEXT_EVENT_ID";
|
||||
public static final String NEED_VICTORY_AFTER = "NEED_VICTORY_AFTER";
|
||||
|
||||
public static final String C_User_Name_Key = "C_User_Name_Key";
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class EventType {
|
|||
* 行为参数:道具id#num#事件点id
|
||||
* 17 完成任务往下推一步,摧毁指定事件点,开启新的事件点
|
||||
* 行为参数:任务id#事件点id#地图id#坐标id#事件点id#地图id#坐标id#摧毁事件点id
|
||||
* 18 完成任务往下推一步,战斗并销毁指定地图点
|
||||
* 18 战斗胜利 任务往下推一步,并销毁指定地图点
|
||||
* 行为参数:怪物组id#事件点id
|
||||
* 19 完成任务往下推一步,行动到某张地图某坐标点,不摧毁事件点
|
||||
* 行为参数:任务id#地图id#坐标(不输入地图id和坐标而输入0代表回主城)
|
||||
|
@ -59,6 +59,9 @@ public class EventType {
|
|||
* 28 消耗行动力
|
||||
* 29 消耗道具并销毁当前地图点
|
||||
* 30 开启新的地图点
|
||||
* 32 推任务,战斗,删除指定地图点,生成新的事件点。 怪物组id#删除点id|地图id#x坐标#y坐标#地图点id|地图id#x坐标#y坐标#地图点id|…
|
||||
* 33 战斗,删除指定地图点,生成新的事件点。 怪物组id#删除点id|地图id#x坐标#y坐标#地图点id|地图id#x坐标#y坐标#地图点id|…
|
||||
* 34 获得buff,删除指定地图点 buffid#删除点id
|
||||
*/
|
||||
public static final int fight = 1;
|
||||
public static final int useItem = 2;
|
||||
|
@ -86,6 +89,9 @@ public class EventType {
|
|||
public static final int twentyEight = 28;
|
||||
public static final int twentyNine = 29;
|
||||
public static final int thirty = 30;
|
||||
public static final int thirtyTwo = 32;
|
||||
public static final int thirtyThree = 33;
|
||||
public static final int thirtyFour = 34;
|
||||
|
||||
public static final int updatePonintEvent = 1;
|
||||
public static final int fightEvent = 2;
|
||||
|
|
|
@ -455,75 +455,29 @@ public class MapLogic {
|
|||
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||
if (baseBehavior != null) {
|
||||
boolean isSuccess = baseBehavior.process(user, behaviorTypeValues, eventUpdateResponse);
|
||||
boolean isSuccess = baseBehavior.process(optionId, user, behaviorTypeValues, eventUpdateResponse);
|
||||
if (!isSuccess) {
|
||||
LOGGER.info("updatePonintEvent() baseBehavior process fail! behaviorType=>{}", behaviorType);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
int jumpType = sOptionConfig.getJumpType();
|
||||
int nextEventId = 0;
|
||||
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
||||
switch (jumpType) {
|
||||
// 1 无条件跳转,对应事件点
|
||||
// 6 无条件跳转地图id
|
||||
case 1:
|
||||
case 5:
|
||||
case 6:{
|
||||
nextEventId = jumpTypeValues[0][0];
|
||||
break;
|
||||
}
|
||||
// 2 权重跳转,1001#1002|0.2#0.8
|
||||
case 2:
|
||||
case 7:
|
||||
case 9:{
|
||||
int ranom = MathUtils.randomInt(100) + 1;
|
||||
if (ranom >= jumpTypeValues[1][0]) {
|
||||
nextEventId = jumpTypeValues[0][0];
|
||||
} else {
|
||||
nextEventId = jumpTypeValues[0][1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
// 3 条件跳转 1001#1002|0(0或1为和)#条件id#条件id
|
||||
case 3:
|
||||
case 8:
|
||||
case 10:{
|
||||
SOptionAddCondition sOptionAddConditions = SOptionAddCondition.sOptionAddConditionMap.get(jumpTypeValues[1][1]);
|
||||
if (sOptionAddConditions == null) {
|
||||
LOGGER.info("sOptionAddConditions == null jumpTypeValues[1][1]=>{}", jumpTypeValues[1][1]);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
nextEventId = getNextPoint(user, mapManager, jumpTypeValues, sOptionAddConditions);
|
||||
break;
|
||||
}
|
||||
// 4 不跳转,关闭界面
|
||||
case 4:{
|
||||
nextEventId = cell.getEventId();
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mapPointConfig.getTriggerRules() == 1) {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
} else {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
}
|
||||
|
||||
// 战斗事件处理需要放到战斗胜利
|
||||
if (behaviorType == EventType.fight || behaviorType == EventType.fightAndDestroyPoint ) {
|
||||
BehaviorUtil.addFightReady(user.getId(), nextEventId);
|
||||
int nextEventId = 0;
|
||||
// 战斗事件需要放到战斗胜利
|
||||
if (behaviorType != EventType.fight && behaviorType != EventType.fightAndDestroyPoint
|
||||
&& behaviorType != EventType.thirtyTwo && behaviorType != EventType.destroyPointAnd) {
|
||||
// 检测该事件点是否已被销毁
|
||||
nextEventId = getNextEventId(user, cell, sOptionConfig);
|
||||
if (cell != null && nextEventId != 0) {
|
||||
cell.setEventId(nextEventId);
|
||||
mapManager.addOrUpdateCell(cell.getCellId(), cell);
|
||||
}
|
||||
}
|
||||
// 检测该事件点是否已被销毁
|
||||
else if (cell != null && nextEventId != 0) {
|
||||
cell.setEventId(nextEventId);
|
||||
mapManager.addOrUpdateCell(cell.getCellId(), cell);
|
||||
}
|
||||
|
||||
updateMapMission(mapManager,EventType.updateOptionalEvent, optionId,0);
|
||||
updateMapMission(mapManager,EventType.updatePonintEvent, pointId,0);
|
||||
CommonProto.Drop.Builder dropBuilder = null;
|
||||
|
@ -557,6 +511,50 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
private int getNextEventId(User user, Cell cell, SOptionConfig sOptionConfig) throws Exception {
|
||||
int jumpType = sOptionConfig.getJumpType();
|
||||
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
||||
switch (jumpType) {
|
||||
// 1 无条件跳转,对应事件点
|
||||
// 6 无条件跳转地图id
|
||||
case 1:
|
||||
case 5:
|
||||
case 6:{
|
||||
return jumpTypeValues[0][0];
|
||||
}
|
||||
// 2 权重跳转,1001#1002|0.2#0.8
|
||||
case 2:
|
||||
case 7:
|
||||
case 9:{
|
||||
int ranom = MathUtils.randomInt(100) + 1;
|
||||
if (ranom >= jumpTypeValues[1][0]) {
|
||||
return jumpTypeValues[0][0];
|
||||
} else {
|
||||
return jumpTypeValues[0][1];
|
||||
}
|
||||
}
|
||||
// 3 条件跳转 1001#1002|0(0或1为和)#条件id#条件id
|
||||
case 3:
|
||||
case 8:
|
||||
case 10:{
|
||||
SOptionAddCondition sOptionAddConditions = SOptionAddCondition.sOptionAddConditionMap.get(jumpTypeValues[1][1]);
|
||||
if (sOptionAddConditions == null) {
|
||||
LOGGER.info("sOptionAddConditions == null jumpTypeValues[1][1]=>{}", jumpTypeValues[1][1]);
|
||||
return 0;
|
||||
}
|
||||
return getNextPoint(user, user.getMapManager(), jumpTypeValues, sOptionAddConditions);
|
||||
}
|
||||
// 4 不跳转,关闭界面
|
||||
case 4:{
|
||||
return cell.getEventId();
|
||||
}
|
||||
default:{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) throws Exception {
|
||||
int nextEventId = 0;
|
||||
switch (sOptionAddConditions.getType()) {
|
||||
|
@ -784,33 +782,14 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
String fightReadyKey = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid), false);
|
||||
String fightReady = (String) RedisUtil.getInstence().get(fightReadyKey);
|
||||
int groupId, destoryXY = 0;
|
||||
String missionId = "0", destroyId = "0", nextEventId = "0";
|
||||
if (fightReady != null) {
|
||||
String[] split = fightReady.split("#");
|
||||
RedisUtil.getInstence().del(fightReadyKey);
|
||||
groupId = Integer.parseInt(split[0]);
|
||||
if (split.length > 1) {
|
||||
missionId = split[1];
|
||||
}
|
||||
if (split.length > 2) {
|
||||
destroyId = split[2];
|
||||
}
|
||||
if (split.length > 3) {
|
||||
nextEventId = split[3];
|
||||
}
|
||||
} else {
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
groupId = option[0];
|
||||
destoryXY = mapManager.getTriggerXY();
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int groupId = option[0];
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, mapManager.getTeamId());
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(3);
|
||||
|
@ -880,6 +859,9 @@ public class MapLogic {
|
|||
// hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]);
|
||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(),HeroAttributeEnum.CurHP.getPropertyId(),checkResult[teamPosHeroInfo.getPosition()]);
|
||||
}
|
||||
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
|
||||
FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
|
||||
|
@ -887,28 +869,6 @@ public class MapLogic {
|
|||
fastFightResponse.setResult(resultCode);
|
||||
fastFightResponse.addAllRemainHpList(remainHp);
|
||||
fastFightResponse.build();
|
||||
if (!missionId.equals("0")) {
|
||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||
BehaviorUtil.updateMission(user, Integer.parseInt(missionId), eventUpdateResponse);
|
||||
fastFightResponse.setMission(eventUpdateResponse.getMission());
|
||||
if (eventUpdateResponse.getDrop() != null) {
|
||||
fastFightResponse.setMissionDrop(eventUpdateResponse.getDrop());
|
||||
}
|
||||
}
|
||||
if (!destroyId.equals("0")) {
|
||||
BehaviorUtil.destoryPoint(user, mapManager.getCurMapId(), Integer.parseInt(destroyId));
|
||||
}
|
||||
if (destoryXY != 0) {
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
}
|
||||
if (!nextEventId.equals("0")) {
|
||||
int triggerXY = mapManager.getTriggerXY();
|
||||
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
if (cell.getEventId() != -1) {
|
||||
cell.setEventId(Integer.parseInt(nextEventId));
|
||||
mapManager.addOrUpdateCell(triggerXY, cell);
|
||||
}
|
||||
}
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
updateMapMission(mapManager,EventType.fightEvent,0, groupId);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
|
@ -954,20 +914,14 @@ public class MapLogic {
|
|||
}
|
||||
String fightReadyKey = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid), false);
|
||||
String fightReady = (String) RedisUtil.getInstence().get(fightReadyKey);
|
||||
int groupId, destoryXY = 0;
|
||||
String missionId = "0", destroyId = "0", nextEventId = "0";
|
||||
int groupId;
|
||||
String pointId = "0";
|
||||
if (fightReady != null) {
|
||||
String[] split = fightReady.split("#");
|
||||
RedisUtil.getInstence().del(fightReadyKey);
|
||||
groupId = Integer.parseInt(split[0]);
|
||||
if (split.length > 1) {
|
||||
missionId = split[1];
|
||||
}
|
||||
if (split.length > 2) {
|
||||
destroyId = split[2];
|
||||
}
|
||||
if (split.length > 3) {
|
||||
nextEventId = split[3];
|
||||
pointId = split[1];
|
||||
}
|
||||
} else {
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
|
@ -977,10 +931,9 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
groupId = option[0];
|
||||
destoryXY = mapManager.getTriggerXY();
|
||||
}
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, missionId, destroyId, destoryXY, nextEventId);
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
|
@ -1090,32 +1043,25 @@ public class MapLogic {
|
|||
fightEndResponse.setResult(resultCode);
|
||||
fightEndResponse.addAllRemainHpList(remainHp);
|
||||
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));
|
||||
int nextEventId = Integer.parseInt((String)valueMap.get(RedisKey.NEXT_EVENT_ID));
|
||||
if (missionId != 0) {
|
||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||
BehaviorUtil.updateMission(user, missionId, eventUpdateResponse);
|
||||
fightEndResponse.setMission(eventUpdateResponse.getMission());
|
||||
if (eventUpdateResponse.getDrop() != null) {
|
||||
fightEndResponse.setMissionDrop(eventUpdateResponse.getDrop());
|
||||
int optionId = Integer.parseInt((String)valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||
if (sOptionConfig != null) {
|
||||
int behaviorType = sOptionConfig.getBehaviorType();
|
||||
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
||||
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||
if (baseBehavior != null) {
|
||||
baseBehavior.afterFight(user, behaviorTypeValues, fightEndResponse);
|
||||
}
|
||||
}
|
||||
if (destoryId != 0) {
|
||||
BehaviorUtil.destoryPoint(user, mapManager.getCurMapId(), destoryId);
|
||||
}
|
||||
if (destoryXY != 0) {
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
}
|
||||
if (nextEventId != 0) {
|
||||
int triggerXY = mapManager.getTriggerXY();
|
||||
Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
if (cell != null) {
|
||||
cell.setEventId(nextEventId);
|
||||
mapManager.addOrUpdateCell(triggerXY, cell);
|
||||
}
|
||||
int nextEventId = 0;
|
||||
int triggerXY = mapManager.getTriggerXY();
|
||||
Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
if (cell != null) {
|
||||
nextEventId = getNextEventId(user, cell, sOptionConfig);
|
||||
cell.setEventId(nextEventId);
|
||||
mapManager.addOrUpdateCell(triggerXY, cell);
|
||||
}
|
||||
fightEndResponse.setEventId(nextEventId);
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
updateMapMission(mapManager,EventType.fightEvent,0,monsterGroupId);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fightEndResponse.getMission(), fightEndResponse.getEnventDrop(), fightEndResponse.getMissionDrop());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -10,6 +11,9 @@ public abstract class BaseBehavior {
|
|||
|
||||
public abstract int getBehaviorType();
|
||||
|
||||
public abstract boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception;
|
||||
public abstract boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception;
|
||||
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.ljsd.jieling.handler.mission.Mission;
|
|||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
|
@ -78,13 +77,6 @@ public class BehaviorUtil {
|
|||
RedisUtil.getInstence().set(key, readyInfo, RedisKey.EXPIRE_TIME);
|
||||
}
|
||||
|
||||
public static void addFightReady(String uid, int nextEventId) {
|
||||
String key = RedisKey.getKey(RedisKey.FIGHT_READY, uid, false);
|
||||
String readyInfo = (String) RedisUtil.getInstence().get(key);
|
||||
readyInfo = readyInfo + "#" + nextEventId;
|
||||
RedisUtil.getInstence().set(key, readyInfo, RedisKey.EXPIRE_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取战斗数据
|
||||
* @param user
|
||||
|
@ -92,8 +84,7 @@ public class BehaviorUtil {
|
|||
* @param fightStartRespons
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String missionId,
|
||||
String destoryId, int destoryXY, String nextEventId) throws Exception {
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
int teamId = mapManager.getTeamId();
|
||||
|
@ -125,10 +116,7 @@ public class BehaviorUtil {
|
|||
}
|
||||
fightInfo.put(RedisKey.FIGHT_SEED,Integer.toString(seed));
|
||||
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));
|
||||
fightInfo.put(RedisKey.NEXT_EVENT_ID, nextEventId);
|
||||
fightInfo.put(RedisKey.NEED_VICTORY_AFTER, pointId);
|
||||
RedisUtil.getInstence().hmset(key, fightInfo, RedisKey.EXPIRE_TIME);
|
||||
|
||||
|
||||
|
@ -174,7 +162,7 @@ public class BehaviorUtil {
|
|||
/**
|
||||
* 更新任务
|
||||
*/
|
||||
public static boolean updateMission(User user, int missionId, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public static boolean updateMission(User user, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
Mission mission = user.getMapManager().getMission();
|
||||
if (mission == null) {
|
||||
return false;
|
||||
|
@ -190,6 +178,25 @@ public class BehaviorUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*/
|
||||
public static boolean updateMissionEndFight(User user, FightInfoProto.FightEndResponse.Builder fightEndResponseBuilder) throws Exception {
|
||||
Mission mission = user.getMapManager().getMission();
|
||||
if (mission == null) {
|
||||
return false;
|
||||
}
|
||||
CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(user);
|
||||
if (checkMissionReturn != null) {
|
||||
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(checkMissionReturn.mission);
|
||||
fightEndResponseBuilder.setMission(missionProto);
|
||||
if (checkMissionReturn.drop != null) {
|
||||
fightEndResponseBuilder.setMissionDrop(checkMissionReturn.drop);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁当前点
|
||||
* @param user
|
||||
|
@ -248,10 +255,6 @@ public class BehaviorUtil {
|
|||
}
|
||||
fightInfo.put(RedisKey.FIGHT_SEED,Integer.toString(seed));
|
||||
fightInfo.put(RedisKey.FIGHT_GROUPID, Integer.toString(groupId));
|
||||
fightInfo.put(RedisKey.NEED_MISSION_ID, Integer.toString(0));
|
||||
fightInfo.put(RedisKey.NEED_DESORY_ID, Integer.toString(0));
|
||||
fightInfo.put(RedisKey.NEED_DESORY_XY, Integer.toString(0));
|
||||
fightInfo.put(RedisKey.NEXT_EVENT_ID, Integer.toString(0));
|
||||
RedisUtil.getInstence().hmset(key, fightInfo, RedisKey.EXPIRE_TIME);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public class DestroyMissionBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
Mission mission = user.getMapManager().getMission();
|
||||
if (mission == null) {
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map.behavior;
|
|||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -13,10 +14,16 @@ public class DestroyPointAndBehavior 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]) + "#" + 0 + "#" + behaviorTypeValues[0][1];
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// readyInfo: optionId
|
||||
String readyInfo = Integer.toString(optionId);
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), behaviorTypeValues[0][1]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DestroyPointBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), behaviorTypeValues[0][0]);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class DunBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// boolean hasMission = MissionLogic.getInstance().hasMission(user, behaviorTypeValues[0][0]);
|
||||
// if (hasMission) {
|
||||
// return false;
|
||||
|
|
|
@ -15,7 +15,7 @@ public class EatBuffBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][0]);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map.behavior;
|
|||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -13,13 +14,17 @@ 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];
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// optionId
|
||||
String readyInfo = Integer.toString(optionId);
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
// 放在战斗胜利后
|
||||
// BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
// BehaviorUtil.distoryPoint(user, behaviorTypeValues[0][2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
BehaviorUtil.updateMissionEndFight(user, fightEndResponse);
|
||||
BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][2]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map.behavior;
|
|||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -13,9 +14,14 @@ public class FightBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
String readyInfo = Integer.toString(behaviorTypeValues[0][0]) + "#" + 0 + "#" + 0;
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.fightReady(user.getId(), Integer.toString(optionId));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
BehaviorUtil.destoryCurPoint(user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ public class FinishMissionBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean b = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean b = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class JumpBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
if (behaviorTypeValues[0][0] != 0) {
|
||||
user.getMapManager().setCurMapId(behaviorTypeValues[0][0]);
|
||||
user.getPlayerInfoManager().setMapId(behaviorTypeValues[0][0]);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class LeaveBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
int randomInt = MathUtils.randomInt(100) + 1;
|
||||
if (randomInt <= behaviorTypeValues[0][0]) {
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class MonitorMissionAndDestroyPointBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// 1#101011|101#13#18#101012|101#12#13#101009
|
||||
// BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
// 销毁事件点
|
||||
|
|
|
@ -15,8 +15,8 @@ public class MonitorMissionAndMoveBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
// 0的时候回城
|
||||
if (behaviorTypeValues[0][1] == 0) {
|
||||
MapLogic.getInstance().resetMapInfo(user, true);
|
||||
|
|
|
@ -13,8 +13,8 @@ public class MonitorMissionBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean b = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean b = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ public class OpenMissionBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
// 开新事件
|
||||
for (int i = 1; i < behaviorTypeValues.length; i++) {
|
||||
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class ScoutBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues);
|
||||
if (!isEnough) {
|
||||
return isEnough;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ThirtyBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
for (int i = 0; i < behaviorTypeValues.length; i++) {
|
||||
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ThirtyFourBehavior extends BaseBehavior {
|
||||
@Override
|
||||
public int getBehaviorType() {
|
||||
return EventType.thirtyFour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][0]);
|
||||
BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][1]);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
|
||||
public class ThirtyThreeBehavior extends BaseBehavior {
|
||||
@Override
|
||||
public int getBehaviorType() {
|
||||
return EventType.thirtyThree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId
|
||||
String readyInfo = Integer.toString(optionId);
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][1]);
|
||||
for (int i = 1; i < behaviorTypeValues.length; i++) {
|
||||
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ThirtyTwoBehavior extends BaseBehavior {
|
||||
@Override
|
||||
public int getBehaviorType() {
|
||||
return EventType.thirtyTwo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
// readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId
|
||||
String readyInfo = Integer.toString(optionId);
|
||||
BehaviorUtil.fightReady(user.getId(), readyInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
BehaviorUtil.updateMissionEndFight(user, fightEndResponse);
|
||||
BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][1]);
|
||||
for (int i = 1; i < behaviorTypeValues.length; i++) {
|
||||
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -13,8 +13,8 @@ public class TwentyFiveBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean flag = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean flag = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
// if (!flag) {
|
||||
// return flag;
|
||||
// }
|
||||
|
|
|
@ -16,7 +16,7 @@ public class TwentyFourBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
|
||||
for (Cell cell : mapInfos.values()) {
|
||||
if (cell.getPointId() == behaviorTypeValues[0][0]) {
|
||||
|
|
|
@ -14,7 +14,7 @@ public class TwentyNineBehavior extends BaseBehavior{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues);
|
||||
if (!isEnough) {
|
||||
return isEnough;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class UseItemAndDestroyBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues);
|
||||
if (!isEnough) {
|
||||
return isEnough;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class UseItemBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues);
|
||||
if (!isEnough) {
|
||||
return isEnough;
|
||||
|
|
|
@ -14,8 +14,8 @@ public class UseItemMissionBehavior extends BaseBehavior {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
int[][] userItem = new int[1][2];
|
||||
for (int i = 0; i < behaviorTypeValues[1].length; i++) {
|
||||
userItem[0][i] = behaviorTypeValues[1][i];
|
||||
|
|
Loading…
Reference in New Issue