Comment STATS code, misc lint fixes
This commit is contained in:
parent
9f7b525683
commit
8697253ea6
1 changed files with 7 additions and 1 deletions
8
main.py
8
main.py
|
@ -64,15 +64,21 @@ def parse_STATS(data):
|
||||||
# BCCE Splits stats into its own section that we need to parse, return, then snap together
|
# BCCE Splits stats into its own section that we need to parse, return, then snap together
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
|
# This is pretty identical to CHARACTERS
|
||||||
|
# Each character has a blank line between them
|
||||||
|
# Most everything else is k : v
|
||||||
for c_text in data.split("\n\n"):
|
for c_text in data.split("\n\n"):
|
||||||
name = "NULL"
|
name = "NULL"
|
||||||
c_data = {}
|
c_data = {}
|
||||||
|
|
||||||
for line in c_text.split("\n"):
|
for line in c_text.split("\n"):
|
||||||
|
# Character name
|
||||||
if line[0:2].isdigit():
|
if line[0:2].isdigit():
|
||||||
name = line[4:]
|
name = line[4:]
|
||||||
|
# Should be nothing, but let's be safe
|
||||||
elif ":" not in line:
|
elif ":" not in line:
|
||||||
pass
|
pass
|
||||||
|
# A stat we can just save k : v
|
||||||
else:
|
else:
|
||||||
stat, value = line.split(":")
|
stat, value = line.split(":")
|
||||||
c_data[stat] = int(value)
|
c_data[stat] = int(value)
|
||||||
|
@ -119,7 +125,7 @@ def parse_COMMANDS(data):
|
||||||
|
|
||||||
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, "r") as infile:
|
with open(filename) as infile:
|
||||||
tok_data = infile.read().split("============================================================\n")
|
tok_data = infile.read().split("============================================================\n")
|
||||||
|
|
||||||
sections = {}
|
sections = {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue