Fix crash if BCCE log lacks a COMMANDS section

This commit is contained in:
Trysdyn Black 2024-10-06 16:41:16 -07:00
parent 62978cf9f0
commit 0954975374

13
main.py
View file

@ -266,11 +266,14 @@ if __name__ == "__main__":
# Subkey CHARACTERS commands with COMMANDS data # Subkey CHARACTERS commands with COMMANDS data
# This turns lists of commands each character has into hashes where # This turns lists of commands each character has into hashes where
# Command name => Textual desc of command # Command name => Textual desc of command
for character, c_data in data["CHARACTERS"].items(): # Certain flags don't shuffle commands like this so we have to check
new_commands = {} if "COMMANDS" in data:
for command in c_data["commands"]: for character, c_data in data["CHARACTERS"].items():
new_commands[command] = data["COMMANDS"].get(command, command) new_commands = {}
c_data["commands"] = new_commands
for command in c_data["commands"]:
new_commands[command] = data["COMMANDS"].get(command, command)
c_data["commands"] = new_commands
# If we have a STATS block, snap it into CHARACTER data # If we have a STATS block, snap it into CHARACTER data
# BCCE broke this out into its own section # BCCE broke this out into its own section