Parse the BCCE Secret Items section
This commit is contained in:
parent
49d5e1260f
commit
9a5b27e744
1 changed files with 8 additions and 1 deletions
9
main.py
9
main.py
|
@ -124,6 +124,7 @@ def parse_COMMANDS(data):
|
||||||
|
|
||||||
|
|
||||||
def parse_SEED(data):
|
def parse_SEED(data):
|
||||||
|
# This is a fake section injected by the file loader. It contains only the seed code
|
||||||
is_BCCE = True if data.startswith("CE") else False
|
is_BCCE = True if data.startswith("CE") else False
|
||||||
|
|
||||||
# Normalize seed codes to BCEX format, removing spaces and replacing pipes with dots
|
# Normalize seed codes to BCEX format, removing spaces and replacing pipes with dots
|
||||||
|
@ -132,6 +133,11 @@ def parse_SEED(data):
|
||||||
return {"is_bcce": is_BCCE, "seed": seed}
|
return {"is_bcce": is_BCCE, "seed": seed}
|
||||||
|
|
||||||
|
|
||||||
|
def parse_SECRET_ITEMS(data):
|
||||||
|
# I have no idea what this is lol, dump it to a list for now
|
||||||
|
return [line for line in data.split("\n") if not line.startswith("---")]
|
||||||
|
|
||||||
|
|
||||||
def load(filename):
|
def load(filename):
|
||||||
# Load our file, tokenize by section header (starting with ====)
|
# Load our file, tokenize by section header (starting with ====)
|
||||||
with open(filename) as infile:
|
with open(filename) as infile:
|
||||||
|
@ -163,7 +169,8 @@ if __name__ == "__main__":
|
||||||
# and just continues to the next section if one doesn't exist.
|
# and just continues to the next section if one doesn't exist.
|
||||||
for k, v in sections.items():
|
for k, v in sections.items():
|
||||||
try:
|
try:
|
||||||
data[k] = globals()[f"parse_{k}"](v)
|
section_func = f"parse_{k.replace(' ', '_')}"
|
||||||
|
data[k] = globals()[section_func](v)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue