def save_game(exit=False): gamedata = GameData( **{ "player": player, "dungeon_room": dungeon.cur_room, "bonus_tasks": bonus_tasks, "savefile": savefile }) json_serialization.save_file(gamedata, savefile) print("Game saved to " + savefile) if not exit: village.show()
def show(): action = input( text.get_message_treasure_chest(items).replace("inventory", "treasure chest")) if action == "leave": leave_item() elif action == "take": take_item() elif action == "quit": village.show() else: print("Invalid input") return show()
def load_game(): global savefile global player global bonus_tasks gamedata = json_serialization.load_file(savefile) player = gamedata.player dungeon.cur_room = gamedata.dungeon_room bonus_tasks = gamedata.bonus_tasks savefile = gamedata.savefile init() village.show()
def start(args): global savefile savefile = args.savefile if args.print_bonus: print_bonus_tasks() quit() if args.bonus_tasks: global bonus_tasks bonus_tasks = True if args.new_game: create_char() else: load_game() init() village.show()
def close(): village.show()
def enter_village(): village.show()