Load rune bases from all non-RACE runes, dropping static_rune_runebase reads
The 315 static_rune_runebase rows are exactly the non-RACE runes, so the loader selects by rune_type. Removes the server type/subtype columns (no live reader), the runereq/overwrite path, the GET_RUNEBASE cache-miss query, the runebase attribute handler, the racerune/baseclassrune loaders and the 111111 checks. No value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
13e02707eb
commit
64a86152d3
8 files changed
+8
-367
No files matched your search
@@ -11,15 +11,12 @@ package engine.objects;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.parsers.cache.CObjectIndex;
|
||||
import engine.parsers.objects.RuneTemplate;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.Hasher;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -37,13 +34,10 @@ public class RuneBase extends AbstractGameObject {
|
||||
private static final Set<Integer> NON_CREATION_TALENTS = new HashSet<>(Arrays.asList(2910, 2911, 250081, 250116, 250117, 250123, 250124, 250125));
|
||||
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 mbEnums.RuneType runeType;
|
||||
@@ -53,56 +47,11 @@ public class RuneBase extends AbstractGameObject {
|
||||
private boolean classRestrict;
|
||||
private boolean discRestrict;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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");
|
||||
|
||||
// static_rune_runereq race/class rows are whitelists, its discipline rows prohibitions
|
||||
this.discRestrict = true;
|
||||
DbManager.RuneBaseQueries.GET_RUNE_REQS(this);
|
||||
this.effectsList = MobBaseEffects.getEffectsForRune(this.getObjectUUID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Rune Template Constructor
|
||||
* type and subtype are server enums that don't map cleanly from rune_type/rune_sub_type, so they
|
||||
* come from the static_rune_runebase row.
|
||||
* Talents with the same sub type token replace each other by rank (client 0x4695D0), so no overwrite list.
|
||||
*/
|
||||
public RuneBase(RuneTemplate rune, RuneBase dbRuneBase) {
|
||||
public RuneBase(RuneTemplate rune) {
|
||||
super(rune.template_id);
|
||||
|
||||
Integer classRuneID;
|
||||
@@ -112,8 +61,6 @@ public class RuneBase extends AbstractGameObject {
|
||||
|
||||
this.name = rune.item_base_name;
|
||||
this.description = rune.rune_dsc;
|
||||
this.type = dbRuneBase.type;
|
||||
this.subtype = dbRuneBase.subtype;
|
||||
this.effectsList = MobBaseEffects.getEffectsForRune(rune.template_id);
|
||||
this.runeType = rune.rune_type;
|
||||
this.rank = rune.rune_rank;
|
||||
@@ -171,48 +118,27 @@ public class RuneBase extends AbstractGameObject {
|
||||
if (tableId == 0)
|
||||
return null;
|
||||
|
||||
RuneBase rb = (RuneBase) DbManager.getFromCache(mbEnums.GameObjectType.RuneBase, tableId);
|
||||
|
||||
if (rb != null)
|
||||
return rb;
|
||||
|
||||
return DbManager.RuneBaseQueries.GET_RUNEBASE(tableId);
|
||||
return (RuneBase) DbManager.getFromCache(mbEnums.GameObjectType.RuneBase, tableId);
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
// Iterates the static_rune_runebase rows: no rune field separates the player runes from the mob
|
||||
// talents, and each row still holds the server type/subtype.
|
||||
// Rune bases are every non-RACE rune: the classes, disciplines and talents (the 315 former static_rune_runebase rows).
|
||||
|
||||
public static void LoadAllRuneBases() {
|
||||
|
||||
ArrayList<RuneBase> dbRuneBases;
|
||||
ArrayList<RuneBaseAttribute> attributes;
|
||||
RuneTemplate rune;
|
||||
int loadedCount = 0;
|
||||
|
||||
dbRuneBases = DbManager.RuneBaseQueries.LOAD_ALL_RUNEBASES();
|
||||
RuneBaseAttribute.runeBaseAttributeMap.clear();
|
||||
|
||||
for (RuneBase dbRuneBase : dbRuneBases) {
|
||||
rune = RuneTemplate._runes.get(dbRuneBase.getObjectUUID());
|
||||
for (RuneTemplate rune : RuneTemplate._runes.values()) {
|
||||
|
||||
if (rune == null) {
|
||||
Logger.warn("RuneBase " + dbRuneBase.getObjectUUID() + " has no rune; loaded from static_rune_runebase without attributes");
|
||||
if (rune.rune_type == mbEnums.RuneType.RACE)
|
||||
continue;
|
||||
}
|
||||
|
||||
DbManager.addToCache(new RuneBase(rune, dbRuneBase));
|
||||
DbManager.addToCache(new RuneBase(rune));
|
||||
attributes = RuneBaseAttribute.getAttributesForRune(rune);
|
||||
|
||||
// getAttrs() returns null for a rune without attributes, as the DB map did
|
||||
// getAttrs() returns null for a rune without attributes
|
||||
if (!attributes.isEmpty())
|
||||
RuneBaseAttribute.runeBaseAttributeMap.put(rune.template_id, attributes);
|
||||
|
||||
@@ -224,7 +150,7 @@ public class RuneBase extends AbstractGameObject {
|
||||
loadCreationTalents();
|
||||
}
|
||||
|
||||
// Every creation race and class gets a list, so the 111111 "any" sentinel of the DB tables is no longer used.
|
||||
// Every creation race and class gets an explicit list; there is no "any" entry.
|
||||
|
||||
private static void loadCreationTalents() {
|
||||
|
||||
@@ -318,15 +244,6 @@ public class RuneBase extends AbstractGameObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type != rbObj.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.subtype != rbObj.subtype) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -344,17 +261,6 @@ public class RuneBase extends AbstractGameObject {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subtype
|
||||
*/
|
||||
public byte getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attrs
|
||||
*/
|
||||
@@ -378,10 +284,6 @@ public class RuneBase extends AbstractGameObject {
|
||||
return this.discipline;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getOverwrite() {
|
||||
return this.overwrite;
|
||||
}
|
||||
|
||||
public mbEnums.RuneType getRuneType() {
|
||||
return this.runeType;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user