Merge branch 'master' of 60.1.1.230:backend/jieling_server

back_recharge
wangyuan 2019-08-06 10:23:53 +08:00
commit bb3464a4fa
2 changed files with 26 additions and 22 deletions

View File

@ -910,13 +910,35 @@ public class MapLogic {
* @param messageType
* @throws Exception
*/
public void outMap(ISession session, int mapId,int outType, int curXY,MessageTypeProto.MessageType messageType) throws Exception {
public void outMap(ISession session, int mapId,int outType, int curXY,int targetMapId,MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager();
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
MapInfoProto.MapOutResponse.Builder builder = MapInfoProto.MapOutResponse.newBuilder();
//无尽副本
if(challengeConfig.getType()==4) {
mapManager.updateEndlessLocation(curXY);
if(outType==1){
mapManager.updateEndlessLocation(0);
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapId).getTeleportCost();
int costNum2 = SEndlessMapConfig.sEndlessMapConfigMap.get(targetMapId).getTeleportCost();
cost[0]= new int[]{costId,Math.abs(costNum-costNum2)};//Math.abs(costNum-costNum)
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
mapManager.setCurMapId(0);
mapManager.setCurXY(0);
mapManager.updateEndlessLocation(0);
if(!costResult){
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"行动力不足!");
return;
}
LOGGER.info("传送消耗{}行动力"+Math.abs(costNum-costNum2));
}
}
if(outType == 0||mapManager.getTower()-1==STrialConfig.getHighestTower()){
if(mapManager.getTowerUnusedBuffer()!=null){
mapManager.setTowerUnusedBuffer(new HashMap<>());
@ -964,26 +986,7 @@ public class MapLogic {
}
}
}
//无尽副本
if(challengeConfig.getType()==4) {
mapManager.updateEndlessLocation(curXY);
if(outType==1){
mapManager.setCurMapId(0);
mapManager.setCurXY(0);
mapManager.updateEndlessLocation(0);
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapId).getTeleportCost();
// int costNum2 = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getEndlessMapInfo().getCurMapId()).getTeleportCost();
cost[0]= new int[]{costId,costNum};//Math.abs(costNum-costNum)
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
if(!costResult){
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"行动力不足!");
return;
}
LOGGER.info("传送消耗{}行动力"+costNum);
}
}
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
return;
}

View File

@ -22,6 +22,7 @@ public class MapOutRequestHandler extends BaseHandler{
int mapId = mapOutRequest.getMapId();
int outType = mapOutRequest.getOutType();
int curXY = mapOutRequest.getCurXY();
MapLogic.getInstance().outMap(iSession, mapId,outType,curXY,MessageTypeProto.MessageType.MAP_OUT_RESPONSE);
int targetMapId = mapOutRequest.getTargetMapId();
MapLogic.getInstance().outMap(iSession, mapId,outType,curXY,targetMapId,MessageTypeProto.MessageType.MAP_OUT_RESPONSE);
}
}