def from_json_dict(cls, json_dict: dict) -> "LayoutDescription": version = json_dict["info"]["version"] version_as_obj = StrictVersion(version) if version_as_obj < StrictVersion("0.21.0"): raise RuntimeError("Unsupported log file version '{}'.".format(version)) # TODO: add try/catch to throw convert potential errors in "seed from future version broke" permalink = Permalink.from_json_dict(json_dict["info"]["permalink"]) if not permalink.spoiler: raise ValueError("Unable to read details of seed log with spoiler disabled") game = data_reader.decode_data(permalink.layout_configuration.game_data) patches = GamePatches( _item_locations_to_pickup_assignment(game, json_dict["locations"]), _node_mapping_to_elevator_connection(game.world_list, json_dict["elevators"]), {}, {}, (), game.starting_location ) return LayoutDescription( version=version, permalink=permalink, patches=patches, solver_path=_playthrough_list_to_solver_path(json_dict["playthrough"]), )
def from_json_dict(cls, json_dict: dict) -> "LayoutDescription": version = json_dict["info"]["version"] # version_as_obj = StrictVersion(version) # # if version_as_obj < StrictVersion("0.26.0"): # raise RuntimeError("Unsupported log file version '{}'.".format(version)) # TODO: add try/catch to throw convert potential errors in "seed from future version broke" permalink = Permalink.from_json_dict(json_dict["info"]["permalink"]) if not permalink.spoiler: raise ValueError( "Unable to read details of seed log with spoiler disabled") return LayoutDescription( version=version, permalink=permalink, patches=game_patches_serializer.decode( json_dict["game_modifications"], permalink.layout_configuration), solver_path=_playthrough_list_to_solver_path( json_dict["playthrough"]), )
def from_json_dict(cls, json_dict: dict) -> "LayoutDescription": version = json_dict["info"]["version"] # version_as_obj = StrictVersion(version) # # if version_as_obj < StrictVersion("0.26.0"): # raise RuntimeError("Unsupported log file version '{}'.".format(version)) # TODO: add try/catch to throw convert potential errors in "seed from future version broke" permalink = Permalink.from_json_dict(json_dict["info"]["permalink"]) if not permalink.spoiler: raise ValueError( "Unable to read details of seed log with spoiler disabled") return LayoutDescription( version=version, permalink=permalink, all_patches=game_patches_serializer.decode( json_dict["game_modifications"], { index: preset.layout_configuration for index, preset in permalink.presets.items() }), item_order=json_dict["item_order"], )