package config; import manager.STableManager; import manager.Table; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; @Table(name ="VipLevelConfig") public class SVipLevelConfig implements BaseConfig { private static Map sVipLevelConfigMap; private static TreeMap money2vip ; private int vipLevel; private int[][] vipBoxDailyReward; private int[][] vipBoxReward; private int[] openRules; private int moneyLimit; private int[][] property; private int[][] reward; @Override public void init() throws Exception { Map config = STableManager.getConfig(SVipLevelConfig.class); money2vip = new TreeMap<>(); for(SVipLevelConfig sVipLevelConfig : config.values()){ money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel()); } sVipLevelConfigMap =config; } public static Map getsVipLevelConfigMap() { return sVipLevelConfigMap; } //根据钱返回当前特权等级 public static int getsVipLevel(int money) { Map.Entry entry = money2vip.ceilingEntry(money); if(null==entry){ return money2vip.lastEntry().getValue(); } return entry.getKey()==money?(entry.getValue()+1):entry.getValue(); } public int getVipLevel() { return vipLevel; } public int[][] getVipBoxReward() { return vipBoxReward; } public int[][] getVipBoxDailyReward() { return vipBoxDailyReward; } public int[] getOpenRules() { return openRules; } public int getMoneyLimit() { return moneyLimit; } public static TreeMap getMoney2vip() { return money2vip; } public int[][] getProperty() { return property; } public int[][] getReward() { return reward; } }