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

70 lines
2.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
}
}