森罗幻境未完成
parent
19ac577d2f
commit
402efe553c
|
|
@ -66,6 +66,8 @@ import util.TimeUtils;
|
|||
import util.CellUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MapLogic {
|
||||
|
||||
|
|
@ -1275,442 +1277,6 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速战斗
|
||||
* <p>
|
||||
* // * @param session
|
||||
* // * @param messageType
|
||||
*/
|
||||
// public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// if (mapManager.getMapInfo() == null) {
|
||||
// LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// if (mapManager.getCanMoveTime() > 0) {
|
||||
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
||||
// if (leftTime > 0) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
||||
// }
|
||||
// }
|
||||
// Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
// if (cell == null) {
|
||||
// cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
// if (cell == null) {
|
||||
// LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
// int bigEventId = cell.getEventId();
|
||||
// SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||
// if (sEventPointConfig == null) {
|
||||
// LOGGER.info("sEventPointConfig == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// int[] option = sEventPointConfig.getOption();
|
||||
// if (option == null) {
|
||||
// LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// int groupId = option[0];
|
||||
//
|
||||
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
// int mostTime = sChallengeConfig.getMostTime();
|
||||
// PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
|
||||
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
// long[] checkResult = fightResult.getCheckResult();
|
||||
//
|
||||
// List<Long> remainHp = fightResult.getRemainHp();
|
||||
// //校验结果码 1:胜利
|
||||
// int resultCode = (int) checkResult[0];
|
||||
// if (resultCode == -1) {
|
||||
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
// }
|
||||
// int teamId = mapManager.getTeamId();
|
||||
// mapManager.setLastFightResult(resultCode);
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
// mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||
// }
|
||||
// if (resultCode == 0) {
|
||||
// //todo 无尽副本不复活记得改回去
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||
//// //无尽副本复活消耗
|
||||
// reviveConsumeExecution(user);
|
||||
// for(Map.Entry<String, Map<Integer, Long>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
|
||||
// mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
|
||||
// mapManager.updateEndlessHeroHp(entry.getKey(),0);
|
||||
// }
|
||||
// }else {
|
||||
// // 失败需要等待n秒后复活所有英雄
|
||||
// int dieCount = user.getMapManager().getDieCount();
|
||||
// dieCount++;
|
||||
// user.getMapManager().setDieCount(dieCount);
|
||||
// int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||
// long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||
// user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||
// int leftTime = getLeftTime(user, true);
|
||||
// remainHp.clear();
|
||||
// if (leftTime <= (int) (time / 1000)) {
|
||||
// resetMapInfo(user, false);
|
||||
// } else {
|
||||
// initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
|
||||
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
// if (hero == null) {
|
||||
// continue;
|
||||
// }
|
||||
// Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
// remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
// FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
|
||||
// .newBuilder()
|
||||
// .setResult(resultCode)
|
||||
// .setEnventDrop(dropBuilder)
|
||||
//// .addAllRemainHpList(remainHp)
|
||||
// .setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
// .setLastXY(mapManager.getLastXY())
|
||||
// .build();
|
||||
// mapManager.setCurXY(mapManager.getLastXY());
|
||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
||||
// return;
|
||||
//
|
||||
// }
|
||||
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
// for (int i = 0 ; i <team.size();i++) {
|
||||
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
||||
// Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
||||
// int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
||||
// if(checkResult[i+2]>0&&per<=0){
|
||||
// per = 1;
|
||||
// }
|
||||
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
||||
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[i+2]);
|
||||
// }
|
||||
//
|
||||
// }else{
|
||||
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
// mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// int destoryXY = mapManager.getTriggerXY();
|
||||
//// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||
//// endlessRefreshMonster(session,destoryXY);
|
||||
//// }
|
||||
// //删点之前进行查找
|
||||
// if (sChallengeConfig.getType() == 2) {
|
||||
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
// if(cell.getCellId()!=mapManager.getBossXY()){
|
||||
// if(mapManager.getTrialInfo().getEnergy()!=-1){
|
||||
// mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
// SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 0, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
// FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
|
||||
//
|
||||
// if (mapManager.getMonsterId() > 0) {
|
||||
// BaseBehavior baseBehavior = baseBehaviorMap.get(10);
|
||||
// baseBehavior.afterFastFight(user, groupId, fastFightResponse);
|
||||
// }
|
||||
// fastFightResponse.setEnventDrop(drop.build());
|
||||
// fastFightResponse.setResult(resultCode);
|
||||
//// fastFightResponse.addAllRemainHpList(remainHp);
|
||||
// fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
// fastFightResponse.build();
|
||||
//
|
||||
//
|
||||
// fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
//// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
// MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, (int) checkResult[1]);
|
||||
//// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fastFightResponse.build(), true);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 开始战斗
|
||||
// *
|
||||
// * @param session
|
||||
// * @param messageType
|
||||
// */
|
||||
// public void startFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// if (mapManager.getMapInfo() == null) {
|
||||
// LOGGER.info("mapManager.getMapInfo() == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// if (mapManager.getCanMoveTime() > 0) {
|
||||
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
||||
// if (leftTime > 0) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
||||
// }
|
||||
// }
|
||||
// Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
// if (cell == null) {
|
||||
// cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
// if (cell == null) {
|
||||
// LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("cell == null"));
|
||||
// }
|
||||
// }
|
||||
// int bigEventId = cell.getEventId();
|
||||
// SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||
// if (sEventPointConfig == null) {
|
||||
// LOGGER.info("sEventPointConfig == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// String fightReadyKey = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid), false);
|
||||
// String fightReady = (String) RedisUtil.getInstence().get(fightReadyKey);
|
||||
// int groupId;
|
||||
// String pointId = "0";
|
||||
// if (fightReady != null) {
|
||||
// String[] split = fightReady.split("#");
|
||||
// RedisUtil.getInstence().del(fightReadyKey);
|
||||
// groupId = Integer.parseInt(split[0]);
|
||||
// if(getDifficultyMonster().containsKey(groupId)){
|
||||
// groupId = getDifficultyMonster().get(groupId);
|
||||
// }
|
||||
// if (split.length > 1) {
|
||||
// pointId = split[1];
|
||||
// }
|
||||
// } else {
|
||||
// int[] option = sEventPointConfig.getOption();
|
||||
// if (option == null||option.length<1) {
|
||||
// LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// groupId = option[0];
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||
// if(getDifficultyMonster().containsKey(groupId)){
|
||||
// groupId = getDifficultyMonster().get(groupId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
// LOGGER.info("EventId为{},groupId为{}",bigEventId,groupId);
|
||||
// BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId, sChallengeConfig.getMostTime(), true);
|
||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
// }
|
||||
|
||||
|
||||
// public void endFight(ISession session, String frames, MessageTypeProto.MessageType messageType,int dropout) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// String key = RedisKey.getKey(RedisKey.FIGHT, Integer.toString(uid), false);
|
||||
// Map<Object, Object> valueMap = RedisUtil.getInstence().hmget(key);
|
||||
// if (valueMap == null || valueMap.isEmpty()) {
|
||||
// LOGGER.info("endFight() uid=>{} not start fight", uid);
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("此战斗已结算过"));
|
||||
// }
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// if (user.getMapManager().getCanMoveTime() > 0) {
|
||||
// long leftTime = user.getMapManager().getCanMoveTime() - TimeUtils.now();
|
||||
// if (leftTime > 0) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<Integer> remainHp = new ArrayList<>(5);
|
||||
// int triggerXY = mapManager.getTriggerXY();
|
||||
// int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||
// int nextEventId = 0;
|
||||
// SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
// //校验结果码 1:胜利
|
||||
// int resultCode=0;
|
||||
// int[] checkResult = new int[0];
|
||||
// int monsterGroupId=0;
|
||||
// SMonsterGroup sMonsterGroup=null;
|
||||
// if(dropout ==0){
|
||||
// monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||
// sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
// int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
||||
// FightEvent fightEvent = new FightEvent(uid, -1, mostTime,frames, GameFightType.MapEndFight);
|
||||
// FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||
// //校验结果码 1:胜利
|
||||
// checkResult = fightResult.getCheckResult();
|
||||
// resultCode = checkResult[0];
|
||||
// if (resultCode == -1) {
|
||||
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// mapManager.setLastFightResult(resultCode);
|
||||
// if (resultCode == 0) {
|
||||
// //todo 无尽副本复活
|
||||
// if (SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType() == 4) {
|
||||
// //无尽副本复活消耗
|
||||
// reviveConsumeExecution(user);
|
||||
// for (Map.Entry<String, Map<Integer, Integer>> entry : mapManager.getHeroAllAttributeMap().entrySet()) {
|
||||
// mapManager.updateHeroOneAttribute(entry.getKey(), HeroAttributeEnum.CurHP.getPropertyId(), 0);
|
||||
// mapManager.updateEndlessHeroHp(entry.getKey(), 0);
|
||||
// }
|
||||
// } else {
|
||||
// // 失败需要等待n秒后复活所有英雄
|
||||
// int dieCount = user.getMapManager().getDieCount();
|
||||
// dieCount++;
|
||||
// user.getMapManager().setDieCount(dieCount);
|
||||
// int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||
// long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||
// user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||
// int leftTime = getLeftTime(user, true);
|
||||
// remainHp.clear();
|
||||
// if (leftTime <= (int) (time / 1000)) {
|
||||
// resetMapInfo(user, false);
|
||||
// } else {
|
||||
// initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
|
||||
// Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
// if (hero == null) {
|
||||
// continue;
|
||||
// }
|
||||
// remainHp.add(heroAllAttributeMap.get(hero.getId()).get(HeroAttributeEnum.CurHP.getPropertyId()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
// FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse
|
||||
// .newBuilder();
|
||||
// fightEndResponse.setResult(resultCode);
|
||||
// fightEndResponse.setEnventDrop(dropBuilder);
|
||||
// fightEndResponse.addAllRemainHpList(remainHp);
|
||||
// fightEndResponse.setLastXY(mapManager.getLastXY());
|
||||
// mapManager.setCurXY(mapManager.getLastXY());
|
||||
// if(mapManager.getCurMapId()!=0){
|
||||
// if (SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType() == 2) {
|
||||
// fightEndResponse.setLastTowerTime((int) (mapManager.getCurrTowerTime() / 1000));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (sOptionConfig != null) {
|
||||
// int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
||||
// if (jumpTypeValues.length > 0 && sOptionConfig.getJumpType() == 3) {
|
||||
// SOptionAddCondition sOptionAddConditions = SOptionAddCondition.sOptionAddConditionMap.get(jumpTypeValues[1][1]);
|
||||
// if (sOptionAddConditions != null && sOptionAddConditions.getType() == 7) {
|
||||
// Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
// if (cell != null) {
|
||||
// nextEventId = getNextEventId(user, cell, sOptionConfig);
|
||||
// cell.setEventId(nextEventId);
|
||||
// mapManager.addOrUpdateCell(triggerXY, cell);
|
||||
// fightEndResponse.setEventId(nextEventId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
// return;
|
||||
// }
|
||||
// for (int i = 2; i < checkResult.length; i++) {
|
||||
// if (checkResult[i] <= 0) {
|
||||
// remainHp.add(0);
|
||||
// } else {
|
||||
// remainHp.add(checkResult[i]);
|
||||
// }
|
||||
// }
|
||||
// int teamId = mapManager.getTeamId();
|
||||
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
// mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
// if(checkResult[0]>0){
|
||||
// for (int i = 0 ; i <team.size();i++) {
|
||||
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
||||
// Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
||||
// int per =(int) (checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
||||
// if(checkResult[i+2]>0&&per<=0){
|
||||
// per = 1;
|
||||
// }
|
||||
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
||||
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
|
||||
// }
|
||||
// }
|
||||
//// if(!cacheRemove.isEmpty()){
|
||||
//// Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||
//// while (iterator.hasNext()){
|
||||
//// TeamPosHeroInfo next = iterator.next();
|
||||
//// if(cacheRemove.contains(next.getHeroId())){
|
||||
//// if(mapManager.getHeroAllAttributeMap().containsKey(next.getHeroId())){
|
||||
//// mapManager.removeOneHeroAttribute(next.getHeroId());
|
||||
//// }
|
||||
//// iterator.remove();
|
||||
//// }
|
||||
//// }
|
||||
//// user.getTeamPosManager().updateTeamPosByTeamId(teamId,team);
|
||||
//// }
|
||||
// }else{
|
||||
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
// mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
// }
|
||||
// }
|
||||
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_GENERAL_FIGHT_REWARD);
|
||||
// FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||
// fightEndResponse.setEnventDrop(drop.build());
|
||||
// fightEndResponse.setResult(resultCode);
|
||||
// fightEndResponse.addAllRemainHpList(remainHp);
|
||||
// fightEndResponse.build();
|
||||
//
|
||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||
// endlessRefreshMonster(session,triggerXY);
|
||||
// }
|
||||
// if (sOptionConfig != null) {
|
||||
// int behaviorType = sOptionConfig.getBehaviorType();
|
||||
// int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
||||
// BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||
// if (baseBehavior != null) {
|
||||
// baseBehavior.afterFight(user, behaviorTypeValues, fightEndResponse);
|
||||
// }
|
||||
// }else{
|
||||
// BehaviorUtil.destoryApointXY(user,triggerXY);
|
||||
// }
|
||||
//
|
||||
// if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
||||
// mapManager.findSuddenlyBoss(0, 0);
|
||||
//
|
||||
// }else{
|
||||
// if(sOptionConfig!=null){
|
||||
// Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
// if (cell != null ) {
|
||||
// nextEventId = getNextEventId(user, cell, sOptionConfig);
|
||||
// cell.setEventId(nextEventId);
|
||||
// mapManager.addOrUpdateCell(triggerXY, cell);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// fightEndResponse.setEventId(nextEventId);
|
||||
//// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
// MapMissionManager.updateMapMission(user, EventType.fightEvent, monsterGroupId, checkResult[1]);
|
||||
//// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fightEndResponse.getMission(), fightEndResponse.getEnventDrop(), fightEndResponse.getMissionDrop());
|
||||
// if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
||||
// mapManager.findSuddenlyBoss(0, 0);
|
||||
// }
|
||||
//// if(mapManager.getBossType()==1)
|
||||
// if(mapManager.getTrialInfo().getFloor()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
//
|
||||
// int time = (int)((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
// mapManager.setCurrTowerTime(time*1000);
|
||||
// LOGGER.info("此层为最后一层,使用时间为{}",time);
|
||||
// fightEndResponse.setLastTowerTime(time);
|
||||
// }else{
|
||||
// fightEndResponse.setLastTowerTime(0);
|
||||
// }
|
||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
// }
|
||||
public void initMapMission(MapManager mapManager) {
|
||||
int mapId = mapManager.getCurMapId();
|
||||
if (mapManager.getCopyMissionProgresById(mapId) != null) {
|
||||
|
|
@ -2416,22 +1982,22 @@ public class MapLogic {
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
|
||||
String stringValue = SSpecialConfig.getStringValue(SSpecialConfig.DISCOUNT_MONSTER_LEVEL);
|
||||
if (stringValue != null && !stringValue.isEmpty()) {
|
||||
String[] split1 = stringValue.split("\\|");
|
||||
String[] split2 = split1[0].split("#");
|
||||
boolean ifTreer = false;
|
||||
if (checkFightId > Integer.parseInt(split2[split2.length - 1])) {
|
||||
if (checkFightId % Integer.parseInt(split1[1]) == 0) {
|
||||
ifTreer = true;
|
||||
}
|
||||
} else {
|
||||
List<String> strings = Arrays.asList(split2);
|
||||
if (strings.contains(Integer.toString(checkFightId))) {
|
||||
ifTreer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// String stringValue = SSpecialConfig.getStringValue(SSpecialConfig.DISCOUNT_MONSTER_LEVEL);
|
||||
// if (stringValue != null && !stringValue.isEmpty()) {
|
||||
// String[] split1 = stringValue.split("\\|");
|
||||
// String[] split2 = split1[0].split("#");
|
||||
// boolean ifTreer = false;
|
||||
// if (checkFightId > Integer.parseInt(split2[split2.length - 1])) {
|
||||
// if (checkFightId % Integer.parseInt(split1[1]) == 0) {
|
||||
// ifTreer = true;
|
||||
// }
|
||||
// } else {
|
||||
// List<String> strings = Arrays.asList(split2);
|
||||
// if (strings.contains(Integer.toString(checkFightId))) {
|
||||
// ifTreer = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
List<CommonProto.Item> itemDrop = drop.getItemlistList();
|
||||
List<Integer> itemIdList = new ArrayList<>();
|
||||
List<Integer> itemNumList = new ArrayList<>();
|
||||
|
|
@ -2648,7 +2214,11 @@ public class MapLogic {
|
|||
|
||||
//GM调用
|
||||
public void setTower(int uid, int towerNumber) throws Exception {
|
||||
UserManager.getUser(uid).getMapManager().setTrialFloor(towerNumber);
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.setTrialFloor(towerNumber);
|
||||
mapManager.setHighestFloor(towerNumber);
|
||||
MapEnum.getToAbstractMap(1).initMap(user.getMapManager(), user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3001,6 +2571,7 @@ public class MapLogic {
|
|||
}
|
||||
trialInfo.setBuffIds(initBuff);
|
||||
trialInfo.setFloor(trialInfo.getHighestTower() - 7 > 1 ? trialInfo.getHighestTower() - 7 : 1);
|
||||
trialInfo.setCleanFloor(trialInfo.getHighestTower() - 2 > 0 ? trialInfo.getHighestTower() - 2 : 0);
|
||||
trialInfo.setKillCount(0);
|
||||
trialInfo.setBombUseTimes(0);
|
||||
trialInfo.setTowerReceivedReward(new HashSet<>());
|
||||
|
|
@ -3063,53 +2634,6 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽小怪打死随机刷新
|
||||
* @param session
|
||||
* @param triggerXY
|
||||
* @throws Exception
|
||||
*/
|
||||
// public void endlessRefreshMonster(ISession session,int triggerXY) throws Exception {
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
// MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
|
||||
// if(mapPointConfig.getStyle()==1){
|
||||
// Map<Integer, SCMap> map= SCMap.sCMap.get(mapManager.getCurMapId());
|
||||
// List<Integer> points = new ArrayList<>();
|
||||
// for(Map.Entry<Integer, SCMap> entry:map.entrySet()){
|
||||
// if(entry.getValue().getEvent()!=cell.getPointId()){
|
||||
// continue;
|
||||
// }
|
||||
// boolean flagToAddMonster = true;
|
||||
// int[][] groups = entry.getValue().getGroups();
|
||||
// for(int i = 0;i<groups.length;i++){
|
||||
// if(mapManager.getMapInfo().get(CellUtil.xy2Pos(groups[i][0],groups[i][1]))==null){
|
||||
// continue;
|
||||
// }
|
||||
// if(mapManager.getMapInfo().get(CellUtil.xy2Pos(groups[i][0],groups[i][1])).getPointId()!=0){
|
||||
// flagToAddMonster = false;
|
||||
// }
|
||||
// }
|
||||
// if(flagToAddMonster){
|
||||
// for(int i = 0;i<groups.length;i++){
|
||||
// points.add(CellUtil.xy2Pos(groups[i][0], groups[i][1]));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (points.size()>0){
|
||||
// //无尽副本随机空地刷新小怪
|
||||
// int cellPos = points.get(MathUtils.randomInt(points.size()));
|
||||
// Cell addCell = new Cell(cellPos,mapPointConfig.getInitialEventId(),mapPointConfig.getId());
|
||||
// LOGGER.info("刷新位置为{},{}",CellUtil.pos2XY(cellPos)[0],CellUtil.pos2XY(cellPos)[1]);
|
||||
// mapManager.addOrUpdateCell(cellPos,addCell);
|
||||
// MapInfoProto.RefreshMonsterResponse monsterResponse = MapInfoProto.RefreshMonsterResponse.newBuilder().addCell(CBean2Proto.getCell(addCell)).build();
|
||||
// MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ENDLESS_MONSTER_REFRESH_INDICATION_VALUE,monsterResponse,true);
|
||||
// }
|
||||
// BehaviorUtil.destoryApointXY(user, triggerXY);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置无尽副本是否跳过战斗
|
||||
*
|
||||
|
|
@ -3355,7 +2879,8 @@ public class MapLogic {
|
|||
* @param boxPosition
|
||||
* @param boxReward
|
||||
* @param user
|
||||
* @param curXY
|
||||
* @param curXY 坐标信息,获取全部奖励是不使用
|
||||
* @param type 0:获取单个宝箱奖励,1:获取指定层全部奖励
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
@ -3577,4 +3102,106 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 森罗幻境扫荡
|
||||
* @param iSession
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
public void cleanTrialMap(ISession iSession) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
MapManager manager = user.getMapManager();
|
||||
TrialInfo trialInfo = manager.getTrialInfo();
|
||||
//是否是可以扫荡的层数
|
||||
int floor = trialInfo.getFloor();
|
||||
// if (floor > trialInfo.getCleanFloor()){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"当前层数无法扫荡");
|
||||
// }
|
||||
// 事件点
|
||||
Map<Integer, List<Cell>> eventMap = manager.getTrialInfo().getEventMap();
|
||||
if (eventMap.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"当前层数无法扫荡或者已经扫荡过");
|
||||
}
|
||||
|
||||
// 数据包信息
|
||||
Map<Integer, SEventPointConfig> eventPointConfig = STableManager.getConfig(SEventPointConfig.class);
|
||||
Collection<Cell> cells = manager.getMapInfo().values();
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
|
||||
// 宝箱
|
||||
List<Cell> boxCell = eventMap.getOrDefault(2, new ArrayList<>());
|
||||
for (Cell cell : boxCell) {
|
||||
if (!cells.contains(cell)){
|
||||
continue;
|
||||
}
|
||||
List<int[][]> reward = Arrays.asList(STrialConfig.sTrialConfigMap.get(floor).getBoxReward());
|
||||
ItemUtil.drop(user, reward, drop, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
// 清理路径点
|
||||
BehaviorUtil.destoryApointXY(user, cell.getCellId());
|
||||
}
|
||||
|
||||
// buff
|
||||
List<Integer> buffIds = manager.getTrialInfo().getBuffIds();
|
||||
List<Cell> buffCell = eventMap.getOrDefault(3, new ArrayList<>());
|
||||
for (Cell cell : buffCell) {
|
||||
if (!cells.contains(cell)){
|
||||
continue;
|
||||
}
|
||||
cell = manager.getMapInfo().get(cell.getCellId());
|
||||
int optionId = eventPointConfig.get(cell.getEventId()).getOption()[0];
|
||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||
for (int[] values : sOptionConfig.getBehaviorTypeValues()) {
|
||||
for (int value : values) {
|
||||
buffIds.add(value);
|
||||
}
|
||||
}
|
||||
manager.updateTrialBuffIds(buffIds);
|
||||
BehaviorUtil.destoryApointXY(user, cell.getCellId());
|
||||
}
|
||||
|
||||
// 怪物
|
||||
List<Cell> monsterCell = eventMap.getOrDefault(1, new ArrayList<>());
|
||||
for (Cell cell : monsterCell) {
|
||||
if (!cells.contains(cell)){
|
||||
continue;
|
||||
}
|
||||
SEventPointConfig pointConfig = eventPointConfig.get(cell.getEventId());
|
||||
if (pointConfig != null){
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(pointConfig.getOption()[0]);
|
||||
if (sMonsterGroup != null){
|
||||
ItemUtil.drop(user, new int[][]{sMonsterGroup.getRewardgroup()}, drop, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
// 清理路径点
|
||||
BehaviorUtil.destoryApointXY(user, cell.getCellId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 小游戏
|
||||
List<Cell> gameCell = eventMap.getOrDefault(4, new ArrayList<>());
|
||||
for (Cell cell : gameCell) {
|
||||
if (!cells.contains(cell)){
|
||||
continue;
|
||||
}
|
||||
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
|
||||
if (mapPointConfig != null){
|
||||
MapGame mapGame = baseGameMap.get(mapPointConfig.getStyle());
|
||||
if (mapGame != null) {
|
||||
mapGame.initGame(user);
|
||||
mapGame.updateGameByClean(user, drop);
|
||||
// 清理路径点
|
||||
BehaviorUtil.destoryApointXY(user, cell.getCellId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 生成传送门
|
||||
manager.setTrialEnergy(-2);
|
||||
Cell transport = TowerMap.createTransport(trialInfo.getFloor());
|
||||
manager.addOrUpdateCell(transport.getCellId(),transport);
|
||||
|
||||
manager.clearTrialEventMap();
|
||||
|
||||
MapInfoProto.TowerCleanFloorResponse.Builder builder = MapInfoProto.TowerCleanFloorResponse.newBuilder().setDrop(drop);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TOWER_CLEAN_FLOOR_RESPONSE_VALUE, builder.build(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -824,6 +824,17 @@ public class MapManager extends MongoBase {
|
|||
trialInfo.setMapInfo(mapInfo);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
|
||||
public void updateEventMap(Map<Integer, List<Cell>> eventMap){
|
||||
trialInfo.setEventMap(eventMap);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
|
||||
public void clearTrialEventMap(){
|
||||
trialInfo.getEventMap().clear();
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
|
||||
public void updateTrialExitMapId(int mapId){
|
||||
trialInfo.setQuitMapId(mapId);
|
||||
updateString("trialInfo",trialInfo);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,16 @@ public class TrialInfo extends MongoBase {
|
|||
|
||||
private Map<Integer, Cell> mapInfo = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 事件点存储
|
||||
* key:
|
||||
* 1:怪物
|
||||
* 2:宝箱
|
||||
* 3:buff
|
||||
* 4:小游戏
|
||||
*/
|
||||
private Map<Integer, List<Cell>> eventMap = new HashMap<>();
|
||||
|
||||
private int killCount;
|
||||
|
||||
private Set<Integer> towerReceivedReward = new HashSet<>();
|
||||
|
|
@ -37,11 +47,30 @@ public class TrialInfo extends MongoBase {
|
|||
|
||||
private MapGameInfo mapGameInfo = new MapGameInfo();
|
||||
|
||||
|
||||
private int bombUseTimes;
|
||||
|
||||
private Map<Integer,List<Long>> monsterHp = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 此层数(含本层)以下的层可以进行一键扫荡
|
||||
*/
|
||||
private int cleanFloor;
|
||||
|
||||
public int getCleanFloor() {
|
||||
return cleanFloor;
|
||||
}
|
||||
|
||||
public void setCleanFloor(int cleanFloor) {
|
||||
this.cleanFloor = cleanFloor;
|
||||
}
|
||||
|
||||
public Map<Integer, List<Cell>> getEventMap() {
|
||||
return eventMap;
|
||||
}
|
||||
|
||||
public void setEventMap(Map<Integer, List<Cell>> eventMap) {
|
||||
this.eventMap = eventMap;
|
||||
}
|
||||
|
||||
public Set<Integer> getTowerReceivedReward() {
|
||||
return towerReceivedReward;
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
@Component
|
||||
public class FightEndRequestHandler extends BaseHandler {
|
||||
|
|
@ -24,31 +24,28 @@ public class FightEndRequestHandler extends BaseHandler {
|
|||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
FightInfoProto.FightEndRequest fightEndRequest = FightInfoProto.FightEndRequest.parseFrom(message);
|
||||
// int monsterGroupId = fightEndRequest.getMonsterGroupId();
|
||||
String frames = fightEndRequest.getFrames();
|
||||
int type = fightEndRequest.getType();
|
||||
int fightId = fightEndRequest.getFightId();
|
||||
if (type == 1){
|
||||
//MapLogic.getInstance().endDifficultyFight(iSession, frames,fightId,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}
|
||||
else if(type == 2){
|
||||
int dropout = fightEndRequest.getDropout();
|
||||
FightInfoProto.FightEndResponse.Builder builder = FightInfoProto.FightEndResponse.newBuilder();
|
||||
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).endFight(iSession.getUid(),frames, builder,dropout);
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
else if(type == 3){
|
||||
MapLogic.getInstance().endSuddlenlyFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 5){
|
||||
MapLogic.getInstance().endMonsterAttackFight(iSession, frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 6){
|
||||
MapLogic.getInstance().endMainLevelFight(iSession, frames,fightId,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 7){
|
||||
GuildFightLogic.endBossFight(iSession,frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
} else {
|
||||
// MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong"));
|
||||
switch (type){
|
||||
case 2:
|
||||
FightInfoProto.FightEndResponse.Builder builder = FightInfoProto.FightEndResponse.newBuilder();
|
||||
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).endFight(iSession.getUid(),frames, builder,fightEndRequest.getDropout());
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
break;
|
||||
case 3:
|
||||
MapLogic.getInstance().endSuddlenlyFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
break;
|
||||
case 5:
|
||||
MapLogic.getInstance().endMonsterAttackFight(iSession, frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
break;
|
||||
case 6:
|
||||
MapLogic.getInstance().endMainLevelFight(iSession, frames, fightEndRequest.getFightId(), MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
break;
|
||||
case 7:
|
||||
GuildFightLogic.endBossFight(iSession,frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
break;
|
||||
default:
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import com.ljsd.jieling.handler.map.mapType.AbstractMap;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
@Component
|
||||
public class MapOutRequestHandler extends BaseHandler{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.map.mapHandler;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 森罗幻境扫荡
|
||||
*/
|
||||
@Component
|
||||
public class TowerCleanFloorHandler extends BaseHandler<MapInfoProto.TowerCleanFloorRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.TOWER_CLEAN_FLOOR_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, MapInfoProto.TowerCleanFloorRequest proto) throws Exception {
|
||||
MapLogic.getInstance().cleanTrialMap(iSession);
|
||||
}
|
||||
}
|
||||
|
|
@ -144,16 +144,8 @@ public abstract class AbstractMap implements IMap {
|
|||
LOGGER.info("当前层使用时间{}",time);
|
||||
//清除副本中增加的怪物被动技能
|
||||
user.getMapManager().removeMonsterTempSkill();
|
||||
// if(outType==0){
|
||||
MapLogic.getInstance().onlyLevelMap(user, true);
|
||||
// if (!result) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// public AbstractMap(int type){
|
||||
// this.type = type;
|
||||
// }
|
||||
|
||||
public void enterNewMap(User user,int mapId,int teamId,MapInfoProto.MapEnterResponse.Builder mapEnterResponse)throws Exception{
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.map.mapType;
|
||||
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
|
@ -25,18 +24,22 @@ import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
|||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.TowerRankUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import util.CellUtil;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -84,7 +87,6 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.setCurXY(trialInfo.getCurXY());
|
||||
}else{
|
||||
//进新图
|
||||
// super.enterMap(uid,mapEnterResponse);
|
||||
initMap(mapManager,user);
|
||||
}
|
||||
}
|
||||
|
|
@ -155,19 +157,8 @@ public class TowerMap extends AbstractMap {
|
|||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||
mapManager.setCurXY(xy);
|
||||
}
|
||||
mapEnterResponse.setTowerCleanFloor(trialInfo.getCleanFloor());
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
// MapInfoProto.TowerCopyInfo towerCopyInfo = MapInfoProto.TowerCopyInfo.newBuilder()
|
||||
// .setTower(mapManager.getTrialInfo().getFloor())
|
||||
// .setFightCount(mapManager.getFightCount())
|
||||
// .setHighestTower(mapManager.getTrialInfo().getHighestTower())
|
||||
// .setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
// .setMapIntoReset(mapManager.getMapIntoFlag())
|
||||
// .setTowerUseTime((int)(mapManager.getCurrTowerTime()/1000))
|
||||
// .setKillCount(mapManager.getTrialInfo().getKillCount())
|
||||
// .addAllTrialRewardInfo(mapManager.getTrialInfo().getTowerReceivedReward())
|
||||
// .setBombUsed(mapManager.getTrialInfo().getBombUseTimes())
|
||||
// .build();
|
||||
// mapEnterResponse.setTowerInfo(towerCopyInfo);
|
||||
mapEnterResponse.setCurTower(trialInfo.getFloor());
|
||||
mapEnterResponse.setBombUsed(trialInfo.getBombUseTimes());
|
||||
mapEnterResponse.setEssenceValue(trialInfo.getEnergy());
|
||||
|
|
@ -178,16 +169,7 @@ public class TowerMap extends AbstractMap {
|
|||
@Override
|
||||
public void enterNewMap(User user, int mapId,int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterNewMap(user, mapId, teamId,mapEnterResponse);
|
||||
// STrialSetting sTrialSetting = STrialSetting.sTrialSetting;
|
||||
// int[] privilegeReward = sTrialSetting.getPrivilegeReward();
|
||||
// if(user.getPlayerInfoManager().checkFunctionIsAllowed(privilegeReward[privilegeReward.length-1])){
|
||||
// ItemUtil.drop(user,sTrialSetting.getBombReward(),1.0f,1,BIReason.MONTH_CARD_REWARD);
|
||||
// }
|
||||
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
||||
initMap(user.getMapManager(), user);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTrialInfo().getFloor());
|
||||
|
||||
}
|
||||
|
||||
public void updateEnergy(User user) {
|
||||
|
|
@ -232,6 +214,9 @@ public class TowerMap extends AbstractMap {
|
|||
Map<Integer, Cell> cellMap3 = new HashMap<>(sTrialConfig.getGameCount()[2]);
|
||||
Map<Integer, Cell> cellMap4 = new HashMap<>(4);//4个怪
|
||||
|
||||
Map<Integer, List<Cell>> eventMap = mapManager.getTrialInfo().getEventMap();
|
||||
|
||||
// 宝箱
|
||||
int boxPointId = STrialSetting.sTrialSetting.getBoxPointId();
|
||||
mapManager.setTowerStartTime(TimeUtils.now());
|
||||
for(int[] box:sTrialConfig.getBoxPosition()){
|
||||
|
|
@ -239,6 +224,7 @@ public class TowerMap extends AbstractMap {
|
|||
Cell cellValue = new Cell(position,0, boxPointId);
|
||||
newMap.put(position,cellValue);
|
||||
}
|
||||
eventMap.put(2,newMap.values().stream().collect(Collectors.toList()));//宝箱
|
||||
|
||||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
|
|
@ -247,117 +233,125 @@ public class TowerMap extends AbstractMap {
|
|||
mustAppear(scMap1,newMap);
|
||||
continue;
|
||||
}
|
||||
if (scMap1.getEvent() == 1) {
|
||||
int i = 0;
|
||||
while (cellMap1.size() < sTrialConfig.getGameCount()[0]) {
|
||||
i++;
|
||||
if (i >= 100) {
|
||||
break;
|
||||
switch (scMap1.getEvent()){
|
||||
case 1://buff
|
||||
int i = 0;
|
||||
while (cellMap1.size() < sTrialConfig.getGameCount()[0]) {
|
||||
i++;
|
||||
if (i >= 100) {
|
||||
break;
|
||||
}
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
int[] gameType1 = sTrialConfig.getGameType1();
|
||||
int randomInt = random.nextInt(gameType1.length);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(gameType1[randomInt]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap1.put(xy, cellValue);
|
||||
}
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
int[] gameType1 = sTrialConfig.getGameType1();
|
||||
int randomInt = random.nextInt(gameType1.length);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(gameType1[randomInt]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
newMap.putAll(cellMap1);
|
||||
break;
|
||||
case 2:
|
||||
//小游戏
|
||||
int[] resultGame;
|
||||
int[] gameType2 = sTrialConfig.getGameType2();
|
||||
if(gameType2.length==sTrialConfig.getGameCount()[1]){
|
||||
resultGame = gameType2;
|
||||
}else{
|
||||
int[][] gameArray = new int[gameType2.length][];
|
||||
for(int j = 0;j<gameType2.length;j++){
|
||||
gameArray[j] = new int[]{gameType2[j],100};
|
||||
}
|
||||
resultGame = MathUtils.randomFromWeightWithTaking(gameArray,sTrialConfig.getGameCount()[1]);
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap1.put(xy, cellValue);
|
||||
}
|
||||
} else if (scMap1.getEvent() == 2) {
|
||||
//小游戏
|
||||
int[] resultGame = null;
|
||||
int[] gameType2 = sTrialConfig.getGameType2();
|
||||
if(gameType2.length==sTrialConfig.getGameCount()[1]){
|
||||
resultGame = gameType2;
|
||||
}else{
|
||||
int[][] gameArray = new int[gameType2.length][];
|
||||
for(int i = 0;i<gameType2.length;i++){
|
||||
gameArray[i] = new int[]{gameType2[i],100};
|
||||
int j = 0;
|
||||
while (cellMap2.size() < sTrialConfig.getGameCount()[1]) {
|
||||
if (j >= 100) {
|
||||
break;
|
||||
}
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
if(resultGame==null){
|
||||
continue;
|
||||
}
|
||||
if(cellMap2.containsKey(xy)){
|
||||
continue;
|
||||
}
|
||||
j++;
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(resultGame[j-1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap2.put(xy, cellValue);
|
||||
}
|
||||
resultGame = MathUtils.randomFromWeightWithTaking(gameArray,sTrialConfig.getGameCount()[1]);
|
||||
}
|
||||
int i = 0;
|
||||
while (cellMap2.size() < sTrialConfig.getGameCount()[1]) {
|
||||
if (i >= 100) {
|
||||
break;
|
||||
newMap.putAll(cellMap2);
|
||||
break;
|
||||
case 3:
|
||||
//商店
|
||||
int storeIndex = MathUtils.randomFromWeight(sTrialConfig.getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
while (cellMap3.size() < sTrialConfig.getGameCount()[2]) {
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getGameType()[2][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap3.put(xy, cellValue);
|
||||
}
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
if(resultGame==null){
|
||||
continue;
|
||||
newMap.putAll(cellMap3);
|
||||
break;
|
||||
case 99:
|
||||
//每层只有四个怪
|
||||
int k = 0;
|
||||
int[] monster = MathUtils.randomFromWeightWithTaking(sTrialConfig.getMonsterPoint(),4);
|
||||
while (cellMap4.size() < 4 ) {
|
||||
if (k >= 100) {
|
||||
break;
|
||||
}
|
||||
int cellLength = scMap1.getGroups().length;
|
||||
if(cellLength!=4){
|
||||
//todo 做成随机
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int x = scMap1.getGroups()[k][0];
|
||||
int y = scMap1.getGroups()[k][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(monster[k]);
|
||||
k++;
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}",monster[k]);
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap4.put(xy, cellValue);
|
||||
}
|
||||
if(cellMap2.containsKey(xy)){
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(resultGame[i-1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap2.put(xy, cellValue);
|
||||
}
|
||||
} else if (scMap1.getEvent() == 3) {
|
||||
//初始化商店
|
||||
int storeIndex = MathUtils.randomFromWeight(sTrialConfig.getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
int i = 0;
|
||||
while (cellMap3.size() < sTrialConfig.getGameCount()[2]) {
|
||||
i++;
|
||||
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||
int x = scMap1.getGroups()[randomIndex][0];
|
||||
int y = scMap1.getGroups()[randomIndex][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getGameType()[2][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap3.put(xy, cellValue);
|
||||
}
|
||||
} else if (scMap1.getEvent()==99){
|
||||
//每层只有四个怪
|
||||
int i = 0;
|
||||
int[] monster = MathUtils.randomFromWeightWithTaking(sTrialConfig.getMonsterPoint(),4);
|
||||
while (cellMap4.size() < 4 ) {
|
||||
if (i >= 100) {
|
||||
break;
|
||||
}
|
||||
int cellLength = scMap1.getGroups().length;
|
||||
if(cellLength!=4){
|
||||
//todo 做成随机
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int x = scMap1.getGroups()[i][0];
|
||||
int y = scMap1.getGroups()[i][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(monster[i]);
|
||||
i++;
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}",monster[i]);
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap4.put(xy, cellValue);
|
||||
}
|
||||
newMap.putAll(cellMap4);
|
||||
break;
|
||||
default:
|
||||
randomCreateMapPoint(newMap,scMap1);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
randomCreateMapPoint(newMap,scMap1);
|
||||
}
|
||||
newMap.putAll(cellMap1);
|
||||
newMap.putAll(cellMap2);
|
||||
newMap.putAll(cellMap3);
|
||||
newMap.putAll(cellMap4);
|
||||
}
|
||||
|
||||
eventMap.put(1,cellMap4.values().stream().collect(Collectors.toList()));//怪物
|
||||
eventMap.put(3,cellMap1.values().stream().collect(Collectors.toList()));//buff
|
||||
eventMap.put(4,cellMap2.values().stream().collect(Collectors.toList()));//小游戏
|
||||
|
||||
//大于10000要生成传送门
|
||||
if(floor>10000){
|
||||
Cell transport = createTransport(floor);
|
||||
|
|
@ -369,7 +363,7 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setTrialEnergy(0);
|
||||
mapManager.setCurMapId(sTrialConfig.getMapId());
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
mapManager.updateEventMap(eventMap);
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
|
|
@ -390,32 +384,29 @@ public class TowerMap extends AbstractMap {
|
|||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
LOGGER.error("fastFight mapManager.getMapInfo() == null");
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
if (cell == null) {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
if (cell == null) {
|
||||
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
int bigEventId = cell.getEventId();
|
||||
SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||
if (sEventPointConfig == null) {
|
||||
LOGGER.info("sEventPointConfig == null");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
LOGGER.error("sEventPointConfig == null");
|
||||
}
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
LOGGER.error("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
}
|
||||
int groupId = option[0];
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
|
|
@ -518,7 +509,7 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
|
||||
//根据层数判断生成传送门
|
||||
private Cell createTransport(int floor){
|
||||
public static Cell createTransport(int floor){
|
||||
int transportPoint;
|
||||
//是否为5层整数倍
|
||||
if(floor%5==0&&floor<10000){
|
||||
|
|
@ -685,7 +676,6 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.updateTrialMapInfo(mapManager.getMapInfo());
|
||||
mapManager.updateTrialCurXY(mapManager.getCurXY());
|
||||
mapManager.updateTrialExitMapId(mapManager.getCurMapId());
|
||||
// ItemUtil.addTemporaryItemToBag(user,mapManager.getTemporaryItems(),true);
|
||||
if(mapManager.getTowerUnusedBuffer()!=null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,18 @@ public class BombGame extends ColorGame {
|
|||
}
|
||||
return response.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGameByClean(User user, CommonProto.Drop.Builder drop) throws Exception {
|
||||
List<STrialGameConfig> trialGameConfigs = STrialGameConfig.trialGameMapByType.get(getType());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int random = MathUtils.random(0, trialGameConfigs.size()-1);
|
||||
STrialGameConfig config = trialGameConfigs.get(random);
|
||||
ItemUtil.drop(user, new int[][]{{config.getRewardID(), config.getMin()}}, drop, BIReason.MAP_EVENET_REWARD);
|
||||
}
|
||||
user.getMapManager().updateMapGameInfo(new MapGameInfo());
|
||||
}
|
||||
|
||||
//乱序数组
|
||||
private int [] shuffle(int [] arr) {
|
||||
int [] arr2 =new int[arr.length];
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
|
|||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SSpiritAnimal;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SSpiritAnimal;
|
||||
import config.STrialGameConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import util.MathUtils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -84,6 +84,26 @@ public class CircleGame extends ColorGame{
|
|||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGameByClean(User user, CommonProto.Drop.Builder drop) throws Exception {
|
||||
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
|
||||
Map<Integer, STrialGameConfig> configMap = STrialGameConfig.trialGameConfigMap;
|
||||
if(mapGameInfo.getType()==0){
|
||||
return;
|
||||
}
|
||||
int[] ids = mapGameInfo.getId();
|
||||
int[][] randomArray = new int[ids.length][];
|
||||
for(int i = 0 ; i <ids.length;i++){
|
||||
STrialGameConfig config = configMap.get(ids[i]);
|
||||
int[] tempArray = new int[]{ids[i],config.getWeight()};
|
||||
randomArray[i] = tempArray;
|
||||
}
|
||||
int[] id = MathUtils.randomFromWeightWithTaking(randomArray, 1);
|
||||
STrialGameConfig config = configMap.get(id[0]);
|
||||
ItemUtil.drop(user, new int[][]{{config.getRewardID(), config.getMin()}}, drop, BIReason.MAP_EVENET_REWARD);
|
||||
user.getMapManager().updateMapGameInfo(new MapGameInfo());
|
||||
}
|
||||
|
||||
private void fiveStarPokemonPushByRandom(User user,int itemId) throws Exception{
|
||||
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(itemId);
|
||||
if(ssa != null && ssa.getQuality()==5){
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package com.ljsd.jieling.handler.map.miniGame;
|
||||
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.map.MapGameInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import config.STrialGameConfig;
|
||||
import util.MathUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,4 +16,6 @@ public interface MapGame {
|
|||
void initGame(User user);
|
||||
|
||||
MapInfoProto.MapGameUpdateResponse updateGame(User user , Object... params) throws Exception;
|
||||
|
||||
void updateGameByClean(User user, CommonProto.Drop.Builder drop) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,17 @@ public class MapLuckyCatGame extends ColorGame {
|
|||
user.getMapManager().updateMapGameInfo(new MapGameInfo());
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGameByClean(User user, CommonProto.Drop.Builder drop) throws Exception {
|
||||
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
|
||||
if(mapGameInfo.getType()==0){
|
||||
return;
|
||||
}
|
||||
int[] id = mapGameInfo.getId();
|
||||
STrialGameConfig questionConfig = STrialGameConfig.trialGameConfigMap.get(id[0]);
|
||||
int count = MathUtils.random(questionConfig.getMin(),questionConfig.getMax());
|
||||
ItemUtil.drop(user, new int[][]{{questionConfig.getRewardID(), count}}, drop, BIReason.MAP_EVENET_REWARD);
|
||||
user.getMapManager().updateMapGameInfo(new MapGameInfo());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package com.ljsd.jieling.handler.map.miniGame;
|
|||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.map.MapGameInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.STrialQuestionConfig;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MapInfoProto;
|
||||
import util.MathUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -57,4 +57,16 @@ public abstract class TrueFalseGame implements MapGame{
|
|||
.setResultId(result);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGameByClean(User user, CommonProto.Drop.Builder drop) throws Exception {
|
||||
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
|
||||
if(mapGameInfo.getType()==0){
|
||||
return;
|
||||
}
|
||||
STrialQuestionConfig questionConfig = STrialQuestionConfig.sTrialQuestionConfigMap.get(mapGameInfo.getId()[0]);
|
||||
int[][] resultReward = questionConfig.getTrueReward();
|
||||
ItemUtil.drop(user, resultReward, drop, BIReason.MAP_EVENET_REWARD);
|
||||
user.getMapManager().updateMapGameInfo(new MapGameInfo());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,13 +176,19 @@ public class ItemUtil {
|
|||
public static CommonProto.Drop.Builder drop(User user, List<int[][]> itemArrs,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
|
||||
for(int[][] itemArr : itemArrs){
|
||||
selectItemArr(itemArr,itemObj);
|
||||
}
|
||||
// useRandomItem(user,randomMap,reason);
|
||||
mapToAdd(user,itemObj,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
public static CommonProto.Drop.Builder drop(User user, List<int[][]> itemArrs, CommonProto.Drop.Builder dropBuilder, int reason) throws Exception {
|
||||
ItemMap itemObj = new ItemMap();
|
||||
for(int[][] itemArr : itemArrs){
|
||||
selectItemArr(itemArr,itemObj);
|
||||
}
|
||||
mapToAdd(user,itemObj,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue