任务没有就不推
parent
ffeb61578f
commit
e53a8fe6cd
|
@ -14,6 +14,7 @@ public class FinishMissionBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
return BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
boolean b = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public class MonitorMissionBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
return BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
boolean b = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ 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);
|
||||
if (!flag) {
|
||||
return flag;
|
||||
}
|
||||
// if (!flag) {
|
||||
// return flag;
|
||||
// }
|
||||
BehaviorUtil.destoryCurPoint(user);
|
||||
BehaviorUtil.changeOtherPoint(user, behaviorTypeValues[0][1], behaviorTypeValues[0][2]);
|
||||
return true;
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.mission.CheckMissionReturn;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.handler.mission.MissionLogic;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class UseItemMissionBehavior extends BaseBehavior {
|
||||
@Override
|
||||
|
@ -22,24 +15,15 @@ public class UseItemMissionBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
|
||||
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
|
||||
if (mission == null) {
|
||||
return false;
|
||||
}
|
||||
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
|
||||
int[][] userItem = new int[1][2];
|
||||
for (int i = 0; i < behaviorTypeValues[1].length; i++) {
|
||||
userItem[0][i] = behaviorTypeValues[1][i];
|
||||
}
|
||||
boolean checkCost = ItemUtil.itemCost(user, userItem);
|
||||
if (!checkCost || !mission.isOpen()) {
|
||||
if (!checkCost) {
|
||||
return false;
|
||||
}
|
||||
CheckMissionReturn checkMissionReturn = MissionLogic.getInstance().checkMission(mission, user);
|
||||
for (Mission cmission : checkMissionReturn.missions){
|
||||
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(cmission);
|
||||
eventUpdateResponse.addMission(missionProto);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue