Change how we handle seed codes

Rather than "normalize" seed codes to BCEX format (which causes issues
with delimiter usage in some scenarios), leave the seed code alone and
break its data out into fields that can/should be parsed instead.
This commit is contained in:
Trysdyn Black 2024-10-09 16:32:08 -07:00
parent 4b72709ae8
commit eb924c14c2

18
main.py
View file

@ -234,13 +234,19 @@ def parse_SEED(data: str) -> dict[str, bool | str]:
This is a fake section injected by the loader code. It contains nothing This is a fake section injected by the loader code. It contains nothing
but the seed code and we derive from this if the randomizer is BCCE or but the seed code and we derive from this if the randomizer is BCCE or
BCEX, and normalize the seed code to a standard format by undoing the BCEX, and try to pluck out other data.
changes BCCE makes to it.
"""
# Normalize seed codes to BCEX format, removing spaces and replacing pipes with dots
seed = data.replace("|", ".").replace(" ", "")
return {"is_bcce": data.startswith("CE"), "seed": seed} We can't do much because the format is really hard to reverse.
"""
version, mode, flags, seed_num = data.split("|") if "|" in data else data.split(".")
return {
"version": version,
"flags": flags,
"seed_num": seed_num,
"mode": mode,
"is_bcce": data.startswith("CE"),
"seed": data,
}
def parse_SECRET_ITEMS(data: str) -> list[str]: def parse_SECRET_ITEMS(data: str) -> list[str]: