Build Race from its race rune and compare every field
Adds Race(RuneTemplate, Race): start/max attributes from rune_attr_adj/
rune_max_attr_adj (min is always 0), health/mana/stamina bonus from
rune_health/mana/stamina, startingPoints = 30 - rune_creation_cost, token =
SBStringHash(rune_sub_type), name from obj_name, description from rune_dsc,
hair/beard styles from rune_hair/rune_beard (style 0 when rune_hair is empty),
and baseClasses = the creation class runes whose item_race_req names the race
sub type. minHeight/strHeightMod come from the static_rune_race row; colors,
skills, powers and effects still load from the DB by rune id. A
static_rune_race comparator checks every field against a JSON-built Race.
Offline parity (scripts/p23.py, 26 rows + racebaseclass/hairstyle/beardstyle
vs the RACE runes): the 22 creation races match in every attribute, bonus,
startingPoints, token and base class. Differences:
- name: "Aelfborn, Male" -> "Aelfborn" on every row
- hair 0 dropped by the JSON on Aracoix M/F and Shade M/F (kept by the
empty-hair rule); beard 0 dropped on Shade M/F, Minotaur, Vampire F
- Minotaur hair 6958 -> 6598, Vampire M beard 5020170 -> 5020300
- 2018 Archon: startingPoints 0 -> 30, token 0 -> SBStringHash("Celestial"),
health 0 -> 20, stamina 0 -> 90
- 2019 Half-Giant-Old Man: str/dex/con/spi start and max, startingPoints
20 -> 15, health/mana/stamina 0 -> 10/5/70, baseClasses {} -> {Fighter}
- 2020/2021 CSR: stats 60/120 -> 40/100, startingPoints 0 -> 30, token 0 ->
SBStringHash("CSR"), health/mana/stamina 0 -> 40/40/10000
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
957293165b
commit
a30a065841
2 files changed
+152
No files matched your search
+72
@@ -9,8 +9,13 @@
|
||||
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;
|
||||
@@ -28,6 +33,10 @@ 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;
|
||||
}
|
||||
@@ -81,4 +90,67 @@ 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