Core: turn MultiServer item_names and location_names into instance vars (#4053)
This commit is contained in:
		
							parent
							
								
									e8f3aa96da
								
							
						
					
					
						commit
						b772d42df5
					
				| 
						 | 
					@ -185,11 +185,9 @@ class Context:
 | 
				
			||||||
    slot_info: typing.Dict[int, NetworkSlot]
 | 
					    slot_info: typing.Dict[int, NetworkSlot]
 | 
				
			||||||
    generator_version = Version(0, 0, 0)
 | 
					    generator_version = Version(0, 0, 0)
 | 
				
			||||||
    checksums: typing.Dict[str, str]
 | 
					    checksums: typing.Dict[str, str]
 | 
				
			||||||
    item_names: typing.Dict[str, typing.Dict[int, str]] = (
 | 
					    item_names: typing.Dict[str, typing.Dict[int, str]]
 | 
				
			||||||
        collections.defaultdict(lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown item (ID:{code})')))
 | 
					 | 
				
			||||||
    item_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]]
 | 
					    item_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]]
 | 
				
			||||||
    location_names: typing.Dict[str, typing.Dict[int, str]] = (
 | 
					    location_names: typing.Dict[str, typing.Dict[int, str]]
 | 
				
			||||||
        collections.defaultdict(lambda: Utils.KeyedDefaultDict(lambda code: f'Unknown location (ID:{code})')))
 | 
					 | 
				
			||||||
    location_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[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_item_and_group_names: typing.Dict[str, typing.Set[str]]
 | 
				
			||||||
    all_location_and_group_names: typing.Dict[str, typing.Set[str]]
 | 
					    all_location_and_group_names: typing.Dict[str, typing.Set[str]]
 | 
				
			||||||
| 
						 | 
					@ -198,7 +196,6 @@ class Context:
 | 
				
			||||||
    """ each sphere is { player: { location_id, ... } } """
 | 
					    """ each sphere is { player: { location_id, ... } } """
 | 
				
			||||||
    logger: logging.Logger
 | 
					    logger: logging.Logger
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int,
 | 
					    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",
 | 
					                 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,
 | 
					                 remaining_mode: str = "disabled", auto_shutdown: typing.SupportsFloat = 0, compatibility: int = 2,
 | 
				
			||||||
| 
						 | 
					@ -269,6 +266,10 @@ class Context:
 | 
				
			||||||
        self.location_name_groups = {}
 | 
					        self.location_name_groups = {}
 | 
				
			||||||
        self.all_item_and_group_names = {}
 | 
					        self.all_item_and_group_names = {}
 | 
				
			||||||
        self.all_location_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.non_hintable_names = collections.defaultdict(frozenset)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._load_game_data()
 | 
					        self._load_game_data()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue