70 lines
2.0 KiB
Java
70 lines
2.0 KiB
Java
package config;
|
||
|
||
import manager.STableManager;
|
||
import manager.Table;
|
||
import util.StringUtil;
|
||
|
||
import java.util.HashMap;
|
||
import java.util.Map;
|
||
import java.util.TreeMap;
|
||
|
||
@Table(name ="WorldBossRewardConfig")
|
||
public class SWorldBossRewardConfig implements BaseConfig {
|
||
|
||
private int id;
|
||
|
||
private int[] section;
|
||
|
||
private int[][] reward;
|
||
|
||
private int type;
|
||
|
||
private int bossId;
|
||
|
||
/**
|
||
* 类型,排名,奖励
|
||
*/
|
||
public static Map<Integer,TreeMap<Integer,String>> rewardByTypeAndRankMap = new HashMap<>();
|
||
/**
|
||
* boss索引id,类型,排名,奖励
|
||
*/
|
||
public static Map<Integer,TreeMap<Integer, TreeMap<Integer,String>>> rewardByBossIdMap = new HashMap<>();
|
||
|
||
@Override
|
||
public void init() throws Exception {
|
||
Map<Integer, SWorldBossRewardConfig> config = STableManager.getConfig(SWorldBossRewardConfig.class);
|
||
Map<Integer, TreeMap<Integer,String>> rewardByTypeAndRankMapTmp = new HashMap<>();
|
||
Map<Integer,TreeMap<Integer, TreeMap<Integer,String>>> rewardByBossIdMapTmp = new HashMap<>();
|
||
config.forEach((id,item)->{
|
||
rewardByTypeAndRankMapTmp.putIfAbsent(item.getType(),new TreeMap<>());
|
||
rewardByTypeAndRankMapTmp.get(item.getType()).put(item.getSection()[0], StringUtil.parseArrayToString(item.getReward()));
|
||
|
||
rewardByBossIdMapTmp.putIfAbsent(item.getBossId(),new TreeMap<>());
|
||
rewardByBossIdMapTmp.get(item.getBossId()).putIfAbsent(item.getType(),new TreeMap<>());
|
||
rewardByBossIdMapTmp.get(item.getBossId()).get(item.getType()).put(item.getSection()[0], StringUtil.parseArrayToString(item.getReward()));
|
||
});
|
||
|
||
rewardByTypeAndRankMap = rewardByTypeAndRankMapTmp;
|
||
rewardByBossIdMap = rewardByBossIdMapTmp;
|
||
}
|
||
|
||
public int getId() {
|
||
return id;
|
||
}
|
||
|
||
public int[] getSection() {
|
||
return section;
|
||
}
|
||
|
||
public int[][] getReward() {
|
||
return reward;
|
||
}
|
||
|
||
public int getType() {
|
||
return type;
|
||
}
|
||
|
||
public int getBossId() {
|
||
return bossId;
|
||
}
|
||
} |