forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
+153
-155
@@ -23,195 +23,193 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class RuneBase extends AbstractGameObject {
|
||||
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final int type;
|
||||
private final byte subtype;
|
||||
public static HashMap<Integer, ArrayList<Integer>> AllowedBaseClassRunesMap = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<Integer>> AllowedRaceRunesMap = new HashMap<>();
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final int type;
|
||||
private final byte subtype;
|
||||
private final ConcurrentHashMap<Integer, Boolean> race = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> baseClass = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> promotionClass = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> discipline = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ArrayList<Integer> overwrite = new ArrayList<>();
|
||||
private int levelRequired = 1;
|
||||
private ArrayList<MobBaseEffects> effectsList = new ArrayList<>();
|
||||
|
||||
private final ConcurrentHashMap<Integer, Boolean> race = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> baseClass = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> promotionClass = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ConcurrentHashMap<Integer, Boolean> discipline = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final ArrayList<Integer> overwrite = new ArrayList<>();
|
||||
private int levelRequired = 1;
|
||||
/**
|
||||
* No Table ID Constructor
|
||||
*/
|
||||
public RuneBase(String name, String description, int type, byte subtype, ArrayList<RuneBaseAttribute> attrs) {
|
||||
super();
|
||||
|
||||
private ArrayList<MobBaseEffects> effectsList = new ArrayList<>();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.type = type;
|
||||
this.subtype = subtype;
|
||||
|
||||
public static HashMap<Integer,ArrayList<Integer>> AllowedBaseClassRunesMap = new HashMap<>();
|
||||
public static HashMap<Integer,ArrayList<Integer>> AllowedRaceRunesMap = new HashMap<>();
|
||||
/**
|
||||
* No Table ID Constructor
|
||||
*/
|
||||
public RuneBase(String name, String description, int type, byte subtype, ArrayList<RuneBaseAttribute> attrs) {
|
||||
super();
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.type = type;
|
||||
this.subtype = subtype;
|
||||
/**
|
||||
* Normal Constructor
|
||||
*/
|
||||
public RuneBase(String name, String description, int type, byte subtype, ArrayList<RuneBaseAttribute> attrs, int newUUID) {
|
||||
super(newUUID);
|
||||
|
||||
}
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.type = type;
|
||||
this.subtype = subtype;
|
||||
|
||||
/**
|
||||
* Normal Constructor
|
||||
*/
|
||||
public RuneBase(String name, String description, int type, byte subtype, ArrayList<RuneBaseAttribute> attrs, int newUUID) {
|
||||
super(newUUID);
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.type = type;
|
||||
this.subtype = subtype;
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public RuneBase(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
}
|
||||
this.name = rs.getString("name");
|
||||
this.description = rs.getString("description");
|
||||
this.type = rs.getInt("type");
|
||||
this.subtype = rs.getByte("subtype");
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public RuneBase(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
DbManager.RuneBaseQueries.GET_RUNE_REQS(this);
|
||||
this.effectsList = DbManager.MobBaseQueries.GET_RUNEBASE_EFFECTS(this.getObjectUUID());
|
||||
}
|
||||
|
||||
this.name = rs.getString("name");
|
||||
this.description = rs.getString("description");
|
||||
this.type = rs.getInt("type");
|
||||
this.subtype = rs.getByte("subtype");
|
||||
public static RuneBase getRuneBase(int tableId) {
|
||||
|
||||
DbManager.RuneBaseQueries.GET_RUNE_REQS(this);
|
||||
this.effectsList = DbManager.MobBaseQueries.GET_RUNEBASE_EFFECTS(this.getObjectUUID());
|
||||
}
|
||||
if (tableId == 0)
|
||||
return null;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
RuneBase rb = (RuneBase) DbManager.getFromCache(Enum.GameObjectType.RuneBase, tableId);
|
||||
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (rb != null)
|
||||
return rb;
|
||||
|
||||
if(obj instanceof RuneBase) {
|
||||
RuneBase rbObj = (RuneBase) obj;
|
||||
if (!this.name.equals(rbObj.name)) {
|
||||
return false;
|
||||
}
|
||||
return DbManager.RuneBaseQueries.GET_RUNEBASE(tableId);
|
||||
}
|
||||
|
||||
if (!this.description.equals(rbObj.description)) {
|
||||
return false;
|
||||
}
|
||||
public static void serializeForClientMsg(RuneBase runeBase, ByteBufferWriter writer) {
|
||||
writer.putInt(runeBase.type);
|
||||
writer.putInt(0); // Pad
|
||||
writer.putInt(runeBase.getObjectUUID());
|
||||
writer.putInt(runeBase.getObjectType().ordinal());
|
||||
writer.putInt(runeBase.getObjectUUID());
|
||||
|
||||
if (this.type != rbObj.type) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.subtype != rbObj.subtype) {
|
||||
return false;
|
||||
}
|
||||
public static void LoadAllRuneBases() {
|
||||
|
||||
DbManager.RuneBaseQueries.LOAD_ALL_RUNEBASES();
|
||||
RuneBase.AllowedBaseClassRunesMap = DbManager.RuneBaseQueries.LOAD_ALLOWED_STARTING_RUNES_FOR_BASECLASS();
|
||||
RuneBase.AllowedRaceRunesMap = DbManager.RuneBaseQueries.LOAD_ALLOWED_STARTING_RUNES_FOR_RACE();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj instanceof RuneBase) {
|
||||
RuneBase rbObj = (RuneBase) obj;
|
||||
if (!this.name.equals(rbObj.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.description.equals(rbObj.description)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type != rbObj.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.subtype != rbObj.subtype) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Getters
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/*
|
||||
* Getters
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subtype
|
||||
*/
|
||||
public byte getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
/**
|
||||
* @return the subtype
|
||||
*/
|
||||
public byte getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attrs
|
||||
*/
|
||||
public ArrayList<RuneBaseAttribute> getAttrs() {
|
||||
return RuneBaseAttribute.runeBaseAttributeMap.get(this.getObjectUUID());
|
||||
}
|
||||
/**
|
||||
* @return the attrs
|
||||
*/
|
||||
public ArrayList<RuneBaseAttribute> getAttrs() {
|
||||
return RuneBaseAttribute.runeBaseAttributeMap.get(this.getObjectUUID());
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Integer, Boolean> getRace() {
|
||||
return this.race;
|
||||
}
|
||||
public ConcurrentHashMap<Integer, Boolean> getRace() {
|
||||
return this.race;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Integer, Boolean> getBaseClass() {
|
||||
return this.baseClass;
|
||||
}
|
||||
public ConcurrentHashMap<Integer, Boolean> getBaseClass() {
|
||||
return this.baseClass;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Integer, Boolean> getPromotionClass() {
|
||||
return this.promotionClass;
|
||||
}
|
||||
public ConcurrentHashMap<Integer, Boolean> getPromotionClass() {
|
||||
return this.promotionClass;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Integer, Boolean> getDiscipline() {
|
||||
return this.discipline;
|
||||
}
|
||||
public ConcurrentHashMap<Integer, Boolean> getDiscipline() {
|
||||
return this.discipline;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getOverwrite() {
|
||||
return this.overwrite;
|
||||
}
|
||||
public ArrayList<Integer> getOverwrite() {
|
||||
return this.overwrite;
|
||||
}
|
||||
|
||||
public int getLevelRequired() {
|
||||
return this.levelRequired;
|
||||
}
|
||||
/*
|
||||
* Serializing
|
||||
*/
|
||||
|
||||
public void setLevelRequired(int levelRequired) {
|
||||
this.levelRequired = levelRequired;
|
||||
}
|
||||
public int getLevelRequired() {
|
||||
return this.levelRequired;
|
||||
}
|
||||
|
||||
public static RuneBase getRuneBase(int tableId) {
|
||||
public void setLevelRequired(int levelRequired) {
|
||||
this.levelRequired = levelRequired;
|
||||
}
|
||||
|
||||
if (tableId == 0)
|
||||
return null;
|
||||
@Override
|
||||
public void updateDatabase() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
RuneBase rb = (RuneBase) DbManager.getFromCache(Enum.GameObjectType.RuneBase, tableId);
|
||||
|
||||
if (rb != null)
|
||||
return rb;
|
||||
|
||||
return DbManager.RuneBaseQueries.GET_RUNEBASE(tableId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Serializing
|
||||
*/
|
||||
|
||||
public static void serializeForClientMsg(RuneBase runeBase,ByteBufferWriter writer) {
|
||||
writer.putInt(runeBase.type);
|
||||
writer.putInt(0); // Pad
|
||||
writer.putInt(runeBase.getObjectUUID());
|
||||
writer.putInt(runeBase.getObjectType().ordinal());
|
||||
writer.putInt(runeBase.getObjectUUID());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDatabase() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the effectsList
|
||||
*/
|
||||
public ArrayList<MobBaseEffects> getEffectsList() {
|
||||
return effectsList;
|
||||
}
|
||||
|
||||
public static void LoadAllRuneBases(){
|
||||
|
||||
DbManager.RuneBaseQueries.LOAD_ALL_RUNEBASES();
|
||||
RuneBase.AllowedBaseClassRunesMap = DbManager.RuneBaseQueries.LOAD_ALLOWED_STARTING_RUNES_FOR_BASECLASS();
|
||||
RuneBase.AllowedRaceRunesMap = DbManager.RuneBaseQueries.LOAD_ALLOWED_STARTING_RUNES_FOR_RACE();
|
||||
}
|
||||
/**
|
||||
* @return the effectsList
|
||||
*/
|
||||
public ArrayList<MobBaseEffects> getEffectsList() {
|
||||
return effectsList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user