diff --git a/sheditor.py b/sheditor.py index a03964d..9adfb91 100644 --- a/sheditor.py +++ b/sheditor.py @@ -147,6 +147,7 @@ class Character: def print_summary(self): print("Name: {}".format(self.name)) + print() print("Skills:") for skill in self.skills: print("{} : {}".format(char_skills[skill['id']], skill['level'])) @@ -344,8 +345,39 @@ class GameData: def print_detailed_character_summary(self): for ship in self.ships: + if len(ship.characters) == 0: + print("Ship {} (owned by {}, state {}) has no characters, skipping...".format(ship.name, ship.owner, ship.state)) + print() + continue + + print("Listing characters for ship {} (owned by {}, state {}):".format(ship.name, ship.owner, ship.state)) + print('-----') + for character in ship.characters: character.print_summary() + print('-----') + + print() + + def print_detailed_item_summary(self): + for ship in self.ships: + if len(ship.storage_areas) == 0: + print("Ship {} (owned by {}, state {}) has no storage areas, skipping...".format(ship.name, ship.owner, ship.state)) + print() + continue + + print("Inventory for ship {} (owned by {}, state {})".format(ship.name, ship.owner, ship.state)) + for index, storage_area in enumerate(ship.storage_areas): + if len(storage_area.items) == 0: + print(" Storage area {} is empty.".format(index)) + continue + + print(" Storage area {}:".format(index)) + for item in storage_area.items: + print(" {:4}: {} - {}".format(item.code, item.name, item.quantity)) + + print() + print() def print_summary(self): print("Start game summary:") @@ -543,10 +575,12 @@ def main(): game_data = GameData(soup, item_code_database) game_data.populate() - game_data.add_item(1759, 100) - game_data.buff_characters() - game_data.add_currency(10000) + # game_data.add_item(1759, 100) + # game_data.buff_characters() + # game_data.add_currency(10000) game_data.print_summary() + # game_data.print_detailed_item_summary() + game_data.print_detailed_character_summary() game_data.writeback() text = soup.prettify()