副本提交
parent
2cdf521ce3
commit
f7b77d668a
|
@ -91,11 +91,15 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
public AbstractMap getMap(int mapId) throws Exception{
|
||||
return MapEnum.getToAbstractMap(2);
|
||||
public AbstractMap getMap(int mapTypeId) throws Exception{
|
||||
return MapEnum.getToAbstractMap(mapTypeId);
|
||||
}
|
||||
public AbstractMap getMap(User user) throws Exception{
|
||||
return MapEnum.getToAbstractMap(2);
|
||||
int curMapType = user.getMapManager().getCurMapType();
|
||||
if(curMapType==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
return MapEnum.getToAbstractMap(curMapType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -687,6 +691,10 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
mapManager.setLastXY(lastXY);
|
||||
if(mapManager.getCurMapType()==2){
|
||||
Item item = user.getItemManager().getItemMap().get(1);
|
||||
ItemUtil.itemCost(user,new int[][]{{1,Math.min(item.getItemNum(),cells.size())}},BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
LOGGER.info("the uid+{},the lastXy={}",uid,lastXY);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
|
||||
}
|
||||
|
@ -1199,6 +1207,7 @@ public class MapLogic {
|
|||
mapManager.setNeedKillNum(0);
|
||||
mapManager.setStars(null);
|
||||
mapManager.setLastFightResult(0);
|
||||
mapManager.setCurMapType(0);
|
||||
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
|
||||
mapManager.setMission(null);
|
||||
if (temporaryItems != null) {
|
||||
|
|
|
@ -111,6 +111,7 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private TrialInfo trialInfo = new TrialInfo();
|
||||
|
||||
private int curMapType;
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
@ -826,6 +827,16 @@ public class MapManager extends MongoBase {
|
|||
trialInfo.setMonsterHp(monsterHp);
|
||||
updateString("trialInfo.monsterHp",monsterHp);
|
||||
}
|
||||
|
||||
public int getCurMapType() {
|
||||
return curMapType;
|
||||
}
|
||||
|
||||
public void setCurMapType(int curMapType) {
|
||||
this.curMapType = curMapType;
|
||||
updateString("curMapType",curMapType);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -165,10 +165,9 @@ public class BehaviorUtil {
|
|||
* @param fightStartRespons
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId,int maxTime,boolean isMyself) throws Exception {
|
||||
public static void getFightInfo(User user, int teamId,int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId,int maxTime,boolean isMyself) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
int teamId = mapManager.getTeamId();
|
||||
CommonProto.FightData.Builder fightData = CommonProto.FightData.newBuilder();
|
||||
CommonProto.FightTeamInfo fightTeamInfo = getFightTeamInfo(user, teamId,isMyself);
|
||||
fightData.setHeroFightInfos(fightTeamInfo);
|
||||
|
|
|
@ -62,6 +62,7 @@ public class FourtyTwoBehavior extends BaseBehavior {
|
|||
mapManager.setTrialFloor(floor + 1);
|
||||
mapManager.setTrialEnergy(0);
|
||||
mapManager.setMapIntoFlag(2);
|
||||
mapManager.updateTrialMapInfo(new HashMap<>());
|
||||
//换层清除数据
|
||||
mapManager.updateMapMonsterHp(new HashMap<>());
|
||||
return true;
|
||||
|
|
|
@ -31,13 +31,12 @@ public class FightEndRequestHandler extends BaseHandler {
|
|||
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()).getMapManager().getCurMapId())
|
||||
// .endFight(iSession.getUid(),frames, builder,dropout);
|
||||
// MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
// }
|
||||
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){
|
||||
|
|
|
@ -26,10 +26,11 @@ public class MapEnterRequestHandler extends BaseHandler{
|
|||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapEnterRequest mapEnterRequest = MapInfoProto.MapEnterRequest.parseFrom(message);
|
||||
int teamId = mapEnterRequest.getTeamId();
|
||||
|
||||
MapInfoProto.MapEnterResponse.Builder builder = MapInfoProto.MapEnterResponse.newBuilder();
|
||||
MapLogic.getInstance().getMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
// MapLogic.getInstance().getMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
|
||||
MapLogic.getInstance().getMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(),builder);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.MAP_ENTER_RESPONSE.getNumber(), builder.build(), true);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,13 +25,12 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
|
|||
int type = fightStartRequest.getType();
|
||||
int fightId = fightStartRequest.getFightId();
|
||||
int teamId = fightStartRequest.getTeamId();
|
||||
// if(type == 2){
|
||||
// FightInfoProto.FightStartResponse.Builder builder = FightInfoProto.FightStartResponse.newBuilder();
|
||||
//
|
||||
// MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid()).getMapManager().getCurMapId())
|
||||
// .startFight(iSession.getUid(),builder);
|
||||
// MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
// }else
|
||||
if(type == 2){
|
||||
FightInfoProto.FightStartResponse.Builder builder = FightInfoProto.FightStartResponse.newBuilder();
|
||||
|
||||
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).startFight(iSession.getUid(),builder);
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_START_RESPONSE_VALUE,builder.build(),true);
|
||||
}else
|
||||
if(type == 3){
|
||||
MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
}else if(type == 5){
|
||||
|
|
|
@ -71,19 +71,11 @@ public abstract class AbstractMap implements IMap {
|
|||
return mapInstence.get(mapType);
|
||||
}
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception{
|
||||
// int uid = iSession.getUid();
|
||||
public void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception{
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (teamId == 0) {
|
||||
LOGGER.info("enterMap() uid=>{} teamId =>{} ", uid, teamId);
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
if (mapManager.getCurMapId() == 0||mapManager.getCurXY()==0) {
|
||||
enterNewMap(user,mapId,teamId,mapEnterResponse);
|
||||
} else if (mapManager.getCurMapId() != mapId) {
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("地图错误,应进入" + mapManager.getCurMapId()));
|
||||
if (mapManager.getCurMapId() == 0||mapManager.getCurXY()==0||mapManager.getCurMapType()==0) {
|
||||
enterNewMap(user,4001,401,mapEnterResponse);
|
||||
}else{
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
}
|
||||
|
@ -92,7 +84,7 @@ public abstract class AbstractMap implements IMap {
|
|||
cellToProto(cells, entry);
|
||||
}
|
||||
|
||||
mapEnterResponse.setLeftTime(MapLogic.getLeftTime(user, true));
|
||||
// mapEnterResponse.setLeftTime(MapLogic.getLeftTime(user, true));
|
||||
for (Map.Entry<Integer, Integer> buffEntry : mapManager.getFoodBufferMap().entrySet()) {
|
||||
if (buffEntry.getValue()==0) {
|
||||
continue;
|
||||
|
@ -101,28 +93,28 @@ public abstract class AbstractMap implements IMap {
|
|||
mapEnterResponse.addFoodBuffers(foodBuffer);
|
||||
}
|
||||
|
||||
int reviveTime = (int) ((mapManager.getCanMoveTime() - TimeUtils.now()) / 1000);
|
||||
if (reviveTime > 0) {
|
||||
mapEnterResponse.setReviveTime(reviveTime);
|
||||
}
|
||||
// int reviveTime = (int) ((mapManager.getCanMoveTime() - TimeUtils.now()) / 1000);
|
||||
// if (reviveTime > 0) {
|
||||
// mapEnterResponse.setReviveTime(reviveTime);
|
||||
// }
|
||||
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||
// mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
if (mapManager.getTemporaryItems() != null) {
|
||||
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||
}
|
||||
MapMission mapMissionProgres = mapManager.getCopyMissionProgresById(mapId);
|
||||
if (mapMissionProgres != null) {
|
||||
Map<Integer, Integer> allMissionProgress = mapMissionProgres.getAllMissionProgress();
|
||||
List<CommonProto.ExploreDetail> exploreDetailList = new ArrayList<>(allMissionProgress.size());
|
||||
for (Map.Entry<Integer, Integer> item : allMissionProgress.entrySet()) {
|
||||
exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(item.getKey()).setProgress(item.getValue()).build());
|
||||
}
|
||||
mapEnterResponse.addAllExploreDetail(exploreDetailList);
|
||||
} else {
|
||||
LOGGER.error("the curmap={}", mapManager.getCurMapId());
|
||||
}
|
||||
// if (mapManager.getTemporaryItems() != null) {
|
||||
// mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||
// }
|
||||
// MapMission mapMissionProgres = mapManager.getCopyMissionProgresById(mapId);
|
||||
// if (mapMissionProgres != null) {
|
||||
// Map<Integer, Integer> allMissionProgress = mapMissionProgres.getAllMissionProgress();
|
||||
// List<CommonProto.ExploreDetail> exploreDetailList = new ArrayList<>(allMissionProgress.size());
|
||||
// for (Map.Entry<Integer, Integer> item : allMissionProgress.entrySet()) {
|
||||
// exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(item.getKey()).setProgress(item.getValue()).build());
|
||||
// }
|
||||
// mapEnterResponse.addAllExploreDetail(exploreDetailList);
|
||||
// } else {
|
||||
// LOGGER.error("the curmap={}", mapManager.getCurMapId());
|
||||
// }
|
||||
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
// Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
// for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
|
@ -138,7 +130,7 @@ public abstract class AbstractMap implements IMap {
|
|||
// mapEnterResponse.addHeroInfos(heroInfo);
|
||||
// }
|
||||
|
||||
LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
||||
// LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,7 +155,7 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
// 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();
|
||||
|
@ -197,7 +189,7 @@ public abstract class AbstractMap implements IMap {
|
|||
user.getPlayerInfoManager().setMapId(mapId);
|
||||
}
|
||||
//todo initTeam ?
|
||||
String error = MapLogic.getInstance().initTeamInfo(teamId, user.getId(), user, mapManager,1);
|
||||
// MapLogic.getInstance().initTeamInfo(teamId, user.getId(), user, mapManager,1);
|
||||
// if (!error.isEmpty()) {
|
||||
// LOGGER.info("enterMap() uid=>{} error =>{} ", user.getId(), error);
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
|
@ -205,7 +197,7 @@ public abstract class AbstractMap implements IMap {
|
|||
mapManager.setCurMapId(mapId);
|
||||
//todo 更新地圖次數
|
||||
user.setMapManager(mapManager);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY, SChallengeConfig.sChallengeConfigs.get(mapId).getType(),1);
|
||||
// user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY, SChallengeConfig.sChallengeConfigs.get(mapId).getType(),1);
|
||||
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId(),1));
|
||||
}
|
||||
|
||||
|
@ -274,7 +266,7 @@ public abstract class AbstractMap implements IMap {
|
|||
groupId = monsterGroupChange(option[0]);
|
||||
}
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
BehaviorUtil.getFightInfo(user, groupId, responseBuilder, pointId, sChallengeConfig.getMostTime(), true);
|
||||
BehaviorUtil.getFightInfo(user,401, groupId, responseBuilder, pointId, sChallengeConfig.getMostTime(), true);
|
||||
}
|
||||
|
||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
|
@ -368,7 +360,7 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
}
|
||||
//血量更新
|
||||
refreshHp(user, mapManager.getTeamId(),checkResult);
|
||||
// refreshHp(user, mapManager.getTeamId(),checkResult);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_GENERAL_FIGHT_REWARD);
|
||||
builder.setEnventDrop(drop.build());
|
||||
builder.setResult(resultCode);
|
||||
|
@ -540,4 +532,6 @@ public abstract class AbstractMap implements IMap {
|
|||
mapEnterResponse.addAllWakeCells(walkCells);
|
||||
}
|
||||
|
||||
public abstract void autoExitMap(User user);
|
||||
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ public class DifficultMap extends AbstractMap {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
||||
public void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid,mapEnterResponse);
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
if (mapManager.getMission() != null) {
|
||||
mapEnterResponse.setMissions(MapLogic.getInstance().getMission(mapManager.getMission()));
|
||||
|
@ -71,4 +71,9 @@ public class DifficultMap extends AbstractMap {
|
|||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoExitMap(User user) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,12 @@ package com.ljsd.jieling.handler.map.mapType;
|
|||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.map.*;
|
||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
|
@ -13,6 +17,10 @@ import com.ljsd.jieling.logic.GlobalDataManaager;
|
|||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightDispatcher;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
|
@ -43,28 +51,42 @@ public class EndlessMap extends AbstractMap{
|
|||
super(type);
|
||||
}
|
||||
|
||||
int endlessMapId = 4001;
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
public void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
// super.enterMap(uid,mapEnterResponse);
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),false,teamId).get(1);
|
||||
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
|
||||
// if (mapManager.getCurMapId() == 0||mapManager.getCurXY()==0||mapManager.getCurMapType()==0) {
|
||||
//
|
||||
// }
|
||||
//检查是否为当前副本
|
||||
if(mapManager.getCurMapType()!=0&&mapManager.getCurMapType()!=type){
|
||||
MapLogic.getInstance().getMap(user).autoExitMap(user);
|
||||
MapLogic.resetMapInfo(user,false);
|
||||
}
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
||||
for (TeamPosHeroInfo aTeamPosForHero : teamPosForHero) {
|
||||
String endlessHeroId = aTeamPosForHero.getHeroId();
|
||||
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user, user.getHeroManager().getHero(endlessHeroId), false, GlobalsDef.ENDLESS_TEAM).get(1);
|
||||
mapManager.addEndlessHero(aTeamPosForHero.getHeroId(), maxHp);
|
||||
}
|
||||
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
//是否是新的周期
|
||||
if(endlessMapInfo.getSeason()!=MapLogic.endlessSeason){
|
||||
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.Endless);
|
||||
StoreLogic.initOnsStoereWithTime(user, SEndlessMapConfig.sEndlessMapConfigMap.get(endlessMapId).getMapStoreId(),openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime());
|
||||
// StoreLogic.initOnsStoereWithTime(user, SEndlessMapConfig.sEndlessMapConfigMap.get(4001).getMapStoreId(),openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime());
|
||||
mapManager.updateEndlessSeason(MapLogic.endlessSeason);
|
||||
mapManager.updateEndlessMapId(0);
|
||||
mapManager.endlessWalkCellSave(new HashSet<>());
|
||||
mapManager.endlessMapInfoSave(new HashMap<>());
|
||||
//清除当前副本信息
|
||||
|
||||
//新创建地图
|
||||
mapManager.setCurMapType(type);
|
||||
// enterNewMap(user,4001,GlobalsDef.ENDLESS_TEAM,mapEnterResponse);
|
||||
initMap(user.getMapManager(), user);
|
||||
}else{
|
||||
|
||||
Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
|
||||
if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
|
||||
mapManager.setMapInfo(endlessMapCellInfo);
|
||||
|
@ -76,15 +98,11 @@ public class EndlessMap extends AbstractMap{
|
|||
if(endlessMapInfo.getCurCell()!=0){
|
||||
mapManager.setCurXY(endlessMapInfo.getCurCell());
|
||||
}
|
||||
mapManager.setCurMapId(endlessMapInfo.getCurMapId());
|
||||
}
|
||||
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
|
||||
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
|
||||
cellToProto(cells, entry);
|
||||
}
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
|
||||
mapManager.updateEndlessMapId(4001);
|
||||
//无尽标记点
|
||||
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
|
||||
int curMapId = entry.getKey();
|
||||
for(Map.Entry<Integer,String> signEntry: entry.getValue().entrySet()){
|
||||
|
@ -105,7 +123,18 @@ public class EndlessMap extends AbstractMap{
|
|||
mapEnterResponse.addRefreshInfo(info);
|
||||
}
|
||||
}
|
||||
//地图信息
|
||||
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
|
||||
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
|
||||
cellToProto(cells, entry);
|
||||
}
|
||||
mapManager.setCurMapType(type);
|
||||
// mapEnterResponse.addHeroInfos();
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
mapEnterResponse.setSkipFight(endlessMapInfo.getSkipFight());
|
||||
mapEnterResponse.setMapId(mapManager.getCurMapId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,16 +150,13 @@ public class EndlessMap extends AbstractMap{
|
|||
mapManager.updateEndlessFightCount(0);
|
||||
}
|
||||
//无尽副本信息保存
|
||||
mapManager.endlessWalkCellSave(mapManager.getWalkCells());
|
||||
mapManager.endlessMapInfoSave(mapManager.getMapInfo());
|
||||
super.outMap(uid, outType, curXY, builder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterNewMap(User user, int mapId,int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterNewMap(user, mapId,teamId, mapEnterResponse);
|
||||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
super.enterNewMap(user, 4001,teamId, mapEnterResponse);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,14 +188,84 @@ public class EndlessMap extends AbstractMap{
|
|||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
super.fastFight(uid, fastFightResponseBuilder);
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
User user = UserManager.getUser(uid);
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
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];
|
||||
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, GlobalsDef.ENDLESS_TEAM, 10, "", GameFightType.MapFastFight, groupId, 3);
|
||||
//怪物剩余血量
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
int[] checkResult = fightResult.getCheckResult();
|
||||
|
||||
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}else if(resultCode==0) {
|
||||
user.getTeamPosManager().updateTeamPosByTeamId(GlobalsDef.ENDLESS_TEAM, new ArrayList<>());
|
||||
for (int i = 0 ; i <team.size();i++) {
|
||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
|
||||
}
|
||||
}else{
|
||||
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,GlobalsDef.ENDLESS_TEAM);
|
||||
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);
|
||||
}
|
||||
endlessRefreshMonster(uid,mapManager.getTriggerXY());
|
||||
}
|
||||
|
||||
|
||||
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
|
||||
// if (mapManager.getMonsterId() > 0) {
|
||||
// BaseBehavior baseBehavior = baseBehaviorMap.get(1);
|
||||
// baseBehavior.process(user, groupId, fastFightResponseBuilder);
|
||||
// }
|
||||
fastFightResponseBuilder.setEnventDrop(drop.build());
|
||||
fastFightResponseBuilder.setResult(resultCode);
|
||||
fastFightResponseBuilder.setFightData(fightResult.getFightData());
|
||||
//todo 临时粘贴
|
||||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||
endlessRefreshMonster(uid,mapManager.getTriggerXY());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽小怪打死随机刷新
|
||||
* @param session
|
||||
* @param triggerXY
|
||||
* @throws Exception
|
||||
*/
|
||||
private void endlessRefreshMonster(int uid,int triggerXY) throws Exception {
|
||||
|
@ -251,13 +347,14 @@ public class EndlessMap extends AbstractMap{
|
|||
|
||||
@Override
|
||||
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||
Map<Integer, SCMap> scMap =SCMap.sCMap.get(mapManager.getCurMapId());
|
||||
int mapId = getMapIdByWorldLevel(1);
|
||||
Map<Integer, SCMap> scMap =SCMap.sCMap.get(mapId);
|
||||
Map<Integer, Cell> newMap = new HashMap<>();
|
||||
Random random = new Random();
|
||||
boolean alreadHadYunShop = StoreLogic.checkContainsStore(user, StoreType.CLOUD_STORE,true);
|
||||
mapManager.checkSuddenlyBoss();
|
||||
int suddenlyBoss = mapManager.getSuddenlyBoss();
|
||||
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getIncidentalBossCd())*1000;
|
||||
// boolean alreadHadYunShop = StoreLogic.checkContainsStore(user, StoreType.CLOUD_STORE,true);
|
||||
// mapManager.checkSuddenlyBoss();
|
||||
// int suddenlyBoss = mapManager.getSuddenlyBoss();
|
||||
// boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getIncidentalBossCd())*1000;
|
||||
|
||||
Map<Integer, Map<Integer, Integer>> initRandomPointMap = SEndlessMapConfig.initRandomPointMap;
|
||||
Map<Integer,List<Integer>> endlessRandomPoint = new HashMap<>();
|
||||
|
@ -282,19 +379,19 @@ public class EndlessMap extends AbstractMap{
|
|||
if (!MapLogic.getInstance().mapPointCanAAppear(mapPointConfig)) {
|
||||
continue;
|
||||
}
|
||||
if (mapPointConfig.getStyle() == EventType.businessman) {
|
||||
if (alreadHadYunShop) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// if (mapPointConfig.getStyle() == EventType.businessman) {
|
||||
// if (alreadHadYunShop) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
||||
// if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
||||
// continue;
|
||||
// }
|
||||
if(initRandomPointMap.get(mapId)==null){
|
||||
continue;
|
||||
}
|
||||
if(initRandomPointMap.get(mapManager.getCurMapId())==null){
|
||||
continue;
|
||||
}
|
||||
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())==null){
|
||||
if(initRandomPointMap.get(mapId).get(mapPointConfig.getId())==null){
|
||||
continue;
|
||||
}
|
||||
if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
|
||||
|
@ -308,7 +405,7 @@ public class EndlessMap extends AbstractMap{
|
|||
//无尽本随机点处理
|
||||
if(endlessRandomPoint.size()>0){
|
||||
for(Map.Entry<Integer,List<Integer>> entry:endlessRandomPoint.entrySet()){
|
||||
int count = initRandomPointMap.get(mapManager.getCurMapId()).get(entry.getKey());
|
||||
int count = initRandomPointMap.get(mapId).get(entry.getKey());
|
||||
List<Integer> points = entry.getValue();
|
||||
Collections.shuffle(points);
|
||||
for(int i = 0 ; i <count;i++){
|
||||
|
@ -320,6 +417,7 @@ public class EndlessMap extends AbstractMap{
|
|||
|
||||
}
|
||||
}
|
||||
mapManager.setCurMapId(mapId);
|
||||
initMapMission(user,newMap);
|
||||
}
|
||||
|
||||
|
@ -337,4 +435,20 @@ public class EndlessMap extends AbstractMap{
|
|||
}
|
||||
return xy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoExitMap(User user) {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.endlessWalkCellSave(mapManager.getWalkCells());
|
||||
mapManager.endlessMapInfoSave(mapManager.getMapInfo());
|
||||
mapManager.updateEndlessLocation(mapManager.getCurXY());
|
||||
try {
|
||||
MapLogic.getInstance().onlyLevelMap(user, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private int getMapIdByWorldLevel(int level){
|
||||
return 4001;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public interface IMap {
|
|||
|
||||
IMap getInstence(int mapType);
|
||||
|
||||
void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception;
|
||||
void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception;
|
||||
|
||||
void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder mapOutResponse)throws Exception;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import java.util.HashMap;
|
|||
import java.util.function.Function;
|
||||
|
||||
public enum MapEnum {
|
||||
STORY_MAP(1, StoryMap::new),
|
||||
TOWER_MAP(2, TowerMap::new),
|
||||
DIFFICULTY_MAP(3,DifficultMap::new),
|
||||
ENDLESS_MAP(4, EndlessMap::new),
|
||||
STORY_MAP(3, StoryMap::new),
|
||||
TOWER_MAP(1, TowerMap::new),
|
||||
DIFFICULTY_MAP(4,DifficultMap::new),
|
||||
ENDLESS_MAP(2, EndlessMap::new),
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public class StoryMap extends AbstractMap{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
||||
public void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid,mapEnterResponse);
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
|
||||
if (mapManager.getMission() != null) {
|
||||
|
@ -51,5 +51,10 @@ public class StoryMap extends AbstractMap{
|
|||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoExitMap(User user) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,64 +52,39 @@ public class TowerMap extends AbstractMap {
|
|||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(outType == 0||mapManager.getTrialInfo().getFloor()-1==STrialConfig.getHighestTower()) {
|
||||
//退出地图需要记录换层数据
|
||||
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<>());
|
||||
}
|
||||
LOGGER.info("退出地图");
|
||||
if(mapManager.getTrialInfo().getFloor()>=1){
|
||||
mapManager.setMapIntoFlag(1);
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
//退出副本
|
||||
autoExitMap(user);
|
||||
}else{
|
||||
//换层需要把镜像数据清除掉
|
||||
mapManager.updateTrialMapInfo(new HashMap<>());
|
||||
mapManager.updateTrialCurXY(0);
|
||||
mapManager.updateTrialExitMapId(0);
|
||||
}
|
||||
mapManager.setCurrTowerTime(0);
|
||||
super.outMap(uid,outType,curXY,builder);
|
||||
if(outType==1){
|
||||
mapManager.setCurMapId(2001);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
// if(teamId!= GlobalsDef.TRIAL_TEAM){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
public void enterMap(int uid, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
//进图时检测是否需要重置
|
||||
MapLogic.getInstance().checkTrialReset(UserManager.getUser(uid));
|
||||
MapLogic.getInstance().checkTrialReset(user);
|
||||
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
MapManager mapManager = user.getMapManager();
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
int curFloor = trialInfo.getFloor();
|
||||
if(curFloor<10000){
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(curFloor);
|
||||
if(sTrialConfig.getMapId()!=mapId){
|
||||
mapId = sTrialConfig.getMapId();
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if(mapManager.getCurMapType()!=0&&mapManager.getCurMapType()!=type){
|
||||
MapLogic.getInstance().getMap(user).autoExitMap(user);
|
||||
}
|
||||
if(!trialInfo.getMapInfo().isEmpty()&&mapManager.getCurMapId()==0){
|
||||
if(!trialInfo.getMapInfo().isEmpty()){
|
||||
mapManager.setMapInfo(trialInfo.getMapInfo());
|
||||
mapManager.setCurMapId(trialInfo.getQuitMapId());
|
||||
mapManager.setCurXY(trialInfo.getCurXY());
|
||||
List<CommonProto.Cell> cells = new ArrayList<>(trialInfo.getMapInfo().size());
|
||||
for (Map.Entry<Integer, Cell> entry : trialInfo.getMapInfo().entrySet()) {
|
||||
cellToProto(cells, entry);
|
||||
}
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
mapEnterResponse.setCurXY(trialInfo.getCurXY());
|
||||
}else{
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
//进新图
|
||||
// super.enterMap(uid,mapEnterResponse);
|
||||
initMap(mapManager,user);
|
||||
}
|
||||
Map<String, TrailHero> heroInfo = trialInfo.getHeroInfo();
|
||||
if(!heroInfo.isEmpty()){
|
||||
|
@ -128,9 +103,13 @@ public class TowerMap extends AbstractMap {
|
|||
mapEnterResponse.addInfos(info);
|
||||
}
|
||||
}
|
||||
mapManager.setTeamId(GlobalsDef.TRIAL_TEAM);
|
||||
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
|
||||
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
|
||||
cellToProto(cells, entry);
|
||||
}
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
//当前使用英雄
|
||||
TeamPosManager teamPosManager = UserManager.getUser(uid).getTeamPosManager();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
|
||||
if(teamPosHeroInfos!=null&&teamPosHeroInfos.size()==1){
|
||||
mapEnterResponse.setCurHero(teamPosHeroInfos.get(0).getHeroId());
|
||||
|
@ -139,20 +118,23 @@ public class TowerMap extends AbstractMap {
|
|||
for(int id :trialInfo.getBuffIds()){
|
||||
mapEnterResponse.addFoodBuffers(CommonProto.FoodBuffer.newBuilder().setBufferId(id).setLeftStep(-1).build());
|
||||
}
|
||||
mapManager.setCurMapType(type);
|
||||
mapEnterResponse.setMapId(mapManager.getCurMapId());
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
// 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);
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
||||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTrialInfo().getFloor());
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTrialInfo().getFloor());
|
||||
|
||||
}
|
||||
|
||||
|
@ -172,9 +154,7 @@ public class TowerMap extends AbstractMap {
|
|||
return;
|
||||
}
|
||||
int floor = mapManager.getTrialInfo().getFloor();
|
||||
// if(floor>=101&&floor<=200){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
|
||||
STrialConfig sTrialConfig;
|
||||
if(floor>10000){
|
||||
TreeMap<Integer,STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>) STrialConfig.sTrialConfigMap;
|
||||
|
@ -225,7 +205,9 @@ public class TowerMap extends AbstractMap {
|
|||
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()[0][1]);
|
||||
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;
|
||||
|
@ -234,9 +216,20 @@ public class TowerMap extends AbstractMap {
|
|||
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};
|
||||
}
|
||||
resultGame = MathUtils.randomFromWeightWithTaking(gameArray,sTrialConfig.getGameCount()[1]);
|
||||
}
|
||||
int i = 0;
|
||||
while (cellMap2.size() < sTrialConfig.getGameCount()[1]) {
|
||||
i++;
|
||||
if (i >= 100) {
|
||||
break;
|
||||
}
|
||||
|
@ -244,7 +237,14 @@ public class TowerMap extends AbstractMap {
|
|||
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()[1][cellMap2.size()+1]);
|
||||
if(resultGame==null){
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
|
@ -315,6 +315,7 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.setCurXY(xy);
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setTrialEnergy(0);
|
||||
mapManager.setCurMapId(sTrialConfig.getMapId());
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
|
@ -370,7 +371,7 @@ public class TowerMap extends AbstractMap {
|
|||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
Map<Integer, List<Integer>> monsterHp = trialInfo.getMonsterHp();
|
||||
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), 10, "", GameFightType.MapFastFight, groupId, 3);
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, GlobalsDef.TRIAL_TEAM, 10, "", GameFightType.MapFastFight, groupId, 3);
|
||||
//怪物剩余血量
|
||||
if(monsterHp!=null&&!monsterHp.isEmpty()&&monsterHp.containsKey(cell.getCellId())){
|
||||
pveFightEvent.setMonsterRemainHp(monsterHp.get(cell.getCellId()));
|
||||
|
@ -386,7 +387,7 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
|
||||
if(teamPosHeroInfos==null||teamPosHeroInfos.size()!=1){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
@ -607,4 +608,28 @@ public class TowerMap extends AbstractMap {
|
|||
response.setDrop(drop);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoExitMap(User user) {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
//退出地图需要记录换层数据
|
||||
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<>());
|
||||
}
|
||||
LOGGER.info("退出地图");
|
||||
if(mapManager.getTrialInfo().getFloor()>=1){
|
||||
mapManager.setMapIntoFlag(1);
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2481,9 +2481,10 @@ public class HeroLogic{
|
|||
*/
|
||||
public CommonProto.Drop.Builder heroBackDrop(User user,List<String> heroIds,int returnPercent,int reason,boolean isAddEspecial)throws Exception{
|
||||
Map<Integer,Integer> returnItemMap = new HashMap<>();
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
for(String heroId:heroIds){
|
||||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
//如果是进阶把装备返还
|
||||
//如果是进阶把装备、宝物返还
|
||||
if(reason==BIReason.UPHERO_DECOMPOS_HERO_REWARD){
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
|
@ -2493,6 +2494,13 @@ public class HeroLogic{
|
|||
if(soulEquipByPositionMap!=null&&soulEquipByPositionMap.size()>0){
|
||||
soulEquipByPositionMap.forEach((k,v)->returnItemMap.put(v,returnItemMap.getOrDefault(v,0)+1));
|
||||
}
|
||||
Set<String> jewelInfo = hero.getJewelInfo();
|
||||
for(String equipId:jewelInfo){
|
||||
if(!equipMap.containsKey(equipId)){
|
||||
continue;
|
||||
}
|
||||
equipMap.get(equipId).setHeroId("");
|
||||
}
|
||||
}
|
||||
int breakId = hero.getBreakId();
|
||||
int templateId = hero.getTemplateId();
|
||||
|
|
|
@ -393,8 +393,11 @@ public class ItemLogic {
|
|||
List<Integer> heroIdReport = new ArrayList<>();
|
||||
List<Integer> heroLevelReport = new ArrayList<>();
|
||||
List<Integer> heroStarReport = new ArrayList<>();
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
|
||||
for (String heroId : heroIdsList) {
|
||||
Hero hero = heroManager.getHeroMap().get(heroId);
|
||||
//卸下魂印装备
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
if(equipByPositionMap!=null&&equipByPositionMap.size()>0){
|
||||
|
@ -403,6 +406,14 @@ public class ItemLogic {
|
|||
if(soulEquipByPositionMap!=null&&soulEquipByPositionMap.size()>0){
|
||||
soulEquipByPositionMap.forEach((k,v)->baseItemMap.put(v,baseItemMap.getOrDefault(v,0)+1));
|
||||
}
|
||||
//卸下宝物
|
||||
Set<String> jewelInfo = hero.getJewelInfo();
|
||||
for(String equipId:jewelInfo){
|
||||
if(!equipMap.containsKey(equipId)){
|
||||
continue;
|
||||
}
|
||||
equipMap.get(equipId).setHeroId("");
|
||||
}
|
||||
|
||||
heroIdReport.add(hero.getTemplateId());
|
||||
heroLevelReport.add(hero.getLevel());
|
||||
|
|
|
@ -68,6 +68,12 @@ public class STrialConfig implements BaseConfig {
|
|||
|
||||
private int[][] boxPosition;
|
||||
|
||||
private int[] gameType1;
|
||||
|
||||
private int[] gameType2;
|
||||
|
||||
private int[] gameType3;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -121,4 +127,16 @@ public class STrialConfig implements BaseConfig {
|
|||
public int[][] getMonsterPoint() {
|
||||
return monsterPoint;
|
||||
}
|
||||
|
||||
public int[] getGameType1() {
|
||||
return gameType1;
|
||||
}
|
||||
|
||||
public int[] getGameType2() {
|
||||
return gameType2;
|
||||
}
|
||||
|
||||
public int[] getGameType3() {
|
||||
return gameType3;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue