鸿蒙阵代码回滚,只保留等级
parent
9da26dd78c
commit
923db41225
|
@ -23,10 +23,7 @@ public class UpHeroLevelHandler extends BaseHandler {
|
|||
HeroInfoProto.UpHeroLevelRequest upHeroLevelRequest = HeroInfoProto.UpHeroLevelRequest.parseFrom(bytes);
|
||||
String heroId = upHeroLevelRequest.getHeroId();
|
||||
// 验证是否可以使用功能,升级突破
|
||||
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.UPGRADE_BREAKTHROUGH.getPropertyId(), heroId);
|
||||
if (!useFunction){
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
}
|
||||
HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.UPGRADE_BREAKTHROUGH.getPropertyId(), heroId);
|
||||
int targetLevel = upHeroLevelRequest.getTargetLevel();
|
||||
HeroLogic.getInstance().upHeroLevel(iSession,heroId,targetLevel);
|
||||
}
|
||||
|
|
|
@ -31,24 +31,18 @@ public class UpHeroStarHandler extends BaseHandler<HeroInfoProto.UpHeroStarReque
|
|||
String heroId = upHeroStarRequest.getHeroId();
|
||||
if(upHeroStarRequest.getType()==1){
|
||||
// 验证是否可以使用功能,神将升星
|
||||
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.UP_START_AWAKEN.getPropertyId(), heroId);
|
||||
if (!useFunction){
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
}
|
||||
// HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.UP_START_AWAKEN.getPropertyId(), heroId);
|
||||
// 验证是否可以使用功能,被吞噬
|
||||
for (HeroInfoProto.ConsumeMaterial material : consumeMaterialsList) {
|
||||
List<String> heroIdsList = new ArrayList<>();
|
||||
// 获取英雄id
|
||||
material.getHeroIdsList().stream()
|
||||
.filter(v->v.getType() == 1)
|
||||
.forEach(v->heroIdsList.add(v.getItemId()));
|
||||
String[] heroIds = heroIdsList.toArray(new String[0]);
|
||||
// 验证神将是否可以消耗
|
||||
useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.PASSIVE_EAT.getPropertyId(), heroIds);
|
||||
if (!useFunction){
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
}
|
||||
}
|
||||
// for (HeroInfoProto.ConsumeMaterial material : consumeMaterialsList) {
|
||||
// List<String> heroIdsList = new ArrayList<>();
|
||||
// // 获取英雄id
|
||||
// material.getHeroIdsList().stream()
|
||||
// .filter(v->v.getType() == 1)
|
||||
// .forEach(v->heroIdsList.add(v.getItemId()));
|
||||
//// String[] heroIds = heroIdsList.toArray(new String[0]);
|
||||
// // 验证神将是否可以消耗
|
||||
//// HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.PASSIVE_EAT.getPropertyId(), heroIds);
|
||||
// }
|
||||
HeroLogic.getInstance().upHeroStar(iSession,heroId,consumeMaterialsList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
|
@ -16,6 +17,6 @@ public class HongmengGetInfoRequestHandler extends BaseHandler<HeroInfoProto.Get
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession session, HeroInfoProto.GetHongmengInfoRequest proto) throws Exception {
|
||||
// HeroLogic.getInstance().addOrUpdateHongmeng(session, true);
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(session, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,10 +54,7 @@ public class SaveHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.Save
|
|||
}
|
||||
|
||||
// 验证是否可以使用功能,神将置换
|
||||
boolean useFunction = HeroLogic.getInstance().isUseFunction(uid, HongMengFunctionEnum.HERO_REPLACE.getPropertyId(), hero.getId());
|
||||
if (!useFunction){
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
}
|
||||
// HeroLogic.getInstance().isUseFunction(uid, HongMengFunctionEnum.HERO_REPLACE.getPropertyId(), hero.getId());
|
||||
|
||||
//check in team
|
||||
int[] teamId = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HERO_RESOLVE_LICENCE);
|
||||
|
@ -69,7 +66,7 @@ public class SaveHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.Save
|
|||
int propertyName = hero.getPropertyId();
|
||||
int heroStar = hero.getStar();
|
||||
Map<Integer, Integer> integerIntegerMap = SLotterySetting.getChangeIds().get(heroStar);
|
||||
if(null == integerIntegerMap|| integerIntegerMap.size() ==0){
|
||||
if(null == integerIntegerMap|| integerIntegerMap.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -1471,6 +1471,8 @@ public class HeroLogic {
|
|||
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(), heroId));
|
||||
// 等级同步鸿蒙阵
|
||||
addOrUpdateHongmeng(session);
|
||||
|
||||
HeroInfoProto.UpHeroLevelResponse build = HeroInfoProto.UpHeroLevelResponse.newBuilder().setHeroId(heroId).setTargetLevel(hero.getOriginalLevel()).build();
|
||||
//发送成功消息
|
||||
|
@ -1508,10 +1510,10 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
// 验证鸿蒙阵等级
|
||||
boolean verifyHomgmeng = upStarVerifyHomgmeng(user, targetHero);
|
||||
if (!verifyHomgmeng) {
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_LEVEL_NOT);
|
||||
}
|
||||
// boolean verifyHomgmeng = upStarVerifyHomgmeng(user, targetHero);
|
||||
// if (!verifyHomgmeng) {
|
||||
// throw new ErrorCodeException(ErrorCode.HONGMENG_LEVEL_NOT);
|
||||
// }
|
||||
|
||||
Map<Integer, SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition = scHero.getConsumeMaterialInfoOfPositionByStar(oldStar + 1);
|
||||
if (consumeMaterialInfoByPosition == null) {
|
||||
|
@ -1655,7 +1657,7 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
//鸿蒙阵
|
||||
addOrUpdateHongmeng(session);
|
||||
// addOrUpdateHongmeng(session);
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE, baseBuilder.build(), true);
|
||||
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ChangeGodHeroContentParm)) {
|
||||
|
@ -4546,6 +4548,8 @@ public class HeroLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
List<String> heroList = new ArrayList<>(1);
|
||||
heroList.add(heroId);
|
||||
// 鸿蒙阵
|
||||
// HeroLogic.getInstance().isUseFunction(user.getId(), HongMengFunctionEnum.HERO_BACK_TO_BEGIN.getPropertyId(), heroId);
|
||||
boolean teamCheck = false;
|
||||
ErrorCode err = ItemLogic.getInstance().checkHeroResolve(heroList, user, teamCheck);
|
||||
if (null != err) {
|
||||
|
@ -5632,7 +5636,7 @@ public class HeroLogic {
|
|||
* @param session
|
||||
*/
|
||||
public void addOrUpdateHongmeng(ISession session) {
|
||||
// addOrUpdateHongmeng(session, false);
|
||||
addOrUpdateHongmeng(session, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5660,213 +5664,213 @@ public class HeroLogic {
|
|||
* @param judge true:返回,false:推送
|
||||
*/
|
||||
public void addOrUpdateHongmeng(ISession session, boolean judge) {
|
||||
// try {
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
// // 鸿蒙阵逻辑
|
||||
// HeroInfoProto.HongmengInfoIndication.Builder hongmengInfoIndication = HeroInfoProto.HongmengInfoIndication.newBuilder();
|
||||
//
|
||||
// SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.HongMeng.getFunctionType());
|
||||
// boolean open = GlobleSystemLogic.checkOpen(user, sGlobalSystemConfig);
|
||||
// // 鸿蒙阵开启条件
|
||||
// if (open) {
|
||||
// /** ========================== 共鸣信息初始化 =========================== **/
|
||||
// // 限制表 鸿蒙守卫数量#鸿蒙碑使者等级
|
||||
// String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#");
|
||||
//
|
||||
// Map<Integer, String> hongmengs = new HashMap<>(Integer.parseInt(openLevel[0]));
|
||||
// int defaultValue = 1000;
|
||||
// // 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 -1:不用卸下装备,其他表示装备星级
|
||||
// HongMengAddAttribute hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// // 只要任意鸿蒙守卫未穿戴魂宝/灵宝,或强化等级为0,便不会触发对应宝物的共鸣
|
||||
// HongMengAddAttribute soulEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// HongMengAddAttribute spiritEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
//
|
||||
// // 共鸣等级=鸿蒙守卫中最低的等级
|
||||
// HongMengAddAttribute resonanceLevel = new HongMengAddAttribute(0, defaultValue);
|
||||
//
|
||||
// // 共鸣法宝=鸿蒙守卫中法宝强化最低等级
|
||||
// HongMengAddAttribute especialEquipLevel = new HongMengAddAttribute(0, defaultValue);
|
||||
//
|
||||
// /** ========================== 开始处理玩家信息,更 =========================== **/
|
||||
// HeroManager heroManager = user.getHeroManager();
|
||||
// // 共鸣英雄池
|
||||
// Map<Integer, String> resonances = heroManager.getResonances();
|
||||
// // 第一个格子免费开启
|
||||
// if (!resonances.containsKey(1)) {
|
||||
// resonances.put(1, "");
|
||||
// heroManager.setResonances(resonances);
|
||||
// // 成就任务
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.HONGMENG_RESONANCE_LATTICE, resonances.size());
|
||||
// }
|
||||
//
|
||||
// // 获取玩家全部英雄
|
||||
// Collection<Hero> values = heroManager.getHeroMap().values();
|
||||
// List<Hero> heroes = new ArrayList<>(values);
|
||||
//
|
||||
// // 是否开启鸿蒙碑
|
||||
// int tabletMax = 0;
|
||||
// // 是否为鸿蒙碑
|
||||
// if (heroManager.getHongmengTablet() > 0) {
|
||||
// // 等级
|
||||
// resonanceLevel.value = heroManager.getHongmengTablet();
|
||||
// tabletMax = heroManager.getHongmengMaxLevelByInt();
|
||||
// } else {
|
||||
// // 玩家英雄背包按等级排序
|
||||
// Collections.sort(heroes);
|
||||
//
|
||||
// for (int i = 0; i < heroes.size(); i++) {
|
||||
// Hero hero = heroes.get(i);
|
||||
// resonances.forEach((k, v) -> {
|
||||
// if (v.equals(hero.getId())) {
|
||||
// try {
|
||||
// // 共鸣格子更新
|
||||
// unLoadResonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, k, 0);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// // 是否开启鸿蒙碑
|
||||
// if (hero.getOriginalLevel() >= Integer.parseInt(openLevel[1])) {
|
||||
// tabletMax++;
|
||||
// }
|
||||
// // 等级
|
||||
// hongmengLevel(resonanceLevel, hero);
|
||||
// hongmengs.put(i + 1, hero.getId());
|
||||
// if (hongmengs.size() >= Integer.parseInt(openLevel[0])) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 更新鸿蒙使者
|
||||
// heroManager.setHongmengGuards(hongmengs);
|
||||
//
|
||||
// // 鸿蒙碑,觉醒限制
|
||||
// if (tabletMax >= Integer.parseInt(openLevel[0]) && heroManager.getHongmengTablet() == 0) {
|
||||
// // 开启鸿蒙碑
|
||||
// heroManager.setHongmengTablet(Integer.parseInt(openLevel[1]));
|
||||
// for (String resetLevelId : heroManager.getHongmengGuards().values()) {
|
||||
// Hero hero = heroManager.getHero(resetLevelId);
|
||||
// if (hero == null) {
|
||||
// continue;
|
||||
// }
|
||||
// hero.setLevel(1);
|
||||
// hero.setBreakId(0);
|
||||
// }
|
||||
// // 初始化鸿蒙碑等级上限
|
||||
// for (Hero hero : heroes) {
|
||||
// if (hero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
// heroManager.addHongmengMaxLevel(hero.getTemplateId());
|
||||
// }
|
||||
// }
|
||||
// tabletMax = heroManager.getHongmengMaxLevelByInt();
|
||||
// resonanceLevel.heroTid = 0;
|
||||
// resonanceLevel.value = heroManager.getHongmengTablet();
|
||||
//
|
||||
// // 鸿蒙碑新手引导推送
|
||||
// HeroInfoProto.HongmengSteleNewHandIndication.Builder builder = HeroInfoProto.HongmengSteleNewHandIndication.newBuilder().setState(1);
|
||||
// MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_STELE_NEW_HAND_INDICATION.getNumber(), builder.build(), true);
|
||||
// }
|
||||
// }
|
||||
// // 守卫/使者英雄池
|
||||
// Map<Integer, String> guards = heroManager.getHongmengGuards();
|
||||
// // 英雄装备
|
||||
// Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
//
|
||||
// // if (guards.size() >= Integer.parseInt(openLevel[0])) {
|
||||
// // for (int i = 0; i < guards.size(); i++) {
|
||||
// // Hero hero = user.getHeroManager().getHero(guards.get(i + 1));
|
||||
// // if (hero == null) {
|
||||
// // // 找不到英雄,不存在这些共鸣属性
|
||||
// // hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// // soulEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// // spiritEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// // break;
|
||||
// // }
|
||||
// // // 装备
|
||||
// // hongmengEquip(hongMengAddAttributeEquip, hero);
|
||||
// // // 魂宝 灵宝
|
||||
// // soulOrSpirit(soulEquip, 1, equipMap, hero);
|
||||
// // soulOrSpirit(spiritEquip, 2, equipMap, hero);
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// /*** ============================= 计算共鸣信息 ==================================== **/
|
||||
// Map<HongMengAttributeEnum, HongMengAddAttribute> resonanceAddition = heroManager.getResonanceAddition();
|
||||
// resonanceAddition.clear();
|
||||
// if (resonanceLevel.value == defaultValue) {
|
||||
// resonanceLevel.value = -1;
|
||||
// }
|
||||
// // if (hongMengAddAttributeEquip.value == defaultValue) {
|
||||
// // hongMengAddAttributeEquip.value = -1;
|
||||
// // }
|
||||
// // if (soulEquip.value == defaultValue) {
|
||||
// // soulEquip.value = -1;
|
||||
// // }
|
||||
// // if (spiritEquip.value == defaultValue) {
|
||||
// // spiritEquip.value = -1;
|
||||
// // }
|
||||
// // if (especialEquipLevel.value == defaultValue) {
|
||||
// // especialEquipLevel.value = -1;
|
||||
// // }
|
||||
// resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel);
|
||||
// // resonanceAddition.put(HongMengAttributeEnum.EQUIP, hongMengAddAttributeEquip);
|
||||
// // resonanceAddition.put(HongMengAttributeEnum.SOUL_EQUIP, soulEquip);
|
||||
// // resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip);
|
||||
// heroManager.setResonanceAddition(resonanceAddition);
|
||||
//
|
||||
// /*** ============================= 开始组装鸿蒙阵信息 ==================================== **/
|
||||
// // 当前时间,秒
|
||||
// long now = TimeUtils.now() / 1000;
|
||||
// // 鸿蒙守卫
|
||||
// List<HeroInfoProto.HongmengHeroInfo> hongmengGuardsProto = new ArrayList<>();
|
||||
// Map<Integer, String> hongmengGuards = heroManager.getHongmengGuards();
|
||||
// Map<Integer, Long> hongmengGuardTime = heroManager.getHongmengGuardTime();
|
||||
// for (Map.Entry<Integer, String> entry : hongmengGuards.entrySet()) {
|
||||
// HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder()
|
||||
// .setGridId(entry.getKey())
|
||||
// .setHeroId(entry.getValue())
|
||||
// .setTime(hongmengGuardTime.containsKey(entry.getKey()) ? (hongmengGuardTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengGuardTime.get(entry.getKey()) - now)) : 0)
|
||||
// .build();
|
||||
// hongmengGuardsProto.add(hongmengHeroInfo);
|
||||
// }
|
||||
// // 共鸣属性
|
||||
// List<HeroInfoProto.HongmengAddition> hongmengAdditions = new ArrayList<>();
|
||||
// for (Map.Entry<HongMengAttributeEnum, HongMengAddAttribute> entry : resonanceAddition.entrySet()) {
|
||||
// HeroInfoProto.HongmengAddition hongmengAddition = HeroInfoProto.HongmengAddition
|
||||
// .newBuilder()
|
||||
// .setAdditionType(entry.getKey().getPropertyId())
|
||||
// .setValue(entry.getValue().value)
|
||||
// .setHeroTid(entry.getValue().heroTid)
|
||||
// .build();
|
||||
// hongmengAdditions.add(hongmengAddition);
|
||||
// }
|
||||
// // 共鸣使者
|
||||
// List<HeroInfoProto.HongmengHeroInfo> hongmengResonancesProto = new ArrayList<>();
|
||||
// Map<Integer, String> hongmengResonances = heroManager.getResonances();
|
||||
// Map<Integer, Long> hongmengResonanceTime = heroManager.getResonancesTime();
|
||||
// for (Map.Entry<Integer, String> entry : hongmengResonances.entrySet()) {
|
||||
// HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder()
|
||||
// .setGridId(entry.getKey())
|
||||
// .setHeroId(entry.getValue())
|
||||
// .setTime(hongmengResonanceTime.containsKey(entry.getKey()) ? (hongmengResonanceTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengResonanceTime.get(entry.getKey()) - now)) : 0)
|
||||
// .build();
|
||||
// hongmengResonancesProto.add(hongmengHeroInfo);
|
||||
// }
|
||||
// hongmengInfoIndication.addAllHongmengGuards(hongmengGuardsProto).addAllHongmengAdditions(hongmengAdditions)
|
||||
// .addAllHongmengResonacnes(hongmengResonancesProto).setHongmengTabletMax(tabletMax).build();
|
||||
// }
|
||||
// // 返回协议
|
||||
// if (judge) {
|
||||
// MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_GET_INFO_RESPONSE_VALUE, hongmengInfoIndication.build(), true);
|
||||
// } else {
|
||||
// if (hongmengInfoIndication.getHongmengGuardsCount() > 0 || hongmengInfoIndication.getHongmengAdditionsCount() > 0 || hongmengInfoIndication.getHongmengResonacnesCount() > 0) {
|
||||
// MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION_VALUE, hongmengInfoIndication.build(), true);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// LOGGER.error("鸿蒙阵报错,{}",e.getMessage());
|
||||
// }
|
||||
try {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
// 鸿蒙阵逻辑
|
||||
HeroInfoProto.HongmengInfoIndication.Builder hongmengInfoIndication = HeroInfoProto.HongmengInfoIndication.newBuilder();
|
||||
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.HongMeng.getFunctionType());
|
||||
boolean open = GlobleSystemLogic.checkOpen(user, sGlobalSystemConfig);
|
||||
// 鸿蒙阵开启条件
|
||||
if (open) {
|
||||
/** ========================== 共鸣信息初始化 =========================== **/
|
||||
// 限制表 鸿蒙守卫数量#鸿蒙碑使者等级
|
||||
String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#");
|
||||
|
||||
Map<Integer, String> hongmengs = new HashMap<>(Integer.parseInt(openLevel[0]));
|
||||
int defaultValue = 1000;
|
||||
// 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 -1:不用卸下装备,其他表示装备星级
|
||||
HongMengAddAttribute hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// 只要任意鸿蒙守卫未穿戴魂宝/灵宝,或强化等级为0,便不会触发对应宝物的共鸣
|
||||
HongMengAddAttribute soulEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
HongMengAddAttribute spiritEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
|
||||
// 共鸣等级=鸿蒙守卫中最低的等级
|
||||
HongMengAddAttribute resonanceLevel = new HongMengAddAttribute(0, defaultValue);
|
||||
|
||||
// 共鸣法宝=鸿蒙守卫中法宝强化最低等级
|
||||
HongMengAddAttribute especialEquipLevel = new HongMengAddAttribute(0, defaultValue);
|
||||
|
||||
/** ========================== 开始处理玩家信息,更 =========================== **/
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 共鸣英雄池
|
||||
Map<Integer, String> resonances = heroManager.getResonances();
|
||||
// 第一个格子免费开启
|
||||
if (!resonances.containsKey(1)) {
|
||||
resonances.put(1, "");
|
||||
heroManager.setResonances(resonances);
|
||||
// 成就任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.HONGMENG_RESONANCE_LATTICE, resonances.size());
|
||||
}
|
||||
|
||||
// 获取玩家全部英雄
|
||||
Collection<Hero> values = heroManager.getHeroMap().values();
|
||||
List<Hero> heroes = new ArrayList<>(values);
|
||||
|
||||
// 是否开启鸿蒙碑
|
||||
int tabletMax = 0;
|
||||
// 是否为鸿蒙碑
|
||||
if (heroManager.getHongmengTablet() > 0) {
|
||||
// 等级
|
||||
resonanceLevel.value = heroManager.getHongmengTablet();
|
||||
tabletMax = heroManager.getHongmengMaxLevelByInt();
|
||||
} else {
|
||||
// 玩家英雄背包按等级排序
|
||||
Collections.sort(heroes);
|
||||
|
||||
for (int i = 0; i < heroes.size(); i++) {
|
||||
Hero hero = heroes.get(i);
|
||||
resonances.forEach((k, v) -> {
|
||||
if (v.equals(hero.getId())) {
|
||||
try {
|
||||
// 共鸣格子更新
|
||||
unLoadResonance(session, MessageTypeProto.MessageType.HONGMENG_RESONANCE_RESPONSE, k, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
// 是否开启鸿蒙碑
|
||||
if (hero.getOriginalLevel() >= Integer.parseInt(openLevel[1])) {
|
||||
tabletMax++;
|
||||
}
|
||||
// 等级
|
||||
hongmengLevel(resonanceLevel, hero);
|
||||
hongmengs.put(i + 1, hero.getId());
|
||||
if (hongmengs.size() >= Integer.parseInt(openLevel[0])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新鸿蒙使者
|
||||
heroManager.setHongmengGuards(hongmengs);
|
||||
|
||||
// 鸿蒙碑,觉醒限制
|
||||
if (tabletMax >= Integer.parseInt(openLevel[0]) && heroManager.getHongmengTablet() == 0) {
|
||||
// 开启鸿蒙碑
|
||||
heroManager.setHongmengTablet(Integer.parseInt(openLevel[1]));
|
||||
for (String resetLevelId : heroManager.getHongmengGuards().values()) {
|
||||
Hero hero = heroManager.getHero(resetLevelId);
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
hero.setLevel(1);
|
||||
hero.setBreakId(0);
|
||||
}
|
||||
// 初始化鸿蒙碑等级上限
|
||||
for (Hero hero : heroes) {
|
||||
if (hero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
heroManager.addHongmengMaxLevel(hero.getTemplateId());
|
||||
}
|
||||
}
|
||||
tabletMax = heroManager.getHongmengMaxLevelByInt();
|
||||
resonanceLevel.heroTid = 0;
|
||||
resonanceLevel.value = heroManager.getHongmengTablet();
|
||||
|
||||
// 鸿蒙碑新手引导推送
|
||||
HeroInfoProto.HongmengSteleNewHandIndication.Builder builder = HeroInfoProto.HongmengSteleNewHandIndication.newBuilder().setState(1);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_STELE_NEW_HAND_INDICATION.getNumber(), builder.build(), true);
|
||||
}
|
||||
}
|
||||
// 守卫/使者英雄池
|
||||
Map<Integer, String> guards = heroManager.getHongmengGuards();
|
||||
// 英雄装备
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
|
||||
// if (guards.size() >= Integer.parseInt(openLevel[0])) {
|
||||
// for (int i = 0; i < guards.size(); i++) {
|
||||
// Hero hero = user.getHeroManager().getHero(guards.get(i + 1));
|
||||
// if (hero == null) {
|
||||
// // 找不到英雄,不存在这些共鸣属性
|
||||
// hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// soulEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// spiritEquip = new HongMengAddAttribute(0, defaultValue);
|
||||
// break;
|
||||
// }
|
||||
// // 装备
|
||||
// hongmengEquip(hongMengAddAttributeEquip, hero);
|
||||
// // 魂宝 灵宝
|
||||
// soulOrSpirit(soulEquip, 1, equipMap, hero);
|
||||
// soulOrSpirit(spiritEquip, 2, equipMap, hero);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*** ============================= 计算共鸣信息 ==================================== **/
|
||||
Map<HongMengAttributeEnum, HongMengAddAttribute> resonanceAddition = heroManager.getResonanceAddition();
|
||||
resonanceAddition.clear();
|
||||
if (resonanceLevel.value == defaultValue) {
|
||||
resonanceLevel.value = -1;
|
||||
}
|
||||
// if (hongMengAddAttributeEquip.value == defaultValue) {
|
||||
// hongMengAddAttributeEquip.value = -1;
|
||||
// }
|
||||
// if (soulEquip.value == defaultValue) {
|
||||
// soulEquip.value = -1;
|
||||
// }
|
||||
// if (spiritEquip.value == defaultValue) {
|
||||
// spiritEquip.value = -1;
|
||||
// }
|
||||
// if (especialEquipLevel.value == defaultValue) {
|
||||
// especialEquipLevel.value = -1;
|
||||
// }
|
||||
resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel);
|
||||
// resonanceAddition.put(HongMengAttributeEnum.EQUIP, hongMengAddAttributeEquip);
|
||||
// resonanceAddition.put(HongMengAttributeEnum.SOUL_EQUIP, soulEquip);
|
||||
// resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip);
|
||||
heroManager.setResonanceAddition(resonanceAddition);
|
||||
|
||||
/*** ============================= 开始组装鸿蒙阵信息 ==================================== **/
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now() / 1000;
|
||||
// 鸿蒙守卫
|
||||
List<HeroInfoProto.HongmengHeroInfo> hongmengGuardsProto = new ArrayList<>();
|
||||
Map<Integer, String> hongmengGuards = heroManager.getHongmengGuards();
|
||||
Map<Integer, Long> hongmengGuardTime = heroManager.getHongmengGuardTime();
|
||||
for (Map.Entry<Integer, String> entry : hongmengGuards.entrySet()) {
|
||||
HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder()
|
||||
.setGridId(entry.getKey())
|
||||
.setHeroId(entry.getValue())
|
||||
.setTime(hongmengGuardTime.containsKey(entry.getKey()) ? (hongmengGuardTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengGuardTime.get(entry.getKey()) - now)) : 0)
|
||||
.build();
|
||||
hongmengGuardsProto.add(hongmengHeroInfo);
|
||||
}
|
||||
// 共鸣属性
|
||||
List<HeroInfoProto.HongmengAddition> hongmengAdditions = new ArrayList<>();
|
||||
for (Map.Entry<HongMengAttributeEnum, HongMengAddAttribute> entry : resonanceAddition.entrySet()) {
|
||||
HeroInfoProto.HongmengAddition hongmengAddition = HeroInfoProto.HongmengAddition
|
||||
.newBuilder()
|
||||
.setAdditionType(entry.getKey().getPropertyId())
|
||||
.setValue(entry.getValue().value)
|
||||
.setHeroTid(entry.getValue().heroTid)
|
||||
.build();
|
||||
hongmengAdditions.add(hongmengAddition);
|
||||
}
|
||||
// 共鸣使者
|
||||
List<HeroInfoProto.HongmengHeroInfo> hongmengResonancesProto = new ArrayList<>();
|
||||
Map<Integer, String> hongmengResonances = heroManager.getResonances();
|
||||
Map<Integer, Long> hongmengResonanceTime = heroManager.getResonancesTime();
|
||||
for (Map.Entry<Integer, String> entry : hongmengResonances.entrySet()) {
|
||||
HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder()
|
||||
.setGridId(entry.getKey())
|
||||
.setHeroId(entry.getValue())
|
||||
.setTime(hongmengResonanceTime.containsKey(entry.getKey()) ? (hongmengResonanceTime.get(entry.getKey()) - now < 0 ? 0 : (hongmengResonanceTime.get(entry.getKey()) - now)) : 0)
|
||||
.build();
|
||||
hongmengResonancesProto.add(hongmengHeroInfo);
|
||||
}
|
||||
hongmengInfoIndication.addAllHongmengGuards(hongmengGuardsProto).addAllHongmengAdditions(hongmengAdditions)
|
||||
.addAllHongmengResonacnes(hongmengResonancesProto).setHongmengTabletMax(tabletMax).build();
|
||||
}
|
||||
// 返回协议
|
||||
if (judge) {
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_GET_INFO_RESPONSE_VALUE, hongmengInfoIndication.build(), true);
|
||||
} else {
|
||||
if (hongmengInfoIndication.getHongmengGuardsCount() > 0 || hongmengInfoIndication.getHongmengAdditionsCount() > 0 || hongmengInfoIndication.getHongmengResonacnesCount() > 0) {
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION_VALUE, hongmengInfoIndication.build(), true);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("鸿蒙阵报错,{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6300,47 +6304,48 @@ public class HeroLogic {
|
|||
* @param functionId
|
||||
* @return
|
||||
*/
|
||||
public boolean isUseFunction(int uid, int functionId, String... heroId) {
|
||||
// User user = UserManager.getUser(uid);
|
||||
// HeroManager heroManager = user.getHeroManager();
|
||||
// // 记录每个英雄
|
||||
// Map<String, Boolean> heroMap = new HashMap<>(heroId.length);
|
||||
//
|
||||
// for (String s : heroId) {
|
||||
// // 属性初始化
|
||||
// int[] value = null;
|
||||
// heroMap.put(s, false);
|
||||
//
|
||||
// if ("".equals(s) || s == null) {
|
||||
// heroMap.put(s, true);
|
||||
// continue;
|
||||
// }
|
||||
// // 鸿蒙守卫
|
||||
// if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().containsValue(s)) {
|
||||
// value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_GUARD_LIMIT);
|
||||
// }
|
||||
// // 鸿蒙使者
|
||||
// if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().containsValue(s)) {
|
||||
// value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_MESSENGER_LIMIT);
|
||||
// }
|
||||
// // 共鸣神将
|
||||
// if (heroManager.getResonances().containsValue(s)) {
|
||||
// value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_TAKE_LIMIT);
|
||||
// }
|
||||
// if (value == null) {
|
||||
// heroMap.put(s, true);
|
||||
// continue;
|
||||
// }
|
||||
// // 包含类型,返回false
|
||||
// for (int i : value)
|
||||
// if (i == functionId) {
|
||||
// heroMap.put(s, true);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// boolean contains = heroMap.containsValue(false);
|
||||
// return !contains;
|
||||
return true;
|
||||
public void isUseFunction(int uid, int functionId, String... heroId) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 记录每个英雄
|
||||
Map<String, Boolean> heroMap = new HashMap<>(heroId.length);
|
||||
|
||||
for (String s : heroId) {
|
||||
// 属性初始化
|
||||
int[] value = null;
|
||||
heroMap.put(s, false);
|
||||
|
||||
if ("".equals(s) || s == null) {
|
||||
heroMap.put(s, true);
|
||||
continue;
|
||||
}
|
||||
// 鸿蒙守卫
|
||||
if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().containsValue(s)) {
|
||||
value = SSpecialConfig.getOnceArrayValue("HONGMENG_GUARD_LIMIT");
|
||||
}
|
||||
// 鸿蒙使者
|
||||
if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().containsValue(s)) {
|
||||
value = SSpecialConfig.getOnceArrayValue("HONGMENG_MESSENGER_LIMIT");
|
||||
}
|
||||
// 共鸣神将
|
||||
if (heroManager.getResonances().containsValue(s)) {
|
||||
value = SSpecialConfig.getOnceArrayValue("HONGMENG_TAKE_LIMIT");
|
||||
}
|
||||
if (value == null) {
|
||||
heroMap.put(s, true);
|
||||
continue;
|
||||
}
|
||||
// 包含类型,返回false
|
||||
for (int i : value)
|
||||
if (i == functionId) {
|
||||
heroMap.put(s, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean contains = heroMap.containsValue(false);
|
||||
if (contains){
|
||||
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
|
@ -140,7 +141,7 @@ public class ItemLogic {
|
|||
public void useItem(ISession iSession, List<CommonProto.Item> itemList) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (itemList.size() == 0) {
|
||||
if (itemList.isEmpty()) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (itemList.size() == 1) {
|
||||
|
@ -296,7 +297,7 @@ public class ItemLogic {
|
|||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
if (itemList.size() == 0) {
|
||||
if (itemList.isEmpty()) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int openBoxLimits = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getOpenBoxLimits();
|
||||
|
@ -322,7 +323,7 @@ public class ItemLogic {
|
|||
cost.append("|").append(item.getItemId()).append("#").append(item.getItemNum());
|
||||
}
|
||||
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||
num += item.getItemNum();
|
||||
num += (int) item.getItemNum();
|
||||
ItemUtil.combineReward(user, true, sItem.getRewardGroup(), 1f, itemObj, 0);
|
||||
}
|
||||
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
|
||||
|
@ -477,6 +478,9 @@ public class ItemLogic {
|
|||
public void decomposeHero(ISession iSession, List<String> heroIdsList) throws Exception {
|
||||
// 逻辑
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
// 鸿蒙阵
|
||||
// HeroLogic.getInstance().isUseFunction(user.getId(), HongMengFunctionEnum.FAREWELL_HERO.getPropertyId(), heroIdsList.toArray(new String[0]));
|
||||
|
||||
ErrorCode errorMags = checkHeroResolve(heroIdsList, user);
|
||||
if (null != errorMags) {
|
||||
throw new ErrorCodeException(errorMags);
|
||||
|
@ -736,7 +740,7 @@ public class ItemLogic {
|
|||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),jewel.getHeroId()));
|
||||
//鸿蒙阵
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(iSession);
|
||||
// HeroLogic.getInstance().addOrUpdateHongmeng(iSession);
|
||||
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.JEWEL_BUILD_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.ljsd.jieling.logic.activity.activityLogic.GmActivityLogic;
|
|||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.home.event.HomeEvent;
|
||||
import com.ljsd.jieling.logic.item.ItemLog;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
|
@ -1422,7 +1423,7 @@ public class ItemUtil {
|
|||
}
|
||||
heroManager.addHero(hero);
|
||||
// 鸿蒙阵推送
|
||||
// HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
if (reason != BIReason.HERO_RETURN) {
|
||||
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
|
||||
|
|
Loading…
Reference in New Issue