diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java index 2fe90d146..6c62c7f24 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java @@ -7,12 +7,10 @@ import manager.AbstractClassStaticConfig; import manager.STableManager; import manager.Table; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { + private static TreeMap force2robotId; @Override public void registConfigs(Set registConfigs) { registConfigs.add(SArenaRobotConfig.class.getAnnotation(Table.class).name()); @@ -20,6 +18,7 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { @Override public void figureConfigs() { + force2robotId = new TreeMap<>(); Map integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap(); for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){ List heroList = sArenaRobotConfig.getHeroList(); @@ -30,7 +29,9 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { sArenaRobotConfig.setBreakId(heroBreakId); sArenaRobotConfig.setStarOfHeroMap(starHeroMap); } - sArenaRobotConfig.setTotalForce(HeroLogic.getInstance().calRobotTotalForce(sArenaRobotConfig)); + int totleForce = HeroLogic.getInstance().calRobotTotalForce(sArenaRobotConfig); + sArenaRobotConfig.setTotalForce(totleForce); + force2robotId.put(totleForce,sArenaRobotConfig.getId()); } int[][] returnMaterials = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getReturnMaterials(); @@ -44,4 +45,13 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { } } } + + public static Integer getFloorForce2robotId(int force) { + + Map.Entry entry = force2robotId.ceilingEntry(force); + if(null==entry){ + return force2robotId.firstEntry().getValue(); + } + return entry.getValue(); + } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java b/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java index 75ff31a28..375412fb0 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java @@ -93,6 +93,8 @@ public class HandlerLogicThread extends Thread{ whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE); whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE); whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE); + whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE); + } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/EndExpeditionBattleRequest.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/EndExpeditionBattleRequest.java index 544dbcdfb..bbc27b1d3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/EndExpeditionBattleRequest.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/EndExpeditionBattleRequest.java @@ -13,8 +13,6 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic; import com.ljsd.jieling.logic.fight.DefFightSnapData; import com.ljsd.jieling.logic.fight.FightUtil; import com.ljsd.jieling.logic.fight.GameFightType; -import com.ljsd.jieling.logic.fight.PVPFightEvent; -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.network.session.ISession; @@ -121,22 +119,6 @@ public class EndExpeditionBattleRequest extends BaseHandler nodeInfos = new HashSet<>(); - user.getExpeditionManager().getExpeditionNodeInfos().forEach((s, nodeInfo1) -> { - if (nodeInfo1.getLay() != oldlay) { - return; - } - CommonProto.ExpeditionNodeInfo.Builder build = CommonProto.ExpeditionNodeInfo.newBuilder() - .setSortId(nodeInfo1.getSortId()) - .setState(nodeInfo1.getState()); - if (nodeInfo1.getSortId() == nodeId) { - build.setBossTeaminfo(ExpeditionLogic.getExpeditionTeamInfoProto(nodeInfo1)); - }else { - return; - } - nodeInfos.add(build.build()); - }); - Set ids = new HashSet<>(); if (resultCode != 1) { @@ -158,14 +140,16 @@ public class EndExpeditionBattleRequest extends BaseHandler getNodePro(User user,int oldlay,int nodeId){ + Set nodeInfos = new HashSet<>(); + user.getExpeditionManager().getExpeditionNodeInfos().forEach((s, nodeInfo1) -> { + if (nodeInfo1.getLay() != oldlay) { + return; + } + CommonProto.ExpeditionNodeInfo.Builder build = CommonProto.ExpeditionNodeInfo.newBuilder() + .setSortId(nodeInfo1.getSortId()) + .setState(nodeInfo1.getState()); + if (nodeInfo1.getSortId() == nodeId) { + build.setBossTeaminfo(ExpeditionLogic.getExpeditionTeamInfoProto(nodeInfo1)); + }else { + return; + } + nodeInfos.add(build.build()); + }); + return nodeInfos; + } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/StartExpeditionBattleRequest.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/StartExpeditionBattleRequest.java index afcb75ac6..1202c940e 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/StartExpeditionBattleRequest.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/Expedition/StartExpeditionBattleRequest.java @@ -73,14 +73,14 @@ public class StartExpeditionBattleRequest extends BaseHandler ids) throws Exception { for(Integer closeId : ids){ int sameType = STableManager.getConfig(SGlobalSystemConfig.class).get(closeId).getIsIDdSame(); -// FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumByType(sameType).g; +// FunctionIdEnum type = FunctionIdEnum.getFunctionIdEnumById(sameType).g; FunctionManager function = FunctionContext.getFunction(sameType); if(function!=null){ function.closeAction(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/eventhandler/HeroFiveStarGetEventHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/eventhandler/HeroFiveStarGetEventHandler.java index 41ba555a1..8cd86fd48 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/eventhandler/HeroFiveStarGetEventHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/eventhandler/HeroFiveStarGetEventHandler.java @@ -35,6 +35,7 @@ public class HeroFiveStarGetEventHandler implements IEventHandler { if (!(event instanceof HeroFiveStarGetEvent)) return; + //动态控制购买数量 User user = UserManager.getUser(((HeroFiveStarGetEvent) event).getUid()); RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo(); long now = System.currentTimeMillis(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java index db841d647..12bde5102 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java @@ -90,8 +90,7 @@ public class UserManager { SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1); playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy()); playerManager.setRideLevel(1); - int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, true); - playerManager.setMaxForce(force); + PlayerLogic.getInstance().vipflushEveryDay(user,null); ActivityLogic.getInstance().newPlayerOpenActivityMission(user); PlayerLogic.getInstance().playerInfoUpdate(user); @@ -109,6 +108,9 @@ public class UserManager { List teamHeros = new ArrayList<>(1); teamHeros.add(heroMap.values().iterator().next()); teamPosManager.addTeamOfInitPlayer(teamHeros); + int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, true); + playerManager.setMaxForce(force); + user.getExpeditionManager().setForceSnap(force); KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java index a546ac06a..6108ca502 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.expedition; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; import com.ljsd.jieling.config.clazzStaticCfg.PlayStaticConfig; +import com.ljsd.jieling.config.clazzStaticCfg.SArenaRobotStaticConfig; import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; @@ -71,8 +72,6 @@ public class ExpeditionLogic { manager.clearPropertyItems(); manager.getHeroHPWithChange().clear(); reSetNode(user); - - } private void takeAllReward(User user)throws Exception { @@ -190,8 +189,15 @@ public class ExpeditionLogic { } + /** + * 添加节点战力数据 匹配的战力数值= 每层的基准战力+random战力+ 类型加成战力 + * 优先从战力排行榜中向下匹配真人数据 ,没有从机器人中匹配 + * @param user + * @throws Exception + */ private void reSetNode(User user) throws Exception { + //创建节点数据 Set nodeSets = createNodeSet(); //存储并设置英雄快照 @@ -199,7 +205,7 @@ public class ExpeditionLogic { int sortId = nodeInfo.getSortId(); try { //生成节点boss信息 - int size = STableManager.getConfig(SExpeditionFloorConfig.class).size(); + float size = (float)STableManager.getConfig(SExpeditionFloorConfig.class).size(); //战力基准值=maxforce*0.8+1/15(max-min)*lay) SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1); if (sExpeditionSetting == null) { @@ -207,19 +213,26 @@ public class ExpeditionLogic { } int minFoce = sExpeditionSetting.getMatchForce()[0]; int manFoce = sExpeditionSetting.getMatchForce()[1]; - int standerFoce = (int) (user.getExpeditionManager().getForceSnap() * (minFoce / 10000f) + nodeInfo.getLay() / size * (manFoce - minFoce) / 10000f); + int standerFoce = (int) (user.getExpeditionManager().getForceSnap() * (minFoce / 10000f) + nodeInfo.getLay() / size * (manFoce - minFoce)); int randomForce = (int) (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f)); + //TODO 战斗节点 不同类型 额外战力加成 走配置 + if(nodeInfo.getType()==NODETYPE_ADVANCE){ + randomForce+=1000; + }else if(nodeInfo.getType()==NODETYPE_BOSS){ + randomForce+=3000; + } Set> typedTuples = RedisUtil.getInstence().rangeByScoreWithScores(RedisKey.AREDEF_TEAM_FORCE_RANK, "", 0, randomForce); if (typedTuples.size() == 0) { //战力没有获取到 从机器人中选 - Set set = ArenaLogic.randomRobot(SArenaSetting.getSArenaSetting().getScore(), 1); - if (set.size() == 0) { - throw new ErrorCodeException(ErrorCode.CFG_NULL); - } - int robotId = set.iterator().next(); - +// Set set = ArenaLogic.randomRobot(SArenaSetting.getSArenaSetting().getScore(), 1); +//// if (set.size() == 0) { +//// throw new ErrorCodeException(ErrorCode.CFG_NULL); +//// } +// int robotId = set.iterator().next(); + //提前战力排序 支持战力查找机器人 + int robotId= SArenaRobotStaticConfig.getFloorForce2robotId(randomForce); SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(robotId); snapOneFightInfo(nodeInfo, sArenaRobotConfig); } else { diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java index 9b4907829..e1bc7614a 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java @@ -381,8 +381,6 @@ public class BuyGoodsLogic { continue; } - - int[] discountType = sRechargeCommodityConfig.getDiscountType(); int time = sRechargeCommodityConfig.getTime(); long startTime=0; @@ -404,25 +402,27 @@ public class BuyGoodsLogic { } if(type == 4){ + //4#妖灵师星级#持续时间 if(!typeBagMap.containsKey(value)){ continue; } startTime = typeBagMap.get(value); - int addtime = discountType[2]; - int diffHour = (int) ((now - startTime) / 3600 / 1000); + int addtime = discountType[2]*3600;//minute + int diffHour = (int) ((now - startTime) / 1000); if (diffHour >= addtime) { + //超过2小时重置动态购买次数 rechargeInfo.removeDyGoodsCanBuyTimes(goodsId); continue; } - endTime = startTime + addtime * 3600 * 1000; + endTime = startTime + addtime * 1000;//minute if (rechargeInfo.getCacheSendedTypes().containsKey(value)) { long lasttime = rechargeInfo.getCacheSendedTypes().get(value); if(lasttime != startTime){ needChange = true; rechargeInfo.getCacheSendedTypes().put(value, startTime); - int diffHourTemp = (int) ((now - lasttime) / 3600 / 1000); + int diffHourTemp = (int) ((now - lasttime) / 1000);//minute if (diffHourTemp < addtime) { startTime =0; }