无尽副本最后修改

lvxinran 2021-07-03 00:05:36 +08:00
parent de1432222f
commit 99cd3246f2
5 changed files with 49 additions and 27 deletions

View File

@ -67,22 +67,7 @@ public class GetEndlessHeroInfoListHandler extends BaseHandler<HeroInfoProto.Get
.setIsSendFinish(isSendFinish);
MapManager mapManager = user.getMapManager();
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.Endless);
if(openTimeOfFuntionCacheByType!=null&&endlessMapInfo.getSeason()!=openTimeOfFuntionCacheByType.getTimes()){
// StoreLogic.initOnsStoereWithTime(user, SEndlessMapConfig.sEndlessMapConfigMap.get(4001).getMapStoreId(),openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime());
mapManager.updateEndlessSeason(openTimeOfFuntionCacheByType.getTimes());
mapManager.updateEndlessMapId(0);
mapManager.endlessWalkCellSave(new HashSet<>());
mapManager.endlessMapInfoSave(new HashMap<>());
mapManager.updateEndlessMoraleLevel(0);
mapManager.clearEndlessOpenCell();
mapManager.removeEndlessMonsterHp();
// 清理无尽副本道具
MapLogic.getInstance().clearEndLessDrop(iSession.getUid());
MapLogic.getInstance().getMap(2).initMap(user.getMapManager(), user);
user.getUserMissionManager().onGameEvent(user, GameEvent.ENDLESS_MISSION_REFRESH);
}
if(isSendFinish){
build.setEndlessMapId(mapManager.getEndlessMapInfo().getCurMapId());
}

View File

@ -69,7 +69,7 @@ public class MapLogic {
public Map<Integer, MapGame> baseGameMap = new HashMap<>();
public static Set<Integer> endlessMapCell = new HashSet<>();
public static Map<Integer,Set<Integer>> endlessMapCell = new HashMap<>();
public static int endlessMapId;
public static final int STAR_1 = 1; // 完成任务
@ -86,10 +86,17 @@ public class MapLogic {
for (MapGame mapGame : beansOfMapGame.values()) {
baseGameMap.put(mapGame.getType(), mapGame);
}
for(int i = 1;i<=30;i++){
for(int j = 1;j<30;j++){
endlessMapCell.add(i*256+j);
Map<Integer, SChallengeMapConfig> sChallengeConfigs = STableManager.getConfig(SChallengeMapConfig.class);
for(Map.Entry<Integer,SChallengeMapConfig> entry:sChallengeConfigs.entrySet()){
SChallengeMapConfig value = entry.getValue();
if(value.getMapId()>4000&&value.getMapId()<5000){
Set<Integer> xy = new HashSet<>();
for(int i = 1;i<=entry.getValue().getSize()[0];i++){
for(int j = 1;j<entry.getValue().getSize()[1];j++){
xy.add((i*256+j));
}
}
endlessMapCell.put(value.getMapId(),xy);
}
}
}
@ -709,7 +716,7 @@ public class MapLogic {
if(mapManager.getCurMapType()==2){
Item item = user.getItemManager().getItemMap().get(1);
ItemUtil.itemCost(user,new int[][]{{1,Math.min((int)item.getItemNum(),cells.size())}},BIReason.ENDLESS_CONSUME_EXECUTION,1);
Set<Integer> openCells = getOpenCells(cells);
Set<Integer> openCells = getOpenCells(mapManager.getCurMapId(),cells);
mapManager.addEndlessOpenCell(openCells);
Set<Integer> walkCells = mapManager.getEndlessMapInfo().getOpenCell();
user.getUserMissionManager().onGameEvent(user,GameEvent.ENDLESS_OPEN_MAP,walkCells.size()*100/(30*30));
@ -717,15 +724,19 @@ public class MapLogic {
LOGGER.info("the uid+{},the lastXy={}",uid,lastXY);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
}
private Set<Integer> getOpenCells(List<Integer> cells){
private Set<Integer> getOpenCells(int mapId,List<Integer> cells){
int square = 3;//范围是3
Set<Integer> openCells= new HashSet<>();
if(!endlessMapCell.containsKey(mapId)){
return null;
}
Set<Integer> mapAllCell = endlessMapCell.get(mapId);
for(int cell:cells){
for(int i =-square;i<=square;i++){
int yOff = square - Math.abs(i);
for(int j = -yOff;j<=yOff;j++){
int openCell = cell + 256 * i + j;
if(!endlessMapCell.contains(openCell)){
if(!mapAllCell.contains(openCell)){
continue;
}
openCells.add(openCell);

View File

@ -278,6 +278,11 @@ public class MapManager extends MongoBase {
itemNum=200;
item.setEndingTime((int)(startTime/1000));
lastUpdateEnergyTime = (int)(startTime/1000);
Map<String, Integer> resetInfo = new HashMap<>();
for(String heroId:user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().keySet()){
resetInfo.put(heroId,10000);
}
user.getMapManager().updateEndlessHero(resetInfo);
}
}
if( recoveryTimes>0){

View File

@ -39,6 +39,7 @@ public class FiftyTwoBehavior extends BaseBehavior {
BehaviorUtil.destoryPoint(user,behaviorTypeValues[0][1]);
int[] behaviorTypeValue = behaviorTypeValues[1];
user.getUserMissionManager().onGameEvent(user, GameEvent.ENDLESS_KILL_SMALL_BOSS);
Set<Integer> checkPoint = new HashSet<>();
Arrays.stream(behaviorTypeValue).forEach(checkPoint::add);
for(Map.Entry<Integer, Cell> entry:user.getMapManager().getMapInfo().entrySet()){
@ -49,7 +50,6 @@ public class FiftyTwoBehavior extends BaseBehavior {
}
int[] add = behaviorTypeValues[2];
BehaviorUtil.addBehaviorInfo(add[2],user, CellUtil.xy2Pos(add[0],add[1]));
user.getUserMissionManager().onGameEvent(user, GameEvent.ENDLESS_KILL_SMALL_BOSS);
return true;
}

View File

@ -68,6 +68,24 @@ public class EndlessMap extends AbstractMap{
MapLogic.getInstance().getMap(user).autoExitMap(user);
MapLogic.resetMapInfo(user,false);
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.Endless);
if(openTimeOfFuntionCacheByType!=null&&endlessMapInfo.getSeason()!=openTimeOfFuntionCacheByType.getTimes()){
// StoreLogic.initOnsStoereWithTime(user, SEndlessMapConfig.sEndlessMapConfigMap.get(4001).getMapStoreId(),openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime());
mapManager.updateEndlessSeason(openTimeOfFuntionCacheByType.getTimes());
mapManager.updateEndlessMapId(0);
mapManager.endlessWalkCellSave(new HashSet<>());
mapManager.endlessMapInfoSave(new HashMap<>());
mapManager.updateEndlessMoraleLevel(0);
mapManager.clearEndlessOpenCell();
mapManager.removeEndlessMonsterHp();
// 清理无尽副本道具
MapLogic.getInstance().clearEndLessDrop(uid);
MapLogic.getInstance().getMap(2).initMap(user.getMapManager(), user);
user.getUserMissionManager().onGameEvent(user, GameEvent.ENDLESS_MISSION_REFRESH);
}
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
if(teamPosForHero!=null){
for (TeamPosHeroInfo aTeamPosForHero : teamPosForHero) {
@ -77,7 +95,6 @@ public class EndlessMap extends AbstractMap{
mapManager.addEndlessHero(aTeamPosForHero.getHeroId(),(int) hp);
}
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
//是否是新的周期
LOGGER.info("======================无尽副本,周期验证;用户:{ },,内存:{ }",endlessMapInfo.getSeason());
@ -92,10 +109,13 @@ public class EndlessMap extends AbstractMap{
if(endlessMapInfo.getCurCell()!=0){
mapManager.setCurXY(endlessMapInfo.getCurCell());
}
if(endlessMapInfo.getCurMapId()==0){
mapManager.updateEndlessMapId(MapLogic.endlessMapId);
}
mapManager.setCurMapId(endlessMapInfo.getCurMapId());
mapManager.updateEndlessMapId(mapManager.getCurMapId());
//无尽标记点
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
int curMapId = entry.getKey();
@ -490,6 +510,7 @@ public class EndlessMap extends AbstractMap{
mapManager.setCurXY(xy);
mapManager.setCurMapId(mapId);
mapManager.updateEndlessMapId(mapId);
mapManager.updateEndlessLocation(xy);
initMapMission(user,newMap);
}