Task【ID1005460】【玩法需求】猎妖之路

back_recharge
zhangshanxue 2020-02-20 16:40:08 +08:00
parent bd54aea85e
commit d902f1d34e
2 changed files with 43 additions and 8 deletions

View File

@ -35,7 +35,9 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
public Map<Integer, List<int[]>> matrixforGroupInfo;
public static Map<Integer, Map<Integer,Integer>> type2lay2weight;
public Map<Integer, Map<Integer,Integer>> type2lay2weight;
public Map<Integer,Map<Integer,Integer>> type2holy2weight;
@Override
public void registConfigs(Set<String> registConfigs) {
registConfigs.add(SGameSetting.class.getAnnotation(Table.class).name());
@ -206,6 +208,22 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
} catch (Exception e) {
LOGGER.error("SWorkShopTechnology init fail",e);
}
try {
type2holy2weight= new HashMap<>();
Map<Integer, SExpeditionHolyConfig> config = STableManager.getConfig(SExpeditionHolyConfig.class);
config.forEach((integer, sExpeditionHolyConfig) -> {
int holyid = sExpeditionHolyConfig.getId();
int type = sExpeditionHolyConfig.gettype();
Map<Integer, Integer> orDefault = type2holy2weight.getOrDefault(type, new HashMap<>());
orDefault.put(holyid, sExpeditionHolyConfig.getWeight());
type2holy2weight.put(type, orDefault);
});
} catch (Exception e) {
LOGGER.error("SWorkShopTechnology init fail",e);
}
}
@ -288,4 +306,12 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
}
return sWorkTechMapByTechIdAndLevelTmp.get(techId).get(level);
}
public Map<Integer, Map<Integer, Integer>> getType2lay2weight() {
return type2lay2weight;
}
public Map<Integer, Integer> getType2holy2weight(int type) {
return type2holy2weight.get(type);
}
}

View File

@ -98,7 +98,9 @@ public class ExpeditionLogic {
String mailReward = ItemUtil.getMailReward(itemArrs);
int nowTime = (int) (TimeUtils.now() / 1000);
//TODO title content 走配置
MailLogic.getInstance().sendMail(user.getId(), "title", "content", mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
String title = SErrorCodeEerverConfig.getI18NMessage("expedition_title");
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);
}
/**
@ -257,7 +259,7 @@ public class ExpeditionLogic {
int totalIndex = 1;
Set<ExpeditionNodeInfo> nodeSets = new HashSet<>();
Map<Integer,Set<Integer>> map = new HashMap<>();
for (Map.Entry<Integer, Map<Integer,Integer>> integerMapMap :CommonStaticConfig.type2lay2weight.entrySet()){
for (Map.Entry<Integer, Map<Integer,Integer>> integerMapMap :STableManager.getFigureConfig(CommonStaticConfig.class).getType2lay2weight().entrySet()){
int type = integerMapMap.getKey();
int lay = ranndomFromWeight(integerMapMap.getValue());
Set<Integer> value = map.getOrDefault(lay,new HashSet<>());
@ -350,12 +352,19 @@ public class ExpeditionLogic {
//生成圣物 設置
if (type == NODETYPE_ADVANCE || type == NODETYPE_BOSS || type == NODETYPE_NORMAL) {
if (cfg.getHolyProbability().length < 3) {
throw new ErrorCodeException(ErrorCode.newDefineCode("随机库配错"));
}
int[] ints = MathUtils.randomFromWeightWithTaking(cfg.getHolyProbability(), 3);
// if (cfg.getHolyProbability().length < 3) {
// throw new ErrorCodeException(ErrorCode.newDefineCode("随机库配错"));
// }
Set<Integer> staffsSet = new HashSet<>();
Arrays.stream(ints).forEach(staffsSet::add);
while (staffsSet.size()<3){
int ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
int i1 = ranndomFromWeight(type2holy2weight);
staffsSet.add(i1);
}
nodeInfo.setHolyEquipId(staffsSet);
}
nodeInfo.setState(NODESTATE_CLOSE);