master_dev
parent
a138ec1b4c
commit
c4f1d8b620
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.assist;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.AssistLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 获取助阵信息
|
||||
*/
|
||||
@Component
|
||||
public class AssistInfoHandler extends BaseHandler<HeroInfoProto.AssistInfoRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.AssistInfoRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.AssistInfoRequest proto) throws Exception {
|
||||
AssistLogic.getInstance().assistInfo(iSession);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.assist;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.AssistLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 助阵上阵,下阵
|
||||
*/
|
||||
@Component
|
||||
public class AssistUpDownHandler extends BaseHandler<HeroInfoProto.AssistUpDownRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.AssistUpDownRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.AssistUpDownRequest proto) throws Exception {
|
||||
AssistLogic.getInstance().assistUpDown(iSession, proto);
|
||||
}
|
||||
}
|
|
@ -6,14 +6,10 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 设置我的助战
|
||||
|
@ -32,7 +28,9 @@ public class SetHelpHeroHandler extends BaseHandler<PlayerInfoProto.SetHelpHeroR
|
|||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
CommonProto.Drop drop = HelpHeroLogic.getInstance().addHelpFightList(user, proto.getHeroId());
|
||||
return PlayerInfoProto.SetHelpHeroResponse.newBuilder().setDrop(drop).build();
|
||||
PlayerInfoProto.SetHelpHeroResponse.Builder builder = PlayerInfoProto.SetHelpHeroResponse.newBuilder();
|
||||
// CommonProto.Drop drop = HelpHeroLogic.getInstance().addHelpFightList(user, proto.getHeroId());
|
||||
// builder.setDrop(drop);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@ package com.ljsd.jieling.handler.hero;
|
|||
import com.google.protobuf.GeneratedMessage;
|
||||
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.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.AssistLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SCHero;
|
||||
import config.SItem;
|
||||
import config.SSpecialConfig;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import config.SCHero;
|
||||
import config.SSpecialConfig;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Description: 神将置换
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/8/10 10:51
|
||||
*/
|
||||
|
@ -60,9 +60,8 @@ public class DoHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.DoHer
|
|||
if (!battleArray){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_DECOMPOSE_HERO_TEAM);
|
||||
}
|
||||
|
||||
user.getHeroManager().removeHero(uid,hero.getId());
|
||||
|
||||
AssistLogic.getInstance().refreshAssistBoxForRemoveHero(user, hero.getId());
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
//random tempid
|
||||
Hero newHero = new Hero(uid,hero.getChangeId(),hero.getOriginalLevel(),hero);
|
||||
|
|
|
@ -27,7 +27,6 @@ import com.ljsd.jieling.logic.family.GuildFightLogic;
|
|||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.logic.friend.FriendLogic;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.home.ArchitectureUnLockHandler;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
|
@ -435,7 +434,7 @@ public class GlobalDataManaager implements IManager {
|
|||
// 四灵试炼,计算每天次数
|
||||
FourChallengeLogic.getInstance().addFourChallengeNum(user,user.getPlayerInfoManager().getLoginTime());
|
||||
// 助战清理
|
||||
HelpHeroLogic.getInstance().clearHelpInfo(user);
|
||||
// HelpHeroLogic.getInstance().clearHelpInfo(user);
|
||||
// 七界推送
|
||||
SevenWorldLogic.getInstance().sevenWorldInfoIndication(session);
|
||||
// 御剑行
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
public class AssistBox {
|
||||
private int id;
|
||||
private int state;
|
||||
private String heroId;
|
||||
|
||||
public AssistBox(){}
|
||||
|
||||
public AssistBox(int id){
|
||||
this.id = id;
|
||||
this.state = 0;
|
||||
this.heroId = "";
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getHeroId() {
|
||||
return heroId;
|
||||
}
|
||||
|
||||
public void setHeroId(String heroId) {
|
||||
this.heroId = heroId;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.ljsd.jieling.logic.dao;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import config.SItem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -16,6 +15,8 @@ public class EquipManager extends MongoBase {
|
|||
|
||||
private Map<String,PropertyItem> equipMap = new HashMap<>();// 属性装备列表
|
||||
private Set<Integer> equipBookEnabled = new HashSet<>();// 装备图鉴
|
||||
private Set<Integer> baublesBookList = new HashSet<>();// 全部法宝图鉴
|
||||
private Set<Integer> baublesBookEnabled = new HashSet<>();// 法宝激活图鉴
|
||||
private Set<Integer> soulGealList = new HashSet<>();// 魂印列表
|
||||
private Map<Integer, GemNew> gemNewMap = new HashMap<>();// 潜能列表
|
||||
private int soulEquipPool;//占星装备卡池
|
||||
|
@ -193,4 +194,32 @@ public class EquipManager extends MongoBase {
|
|||
public Map<Integer, GemNew> getGemNewMap() {
|
||||
return gemNewMap;
|
||||
}
|
||||
|
||||
public Set<Integer> getBaublesBookEnabled() {
|
||||
return baublesBookEnabled;
|
||||
}
|
||||
|
||||
public void setBaublesBookEnabled(Set<Integer> baublesBookEnabled) {
|
||||
this.baublesBookEnabled = baublesBookEnabled;
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
|
||||
public void addBaublesBookEnabled(int bookId){
|
||||
this.baublesBookEnabled.add(bookId);
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
|
||||
public Set<Integer> getBaublesBookList() {
|
||||
return baublesBookList;
|
||||
}
|
||||
|
||||
public void setBaublesBookList(Set<Integer> baublesBookList) {
|
||||
this.baublesBookList = baublesBookList;
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
|
||||
public void addBaublesBookList(int id) {
|
||||
this.baublesBookList.add(id);
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import config.SLikeAbilityConfig;
|
|||
import config.SSpecialConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -128,6 +129,8 @@ public class HeroManager extends MongoBase {
|
|||
private Map<Integer,Map<Integer,Integer>> LifeGridMap = new HashMap<>();//命格数据
|
||||
private Map<Integer,TransformationInfo> transformationList = new HashMap<>();//变身卡列表
|
||||
|
||||
private Map<Integer, AssistBox> assistBoxMap = new HashMap<>();//助阵盒子
|
||||
|
||||
public Map<Integer, SixiangProfessionInfo> getSixiangDataMap() {
|
||||
return sixiangDataMap;
|
||||
}
|
||||
|
@ -664,5 +667,47 @@ public class HeroManager extends MongoBase {
|
|||
this.xiuweiLevel = xiuweiLevel;
|
||||
updateString("xiuweiLevel", xiuweiLevel);
|
||||
}
|
||||
|
||||
public Map<Integer, AssistBox> getAssistBoxMap() {
|
||||
return assistBoxMap;
|
||||
}
|
||||
|
||||
public void setAssistBoxMap(Map<Integer, AssistBox> assistBoxMap) {
|
||||
this.assistBoxMap = assistBoxMap;
|
||||
updateString("assistBoxMap", assistBoxMap);
|
||||
}
|
||||
|
||||
public void putAssistBox(AssistBox box) {
|
||||
this.assistBoxMap.put(box.getId(), box);
|
||||
updateString("assistBoxMap", assistBoxMap);
|
||||
}
|
||||
|
||||
public AssistBox getAssistBox(int id) {
|
||||
AssistBox box = assistBoxMap.get(id);
|
||||
if (box == null){
|
||||
box = new AssistBox(id);
|
||||
}
|
||||
return box;
|
||||
}
|
||||
|
||||
public List<Integer> getOpenAssistBoxIds() {
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
for (AssistBox value : assistBoxMap.values()) {
|
||||
if (value.getState() == 1){
|
||||
list.add(value.getId());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getAssistHeroIds() {
|
||||
HashMap<String, Integer> map = new HashMap<>();
|
||||
for (AssistBox value : assistBoxMap.values()) {
|
||||
if (!StringUtil.isEmpty(value.getHeroId())){
|
||||
map.put(value.getHeroId(),value.getId());
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@ public class ItemManager extends MongoBase {
|
|||
updateString("equipBookEnabled", equipBookEnabled);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ItemManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
package com.ljsd.jieling.logic.hero;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.exception.ErrorTableException;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.AssistBox;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SAssistanceConfig;
|
||||
import config.SCHero;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AssistLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AssistLogic.class);
|
||||
|
||||
private static class Instance {
|
||||
public final static AssistLogic instance = new AssistLogic();
|
||||
}
|
||||
|
||||
public static AssistLogic getInstance() {
|
||||
return AssistLogic.Instance.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取助阵信息
|
||||
* @param iSession 用户
|
||||
* @throws Exception error
|
||||
*/
|
||||
public void assistInfo(ISession iSession) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
refreshAssistBox(user);
|
||||
List<CommonProto.AssistBox> assistBoxes = CBean2Proto.buildAssistBox(user);
|
||||
HeroInfoProto.AssistInfoResponse.Builder builder = HeroInfoProto.AssistInfoResponse.newBuilder().addAllBoxs(assistBoxes);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.AssistInfoResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新助阵盒子
|
||||
* @param user 用户
|
||||
*/
|
||||
public void refreshAssistBox(User user){
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
long now = TimeUtils.now();
|
||||
long createTime = user.getPlayerInfoManager().getCreateTime();
|
||||
Map<Integer, SAssistanceConfig> map = SAssistanceConfig.map;
|
||||
for (SAssistanceConfig config : map.values()) {
|
||||
if (now < createTime + config.getExperience() * TimeUtils.DAY){
|
||||
break;
|
||||
}
|
||||
AssistBox assistBox = heroManager.getAssistBox(config.getId());
|
||||
assistBox.setState(1);
|
||||
heroManager.putAssistBox(assistBox);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 助阵上下
|
||||
* @param iSession 用户
|
||||
* @param proto 协议
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void assistUpDown(ISession iSession, HeroInfoProto.AssistUpDownRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int id = proto.getId();
|
||||
String heroId = proto.getHeroId();
|
||||
int operate = proto.getOperate();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
AssistBox assistBox = heroManager.getAssistBox(id);
|
||||
if (assistBox == null || assistBox.getState() == 0){
|
||||
throw new ErrorTableException(162);//格子未开启
|
||||
}
|
||||
// 穿戴
|
||||
if (operate == 1){
|
||||
if (heroManager.getAssistHeroIds().containsKey(heroId)){
|
||||
throw new ErrorTableException(163);//英雄已助阵
|
||||
}
|
||||
if (!StringUtil.isEmpty(assistBox.getHeroId())){
|
||||
throw new ErrorTableException(164);//格子有助阵
|
||||
}
|
||||
Hero hero = heroManager.getHero(heroId);
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
SCHero scHero = SCHero.getSCHero(hero.getTemplateId());
|
||||
if (scHero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
SAssistanceConfig assistanceConfig = SAssistanceConfig.map.get(id);
|
||||
if (assistanceConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
if (scHero.getPropertyName() != assistanceConfig.getProfessionLimit() || scHero.getQuality() != assistanceConfig.getQuality()){
|
||||
throw new ErrorTableException(167);//条件不满足
|
||||
}
|
||||
assistBox.setHeroId(heroId);
|
||||
}
|
||||
// 卸下
|
||||
else {
|
||||
assistBox.setHeroId("");
|
||||
}
|
||||
heroManager.putAssistBox(assistBox);
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),heroId));
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.AssistUpDownResponse_VALUE, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英雄刷新助阵
|
||||
*/
|
||||
public void refreshAssistBoxForRemoveHero(User user, List<String> heroId){
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Map<String, Integer> assistHeroIds = heroManager.getAssistHeroIds();
|
||||
for (String hero : heroId) {
|
||||
Integer boxId = assistHeroIds.get(hero);
|
||||
if (boxId == null){
|
||||
continue;
|
||||
}
|
||||
AssistBox assistBox = heroManager.getAssistBox(boxId);
|
||||
if (assistBox == null){
|
||||
continue;
|
||||
}
|
||||
assistBox.setHeroId("");
|
||||
heroManager.putAssistBox(assistBox);
|
||||
}
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
// 推送
|
||||
List<CommonProto.AssistBox> assistBoxes = CBean2Proto.buildAssistBox(user);
|
||||
HeroInfoProto.AssistInfoResponse.Builder builder = HeroInfoProto.AssistInfoResponse.newBuilder().addAllBoxs(assistBoxes);
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.AssistInfoIndication_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
public void refreshAssistBoxForRemoveHero(User user, String heroId){
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(heroId);
|
||||
refreshAssistBoxForRemoveHero(user, list);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import com.ljsd.jieling.core.FunctionIdEnum;
|
|||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.exception.ErrorTableException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
|
@ -1660,11 +1661,6 @@ public class HeroLogic {
|
|||
//改成归元获得,同时返还法宝获得
|
||||
CommonProto.Drop.Builder baseBuilder = consumeBackDrop(user, removeHeroIds);
|
||||
|
||||
// 删除英雄
|
||||
for (String rmHeroId : removeHeroIds) {
|
||||
heroManager.removeHero(uid, rmHeroId);
|
||||
}
|
||||
|
||||
// 消耗道具
|
||||
ItemUtil.itemCost(user, removeItemMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
|
||||
|
@ -2810,6 +2806,8 @@ public class HeroLogic {
|
|||
applyBaublesAndFaxiangAttribute(heroAllAttribute, hero, user);
|
||||
// 魂印和神印属性加成
|
||||
applySoulEquipAndGodSealAttribute(heroAllAttribute, hero, user);
|
||||
// 助阵
|
||||
applyAssistAttribute(heroAllAttribute, user);
|
||||
// 主角修为和修行等级属性加成
|
||||
applyXiuxingAndXiuxianAttribute(heroAllAttribute, user);
|
||||
// 公会技能和特权加成
|
||||
|
@ -3350,6 +3348,12 @@ public class HeroLogic {
|
|||
combinedAttribute(propertyMap, heroAllAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 魂印和神印等属性加成
|
||||
* @param heroAllAttribute 属性
|
||||
* @param hero 英雄
|
||||
* @param user 用户
|
||||
*/
|
||||
private void applySoulEquipAndGodSealAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user) {
|
||||
// ... 魂印和神印等属性加成 ...
|
||||
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
|
||||
|
@ -3365,6 +3369,48 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 助阵
|
||||
* @param heroAllAttribute 属性
|
||||
* @param user 用户
|
||||
*/
|
||||
private void applyAssistAttribute(Map<Integer, Long> heroAllAttribute, User user) {
|
||||
// ... 助阵 ...
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Map<Integer, AssistBox> assistBoxMap = heroManager.getAssistBoxMap();
|
||||
ArrayList<int[][]> list = new ArrayList<>();
|
||||
int totalAdd = 0;
|
||||
for (AssistBox box : assistBoxMap.values()) {
|
||||
if (box.getState() == 0 || StringUtil.isEmpty(box.getHeroId())){
|
||||
continue;
|
||||
}
|
||||
Hero hero = heroManager.getHero(box.getHeroId());
|
||||
if (hero == null){
|
||||
continue;
|
||||
}
|
||||
SCHero scHero = SCHero.getSCHero(hero.getTemplateId());
|
||||
int[][] property = SAssistanceProperty.propertymap.get(scHero.getQuality()).get(hero.getStar());
|
||||
if (property == null){
|
||||
continue;
|
||||
}
|
||||
list.add(property);
|
||||
SAssistanceConfig config = SAssistanceConfig.map.get(box.getId());
|
||||
if (config == null){
|
||||
continue;
|
||||
}
|
||||
totalAdd += config.getPropertyUp();
|
||||
}
|
||||
HashMap<Integer, Long> attribute = new HashMap<>();
|
||||
for (int[][] i : list) {
|
||||
for (int[] j : i) {
|
||||
int id = j[0];
|
||||
long num = Math.round(j[1] * totalAdd / 10000D);
|
||||
attribute.put(id, attribute.getOrDefault(id, 0L) + num);
|
||||
}
|
||||
}
|
||||
combinedAttribute(attribute, heroAllAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* ... 修行和修仙 ...
|
||||
*
|
||||
|
@ -4663,15 +4709,22 @@ public class HeroLogic {
|
|||
public CommonProto.Drop.Builder consumeBackDrop(User user, List<String> heroIds) throws Exception {
|
||||
Map<Integer, Long> returnItemMap = new HashMap<>();
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
for (String heroId : heroIds) {
|
||||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
Hero hero = heroManager.getHero(heroId);
|
||||
dismantleHeroEquip(hero, equipManager, returnItemMap);
|
||||
dismantleHeroLevel(hero, returnItemMap);
|
||||
}
|
||||
int returnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_RETURN_PERCENT);
|
||||
long[][] resultDrop = ItemUtil.mapToLongArray(returnItemMap);
|
||||
long[][] levelReturn = ItemLogic.itemReturnPercent(resultDrop, returnPercent);
|
||||
return ItemUtil.drop(user, levelReturn, BIReason.HERO_CONSUME);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, levelReturn, BIReason.HERO_CONSUME);
|
||||
// 删除英雄
|
||||
for (String rmHeroId : heroIds) {
|
||||
heroManager.removeHero(user.getId(), rmHeroId);
|
||||
}
|
||||
AssistLogic.getInstance().refreshAssistBoxForRemoveHero(user, heroIds);
|
||||
return drop;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4699,7 +4752,13 @@ public class HeroLogic {
|
|||
int rankUpReturnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_SACRIFICE_PERCENT);
|
||||
long[][] itemArray = ItemUtil.mapToLongArray(baseItemMap);
|
||||
long[][] returnPercent = ItemLogic.itemReturnPercent(itemArray, rankUpReturnPercent);
|
||||
return ItemUtil.drop(user, returnPercent, reason);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, returnPercent, reason);
|
||||
for (String id : heroIdsList) {
|
||||
// 删除英雄
|
||||
user.getHeroManager().removeHero(user.getId(),id);
|
||||
}
|
||||
AssistLogic.getInstance().refreshAssistBoxForRemoveHero(user, heroIdsList);
|
||||
return drop;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5028,6 +5087,10 @@ public class HeroLogic {
|
|||
for (Integer enabled : user.getMagicSoldierManager().getMagicSoldierBook()) {
|
||||
builder.addAllBookEnabled(enabled);
|
||||
}
|
||||
// 法宝图鉴
|
||||
for (Integer enabled : user.getEquipManager().getBaublesBookEnabled()) {
|
||||
builder.addAllBookEnabled(enabled);
|
||||
}
|
||||
|
||||
for (Integer equip : equipManager.getSoulGealList()) {
|
||||
builder.addEquipGot(equip);
|
||||
|
@ -5075,59 +5138,81 @@ public class HeroLogic {
|
|||
int[][] tamers = bookConfig.getTeamers();
|
||||
int[][] reward = bookConfig.getReward();
|
||||
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
|
||||
switch (bookConfig.getFetterType()) {
|
||||
case 1://神将激活
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Set<Integer> hero = getHeroHands(bookId, heroManager);
|
||||
//判断羁绊神将是否在集合
|
||||
for (int[] tmp : tamers) {
|
||||
if (!hero.contains(tmp[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
//将羁绊加入神将羁绊集合
|
||||
heroManager.addHeroHandBookEnabled(bookId);
|
||||
break;
|
||||
case 2://魂印激活
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
if (equipManager.getEquipBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] equip : tamers) {
|
||||
if (!equipManager.getSoulGealList().contains(equip[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
equipManager.addEquipBookEnabled(bookId);
|
||||
break;
|
||||
case 3://灵兽激活
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
if (pokemonManager.getPokemonBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] pokemon : tamers) {
|
||||
if (!pokemonManager.getPokemonGot().contains(pokemon[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
pokemonManager.addPokemonBookEnabled(bookId);
|
||||
break;
|
||||
case 4://白金装备激活
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
if (itemManager.getEquipBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
Map<Integer, Long> equipBookMap = itemManager.getEquipBookMap();
|
||||
for (int[] pokemon : tamers) {
|
||||
if (!itemManager.getEquipBookMap().containsKey(pokemon[0]) || itemManager.getEquipBookMap().get(pokemon[0]) < pokemon[1]) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
if (!equipBookMap.containsKey(pokemon[0]) || equipBookMap.get(pokemon[0]) < pokemon[1]) {
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
itemManager.addEquipBookEnabled(bookId);
|
||||
break;
|
||||
case 5://神兵图鉴激活
|
||||
MagicSoldierManager soldierManager = magicSoldierCheck(bookId, user, tamers);
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
if (soldierManager.getMagicSoldierBook().contains(bookId)) {
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] soldier : tamers) {
|
||||
if (!soldierManager.getMagicSoldierRecord().contains(soldier[0])) {
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
soldierManager.addMagicSoldierBook(bookId);
|
||||
break;
|
||||
case 6://法宝图鉴激活
|
||||
Set<Integer> baublesBookEnabled = equipManager.getBaublesBookEnabled();
|
||||
if (baublesBookEnabled.contains(bookId)) {
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] equip : tamers) {
|
||||
if (!equipManager.getBaublesBookList().contains(equip[0])){
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
equipManager.addBaublesBookEnabled(bookId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
|
@ -26,7 +25,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
public class TrainingLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TrainingLogic.class);
|
||||
|
||||
private static class Instance {
|
||||
public final static TrainingLogic instance = new TrainingLogic();
|
||||
|
@ -467,10 +466,6 @@ public class TrainingLogic {
|
|||
List<String> heroIdsList = consumeHeroIdsList.stream().filter(v -> v.getType() == 1).map(CommonProto.TrainingUnlockSkillHeroItem::getId).collect(Collectors.toList());
|
||||
if (!heroIdsList.isEmpty()){
|
||||
builder = HeroLogic.getInstance().consumeBackDrop(user, heroIdsList);
|
||||
// 删除英雄
|
||||
for (String id : heroIdsList) {
|
||||
heroManager.removeHero(user.getId(), id);
|
||||
}
|
||||
}
|
||||
|
||||
List<CommonProto.TrainingUnlockSkillHeroItem> itemList = consumeHeroIdsList.stream().filter(v -> v.getType() == 2).collect(Collectors.toList());
|
||||
|
|
|
@ -8,8 +8,6 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||
|
@ -19,8 +17,8 @@ import com.ljsd.jieling.logic.activity.event.Poster;
|
|||
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.AssistLogic;
|
||||
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;
|
||||
|
@ -474,7 +472,7 @@ public class ItemLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 分解卡牌|进阶消耗
|
||||
* 分解卡牌|进阶消耗 分解英雄
|
||||
*/
|
||||
public void decomposeHero(ISession iSession, List<String> heroIdsList) throws Exception {
|
||||
// 逻辑
|
||||
|
@ -497,10 +495,7 @@ public class ItemLogic {
|
|||
}
|
||||
|
||||
CommonProto.Drop.Builder drop = HeroLogic.getInstance().disbandHeroDrop(user, heroIdsList, BIReason.DECOMPOS_HERO_REWARD);
|
||||
for (String id : heroIdsList) {
|
||||
// 删除英雄
|
||||
user.getHeroManager().removeHero(user.getId(),id);
|
||||
}
|
||||
AssistLogic.getInstance().refreshAssistBoxForRemoveHero(user, heroIdsList);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.DECOMPOSE_TIMES, heroIdsList.size());
|
||||
ItemLogic.sendUseAndPriceItemMessage(iSession, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE, drop);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -1508,4 +1507,19 @@ public class CBean2Proto {
|
|||
.setFightResult(arenaRecord.getFightResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<CommonProto.AssistBox> buildAssistBox(User user){
|
||||
ArrayList<CommonProto.AssistBox> boxes = new ArrayList<>();
|
||||
Map<Integer, SAssistanceConfig> map = SAssistanceConfig.map;
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
for (SAssistanceConfig config : map.values()) {
|
||||
AssistBox assistBox = heroManager.getAssistBox(config.getId());
|
||||
CommonProto.AssistBox.Builder builder = CommonProto.AssistBox.newBuilder();
|
||||
builder.setId(assistBox.getId());
|
||||
builder.setState(assistBox.getState());
|
||||
builder.setHeroId(assistBox.getHeroId());
|
||||
boxes.add(builder.build());
|
||||
}
|
||||
return boxes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1278,6 +1278,7 @@ public class ItemUtil {
|
|||
PropertyItem equip;
|
||||
if (item.getItemType() == GlobalItemType.ESPECIAL_EQUIP){
|
||||
equip = new Baubles(user.getId(), equipId);
|
||||
user.getEquipManager().addBaublesBookList(equipId);
|
||||
}else {
|
||||
equip = new PropertyItem(user.getId(), equipId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="AssistanceConfig")
|
||||
public class SAssistanceConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int professionLimit;
|
||||
|
||||
private int propertyUp;
|
||||
|
||||
private int experience;
|
||||
|
||||
public static Map<Integer, SAssistanceConfig> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
map = STableManager.getConfig(SAssistanceConfig.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int getProfessionLimit() {
|
||||
return professionLimit;
|
||||
}
|
||||
|
||||
public int getPropertyUp() {
|
||||
return propertyUp;
|
||||
}
|
||||
|
||||
public int getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="AssistanceProperty")
|
||||
public class SAssistanceProperty implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int star;
|
||||
|
||||
private int[][] property;
|
||||
|
||||
// quality > star > property
|
||||
public static Map<Integer, Map<Integer, int[][]>> propertymap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SAssistanceProperty> config = STableManager.getConfig(SAssistanceProperty.class);
|
||||
for (SAssistanceProperty value : config.values()) {
|
||||
Map<Integer, int[][]> starmap = propertymap.getOrDefault(value.getQuality(), new HashMap<>());
|
||||
starmap.put(value.star, value.getProperty());
|
||||
propertymap.put(value.getQuality(), starmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public int[][] getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -231,6 +231,10 @@ public class SCHero implements BaseConfig{
|
|||
return sCHero;
|
||||
}
|
||||
|
||||
public static SCHero getSCHero(int heroTId) {
|
||||
return sCHero.get(heroTId);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue