抽卡获取同阵营修改

lvxinran 2021-07-02 18:22:35 +08:00
parent d6cf251701
commit 90f8cba220
2 changed files with 24 additions and 11 deletions

View File

@ -1608,15 +1608,16 @@ public class ActivityLogic implements IEventHandler{
int count = mission.getV();
// up奖励id
int upRewardId = mission.getChoiceRewardId();
// 排序权重map
Map<Integer, Integer> weight = new TreeMap<>(SWishActivityPool.weight);
// 常驻卡池
Map<Integer, SWishActivityPool> poolMap = SWishActivityPool.map;
// 根据活动获取本期得全部up信息
Map<Integer, int[]> up = SWishActivityUp.upMap.get(activityId);
// 根据玩家选取得up奖励id获取详细信息
int[] incs = up.get(upRewardId);
//拿到当前阵营
int camp = incs[3];
// 排序权重map
Map<Integer, Integer> weight = new TreeMap<>(SWishActivityPool.weight.get(camp));
// 常驻卡池
Map<Integer, SWishActivityPool> poolMap = SWishActivityPool.map;
// 讲up奖励id得权重加入到整个卡池权重中
weight.put(weight.size()+1,incs[2]);
// 计算总权重

View File

@ -3,9 +3,7 @@ package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.*;
@Table(name ="WishActivityPool")
public class SWishActivityPool implements BaseConfig {
@ -16,17 +14,29 @@ public class SWishActivityPool implements BaseConfig {
private int getRate;
public static Map<Integer,Integer> weight = new TreeMap<>();
private int camp;
public static Map<Integer,Map<Integer,Integer>> weight = new TreeMap<>();
public static Map<Integer,SWishActivityPool> map = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, SWishActivityPool> config = STableManager.getConfig(SWishActivityPool.class);
List<Integer> allCamp = new ArrayList<>(10);
Map<Integer,Map<Integer,Integer>> mapTemp = new HashMap<>();
config.values().forEach(v->{
map.put(v.getId(),v);
weight.put(v.getId(),v.getGetRate());
//weight修改成只有当前卡池和对应权重
if(v.getCamp()!=0){
mapTemp.putIfAbsent(v.getCamp(),new HashMap<>());
mapTemp.get(v.getCamp()).put(v.getId(),v.getGetRate());
}else{
allCamp.add(v.getId());
}
});
//把0权重的放进去
allCamp.forEach(i->mapTemp.forEach((k,v)->v.put(i,map.get(i).getGetRate())));
}
@ -42,5 +52,7 @@ public class SWishActivityPool implements BaseConfig {
return getRate;
}
public int getCamp() {
return camp;
}
}