Merge branch 'master' of 60.1.1.230:backend/jieling_server

back_recharge
wangyuan 2019-02-25 20:53:51 +08:00
commit 7684ffe7e0
5 changed files with 69 additions and 2 deletions

View File

@ -41,6 +41,10 @@ public class EventType {
* id
* 14
* id##id
* 15
* id
* 16
* id#num#id
*/
public static final int fight = 1;
public static final int useItem = 2;
@ -54,4 +58,6 @@ public class EventType {
public static final int openMission = 11;
public static final int finishMission = 13;
public static final int useItemMission = 14;
public static final int destroyPoint = 15;
public static final int useItemAndDestroy = 16;
}

View File

@ -365,7 +365,6 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
// 1 完成事件点即进度100%
nextPoint = getNextPoint(user, mapManager, jumpTypeValues, sOptionAddConditions);
break;
}
@ -417,6 +416,7 @@ public class MapLogic {
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) {
int nextPoint = 0;
switch (sOptionAddConditions.getType()) {
// 1 完成事件点即进度100%
case 1:{
int doneEvent = sOptionAddConditions.getValues()[0][0];
for (Cell cell1 : mapManager.getMapInfo().values()) {

View File

@ -0,0 +1,25 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.User;
import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class DestroyPointBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.destroyPoint;
}
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
mapInfo.remove(user.getMapManager().getCurXY());
user.getMapManager().setMapInfo(mapInfo);
return true;
}
}

View File

@ -0,0 +1,36 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.config.SItem;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.User;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.util.ItemUtil;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class UseItemAndDestroyBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.useItemAndDestroy;
}
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
SItem sItem = SItem.getsItemMap().get(behaviorTypeValues[0][0]);
boolean isEnough = ItemUtil.checkCost(user, sItem, behaviorTypeValues[0][1]);
if (!isEnough) {
return isEnough;
}
Map<Integer, Integer> useItems = new HashMap<>();
useItems.put(behaviorTypeValues[0][0], behaviorTypeValues[0][1]);
ItemUtil.useItem(user, useItems);
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
mapInfo.remove(user.getMapManager().getCurXY());
user.getMapManager().setMapInfo(mapInfo);
return true;
}
}

View File

@ -14,7 +14,7 @@ import java.util.Map;
public class UseItemBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.eatBuff;
return EventType.useItem;
}
@Override