Deprecate data_version and introduce checksum for DataPackages. (#684)

Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
Zach Parks
2023-03-20 11:01:08 -05:00
committed by GitHub
parent d825576f12
commit ff9f563d4a
20 changed files with 297 additions and 119 deletions

View File

@@ -20,14 +20,19 @@ if typing.TYPE_CHECKING:
from .AutoWorld import World
class GamesPackage(typing.TypedDict):
class GamesData(typing.TypedDict):
item_name_groups: typing.Dict[str, typing.List[str]]
item_name_to_id: typing.Dict[str, int]
location_name_groups: typing.Dict[str, typing.List[str]]
location_name_to_id: typing.Dict[str, int]
version: int
class GamesPackage(GamesData, total=False):
checksum: str
class DataPackage(typing.TypedDict):
version: int
games: typing.Dict[str, GamesPackage]
@@ -75,14 +80,9 @@ games: typing.Dict[str, GamesPackage] = {}
from .AutoWorld import AutoWorldRegister
# Build the data package for each game.
for world_name, world in AutoWorldRegister.world_types.items():
games[world_name] = {
"item_name_to_id": world.item_name_to_id,
"location_name_to_id": world.location_name_to_id,
"version": world.data_version,
# seems clients don't actually want this. Keeping it here in case someone changes their mind.
# "item_name_groups": {name: tuple(items) for name, items in world.item_name_groups.items()}
}
games[world_name] = world.get_data_package_data()
lookup_any_item_id_to_name.update(world.item_id_to_name)
lookup_any_location_id_to_name.update(world.location_id_to_name)