Merge branch 'master_test_hw' into master_test_gn

back_recharge
lvxinran 2021-03-18 15:50:51 +08:00
commit 129a0cdaa1
24 changed files with 441 additions and 378 deletions

View File

@ -263,37 +263,40 @@ function BuffManager:Update()
buffList = self.buffDic.kvList[buff.type]
end
-- 是覆盖类型的buff且有老buff
if buff.cover and buffList.size > 0 then
local isCovered = false
for i=1, buffList.size do
local oldBuff = buffList.buffer[i]
if oldBuff.cover and oldBuff.target == buff.target and oldBuff.clear == buff.clear and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
-- 结束并回收老buff
oldBuff:OnEnd()
oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
putBuff(oldBuff)
-- 覆盖老buff
buffList.buffer[i] = buff
buff:OnStart()
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
isCovered = true
break
end
end
-- 没有覆盖新buff
if not isCovered then
buffList:Add(buff)
buff:OnStart()
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
end
else
-- 新buff
buffList:Add(buff)
buff:OnStart()
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
end
-- 是覆盖类型的buff且有老buff buff表现层修改所有cover 字段没用了 注释 by:王振兴 2021/03/11 20:40
-- if buff.cover and buffList.size > 0 then
-- local isCovered = false
-- for i=1, buffList.size do
-- local oldBuff = buffList.buffer[i]
-- if oldBuff.cover and oldBuff.target == buff.target and oldBuff.clear == buff.clear and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
-- -- 结束并回收老buff
-- oldBuff:OnEnd()
-- oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
-- putBuff(oldBuff)
-- -- 覆盖老buff
-- buffList.buffer[i] = buff
-- buff:OnStart()
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
-- buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
-- isCovered = true
-- break
-- end
-- end
-- -- 没有覆盖新buff
-- if not isCovered then
-- buffList:Add(buff)
-- buff:OnStart()
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
-- end
-- else
-- -- 新buff
-- buffList:Add(buff)
-- buff:OnStart()
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
-- end
buffList:Add(buff)
buff:OnStart()
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
end
-- 清除过期buff

View File

@ -5209,6 +5209,7 @@ local passivityList = {
[249] = function(role, args,id,judge)
local f1 = args[1]
local round = 0
local isKill =false
-- 释放技能后
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
if skill and not skill.isTriggerJudge and judge==1 then
@ -5218,16 +5219,11 @@ local passivityList = {
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return
end
local curRound=BattleLogic.GetCurRound()
--每个回合只会生效一次
if curRound>round then
round=curRound
else
return
end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
role:AddBuff(buff)
-- local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
-- role:AddBuff(buff)
isKill = true
if skill then
--skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,id)
@ -5235,6 +5231,26 @@ local passivityList = {
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
local onRoundChange=function(round2)
if round2==round+1 and isKill then
role.mustCrit=true
else
role.mustCrit=false
isKill=false
end
round=round2
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
local onRoundStart=function(round2)
isKill=false
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, onRoundStart)
end,
-- 直接伤害每次击杀目标增加自身伤害[a]%[b]改变,可叠加持续至战斗结束 重写132 一次技能只触发一次被动

View File

@ -116,8 +116,7 @@ function BattleLogic.CheckFirstCamp()
end
end
function BattleLogic.StartOrder()
--
function BattleLogic.InitOrder()
BattleLogic.CurOrder = BattleLogic.CurOrder + 1
if BattleLogic.CurOrder == 1 then
local playerData = fightData.playerData
@ -144,7 +143,6 @@ function BattleLogic.StartOrder()
end
end
else
RoleManager.ClearEnemy()
local orderList = fightData.enemyData[BattleLogic.CurOrder]
@ -159,14 +157,19 @@ function BattleLogic.StartOrder()
MonsterManager.AddMonster(enemyMonsterList[i])
end
end
end
-- 检测先后手
BattleLogic.CheckFirstCamp()
-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
BattleLogic.TurnRoundNextFrame()
-- 战斗开始
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStart)
end
function BattleLogic.StartTurnRound()
BattleLogic.CheckFirstCamp()-- 检测先后手
BattleLogic.TurnRoundNextFrame()-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStart)-- 战斗开始
end
function BattleLogic.StartOrder()
BattleLogic.InitOrder()
BattleLogic.StartTurnRound()
end
-- 获取当前轮数

View File

@ -1,3 +1,9 @@
v1.0.22
1、被动249修改
v1.0.22
1、效果叠加显示修改注释逻辑里关于效果覆盖的代码
2 同步战斗逻辑添加boss展示
v1.0.21
1、混乱后的普攻不触发任何特性
2 舍身济世分担的伤害改为可以触发被动

View File

