鸿蒙阵1.0,存在bug正在修改

back_recharge
duhui 2020-12-25 14:21:57 +08:00
parent 58cb744e2e
commit e3391faa6e
20 changed files with 420 additions and 44 deletions

View File

@ -157,6 +157,7 @@ public enum ErrorCode implements IErrorCode {
USER_LEVE_DOWN(127,"玩家等级不够"),
HAS_AWAKE(130,"已达最大星级"),
BAG_FULL(135,"背包内存储空间不足,无法领取附件"),
HONGMENG_ING(136,"英雄在鸿蒙阵中,操作失败"),
SERVER_DEFINE_SELF(20000,"操作失败")
;

View File

@ -1,11 +1,17 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
/**
*
*/
@Component
public class HeroReturnHandler extends BaseHandler<HeroInfoProto.HeroReturnRequest>{
@Override
@ -15,6 +21,11 @@ public class HeroReturnHandler extends BaseHandler<HeroInfoProto.HeroReturnReque
@Override
public void processWithProto(ISession iSession, HeroInfoProto.HeroReturnRequest proto) throws Exception {
// 验证是否可以使用功能,神将归元
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.HERO_BACK_TO_BEGIN.getPropertyId(), proto.getHeroId());
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
HeroLogic.getInstance().heroBack(iSession,proto.getHeroId());
}
}

View File

@ -1,12 +1,17 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@Component
public class UpHeroLevelHandler extends BaseHandler {
@Override
@ -19,6 +24,11 @@ public class UpHeroLevelHandler extends BaseHandler {
byte[] bytes = netData.parseClientProtoNetData();
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);
}
int targetLevel = upHeroLevelRequest.getTargetLevel();
HeroLogic.getInstance().upHeroLevel(iSession,heroId,targetLevel);
}

View File

@ -1,6 +1,9 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
@ -28,8 +31,28 @@ public class UpHeroStarHandler extends BaseHandler<HeroInfoProto.UpHeroStarReque
List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList = upHeroStarRequest.getConsumeMaterialsList();
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);
}
// 验证是否可以使用功能,被吞噬
for (int i = 0; i < consumeMaterialsList.size(); i++) {
List<String> heroIdsList = consumeMaterialsList.get(i).getHeroIdsList();
String[] heroIds = new String[heroIdsList.size()];
heroIdsList.toArray(heroIds);
useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.PASSIVE_EAT.getPropertyId(), heroIds);
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
}
HeroLogic.getInstance().upHeroStar(iSession,heroId,consumeMaterialsList);
}else{
// 验证是否可以使用功能,法宝强化
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.MIRACLE_WEAPON_INTENSIFY.getPropertyId(), heroId);
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
ItemLogic.getInstance().especialEquipUpStar(iSession,heroId);
}
}

View File

@ -2,6 +2,8 @@ package com.ljsd.jieling.handler;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
@ -12,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
@Component
@ -38,6 +41,13 @@ public class UseAndPriceItemHandler extends BaseHandler<PlayerInfoProto.UseAndPr
} else if (type == 2){ //分解装备
ItemLogic.getInstance().decomposeEquip(iSession,equipIdsList);
} else if(type==3){
// 验证是否可以使用功能,恭送神将
String[] heroIds = new String[heroIdsList.size()];
heroIdsList.toArray(heroIds);
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.FAREWELL_HERO.getPropertyId(), heroIds);
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
CommonProto.Drop.Builder baseBuilder =ItemLogic.getInstance().decomposeHero(iSession,heroIdsList,null, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE);
ItemLogic.sendUseAndPriceItemMessage(iSession, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE, baseBuilder);
}else if(type==4){//分解宝器

View File

@ -1,12 +1,17 @@
package com.ljsd.jieling.handler.equip;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author lvxinran
* @date 2020/8/5
@ -21,6 +26,15 @@ public class EspecialEquipBackHandler extends BaseHandler<HeroInfoProto.Especial
@Override
public void processWithProto(ISession iSession, HeroInfoProto.EspecialEquipBackRequest proto) throws Exception {
HeroLogic.getInstance().especialEquipBack(iSession,proto.getHeroIdLsitList());
List<String> heroIdList = proto.getHeroIdLsitList();
// 验证是否可以使用功能,法宝归元
String[] heroIds = new String[heroIdList.size()];
heroIdList.toArray(heroIds);
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.MIRACLE_WEAPON_BACK_TO_BEGIN.getPropertyId(), heroIds);
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
HeroLogic.getInstance().especialEquipBack(iSession,heroIdList);
}
}

View File

@ -5,12 +5,15 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
import com.ljsd.jieling.logic.dao.UserManager;
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.player.PlayerLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
@ -28,7 +31,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
/**
* Description: des
* Description:
* Author: zsx
* CreateDate: 2020/8/10 10:51
*/
@ -56,6 +59,11 @@ public class SaveHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.Save
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
// 验证是否可以使用功能,神将置换
boolean useFunction = HeroLogic.getInstance().isUseFunction(uid, HongMengFunctionEnum.HERO_REPLACE.getPropertyId(), hero.getId());
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
//check in team
int[] teamId = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HERO_RESOLVE_LICENCE);
@ -112,6 +120,13 @@ public class SaveHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.Save
}
// hero.getTemplateId();
hero.setChangeId(result);
ISession session = OnlineUserManager.getSessionByUid(uid);
if (session != null){
//鸿蒙阵
HeroLogic.getInstance().addOrUpdateHongmeng(session);
}
return HeroInfoProto.SaveHeroChangeResponse.newBuilder().setHeroTempId(result).build();
}

View File

@ -167,9 +167,15 @@ public class Hero extends MongoBase {
return heroManager.getHongmengTablet();
}
if (heroManager.getResonances().values().contains(id)) {
// 模板,取装备
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
if (hongMengAddAttribute != null) {
return hongMengAddAttribute.value;
SCHero scHero = SCHero.getsCHero().get(templateId);
SCHeroRankUpConfig config = STableManager.getConfig(SCHeroRankUpConfig.class).get(scHero.getMaxRank());
// 是否达到限制等级
return hongMengAddAttribute.value >= config.getOpenLevel() ? config.getOpenLevel():hongMengAddAttribute.value;
}
}
return level;
@ -191,6 +197,25 @@ public class Hero extends MongoBase {
return equipByPositionMap==null?new HashMap<>():equipByPositionMap;
}
public Map<Integer, Integer> getEquipByHongmengPositionMap(HeroManager heroManager) {
if (!equipByPositionMap.isEmpty()){
return equipByPositionMap;
}
// 英雄在共鸣池中
if (heroManager.getResonances().values().contains(id)) {
// 模板,取装备
HongMengAddAttribute hongMengByEquip = heroManager.getResonanceAddition().get(HongMengAttributeEnum.EQUIP);
if (hongMengByEquip != null && hongMengByEquip.value != -1) {
Map<Integer, Integer> hongmengEquip = new HashMap<>(4);
for (int i = 0; i < 4; i++) {
hongmengEquip.put(i+1,hongMengByEquip.value);
}
return hongmengEquip;
}
}
return equipByPositionMap;
}
public void setEquipByPositionMap(Map<Integer, Integer> equipByPositionMap) throws Exception {
updateString("equipByPositionMap",equipByPositionMap);
this.equipByPositionMap = equipByPositionMap;
@ -293,6 +318,19 @@ public class Hero extends MongoBase {
return especialEquipLevel;
}
public int getEspecialEquipLevelByHongmeng(HeroManager heroManager,String heroId) {
// 英雄在共鳴池中
if (heroManager.getResonances().values().contains(heroId)) {
// 法宝
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.MAGIC_WEAPON);
if (hongMengAddAttribute != null){
// 对比本身和共鸣等级,选高的
return especialEquipLevel >= hongMengAddAttribute.value?especialEquipLevel:hongMengAddAttribute.value;
}
}
return especialEquipLevel;
}
public Set<String> getJewelInfo() {
return jewelInfo;
}

View File

