大闹天宫改活动
parent
710ad4c35d
commit
c297f5184a
|
@ -15,12 +15,10 @@ import com.ljsd.jieling.util.CBean2Proto;
|
||||||
import config.SExpeditionNodeConfig;
|
import config.SExpeditionNodeConfig;
|
||||||
import config.SExpeditionRecruitConfig;
|
import config.SExpeditionRecruitConfig;
|
||||||
import config.SExpeditionSetting;
|
import config.SExpeditionSetting;
|
||||||
import config.SRobotProperty;
|
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import rpc.protocols.Expedition;
|
import rpc.protocols.Expedition;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
import util.StringUtil;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -72,7 +70,7 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
// 获取英雄池id
|
// 获取英雄池id
|
||||||
int poolId = sExpeditionNodeConfig.getPoolId();
|
int poolId = sExpeditionNodeConfig.getPoolId();
|
||||||
// 从池中随机指定数量的英雄模板
|
// 从池中随机指定数量的英雄模板
|
||||||
TreeSet<Integer> randomTid = ExpeditionLogic.getRandomTid(poolId, recruitTime);
|
TreeSet<Integer> randomTid = ExpeditionLogic.getInstance().getRandomTid(poolId, recruitTime);
|
||||||
|
|
||||||
//获取最高等级英雄
|
//获取最高等级英雄
|
||||||
Hero hero = HeroLogic.getHeroByMaxLevel(user);
|
Hero hero = HeroLogic.getHeroByMaxLevel(user);
|
||||||
|
|
|
@ -247,7 +247,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
|
||||||
|
|
||||||
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
||||||
int poolId = sExpeditionNodeConfig.getPoolId();
|
int poolId = sExpeditionNodeConfig.getPoolId();
|
||||||
int tempId =ExpeditionLogic.getRandomTid(poolId,1).first();
|
int tempId =ExpeditionLogic.getInstance().getRandomTid(poolId,1).first();
|
||||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
|
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
|
||||||
if(sExpeditionRecruitConfig==null) {
|
if(sExpeditionRecruitConfig==null) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
|
|
@ -118,7 +118,7 @@ public enum ActivityTypeEnum {
|
||||||
FABAO_BOOK_REWARD(ActivityType.FABAO_BOOK_REWARD,FabaoBookRewardActivity::new),//法宝图鉴宝箱
|
FABAO_BOOK_REWARD(ActivityType.FABAO_BOOK_REWARD,FabaoBookRewardActivity::new),//法宝图鉴宝箱
|
||||||
DRAW_FABAO_LV_CHEST(ActivityType.DRAW_FABAO_LV_CHEST,DrawLvChestActivity::new),//抽卡等级宝箱
|
DRAW_FABAO_LV_CHEST(ActivityType.DRAW_FABAO_LV_CHEST,DrawLvChestActivity::new),//抽卡等级宝箱
|
||||||
TIAN_JIANG_GIFT(ActivityType.TIAN_JIANG_GIFT,DefaultEmptyActivity::new),//抽卡等级宝箱
|
TIAN_JIANG_GIFT(ActivityType.TIAN_JIANG_GIFT,DefaultEmptyActivity::new),//抽卡等级宝箱
|
||||||
DA_NAO_TIAN_GONG(ActivityType.DA_NAO_TIAN_GONG, DaNaoTianGongActivity::new),//大闹天宫
|
DA_NAO_TIAN_GONG(ActivityType.DA_NAO_TIAN_GONG, ExpeditionActivity::new),//大闹天宫
|
||||||
LINGLONG_BAOJING_TASK(ActivityType.LINGLONG_BAOJING_TASK, DefaultEmptyActivity::new),//玲珑宝镜任务
|
LINGLONG_BAOJING_TASK(ActivityType.LINGLONG_BAOJING_TASK, DefaultEmptyActivity::new),//玲珑宝镜任务
|
||||||
|
|
||||||
/****************************************************** bt **********************************************************/
|
/****************************************************** bt **********************************************************/
|
||||||
|
|
|
@ -14,16 +14,20 @@ 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.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SExpeditionDaily;
|
||||||
import config.SSpecialConfig;
|
import config.SSpecialConfig;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import rpc.protocols.PlayerInfoProto;
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class DaNaoTianGongActivity extends AbstractActivity{
|
public class ExpeditionActivity extends AbstractActivity{
|
||||||
|
|
||||||
public DaNaoTianGongActivity(int id) {
|
public ExpeditionActivity(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
Poster.getPoster().listenEvent(this, ZeroRefreshEvent.class);
|
Poster.getPoster().listenEvent(this, ZeroRefreshEvent.class);
|
||||||
}
|
}
|
||||||
|
@ -51,8 +55,41 @@ public class DaNaoTianGongActivity extends AbstractActivity{
|
||||||
refresh(user);
|
refresh(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh(User user){
|
/**
|
||||||
|
* 获取天数
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getDay(User user){
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if (mission == null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return TimeUtils.differentDays(mission.getCreatTime(), TimeUtils.now()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新
|
||||||
|
* @param user
|
||||||
|
*/
|
||||||
|
private void refresh(User user){
|
||||||
|
int day = getDay(user);
|
||||||
|
SExpeditionDaily daily = SExpeditionDaily.map.get(day);
|
||||||
|
if (daily == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if (mission == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Integer, ActivityProgressInfo> missionMap = mission.getActivityMissionMap();
|
||||||
|
missionMap.clear();
|
||||||
|
Set<Integer> randomHoly = ExpeditionLogic.getInstance().getRandomHoly(user,5,daily.getHolyProbability());
|
||||||
|
for (Integer holy : randomHoly) {
|
||||||
|
ActivityProgressInfo info = new ActivityProgressInfo();
|
||||||
|
info.setProgrss(holy);
|
||||||
|
missionMap.put(holy,info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,7 +105,8 @@ public class DaNaoTianGongActivity extends AbstractActivity{
|
||||||
throw new ErrorCodeException(ErrorCode.HAD_TAKE_REWARD, format);
|
throw new ErrorCodeException(ErrorCode.HAD_TAKE_REWARD, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndSetProgress(mission,missionId,ActivityType.HAD_TAKED);
|
// 领取并更新状态
|
||||||
|
checkAndSetProgress(session,missionId,ActivityType.HAD_TAKED);
|
||||||
|
|
||||||
int[] value = SSpecialConfig.getOnceArrayValue("Danaotiangong_daily_reward");
|
int[] value = SSpecialConfig.getOnceArrayValue("Danaotiangong_daily_reward");
|
||||||
int[][] reward = {value};
|
int[][] reward = {value};
|
||||||
|
@ -87,15 +125,19 @@ public class DaNaoTianGongActivity extends AbstractActivity{
|
||||||
/**
|
/**
|
||||||
* 领奖后更新奖励进度
|
* 领奖后更新奖励进度
|
||||||
*/
|
*/
|
||||||
public void checkAndSetProgress(ActivityMission activityMission, int missionId, int state) {
|
public void checkAndSetProgress(ISession session, int missionId, int state) throws Exception {
|
||||||
|
ExpeditionLogic.getInstance().takeHoly(session, missionId);
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
|
||||||
ActivityProgressInfo progressInfo = new ActivityProgressInfo();
|
ActivityProgressInfo progressInfo = new ActivityProgressInfo();
|
||||||
|
progressInfo.setProgrss(missionId);
|
||||||
progressInfo.setState(state);
|
progressInfo.setState(state);
|
||||||
activityMission.getActivityMissionMap().put(missionId, progressInfo);
|
|
||||||
activityMission.setV(1);
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
mission.getActivityMissionMap().put(missionId, progressInfo);
|
||||||
|
mission.setV(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||||
return false;
|
return false;
|
|
@ -1,19 +1,25 @@
|
||||||
package com.ljsd.jieling.logic.expedition;
|
package com.ljsd.jieling.logic.expedition;
|
||||||
|
|
||||||
import com.ljsd.fight.FamilyHeroInfo;
|
import com.ljsd.fight.FamilyHeroInfo;
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
|
||||||
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.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.ExpeditionNodeInfo;
|
||||||
|
import com.ljsd.jieling.logic.dao.SnapFightInfo;
|
||||||
|
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.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.rank.RankLogic;
|
import com.ljsd.jieling.logic.rank.RankLogic;
|
||||||
import config.*;
|
import config.SExpeditionFloorConfig;
|
||||||
|
import config.SExpeditionSetting;
|
||||||
|
import config.SRobotProperty;
|
||||||
|
import config.SRobotSkill;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import util.MathUtils;
|
|
||||||
import util.StringUtil;
|
import util.StringUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 战斗节点
|
* 战斗节点
|
||||||
|
@ -33,7 +39,7 @@ public class BattleNode extends AbstractExpedition {
|
||||||
SExpeditionFloorConfig config = STableManager.getConfig(SExpeditionFloorConfig.class).get(index);
|
SExpeditionFloorConfig config = STableManager.getConfig(SExpeditionFloorConfig.class).get(index);
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
|
||||||
nodeHolyInfo(user,type,config,nodeInfo);
|
nodeHolyInfo(user, config,nodeInfo);
|
||||||
|
|
||||||
nodeFightInfo(user,leve,nodeInfo);
|
nodeFightInfo(user,leve,nodeInfo);
|
||||||
|
|
||||||
|
@ -60,8 +66,9 @@ public class BattleNode extends AbstractExpedition {
|
||||||
// 万分比
|
// 万分比
|
||||||
double base = 10000d;
|
double base = 10000d;
|
||||||
// 上下浮动值
|
// 上下浮动值
|
||||||
double min = sExpeditionSetting.getMatchForce()[leve-1][0]/base;
|
int[][] matchForce = sExpeditionSetting.getMatchForce();
|
||||||
double max = sExpeditionSetting.getMatchForce()[leve-1][1]/base;
|
double min = matchForce[leve-1][0]/base;
|
||||||
|
double max = matchForce[leve-1][1]/base;
|
||||||
// 初始等级,前六名平均等级
|
// 初始等级,前六名平均等级
|
||||||
int averageLevel = HeroLogic.getInstance().getAverageLevel(user, 6);
|
int averageLevel = HeroLogic.getInstance().getAverageLevel(user, 6);
|
||||||
// 第一次计算,随机出来机器人等级,(【向上取整】基础等级 *(最低浮动 + (当前节点位置 / 总层数 *(最高浮动-最低浮动))))
|
// 第一次计算,随机出来机器人等级,(【向上取整】基础等级 *(最低浮动 + (当前节点位置 / 总层数 *(最高浮动-最低浮动))))
|
||||||
|
@ -88,36 +95,12 @@ public class BattleNode extends AbstractExpedition {
|
||||||
/**
|
/**
|
||||||
* 节点圣物信息
|
* 节点圣物信息
|
||||||
* @param user
|
* @param user
|
||||||
* @param type
|
|
||||||
* @param cfg
|
* @param cfg
|
||||||
* @param nodeInfo
|
* @param nodeInfo
|
||||||
*/
|
*/
|
||||||
private void nodeHolyInfo(User user, int type, SExpeditionFloorConfig cfg, ExpeditionNodeInfo nodeInfo){
|
private void nodeHolyInfo(User user, SExpeditionFloorConfig cfg, ExpeditionNodeInfo nodeInfo){
|
||||||
Set<Integer> staffsSet = new HashSet<>();
|
Set<Integer> randomHoly = ExpeditionLogic.getInstance().getRandomHoly(user,type,cfg.getHolyProbability());
|
||||||
while (staffsSet.size()<3){
|
nodeInfo.setHolyEquipId(randomHoly);
|
||||||
int[][] probability = cfg.getHolyProbability();
|
|
||||||
int[][] holyProbability = new int[probability.length][2];
|
|
||||||
for(int j = 0; j < holyProbability.length; j++){
|
|
||||||
System.arraycopy(probability[j], 0, holyProbability[j], 0, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(type);
|
|
||||||
if(null!=sExpeditionNodeConfig && sExpeditionNodeConfig.getHolyProbability().length==3){
|
|
||||||
for (int j = 0; j <holyProbability.length ; j++) {
|
|
||||||
holyProbability[j][1]+= sExpeditionNodeConfig.getHolyProbability()[j][1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int ints;
|
|
||||||
try {
|
|
||||||
ints = MathUtils.randomFromWeight(holyProbability);
|
|
||||||
}catch (Exception e){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Map<Integer, Integer> type2holy2weight = getType2holy2weightRemoveHas(user, ints);
|
|
||||||
int i1 = ExpeditionLogic.ranndomFromWeight(type2holy2weight);
|
|
||||||
staffsSet.add(i1);
|
|
||||||
}
|
|
||||||
nodeInfo.setHolyEquipId(staffsSet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,77 +195,4 @@ public class BattleNode extends AbstractExpedition {
|
||||||
|
|
||||||
nodeInfo.setBossHP(bossHP);
|
nodeInfo.setBossHP(bossHP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取不重复得圣物
|
|
||||||
* @param user
|
|
||||||
* @param type
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<Integer, Integer> getType2holy2weightRemoveHas(User user, int type) {
|
|
||||||
// 策划表的圣物,因为会有删除操作,所以需要重新赋值,而不是直接引用
|
|
||||||
Map<Integer, Integer> weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(type);
|
|
||||||
if (weight == null){
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
Map<Integer, Integer> valueMap = new HashMap<>(weight);
|
|
||||||
ExpeditionManager expeditionManager = user.getExpeditionManager();
|
|
||||||
// 已拥有的圣物
|
|
||||||
Set<ExpeditionItem> items = expeditionManager.getPropertyItems();
|
|
||||||
Set<Integer> ids = new HashSet<>();
|
|
||||||
items.forEach(id->ids.add(id.getEquipId()));
|
|
||||||
|
|
||||||
// 大闹天宫临时英雄
|
|
||||||
Map<String, Hero> expeditonHeroMap = expeditionManager.getHeroMap();
|
|
||||||
Set<Integer> expeditonHeroIds = new HashSet<>();
|
|
||||||
expeditonHeroMap.values().forEach(v->expeditonHeroIds.add(v.getTemplateId()));
|
|
||||||
expeditonHeroIds.addAll(expeditionManager.getGHeroSet());
|
|
||||||
|
|
||||||
// 已生成得节点圣物信息
|
|
||||||
Set<Integer> nodeHolyInfo = getNodeHolyInfo(user);
|
|
||||||
|
|
||||||
// 因为有删除操作,所以使用iterator遍历
|
|
||||||
Iterator<Integer> iterator = valueMap.keySet().iterator();
|
|
||||||
while (iterator.hasNext()){
|
|
||||||
Integer v = iterator.next();
|
|
||||||
|
|
||||||
SExpeditionHolyConfig holyConfig = STableManager.getConfig(SExpeditionHolyConfig.class).get(v);
|
|
||||||
// 重复圣物
|
|
||||||
if (ids.contains(v) && holyConfig.getCanRepeat() == 0){
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 不存在的英雄,专属圣物
|
|
||||||
if (holyConfig.getHeroId() != 0){
|
|
||||||
if (!expeditonHeroIds.contains(holyConfig.getHeroId())){
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 已经生成过得圣物
|
|
||||||
if(nodeHolyInfo.contains(v)){
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return valueMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取全部节点得圣物信息
|
|
||||||
* @param user
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static Set<Integer> getNodeHolyInfo(User user){
|
|
||||||
Set<Integer> set = new HashSet<>();
|
|
||||||
// 以生成得节点信息,非空验证
|
|
||||||
Collection<ExpeditionNodeInfo> values = user.getExpeditionManager().getExpeditionNodeInfos().values();
|
|
||||||
if (values.size() <= 0){
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
// 聚合操作,首先排除不存在圣物得节点,然后循环添加剩余节点圣物
|
|
||||||
values.stream()
|
|
||||||
.filter(val->val.getHolyEquipId() != null && val.getHolyEquipId().size() > 0)
|
|
||||||
.forEach(val->set.addAll(val.getHolyEquipId()));
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,8 +699,112 @@ public class ExpeditionLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机圣遗物buff
|
||||||
|
* @param user
|
||||||
|
* @param probability
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Set<Integer> getRandomHoly(User user,int type, int[][] probability){
|
||||||
|
Set<Integer> staffsSet = new HashSet<>();
|
||||||
|
while (staffsSet.size()<3){
|
||||||
|
int[][] holyProbability = new int[probability.length][2];
|
||||||
|
for(int j = 0; j < holyProbability.length; j++){
|
||||||
|
System.arraycopy(probability[j], 0, holyProbability[j], 0, 2);
|
||||||
|
}
|
||||||
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(type);
|
||||||
|
if(null!=sExpeditionNodeConfig && sExpeditionNodeConfig.getHolyProbability().length==3){
|
||||||
|
for (int j = 0; j <holyProbability.length ; j++) {
|
||||||
|
holyProbability[j][1]+= sExpeditionNodeConfig.getHolyProbability()[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int ints;
|
||||||
|
try {
|
||||||
|
ints = MathUtils.randomFromWeight(holyProbability);
|
||||||
|
}catch (Exception e){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Map<Integer, Integer> type2holy2weight = getType2holy2weightRemoveHas(user, ints);
|
||||||
|
int i1 = ExpeditionLogic.ranndomFromWeight(type2holy2weight);
|
||||||
|
staffsSet.add(i1);
|
||||||
|
}
|
||||||
|
return staffsSet;
|
||||||
|
}
|
||||||
|
|
||||||
public static TreeSet<Integer> getRandomTid(int type,int size)throws ErrorCodeException{
|
/**
|
||||||
|
* 获取不重复得圣物
|
||||||
|
* @param user
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<Integer, Integer> getType2holy2weightRemoveHas(User user, int type) {
|
||||||
|
// 策划表的圣物,因为会有删除操作,所以需要重新赋值,而不是直接引用
|
||||||
|
Map<Integer, Integer> weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(type);
|
||||||
|
if (weight == null){
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
Map<Integer, Integer> valueMap = new HashMap<>(weight);
|
||||||
|
ExpeditionManager expeditionManager = user.getExpeditionManager();
|
||||||
|
// 已拥有的圣物
|
||||||
|
Set<ExpeditionItem> items = expeditionManager.getPropertyItems();
|
||||||
|
Set<Integer> ids = new HashSet<>();
|
||||||
|
items.forEach(id->ids.add(id.getEquipId()));
|
||||||
|
|
||||||
|
// 大闹天宫临时英雄
|
||||||
|
Map<String, Hero> expeditonHeroMap = expeditionManager.getHeroMap();
|
||||||
|
Set<Integer> expeditonHeroIds = new HashSet<>();
|
||||||
|
expeditonHeroMap.values().forEach(v->expeditonHeroIds.add(v.getTemplateId()));
|
||||||
|
expeditonHeroIds.addAll(expeditionManager.getGHeroSet());
|
||||||
|
|
||||||
|
// 已生成得节点圣物信息
|
||||||
|
Set<Integer> nodeHolyInfo = getNodeHolyInfo(user);
|
||||||
|
|
||||||
|
// 因为有删除操作,所以使用iterator遍历
|
||||||
|
Iterator<Integer> iterator = valueMap.keySet().iterator();
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
Integer v = iterator.next();
|
||||||
|
|
||||||
|
SExpeditionHolyConfig holyConfig = STableManager.getConfig(SExpeditionHolyConfig.class).get(v);
|
||||||
|
// 重复圣物
|
||||||
|
if (ids.contains(v) && holyConfig.getCanRepeat() == 0){
|
||||||
|
iterator.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 不存在的英雄,专属圣物
|
||||||
|
if (holyConfig.getHeroId() != 0){
|
||||||
|
if (!expeditonHeroIds.contains(holyConfig.getHeroId())){
|
||||||
|
iterator.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 已经生成过得圣物
|
||||||
|
if(nodeHolyInfo.contains(v)){
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部节点得圣物信息
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Set<Integer> getNodeHolyInfo(User user){
|
||||||
|
Set<Integer> set = new HashSet<>();
|
||||||
|
// 以生成得节点信息,非空验证
|
||||||
|
Collection<ExpeditionNodeInfo> values = user.getExpeditionManager().getExpeditionNodeInfos().values();
|
||||||
|
if (values.size() <= 0){
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
// 聚合操作,首先排除不存在圣物得节点,然后循环添加剩余节点圣物
|
||||||
|
values.stream()
|
||||||
|
.filter(val->val.getHolyEquipId() != null && val.getHolyEquipId().size() > 0)
|
||||||
|
.forEach(val->set.addAll(val.getHolyEquipId()));
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeSet<Integer> getRandomTid(int type,int size)throws ErrorCodeException{
|
||||||
|
|
||||||
//select collections
|
//select collections
|
||||||
Map<Integer, Integer> cfg = STableManager.getFigureConfig(CommonStaticConfig.class).type2Recruitcfgs.getOrDefault(type, new HashMap<>());
|
Map<Integer, Integer> cfg = STableManager.getFigureConfig(CommonStaticConfig.class).type2Recruitcfgs.getOrDefault(type, new HashMap<>());
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class SpecialNode extends AbstractExpedition {
|
||||||
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
||||||
int poolId = sExpeditionNodeConfig.getPoolId();
|
int poolId = sExpeditionNodeConfig.getPoolId();
|
||||||
SnapFightInfo fightInfo = new SnapFightInfo();
|
SnapFightInfo fightInfo = new SnapFightInfo();
|
||||||
int tempId =ExpeditionLogic.getRandomTid(poolId,1).first();
|
int tempId =ExpeditionLogic.getInstance().getRandomTid(poolId,1).first();
|
||||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
|
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(tempId);
|
||||||
if(sExpeditionRecruitConfig==null) {
|
if(sExpeditionRecruitConfig==null) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
|
|
@ -4,9 +4,7 @@ import com.ljsd.jieling.logic.dao.CumulationData;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||||
import com.ljsd.jieling.logic.mission.MissionState;
|
import com.ljsd.jieling.logic.mission.MissionState;
|
||||||
import config.SHomeLandTask;
|
|
||||||
import config.SThemeActivityTaskConfig;
|
import config.SThemeActivityTaskConfig;
|
||||||
import manager.STableManager;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -32,11 +30,6 @@ public class DonghaiXunxianMissionType extends AbstractMissionType {
|
||||||
return config.getIntegral();
|
return config.getIntegral();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getAllRewards(List<int[][]> itemAttrs){
|
|
||||||
super.getAllRewards(this, itemAttrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) throws Exception {
|
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) throws Exception {
|
||||||
// 进行中得任务
|
// 进行中得任务
|
||||||
|
|
Loading…
Reference in New Issue