@ -38,12 +38,14 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
CommonProto.Hero.Builder heroBuilder = CommonProto.Hero.newBuilder();
int heroStarBreakId = HeroLogic.getInstance().calRobotStarByLevel(heroTid,heroLevel,heroBuilder);
int heroBreakId = HeroLogic.getInstance().calRobotBreaByLevel(heroTid,heroLevel,heroBuilder);
int star = HeroLogic.getInstance().calRobotStarByLevel(heroTid,heroLevel);
int heroStarBreakId = HeroLogic.getInstance().calRobotStarBreakByLevel(heroTid,heroLevel);
int heroBreakId = HeroLogic.getInstance().calRobotBreakByLevel(heroTid,heroLevel);
heroBuilder.setId(String.valueOf(scHero.getId()));
heroBuilder.setHeroId(scHero.getId());
heroBuilder.setLevel(heroLevel);
heroBuilder.setStar(star);
heroBuilder.setStarBreakId(heroStarBreakId);
heroBuilder.setBreakId(heroBreakId);
heroMap.put(heroTid,heroBuilder.build());

View File

@ -97,14 +97,14 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
String holySkill = passiveSkillResult.length()!=0?passiveSkillResult.substring(0,passiveSkillResult.length()-1):"";
LuaValue getFightData;
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
int tid = deffightInfo.getUid();
List<CommonProto.FightTeamInfo> gropFightTeamInfoWithDouble = ExpeditionLogic.getGropFightTeamInfoWithDouble(tid, nodeInfo.getBossHP());
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, gropFightTeamInfoWithDouble);
}else {
// if(ExpeditionLogic.NODETYPE_GREED == nodeInfo.getType()){
// int tid = deffightInfo.getUid();
// List<CommonProto.FightTeamInfo> gropFightTeamInfoWithDouble = ExpeditionLogic.getGropFightTeamInfoWithDouble(tid, nodeInfo.getBossHP());
// getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, gropFightTeamInfoWithDouble);
// }else {
CommonProto.FightTeamInfo deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()+holySkill),nodeInfo.getBossHP());
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
}
// }
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
long[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
@ -143,23 +143,23 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
//节点血量更新
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->{
SMonsterConfig sMonsterConfig = STableManager.getConfig(SMonsterConfig.class).get(Integer.valueOf(s));
if(sMonsterConfig!=null){
nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double)sMonsterConfig.getHp());
}
}
);
}else {
//
// if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
// //节点血量更新
// nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->{
// SMonsterConfig sMonsterConfig = STableManager.getConfig(SMonsterConfig.class).get(Integer.valueOf(s));
// if(sMonsterConfig!=null){
// nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double)sMonsterConfig.getHp());
// }
// }
// );
//
// }else {
//节点血量更新
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))
nodeInfo.getBossHP().put(s, (double) remainHp.remove(familyHeroInfo.getPosition()-1) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))
);
}
// }
// //节点血量更新
// nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
// nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))

View File