@ -43,7 +43,7 @@ public class HeroManager extends MongoBase {
private Map<HongMengAttributeEnum, HongMengAddAttribute> resonanceAddition = new HashMap<>();
// 鸿蒙碑等级
private int hongmengTablet;
// 鸿蒙碑最大等级
// 鸿蒙碑最大等级,添加限制,
private Set<Integer> hongmengMaxLevel = new HashSet<>();
public void updateRandCount(int type,int count){

View File

@ -1,7 +1,13 @@
package com.ljsd.jieling.logic.dao;
public class HongMengAddAttribute {
/**
*
*/
public int heroTid;
/**
*
*/
public int value;
public HongMengAddAttribute(int heroTid, int value) {

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.UUIDEnum;
import config.SJewelConfig;
@ -22,7 +23,6 @@ public class Jewel extends PropertyItem {
}
public Jewel(int uid,int jewelId){
this.setRootCollection(User._COLLECTION_NAME);
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.JEWEL, uid));
@ -46,4 +46,29 @@ public class Jewel extends PropertyItem {
public void setJewelType(int jewelType) {
this.jewelType = jewelType;
}
public int getLevelByHongMeng(HeroManager heroManager,String heroId) {
// 英雄在共鳴池中
if (heroManager.getResonances().values().contains(heroId)) {
// 1:魂宝2灵宝
HongMengAddAttribute hongMengAddAttribute = null;
if (jewelType == 1){
hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.SOUL_EQUIP);
}else if (jewelType == 2){
hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.SPIRIT_EQUIP);
}
// 读配置表
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(getEquipId());
// 0最大等级1最大精炼等级
int[] max = config.getMax();
if (hongMengAddAttribute != null){
// 比较当前等级和共鸣等级
int newLevel = getLevel() >= hongMengAddAttribute.value?getLevel():hongMengAddAttribute.value;
// 第一次结果和最大等级限制比较
newLevel = max[0] >= newLevel?newLevel:max[0];
return newLevel;
}
}
return getLevel();
}
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import java.util.Map;

View File

@ -896,7 +896,6 @@ public class HeroLogic{
}
}
//校验消耗
boolean result = ItemUtil.itemCost(user, consumeMap,BIReason.UP_HERO_LEVEL_CONSUME,hero.getTemplateId());
if(!result){
@ -920,9 +919,13 @@ public class HeroLogic{
if(isInTeam(user,heroId,1)){
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
}
// 鸿蒙阵
addOrUpdateHongmeng(session);
HeroInfoProto.UpHeroLevelResponse build = HeroInfoProto.UpHeroLevelResponse.newBuilder().setHeroId(heroId).setTargetLevel(hero.getLevel(user.getHeroManager())).build();
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,build,true);
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,build);
}
/**
@ -1080,6 +1083,10 @@ public class HeroLogic{
heroManager.setHongmengMaxLevel(hongmengMaxLevel);
}
}
//鸿蒙阵
addOrUpdateHongmeng(session);
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);
// 觉醒飘字
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
@ -1552,7 +1559,7 @@ public class HeroLogic{
//装备总战力评分
int equipForce=0;
boolean needRemove = false;
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
while (iterator.hasNext()){
Map.Entry<Integer, Integer> next = iterator.next();
@ -1581,7 +1588,7 @@ public class HeroLogic{
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
for(Hero heroTmp : heroMap.values()){
Iterator<Map.Entry<Integer, Integer>> iterator1 = heroTmp.getEquipByPositionMap().entrySet().iterator();
Iterator<Map.Entry<Integer, Integer>> iterator1 = heroTmp.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
boolean isUpate = false;
while (iterator1.hasNext()){
Map.Entry<Integer, Integer> next = iterator1.next();
@ -1593,7 +1600,7 @@ public class HeroLogic{
}
}
if(isUpate){
heroTmp.setEquipByPositionMap(heroTmp.getEquipByPositionMap());
heroTmp.setEquipByPositionMap(heroTmp.getEquipByHongmengPositionMap(user.getHeroManager()));
}
}
});
@ -1616,11 +1623,11 @@ public class HeroLogic{
}
//法宝加成
int heroStar = hero.getStar();
if(scHero.getEquipTalismana()!=null&&scHero.getEquipTalismana().length>0&&heroStar>=scHero.getEquipTalismana()[0]){//判断是否解锁法宝
//判断是否解锁法宝
if(scHero.getEquipTalismana()!=null&&scHero.getEquipTalismana().length>0&&heroStar>=scHero.getEquipTalismana()[0]){
int equipTempId = scHero.getEquipTalismana()[1];
int tempStar = hero.getEspecialEquipLevel();
int tempStar = hero.getEspecialEquipLevelByHongmeng(user.getHeroManager(),hero.getId());
Map<Integer, Map<Integer, SEquipTalismana>> equipTalismanaMap = SEquipTalismana.equipTalismanaStarMap;
SEquipTalismana equipTali = equipTalismanaMap.get(equipTempId).get(tempStar);
@ -1636,19 +1643,19 @@ public class HeroLogic{
for (String jewel: jewelInfo) {
PropertyItem propertyItem = equipMap.get(jewel);
if(propertyItem==null)
if (propertyItem==null) {
continue;
}
Jewel j = (Jewel)propertyItem;
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(j.getEquipId());
Map<Integer, Map<Integer, SJewelRankupConfig>> rankPoolMap = SJewelRankupConfig.rankupMap.get(config.getRankupPool());
Map<Integer, Map<Integer, SJewelRankupConfig>> levelPoolMap = SJewelRankupConfig.rankupMap.get(config.getLevelupPool());
if(flashing){
if(minLevel==-1){
minLevel = j.getLevel();
minLevel = j.getLevelByHongMeng(user.getHeroManager(),hero.getId());
}else{
minLevel = Math.min(j.getLevel(),minLevel);
minLevel = Math.min(j.getLevelByHongMeng(user.getHeroManager(),hero.getId()),minLevel);
}
if(minBuildLevel==-1){
minBuildLevel = j.getBuildLevel();
@ -1658,7 +1665,7 @@ public class HeroLogic{
}
int[][] property;
if(levelPoolMap!=null){
property = levelPoolMap.get(1).get(j.getLevel()).getProperty();
property = levelPoolMap.get(1).get(j.getLevelByHongMeng(user.getHeroManager(),hero.getId())).getProperty();
combinedAttribute(property,heroAllAttribute);
}
if(rankPoolMap!=null){
@ -2074,10 +2081,12 @@ public class HeroLogic{
if(isInTeam(user,heroId,1)){
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(uid));
}
// 鸿蒙阵,穿装备
addOrUpdateHongmeng(session);
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,null,true);
}
private void wearJewel(Hero hero,EquipManager equipManager,String equipId)throws Exception{
@ -2113,9 +2122,14 @@ public class HeroLogic{
}
/**
*
* @param session
* @param heroId
* @param equipIds
* @param type
* @throws Exception
*/
public void unloadEquipOpt(ISession session,String heroId,List<String> equipIds,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
@ -2163,6 +2177,10 @@ public class HeroLogic{
if(isInTeam(user,heroId,1)){
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(uid));
}
// 鸿蒙阵,脱装备
addOrUpdateHongmeng(session);
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,null,true);
}
@ -2544,6 +2562,12 @@ public class HeroLogic{
}
}
/**
*
* @param session
* @param heroId
* @throws Exception
*/
public void heroBack(ISession session,String heroId) throws Exception {
int returnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_RETURN_PERCENT);
int uid = session.getUid();
@ -2589,9 +2613,12 @@ public class HeroLogic{
ReportUtil.onReportEvent(user,ReportEventEnum.HERO_COMPOSITION.getType(),String.valueOf(hero.getTemplateId()),hero.getLevel(user.getHeroManager()),hero.getStar(),itemId,itemNum);
hero.setLevel(user,1);
hero.setBreakId(0);
//鸿蒙阵
addOrUpdateHongmeng(session);
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1,responseMsgId,build,true);
}
/**
@ -2617,10 +2644,12 @@ public class HeroLogic{
hero.updateEspecial(1);
}
// 鸿蒙阵
addOrUpdateHongmeng(session);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, ItemUtil.mapToArray(dropMap), BIReason.ESPECIAL_BACK);
HeroInfoProto.EspecialEquipBackResponse response = HeroInfoProto.EspecialEquipBackResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.ESPECIAL_EQUIP_BACK_RESPONSE_VALUE,response,true);
}
/**
@ -2809,8 +2838,6 @@ public class HeroLogic{
});
}
}
public static void mergeSoul(ISession session, int targetId, List<Integer> soulIdList) throws Exception {
@ -3423,7 +3450,7 @@ public class HeroLogic{
HeroManager heroManager = user.getHeroManager();
// 组装鸿蒙守卫或者鸿蒙使者信息
// 刷新鸿蒙阵
addOrUpdateHongmeng(user);
addOrUpdateHongmeng(session);
// 组装鸿蒙阵信息
List<HeroInfoProto.HongmengHeroInfo> hongmengHeroInfos = new ArrayList<>();
Map<Integer, String> resonances = heroManager.getResonances();
@ -3471,9 +3498,11 @@ public class HeroLogic{
/**
* 鸿
* @param user
* @param session
*/
public void addOrUpdateHongmeng(User user) throws Exception {
public void addOrUpdateHongmeng(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
if (user.getPlayerInfoManager().getLevel() < SSpecialConfig.getIntegerValue(SSpecialConfig.HONGMENG_OPENLEVEL)) {
return;
}
@ -3496,7 +3525,7 @@ public class HeroLogic{
});
Map<Integer, String> hongmengs = new HashMap<>();
int defaultValue = 1000;
// 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 1:不卸下装备
// 只要任意鸿蒙守卫中有未穿戴装备的部位,就不会触发装备共鸣,共鸣区域放入神将时不再自动卸下装备 -1:不卸下装备,其他表示装备星级
HongMengAddAttribute hongMengAddAttributeEquip = new HongMengAddAttribute(0, defaultValue);
// 只要任意鸿蒙守卫未穿戴魂宝/灵宝或强化等级为0便不会触发对应宝物的共鸣
HongMengAddAttribute soulEquip = new HongMengAddAttribute(0, defaultValue);
@ -3537,9 +3566,9 @@ public class HeroLogic{
}
}
// 不够6个无法开启鸿蒙阵
if (hongmengs.size() < Integer.parseInt(openLevel[0])) {
/*if (hongmengs.size() < Integer.parseInt(openLevel[0])) {
return;
}
}*/
heroManager.setHongmengGuards(hongmengs);
// 第一个格子免费开启
Map<Integer, String> resonances = heroManager.getResonances();
@ -3571,7 +3600,7 @@ 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]));
@ -3609,7 +3638,8 @@ public class HeroLogic{
.addAllHongmengGuards(hongmengGuardsProto)
.addAllHongmengAdditions(hongmengAdditions)
.build();
MessageUtil.sendIndicationMessage(user.getId(), hongmengInfoIndication);
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.HONGMENG_INFO_INDICATION.getNumber(),hongmengInfoIndication,true);
}
/**
@ -3681,11 +3711,11 @@ public class HeroLogic{
* @param hero
*/
public void hongmengEquip(HongMengAddAttribute hongMengAddAttributeEquip, Hero hero) {
if (hero.getEquipByPositionMap().size() != 4) {
// 现在装备默认只有4条
if (hero.getEquipByPositionMap().size() < 4) {
hongMengAddAttributeEquip.value = -1;
hongMengAddAttributeEquip.heroTid = 0;
}
if (hongMengAddAttributeEquip.value > 0) {
}else if (hongMengAddAttributeEquip.value > 0) {
for (Integer value : hero.getEquipByPositionMap().values()) {
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(value);
if (sEquipConfig == null) {
@ -3731,7 +3761,7 @@ public class HeroLogic{
boolean checkCost2 = ItemUtil.checkCost(user, cost2);
if (!checkCost2) {
LOGGER.info("openResonance uid=>{} cost item not enough=>{}", user.getId(), graidId);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
ItemUtil.itemCost(user, cost2, BIReason.OPEN_HONGMENG_GRAID, graidId);
}
@ -3774,7 +3804,7 @@ public class HeroLogic{
// 添加到共鸣区
heroManager.updateResonances(index, heroId);
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.EQUIP);
if (hongMengAddAttribute.value == -1) {
if (hongMengAddAttribute.value != -1) {
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
equipByPositionMap.clear();
hero.setEquipByPositionMap(equipByPositionMap);
@ -3837,14 +3867,14 @@ public class HeroLogic{
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
}
String[] stringValue = SSpecialConfig.getStringValue(SSpecialConfig.HONGMENG_LATTICE_PRICE).split("#");
long time = unloadTime - TimeUtils.now();
int count = (int) (time / 1000 * Integer.parseInt(stringValue[0]));
long time = (unloadTime - TimeUtils.now())/1000;
int count = (int) (time / Integer.parseInt(stringValue[0]) *Integer.parseInt(stringValue[2]) );
Map<Integer, Integer> cost = new HashMap<>(1);
cost.put(Integer.parseInt(stringValue[1]), count);
boolean checkCost = ItemUtil.checkCost(user, cost);
if (!checkCost) {
LOGGER.info("cleanTime uid=>{} item not enough =>{}", user.getId(), unloadTime);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
ItemUtil.itemCost(user, cost, BIReason.CLEAR_HONGMENG_GRAID, index);
heroManager.updateResonancesTime(index, 0L);
@ -3995,5 +4025,44 @@ public class HeroLogic{
MessageUtil.sendMessage(session, 1, messageType.getNumber(), resonanceResponse);
}
/**
* 使
* 1|2|3|4|5|6|7|8|9
* ||||||||
* @param uid
* @param heroId
* @param functionId
* @return
* @throws Exception
*/
public boolean isUseFunction(int uid,int functionId,String... heroId) throws Exception {
User user = UserManager.getUser(uid);
HeroManager heroManager = user.getHeroManager();
for (int i = 0; i < heroId.length; i++) {
int[] value = null;
// 鸿蒙守卫
if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().values().contains(heroId[i])){
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_GUARD_LIMIT);
}
// 鸿蒙使者
if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().values().contains(heroId[i])){
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_MESSENGER_LIMIT);
}
// 共鸣神将
if (heroManager.getResonances().values().contains(heroId[i])){
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_TAKE_LIMIT);
}
if (value == null){
return true;
}
// 包含类型返回false
for (int j = 0; j < value.length; j++) {
if (value[j] == functionId){
return true;
}
}
}
return false;
}
}

View File

@ -0,0 +1,62 @@
package com.ljsd.jieling.logic.hero;
/**
* 鸿
* @author hj
*/
public enum HongMengFunctionEnum {
/**
*
*/
UPGRADE_BREAKTHROUGH(1,"升级突破"),
/**
*
*/
UP_START_AWAKEN(2,"升星觉醒"),
/**
*
*/
HERO_BACK_TO_BEGIN(3,"神将归元"),
/**
*
*/
FAREWELL_HERO(4,"恭送神将"),
/**
*
*/
PASSIVE_EAT(5,"被吞噬"),
/**
*
*/
MIRACLE_WEAPON_INTENSIFY(6,"法宝强化"),
/**
*
*/
MIRACLE_WEAPON_BACK_TO_BEGIN(7,"法宝归元"),
/**
*
*/
INTENSIFY_JEWEL(8,"强化宝物"),
/**
*
*/
HERO_REPLACE(9,"神将置换"),
;
private int propertyId;
private String value;
HongMengFunctionEnum(int propertyId,String value) {
this.propertyId = propertyId;
this.value = value;
}
public int getPropertyId() {
return propertyId;
}
public String getValue() {
return value;
}
}

View File

@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
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.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -542,6 +543,10 @@ public class ItemLogic {
if(reson== BIReason.DECOMPOS_HERO_REWARD){
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_HERO.getType(),heroIdReport,heroLevelReport,heroStarReport,new ArrayList<>(baseItemMap.keySet()),new ArrayList<>(baseItemMap.values()));
}
//鸿蒙阵
HeroLogic.getInstance().addOrUpdateHongmeng(iSession);
return ItemUtil.drop(user,itemReturnPercent(itemArray,rankUpReturnPercent),reson);
}
@ -708,6 +713,10 @@ public class ItemLogic {
if (HeroLogic.getInstance().isInTeam(user, heroId, 1)) {
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
}
//鸿蒙阵
HeroLogic.getInstance().addOrUpdateHongmeng(session);
} else {
throw new ErrorCodeException(ErrorCode.ITEM_ESPECIAL_EQUIP_UP_ITEM_NOT);
}
@ -792,6 +801,12 @@ public class ItemLogic {
int level;
int poolType;
if(type==1){//强化
// 验证是否可以使用功能,宝物强化
boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.INTENSIFY_JEWEL.getPropertyId(), propertyItem.getHeroId());
if (!useFunction){
throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
}
if(jewel.getLevel()>=config.getMax()[0]){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
@ -859,6 +874,10 @@ public class ItemLogic {
if(HeroLogic.getInstance().isInTeam(user,jewel.getHeroId(),1)){
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(user.getId()));
}
//鸿蒙阵
HeroLogic.getInstance().addOrUpdateHongmeng(iSession);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.JEWEL_BUILD_RESPONSE_VALUE,null,true);
}

View File

@ -693,7 +693,7 @@ public class PlayerLogic {
for(String equipId : hero.getJewelInfo()){
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
}
for(int equipId : hero.getEquipByPositionMap().values()){
for(int equipId : hero.getEquipByHongmengPositionMap(userInMem.getHeroManager()).values()){
builder.addEquip(CBean2Proto.getEquipProto(equipId));
}
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));

View File

@ -27,6 +27,7 @@ import com.ljsd.jieling.logic.activity.event.UseItemEvent;
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
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.item.ItemLog;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
@ -1253,6 +1254,8 @@ public class ItemUtil {
int[] heroStar = SItem.getsItemMap().get(cardId).getHeroStar();
Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]);
heroManager.addHero(hero);
// 鸿蒙阵推送
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
heroList.add(CBean2Proto.getHero(hero));
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级

View File

@ -24,6 +24,9 @@ public class SJewelConfig implements BaseConfig {
private int[][] rankupResources;
private int godHoodPool;
private int godHoodMaxlv;
@Override
public void init() throws Exception {
@ -67,5 +70,12 @@ public class SJewelConfig implements BaseConfig {
return rankupResources;
}
public int getGodHoodPool() {
return godHoodPool;
}
public int getGodHoodMaxlv() {
return godHoodMaxlv;
}
}

View File

@ -0,0 +1,55 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.Map;
@Table(name ="LevelSetting")
public class SLevelSetting implements BaseConfig {
private int id;
private String name;
private float[] simpleLevel;
private float[] normalLevel;
private float[] difficultyLevel;
private float[][] openChallenge;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public float[] getSimpleLevel() {
return simpleLevel;
}
public float[] getNormalLevel() {
return normalLevel;
}
public float[] getDifficultyLevel() {
return difficultyLevel;
}
public float[][] getOpenChallenge() {
return openChallenge;
}
}

View File

@ -75,6 +75,10 @@ public class SSpecialConfig implements BaseConfig {
public static final String HONGMENG_UPGRADE_LIMIT = "Hongmeng_upgrade_limit";//鸿蒙阵升级开启限制
public static final String HONGMENG_ONEHERO_OPENLEVEL = "Hongmeng_Onehero_OpenLevel";//鸿蒙阵每个觉醒神将提升的等级
public static final String HONGMENG_GUARD_LIMIT = "Hongmeng_Guard_limit";//鸿蒙守卫|升级|突破|升星|觉醒|神将归元|恭送神将|被吞噬|法宝强化|法宝归元|强化宝物|神将置换
public static final String HONGMENG_TAKE_LIMIT = "Hongmeng_Take_limit";//共鸣神将|升级|突破|升星|觉醒|神将归元|恭送神将|被吞噬|法宝强化|法宝归元|强化宝物|神将置换
public static final String HONGMENG_MESSENGER_LIMIT = "Hongmeng_Messenger_limit";//鸿蒙使者|升级|突破|升星|觉醒|神将归元|恭送神将|被吞噬|法宝强化|法宝归元|强化宝物|神将置换
public static final String REPLACE_ITEM_ID = "replace_item_id";//置换玉道具ID
public static final String REPLACE_COST = "replace_cost";//置换玉消耗