Skip to content

Commit

Permalink
Core: turn MultiServer item_names and location_names into instance va…
Browse files Browse the repository at this point in the history
…rs (#4053)
  • Loading branch information
Berserker66 authored Oct 13, 2024
1 parent e8f3aa9 commit b772d42
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ class Context:
slot_info: typing.Dict[int, NetworkSlot]
generator_version = Version(0, 0, 0)
checksums: typing.Dict[str, str]
item_names: typing.Dict[str, typing.Dict[int, str]] = (
collections.defaultdict(lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown item (ID:{code})')))
item_names: typing.Dict[str, typing.Dict[int, str]]
item_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]]
location_names: typing.Dict[str, typing.Dict[int, str]] = (
collections.defaultdict(lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown location (ID:{code})')))
location_names: typing.Dict[str, typing.Dict[int, str]]
location_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]]
all_item_and_group_names: typing.Dict[str, typing.Set[str]]
all_location_and_group_names: typing.Dict[str, typing.Set[str]]
Expand All @@ -198,7 +196,6 @@ class Context:
""" each sphere is { player: { location_id, ... } } """
logger: logging.Logger


def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int,
hint_cost: int, item_cheat: bool, release_mode: str = "disabled", collect_mode="disabled",
remaining_mode: str = "disabled", auto_shutdown: typing.SupportsFloat = 0, compatibility: int = 2,
Expand Down Expand Up @@ -269,6 +266,10 @@ def __init__(self, host: str, port: int, server_password: str, password: str, lo
self.location_name_groups = {}
self.all_item_and_group_names = {}
self.all_location_and_group_names = {}
self.item_names = collections.defaultdict(
lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown item (ID:{code})'))
self.location_names = collections.defaultdict(
lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown location (ID:{code})'))
self.non_hintable_names = collections.defaultdict(frozenset)

self._load_game_data()
Expand Down

0 comments on commit b772d42

Please sign in to comment.