Load BaseClass from the class runes instead of static_rune_baseclass
LoadAllBaseClasses builds one BaseClass per CLASS rune with rune_is_standard_character_creation (2500-2503; promotions and Pet are skipped) and caches it. Race.baseClasses picks up the cached objects through GET_BASECLASS_FOR_RACE. The SQL loader stays until task 2.11. Value changes: description goes from '' to the rune_dsc class blurb (unread). All other fields unchanged; final parity before the switch (scripts/p21.py): 4 rows, 0 differences in name, attribute mods, token, health/mana/stamina mods. The static_rune_baseclass comparator is removed; it would only compare the JSON with itself now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5acd3492ed
commit
c8c322a3f5
2 files changed
+14
-51
No files matched your search
@@ -14,6 +14,7 @@ import engine.mbEnums;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.parsers.objects.RuneTemplate;
|
||||
import engine.util.Hasher;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -130,7 +131,19 @@ public class BaseClass extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public static void LoadAllBaseClasses() {
|
||||
DbManager.BaseClassQueries.GET_ALL_BASE_CLASSES();
|
||||
|
||||
int loadedCount = 0;
|
||||
|
||||
// Promotion classes and the Pet class are also CLASS runes, but not standard creation runes
|
||||
for (RuneTemplate rune : RuneTemplate._runes.values()) {
|
||||
if (rune.rune_type != mbEnums.RuneType.CLASS || !rune.rune_is_standard_character_creation)
|
||||
continue;
|
||||
|
||||
DbManager.addToCache(new BaseClass(rune));
|
||||
loadedCount++;
|
||||
}
|
||||
|
||||
Logger.info("Loaded " + loadedCount + " base classes from runes");
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(BaseClass baseClass, ByteBufferWriter writer) {
|
||||
|
||||
-50
@@ -9,16 +9,10 @@
|
||||
package engine.parsers.cache;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.BaseClass;
|
||||
import engine.parsers.objects.RuneTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// Dev-only check that compares DB-built objects with the cache JSON before a loader is switched.
|
||||
@@ -34,10 +28,6 @@ public class ParityCheck {
|
||||
private int differenceCount = 0;
|
||||
private int missingCount = 0;
|
||||
|
||||
static {
|
||||
register("static_rune_baseclass", ParityCheck::compareBaseClasses);
|
||||
}
|
||||
|
||||
private ParityCheck(String table) {
|
||||
this.table = table;
|
||||
}
|
||||
@@ -91,44 +81,4 @@ public class ParityCheck {
|
||||
differenceCount++;
|
||||
Logger.warn("Parity: " + table + "/" + id + "/" + field + ": db=" + dbValue + " json=" + jsonValue);
|
||||
}
|
||||
|
||||
private static void compareBaseClasses(ParityCheck check) {
|
||||
|
||||
ConcurrentHashMap<Integer, AbstractGameObject> cache;
|
||||
BaseClass baseClass;
|
||||
BaseClass jsonClass;
|
||||
RuneTemplate rune;
|
||||
int id;
|
||||
|
||||
cache = DbManager.getMap(mbEnums.GameObjectType.BaseClass);
|
||||
|
||||
if (cache == null) {
|
||||
Logger.warn("Parity: static_rune_baseclass: no BaseClass objects loaded");
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractGameObject cached : cache.values()) {
|
||||
baseClass = (BaseClass) cached;
|
||||
id = baseClass.getObjectUUID();
|
||||
rune = RuneTemplate._runes.get(id);
|
||||
|
||||
if (!check.compareRow(id, rune))
|
||||
continue;
|
||||
|
||||
jsonClass = new BaseClass(rune);
|
||||
|
||||
check.compareField(id, "name", baseClass.getName(), jsonClass.getName());
|
||||
check.compareField(id, "strMod", baseClass.getStrMod(), jsonClass.getStrMod());
|
||||
check.compareField(id, "dexMod", baseClass.getDexMod(), jsonClass.getDexMod());
|
||||
check.compareField(id, "conMod", baseClass.getConMod(), jsonClass.getConMod());
|
||||
check.compareField(id, "intMod", baseClass.getIntMod(), jsonClass.getIntMod());
|
||||
check.compareField(id, "spiMod", baseClass.getSpiMod(), jsonClass.getSpiMod());
|
||||
check.compareField(id, "token", baseClass.getToken(), jsonClass.getToken());
|
||||
check.compareField(id, "healthMod", baseClass.getHealthMod(), jsonClass.getHealthMod());
|
||||
check.compareField(id, "manaMod", baseClass.getManaMod(), jsonClass.getManaMod());
|
||||
check.compareField(id, "staminaMod", baseClass.getStaminaMod(), jsonClass.getStaminaMod());
|
||||
check.compareField(id, "isStandardCreation", true, rune.rune_type == mbEnums.RuneType.CLASS
|
||||
&& rune.rune_is_standard_character_creation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user