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

87 lines
2.1 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 ="TreasureSunlongTaskConfig")
public class STreasureSunlongTaskConfig implements BaseConfig {
private int id;
private int activityId;
private int type;
private int taskType;
private int[][] taskValue;
private int[][] integral;
private int weight;
public static Map<Integer,STreasureSunlongTaskConfig> treasureTaskConfig;
public static Map<Integer, List<Integer>> taskTypeMap;
public static Map<Integer,List<STreasureSunlongTaskConfig>> sTreasureTaskConfigListByTypeMapTmp;
/**
* 提出来一本轮配置任务奖励的积分道具的ID
* 用来在活动开始的时候,清除玩家背包里上一轮相同的积分道具
*/
private static int TASK_INTEGRAL;
@Override
public void init() throws Exception {
treasureTaskConfig = STableManager.getConfig(STreasureSunlongTaskConfig.class);
taskTypeMap = new HashMap<>();
sTreasureTaskConfigListByTypeMapTmp = new HashMap<>();
for(Map.Entry<Integer,STreasureSunlongTaskConfig> entry:treasureTaskConfig.entrySet()){
STreasureSunlongTaskConfig entryValue = entry.getValue();
taskTypeMap.computeIfAbsent(entryValue.getType(),v->new ArrayList<>()).add(entry.getKey());
sTreasureTaskConfigListByTypeMapTmp.computeIfAbsent(entryValue.getTaskType(),v->new ArrayList<>()).add(entryValue);
if (TASK_INTEGRAL == 0) {
TASK_INTEGRAL = entryValue.integral[0][0];
}
}
}
public int getId() {
return id;
}
public int getActivityId() {
return activityId;
}
public int getType() {
return type;
}
public int getTaskType() {
return taskType;
}
public int[][] getTaskValue() {
return taskValue;
}
public int[][] getIntegral() {
return integral;
}
public int getWeight() {
return weight;
}
public static int getTaskIntegral() {
return TASK_INTEGRAL;
}
}