副本修改
parent
1f9756dd59
commit
19e59de463
|
@ -2,7 +2,6 @@ package com.ljsd;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.common.mogodb.util.MongoKeys;
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.jieling.config.json.CoreSettings;
|
||||
import com.ljsd.jieling.core.CoreLogic;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
|
|
|
@ -85,6 +85,7 @@ public interface GlobalsDef {
|
|||
int FORMATION_NORMAL = 1;//主线编队
|
||||
int TEAM_ARENA_DEFENSE =101;//竞技场防御编队
|
||||
int TEAM_ARENA_ATTACH =201;//竞技场进攻编队
|
||||
int TRIAL_TEAM = 301;//森罗环境编队
|
||||
int ENDLESS_TEAM = 401;//无尽编队
|
||||
int BLOODY_TEAM =701; //血战队伍
|
||||
int CHAMPION_ATTACK_TEAM =801; //
|
||||
|
|
|
@ -15,6 +15,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.handler.map.mapType.AbstractMap;
|
||||
import com.ljsd.jieling.handler.map.mapType.MapEnum;
|
||||
import com.ljsd.jieling.handler.mission.CheckMissionReturn;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.ktbeans.KTGameType;
|
||||
|
@ -53,16 +55,16 @@ import java.util.*;
|
|||
|
||||
public class MapLogic {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MapLogic.class);
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MapLogic.class);
|
||||
|
||||
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
public Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
|
||||
private Map<Integer, Integer> difficultyMonster;
|
||||
private Map<Integer, Integer> difficultyReward;
|
||||
public Map<Integer, Integer> difficultyMonster;
|
||||
public Map<Integer, Integer> difficultyReward;
|
||||
|
||||
private static int endlessSeason;
|
||||
public static int endlessSeason;
|
||||
|
||||
private static int endlessMapId;
|
||||
public static int endlessMapId;
|
||||
public static final int STAR_1 = 1; // 完成任务
|
||||
public static final int STAR_2 = 2; // 100% 探索度
|
||||
public static final int STAR_3 = 3; // 复活次数少于N次
|
||||
|
@ -79,6 +81,13 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
public AbstractMap getMap(int mapId) throws Exception{
|
||||
return MapEnum.getToAbstractMap(2);
|
||||
}
|
||||
public AbstractMap getMap(User user) throws Exception{
|
||||
return MapEnum.getToAbstractMap(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单例
|
||||
*
|
||||
|
@ -190,7 +199,7 @@ public class MapLogic {
|
|||
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.COPY_TOWER_TIMES,1);
|
||||
initTrialMap(mapManager, user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapManager.getTower());
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapManager.getTrialInfo().getFloor());
|
||||
} else {
|
||||
initMap(mapManager, user);
|
||||
KtEventUtils.onKtEvent(user,ParamEventBean.UserGameType,type,mapId);
|
||||
|
@ -329,7 +338,7 @@ public class MapLogic {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private String initTeamInfo(int teamId, int uid, User user, MapManager mapManager ,int initType) throws Exception {
|
||||
public String initTeamInfo(int teamId, int uid, User user, MapManager mapManager ,int initType) throws Exception {
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
||||
return "阵容不存在";
|
||||
|
@ -380,7 +389,7 @@ public class MapLogic {
|
|||
return "";
|
||||
}
|
||||
|
||||
private void cellToProto(List<CommonProto.Cell> cells, Map.Entry<Integer, Cell> entry) {
|
||||
public void cellToProto(List<CommonProto.Cell> cells, Map.Entry<Integer, Cell> entry) {
|
||||
Cell cell = entry.getValue();
|
||||
if (cell.getEventId() == -1) {
|
||||
return;
|
||||
|
@ -506,7 +515,7 @@ public class MapLogic {
|
|||
initMapMission(mapManager);
|
||||
}
|
||||
|
||||
private boolean mapPointCanAAppear(MapPointConfig mapPointConfig) {
|
||||
public boolean mapPointCanAAppear(MapPointConfig mapPointConfig) {
|
||||
int[][] randomProbability = mapPointConfig.getRandomProbability();
|
||||
if (randomProbability == null || randomProbability.length == 0) {
|
||||
return true;
|
||||
|
@ -607,13 +616,13 @@ public class MapLogic {
|
|||
Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
if (cell == null) {
|
||||
cell = mapManager.getMapInfo().get(curXY);
|
||||
if (cell == null&&mapManager.getEssenceValue()!=-1) {
|
||||
if (cell == null&&mapManager.getTrialInfo().getEnergy()!=-1) {
|
||||
LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
if(cell ==null){
|
||||
if(mapManager.getEssenceValue()==100||mapManager.getEssenceValue()==-1){
|
||||
if(mapManager.getTrialInfo().getEnergy()==100||mapManager.getTrialInfo().getEnergy()==-1){
|
||||
MessageUtil.sendErrorResponse(session, -1,messageType.getNumber(),"怪物已被清除!");
|
||||
}
|
||||
return;
|
||||
|
@ -806,7 +815,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
private int getNextEventId(User user, Cell cell, SOptionConfig sOptionConfig) throws Exception {
|
||||
public int getNextEventId(User user, Cell cell, SOptionConfig sOptionConfig) throws Exception {
|
||||
int jumpType = sOptionConfig.getJumpType();
|
||||
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
|
||||
switch (jumpType) {
|
||||
|
@ -857,7 +866,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) throws Exception {
|
||||
public int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) throws Exception {
|
||||
int nextEventId = 0;
|
||||
switch (sOptionAddConditions.getType()) {
|
||||
// 1 完成事件点,即进度100%
|
||||
|
@ -1071,27 +1080,27 @@ public class MapLogic {
|
|||
}
|
||||
mapManager.endlessMapInfoSave(mapManager.getMapInfo());
|
||||
}
|
||||
if(outType == 0||mapManager.getTower()-1==STrialConfig.getHighestTower()){
|
||||
if(outType == 0||mapManager.getTrialInfo().getFloor()-1==STrialConfig.getHighestTower()){
|
||||
if(mapManager.getTowerUnusedBuffer()!=null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
LOGGER.info("退出地图");
|
||||
if(challengeConfig.getType()==2){
|
||||
if(mapManager.getTower()>=1){
|
||||
if(mapManager.getTrialInfo().getFloor()>=1){
|
||||
mapManager.setMapIntoFlag(1);
|
||||
if(mapManager.getTower()==STrialConfig.getHighestTower()){
|
||||
mapManager.setHighestTower(mapManager.getTower());
|
||||
if(mapManager.getTrialInfo().getFloor()==STrialConfig.getHighestTower()){
|
||||
mapManager.setHighestFloor(mapManager.getTrialInfo().getFloor());
|
||||
AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType());
|
||||
// TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))
|
||||
if(towerRank.getScore(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))>towerRank.getScoreById(user.getId(),"")){
|
||||
towerRank.addRank(user.getId(),"",mapManager.getTower(),(int)mapManager.getCurrTowerTime()/1000);
|
||||
// RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000)));
|
||||
// TowerRankUtil.getRankNumber(mapManager.getTrialInfo().getFloor(),(int)(mapManager.getCurrTowerTime()/1000))
|
||||
if(towerRank.getScore(mapManager.getTrialInfo().getFloor(),(int)(mapManager.getCurrTowerTime()/1000))>towerRank.getScoreById(user.getId(),"")){
|
||||
towerRank.addRank(user.getId(),"",mapManager.getTrialInfo().getFloor(),(int)mapManager.getCurrTowerTime()/1000);
|
||||
// RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTrialInfo().getFloor(),(int)(mapManager.getCurrTowerTime()/1000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
mapManager.setCurrTowerTime(0);
|
||||
boolean result = onlyLevelMap(user, true);
|
||||
if (!result) {
|
||||
|
@ -1139,7 +1148,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
private boolean onlyLevelMap(User user, boolean needTemporaryItem) throws Exception {
|
||||
public boolean onlyLevelMap(User user, boolean needTemporaryItem) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("mapManager.getMapInfo() == null");
|
||||
|
@ -1162,7 +1171,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
public void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
||||
public static void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.setFoodBufferMap(new HashMap<>());
|
||||
mapManager.clearCopyMission(mapManager.getCurMapId());
|
||||
|
@ -1298,7 +1307,7 @@ public class MapLogic {
|
|||
.setResult(resultCode)
|
||||
.setEnventDrop(dropBuilder)
|
||||
.addAllRemainHpList(remainHp)
|
||||
.setEssenceValue(mapManager.getEssenceValue())
|
||||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
.setLastXY(mapManager.getLastXY())
|
||||
.build();
|
||||
mapManager.setCurXY(mapManager.getLastXY());
|
||||
|
@ -1331,14 +1340,14 @@ public class MapLogic {
|
|||
}
|
||||
//删点之前进行查找
|
||||
if (sChallengeConfig.getType() == 2) {
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
|
||||
if(cell.getCellId()!=mapManager.getBossXY()){
|
||||
if(mapManager.getEssenceValue()!=-1){
|
||||
if(mapManager.getTrialInfo().getEnergy()!=-1){
|
||||
if (randomMonsterType[0][1] == cell.getPointId()) {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
|
||||
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
|
||||
} else {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy());
|
||||
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getEliteEnergy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1355,11 +1364,11 @@ public class MapLogic {
|
|||
fastFightResponse.setEnventDrop(drop.build());
|
||||
fastFightResponse.setResult(resultCode);
|
||||
fastFightResponse.addAllRemainHpList(remainHp);
|
||||
fastFightResponse.setEssenceValue(mapManager.getEssenceValue());
|
||||
fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
fastFightResponse.build();
|
||||
|
||||
|
||||
fastFightResponse.setEssenceValue(mapManager.getEssenceValue());
|
||||
fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, checkResult[1]);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
|
@ -1636,7 +1645,7 @@ public class MapLogic {
|
|||
mapManager.findSuddenlyBoss(0, 0);
|
||||
}
|
||||
// if(mapManager.getBossType()==1)
|
||||
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
if(mapManager.getTrialInfo().getFloor()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
|
||||
int time = (int)((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
mapManager.setCurrTowerTime(time*1000);
|
||||
|
@ -1669,7 +1678,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
public int getLeftTime(User user, boolean needResetMap) throws Exception {
|
||||
public static int getLeftTime(User user, boolean needResetMap) throws Exception {
|
||||
int curMapId = user.getMapManager().getCurMapId();
|
||||
if (curMapId == 0) {
|
||||
return -1;
|
||||
|
@ -2031,10 +2040,10 @@ public class MapLogic {
|
|||
builder.setStarNum(sChallengeStarBox.getStarNum());
|
||||
}
|
||||
MapInfoProto.TowerCopyInfo towerCopyInfo = MapInfoProto.TowerCopyInfo.newBuilder()
|
||||
.setTower(mapManager.getTower())
|
||||
.setTower(mapManager.getTrialInfo().getFloor())
|
||||
.setFightCount(mapManager.getFightCount())
|
||||
.setHighestTower(mapManager.getHighestTower())
|
||||
.setEssenceValue(mapManager.getEssenceValue())
|
||||
.setHighestTower(mapManager.getTrialInfo().getHighestTower())
|
||||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
.setMapIntoReset(mapManager.getMapIntoFlag())
|
||||
.setTowerUseTime((int)(mapManager.getCurrTowerTime()/1000))
|
||||
.build();
|
||||
|
@ -2397,9 +2406,9 @@ public class MapLogic {
|
|||
*/
|
||||
public String initTrialMap(MapManager mapManager, User user) throws Exception {
|
||||
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTower();i++){
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
if(mapManager.getTrialInfo().getFloor()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTrialInfo().getFloor();i++){
|
||||
ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
if(type == 3){
|
||||
|
@ -2410,13 +2419,13 @@ public class MapLogic {
|
|||
mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
}
|
||||
if(type == 4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTower()).getRandomStore());
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sTrialConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTower());
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTrialInfo().getFloor());
|
||||
return "";
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
|
@ -2508,7 +2517,7 @@ public class MapLogic {
|
|||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||
mapManager.setCurXY(xy);
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
|
@ -2527,10 +2536,10 @@ public class MapLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(mapManager.getEssenceValue()<100){
|
||||
if(mapManager.getTrialInfo().getEnergy()<100){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("精气值不足!!"));
|
||||
}
|
||||
int currTower = mapManager.getTower();
|
||||
int currTower = mapManager.getTrialInfo().getFloor();
|
||||
STrialConfig config = STrialConfig.sTrialConfigMap.get(currTower);
|
||||
|
||||
int type = 1;
|
||||
|
@ -2539,7 +2548,7 @@ public class MapLogic {
|
|||
int[][] bossType = config.getRandomBossType();
|
||||
|
||||
type = MathUtils.randomFromWeight(bossType);
|
||||
// if(mapManager.getTower()%5!=0){
|
||||
// if(mapManager.getTrialInfo().getFloor()%5!=0){
|
||||
// type = 3;
|
||||
// }
|
||||
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
|
@ -2589,7 +2598,7 @@ public class MapLogic {
|
|||
Cell cell = BehaviorUtil.addBehaviorInfo(user,randomPoint,mapManager,mapManager.getCurMapId(),CellUtil.pos2XY(xyResult)[0],CellUtil.pos2XY(xyResult)[1],false);
|
||||
CommonProto.Cell protoCell =CBean2Proto.getCell(cell);
|
||||
response.setType(type);
|
||||
mapManager.setEssenceValue(-1);
|
||||
mapManager.setTrialEnergy(-1);
|
||||
response.setMonsterInfo(protoCell);
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
|
@ -2607,7 +2616,7 @@ public class MapLogic {
|
|||
MapManager mapManager = user.getMapManager();
|
||||
STrialSetting setting = STrialSetting.sTrialSetting;
|
||||
int[][] bomb = setting.getBombId();
|
||||
if(mapManager.getEssenceValue()==-1){
|
||||
if(mapManager.getTrialInfo().getEnergy()==-1){
|
||||
throw new ErrorCodeException(ErrorCode.USE_BOMB_BOSS);
|
||||
}
|
||||
boolean isUse = ItemUtil.itemCost(user,bomb,BIReason.BOMB_CONSUME,mapManager.getCurMapId());
|
||||
|
@ -2648,7 +2657,7 @@ public class MapLogic {
|
|||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, bombReward, 1,1,BIReason.BOMB_REWARD);
|
||||
|
||||
|
||||
mapManager.setEssenceValue(100);
|
||||
mapManager.setTrialEnergy(100);
|
||||
MapInfoProto.MapTowerUseBombResponse.Builder response = MapInfoProto.MapTowerUseBombResponse.newBuilder();
|
||||
response.setEssenceValue(100);
|
||||
response.setDrop(drop);
|
||||
|
@ -2675,62 +2684,6 @@ public class MapLogic {
|
|||
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
|
||||
BehaviorUtil.destoryPoints(user,x);
|
||||
}
|
||||
/**
|
||||
* 重置爬塔副本
|
||||
* @param iSession
|
||||
* @param messageType
|
||||
*/
|
||||
public void towerReset(ISession iSession,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
StoreManager storeManager = user.getStoreManager();
|
||||
if(mapManager.getMapIntoFlag()==0){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("重置错误"));
|
||||
}
|
||||
// TODO 检测重置次数
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
if( !PlayerLogic.getInstance().checkAndUpdate(user,VipPrivilegeType.TOWER_RESRT_NUM, 1)){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无重置次数"));
|
||||
}
|
||||
mapManager.setTower(MathUtils.resetMethod(mapManager.getHighestTower()));
|
||||
mapManager.setFightCount(0);
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
mapManager.setMapIntoFlag(0);
|
||||
if(storeManager.getStoreInfoMap().get(8)!=null){
|
||||
storeManager.removeStoreInfo(8);
|
||||
}
|
||||
mapManager.setTowerStartTime(0);
|
||||
mapManager.setCurrTowerTime(0);
|
||||
resetMapInfo(user, true);
|
||||
// mapManager.setTower(98);
|
||||
MapInfoProto.MapTowerResetResponse mapTowerResetResponse = MapInfoProto.MapTowerResetResponse
|
||||
.newBuilder()
|
||||
.setTower(mapManager.getTower())
|
||||
.build();
|
||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapTowerResetResponse, true);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 5点自动刷新重置次数
|
||||
// * @param session
|
||||
// */
|
||||
// public void towerAutoReset(ISession session, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// //5点自动重置
|
||||
// if(mapManager.getCurMapId()==0||SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()!=2){
|
||||
// int afterResetTower = MathUtils.resetMethod(mapManager.getHighestTower());
|
||||
// mapManager.setTower(afterResetTower);
|
||||
// }
|
||||
// mapManager.setMapIntoFlag(0);
|
||||
// CommonProto.fiveResetTowerInfo resetTowerInfo = CommonProto.fiveResetTowerInfo.newBuilder().setTower(user.getMapManager().getTower()).setIntoType(user.getMapManager().getMapIntoFlag()).build();
|
||||
// if(fBuilder!=null){
|
||||
// fBuilder.setFiveResetTowerInfo(resetTowerInfo);
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 爬塔使用Buff
|
||||
* @param session
|
||||
|
@ -2788,7 +2741,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
private String checkUseTowerBuff(MapManager mapManager,int towerLevel,int optionId){
|
||||
public String checkUseTowerBuff(MapManager mapManager,int towerLevel,int optionId){
|
||||
if(!mapManager.getTowerUnusedBuffer().containsKey(towerLevel)){
|
||||
return "使用错误,当前层不存在buff";
|
||||
}
|
||||
|
@ -2873,63 +2826,7 @@ public class MapLogic {
|
|||
}
|
||||
//GM调用
|
||||
public void setTower(int uid,int towerNumber) throws Exception {
|
||||
UserManager.getUser(uid).getMapManager().setTower(towerNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排行榜数据
|
||||
* @param session
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getTowerRank(ISession session,int type,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
|
||||
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
|
||||
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(),"",1, rankEndLine);
|
||||
|
||||
|
||||
// Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, rankEndLine);
|
||||
// Iterator<ZSetOperations.TypedTuple<String>> iterator = zsetreverseRangeWithScores.iterator();
|
||||
// MapInfoProto.TowerRankResponse.Builder response = MapInfoProto.TowerRankResponse.newBuilder();
|
||||
// int rank = 1;
|
||||
// while (iterator.hasNext()){
|
||||
// ZSetOperations.TypedTuple<String> next = iterator.next();
|
||||
// int data = next.getScore().intValue();
|
||||
// int tower = TowerRankUtil.getTowerAndTime(data)[0];
|
||||
// int time = TowerRankUtil.getTowerAndTime(data)[1];
|
||||
// User everyUser = UserManager.getUser(Integer.parseInt(next.getValue()), true);
|
||||
// if (null == everyUser) {
|
||||
// continue;
|
||||
// }
|
||||
// CommonProto.TowerRankInfo everyRankInfo = CommonProto.TowerRankInfo.newBuilder()
|
||||
// .setRank(rank)
|
||||
// .setHighestTower(tower)
|
||||
// .setTime(time)
|
||||
// .build();
|
||||
// CommonProto.TowerRank everyRank = CommonProto.TowerRank.newBuilder()
|
||||
// .setUid(everyUser.getId())
|
||||
// .setUserName(everyUser.getPlayerInfoManager().getNickName())
|
||||
// .setHead(everyUser.getPlayerInfoManager().getHead())
|
||||
// .setHeadFrame(everyUser.getPlayerInfoManager().getHeadFrame())
|
||||
// .setLevel(everyUser.getPlayerInfoManager().getLevel())
|
||||
// .setTowerRankInfo(everyRankInfo)
|
||||
// .build();
|
||||
// response.addTowerRanks(everyRank);
|
||||
// rank++;
|
||||
// }
|
||||
// //当前用户信息
|
||||
// int myRank= RedisUtil.getInstence().getZSetreverseRank(RedisKey.TOWER_RANK,"",Integer.toString(user.getId())).intValue();
|
||||
// int zSetScore = RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", Integer.toString(user.getId())).intValue();
|
||||
// int[] towerAndTime = TowerRankUtil.getTowerAndTime(zSetScore);
|
||||
// CommonProto.TowerRankInfo towerRankInfo = CommonProto.TowerRankInfo.newBuilder()
|
||||
// .setRank(myRank)
|
||||
// .setHighestTower(towerAndTime[0])
|
||||
// .setTime(towerAndTime[1]).build();
|
||||
// response.setUserRank(towerRankInfo);
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),rankResponse,true);
|
||||
|
||||
UserManager.getUser(uid).getMapManager().setTrialFloor(towerNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2943,7 +2840,7 @@ public class MapLogic {
|
|||
User user = UserManager.getUser(session.getUid());
|
||||
STrialConfig trialConfig = STrialConfig.sTrialConfigMap.get(tower);
|
||||
int[][] floorReward = trialConfig.getFloorReward();
|
||||
if(floorReward.length<0){
|
||||
if(floorReward.length<1){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("当前层无奖励"));
|
||||
}
|
||||
Map<Integer, Integer> towerReceivedReward = user.getMapManager().getTowerReceivedReward();
|
||||
|
@ -3128,7 +3025,7 @@ public class MapLogic {
|
|||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
private void reviveConsumeExecution(User user) throws Exception {
|
||||
public void reviveConsumeExecution(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()!=4){
|
||||
return;
|
||||
|
@ -3255,7 +3152,7 @@ public class MapLogic {
|
|||
* @param triggerXY
|
||||
* @throws Exception
|
||||
*/
|
||||
private void endlessRefreshMonster(ISession session,int 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);
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.ljsd.jieling.logic.dao.PlayerManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import util.MathUtils;
|
||||
import config.SVipLevelConfig;
|
||||
import manager.STableManager;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -83,16 +82,8 @@ public class MapManager extends MongoBase {
|
|||
private Set<Integer> playGenMaps = new HashSet<>();
|
||||
|
||||
|
||||
// 爬塔副本当前层数
|
||||
private int tower = 1;
|
||||
// 爬塔副本战斗次数
|
||||
private int fightCount;
|
||||
// 爬塔副本重置次数
|
||||
private int resetCount;
|
||||
// 爬塔副本试炼精气
|
||||
private int essenceValue;
|
||||
// 爬塔副本历史最高层
|
||||
private int highestTower;
|
||||
//爬塔副本暂存Buff
|
||||
private Map<Integer,Integer> towerUnusedBuffer = new HashMap<>();
|
||||
//副本boss坐标
|
||||
|
@ -120,6 +111,9 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private Set<Integer> playedMapType = new HashSet<>();
|
||||
|
||||
private TrialInfo trialInfo = new TrialInfo();
|
||||
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -488,14 +482,6 @@ public class MapManager extends MongoBase {
|
|||
public Set<Integer> getTakeCopyMisionRewards() {
|
||||
return takeCopyMisionRewards;
|
||||
}
|
||||
public int getTower() {
|
||||
return tower;
|
||||
}
|
||||
|
||||
public void setTower(int tower) {
|
||||
updateString("tower" , tower);
|
||||
this.tower = tower;
|
||||
}
|
||||
|
||||
public int getFightCount() {
|
||||
return fightCount;
|
||||
|
@ -511,15 +497,6 @@ public class MapManager extends MongoBase {
|
|||
this.fightCount = fightCount;
|
||||
}
|
||||
|
||||
public int getResetCount() {
|
||||
return resetCount;
|
||||
}
|
||||
|
||||
public void setResetCount(int resetCount) {
|
||||
updateString("resetCount" , resetCount);
|
||||
this.resetCount = resetCount;
|
||||
}
|
||||
|
||||
public int getStarReward() {
|
||||
return starReward;
|
||||
}
|
||||
|
@ -539,23 +516,6 @@ public class MapManager extends MongoBase {
|
|||
this.copyMissionProgresMap.remove(copyId);
|
||||
}
|
||||
|
||||
public int getEssenceValue() {
|
||||
return essenceValue;
|
||||
}
|
||||
|
||||
public void setEssenceValue(int essenceValue) {
|
||||
updateString("essenceValue" , essenceValue);
|
||||
this.essenceValue = essenceValue;
|
||||
}
|
||||
|
||||
public int getHighestTower() {
|
||||
return highestTower;
|
||||
}
|
||||
|
||||
public void setHighestTower(int highestTower) {
|
||||
updateString("highestTower" , highestTower);
|
||||
this.highestTower = highestTower;
|
||||
}
|
||||
public Map<Integer,Integer> getTowerUnusedBuffer(){ return this.towerUnusedBuffer;}
|
||||
|
||||
public void setTowerUnusedBuffer(Map<Integer,Integer> towerUnusedBuffer){
|
||||
|
@ -808,6 +768,24 @@ public class MapManager extends MongoBase {
|
|||
playedMapType.add(type);
|
||||
updateString("playedMapType",playedMapType);
|
||||
}
|
||||
|
||||
public TrialInfo getTrialInfo() {
|
||||
return trialInfo;
|
||||
}
|
||||
|
||||
public void setTrialFloor(int floor){
|
||||
trialInfo.setFloor(floor);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
|
||||
public void setHighestFloor(int floor){
|
||||
trialInfo.setHighestTower(floor);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void setTrialEnergy(int energy) {
|
||||
trialInfo.setEnergy(energy);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/16
|
||||
* @discribe
|
||||
*/
|
||||
public class TrialInfo {
|
||||
//默认一层
|
||||
private int floor = 1;
|
||||
|
||||
private boolean autoFight;
|
||||
|
||||
private boolean autoAddHp;
|
||||
|
||||
private boolean autoGetItem;
|
||||
|
||||
private int energy;
|
||||
|
||||
private Map<String,Integer> endlessHeroInfo;
|
||||
|
||||
private int addHpCount;
|
||||
|
||||
private int highestTower;
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(int floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public boolean isAutoFight() {
|
||||
return autoFight;
|
||||
}
|
||||
|
||||
public void setAutoFight(boolean autoFight) {
|
||||
this.autoFight = autoFight;
|
||||
}
|
||||
|
||||
public boolean isAutoAddHp() {
|
||||
return autoAddHp;
|
||||
}
|
||||
|
||||
public void setAutoAddHp(boolean autoAddHp) {
|
||||
this.autoAddHp = autoAddHp;
|
||||
}
|
||||
|
||||
public boolean isAutoGetItem() {
|
||||
return autoGetItem;
|
||||
}
|
||||
|
||||
public void setAutoGetItem(boolean autoGetItem) {
|
||||
this.autoGetItem = autoGetItem;
|
||||
}
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
||||
public void setEnergy(int energy) {
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getEndlessHeroInfo() {
|
||||
return endlessHeroInfo;
|
||||
}
|
||||
|
||||
public void setEndlessHeroInfo(Map<String, Integer> endlessHeroInfo) {
|
||||
this.endlessHeroInfo = endlessHeroInfo;
|
||||
}
|
||||
|
||||
public int getAddHpCount() {
|
||||
return addHpCount;
|
||||
}
|
||||
|
||||
public void setAddHpCount(int addHpCount) {
|
||||
this.addHpCount = addHpCount;
|
||||
}
|
||||
|
||||
public int getHighestTower() {
|
||||
return highestTower;
|
||||
}
|
||||
|
||||
public void setHighestTower(int highestTower) {
|
||||
this.highestTower = highestTower;
|
||||
}
|
||||
}
|
|
@ -28,11 +28,11 @@ public class FourtyThreeBehavior extends BaseBehavior{
|
|||
};
|
||||
if (mapManager.getBossType()==3){
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getBossXY());
|
||||
LOGGER.info("暂存buff层数:{},buff:{},pointId:{}",mapManager.getTower(),cell.getEventId(),cell.getPointId());
|
||||
mapManager.addTowerUnusedBuffer(mapManager.getTower(),cell.getEventId());
|
||||
LOGGER.info("暂存buff层数:{},buff:{},pointId:{}",mapManager.getTrialInfo().getFloor(),cell.getEventId(),cell.getPointId());
|
||||
mapManager.addTowerUnusedBuffer(mapManager.getTrialInfo().getFloor(),cell.getEventId());
|
||||
return true;
|
||||
}else if(mapManager.getBossType()==4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTower()).getRandomStore());
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.TrialInfo;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
|
@ -27,39 +28,36 @@ public class FourtyTwoBehavior extends BaseBehavior {
|
|||
MapManager mapManager = user.getMapManager();
|
||||
int maxTower = STrialConfig.getHighestTower();
|
||||
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
if (challengeConfig.getType() == 2 && mapManager.getTower() >= maxTower) {
|
||||
mapManager.setTower(mapManager.getTower() + 1);
|
||||
LOGGER.info("当前层为{},最大层为{}", mapManager.getTower(), maxTower);
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
if (challengeConfig.getType() == 2 && trialInfo.getFloor() >= maxTower) {
|
||||
mapManager.setTrialFloor(trialInfo.getFloor() + 1);
|
||||
LOGGER.info("当前层为{},最大层为{}", trialInfo.getFloor(), maxTower);
|
||||
return false;
|
||||
}
|
||||
LOGGER.info("当前层为{},进入下一层", mapManager.getTower());
|
||||
LOGGER.info("当前层为{},进入下一层", trialInfo.getFloor());
|
||||
MapLogic.getInstance().clearNormalMonster(user);
|
||||
mapManager.removeBoss();
|
||||
long time = TimeUtils.now() - mapManager.getTowerStartTime();
|
||||
mapManager.setCurrTowerTime(time);
|
||||
LOGGER.info("上层使用时间{}", time);
|
||||
//判断通关最高层是否需要替换
|
||||
if(mapManager.getTower()>mapManager.getHighestTower()){
|
||||
mapManager.setHighestTower(mapManager.getTower());
|
||||
if(trialInfo.getFloor()> trialInfo.getHighestTower()){
|
||||
trialInfo.setHighestTower(trialInfo.getFloor());
|
||||
AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType());
|
||||
// Double zSetScore = RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId()));
|
||||
// TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000)
|
||||
if(towerRank.getScore(mapManager.getTower(),(int)time/1000)>towerRank.getScoreById(user.getId(),"")){
|
||||
// String key = RedisKey.getKey(RedisKey.TOWER_RANK,"",false);
|
||||
// RedisUtil.getInstence().zsetAddOne(key,String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)time/1000));
|
||||
towerRank.addRank(user.getId(),"",mapManager.getTower(),(int)time/1000);
|
||||
if(towerRank.getScore(trialInfo.getFloor(),(int)time/1000)>towerRank.getScoreById(user.getId(),"")){
|
||||
towerRank.addRank(user.getId(),"", trialInfo.getFloor(),(int)time/1000);
|
||||
}
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL, mapManager.getTower());
|
||||
mapManager.setTower(mapManager.getTower() + 1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL, trialInfo.getFloor());
|
||||
mapManager.setTrialFloor(trialInfo.getFloor() + 1);
|
||||
// if(mapManager.getTower()==6){
|
||||
// mapManager.setTower(50);
|
||||
// }
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
|
||||
mapManager.setStartExporeTime(0);
|
||||
mapManager.setMapIntoFlag(2);
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(trialInfo.getFloor());
|
||||
mapManager.setCurMapId(sTrialConfig.getMapId());
|
||||
MapLogic.getInstance().initTrialMap(mapManager, user);
|
||||
return true;
|
||||
|
|
|
@ -20,7 +20,7 @@ public class JumpBehavior extends BaseBehavior {
|
|||
if (behaviorTypeValues[0][0] != 0) {
|
||||
user.getMapManager().setCurMapId(behaviorTypeValues[0][0]);
|
||||
user.getPlayerInfoManager().setMapId(behaviorTypeValues[0][0]);
|
||||
MapLogic.getAbstractMap(user).initMap(user.getMapManager(), user);
|
||||
MapLogic.getInstance().getMap(user).initMap(user.getMapManager(), user);
|
||||
return true;
|
||||
} else {
|
||||
MapLogic.getInstance().resetMapInfo(user, true);
|
||||
|
|
|
@ -27,9 +27,9 @@ public class MapEnterRequestHandler extends BaseHandler{
|
|||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapEnterRequest mapEnterRequest = MapInfoProto.MapEnterRequest.parseFrom(message);
|
||||
int teamId = mapEnterRequest.getTeamId();
|
||||
// MapLogic.getInstance().enterMap();
|
||||
|
||||
MapInfoProto.MapEnterResponse.Builder builder = MapInfoProto.MapEnterResponse.newBuilder();
|
||||
MapLogic.getAbstractMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
MapLogic.getInstance().getMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.MAP_ENTER_RESPONSE.getNumber(), builder.build(), true);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class MapFastFightRequestHandler extends BaseHandler {
|
|||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
FightInfoProto.FastFightResponse.Builder builder = FightInfoProto.FastFightResponse.newBuilder();
|
||||
MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid())).fastFight(iSession.getUid(), builder);
|
||||
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).fastFight(iSession.getUid(), builder);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.MAP_FAST_FIGHT_RESPONSE.getNumber(), builder.build(), true);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class MapOutRequestHandler extends BaseHandler{
|
|||
MapInfoProto.MapOutRequest mapOutRequest = MapInfoProto.MapOutRequest.parseFrom(bytes);
|
||||
int outType = mapOutRequest.getOutType();
|
||||
int curXY = mapOutRequest.getCurXY();
|
||||
AbstractMap abstractMap = MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid()));
|
||||
AbstractMap abstractMap = MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid()));
|
||||
MapInfoProto.MapOutResponse.Builder builder = MapInfoProto.MapOutResponse.newBuilder();
|
||||
abstractMap.outMap(iSession.getUid(),outType,curXY,builder);
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.MAP_OUT_RESPONSE_VALUE,builder.build());
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
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 MapTowerResetRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_TOWER_RESET_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().towerReset(iSession, MessageTypeProto.MessageType.MAP_TOWER_RESET_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.handler.map.mapType;
|
|||
|
||||
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -19,22 +21,18 @@ import com.ljsd.jieling.handler.mission.Mission;
|
|||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.StoryEvent;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.StoreManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
import com.ljsd.jieling.logic.fight.FightType;
|
||||
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
|
@ -173,23 +171,17 @@ public abstract class AbstractMap implements IMap {
|
|||
if(mapManager.getCurMapId()!=0){
|
||||
return;
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapId);
|
||||
SChallengeConfig sChallengeConfig = STableManager.getConfig(SChallengeConfig.class).get(mapId);
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(scMapConfig.getPosition()[0],scMapConfig.getPosition()[1]));
|
||||
Map<Integer, SCMap> scMap = SCMap.sCMap.get(mapId);
|
||||
if (scMap == null) {
|
||||
LOGGER.info("enterMap() uid=>{} scMap == null =>{} ", user.getId(), mapId);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (scMapConfig == null) {
|
||||
LOGGER.info("enterMap() uid=>{} sChallengeConfig == null =>{} ", user.getId(), mapId);
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("该地图不存在"));
|
||||
}
|
||||
SChallengeConfig sChallengeConfig = STableManager.getConfig(SChallengeConfig.class).get(mapId);
|
||||
if (sChallengeConfig == null) {
|
||||
LOGGER.info("enterMap() uid=>{} sChallengeConfig == null =>{} ", user.getId(), mapId);
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("该地图不存在"));
|
||||
}
|
||||
// TODO 可进入地图条件判断
|
||||
// 可进入地图条件判断
|
||||
int[][] openRule = sChallengeConfig.getOpenRule();
|
||||
if (openRule != null && openRule.length > 0) {
|
||||
if (user.getPlayerInfoManager().getLevel() < openRule[0][1]) {
|
||||
|
@ -199,10 +191,13 @@ public abstract class AbstractMap implements IMap {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("需要通关:" + openRule[0][0]));
|
||||
}
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapId);
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(scMapConfig.getPosition()[0],scMapConfig.getPosition()[1]));
|
||||
|
||||
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
||||
user.getPlayerInfoManager().setMapId(mapId);
|
||||
}
|
||||
//todo initTeam ?
|
||||
String error = MapLogic.getInstance().initTeamInfo(teamId, user.getId(), user, mapManager,1);
|
||||
if (!error.isEmpty()) {
|
||||
LOGGER.info("enterMap() uid=>{} error =>{} ", user.getId(), error);
|
||||
|
@ -261,10 +256,10 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
int groupId = option[0];
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||
Integer newGroupId= STableManager.getFigureConfig(MapStaticConfig.class).getDifficultyMonster().get(groupId);
|
||||
if(newGroupId!=null){
|
||||
groupId = newGroupId;
|
||||
}
|
||||
// Integer newGroupId= STableManager.getFigureConfig(MapStaticConfig.class).getDifficultyMonster().get(groupId);
|
||||
// if(newGroupId!=null){
|
||||
// groupId = newGroupId;
|
||||
// }
|
||||
}
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, mapManager.getTeamId(), true);
|
||||
|
@ -307,7 +302,7 @@ public abstract class AbstractMap implements IMap {
|
|||
fastFightResponseBuilder.setResult(resultCode)
|
||||
.setEnventDrop(dropBuilder)
|
||||
.addAllRemainHpList(remainHp)
|
||||
.setEssenceValue(mapManager.getEssenceValue())
|
||||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
.setLastXY(mapManager.getLastXY());
|
||||
mapManager.setCurXY(mapManager.getLastXY());
|
||||
return;
|
||||
|
@ -324,7 +319,7 @@ public abstract class AbstractMap implements IMap {
|
|||
fastFightResponseBuilder.setEnventDrop(drop.build());
|
||||
fastFightResponseBuilder.setResult(resultCode);
|
||||
fastFightResponseBuilder.addAllRemainHpList(remainHp);
|
||||
fastFightResponseBuilder.setEssenceValue(mapManager.getEssenceValue());
|
||||
fastFightResponseBuilder.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, checkResult[1]);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
|
@ -508,7 +503,7 @@ public abstract class AbstractMap implements IMap {
|
|||
if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
||||
mapManager.findSuddenlyBoss(0, 0);
|
||||
}
|
||||
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
if(mapManager.getTrialInfo().getFloor()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
|
||||
int time = (int)((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
mapManager.setCurrTowerTime(time*1000);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class DifficultMap extends AbstractMap {
|
|||
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
if (mapManager.getMission() != null) {
|
||||
mapEnterResponse.setMissions(MapLogic.getMission(mapManager.getMission()));
|
||||
mapEnterResponse.setMissions(MapLogic.getInstance().getMission(mapManager.getMission()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -242,8 +242,9 @@ public class EndlessMap extends AbstractMap{
|
|||
|
||||
@Override
|
||||
public int monsterGroupChange(int groupId) {
|
||||
if(STableManager.getFigureConfig(MapStaticConfig.class).getDifficultyMonster().containsKey(groupId)){
|
||||
groupId = STableManager.getFigureConfig(MapStaticConfig.class).getDifficultyMonster().get(groupId);
|
||||
Map<Integer, Integer> difficultyMonster = MapLogic.getInstance().getDifficultyMonster();
|
||||
if(difficultyMonster.containsKey(groupId)){
|
||||
groupId = difficultyMonster.get(groupId);
|
||||
}
|
||||
return groupId;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
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;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.Cell;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
|
@ -43,38 +45,46 @@ public class TowerMap extends AbstractMap {
|
|||
super.outMap(uid,outType,curXY,builder);
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(outType == 0||mapManager.getTower()-1==STrialConfig.getHighestTower()) {
|
||||
if(outType == 0||mapManager.getTrialInfo().getFloor()-1==STrialConfig.getHighestTower()) {
|
||||
if(mapManager.getTowerUnusedBuffer()!=null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
LOGGER.info("退出地图");
|
||||
if(mapManager.getTower()>=1){
|
||||
if(mapManager.getTrialInfo().getFloor()>=1){
|
||||
mapManager.setMapIntoFlag(1);
|
||||
if(mapManager.getTower()== STrialConfig.getHighestTower()){
|
||||
mapManager.setHighestTower(mapManager.getTower());
|
||||
if(TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))> RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId()))){
|
||||
RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000)));
|
||||
if(mapManager.getTrialInfo().getFloor()== STrialConfig.getHighestTower()){
|
||||
mapManager.setHighestFloor(mapManager.getTrialInfo().getFloor());
|
||||
if(TowerRankUtil.getRankNumber(mapManager.getTrialInfo().getFloor(),(int)(mapManager.getCurrTowerTime()/1000))> RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId()))){
|
||||
RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTrialInfo().getFloor(),(int)(mapManager.getCurrTowerTime()/1000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mapManager.setCurrTowerTime(0);
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
if(mapManager.getTowerUnusedBuffer()!=null&&mapManager.getTowerUnusedBuffer().size()>=1){
|
||||
List<MapInfoProto.TowerBuff> towerBuffs = new ArrayList<>();
|
||||
for(Map.Entry<Integer,Integer> buffer:mapManager.getTowerUnusedBuffer().entrySet()){
|
||||
TowerBuff towerBuff = new TowerBuff(buffer.getKey(),buffer.getValue());
|
||||
towerBuffs.add(CBean2Proto.getTowerBuff(towerBuff));
|
||||
}
|
||||
mapEnterResponse.addAllBuf(towerBuffs);
|
||||
if(teamId!= GlobalsDef.TRIAL_TEAM){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
int curFloor = mapManager.getTrialInfo().getFloor();
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(curFloor);
|
||||
if(sTrialConfig.getMapId()!=mapId){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
// if(mapManager.getTowerUnusedBuffer()!=null&&mapManager.getTowerUnusedBuffer().size()>=1){
|
||||
// List<MapInfoProto.TowerBuff> towerBuffs = new ArrayList<>();
|
||||
// for(Map.Entry<Integer,Integer> buffer:mapManager.getTowerUnusedBuffer().entrySet()){
|
||||
// TowerBuff towerBuff = new TowerBuff(buffer.getKey(),buffer.getValue());
|
||||
// towerBuffs.add(CBean2Proto.getTowerBuff(towerBuff));
|
||||
// }
|
||||
// mapEnterResponse.addAllBuf(towerBuffs);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +98,7 @@ public class TowerMap extends AbstractMap {
|
|||
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
||||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTower());
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTrialInfo().getFloor());
|
||||
|
||||
}
|
||||
|
||||
|
@ -97,24 +107,24 @@ public class TowerMap extends AbstractMap {
|
|||
super.refreshHp(user, teamId, checkResult);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
//删点之前进行查找
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
|
||||
if(cell.getCellId()!=mapManager.getBossXY()){
|
||||
if(mapManager.getEssenceValue()!=-1){
|
||||
if(mapManager.getTrialInfo().getEnergy()!=-1){
|
||||
if (randomMonsterType[0][1] == cell.getPointId()) {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
|
||||
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
|
||||
} else {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy());
|
||||
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getEliteEnergy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTower();i++){
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
if(mapManager.getTrialInfo().getFloor()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTrialInfo().getFloor();i++){
|
||||
ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
if(type == 3){
|
||||
|
@ -125,13 +135,13 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
}
|
||||
if(type == 4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTower()).getRandomStore());
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sTrialConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTower());
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTrialInfo().getFloor());
|
||||
return;
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
|
@ -216,7 +226,7 @@ public class TowerMap extends AbstractMap {
|
|||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||
mapManager.setCurXY(xy);
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
|
|
Loading…
Reference in New Issue