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

71 lines
1.3 KiB
Java

package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="ExploreFight")
public class SExploreFight implements BaseConfig {
private int id;
private float fightDown;
private float fightUp;
private float loseFight;
public static Map<Integer,SExploreFight> exploreFight;
@Override
public void init() throws Exception {
Map<Integer, SExploreFight> config = STableManager.getConfig(SExploreFight.class);
Map<Integer,SExploreFight> tempExploreFight = new HashMap<>();
for(Map.Entry<Integer, SExploreFight> entry:config.entrySet()){
tempExploreFight.put(entry.getKey(),entry.getValue());
}
exploreFight = tempExploreFight;
}
public int getId() {
return id;
}
public float getFightDown() {
return fightDown;
}
public float getFightUp() {
return fightUp;
}
public float getLoseFight() {
return loseFight;
}
public static Map<Integer, SExploreFight> getExploreFight() {
return exploreFight;
}
public static SExploreFight getConfigByFightDownAndFightUp(float ratio){
for(SExploreFight data:exploreFight.values()){
if(ratio>= data.fightDown&& data.fightUp>= ratio){
return data;
}
}
return null;
}
}