Merge branch 'master' of 60.1.1.230:backend/jieling_server
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java
commit
d1bd1ebade
|
@ -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<Integer, Integer> force2robotId;
|
||||
@Override
|
||||
public void registConfigs(Set<String> 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<Integer, SArenaRobotConfig> integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap();
|
||||
for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){
|
||||
List<Integer> 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<Integer,Integer> entry = force2robotId.ceilingEntry(force);
|
||||
if(null==entry){
|
||||
return force2robotId.firstEntry().getValue();
|
||||
}
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Expedition.EndExpedi
|
|||
|
||||
//更新节点状态 节点
|
||||
final int oldlay = nodeInfo.getLay();
|
||||
Set<CommonProto.ExpeditionNodeInfo> 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<String> ids = new HashSet<>();
|
||||
if (resultCode != 1) {
|
||||
|
||||
|
@ -158,14 +140,16 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
|
||||
//更新节点
|
||||
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
||||
builder.addAllNodeInfo(nodeInfos);
|
||||
|
||||
builder.addAllNodeInfo(getNodePro(user,oldlay,nodeId));
|
||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,ids));
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
||||
|
||||
Expedition.EndExpeditionBattleResponse.Builder response = Expedition.EndExpeditionBattleResponse.newBuilder();
|
||||
response.setResult(resultCode);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_END_BATTLE_RESONSE_VALUE, response.build(), true);
|
||||
System.out.print( response.build());
|
||||
|
||||
|
||||
return;
|
||||
} else {
|
||||
//节点血量更新
|
||||
|
@ -185,12 +169,17 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
ids.add(hero.getId());
|
||||
}
|
||||
nodeInfo.setState(ExpeditionLogic.NODESTATE_NOT_GET);
|
||||
if(!STableManager.getConfig(SExpeditionFloorConfig.class).containsKey(oldlay+1))
|
||||
{//最后一层直接更新 领取宝箱时候校验
|
||||
user.getExpeditionManager().setLay(oldlay+1);
|
||||
nodeInfo.setState(ExpeditionLogic.NODESTATE_PASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//更新节点
|
||||
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
||||
builder.addAllNodeInfo(nodeInfos);
|
||||
builder.addAllNodeInfo(getNodePro(user,oldlay,nodeId));
|
||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,ids));
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
||||
|
||||
|
@ -208,4 +197,23 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_END_BATTLE_RESONSE_VALUE, response.build(), true);
|
||||
|
||||
}
|
||||
|
||||
private Set<CommonProto.ExpeditionNodeInfo> getNodePro(User user,int oldlay,int nodeId){
|
||||
Set<CommonProto.ExpeditionNodeInfo> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,14 +73,14 @@ public class StartExpeditionBattleRequest extends BaseHandler<Expedition.StartEx
|
|||
if (nodeInfo1.getLay() != nodeInfo.getLay()) {
|
||||
return;
|
||||
}
|
||||
CommonProto.ExpeditionNodeInfo.Builder build = CommonProto.ExpeditionNodeInfo.newBuilder()
|
||||
.setSortId(nodeInfo1.getSortId())
|
||||
.setState(nodeInfo1.getState());
|
||||
if (nodeInfo1.getSortId() != nodeId) {
|
||||
nodeInfo1.setState(ExpeditionLogic.NODESTATE_CLOSE);
|
||||
}else {
|
||||
return;
|
||||
}
|
||||
CommonProto.ExpeditionNodeInfo.Builder build = CommonProto.ExpeditionNodeInfo.newBuilder()
|
||||
.setSortId(nodeInfo1.getSortId())
|
||||
.setState(nodeInfo1.getState());
|
||||
nodeInfos.add(build.build());
|
||||
});
|
||||
//更新节点
|
||||
|
|
|
@ -9,7 +9,10 @@ import com.ljsd.jieling.core.FunctionManager;
|
|||
import com.ljsd.jieling.core.function.FunctionContext;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.activity.*;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.FightMainEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.RemoveEventHeroHandler;
|
||||
import com.ljsd.jieling.logic.activity.UserLevelEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.BuyGoodsDirectHandler;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||
|
@ -201,7 +204,7 @@ public class GlobalDataManaager implements IManager {
|
|||
public void closeAction(List<Integer> 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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<Hero> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ExpeditionNodeInfo> 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<ZSetOperations.TypedTuple<String>> typedTuples = RedisUtil.getInstence().rangeByScoreWithScores(RedisKey.AREDEF_TEAM_FORCE_RANK, "", 0, randomForce);
|
||||
|
||||
if (typedTuples.size() == 0) {
|
||||
//战力没有获取到 从机器人中选
|
||||
Set<Integer> set = ArenaLogic.randomRobot(SArenaSetting.getSArenaSetting().getScore(), 1);
|
||||
if (set.size() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int robotId = set.iterator().next();
|
||||
|
||||
// Set<Integer> 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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue