无尽副本出图

back_recharge
lvxinran 2019-08-06 10:30:43 +08:00
parent c647d31458
commit 3558ad8ec0
6 changed files with 120 additions and 4 deletions

View File

@ -12,6 +12,10 @@ public class EndlessMapInfo {
private Map<Integer,Map<Integer,String>> mapSign;
private int fightCount;
private int consumeExecution;
public int getCurMapId() {
return curMapId;
}
@ -48,4 +52,20 @@ public class EndlessMapInfo {
this.endlessHeroInfo =new HashMap<>();
this.mapSign = new HashMap<>();
}
public int getFightCount() {
return fightCount;
}
public int getConsumeExecution() {
return consumeExecution;
}
public void setFightCount(int fightCount) {
this.fightCount = fightCount;
}
public void setConsumeExecution(int consumeExecution) {
this.consumeExecution = consumeExecution;
}
}

View File

@ -439,6 +439,7 @@ public class MapLogic {
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = cells.size();
mapManager.updateEndlessConsumeExecution(costNum);
cost[0]= new int[]{costId,costNum};
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
if(!costResult) {
@ -543,7 +544,8 @@ public class MapLogic {
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = cells.size();;
int costNum = cells.size();
mapManager.updateEndlessConsumeExecution(costNum);
cost[0]= new int[]{costId,costNum};
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
if(!costResult){
@ -926,7 +928,9 @@ public class MapLogic {
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)
int resultCost = Math.abs(costNum-costNum2);
mapManager.updateEndlessConsumeExecution(resultCost);
cost[0]= new int[]{costId,resultCost};//Math.abs(costNum-costNum)
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
mapManager.setCurMapId(0);
mapManager.setCurXY(0);
@ -1125,7 +1129,11 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "战斗异常!");
return;
}
int teamId = mapManager.getTeamId();
mapManager.setLastFightResult(resultCode);
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
mapManager.updateEndlessFightCount();
}
if (resultCode == 0) {
// 失败需要等待n秒后复活所有英雄
int dieCount = user.getMapManager().getDieCount();
@ -1161,7 +1169,6 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
return;
}
int teamId = mapManager.getTeamId();
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : team) {
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
@ -1341,10 +1348,12 @@ public class MapLogic {
mapManager.setLastFightResult(resultCode);
if (resultCode == 0) {
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
mapManager.updateEndlessFightCount();
//消耗行动力
int [][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
mapManager.updateEndlessConsumeExecution(costNum);
int [] cost1 = new int[]{costId,costNum};
cost[0] = cost1;
if(ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
@ -1409,6 +1418,7 @@ public class MapLogic {
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
}
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
mapManager.updateEndlessFightCount();
for (int i = 0 ; i <team.size();i++) {
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),checkResult[i+2]);
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
@ -2817,7 +2827,7 @@ public class MapLogic {
if(heroEntry.getValue().getLevel()<20){
continue;
}
int calHp = HeroLogic.getInstance().calHeroFinalAttributeWhenInMap(user, heroEntry.getValue(), true).get(1);
int calHp = HeroLogic.getInstance().calHeroFinalAttributeWhenInMap(user, heroEntry.getValue(), false).get(1);
if(!endlessHeroInfo.containsKey(heroEntry.getKey())){
mapManager.addEndlessHero(heroEntry.getKey(),calHp);
}
@ -2943,4 +2953,18 @@ public class MapLogic {
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}
/**
*
* @param session
* @param messageType
*/
public void endlessOutMapConsume(ISession session , MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
MapManager mapManager = user.getMapManager();
MapInfoProto.EndlessOutConsumeResponse.Builder response = MapInfoProto.EndlessOutConsumeResponse.newBuilder();
response.setFightCount(mapManager.getEndlessMapInfo().getFightCount());
response.setConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution());
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
}

View File

@ -727,6 +727,13 @@ public class MapManager extends MongoBase {
endlessMapInfo.getMapSign().get(mapId).remove(cellId);
removeString(getMongoKey()+".endlessMapInfo.mapSign."+mapId+"."+cellId);
}
public void updateEndlessFightCount(){
endlessMapInfo.setFightCount(1+endlessMapInfo.getFightCount());
updateString("endlessMapInfo.fightCount",endlessMapInfo.getFightCount());
}
public void updateEndlessConsumeExecution(int count){
endlessMapInfo.setFightCount(count+endlessMapInfo.getFightCount());
}
}

View File

@ -0,0 +1,21 @@
package com.ljsd.jieling.handler.map.mapHandler;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class EndlessOutMapConsumeHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
MapLogic.getInstance().endlessOutMapConsume(iSession, MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_RESPONSE);
}
}

View File

@ -0,0 +1,25 @@
package com.ljsd.jieling.handler.player;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.springframework.stereotype.Component;
@Component
public class GetPlayerOneTeamInfo extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] bytes = netData.parseClientProtoNetData();
PlayerInfoProto.GetPlayerOneTeamInfo info = PlayerInfoProto.GetPlayerOneTeamInfo.parseFrom(bytes);
info.getPlayerId();
PlayerLogic.getInstance().getOneTeamInfo(iSession, info.getPlayerId(), MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE);
}
}

View File

@ -328,4 +328,23 @@ public class PlayerLogic {
}
}
public void getOneTeamInfo(ISession session, int id,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(id);
PlayerManager playerManager = user.getPlayerInfoManager();
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
TeamPosManager teamPosManager = user.getTeamPosManager();
for (TeamPosHeroInfo heroInfo:teamPosManager.getTeamPosForHero().get(1)) {
int templateId = user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId();
team.addHeroTid(templateId);
}
CommonProto.PlayerTeamInfo.Builder playerTeamInfo = CommonProto.PlayerTeamInfo.newBuilder()
.setHead(1)
.setHeadFrame(playerManager.getHeadFrame())
.setName(playerManager.getNickName()).setUid(session.getUid()).setTeam(team);
for(TeamPosForPokenInfo posForPokenInfo:teamPosManager.getTeamPosForPoken().get(1)){
playerTeamInfo.addPokemonInfos(posForPokenInfo.getPokenId());
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),playerTeamInfo.build(),true);
}
}