@@ -47,27 +47,31 @@ def settings(cls) -> Any: # actual type is defined in World
4747 def __new__ (mcs , name : str , bases : Tuple [type , ...], dct : Dict [str , Any ]) -> AutoWorldRegister :
4848 if "web" in dct :
4949 assert isinstance (dct ["web" ], WebWorld ), "WebWorld has to be instantiated."
50- # filter out any events
51- dct ["item_name_to_id" ] = {name : id for name , id in dct ["item_name_to_id" ].items () if id }
52- dct ["location_name_to_id" ] = {name : id for name , id in dct ["location_name_to_id" ].items () if id }
53- # build reverse lookups
54- dct ["item_id_to_name" ] = {code : name for name , code in dct ["item_name_to_id" ].items ()}
55- dct ["location_id_to_name" ] = {code : name for name , code in dct ["location_name_to_id" ].items ()}
56-
57- # build rest
58- dct ["item_names" ] = frozenset (dct ["item_name_to_id" ])
59- dct ["item_name_groups" ] = {group_name : frozenset (group_set ) for group_name , group_set
60- in dct .get ("item_name_groups" , {}).items ()}
61- dct ["item_name_groups" ]["Everything" ] = dct ["item_names" ]
62-
63- dct ["location_names" ] = frozenset (dct ["location_name_to_id" ])
64- dct ["location_name_groups" ] = {group_name : frozenset (group_set ) for group_name , group_set
65- in dct .get ("location_name_groups" , {}).items ()}
66- dct ["location_name_groups" ]["Everywhere" ] = dct ["location_names" ]
67- dct ["all_item_and_group_names" ] = frozenset (dct ["item_names" ] | set (dct .get ("item_name_groups" , {})))
68-
69- # move away from get_required_client_version function
50+
7051 if "game" in dct :
52+ assert "item_name_to_id" in dct , f"{ name } : item_name_to_id is required"
53+ assert "location_name_to_id" in dct , f"{ name } : location_name_to_id is required"
54+
55+ # filter out any events
56+ dct ["item_name_to_id" ] = {name : id for name , id in dct ["item_name_to_id" ].items () if id }
57+ dct ["location_name_to_id" ] = {name : id for name , id in dct ["location_name_to_id" ].items () if id }
58+ # build reverse lookups
59+ dct ["item_id_to_name" ] = {code : name for name , code in dct ["item_name_to_id" ].items ()}
60+ dct ["location_id_to_name" ] = {code : name for name , code in dct ["location_name_to_id" ].items ()}
61+
62+ # build rest
63+ dct ["item_names" ] = frozenset (dct ["item_name_to_id" ])
64+ dct ["item_name_groups" ] = {group_name : frozenset (group_set ) for group_name , group_set
65+ in dct .get ("item_name_groups" , {}).items ()}
66+ dct ["item_name_groups" ]["Everything" ] = dct ["item_names" ]
67+
68+ dct ["location_names" ] = frozenset (dct ["location_name_to_id" ])
69+ dct ["location_name_groups" ] = {group_name : frozenset (group_set ) for group_name , group_set
70+ in dct .get ("location_name_groups" , {}).items ()}
71+ dct ["location_name_groups" ]["Everywhere" ] = dct ["location_names" ]
72+ dct ["all_item_and_group_names" ] = frozenset (dct ["item_names" ] | set (dct .get ("item_name_groups" , {})))
73+
74+ # move away from get_required_client_version function
7175 assert "get_required_client_version" not in dct , f"{ name } : required_client_version is an attribute now"
7276 # set minimum required_client_version from bases
7377 if "required_client_version" in dct and bases :
0 commit comments