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

76 lines
2.0 KiB
Java

package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="EquipSuiteConfig")
public class SEquipSuiteConfig implements BaseConfig {
private int id;
private int[][] suiteValue;
private int[][] suiteSkill;
private Map<Integer, Integer> suiteSkills;
private Map<Integer,Map<Integer,Long>> suiteMap;
public static Map<Integer, SEquipSuiteConfig> config;
@Override
public void init() throws Exception {
Map<Integer, SEquipSuiteConfig> configTmp = STableManager.getConfig(SEquipSuiteConfig.class);
for (SEquipSuiteConfig value : configTmp.values()) {
Map<Integer,Map<Integer,Long>> suiteMapTmp = new HashMap<>();
Map<Integer, Integer> suiteSkills = new HashMap<>(2);
int[][] suiteValue = value.getSuiteValue();
for(int[] suiteItem :suiteValue){
HashMap<Integer, Long> map = new HashMap<>();
map.putIfAbsent(suiteItem[1], (long) suiteItem[2]);
suiteMapTmp.put(suiteItem[0],map);
}
int[][] suiteSkill = value.getSuiteSkill();
if (suiteSkill != null && suiteSkill.length > 0) {
for (int[] ints : suiteSkill) {
suiteSkills.put(ints[0], ints[1]);
}
}
value.setSuiteSkills(suiteSkills);
value.setSuiteMap(suiteMapTmp);
}
config=configTmp;
}
public Map<Integer, Map<Integer, Long>> getSuiteMap() {
return suiteMap;
}
public void setSuiteMap(Map<Integer, Map<Integer, Long>> suiteMap) {
this.suiteMap = suiteMap;
}
public int getId() {
return id;
}
public int[][] getSuiteValue() {
return suiteValue;
}
public int[][] getSuiteSkill() {
return suiteSkill;
}
public Map<Integer, Integer> getSuiteSkills() {
return suiteSkills;
}
public void setSuiteSkills(Map<Integer, Integer> suiteSkills) {
this.suiteSkills = suiteSkills;
}
}