爬塔时间修改

back_recharge
lvxinran 2019-07-08 19:54:57 +08:00
parent 1b49020695
commit cab55a367c
3 changed files with 52 additions and 45 deletions

View File

@ -14,5 +14,6 @@ public interface GlobalGm {
int VIP_LEVEL = 11; // 根据等级开启对应的关卡 int VIP_LEVEL = 11; // 根据等级开启对应的关卡
int RESET_USER_NAME = 12; int RESET_USER_NAME = 12;
int CREATE_INVADE = 13; //生成外敌 int CREATE_INVADE = 13; //生成外敌
int SET_TOWER_NUMBER = 14;//设置试炼副本进入层数
} }

View File

@ -206,7 +206,10 @@ public class GMRequestHandler extends BaseHandler{
break; break;
case GlobalGm.CREATE_INVADE: case GlobalGm.CREATE_INVADE:
CombatLogic.getInstance().randomInvasionBoss(iSession.getUid(),prarm1,100,true); CombatLogic.getInstance().randomInvasionBoss(iSession.getUid(),prarm1,100,true);
break;
case GlobalGm.SET_TOWER_NUMBER:
MapLogic.getInstance().setTower(iSession.getUid(),prarm1);
break;
default: default:
} }
try { try {

View File

@ -198,9 +198,10 @@ public class MapLogic {
} }
mapEnterResponse.addAllBuf(towerBuffs); mapEnterResponse.addAllBuf(towerBuffs);
} }
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
mapEnterResponse.setDieCount(mapManager.getDieCount()); mapEnterResponse.setDieCount(mapManager.getDieCount());
mapEnterResponse.addAllMapList(cells); mapEnterResponse.addAllMapList(cells);
mapEnterResponse.setCurXY(mapManager.getCurXY()); mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells()); mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
if (mapManager.getTemporaryItems() != null) { if (mapManager.getTemporaryItems() != null) {
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems())); mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
@ -230,14 +231,6 @@ public class MapLogic {
.build(); .build();
mapEnterResponse.addHeroInfos(heroInfo); mapEnterResponse.addHeroInfos(heroInfo);
} }
// List<MapInfoProto.TowerBuff> buffers = new ArrayList<>();
// if(mapManager.getTowerUnusedBuffer()!=null){
// for(Map.Entry<Integer,Integer> entry:mapManager.getTowerUnusedBuffer().entrySet()){
// TowerBuff buff = new TowerBuff(entry.getKey(),entry.getValue());
// buffers.add(CBean2Proto.getTowerBuff(buff));
// }
// }
// mapManager.setStartExporeTime(System.currentTimeMillis());
LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId()); LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true); MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
} }
@ -429,37 +422,40 @@ public class MapLogic {
Cell cell = mapManager.getMapInfo().get(triggerXY); Cell cell = mapManager.getMapInfo().get(triggerXY);
if (cell == null) { if (cell == null) {
cell = mapManager.getMapInfo().get(curXY); cell = mapManager.getMapInfo().get(curXY);
if (cell == null) { if (cell == null&&mapManager.getEssenceValue()!=-1) {
LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY); LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY);
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
return; return;
} }
} }
int pointId = cell.getPointId(); int pointId = cell.getPointId();
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(pointId); MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(pointId);
if (mapPointConfig.getStyle() == EventType.suddenlyBoss) { if (mapPointConfig.getStyle() == EventType.suddenlyBoss) {
int suddenlyBoss = mapManager.getSuddenlyBoss(); int suddenlyBoss = mapManager.getSuddenlyBoss();
SEventPointConfig sEventPointConfig = SEventPointConfig.sEventPointConfigMap.get(cell.getEventId()); SEventPointConfig sEventPointConfig = SEventPointConfig.sEventPointConfigMap.get(cell.getEventId());
if (suddenlyBoss == 0) { if (suddenlyBoss == 0) {
int now = (int) (TimeUtils.now() / 1000); int now = (int) (TimeUtils.now() / 1000);
int bossId = sEventPointConfig.getOption()[0]; int bossId = sEventPointConfig.getOption()[0];
mapManager.findSuddenlyBoss(bossId, now); mapManager.findSuddenlyBoss(bossId, now);
}
} else if (mapPointConfig.getStyle() == EventType.businessman) {
if (!user.getStoreManager().getStoreInfoMap().containsKey(3)) {
StoreLogic.initOneStore(user, 3);
}
} }
} else if (mapPointConfig.getStyle() == EventType.businessman) {
if (!user.getStoreManager().getStoreInfoMap().containsKey(3)) {
StoreLogic.initOneStore(user, 3);
}
}
mapManager.setTriggerXY(triggerXY); mapManager.setTriggerXY(triggerXY);
mapManager.addWalkCells(new HashSet<>(cells)); mapManager.addWalkCells(new HashSet<>(cells));
mapManager.setCurXY(curXY); mapManager.setCurXY(curXY);
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder() MapInfoProto.MapUpdateResponse.Builder mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder();
.setEventId(cell.getEventId()) mapUpdateResponse.setLeftTime(getLeftTime(user, true));
.setLeftTime(getLeftTime(user, true)) mapUpdateResponse.setEventId(cell.getEventId());
.build();
LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId());
// LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId());
mapManager.updateFoodBufferByStep(cells.size()); mapManager.updateFoodBufferByStep(cells.size());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
} }
@ -825,6 +821,7 @@ public class MapLogic {
} }
mapManager.setEssenceValue(0); mapManager.setEssenceValue(0);
mapManager.setCurrTowerTime(0);
boolean result = onlyLevelMap(user, true); boolean result = onlyLevelMap(user, true);
if (!result) { if (!result) {
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
@ -837,7 +834,6 @@ public class MapLogic {
if(mapManager.getTower()>mapManager.getHighestTower()){ if(mapManager.getTower()>mapManager.getHighestTower()){
mapManager.setHighestTower(mapManager.getTower()); mapManager.setHighestTower(mapManager.getTower());
} }
mapManager.setCurrTowerTime(0);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
return; return;
} }
@ -1033,10 +1029,12 @@ public class MapLogic {
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower()); STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType(); int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
if(cell.getCellId()!=mapManager.getBossXY()){ if(cell.getCellId()!=mapManager.getBossXY()){
if (randomMonsterType[0][1] == cell.getPointId()&&mapManager.getEssenceValue()!=-1) { if(mapManager.getEssenceValue()!=-1){
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy()); if (randomMonsterType[0][1] == cell.getPointId()) {
} else { mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy()); } else {
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy());
}
} }
} }
} }
@ -2129,12 +2127,10 @@ public class MapLogic {
int[][] bossType = config.getRandomBossType(); int[][] bossType = config.getRandomBossType();
type = MathUtils.randomFromWeight(bossType); type = MathUtils.randomFromWeight(bossType);
// if(mapManager.getTower()<=4){ if(mapManager.getTower()%5!=0){
// type = 2; type = 3;
// } }
// }else if(mapManager.getTower()==2){ LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
// type = 3;
clearNormalMonster(user);
int[][][] pointId = config.getRandomMapPointId(); int[][][] pointId = config.getRandomMapPointId();
int mapId = config.getMapId(); int mapId = config.getMapId();
SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId); SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId);
@ -2143,6 +2139,7 @@ public class MapLogic {
Set<Integer> xySet = CellUtil.getSurroundPos(mapSize[0],mapSize[1],mapManager.getCurXY()); Set<Integer> xySet = CellUtil.getSurroundPos(mapSize[0],mapSize[1],mapManager.getCurXY());
LOGGER.info(xySet.toString()); LOGGER.info(xySet.toString());
Map<Integer, Cell> mapInfo = mapManager.getMapInfo(); Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
clearNormalMonster(user);
Iterator<Integer> it = xySet.iterator(); Iterator<Integer> it = xySet.iterator();
Map<Integer, MapPointConfig> pointConfig = MapPointConfig.scMapEventMap; Map<Integer, MapPointConfig> pointConfig = MapPointConfig.scMapEventMap;
@ -2260,6 +2257,7 @@ public class MapLogic {
} }
public void clearNormalMonster(User user) throws Exception { public void clearNormalMonster(User user) throws Exception {
MapManager mapManager = user.getMapManager();
LOGGER.info("删除当前地图小怪!!"); LOGGER.info("删除当前地图小怪!!");
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap; Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
Set<Integer> destoryCell = new HashSet<>(); Set<Integer> destoryCell = new HashSet<>();
@ -2267,7 +2265,7 @@ public class MapLogic {
for(Map.Entry<Integer,Cell> entry:mapInfo.entrySet()){ for(Map.Entry<Integer,Cell> entry:mapInfo.entrySet()){
int monsterType = configMap.get(entry.getValue().getPointId()).getStyle(); int monsterType = configMap.get(entry.getValue().getPointId()).getStyle();
if(monsterType==1||monsterType==11){ if(monsterType==1||monsterType==11){
if(entry.getValue().getEventId() == -1){ if(!CellUtil.checkIsNextCell(mapManager.getTriggerXY(),entry.getKey())&&entry.getValue().getEventId() == -1){
continue; continue;
} }
destoryCell.add(entry.getValue().getPointId()); destoryCell.add(entry.getValue().getPointId());
@ -2303,9 +2301,9 @@ public class MapLogic {
MessageUtil.sendErrorResponse(iSession,0,messageType.getNumber(),"最高层数为0无需重置。"); MessageUtil.sendErrorResponse(iSession,0,messageType.getNumber(),"最高层数为0无需重置。");
return; return;
} }
int afterResetTower = mapManager.getHighestTower()-(mapManager.getHighestTower()%5); int afterResetTower = mapManager.getHighestTower()-(mapManager.getHighestTower()%5==0?5:mapManager.getHighestTower()%5);
LOGGER.info("重置当前层,当前层为{},重置为{}",mapManager.getTower(),afterResetTower); LOGGER.info("重置当前层,当前层为{},重置为{}",mapManager.getTower(),afterResetTower);
if(mapManager.getTower()>=5){ if(mapManager.getTower()>5){
mapManager.setTower(afterResetTower); mapManager.setTower(afterResetTower);
}else{ }else{
mapManager.setTower(1); mapManager.setTower(1);
@ -2320,6 +2318,7 @@ public class MapLogic {
mapManager.setTowerStartTime(0); mapManager.setTowerStartTime(0);
mapManager.setCurrTowerTime(0); mapManager.setCurrTowerTime(0);
resetMapInfo(user, true); resetMapInfo(user, true);
// mapManager.setTower(98);
MapInfoProto.MapTowerResetResponse mapTowerResetResponse = MapInfoProto.MapTowerResetResponse MapInfoProto.MapTowerResetResponse mapTowerResetResponse = MapInfoProto.MapTowerResetResponse
.newBuilder() .newBuilder()
.setTower(mapManager.getTower()) .setTower(mapManager.getTower())
@ -2452,5 +2451,9 @@ public class MapLogic {
} }
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
} }
//GM调用
public void setTower(int uid,int towerNumber) throws Exception {
UserManager.getUser(uid).getMapManager().setTower(towerNumber);
}
} }