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