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

76 lines
1.7 KiB
Java

package config;
import manager.STableManager;
import manager.Table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Table(name ="EquipPropertyPool")
public class SEquipPropertyPool implements BaseConfig {
private static Map<Integer, List<SEquipPropertyPool>> SEquipPropertyPoolByIdMap;
private int id;
private int propertyId;
private int min;
private int max;
private int poolNum;
private int weight;
@Override
public void init() throws Exception {
Map<Integer, List<SEquipPropertyPool>> sEquipPropertyPoolByIdMapTmp = new HashMap<>();
Map<Integer, SEquipPropertyPool> config = STableManager.getConfig(SEquipPropertyPool.class);
for(SEquipPropertyPool sEquipPropertyPool : config.values()){
int poolNum = sEquipPropertyPool.getPoolNum();
int weight = sEquipPropertyPool.getWeight();
if(weight==0){
continue;
}
if(!sEquipPropertyPoolByIdMapTmp.containsKey(poolNum)){
sEquipPropertyPoolByIdMapTmp.put(poolNum,new ArrayList<>());
}
sEquipPropertyPoolByIdMapTmp.get(poolNum).add(sEquipPropertyPool);
}
SEquipPropertyPoolByIdMap = sEquipPropertyPoolByIdMapTmp;
}
public static List<SEquipPropertyPool> getSEquipPropertyPool(int poolId) {
return SEquipPropertyPoolByIdMap.get(poolId);
}
public int getId() {
return id;
}
public int getPropertyId() {
return propertyId;
}
public int getMin() {
return min;
}
public int getMax() {
return max;
}
public int getPoolNum() {
return poolNum;
}
public int getWeight() {
return weight;
}
}