82 lines
1.9 KiB
Java
82 lines
1.9 KiB
Java
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<Integer, SVipLevelConfig> sVipLevelConfigMap;
|
|
private static TreeMap<Integer,Integer> 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<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class);
|
|
money2vip = new TreeMap<>();
|
|
for(SVipLevelConfig sVipLevelConfig : config.values()){
|
|
money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel());
|
|
}
|
|
sVipLevelConfigMap =config;
|
|
|
|
}
|
|
|
|
public static Map<Integer, SVipLevelConfig> getsVipLevelConfigMap() {
|
|
return sVipLevelConfigMap;
|
|
}
|
|
//根据钱返回当前特权等级
|
|
public static int getsVipLevel(int money) {
|
|
Map.Entry<Integer,Integer> 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<Integer, Integer> getMoney2vip() {
|
|
return money2vip;
|
|
}
|
|
|
|
public int[][] getProperty() {
|
|
return property;
|
|
}
|
|
|
|
public int[][] getReward() {
|
|
return reward;
|
|
}
|
|
} |