miduo_server/tablemanager/src/main/java/config/SWorldBossRewardConfig.java

70 lines
2.0 KiB
Java
Raw Normal View History

2020-05-07 16:31:28 +08:00
package config;
import manager.STableManager;
import manager.Table;
2020-05-09 11:39:57 +08:00
import util.StringUtil;
2020-05-07 16:31:28 +08:00
2020-05-09 11:39:57 +08:00
import java.util.HashMap;
2020-05-07 16:31:28 +08:00
import java.util.Map;
2020-05-09 11:39:57 +08:00
import java.util.TreeMap;
2020-05-07 16:31:28 +08:00
@Table(name ="WorldBossRewardConfig")
public class SWorldBossRewardConfig implements BaseConfig {
private int id;
private int[] section;
private int[][] reward;
2020-05-09 11:39:57 +08:00
private int type;
private int bossId;
2020-05-09 11:39:57 +08:00
/**
*
*/
public static Map<Integer,TreeMap<Integer,String>> rewardByTypeAndRankMap = new HashMap<>();
/**
* bossid
*/
public static Map<Integer,TreeMap<Integer, TreeMap<Integer,String>>> rewardByBossIdMap = new HashMap<>();
2020-05-07 16:31:28 +08:00
@Override
public void init() throws Exception {
2020-05-09 11:39:57 +08:00
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<>();
2020-05-09 11:39:57 +08:00
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()));
2020-05-09 11:39:57 +08:00
});
rewardByTypeAndRankMap = rewardByTypeAndRankMapTmp;
rewardByBossIdMap = rewardByBossIdMapTmp;
2020-05-07 16:31:28 +08:00
}
public int getId() {
2020-05-07 16:31:28 +08:00
return id;
}
public int[] getSection() {
return section;
}
public int[][] getReward() {
return reward;
}
2020-05-09 11:39:57 +08:00
public int getType() {
return type;
}
public int getBossId() {
return bossId;
}
2020-05-07 16:31:28 +08:00
}