Load Race from the race runes instead of static_rune_race
loadAllRaces builds one Race per static_rune_race row from the RACE rune with
the same id (all 26, including 2018-2021, decision: JSON); the row now only
supplies minHeight and strHeightMod, and a row without a race rune would load
from the DB with a warning. Colors stay in the DB. racebaseclass,
racehairstyle and racebeardstyle are no longer read at boot. The SQL loader
stays until task 2.11.
Value changes (decisions: JSON, D2):
- name drops the ", Male"/", Female" suffix ("Aelfborn, Male" -> "Aelfborn").
WhoResponseMsg's split(",") and runAfterLoad's suffix strip still work;
runAfterLoad now resolves 2019 to HalfGiant (it threw on the DB name).
- description '' -> rune_dsc blurb (unread)
- Minotaur hair 6958 -> 6598; Vampire M beard 5020170 -> 5020300
- beard style 0 dropped on Shade M/F, Minotaur, Vampire F (beard styles are
never validated); hair 0 kept on Aracoix M/F and Shade M/F by the
empty-hair rule
- 2018 Archon: startingPoints 0 -> 30, token 0 -> -317458791, health 0 -> 20,
stamina 0 -> 90
- 2019 Half-Giant-Old Man: strMax 150 -> 140, dex 40/65 -> 30/75, con 60/140
-> 50/130, spi 30/60 -> 35/80, startingPoints 20 -> 15, health/mana/stamina
0 -> 10/5/70, baseClasses {} -> {Fighter 2500}
- 2020/2021 CSR: all stats 60/120 -> 40/100, startingPoints 0 -> 30, token
0 -> 52803, health/mana/stamina 0 -> 40/40/10000
All other fields unchanged; final parity before the switch (scripts/p23.py):
22 creation races, 0 differences in attributes, bonuses, startingPoints,
token and base classes. The static_rune_race 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
a30a065841
commit
98f09d0713
2 files changed
+26
-73
No files matched your search
@@ -17,6 +17,7 @@ import engine.parsers.cache.CacheParserUtil;
|
||||
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;
|
||||
@@ -187,8 +188,32 @@ public class Race {
|
||||
return baseClasses;
|
||||
}
|
||||
|
||||
// Iterates the static_rune_race rows: no rune field separates 2018-2021 from the mob race runes,
|
||||
// and each row still holds the server-only heights.
|
||||
|
||||
public static void loadAllRaces() {
|
||||
Race._raceByID = DbManager.RaceQueries.LOAD_ALL_RACES();
|
||||
|
||||
ConcurrentHashMap<Integer, Race> dbRaces;
|
||||
ConcurrentHashMap<Integer, Race> races;
|
||||
RuneTemplate rune;
|
||||
|
||||
dbRaces = DbManager.RaceQueries.LOAD_ALL_RACES();
|
||||
races = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
for (Race dbRace : dbRaces.values()) {
|
||||
rune = RuneTemplate._runes.get(dbRace.raceRuneID);
|
||||
|
||||
if (rune == null || rune.rune_type != mbEnums.RuneType.RACE) {
|
||||
Logger.warn("Race " + dbRace.raceRuneID + " has no race rune; loaded from static_rune_race");
|
||||
races.put(dbRace.raceRuneID, dbRace);
|
||||
continue;
|
||||
}
|
||||
|
||||
races.put(dbRace.raceRuneID, new Race(rune, dbRace));
|
||||
}
|
||||
|
||||
Race._raceByID = races;
|
||||
Logger.info("Loaded " + races.size() + " races from runes");
|
||||
}
|
||||
|
||||
public static Race getRace(int id) {
|
||||
|
||||
-72
@@ -9,13 +9,8 @@
|
||||
package engine.parsers.cache;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.BaseClass;
|
||||
import engine.objects.Race;
|
||||
import engine.parsers.objects.RuneTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
@@ -33,10 +28,6 @@ public class ParityCheck {
|
||||
private int differenceCount = 0;
|
||||
private int missingCount = 0;
|
||||
|
||||
static {
|
||||
register("static_rune_race", ParityCheck::compareRaces);
|
||||
}
|
||||
|
||||
private ParityCheck(String table) {
|
||||
this.table = table;
|
||||
}
|
||||
@@ -90,67 +81,4 @@ public class ParityCheck {
|
||||
differenceCount++;
|
||||
Logger.warn("Parity: " + table + "/" + id + "/" + field + ": db=" + dbValue + " json=" + jsonValue);
|
||||
}
|
||||
|
||||
private static void compareRaces(ParityCheck check) {
|
||||
|
||||
Race race;
|
||||
Race jsonRace;
|
||||
RuneTemplate rune;
|
||||
int id;
|
||||
|
||||
for (mbEnums.RaceType raceType : mbEnums.RaceType.values()) {
|
||||
id = raceType.getRuneID();
|
||||
race = Race.getRace(id);
|
||||
|
||||
if (race == null) {
|
||||
Logger.warn("Parity: static_rune_race/" + id + ": not loaded from the db");
|
||||
continue;
|
||||
}
|
||||
|
||||
rune = RuneTemplate._runes.get(id);
|
||||
|
||||
if (rune != null && rune.rune_type != mbEnums.RuneType.RACE)
|
||||
rune = null;
|
||||
|
||||
if (!check.compareRow(id, rune))
|
||||
continue;
|
||||
|
||||
jsonRace = new Race(rune, race);
|
||||
|
||||
check.compareField(id, "name", race.getName(), jsonRace.getName());
|
||||
check.compareField(id, "strStart", race.getStrStart(), jsonRace.getStrStart());
|
||||
check.compareField(id, "strMin", race.getStrMin(), jsonRace.getStrMin());
|
||||
check.compareField(id, "strMax", race.getStrMax(), jsonRace.getStrMax());
|
||||
check.compareField(id, "dexStart", race.getDexStart(), jsonRace.getDexStart());
|
||||
check.compareField(id, "dexMin", race.getDexMin(), jsonRace.getDexMin());
|
||||
check.compareField(id, "dexMax", race.getDexMax(), jsonRace.getDexMax());
|
||||
check.compareField(id, "conStart", race.getConStart(), jsonRace.getConStart());
|
||||
check.compareField(id, "conMin", race.getConMin(), jsonRace.getConMin());
|
||||
check.compareField(id, "conMax", race.getConMax(), jsonRace.getConMax());
|
||||
check.compareField(id, "intStart", race.getIntStart(), jsonRace.getIntStart());
|
||||
check.compareField(id, "intMin", race.getIntMin(), jsonRace.getIntMin());
|
||||
check.compareField(id, "intMax", race.getIntMax(), jsonRace.getIntMax());
|
||||
check.compareField(id, "spiStart", race.getSpiStart(), jsonRace.getSpiStart());
|
||||
check.compareField(id, "spiMin", race.getSpiMin(), jsonRace.getSpiMin());
|
||||
check.compareField(id, "spiMax", race.getSpiMax(), jsonRace.getSpiMax());
|
||||
check.compareField(id, "token", race.getToken(), jsonRace.getToken());
|
||||
check.compareField(id, "healthBonus", race.getHealthBonus(), jsonRace.getHealthBonus());
|
||||
check.compareField(id, "manaBonus", race.getManaBonus(), jsonRace.getManaBonus());
|
||||
check.compareField(id, "staminaBonus", race.getStaminaBonus(), jsonRace.getStaminaBonus());
|
||||
check.compareField(id, "startingPoints", race.getStartingPoints(), jsonRace.getStartingPoints());
|
||||
check.compareField(id, "hairStyles", race.getHairStyles(), jsonRace.getHairStyles());
|
||||
check.compareField(id, "beardStyles", race.getBeardStyles(), jsonRace.getBeardStyles());
|
||||
check.compareField(id, "baseClasses", getObjectIds(race.getValidBaseClasses()), getObjectIds(jsonRace.getValidBaseClasses()));
|
||||
}
|
||||
}
|
||||
|
||||
private static HashSet<Integer> getObjectIds(Iterable<BaseClass> baseClasses) {
|
||||
|
||||
HashSet<Integer> ids = new HashSet<>();
|
||||
|
||||
for (BaseClass baseClass : baseClasses)
|
||||
ids.add(baseClass.getObjectUUID());
|
||||
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user