Task【ID1006213】【新战斗版本】大闹天宫(猎妖之路功能优化)
parent
a6767eb7bf
commit
094d64f8ad
|
@ -35,7 +35,7 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
|
||||||
|
|
||||||
public Map<Integer, List<int[]>> matrixforGroupInfo;
|
public Map<Integer, List<int[]>> matrixforGroupInfo;
|
||||||
|
|
||||||
public Map<Integer, Map<Integer,Integer>> type2lay2weight;
|
public Map<Integer,Map<Integer, Map<Integer,Integer>>> type2lay2weight;
|
||||||
public Map<Integer, Integer> leve2num;//阶段第一层
|
public Map<Integer, Integer> leve2num;//阶段第一层
|
||||||
public Map<Integer, Set<Integer>> leve2ids;//ids
|
public Map<Integer, Set<Integer>> leve2ids;//ids
|
||||||
public Map<Integer,Map<Integer,Integer>> type2holy2weight;
|
public Map<Integer,Map<Integer,Integer>> type2holy2weight;
|
||||||
|
@ -204,9 +204,11 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
|
||||||
int layid = sExpeditionFloorConfig.getId();
|
int layid = sExpeditionFloorConfig.getId();
|
||||||
int[][] randomNode = sExpeditionFloorConfig.getRandomNode();
|
int[][] randomNode = sExpeditionFloorConfig.getRandomNode();
|
||||||
for (int[] aRandomNode : randomNode) {
|
for (int[] aRandomNode : randomNode) {
|
||||||
Map<Integer, Integer> orDefault = type2lay2weight.getOrDefault(aRandomNode[0], new HashMap<>());
|
Map<Integer, Map<Integer, Integer>> orDefault1 = type2lay2weight.getOrDefault(sExpeditionFloorConfig.getFloor(), new HashMap<>());
|
||||||
|
Map<Integer, Integer> orDefault = orDefault1.getOrDefault(aRandomNode[0], new HashMap<>());
|
||||||
orDefault.put(layid, aRandomNode[1]);
|
orDefault.put(layid, aRandomNode[1]);
|
||||||
type2lay2weight.put(aRandomNode[0], orDefault);
|
orDefault1.put(aRandomNode[0], orDefault);
|
||||||
|
type2lay2weight.put(sExpeditionFloorConfig.getFloor(),orDefault1);
|
||||||
}
|
}
|
||||||
leve2num.put(sExpeditionFloorConfig.getFloor(),integer);
|
leve2num.put(sExpeditionFloorConfig.getFloor(),integer);
|
||||||
|
|
||||||
|
@ -340,8 +342,8 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
|
||||||
return sWorkTechMapByTechIdAndLevelTmp.get(techId).get(level);
|
return sWorkTechMapByTechIdAndLevelTmp.get(techId).get(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, Map<Integer, Integer>> getType2lay2weight() {
|
public Map<Integer, Map<Integer, Integer>> getType2lay2weight(int floor) {
|
||||||
return type2lay2weight;
|
return type2lay2weight.getOrDefault(floor,new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, Integer> getType2holy2weight(int type) {
|
public Map<Integer, Integer> getType2holy2weight(int type) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
return MessageTypeProto.MessageType.EXPEDITION_END_BATTLE_REQUEST;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -126,12 +126,15 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
if (hero == null) {
|
Hero herotemp = user.getExpeditionManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
|
if (hero == null&&herotemp==null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
user.getExpeditionManager().getHeroHPWithChange().put(hero.getId(), 0d);
|
user.getExpeditionManager().getHeroHPWithChange().put(hero.getId(), 0d);
|
||||||
ids.add(hero.getId());
|
ids.add(hero.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//出队伍
|
//出队伍
|
||||||
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
|
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
|
||||||
|
|
||||||
|
|
|
@ -101,14 +101,16 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
}
|
}
|
||||||
String holySkill = passiveSkillResult.length()!=0?passiveSkillResult.substring(0,passiveSkillResult.length()-1):"";
|
String holySkill = passiveSkillResult.length()!=0?passiveSkillResult.substring(0,passiveSkillResult.length()-1):"";
|
||||||
|
|
||||||
CommonProto.FightTeamInfo deffightTeamInfo;
|
LuaValue getFightData;
|
||||||
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
|
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
|
||||||
int tid = deffightInfo.getUid();
|
int tid = deffightInfo.getUid();
|
||||||
deffightTeamInfo= ExpeditionLogic.getGropFightTeamInfoWithDouble(tid,nodeInfo.getBossHP());
|
List<CommonProto.FightTeamInfo> gropFightTeamInfoWithDouble = ExpeditionLogic.getGropFightTeamInfoWithDouble(tid, nodeInfo.getBossHP());
|
||||||
|
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, gropFightTeamInfoWithDouble);
|
||||||
}else {
|
}else {
|
||||||
deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
|
CommonProto.FightTeamInfo deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
|
||||||
|
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
|
||||||
}
|
}
|
||||||
LuaValue getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
|
|
||||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
|
int[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
|
||||||
|
|
||||||
|
@ -140,7 +142,8 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
if (hero == null) {
|
Hero herotemp = user.getExpeditionManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
|
if (hero == null&&herotemp==null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
user.getExpeditionManager().getHeroHPWithChange().put(hero.getId(), 0d);
|
user.getExpeditionManager().getHeroHPWithChange().put(hero.getId(), 0d);
|
||||||
|
@ -149,10 +152,18 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
//出队伍
|
//出队伍
|
||||||
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
|
user.getTeamPosManager().updateTeamPosByTeamId(1001,new LinkedList<>());
|
||||||
|
|
||||||
//节点血量更新
|
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
|
||||||
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
//节点血量更新
|
||||||
nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))
|
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
||||||
);
|
nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
//节点血量更新
|
||||||
|
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
||||||
|
nodeInfo.getBossHP().put(s, (double) remainHp.remove(0) / (double) familyHeroInfo.getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//更新节点
|
//更新节点
|
||||||
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
||||||
|
@ -172,8 +183,6 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//节点血量更新
|
//节点血量更新
|
||||||
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
||||||
nodeInfo.getBossHP().put(s, 0d)
|
nodeInfo.getBossHP().put(s, 0d)
|
||||||
|
@ -184,9 +193,13 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
|
Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
|
||||||
while (iterator.hasNext()){
|
while (iterator.hasNext()){
|
||||||
TeamPosHeroInfo teamPosHeroInfo = iterator.next();
|
TeamPosHeroInfo teamPosHeroInfo = iterator.next();
|
||||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
|
||||||
if (hero == null) {
|
Hero hero = user.getExpeditionManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
continue;
|
if (hero==null) {
|
||||||
|
hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||||
|
}
|
||||||
|
if (hero==null) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||||
double remain = remainHp.remove(0);
|
double remain = remainHp.remove(0);
|
||||||
|
@ -216,7 +229,13 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
if (sExpeditionNodeConfig == null) {
|
if (sExpeditionNodeConfig == null) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sExpeditionNodeConfig.getreward(),1,0,BIReason.EXPEDITION_DROP_REWARD);
|
CommonProto.Drop.Builder drop;
|
||||||
|
if(sExpeditionNodeConfig.getreward()!=null){
|
||||||
|
drop = ItemUtil.drop(user, sExpeditionNodeConfig.getreward(),1,0,BIReason.EXPEDITION_DROP_REWARD);
|
||||||
|
}else {
|
||||||
|
drop = CommonProto.Drop.newBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
//试炼和贪婪节点胜利直接通过
|
//试炼和贪婪节点胜利直接通过
|
||||||
if (ExpeditionLogic.isHardNode(nodeInfo.getType())) {
|
if (ExpeditionLogic.isHardNode(nodeInfo.getType())) {
|
||||||
//updata node
|
//updata node
|
||||||
|
@ -242,7 +261,7 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
if(hero==null){
|
if(hero==null){
|
||||||
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
||||||
}
|
}
|
||||||
Hero hero1 = ExpeditionLogic.createHero(i, uid, hero);
|
Hero hero1 = ExpeditionLogic.createHero(i, uid, hero,false);
|
||||||
drop.addHero(CBean2Proto.getHero(hero1));
|
drop.addHero(CBean2Proto.getHero(hero1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,24 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.logic.dao.ExpeditionManager;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.Expedition;
|
import com.ljsd.jieling.protocols.Expedition;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
import com.ljsd.jieling.util.CBean2Proto;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SExpeditionSetting;
|
import config.SExpeditionSetting;
|
||||||
import config.SGlobalSystemConfig;
|
import config.SGlobalSystemConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: 获取猎妖之路信息
|
* Description: 获取猎妖之路信息
|
||||||
* Author: zsx
|
* Author: zsx
|
||||||
|
@ -37,27 +42,15 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
|
||||||
|
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
ExpeditionManager manager = user.getExpeditionManager();
|
ExpeditionManager manager = user.getExpeditionManager();
|
||||||
|
|
||||||
|
|
||||||
if(leve!=manager.getExpeditionLeve()&&(manager.getExpeditionLeve()!=-1)){
|
if(leve!=manager.getExpeditionLeve()&&(manager.getExpeditionLeve()!=-1)){
|
||||||
throw new ErrorCodeException("阶段不正确 current"+manager.getExpeditionLeve());
|
throw new ErrorCodeException("阶段不正确 current"+manager.getExpeditionLeve());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
||||||
if(sExpeditionSetting == null){
|
if(sExpeditionSetting == null){
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
int[][] fourthOpenRule = sExpeditionSetting.getFourthOpenRule();
|
|
||||||
|
|
||||||
//check 困难模式是否开启
|
|
||||||
// if(!(manager.getPassTimes()==-1||manager.getPassTimes()>=fourthOpenRule[0][1]||user.getPlayerInfoManager().getMaxForce()>=fourthOpenRule[1][1])){
|
|
||||||
// throw new ErrorCodeException("阶段不正确 current"+manager.getExpeditionLeve());
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Expedition.GetExpeditionResponse.Builder builder = Expedition.GetExpeditionResponse.newBuilder();
|
Expedition.GetExpeditionResponse.Builder builder = Expedition.GetExpeditionResponse.newBuilder();
|
||||||
|
|
||||||
if(manager.getExpeditionNodeInfos().size()==0){
|
if(manager.getExpeditionNodeInfos().size()==0){
|
||||||
manager.setExpeditionLeve(leve);
|
manager.setExpeditionLeve(leve);
|
||||||
manager.setLay(1);
|
manager.setLay(1);
|
||||||
|
@ -70,6 +63,26 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
|
||||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user));
|
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user));
|
||||||
builder.addAllNodeInfo(ExpeditionLogic.getInstance().getNodeInfo(user));
|
builder.addAllNodeInfo(ExpeditionLogic.getInstance().getNodeInfo(user));
|
||||||
builder.addAllEquipIds(ExpeditionLogic.getInstance().getEquipnfo(user));
|
builder.addAllEquipIds(ExpeditionLogic.getInstance().getEquipnfo(user));
|
||||||
|
|
||||||
|
List<CommonProto.Hero> heroList = new ArrayList<>();
|
||||||
|
Map<String, Hero> heroMap = user.getExpeditionManager().getHeroMap();
|
||||||
|
for(Hero hero : heroMap.values()){
|
||||||
|
heroList.add(CBean2Proto.getHero(hero));
|
||||||
|
}
|
||||||
|
builder.addAllHeroList(heroList);
|
||||||
|
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
||||||
|
List<CommonProto.Equip> equipList = new ArrayList<>();
|
||||||
|
for(PropertyItem equipInfo: equipMap.values()){
|
||||||
|
if(equipInfo instanceof Equip)
|
||||||
|
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||||
|
}
|
||||||
|
builder.addAllEquip(equipList);
|
||||||
|
List<CommonProto.Equip> soulEquipList = new ArrayList<>();
|
||||||
|
for(PropertyItem equipInfo: equipMap.values()){
|
||||||
|
if(equipInfo instanceof Jewel)
|
||||||
|
soulEquipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||||
|
}
|
||||||
|
builder.addAllEquip(soulEquipList);
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_RESONSE_VALUE, builder.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_RESONSE_VALUE, builder.build(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,7 @@ import config.*;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import util.StringUtil;
|
import util.StringUtil;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,13 +45,10 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在"));
|
||||||
}
|
}
|
||||||
ExpeditionNodeInfo nodeInfo = user.getExpeditionManager().getExpeditionNodeInfos().get(nodeId);
|
ExpeditionNodeInfo nodeInfo = user.getExpeditionManager().getExpeditionNodeInfos().get(nodeId);
|
||||||
if (!ExpeditionLogic.isBattleNode( nodeInfo.getType())) {
|
|
||||||
|
if (nodeInfo.getType() != ExpeditionLogic.NODETYPE_HERO_GET) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点类型不符"+nodeInfo.getType()));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点类型不符"+nodeInfo.getType()));
|
||||||
}
|
}
|
||||||
if (nodeInfo.getState() != ExpeditionLogic.NODETYPE_HERO_GET) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点状态不正确"+nodeInfo.getState()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//check node
|
//check node
|
||||||
List<Integer> nextNodeId = ExpeditionLogic.getNextNodeId(user.getExpeditionManager().getSortid(),user.getExpeditionManager().getExpeditionNodeInfos().size());
|
List<Integer> nextNodeId = ExpeditionLogic.getNextNodeId(user.getExpeditionManager().getSortid(),user.getExpeditionManager().getExpeditionNodeInfos().size());
|
||||||
if(!nextNodeId.contains(nodeId)){
|
if(!nextNodeId.contains(nodeId)){
|
||||||
|
@ -75,43 +69,30 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
int recruitTime = sExpeditionSetting.getRecruitTime();
|
int recruitTime = sExpeditionSetting.getRecruitTime();
|
||||||
|
|
||||||
|
|
||||||
// int poolId = sExpeditionNodeConfig.getPoolId();
|
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp();
|
||||||
// Set<Integer> tempIdcfgs = ExpeditionLogic.getRandomTid(poolId,recruitTime);
|
if(heroMapTemp.size()==0){
|
||||||
// Set<Integer> cls = new HashSet<>();
|
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(sExpeditionNodeConfig.getPoolId());
|
||||||
// Set<Integer> collect = tempIdcfgs.stream().filter(integer -> {
|
if(sExpeditionRecruitConfig!=null) {
|
||||||
// SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
|
int i = sExpeditionRecruitConfig.getHeroId();
|
||||||
// if(sExpeditionRecruitConfig==null){
|
//获取最大战力hero
|
||||||
// return false;
|
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
||||||
// }
|
if (StringUtil.isEmpty(maxforceHero)) {
|
||||||
// int heroId = sExpeditionRecruitConfig.getHeroId();
|
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||||
// SCHero scHero = SCHero.getsCHero().get(heroId);
|
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
||||||
// scHero.getPropertyName();
|
}
|
||||||
// }
|
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
|
||||||
//
|
if (hero == null) {
|
||||||
// }).collect(Collectors.toSet());
|
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
||||||
|
}
|
||||||
|
|
||||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(0);
|
for (int j = 0; j < recruitTime; j++) {
|
||||||
if(sExpeditionRecruitConfig!=null) {
|
ExpeditionLogic.createHero(i, uid, hero, true);
|
||||||
int i = sExpeditionRecruitConfig.getgetHero();
|
}
|
||||||
//获取最大战力hero
|
|
||||||
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
|
||||||
if (StringUtil.isEmpty(maxforceHero)) {
|
|
||||||
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
|
||||||
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
|
||||||
}
|
}
|
||||||
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
|
|
||||||
if (hero == null) {
|
|
||||||
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
|
||||||
}
|
|
||||||
ExpeditionLogic.createHero(i, uid, hero);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i <4 ; i++) {
|
|
||||||
|
|
||||||
Hero hero = user.getHeroManager().getHeroMap().get(0);
|
heroMapTemp.forEach((s, hero) -> {
|
||||||
if(hero == null){
|
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
|
|
||||||
}
|
|
||||||
CommonProto.ViewHeroInfo.Builder inner = CommonProto.ViewHeroInfo.newBuilder();
|
CommonProto.ViewHeroInfo.Builder inner = CommonProto.ViewHeroInfo.newBuilder();
|
||||||
Map<Integer, Integer> heroNotBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, true, 0);
|
Map<Integer, Integer> heroNotBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, true, 0);
|
||||||
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
||||||
|
@ -123,10 +104,10 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
}
|
}
|
||||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||||
inner.setHero(CBean2Proto.getHero(hero));
|
inner.setHero(CBean2Proto.getHero(hero));
|
||||||
|
|
||||||
builder.addViewHeroInfo(inner);
|
builder.addViewHeroInfo(inner);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// nodeInfo.setState(ExpeditionLogic.NODESTATE_HERO);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.ljsd.jieling.handler.Expedition;
|
|
||||||
|
|
||||||
import com.google.protobuf.GeneratedMessage;
|
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
|
||||||
import com.ljsd.jieling.protocols.Expedition;
|
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description: 英雄招募
|
|
||||||
* Author: zsx
|
|
||||||
* CreateDate: 2020/5/18 20:48
|
|
||||||
*/
|
|
||||||
public class HeroNodeRequest extends BaseHandler<Expedition.HeroNodeRequest> {
|
|
||||||
@Override
|
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeneratedMessage processWithProto(int uid, Expedition.HeroNodeRequest proto) throws Exception {
|
|
||||||
return Expedition.HeroNodeResponse.newBuilder().build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.ljsd.jieling.handler.Expedition;
|
||||||
|
|
||||||
|
import com.google.protobuf.GeneratedMessage;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.Expedition;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.util.CBean2Proto;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SExpeditionNodeConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
import util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 英雄招募
|
||||||
|
* Author: zsx
|
||||||
|
* CreateDate: 2020/5/18 20:48
|
||||||
|
*/
|
||||||
|
public class HeroNodeRequestHandler extends BaseHandler<Expedition.HeroNodeRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeneratedMessage processWithProto(int uid, Expedition.HeroNodeRequest proto) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
int nodeId = proto.getNodeId();
|
||||||
|
String heroId = proto.getHeroId();
|
||||||
|
if(StringUtil.isEmpty(heroId)){
|
||||||
|
throw new ErrorCodeException("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
//cfg check
|
||||||
|
if (!user.getExpeditionManager().getExpeditionNodeInfos().containsKey(nodeId)) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在"));
|
||||||
|
}
|
||||||
|
ExpeditionNodeInfo nodeInfo = user.getExpeditionManager().getExpeditionNodeInfos().get(nodeId);
|
||||||
|
|
||||||
|
if (nodeInfo.getType() != ExpeditionLogic.NODETYPE_HERO_GET) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点类型不符"+nodeInfo.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (nodeInfo.getState() != ExpeditionLogic.NODESTATE_HERO) {
|
||||||
|
// throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点状态不正确"+nodeInfo.getState()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
//check node
|
||||||
|
List<Integer> nextNodeId = ExpeditionLogic.getNextNodeId(user.getExpeditionManager().getSortid(),user.getExpeditionManager().getExpeditionNodeInfos().size());
|
||||||
|
if(!nextNodeId.contains(nodeId)){
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点状态不正确"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpeditionManager expeditionManager = user.getExpeditionManager();
|
||||||
|
if(!expeditionManager.getHeroMapTemp().containsKey(heroId)){
|
||||||
|
throw new ErrorCodeException("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
//move temp to
|
||||||
|
Hero hero = expeditionManager.getHeroMapTemp().get(heroId);
|
||||||
|
expeditionManager.addHero(hero);
|
||||||
|
|
||||||
|
Map<String, PropertyItem> equipMapTemp = expeditionManager.getEquipMapTemp();
|
||||||
|
for (Map.Entry<Integer, String> next : hero.getEquipByPositionMap().entrySet()) {
|
||||||
|
String equipId = next.getValue();
|
||||||
|
PropertyItem equip = equipMapTemp.get(equipId);
|
||||||
|
if (equip == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
user.getExpeditionManager().addEquip(user, equip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Set<String> jewelInfo = hero.getJewelInfo();
|
||||||
|
for (String jewel : jewelInfo) {
|
||||||
|
PropertyItem propertyItem = user.getEquipManager().getEquipMap().get(jewel);
|
||||||
|
if (propertyItem == null)
|
||||||
|
continue;
|
||||||
|
Jewel j = (Jewel) propertyItem;
|
||||||
|
user.getExpeditionManager().addEquip(user, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||||
|
|
||||||
|
drop.addHero(CBean2Proto.getHero(hero));
|
||||||
|
|
||||||
|
//clear temp
|
||||||
|
user.getExpeditionManager().clearEquipToTemp();
|
||||||
|
user.getExpeditionManager().clearHeroToTemp();
|
||||||
|
|
||||||
|
|
||||||
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
||||||
|
if (sExpeditionNodeConfig == null) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//updata node
|
||||||
|
Set<CommonProto.ExpeditionNodeInfo> nodeInfos = ExpeditionLogic.openLay(user,nodeInfo.getLay(),nodeId);
|
||||||
|
|
||||||
|
//更新节点
|
||||||
|
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
||||||
|
builder.addAllNodeInfo(nodeInfos);
|
||||||
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
|
||||||
|
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
||||||
|
|
||||||
|
return Expedition.HeroNodeResponse.newBuilder().setDrop(drop).build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -107,7 +107,7 @@ public class StartExpeditionBattleRequest extends BaseHandler<Expedition.StartEx
|
||||||
CommonProto.FightTeamInfo deffightTeamInfo;
|
CommonProto.FightTeamInfo deffightTeamInfo;
|
||||||
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
|
if(ExpeditionLogic.isHardNode(nodeInfo.getType())){
|
||||||
int tid = deffightInfo.getUid();
|
int tid = deffightInfo.getUid();
|
||||||
deffightTeamInfo= ExpeditionLogic.getGropFightTeamInfoWithDouble(tid,nodeInfo.getBossHP());
|
deffightTeamInfo= ExpeditionLogic.getGropFightTeamInfoWithDouble(tid,nodeInfo.getBossHP()).get(0);
|
||||||
}else {
|
}else {
|
||||||
deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
|
deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,141 @@
|
||||||
package com.ljsd.jieling.logic.dao;
|
package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.util.KeyGenUtils;
|
import com.ljsd.jieling.util.KeyGenUtils;
|
||||||
import com.ljsd.jieling.util.UUIDEnum;
|
import com.ljsd.jieling.util.UUIDEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 圣物
|
* 圣物
|
||||||
*/
|
*/
|
||||||
public class ExpeditionItem extends PropertyItem {
|
public class ExpeditionItem extends MongoBase {
|
||||||
|
|
||||||
private String itemDbType = "ExpeditionItem";
|
private String itemDbType = "ExpeditionItem";
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private int equipId;
|
||||||
|
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private String heroId;
|
||||||
|
|
||||||
|
private Map<Integer, Integer> propertyValueByIdMap; //主属性 key 对应PropertyConfig id
|
||||||
|
|
||||||
|
private Map<Integer, Integer> secondValueByIdMap; //副属性
|
||||||
|
|
||||||
|
private int createTime;
|
||||||
|
|
||||||
|
private int skill;
|
||||||
|
|
||||||
|
private int isLocked;
|
||||||
|
|
||||||
|
public ExpeditionItem(String id, int equipId, int level, String heroId, Map<Integer, Integer> propertyValueByIdMap, Map<Integer, Integer> secondValueByIdMap, int createTime, int skill, int isLocked) {
|
||||||
|
this.id = id;
|
||||||
|
this.equipId = equipId;
|
||||||
|
this.level = level;
|
||||||
|
this.heroId = heroId;
|
||||||
|
this.propertyValueByIdMap = propertyValueByIdMap;
|
||||||
|
this.secondValueByIdMap = secondValueByIdMap;
|
||||||
|
this.createTime = createTime;
|
||||||
|
this.skill = skill;
|
||||||
|
this.isLocked = isLocked;
|
||||||
|
}
|
||||||
public ExpeditionItem(int uid, int expeditionTid) {
|
public ExpeditionItem(int uid, int expeditionTid) {
|
||||||
super();
|
super();
|
||||||
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.EXPEDITION, uid));
|
this.id =(KeyGenUtils.produceIdByModule(UUIDEnum.EXPEDITION, uid));
|
||||||
super.setEquipId(expeditionTid);
|
this.equipId=(expeditionTid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpeditionItem() {
|
public ExpeditionItem() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
updateString("id",equipId);
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEquipId() {
|
||||||
|
return equipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipId(int equipId){
|
||||||
|
updateString("equipId",equipId);
|
||||||
|
this.equipId = equipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level){
|
||||||
|
updateString("level",level);
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getHeroId() {
|
||||||
|
return heroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeroId(String heroId){
|
||||||
|
updateString("heroId",heroId);
|
||||||
|
this.heroId = heroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer> getPropertyValueByIdMap() {
|
||||||
|
return propertyValueByIdMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer> getSecondValueByIdMap() {
|
||||||
|
return secondValueByIdMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setPropertyValueByIdMap(Map<Integer, Integer> propertyValueByIdMap) {
|
||||||
|
updateString("propertyValueByIdMap",propertyValueByIdMap);
|
||||||
|
this.propertyValueByIdMap = propertyValueByIdMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
|
||||||
|
updateString("secondValueByIdMap",secondValueByIdMap);
|
||||||
|
this.secondValueByIdMap = secondValueByIdMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(int createTime) {
|
||||||
|
updateString("createTime", createTime);
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSkill() {
|
||||||
|
return skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkill(int skill) {
|
||||||
|
updateString("skill", skill);
|
||||||
|
|
||||||
|
this.skill = skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIsLocked() {
|
||||||
|
return isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateIsLocked(int isLocked) {
|
||||||
|
updateString("isLocked", isLocked);
|
||||||
|
this.isLocked = isLocked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,19 @@ public class ExpeditionManager extends MongoBase {
|
||||||
heroMap.put(hero.getId(), hero);
|
heroMap.put(hero.getId(), hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addHeroToTemp(Hero hero) throws Exception {
|
||||||
|
//绑定关系
|
||||||
|
hero.init(this.getRootId(),getMongoKey() + ".heroMapTemp." + hero.getId());
|
||||||
|
updateString("heroMapTemp." + hero.getId(), hero);
|
||||||
|
heroMapTemp.put(hero.getId(), hero);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearHeroToTemp() throws Exception {
|
||||||
|
heroMapTemp.clear();
|
||||||
|
updateString("heroMapTemp" , heroMapTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Hero getHero(String heroId) {
|
public Hero getHero(String heroId) {
|
||||||
return heroMap.get(heroId);
|
return heroMap.get(heroId);
|
||||||
}
|
}
|
||||||
|
@ -187,11 +200,27 @@ public class ExpeditionManager extends MongoBase {
|
||||||
equip.init(this.getRootId(),getMongoKey() + ".equipMap." + equip.getId());
|
equip.init(this.getRootId(),getMongoKey() + ".equipMap." + equip.getId());
|
||||||
updateString("equipMap." + equip.getId(), equip);
|
updateString("equipMap." + equip.getId(), equip);
|
||||||
equipMap.put(equip.getId(),equip);
|
equipMap.put(equip.getId(),equip);
|
||||||
// addEquipHandBook(equip.getEquipId());
|
|
||||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.GET_EQUIP,equip.getEquipId());
|
|
||||||
Poster.getPoster().dispatchEvent(new EquipEvent(user.getId(),equip.getEquipId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearEquipToTemp() throws Exception {
|
||||||
|
updateString("equipMapTemp" , equipMapTemp);
|
||||||
|
equipMapTemp.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEquipToTemp(User user, PropertyItem equip) throws Exception {
|
||||||
|
equip.init(this.getRootId(),getMongoKey() + ".equipMapTemp." + equip.getId());
|
||||||
|
updateString("equipMapTemp." + equip.getId(), equip);
|
||||||
|
equipMapTemp.put(equip.getId(),equip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, Hero> getHeroMapTemp() {
|
||||||
|
return heroMapTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, PropertyItem> getEquipMapTemp() {
|
||||||
|
return equipMapTemp;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, PropertyItem> getEquipMap() {
|
public Map<String, PropertyItem> getEquipMap() {
|
||||||
return equipMap;
|
return equipMap;
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class Hero extends MongoBase {
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
||||||
this.templateId = heroTid;
|
this.templateId = heroTid;
|
||||||
this.level = hero.level;
|
this.level = initStar;
|
||||||
this.star = initStar;
|
this.star =hero.getStar() ;
|
||||||
this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
|
this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
|
||||||
this.breakId = hero.breakId;
|
this.breakId = hero.breakId;
|
||||||
this.starBreakId = hero.starBreakId;
|
this.starBreakId = hero.starBreakId;
|
||||||
|
@ -142,7 +142,7 @@ public class Hero extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, String> getEquipByPositionMap() {
|
public Map<Integer, String> getEquipByPositionMap() {
|
||||||
return equipByPositionMap;
|
return equipByPositionMap==null?new HashMap<>():equipByPositionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEquipByPositionMap(Map<Integer, String> equipByPositionMap) throws Exception {
|
public void setEquipByPositionMap(Map<Integer, String> equipByPositionMap) throws Exception {
|
||||||
|
@ -170,7 +170,7 @@ public class Hero extends MongoBase {
|
||||||
|
|
||||||
|
|
||||||
public Map<Integer, Integer> getSoulEquipByPositionMap() {
|
public Map<Integer, Integer> getSoulEquipByPositionMap() {
|
||||||
return soulEquipByPositionMap;
|
return soulEquipByPositionMap==null?new HashMap<>():soulEquipByPositionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSoulEquipPositionMap(int position,int equipId) {
|
public void updateSoulEquipPositionMap(int position,int equipId) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SnapFightInfo {
|
public class SnapFightInfo {
|
||||||
private Map<String, FamilyHeroInfo> heroAttribute;
|
private Map<String, FamilyHeroInfo> heroAttribute = new HashMap<>();
|
||||||
private int uid;
|
private int uid;
|
||||||
private int force;
|
private int force;
|
||||||
private Map<String, String> heroSkills = new HashMap<>();
|
private Map<String, String> heroSkills = new HashMap<>();
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.ljsd.jieling.logic.expedition;
|
package com.ljsd.jieling.logic.expedition;
|
||||||
|
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.*;
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.PlayStaticConfig;
|
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.SArenaRobotStaticConfig;
|
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.WorldBossTreasureStaticConfig;
|
|
||||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||||
|
@ -12,6 +9,7 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
|
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||||
|
@ -38,6 +36,7 @@ import util.StringUtil;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +52,7 @@ public class ExpeditionLogic {
|
||||||
public static final int NODESTATE_NOT_GET = 2;//2未领取圣物
|
public static final int NODESTATE_NOT_GET = 2;//2未领取圣物
|
||||||
public static final int NODESTATE_PASS = 3;//已完成
|
public static final int NODESTATE_PASS = 3;//已完成
|
||||||
public static final int NODESTATE_OVER_PASS = 4;//已完成
|
public static final int NODESTATE_OVER_PASS = 4;//已完成
|
||||||
|
public static final int NODESTATE_HERO = 5;//招募节点
|
||||||
|
|
||||||
public static final int NODETYPE_ADVANCE = 1;//精英节点
|
public static final int NODETYPE_ADVANCE = 1;//精英节点
|
||||||
public static final int NODETYPE_BOSS = 2;//首领节点
|
public static final int NODETYPE_BOSS = 2;//首领节点
|
||||||
|
@ -97,19 +96,33 @@ public class ExpeditionLogic {
|
||||||
manager.clearPropertyItems();
|
manager.clearPropertyItems();
|
||||||
manager.getHeroHPWithChange().clear();
|
manager.getHeroHPWithChange().clear();
|
||||||
manager.setCurrentTime(openTimeOfFuntionCacheByType.getTimes());
|
manager.setCurrentTime(openTimeOfFuntionCacheByType.getTimes());
|
||||||
|
manager.clearHeroToTemp();
|
||||||
|
manager.clearEquipToTemp();
|
||||||
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
// checkAndResetTreasure(user);
|
// checkAndResetTreasure(user);
|
||||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Expedition.getFunctionType());
|
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Expedition.getFunctionType());
|
||||||
Expedition.ExpeditionResetIndication.Builder builder = Expedition.ExpeditionResetIndication.newBuilder();
|
|
||||||
|
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
||||||
|
if(sExpeditionSetting == null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
Expedition.GetExpeditionResponse.Builder builder = Expedition.GetExpeditionResponse.newBuilder();
|
||||||
|
if(manager.getExpeditionNodeInfos().size()==0){
|
||||||
|
manager.setExpeditionLeve(1);
|
||||||
|
manager.setLay(1);
|
||||||
|
manager.setSortid(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
|
if (HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
|
||||||
builder.addAllRewardids(manager.getRewardBox());
|
builder.addAllLay(manager.getRewardBox());
|
||||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user));
|
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user));
|
||||||
builder.addAllNodeInfo(ExpeditionLogic.getInstance().getNodeInfo(user));
|
builder.addAllNodeInfo(ExpeditionLogic.getInstance().getNodeInfo(user));
|
||||||
builder.addAllEquipIds(ExpeditionLogic.getInstance().getEquipnfo(user));
|
builder.addAllEquipIds(ExpeditionLogic.getInstance().getEquipnfo(user));
|
||||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
builder.addAllHeroList(new ArrayList<>());
|
||||||
//猎妖添加的英雄
|
builder.addAllEquip(new ArrayList<>());
|
||||||
Set<String> collect= heroMap.values().stream().filter(hero -> hero.getCreateType() == 1).map(Hero::getId).collect(Collectors.toSet());
|
builder.addAllEquip(new ArrayList<>());
|
||||||
builder.addAllRemovesHeroIds(collect);
|
|
||||||
}
|
}
|
||||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.ExpeditionResetIndication.getNumber(), builder.build(), true);
|
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.ExpeditionResetIndication.getNumber(), builder.build(), true);
|
||||||
// reSetNode(user);
|
// reSetNode(user);
|
||||||
|
@ -138,7 +151,6 @@ public class ExpeditionLogic {
|
||||||
|
|
||||||
String mailReward = ItemUtil.getMailReward(itemArrs);
|
String mailReward = ItemUtil.getMailReward(itemArrs);
|
||||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||||
//TODO title content 走配置
|
|
||||||
String title = SErrorCodeEerverConfig.getI18NMessage("expedition_title");
|
String title = SErrorCodeEerverConfig.getI18NMessage("expedition_title");
|
||||||
String content = SErrorCodeEerverConfig.getI18NMessage("expedition_txt",new Object[]{user.getExpeditionManager().getLay()-1});
|
String content = SErrorCodeEerverConfig.getI18NMessage("expedition_txt",new Object[]{user.getExpeditionManager().getLay()-1});
|
||||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||||
|
@ -194,18 +206,21 @@ public class ExpeditionLogic {
|
||||||
|
|
||||||
public Set<CommonProto.ExpeditionSimpleHeroInfo> getAllHeroInfo(User user, Set<String> set) {
|
public Set<CommonProto.ExpeditionSimpleHeroInfo> getAllHeroInfo(User user, Set<String> set) {
|
||||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||||
|
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMap();
|
||||||
//生成新英雄的血量信息
|
//生成新英雄的血量信息
|
||||||
Map<String, Double> heroHP = user.getExpeditionManager().getHeroHPWithChange();
|
Map<String, Double> heroHP = user.getExpeditionManager().getHeroHPWithChange();
|
||||||
for (Map.Entry<String, Hero> entry : heroMap.entrySet()) {
|
for (Map.Entry<String, Hero> entry : heroMap.entrySet()) {
|
||||||
if (!heroHP.keySet().contains(entry.getKey())) {
|
if (!heroHP.keySet().contains(entry.getKey())&&!heroMapTemp.keySet().contains(entry.getKey())) {
|
||||||
heroHP.put(entry.getKey(), 1d);
|
heroHP.put(entry.getKey(), 1d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//移除已经删除的hero
|
//移除已经删除的hero
|
||||||
Set<String> removeId = heroHP.keySet().stream().filter(k -> {
|
Set<String> removeId = heroHP.keySet().stream().filter(k -> {
|
||||||
if(!heroMap.keySet().contains(k))
|
if(heroMap.keySet().contains(k))
|
||||||
return true;
|
return heroMap.get(k).getLevel()<20;
|
||||||
return heroMap.get(k).getLevel()<20;
|
if(heroMapTemp.keySet().contains(k))
|
||||||
|
return heroMapTemp.get(k).getLevel()<20;
|
||||||
|
return !heroMap.keySet().contains(k) && !heroMapTemp.keySet().contains(k);
|
||||||
}).collect(Collectors.toSet());
|
}).collect(Collectors.toSet());
|
||||||
removeId.forEach(heroHP::remove);
|
removeId.forEach(heroHP::remove);
|
||||||
Set<CommonProto.ExpeditionSimpleHeroInfo> heroInfoSet = new HashSet<>();
|
Set<CommonProto.ExpeditionSimpleHeroInfo> heroInfoSet = new HashSet<>();
|
||||||
|
@ -336,7 +351,7 @@ public class ExpeditionLogic {
|
||||||
int orDefault = STableManager.getFigureConfig(CommonStaticConfig.class).leve2num.getOrDefault(leve-1, 0)-1;//节点
|
int orDefault = STableManager.getFigureConfig(CommonStaticConfig.class).leve2num.getOrDefault(leve-1, 0)-1;//节点
|
||||||
|
|
||||||
Map<Integer,Set<Integer>> map = new HashMap<>();
|
Map<Integer,Set<Integer>> map = new HashMap<>();
|
||||||
for (Map.Entry<Integer, Map<Integer,Integer>> integerMapMap :STableManager.getFigureConfig(CommonStaticConfig.class).getType2lay2weight().entrySet()){
|
for (Map.Entry<Integer, Map<Integer,Integer>> integerMapMap :STableManager.getFigureConfig(CommonStaticConfig.class).getType2lay2weight(leve).entrySet()){
|
||||||
int type = integerMapMap.getKey();
|
int type = integerMapMap.getKey();
|
||||||
int lay = ranndomFromWeight(integerMapMap.getValue());
|
int lay = ranndomFromWeight(integerMapMap.getValue());
|
||||||
Set<Integer> value = map.getOrDefault(lay,new HashSet<>());
|
Set<Integer> value = map.getOrDefault(lay,new HashSet<>());
|
||||||
|
@ -578,11 +593,26 @@ public class ExpeditionLogic {
|
||||||
}
|
}
|
||||||
//grop config
|
//grop config
|
||||||
int i = sExpeditionRecruitConfig.getHeroId();
|
int i = sExpeditionRecruitConfig.getHeroId();
|
||||||
|
|
||||||
SnapFightInfo fightInfo = new SnapFightInfo();
|
SnapFightInfo fightInfo = new SnapFightInfo();
|
||||||
|
|
||||||
fightInfo.setUid(i);
|
fightInfo.setUid(i);
|
||||||
int force = MonsterUtil.getMonsterForce(new int[]{i});
|
int force = MonsterUtil.getMonsterForce(new int[]{i});
|
||||||
Map<String, Double> bossHP = new HashMap<>();
|
Map<String, Double> bossHP = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, FamilyHeroInfo> heroAllAttribute = new HashMap<>();
|
||||||
|
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(i);
|
||||||
|
int[][] groupIds = sMonsterGroup.getContents();
|
||||||
|
|
||||||
|
int[] monsterIds = groupIds[0];
|
||||||
|
|
||||||
|
for (int monsterId : monsterIds) {
|
||||||
|
if(monsterId!=0){
|
||||||
|
bossHP.put(Integer.toString(monsterId), 1d);
|
||||||
|
heroAllAttribute.put(Integer.toString(monsterId), new FamilyHeroInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||||
fightInfo.setForce(force);
|
fightInfo.setForce(force);
|
||||||
nodeInfo.setBossHP(bossHP);
|
nodeInfo.setBossHP(bossHP);
|
||||||
fightInfo.setPokenmonSkills("");
|
fightInfo.setPokenmonSkills("");
|
||||||
|
@ -779,8 +809,8 @@ public class ExpeditionLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Hero createHero(int tempid,int uid,Hero hero)throws Exception{
|
public static Hero createHero(int tempid,int uid,Hero hero,boolean isTemp)throws Exception{
|
||||||
int star = hero.getStar();
|
int star = hero.getLevel();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
||||||
if (sExpeditionSetting == null) {
|
if (sExpeditionSetting == null) {
|
||||||
|
@ -790,7 +820,9 @@ public class ExpeditionLogic {
|
||||||
int min = sExpeditionSetting.getMatchForceRange()[0];
|
int min = sExpeditionSetting.getMatchForceRange()[0];
|
||||||
int max= sExpeditionSetting.getMatchForceRange()[1];
|
int max= sExpeditionSetting.getMatchForceRange()[1];
|
||||||
int finalstar = (int) (star * ((min / 10000f) + ((float) (Math.random() *(max - min))/10000f)));
|
int finalstar = (int) (star * ((min / 10000f) + ((float) (Math.random() *(max - min))/10000f)));
|
||||||
|
if(finalstar<=20){
|
||||||
|
finalstar=50;
|
||||||
|
}
|
||||||
//random tempid
|
//random tempid
|
||||||
Hero newHero = new Hero(uid,tempid,finalstar,hero);
|
Hero newHero = new Hero(uid,tempid,finalstar,hero);
|
||||||
|
|
||||||
|
@ -802,7 +834,12 @@ public class ExpeditionLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Equip newequip = new Equip(uid, equip.getEquipId());
|
Equip newequip = new Equip(uid, equip.getEquipId());
|
||||||
user.getExpeditionManager().addEquip(user, newequip);
|
if(isTemp){
|
||||||
|
user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||||
|
}else {
|
||||||
|
user.getExpeditionManager().addEquip(user, newequip);
|
||||||
|
}
|
||||||
|
|
||||||
newHero.updateEquipPositionMap(next.getKey(), newequip.getId());
|
newHero.updateEquipPositionMap(next.getKey(), newequip.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,10 +851,19 @@ public class ExpeditionLogic {
|
||||||
continue;
|
continue;
|
||||||
Jewel j = (Jewel) propertyItem;
|
Jewel j = (Jewel) propertyItem;
|
||||||
Jewel newequip = new Jewel(user.getId(), j.getEquipId());
|
Jewel newequip = new Jewel(user.getId(), j.getEquipId());
|
||||||
user.getExpeditionManager().addEquip(user, newequip);
|
|
||||||
|
if(isTemp){
|
||||||
|
user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||||
|
}else {
|
||||||
|
user.getExpeditionManager().addEquip(user, newequip);
|
||||||
|
}
|
||||||
newHero.addJewel(newequip.getId());
|
newHero.addJewel(newequip.getId());
|
||||||
}
|
}
|
||||||
user.getExpeditionManager().addHero(newHero);
|
if(isTemp){
|
||||||
|
user.getExpeditionManager().addHeroToTemp(newHero);
|
||||||
|
}else {
|
||||||
|
user.getExpeditionManager().addHero(newHero);
|
||||||
|
}
|
||||||
return newHero;
|
return newHero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,12 +914,12 @@ public class ExpeditionLogic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommonProto.FightTeamInfo getGropFightTeamInfoWithDouble(int gropid, Map<String, Double> attackBloodMap) {
|
public static List<CommonProto.FightTeamInfo> getGropFightTeamInfoWithDouble(int gropid, Map<String, Double> attackBloodMap) {
|
||||||
Map<Integer,List<Double>> hps = new HashMap<>();
|
Map<Integer,List<Double>> hps = new HashMap<>();
|
||||||
hps.put(0,new LinkedList<>(attackBloodMap.values()));
|
hps.put(0,new LinkedList<>(attackBloodMap.values()));
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(gropid, hps);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(gropid, hps);
|
||||||
String monsterTeamSkill = MonsterUtil.getMonsterTeamSkillByGroup(gropid);
|
List<CommonProto.FightTeamInfo> fightTeamInfos = BehaviorUtil.getFightTeamInfos(gropid, monsterByGroupWithDouble, Global.MONSTER_1);
|
||||||
return CommonProto.FightTeamInfo.newBuilder().addAllFightUnitList(monsterByGroupWithDouble.get(0)).setTeamSkillList(monsterTeamSkill).build();
|
return fightTeamInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,12 @@ public class CombatLogic {
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
List<Integer> passiveTeamskillEffect = new ArrayList<>();
|
List<Integer> passiveTeamskillEffect = new ArrayList<>();
|
||||||
for(TeamPosHeroInfo teamPosHeroInfo :teamPosHeroInfos){
|
for(TeamPosHeroInfo teamPosHeroInfo :teamPosHeroInfos){
|
||||||
Hero hero = heroMap.get(teamPosHeroInfo.getHeroId());
|
Hero hero;
|
||||||
|
if(teamId==GlobalsDef.EXPEDITION_TEAM&&user.getExpeditionManager().getHeroMap().containsKey(teamPosHeroInfo.getHeroId())){
|
||||||
|
hero = user.getExpeditionManager().getHeroMap().get(teamPosHeroInfo.getHeroId());
|
||||||
|
}else {
|
||||||
|
hero = heroMap.get(teamPosHeroInfo.getHeroId());
|
||||||
|
}
|
||||||
List<Integer> heroSkillListTmp = HeroLogic.getInstance().getHeroSkillList(user, hero);
|
List<Integer> heroSkillListTmp = HeroLogic.getInstance().getHeroSkillList(user, hero);
|
||||||
heroSkillListTmp.forEach(skill->{
|
heroSkillListTmp.forEach(skill->{
|
||||||
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
|
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
|
||||||
|
@ -801,6 +806,10 @@ public class CombatLogic {
|
||||||
//找出上场的Id
|
//找出上场的Id
|
||||||
List<Integer> heroFind = new ArrayList<>(teamPosHeroInfos.size());
|
List<Integer> heroFind = new ArrayList<>(teamPosHeroInfos.size());
|
||||||
for(TeamPosHeroInfo key :teamPosHeroInfos){
|
for(TeamPosHeroInfo key :teamPosHeroInfos){
|
||||||
|
if(teamId==GlobalsDef.EXPEDITION_TEAM&&user.getExpeditionManager().getHeroMap().containsKey(key.getHeroId())){
|
||||||
|
heroFind.add(user.getExpeditionManager().getHeroMap().get(key.getHeroId()).getTemplateId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
heroFind.add(heroMap.get(key.getHeroId()).getTemplateId());
|
heroFind.add(heroMap.get(key.getHeroId()).getTemplateId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,7 +468,21 @@ public class HeroLogic{
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
HeroManager heroManager = user.getHeroManager();
|
HeroManager heroManager = user.getHeroManager();
|
||||||
Set<Integer> set = new HashSet<>();
|
Set<Integer> set = new HashSet<>();
|
||||||
heroIds.forEach(heroId->set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId()));
|
if(teamId==GlobalsDef.EXPEDITION_TEAM){
|
||||||
|
|
||||||
|
heroIds.forEach(heroId->{
|
||||||
|
if(heroManager.getHeroMap().containsKey(heroId.getHeroId())){
|
||||||
|
set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId());
|
||||||
|
}
|
||||||
|
if(user.getExpeditionManager().getHeroMap().containsKey(heroId.getHeroId())){
|
||||||
|
set.add(user.getExpeditionManager().getHero(heroId.getHeroId()).getTemplateId());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
heroIds.forEach(heroId->set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId()));
|
||||||
|
}
|
||||||
|
|
||||||
if(set.size()!=heroIds.size()){
|
if(set.size()!=heroIds.size()){
|
||||||
throw new ErrorCodeException(ErrorCode.NO_USE_SAME_HERO);
|
throw new ErrorCodeException(ErrorCode.NO_USE_SAME_HERO);
|
||||||
}
|
}
|
||||||
|
@ -537,10 +551,18 @@ public class HeroLogic{
|
||||||
Set<String> cacheHeroIds = new HashSet<>();
|
Set<String> cacheHeroIds = new HashSet<>();
|
||||||
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
|
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
|
||||||
String heroId = teamHeroInfo.getHeroId();
|
String heroId = teamHeroInfo.getHeroId();
|
||||||
if(user.getHeroManager().getHero(heroId) == null) {
|
if(teamId==GlobalsDef.EXPEDITION_TEAM){
|
||||||
// 卡牌不存在
|
if(user.getHeroManager().getHero(heroId) == null&&!user.getExpeditionManager().getHeroMap().containsKey(heroId)) {
|
||||||
return "card not exists";
|
// 卡牌不存在
|
||||||
|
return "card not exists";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(user.getHeroManager().getHero(heroId) == null) {
|
||||||
|
// 卡牌不存在
|
||||||
|
return "card not exists";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 卡牌重复 卡牌已上阵
|
// 卡牌重复 卡牌已上阵
|
||||||
if(cacheHeroIds.contains(heroId)){
|
if(cacheHeroIds.contains(heroId)){
|
||||||
return "card repeated";
|
return "card repeated";
|
||||||
|
@ -974,7 +996,10 @@ public class HeroLogic{
|
||||||
public List<Integer> getHeroSkillList(User user,Hero hero){
|
public List<Integer> getHeroSkillList(User user,Hero hero){
|
||||||
List<Integer> skillList = new ArrayList<>();
|
List<Integer> skillList = new ArrayList<>();
|
||||||
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
|
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||||
skillList.addAll(tempHero.getSkillListByStar(hero.getStar()));
|
List<Integer> skillListByStar = tempHero.getSkillListByStar(hero.getStar());
|
||||||
|
if(skillListByStar!=null){
|
||||||
|
skillList.addAll(skillListByStar);
|
||||||
|
}
|
||||||
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
|
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
|
||||||
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
|
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ public class SGlobalSystemConfig implements BaseConfig {
|
||||||
|
|
||||||
private int isIDdSame;
|
private int isIDdSame;
|
||||||
|
|
||||||
|
private int guideId;
|
||||||
|
|
||||||
public static Map<Integer, List<Integer>> idsByType;
|
public static Map<Integer, List<Integer>> idsByType;
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue