|
|
|
|
@ -29,10 +29,7 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
|
|
|
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
|
|
|
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
|
|
|
|
import com.ljsd.jieling.network.session.ISession;
|
|
|
|
|
import com.ljsd.jieling.protocols.CommonProto;
|
|
|
|
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
|
|
|
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
|
|
|
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
|
|
|
|
import com.ljsd.jieling.protocols.*;
|
|
|
|
|
import com.ljsd.jieling.util.*;
|
|
|
|
|
import config.*;
|
|
|
|
|
import manager.STableManager;
|
|
|
|
|
@ -3447,53 +3444,10 @@ public class HeroLogic{
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public void getHongmengInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
|
|
|
|
User user = UserManager.getUser(session.getUid());
|
|
|
|
|
HeroManager heroManager = user.getHeroManager();
|
|
|
|
|
// 组装鸿蒙守卫或者鸿蒙使者信息
|
|
|
|
|
// 刷新鸿蒙阵
|
|
|
|
|
addOrUpdateHongmeng(session);
|
|
|
|
|
// 组装鸿蒙阵信息
|
|
|
|
|
List<HeroInfoProto.HongmengHeroInfo> hongmengHeroInfos = new ArrayList<>();
|
|
|
|
|
Map<Integer, String> resonances = heroManager.getResonances();
|
|
|
|
|
Map<Integer, Long> resonancesTime = heroManager.getResonancesTime();
|
|
|
|
|
long now = TimeUtils.now()/1000;
|
|
|
|
|
for (Map.Entry<Integer, String> entry : resonances.entrySet()) {
|
|
|
|
|
HeroInfoProto.HongmengHeroInfo hongmengHeroInfo = HeroInfoProto.HongmengHeroInfo.newBuilder()
|
|
|
|
|
.setGridId(entry.getKey())
|
|
|
|
|
.setHeroId(entry.getValue())
|
|
|
|
|
.setTime(resonancesTime.containsKey(entry.getKey()) ? (resonancesTime.get(entry.getKey()) - now < 0 ? 0 : (resonancesTime.get(entry.getKey()) - now)) : 0)
|
|
|
|
|
.build();
|
|
|
|
|
hongmengHeroInfos.add(hongmengHeroInfo);
|
|
|
|
|
}
|
|
|
|
|
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<>();
|
|
|
|
|
Map<HongMengAttributeEnum, HongMengAddAttribute> resonanceAddition = heroManager.getResonanceAddition();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
HeroInfoProto.GetHongmengInfoResponse getHongmengInfoResponse = HeroInfoProto.GetHongmengInfoResponse.newBuilder()
|
|
|
|
|
.addAllHongmengGuards(hongmengGuardsProto)
|
|
|
|
|
.setHongmengTablet(heroManager.getHongmengTablet())
|
|
|
|
|
.addAllHongmengHeroInfos(hongmengHeroInfos)
|
|
|
|
|
.addAllHongmengAdditions(hongmengAdditions)
|
|
|
|
|
.build();
|
|
|
|
|
HeroInfoProto.GetHongmengInfoResponse getHongmengInfoResponse = HeroInfoProto.GetHongmengInfoResponse.newBuilder().build();
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), getHongmengInfoResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -3503,32 +3457,12 @@ public class HeroLogic{
|
|
|
|
|
*/
|
|
|
|
|
public void addOrUpdateHongmeng(ISession session) throws Exception {
|
|
|
|
|
User user = UserManager.getUser(session.getUid());
|
|
|
|
|
|
|
|
|
|
// 鸿蒙阵开启条件
|
|
|
|
|
if (user.getPlayerInfoManager().getLevel() < SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_OPENLEVEL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
HeroManager heroManager = user.getHeroManager();
|
|
|
|
|
// 鸿蒙碑开启,不需要再更新鸿蒙使者和鸿蒙守卫
|
|
|
|
|
if (heroManager.getHongmengTablet() > 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Collection<Hero> values = heroManager.getHeroMap().values();
|
|
|
|
|
List<Hero> heroes = new ArrayList<>(values);
|
|
|
|
|
Collections.sort(heroes, new Comparator<Hero>() {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(Hero hero1, Hero hero2) {
|
|
|
|
|
int compareValue = hero2.getOriginalLevel() - hero1.getOriginalLevel();
|
|
|
|
|
if (compareValue != 0) {
|
|
|
|
|
return compareValue;
|
|
|
|
|
}
|
|
|
|
|
return Integer.compare(hero2.getStar(), hero1.getStar());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
heroes.forEach((item)->{
|
|
|
|
|
System.out.println("hero========================:"+item.getId());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** ========================== 共鸣信息初始化 =========================== **/
|
|
|
|
|
// 限制表 鸿蒙守卫数量#鸿蒙碑使者等级
|
|
|
|
|
String[] openLevel = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#");
|
|
|
|
|
|
|
|
|
|
@ -3546,32 +3480,91 @@ public class HeroLogic{
|
|
|
|
|
// 共鸣法宝=鸿蒙守卫中法宝强化最低等级
|
|
|
|
|
HongMengAddAttribute especialEquipLevel = new HongMengAddAttribute(0, defaultValue);
|
|
|
|
|
|
|
|
|
|
// 是否开启鸿蒙碑
|
|
|
|
|
int tablet = 1;
|
|
|
|
|
/** ========================== 开始处理玩家信息,更 =========================== **/
|
|
|
|
|
HeroManager heroManager = user.getHeroManager();
|
|
|
|
|
// 共鸣英雄池
|
|
|
|
|
Map<Integer, String> resonances = heroManager.getResonances();
|
|
|
|
|
int key = 1;
|
|
|
|
|
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 (!resonances.containsKey(1)) {
|
|
|
|
|
resonances.put(1, "");
|
|
|
|
|
heroManager.setResonances(resonances);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取玩家全部英雄
|
|
|
|
|
Collection<Hero> values = heroManager.getHeroMap().values();
|
|
|
|
|
List<Hero> heroes = new ArrayList<>(values);
|
|
|
|
|
|
|
|
|
|
// 是否开启鸿蒙碑
|
|
|
|
|
int tabletMax = 1;
|
|
|
|
|
// 是否为鸿蒙碑
|
|
|
|
|
if (heroManager.getHongmengTablet() > 0){
|
|
|
|
|
// 等级
|
|
|
|
|
resonanceLevel.value = heroManager.getHongmengTablet();
|
|
|
|
|
tabletMax = heroManager.getHongmengMaxLevelByInt();
|
|
|
|
|
}else {
|
|
|
|
|
// 玩家英雄背包按等级排序
|
|
|
|
|
Collections.sort(heroes, new Comparator<Hero>() {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(Hero hero1, Hero hero2) {
|
|
|
|
|
int compareValue = hero2.getOriginalLevel() - hero1.getOriginalLevel();
|
|
|
|
|
if (compareValue != 0) {
|
|
|
|
|
return compareValue;
|
|
|
|
|
}
|
|
|
|
|
return Integer.compare(hero2.getStar(), hero1.getStar());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 是否开启鸿蒙碑
|
|
|
|
|
if (hero.getOriginalLevel() < Integer.parseInt(openLevel[1])) {
|
|
|
|
|
tablet = 0;
|
|
|
|
|
|
|
|
|
|
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 = 0;
|
|
|
|
|
}
|
|
|
|
|
// 等级
|
|
|
|
|
hongmengLevel(resonanceLevel, hero);
|
|
|
|
|
hongmengs.put(i+1, hero.getId());
|
|
|
|
|
if (hongmengs.size() >= Integer.parseInt(openLevel[0])) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 等级
|
|
|
|
|
hongmengLevel(resonanceLevel, hero);
|
|
|
|
|
hongmengs.put(key++, hero.getId());
|
|
|
|
|
if (hongmengs.size() >= Integer.parseInt(openLevel[0])) {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// 更新鸿蒙使者
|
|
|
|
|
heroManager.setHongmengGuards(hongmengs);
|
|
|
|
|
|
|
|
|
|
// 鸿蒙碑,觉醒限制
|
|
|
|
|
if (tabletMax == 1 && 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(user, 1);
|
|
|
|
|
}
|
|
|
|
|
// 初始化鸿蒙碑等级上限
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -3579,48 +3572,49 @@ public class HeroLogic{
|
|
|
|
|
/*if (hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
return;
|
|
|
|
|
}*/
|
|
|
|
|
// 更新鸿蒙使者
|
|
|
|
|
heroManager.setHongmengGuards(hongmengs);
|
|
|
|
|
|
|
|
|
|
// 守卫/使者英雄池
|
|
|
|
|
Map<Integer, String> guards = heroManager.getHongmengGuards();
|
|
|
|
|
// 英雄装备
|
|
|
|
|
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < guards.size(); i++) {
|
|
|
|
|
Hero hero = user.getHeroManager().getHero(guards.get(i+1));
|
|
|
|
|
if (hero == null){
|
|
|
|
|
continue;
|
|
|
|
|
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);
|
|
|
|
|
especialEquipLevel = new HongMengAddAttribute(0, defaultValue);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// 装备
|
|
|
|
|
hongmengEquip(hongMengAddAttributeEquip, hero);
|
|
|
|
|
// 魂宝 灵宝
|
|
|
|
|
soulOrSpirit(soulEquip, spiritEquip, equipMap, hero);
|
|
|
|
|
// 法宝
|
|
|
|
|
especialAdd(especialEquipLevel, hero);
|
|
|
|
|
}
|
|
|
|
|
// 装备
|
|
|
|
|
hongmengEquip(hongMengAddAttributeEquip, hero);
|
|
|
|
|
// 魂宝 灵宝
|
|
|
|
|
soulOrSpirit(soulEquip, spiritEquip, equipMap, hero);
|
|
|
|
|
// 法宝
|
|
|
|
|
especialAdd(especialEquipLevel, hero);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 第一个格子免费开启
|
|
|
|
|
if (!resonances.containsKey(1)) {
|
|
|
|
|
resonances.put(1, "");
|
|
|
|
|
heroManager.setResonances(resonances);
|
|
|
|
|
}
|
|
|
|
|
// 计算共鸣属性
|
|
|
|
|
/*** ============================= 计算共鸣信息 ==================================== **/
|
|
|
|
|
Map<HongMengAttributeEnum, HongMengAddAttribute> resonanceAddition = heroManager.getResonanceAddition();
|
|
|
|
|
resonanceAddition.clear();
|
|
|
|
|
if (resonanceLevel.value == defaultValue || hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
resonanceLevel.value = 0;
|
|
|
|
|
if (resonanceLevel.value == defaultValue) {
|
|
|
|
|
resonanceLevel.value = -1;
|
|
|
|
|
}
|
|
|
|
|
if (hongMengAddAttributeEquip.value == defaultValue || hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
hongMengAddAttributeEquip.value = 0;
|
|
|
|
|
if (hongMengAddAttributeEquip.value == defaultValue) {
|
|
|
|
|
hongMengAddAttributeEquip.value = -1;
|
|
|
|
|
}
|
|
|
|
|
if (soulEquip.value == defaultValue || hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
soulEquip.value = 0;
|
|
|
|
|
if (soulEquip.value == defaultValue) {
|
|
|
|
|
soulEquip.value = -1;
|
|
|
|
|
}
|
|
|
|
|
if (spiritEquip.value == defaultValue || hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
spiritEquip.value = 0;
|
|
|
|
|
if (spiritEquip.value == defaultValue) {
|
|
|
|
|
spiritEquip.value = -1;
|
|
|
|
|
}
|
|
|
|
|
if (especialEquipLevel.value == defaultValue || hongmengs.size() < Integer.parseInt(openLevel[0])) {
|
|
|
|
|
especialEquipLevel.value = 0;
|
|
|
|
|
if (especialEquipLevel.value == defaultValue) {
|
|
|
|
|
especialEquipLevel.value = -1;
|
|
|
|
|
}
|
|
|
|
|
resonanceAddition.put(HongMengAttributeEnum.LEVEL, resonanceLevel);
|
|
|
|
|
resonanceAddition.put(HongMengAttributeEnum.EQUIP, hongMengAddAttributeEquip);
|
|
|
|
|
@ -3628,18 +3622,9 @@ public class HeroLogic{
|
|
|
|
|
resonanceAddition.put(HongMengAttributeEnum.SPIRIT_EQUIP, spiritEquip);
|
|
|
|
|
resonanceAddition.put(HongMengAttributeEnum.MAGIC_WEAPON, especialEquipLevel);
|
|
|
|
|
heroManager.setResonanceAddition(resonanceAddition);
|
|
|
|
|
// 鸿蒙碑,觉醒限制
|
|
|
|
|
if (tablet == 1 && 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(user, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*** ============================= 开始组装鸿蒙阵信息 ==================================== **/
|
|
|
|
|
// 当前时间,秒
|
|
|
|
|
long now = TimeUtils.now()/1000;
|
|
|
|
|
// 鸿蒙守卫
|
|
|
|
|
List<HeroInfoProto.HongmengHeroInfo> hongmengGuardsProto = new ArrayList<>();
|
|
|
|
|
@ -3680,6 +3665,7 @@ public class HeroLogic{
|
|
|
|
|
.addAllHongmengGuards(hongmengGuardsProto)
|
|
|
|
|
.addAllHongmengAdditions(hongmengAdditions)
|
|
|
|
|
.addAllHongmengResonacnes(hongmengResonancesProto)
|
|
|
|
|
.setHongmengTabletMax(tabletMax)
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION.getNumber(),hongmengInfoIndication,true);
|
|
|
|
|
@ -3868,6 +3854,12 @@ public class HeroLogic{
|
|
|
|
|
equipByPositionMap.clear();
|
|
|
|
|
hero.setEquipByPositionMap(equipByPositionMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 战力改变
|
|
|
|
|
if(isInTeam(user,heroId,1)){
|
|
|
|
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -3898,6 +3890,11 @@ public class HeroLogic{
|
|
|
|
|
heroManager.updateResonances(index, "");
|
|
|
|
|
heroManager.updateResonancesTime(index, TimeUtils.now()/1000 + time);
|
|
|
|
|
|
|
|
|
|
// 战力改变
|
|
|
|
|
if(isInTeam(user,heroId,1)){
|
|
|
|
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HeroInfoProto.ResonanceResponse resonanceResponse = HeroInfoProto.ResonanceResponse.newBuilder().setLeftTime(time).build();
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), resonanceResponse);
|
|
|
|
|
}
|
|
|
|
|
@ -3927,10 +3924,11 @@ public class HeroLogic{
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
String[] stringValue = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_LATTICE_PRICE).split("#");
|
|
|
|
|
long time = (unloadTime - now);
|
|
|
|
|
int count = (int) (time / Integer.parseInt(stringValue[0]) *Integer.parseInt(stringValue[2]) );
|
|
|
|
|
double time = (unloadTime - now);
|
|
|
|
|
double money = Integer.parseInt(stringValue[0]) *Integer.parseInt(stringValue[2]);
|
|
|
|
|
double count = Math.ceil (time / money);
|
|
|
|
|
Map<Integer, Integer> cost = new HashMap<>(1);
|
|
|
|
|
cost.put(Integer.parseInt(stringValue[1]), count);
|
|
|
|
|
cost.put(Integer.parseInt(stringValue[1]), (int)count);
|
|
|
|
|
boolean checkCost = ItemUtil.checkCost(user, cost);
|
|
|
|
|
if (!checkCost) {
|
|
|
|
|
LOGGER.info("cleanTime uid=>{} item not enough =>{}", user.getId(), unloadTime);
|
|
|
|
|
@ -3956,10 +3954,11 @@ public class HeroLogic{
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
String[] stringValue = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_LATTICE_PRICE).split("#");
|
|
|
|
|
long time = unloadTime - now;
|
|
|
|
|
int count = (int) (time * Integer.parseInt(stringValue[0]));
|
|
|
|
|
double time = unloadTime - now;
|
|
|
|
|
double money = Integer.parseInt(stringValue[0]) *Integer.parseInt(stringValue[2]);
|
|
|
|
|
double count = Math.ceil (time / money);
|
|
|
|
|
Map<Integer, Integer> cost = new HashMap<>(1);
|
|
|
|
|
cost.put(Integer.parseInt(stringValue[1]), count);
|
|
|
|
|
cost.put(Integer.parseInt(stringValue[1]), (int)count);
|
|
|
|
|
boolean checkCost = ItemUtil.checkCost(user, cost);
|
|
|
|
|
if (!checkCost) {
|
|
|
|
|
LOGGER.info("cleanTime uid=>{} item not enough =>{}", user.getId(), unloadTime);
|
|
|
|
|
@ -3984,8 +3983,7 @@ public class HeroLogic{
|
|
|
|
|
LOGGER.info("updateHongmengTablet uid=>{} HongmengTablet not open=>{}", user.getId(), 0);
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
String[] split = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_UPGRADE_LIMIT).split("#");
|
|
|
|
|
int maxLevel = heroManager.getHongmengMaxLevel().size() * SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_ONEHERO_OPENLEVEL) + Integer.parseInt(split[1]);
|
|
|
|
|
int maxLevel = heroManager.getHongmengMaxLevelByInt();
|
|
|
|
|
if (heroManager.getHongmengTablet() >= maxLevel) {
|
|
|
|
|
LOGGER.info("updateHongmengTablet uid=>{} curLevel={} maxLevel =>{}", user.getId(), heroManager.getHongmengTablet(), maxLevel);
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
@ -4003,6 +4001,10 @@ public class HeroLogic{
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
heroManager.setHongmengTablet(nextLevel);
|
|
|
|
|
|
|
|
|
|
// 战力改变
|
|
|
|
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
|
|
|
|
|
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -4034,19 +4036,27 @@ public class HeroLogic{
|
|
|
|
|
LOGGER.info("addHongmengTableHero uid=>{} the heroId=>{} is Resonances", user.getId(), heroId);
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, String> resonances = heroManager.getHongmengGuards();
|
|
|
|
|
String resonanceInfo = resonances.get(index);
|
|
|
|
|
if (resonanceInfo != null && !resonanceInfo.isEmpty()) {
|
|
|
|
|
Map<Integer, String> guards = heroManager.getHongmengGuards();
|
|
|
|
|
String guardsInfo = guards.get(index);
|
|
|
|
|
if (guardsInfo != null && !guardsInfo.isEmpty()) {
|
|
|
|
|
LOGGER.info("addHongmengTableHero uid=>{} not hero key=>{}", user.getId(), index);
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Long> resonancesTime = heroManager.getHongmengGuardTime();
|
|
|
|
|
if (resonancesTime.get(index) != null && resonancesTime.get(index) > TimeUtils.now()/1000) {
|
|
|
|
|
LOGGER.info("addHongmengTableHero uid=>{} time =>{}", user.getId(), resonancesTime.get(index));
|
|
|
|
|
Map<Integer, Long> guardsTime = heroManager.getHongmengGuardTime();
|
|
|
|
|
if (guardsTime.get(index) != null && guardsTime.get(index) > TimeUtils.now()/1000) {
|
|
|
|
|
LOGGER.info("addHongmengTableHero uid=>{} time =>{}", user.getId(), guardsTime.get(index));
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
// 添加鸿蒙碑
|
|
|
|
|
heroManager.updateHongmengGuards(index, heroId);
|
|
|
|
|
|
|
|
|
|
// 战力改变
|
|
|
|
|
if(isInTeam(user,heroId,1)){
|
|
|
|
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addOrUpdateHongmeng(session);
|
|
|
|
|
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -4065,8 +4075,8 @@ public class HeroLogic{
|
|
|
|
|
LOGGER.info("unLoadHongmengTableHero uid=>{} HongmengTablet==0", user.getId());
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, String> resonances = heroManager.getHongmengGuards();
|
|
|
|
|
String heroId = resonances.get(index);
|
|
|
|
|
Map<Integer, String> guards = heroManager.getHongmengGuards();
|
|
|
|
|
String heroId = guards.get(index);
|
|
|
|
|
if (heroId == null || heroId.isEmpty()) {
|
|
|
|
|
LOGGER.info("unLoadHongmengTableHero uid=>{} no hero=>{}", user.getId(), index);
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
|
|
|
|
@ -4082,6 +4092,14 @@ public class HeroLogic{
|
|
|
|
|
.newBuilder()
|
|
|
|
|
.setLeftTime(SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_LATTICE_WAIT_TIME))
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
// 战力改变
|
|
|
|
|
if(isInTeam(user,heroId,1)){
|
|
|
|
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addOrUpdateHongmeng(session);
|
|
|
|
|
|
|
|
|
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), resonanceResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|