@ -127,7 +127,7 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
if (resultCode != 1) {
if (nodeInfo.getType() == ExpeditionLogic.NODETYPE_GREED||(expeditionManager.getExpeditionLeve()>2&&nodeInfo.getType() == ExpeditionLogic.NODETYPE_BOSS)) {
if (ExpeditionLogic.NODETYPE_GREED == nodeInfo.getType()) {
//贪婪节点只有1次战斗机会若战斗失败后敌人将会逃走玩家视为通过此节点
//updata node
Set<CommonProto.ExpeditionNodeInfo> nodeInfos = ExpeditionLogic.openLay(user,nodeInfo.getLay(),nodeId);
@ -149,7 +149,7 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
//出队伍
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
if(ExpeditionLogic.NODETYPE_GREED == nodeInfo.getType()){
//节点血量更新
// nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
@ -268,28 +268,26 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
Set<CommonProto.ExpeditionNodeInfo> collect = nodeInfos.stream().filter(expeditionNodeInfo -> expeditionNodeInfo.getSortId() != nodeId).collect(Collectors.toSet());
builder.addAllNodeInfo(collect);
// 试炼节点
if(nodeInfo.getType() == ExpeditionLogic.NODETYPE_TRY){
//create Hero
int poolId = sExpeditionNodeConfig.getPoolId();
int tempId =ExpeditionLogic.getRandomTid(poolId,1).first();
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
if(sExpeditionRecruitConfig!=null){
int i = sExpeditionRecruitConfig.getHeroId();
//获取最大战力hero
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
if(StringUtil.isEmpty(maxforceHero)){
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
}
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
if(hero==null){
throw new ErrorCodeException("试炼节点英雄掉落失败");
}
Hero hero1 = ExpeditionLogic.createHero(i, uid, hero,-1);
drop.addHero(CBean2Proto.getHero(hero1));
for(Integer equipId : hero1.getEquipByPositionMap().values()){
drop.addEquipId(CBean2Proto.getEquipProto(equipId));
}
// Tid
int heroTid = nodeInfo.getSnapFightInfo().getUid();
// level
int max = sExpeditionSetting.getLevelForce()[1];
int min = sExpeditionSetting.getLevelForce()[0];
int averageLevel = HeroLogic.getInstance().getAverageLevel(user,6);
int level = (int) (averageLevel * ((min / 10000f) + ((float) (Math.random() *(max - min))/10000f)));
level = level <= 20?50:level;
Hero hero = HeroLogic.getHeroByMaxLevel(user);
if(hero==null){
throw new ErrorCodeException("试炼节点英雄掉落失败");
}
Hero hero1 = ExpeditionLogic.createRandomHero(user,hero,heroTid,level,-1,2);
drop.addHero(CBean2Proto.getHero(hero1));
for(Integer equipId : hero1.getEquipByPositionMap().values()){
drop.addEquipId(CBean2Proto.getEquipProto(equipId));
}
}

View File

@ -47,61 +47,50 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
if (!user.getExpeditionManager().getExpeditionNodeInfos().containsKey(nodeId)) {
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在"));
}
ExpeditionNodeInfo nodeInfo = user.getExpeditionManager().getExpeditionNodeInfos().get(nodeId);
ExpeditionNodeInfo nodeInfo = user.getExpeditionManager().getExpeditionNodeInfos().get(nodeId);
if (nodeInfo.getType() != ExpeditionLogic.NODETYPE_HERO_GET) {
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点类型不符"+nodeInfo.getType()));
}
// //check node
// List<Integer> nextNodeId = ExpeditionLogic.getNextNodeId(user.getExpeditionManager().getSortid(),user.getExpeditionManager().getExpeditionNodeInfos().size());
// if(!nextNodeId.contains(nodeId)){
// throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点状态不正确"));
// }
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
if (sExpeditionNodeConfig == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
throw new ErrorCodeException(ErrorCode.CFG_NULL,"节点信息不存在:"+nodeInfo.getType());
}
//crerate hero
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
if(sExpeditionSetting==null){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
throw new ErrorCodeException(ErrorCode.CFG_NULL,"配置不存在");
}
// 商店英雄数量
int recruitTime = sExpeditionSetting.getRecruitTime();
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
if(heroMapTemp.size()==0){
if(heroMapTemp.size() <= 0){
// 获取英雄池id
int poolId = sExpeditionNodeConfig.getPoolId();
// 从池中随机指定数量的英雄模板
TreeSet<Integer> randomTid = ExpeditionLogic.getRandomTid(poolId, recruitTime);
//获取最大战力hero
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
if (StringUtil.isEmpty(maxforceHero)) {
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
}
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
//获取最高等级英雄
Hero hero = HeroLogic.getHeroByMaxLevel(user);
if (hero == null) {
throw new ErrorCodeException("招募节点英雄掉落失败");
}
HeroLogic herolevel =new HeroLogic();
int level = herolevel.getAverageLevel(user,6);
int star = STableManager.getConfig(SRobotProperty.class).get(level).getStar();
// 等级
int level = HeroLogic.getInstance().getAverageLevel(user,6);
for (Integer integer:randomTid) {
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(integer);
if(sExpeditionRecruitConfig!=null) {
int i = sExpeditionRecruitConfig.getHeroId();
ExpeditionLogic.createRandomHero(i, uid, hero, nodeId,level,star);
SExpeditionRecruitConfig recruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(integer);
if(recruitConfig!=null) {
int heroTid = recruitConfig.getHeroId();
ExpeditionLogic.createRandomHero(user,hero,heroTid,level,nodeId,1);
}
}
heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
}
heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
heroMapTemp.forEach((s, hero) -> {
CommonProto.ViewHeroInfo.Builder inner = CommonProto.ViewHeroInfo.newBuilder();
Map<Integer, Long> heroNotBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, true, 0);

View File

@ -98,12 +98,12 @@ public class StartExpeditionBattleRequest extends BaseHandler<Expedition.StartEx
CommonProto.FightTeamInfo fightTeamInfo = ExpeditionLogic.getFightTeamInfoWithDouble(inMem,teamId,user.getExpeditionManager().getHeroHP());
SnapFightInfo deffightInfo = nodeInfo.getSnapFightInfo();
CommonProto.FightTeamInfo deffightTeamInfo;
if(nodeInfo.getType()==ExpeditionLogic.NODETYPE_GREED){
int tid = deffightInfo.getUid();
deffightTeamInfo= ExpeditionLogic.getGropFightTeamInfoWithDouble(tid,nodeInfo.getBossHP()).get(0);
}else {
// if(nodeInfo.getType()==ExpeditionLogic.NODETYPE_GREED){
// int tid = deffightInfo.getUid();
// deffightTeamInfo= ExpeditionLogic.getGropFightTeamInfoWithDouble(tid,nodeInfo.getBossHP()).get(0);
// }else {
deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
}
// }
int seed = (int)(System.currentTimeMillis()/1000);
String fightInfo = nodeId + "#" +seed+ "#" + teamId;

View File

@ -22,7 +22,7 @@ class RechargeTotalActivity extends AbstractActivity {
User user = UserManager.getUser(session.getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int days = TimeUtils.differentDaysByHour(rechargeInfo.getCreateTime(), now,0) + 1;
if (missionProgress/1000 < values[0][0] || days < values[0][1]) {
if (missionProgress <= 0 || days < values[0][1]) {
return false;
}
return true;

View File

@ -32,18 +32,26 @@ public class LeveGiftEventHander implements IEventHandler {
public void onEvent(IEvent event) throws Exception {
if(event instanceof UserLevelEvent){
User user = UserManager.getUser(((UserLevelEvent) event).getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int[] shenZhuangRule = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SHEN_ZHUANG);
if(shenZhuangRule!=null&&shenZhuangRule.length>0&&((UserLevelEvent) event).getLevel()==shenZhuangRule[0]){
rechargeInfo.addDyGoodsCanBuyTimes(10001);
rechargeInfo.putLevelAndMoneyBagMap(-1,System.currentTimeMillis());
// rechargeInfo.putLevelAndMoneyBagMap(shenZhuangRule[1],System.currentTimeMillis());
giftIndication(user,new ArrayList<>(1));
}
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.DISCOUNT_LEVEL);
int start = onceArrayValue[0];
int inter = onceArrayValue[1];
if(((UserLevelEvent) event).getLevel()<start){
return;
}
User user = UserManager.getUser(((UserLevelEvent) event).getUid());
boolean b = (((UserLevelEvent) event).getLevel() - start) % inter == 0;
if(!b){
return;
}
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
double saveAmt = rechargeInfo.getSaveAmt();
Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry((int)saveAmt);
SRechargeCommodityConfig orDefault = STableManager.getConfig(SRechargeCommodityConfig.class).getOrDefault(entry.getValue(), null);
@ -67,18 +75,19 @@ public class LeveGiftEventHander implements IEventHandler {
// BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
giftIndication(user,goodsBagInfo);
}
}
private void giftIndication(User user,List<CommonProto.GiftGoodsInfo> goodsBagInfo) throws Exception {
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
}
}
}

View File

@ -94,22 +94,30 @@ public class Hero extends MongoBase implements Comparable<Hero> {
this.especialEquipLevel = hero.especialEquipLevel;
this.createType = 1;
}
//~~~~~
public Hero(int uid,int heroTid,int level,int star,Hero hero) {
/**
*
* @param uid
* @param heroTid
* @param level
* @param hero
*/
public Hero(Hero hero,int uid,int heroTid,int level) {
this.setRootCollection(User._COLLECTION_NAME);
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
this.templateId = heroTid;
this.level = level;//
this.star = star;
this.equipByPositionMap = new HashMap<>();
// this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
this.level = level;
this.star = HeroLogic.getInstance().calRobotStarByLevel(heroTid,level);
this.starBreakId = HeroLogic.getInstance().calRobotStarBreakByLevel(heroTid,level);
this.equipByPositionMap = new HashMap<>(hero.equipByPositionMap);
this.soulEquipByPositionMap = new HashMap<>();
this.breakId = hero.breakId;
this.breakId = HeroLogic.getInstance().calRobotBreakByLevel(heroTid,level);
this.createTime = (int)(System.currentTimeMillis()/1000);
this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel;
this.createType = 1;
this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel;
this.createType = 1;
// 这个参数需要到外边处理
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
}
public Hero(int uid, int heroTid, int initStar){
@ -293,8 +301,14 @@ public class Hero extends MongoBase implements Comparable<Hero> {
*/
public int getBreakIdByHongMeng(HeroManager heroManager){
// 英雄在共鸣池中
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
return HeroLogic.getInstance().calRobotBreaByLevel(templateId, getLevel(heroManager));
if (heroManager.getHongmengTablet() > 0){
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
return HeroLogic.getInstance().calRobotBreakByLevel(templateId, getLevel(heroManager));
}
}else{
if (heroManager.getResonances().values().contains(id)) {
return HeroLogic.getInstance().calRobotBreakByLevel(templateId, getLevel(heroManager));
}
}
return breakId;
}

View File

@ -250,16 +250,19 @@ public class BattleNode extends AbstractExpedition {
// 重复圣物
if (ids.contains(v) && holyConfig.getCanRepeat() == 0){
iterator.remove();
continue;
}
// 不存在的英雄,专属圣物
if (holyConfig.getHeroId() != 0){
if (!expeditonHeroIds.contains(holyConfig.getHeroId())){
iterator.remove();
continue;
}
}
// 已经生成过得圣物
if(nodeHolyInfo.contains(v)){
iterator.remove();
continue;
}
}
return valueMap;

View File

@ -14,7 +14,7 @@ public class BossNode extends BattleNode {
@Override
protected int getAmendLevel(SExpeditionSetting sExpeditionSetting, int level){
level += (Math.ceil(sExpeditionSetting.getPowerfulForce()[1][1] / 10000d * level));
level += (Math.ceil(sExpeditionSetting.getPowerfulForce()[2][1] / 10000d * level));
return level;
}
}

View File

@ -14,7 +14,7 @@ public class EliteNode extends BattleNode {
@Override
protected int getAmendLevel(SExpeditionSetting sExpeditionSetting, int level){
level += (Math.ceil(sExpeditionSetting.getPowerfulForce()[2][1] / 10000d * level));
level += (Math.ceil(sExpeditionSetting.getPowerfulForce()[1][1] / 10000d * level));
return level;
}
}

View File

@ -575,163 +575,110 @@ public class ExpeditionLogic {
}
/**
*
* @param nodeId -1
* ,
* @param user
* @param hero
* @param heroTid
* @param level
* @param nodeId -1
* @param type 1:,2:
* @return
* @throws Exception
*/
public static Hero createHero(int tempid,int uid,Hero hero,int nodeId)throws Exception{
boolean isTemp = nodeId != -1;
User user = UserManager.getUser(uid);
int level = HeroLogic.getInstance().getAverageLevel(user,6);
public static Hero createRandomHero(User user,Hero hero,int heroTid,int level,int nodeId,int type)throws Exception{
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
if (sExpeditionSetting == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
throw new ErrorCodeException(ErrorCode.CFG_NULL,"配置不存在:sExpeditionSetting");
}
//random star
int min = sExpeditionSetting.getLevelForce()[0];
int max= sExpeditionSetting.getLevelForce()[1];
int finalLevel = (int) (level * ((min / 10000f) + ((float) (Math.random() *(max - min))/10000f)));
if(finalLevel<=20){
finalLevel=50;
SCHero scHero = SCHero.getsCHero().get(heroTid);
if (scHero == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid);
}
SCHero hero1 = SCHero.getsCHero().get(tempid);
if (hero1 == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(hero1.getStar());
if (null != scHeroRankUpConfig && finalLevel > scHeroRankUpConfig.getOpenLevel()) {
finalLevel = scHeroRankUpConfig.getOpenLevel();
}
//random tempid
Hero newHero = new Hero(uid,tempid,finalLevel,hero);
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
int equipId = next.getValue();
newHero.updateEquipPositionMap(next.getKey(), equipId);
}
Set<String> jewelInfo = hero.getJewelInfo();
addExpeditionJewel(jewelInfo,user,hero1,newHero);
updateExpenditionSoulEquip(hero.getSoulEquipByPositionMap(),user,newHero,tempid);
if(isTemp){
user.getExpeditionManager().addHeroToTemp(newHero,nodeId);
}else {
// 等级上限验证
level = level>scHero.getMaxLevel()?scHero.getMaxLevel():level;
//创建新的英雄
Hero newHero = new Hero(hero,user.getId(),heroTid,level);
// 魂宝灵宝,魂印需要走表
addExpeditionJewel(user,newHero,type);
addExpenditionSoulEquip(user,newHero,type);
// 商店还是入库
if(nodeId < 0){
user.getExpeditionManager().addHero(newHero);
}else {
user.getExpeditionManager().addHeroToTemp(newHero,nodeId);
}
return newHero;
}
//添加宝物
private static void addExpeditionJewel(Set<String> jewelInfo, User user, SCHero hero1, Hero newHero) throws Exception {
for (String jewel : jewelInfo) {
PropertyItem propertyItem = user.getEquipManager().getEquipMap().get(jewel);
if (propertyItem == null) {
continue;
}
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(propertyItem.getEquipId());
if(config==null){
continue;
}
if(hero1.getPropertyName()!=config.getRace()){
continue;
}
Jewel j = (Jewel) propertyItem;
Jewel newequip = new Jewel(user.getId(), j.getEquipId());
// if(isTemp){
// user.getExpeditionManager().addEquipToTemp(user, newequip);
// }else {
user.getExpeditionManager().addEquip(user, newequip);
// }
newHero.addJewel(newequip.getId());
/**
* ,
* @param user
* @param newHero
* @param type
*/
private static void addExpeditionJewel(User user,Hero newHero,int type) throws Exception {
Set<String> jewelInfo = newHero.getJewelInfo();
if (jewelInfo == null || jewelInfo.size() <= 0){
// 没有魂宝灵宝
return;
}
HashSet<String> set = new HashSet<>();
// 0:魂宝,1:灵宝
int[] equip = SExpeditionRecruitConfig.getRecruitMap().get(type).get(newHero.getTemplateId()).getEquip();
if (equip == null){
return;
}
// 玩家自身装备背包
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
if (equipMap == null){
return;
}
for (String v : jewelInfo) {
// 获取魂宝灵宝
Jewel jewel = (Jewel)equipMap.get(v);
if (jewel == null){
continue;
}
// 修改装备id为表里类型,1:魂宝,2:灵宝
if (jewel.getJewelType() == 1){
jewel.setEquipId(equip[0]);
}else {
jewel.setEquipId(equip[1]);
}
// 添加到大闹天宫装备背包,此操作会更新唯一id
user.getExpeditionManager().addEquip(user,jewel);
// 新的装备id
set.add(jewel.getId());
}
newHero.setJewelInfo(set);
}
//添加魂印
private static void updateExpenditionSoulEquip(Map<Integer, Integer> soulEquipByPositionMap, User user, Hero newHero, int tempid){
for (Map.Entry<Integer,Integer> entry:soulEquipByPositionMap.entrySet()) {
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(entry.getValue());
if (sEquipConfig == null) {
continue;
/**
*
* @param newHero
* @param type
* @throws Exception
*/
private static void addExpenditionSoulEquip(User user,Hero newHero,int type){
if (newHero.getStar() < 6){
// 不足六星得英雄不能装魂印
return;
}
// 大闹天宫配置的怪物魂印
int[] sign = SExpeditionRecruitConfig.getRecruitMap().get(type).get(newHero.getTemplateId()).getSign();
// 魂印位置对应的开启等级
int[] ints = SSpecialConfig.getIntegerArrayValue("Sign_Location");
for (int i = 0; i < ints.length; i++) {
if (user.getPlayerInfoManager().getLevel() >= ints[i]){
// 装备魂印
newHero.updateSoulEquipPositionMap(i,sign[i]);
}
Set<Integer> cacheIds = new HashSet<>();
int equipId = entry.getValue();
if (sEquipConfig.getRangeHeroTids() != null && !sEquipConfig.getRangeHeroTids().contains(tempid)) {
continue;
}
if (sEquipConfig.getLimit() == 1) {
user.getHeroManager().getHeroMap().values().forEach(itemHero -> {
cacheIds.addAll(itemHero.getSoulEquipByPositionMap().values());
});
if (cacheIds.contains(equipId)) {
cacheIds.add(equipId);
continue;
}
}
newHero.updateSoulEquipPositionMap(entry.getKey(),entry.getValue());
}
}
//~~~~~~~~
public static Hero createRandomHero(int tempid,int uid,Hero hero,int nodeId,int level,int star)throws Exception{
boolean isTemp = nodeId != -1;
User user = UserManager.getUser(uid);
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
if (sExpeditionSetting == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
//random star
SCHero hero1 = SCHero.getsCHero().get(tempid);
if (hero1 == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(star);
if (null != scHeroRankUpConfig && level > scHeroRankUpConfig.getOpenLevel()) {
level = scHeroRankUpConfig.getOpenLevel();
}
//random tempid
Hero newHero = new Hero(uid,tempid,level,star,hero);
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
int equipId = next.getValue();
newHero.updateEquipPositionMap(next.getKey(), equipId);
}
Set<String> jewelInfo = hero.getJewelInfo();
addExpeditionJewel(jewelInfo,user,hero1,newHero);
updateExpenditionSoulEquip(hero.getSoulEquipByPositionMap(),user,newHero,tempid);
if(isTemp){
user.getExpeditionManager().addHeroToTemp(newHero,nodeId);
}else {
user.getExpeditionManager().addHero(newHero);
}
return newHero;
}
public static TreeSet<Integer> getRandomTid(int type,int size)throws ErrorCodeException{
//select collections

View File

@ -24,6 +24,7 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
private final int DAMAGE_INCREASE = 17;
private final int HOLY_INCREASE = 35;
private final int JUDGE_INCREASE = 43;
private final int HOLY_QUALITY = 37;
@Override
public String getSpecialParm(User user) {
Map<Integer, SExpeditionHolyConfig> config = STableManager.getConfig(SExpeditionHolyConfig.class);
@ -32,6 +33,11 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
ExpeditionManager expeditionManager = user.getExpeditionManager();
Set<ExpeditionItem> propertyItems = user.getExpeditionManager().getPropertyItems();
propertyItems.forEach(e->{
int type = config.get(e.getEquipId()).gettype();
//掉落战利品
if(type==2||type==3){
cache.put(type,cache.getOrDefault(type,0)+1);
}
//夜明珠
if(e.getEquipId() == HOLY_INCREASE){
cache.put(e.getEquipId(),cache.getOrDefault(e.getEquipId(),0) + 1);
@ -64,7 +70,6 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
result.append(item==null?0:item.getCountVictory());
}
//每使用一次判官笔
expeditionManager.getEffectItems().get(JUDGE_INCREASE);
SExpeditionHolyConfig con43 = expeditionManager.getEffectItems().get(JUDGE_INCREASE);
if(con43 != null){
if(result.length()>0){
@ -74,6 +79,16 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
ExpeditionItem item = expeditionManager.getExpeditionItem(con43.getId());
result.append(item==null?0:item.getJudgePen());
}
SExpeditionHolyConfig con37 = expeditionManager.getEffectItems().get(HOLY_QUALITY);
if(con37 != null){
if(result.length()>0){
result.append("|");
}
result.append(con37.getPassiveSkillId()+"#");
int num = cache.getOrDefault(2,0);
num += cache.getOrDefault(3,0);
result.append(num);
}
return result.toString();
}
}

View File

@ -50,6 +50,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class HeroLogic{
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
@ -1226,89 +1227,92 @@ public class HeroLogic{
}
/**
* starBrealId
* starBreaklId
* @param heroTid
* @param heroLevel
* @param heroBuilder
* @return
*/
public int calRobotStarByLevel(int heroTid,int heroLevel,CommonProto.Hero.Builder heroBuilder){
SCHero scHero = SCHero.getsCHero().get(heroTid);
int star = scHero.getStar();
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
if(scHeroRankUpConfigByType == null){
return 0;
}
// 无奈方式代码写死验证机器人等级小于100级为未升星
if (heroLevel <= 100){
return 0;
}
for(SCHeroRankUpConfig scHeroRankUpConfig : scHeroRankUpConfigByType.values()){
if (heroLevel <= scHeroRankUpConfig.getOpenLevel()){
heroBuilder.setStar(scHeroRankUpConfig.getOpenStar());
return scHeroRankUpConfig.getId();
public int calRobotStarBreakByLevel(int heroTid,int heroLevel){
// 获取进阶属性
int star = SCHero.getsCHero().get(heroTid).getStar();
Map<Integer, SCHeroRankUpConfig> byStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,star);
if(byStar != null){
// 换个对象,尽量不要修改原值
List<SCHeroRankUpConfig> rankUpConfigs = new ArrayList<>(byStar.values());
// 聚合::根据openlevel倒序,输出list
List<SCHeroRankUpConfig> collect = rankUpConfigs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
for(SCHeroRankUpConfig scHeroRankUpConfig : collect){
if (heroLevel >= scHeroRankUpConfig.getOpenLevel()){
return scHeroRankUpConfig.getId();
}
}
}
return 0;
}
/**
* BreaklId
* @param heroTid
* @param heroLevel
* @return
*/
public int calRobotBreakByLevel(int heroTid,int heroLevel){
// 初始等级
int star = SCHero.getsCHero().get(heroTid).getStar();
Map<Integer, SCHeroRankUpConfig> byBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,star);
if(byBreak != null){
List<SCHeroRankUpConfig> rankUpConfigs = new ArrayList<>(byBreak.values());
// 聚合:根据openlevel倒叙排序,输出成list
List<SCHeroRankUpConfig> collect = rankUpConfigs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
for(SCHeroRankUpConfig scHeroRankUpConfig : collect){
if (heroLevel >= scHeroRankUpConfig.getOpenLevel()){
return scHeroRankUpConfig.getId();
}
}
}
heroBuilder.setStar(star);
return 0;
}
/**
* BrealId
*
* @param heroTid
* @param heroLevel
* @param heroBuilder
* @return
*/
public int calRobotBreaByLevel(int heroTid,int heroLevel,CommonProto.Hero.Builder heroBuilder){
public int calRobotStarByLevel(int heroTid,int heroLevel){
SCHero scHero = SCHero.getsCHero().get(heroTid);
// 英雄初始星级
int star = scHero.getStar();
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar());
if(scHeroRankUpConfigByType == null){
return 0;
}
for(SCHeroRankUpConfig scHeroRankUpConfig : scHeroRankUpConfigByType.values()){
if (heroLevel >= scHeroRankUpConfig.getLimitLevel() && heroLevel <= scHeroRankUpConfig.getOpenLevel()){
heroBuilder.setStar(scHeroRankUpConfig.getOpenStar());
return scHeroRankUpConfig.getId();
// 进阶,根据初始星级获取不同分区,先进行进阶验证,再进行突破验证
Map<Integer, SCHeroRankUpConfig> byStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,star);
if (byStar != null){
// 换个对象,尽量不要修改原值
List<SCHeroRankUpConfig> rankUpStar = new ArrayList<>(byStar.values());
// 聚合::根据openlevel倒序,输出list
List<SCHeroRankUpConfig> collect = rankUpStar.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
for(SCHeroRankUpConfig val : collect){
if (heroLevel >= val.getOpenLevel()){
return val.getOpenStar();
}
}
}
heroBuilder.setStar(star);
return 0;
}
/**
* BrealIdheroBuilder
* @param heroTid
* @param heroLevel
* @return
*/
public int calRobotBreaByLevel(int heroTid,int heroLevel){
SCHero scHero = SCHero.getsCHero().get(heroTid);
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar());
if(scHeroRankUpConfigByType == null){
return 0;
}
// 排序
Set<Map.Entry<Integer, SCHeroRankUpConfig>> entries = scHeroRankUpConfigByType.entrySet();
ArrayList<Map.Entry<Integer, SCHeroRankUpConfig>> list = new ArrayList<>(entries);
Collections.sort(list, new Comparator<Map.Entry<Integer, SCHeroRankUpConfig>>() {
@Override
public int compare(Map.Entry<Integer, SCHeroRankUpConfig> o1, Map.Entry<Integer, SCHeroRankUpConfig> o2) {
//逆序 就用后面的参数 - 前面的参数
return o2.getValue().getOpenLevel() - o1.getValue().getOpenLevel();
// 突破,根据初始星级获取不同分区
Map<Integer, SCHeroRankUpConfig> byBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,star);
if (byBreak != null){
List<SCHeroRankUpConfig> rankUpBreak = new ArrayList<>(byBreak.values());
// 聚合:根据openlevel倒叙排序,输出成list
List<SCHeroRankUpConfig> collect = rankUpBreak.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
for(SCHeroRankUpConfig val : collect){
if (heroLevel >= val.getOpenLevel()){
return val.getOpenStar();
}
}
});
for (int i = 0; i < list.size(); i++) {
Map.Entry<Integer, SCHeroRankUpConfig> entry = list.get(i);
SCHeroRankUpConfig value = entry.getValue();
if (heroLevel >= value.getOpenLevel()){
return value.getId();
}
}
return 0;
return star;
}
private Map<Integer,Object> getParaRate(SCHero scHero,int heroStar,int heroLevel,int heroBreakId){
@ -4358,4 +4362,18 @@ public class HeroLogic{
return count/num;
}
/**
*
* @param user
* @return
*/
public static Hero getHeroByMaxLevel(User user){
// 获取玩家全部英雄
Collection<Hero> values = user.getHeroManager().getHeroMap().values();
List<Hero> heroes = new ArrayList<>(values);
// 玩家英雄背包按等级排
Collections.sort(heroes);
return heroes.get(0);
}
}

View File

@ -132,34 +132,27 @@ public class RankLogic {
* @throws Exception
*/
public List<List<Integer>> getRandomUserByRank(User user,int counts) throws Exception {
// 获取排行榜得数量
int rankEndLine = 50;
if (counts > rankEndLine){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"逻辑错误,传值有问题");
}
// 获取排行信息
PlayerInfoProto.RankResponse rankResponse = getRankInfo(user,1,rankEndLine);
PlayerInfoProto.RankResponse rankResponse = getRankInfo(user,1,50);
// 计时器
long start = System.currentTimeMillis();
List<List<Integer>> result = new ArrayList<>();
// -1方便后面取值操作防止下标越界异常
int rankSize = rankResponse.getRanksCount()-1;
if (rankSize < 0){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"战力排行榜找不到人");
int rankSize = rankResponse.getRanksCount();
if (rankSize <= 0){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"战力排行榜暂无数据,没有人上榜");
}
List<List<Integer>> result = new ArrayList<>();
// 计数器
int count = 0;
do {
// 从0开始的随机
int random = MathUtils.randomInt(rankEndLine);
// 随机排名
int anInt = random > rankSize?rankSize:random;
int random = MathUtils.randomInt(rankSize);
// 获取随机玩家的主线队伍阵容
User other1 = getRankUid(rankResponse, anInt);
User other1 = getRankUid(rankResponse, random);
List<Integer> heroInfos = getTeamByUid(other1);
// 队伍长度不足六人
if (heroInfos.size() < 6){
// 队伍长度不足六人
if (count == 5){
// 最多循环五次五次之后直接取第一名得id
User other2 = getRankUid(rankResponse, 0);

View File

@ -90,6 +90,9 @@ public class GuildForceRank extends AbstractRank {
return builder;
}
GuildInfo guildInfo = map.get(gid);
if (guildInfo == null || guildInfo.getMembers() == null || guildInfo.getMembers().isEmpty()){
return builder;
}
Set<Integer> chairMan = guildInfo.getMembers().get(GlobalsDef.CHAIRMAN);
int chairManId = chairMan.iterator().next();
User user = UserManager.getUser(chairManId);

View File

@ -9,6 +9,8 @@ import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
@ -186,6 +188,15 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
LOGGER.error("您的账号已经在其他设备上登陆,请确认账号安全!"+iSession.getId()+"\r\nnew "+newSession.getId());
serverKick(iSession,ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
return 1;
}else{
ISession session = OnlineUserManager.getSessionByUid(uid);
if(session!=null){
User userInMem = UserManager.getUserInMem(session.getUid());
if(userInMem!=null){
processUserOfflineData(userInMem,session);
}
OnlineUserManager.userOffline(session.getUid());
}
}
return 0;
}
@ -414,6 +425,8 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
playerInfoManager.setOffLineTime(TimeUtils.now());
long onlineTime = playerInfoManager.getOffLineTime() - session.getUserLoginTime();
playerInfoManager.addOnlineTime(onlineTime);
// 登出通知
// ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
//更新在线时长
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.OnlineReward,(int)(onlineTime/TimeUtils.ONE_SECOND));
MongoUtil.getInstence().lastUpdate();

View File

@ -1,8 +1,12 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="ExpeditionRecruitConfig")
public class SExpeditionRecruitConfig implements BaseConfig {
@ -18,10 +22,24 @@ public class SExpeditionRecruitConfig implements BaseConfig {
private int weight;
private int[] sign;
private int[] equip;
/**
* map<,map<id,>>
*/
private static Map<Integer,Map<Integer,SExpeditionRecruitConfig>> recruitMap;
@Override
public void init() throws Exception {
recruitMap = new HashMap<>();
Map<Integer, SExpeditionRecruitConfig> config = STableManager.getConfig(SExpeditionRecruitConfig.class);
config.values().forEach(v->{
Map<Integer, SExpeditionRecruitConfig> map1 = recruitMap.getOrDefault(v.getType(), new HashMap<>());
map1.put(v.getHeroId(),v);
recruitMap.put(v.getType(),map1);
});
}
@ -49,5 +67,15 @@ public class SExpeditionRecruitConfig implements BaseConfig {
return weight;
}
public int[] getSign() {
return sign;
}
public int[] getEquip() {
return equip;
}
public static Map<Integer, Map<Integer, SExpeditionRecruitConfig>> getRecruitMap() {
return recruitMap;
}
}

View File

@ -59,8 +59,10 @@ public class SRobotSkill implements BaseConfig {
builder.append(i).append("#");
}
// 被动技能
for (int i : robotSkill.getPassiveSkill()[index]) {
builder.append(i).append("#");
if(robotSkill.getPassiveSkill().length>0){
for (int i : robotSkill.getPassiveSkill()[index]) {
builder.append(i).append("#");
}
}
return builder.toString();
}

View File

@ -96,6 +96,7 @@ public class SSpecialConfig implements BaseConfig {
public static final String SKILL_EFFECT_TGMB = "skill_effect_tgmb";//天宫秘宝购买特权带来的攻击提升万分比(只在天宫生效)
public static final String GUILD_LEADER_PASS_TIME = "GuildLeaderPassTime";//会长不上线移交时长
public static final String GUILD_DISMISS_TIME ="GuildDismissTime";//公会全员不上线解散时长
public static final String SHEN_ZHUANG = "ShenZhuang";//神装礼包推送等级
@Override
public void init() throws Exception {