Filter events out of datapackage
This commit is contained in:
		
							parent
							
								
									741ab3e45c
								
							
						
					
					
						commit
						14cadbf80d
					
				|  | @ -9,8 +9,13 @@ class AutoWorldRegister(type): | |||
| 
 | ||||
|     def __new__(cls, name, bases, dct): | ||||
|         dct["all_names"] = dct["item_names"] | dct["location_names"] | set(dct.get("item_name_groups", {})) | ||||
|         # filter out any events | ||||
|         dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id} | ||||
|         dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id} | ||||
|         # build reverse lookups | ||||
|         dct["item_id_to_name"] = {code: name for name, code in dct["item_name_to_id"].items()} | ||||
|         dct["location_id_to_name"] = {code: name for name, code in dct["location_name_to_id"].items()} | ||||
|         # construct class | ||||
|         new_class = super().__new__(cls, name, bases, dct) | ||||
|         if "game" in dct: | ||||
|             AutoWorldRegister.world_types[dct["game"]] = new_class | ||||
|  |  | |||
|  | @ -391,7 +391,7 @@ item_table = \ | |||
|     'Whispering_Root-Waterways': HKItemData(advancement=True, id=16777410, type='Root'), | ||||
|     'World_Sense': HKItemData(advancement=False, id=16777220, type='Dreamer')} | ||||
| 
 | ||||
| lookup_id_to_name:Dict[int, str] = {data.id: item_name for item_name, data in item_table.items()} | ||||
| lookup_id_to_name:Dict[int, str] = {data.id: item_name for item_name, data in item_table.items() if data.type != 'Event'} | ||||
| lookup_type_to_names:Dict[str, Set[str]] = {} | ||||
| for item, item_data in item_table.items(): | ||||
|     lookup_type_to_names.setdefault(item_data.type, set()).add(item) | ||||
|  | @ -18,7 +18,7 @@ class HKWorld(World): | |||
|     item_names: Set[str] = frozenset(item_table) | ||||
|     location_names: Set[str] = frozenset(lookup_name_to_id) | ||||
| 
 | ||||
|     item_name_to_id = {name: data.id for name, data in item_table.items()} | ||||
|     item_name_to_id = {name: data.id for name, data in item_table.items() if data.type != "Event"} | ||||
|     location_name_to_id = lookup_name_to_id | ||||
| 
 | ||||
|     def generate_basic(self): | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import typing | |||
| 
 | ||||
| 
 | ||||
| class ItemData(typing.NamedTuple): | ||||
|     code: int | ||||
|     code: typing.Optional[int] | ||||
|     progression: bool | ||||
| 
 | ||||
| 
 | ||||
|  | @ -49,7 +49,7 @@ item_table = { | |||
|     "Single Arrow": ItemData(45034, False),  | ||||
|     "Bee Trap (Minecraft)": ItemData(45100, False), | ||||
| 
 | ||||
|     "Victory": ItemData(0, True) | ||||
|     "Victory": ItemData(None, True) | ||||
| } | ||||
| 
 | ||||
| # If not listed here then has frequency 1 | ||||
|  |  | |||
|  | @ -1,15 +1,19 @@ | |||
| from BaseClasses import Location | ||||
| import typing | ||||
| 
 | ||||
| 
 | ||||
| class AdvData(typing.NamedTuple): | ||||
|     id: int | ||||
|     id: typing.Optional[int] | ||||
|     region: str | ||||
| 
 | ||||
| 
 | ||||
| class MinecraftAdvancement(Location): | ||||
|     game: str = "Minecraft" | ||||
|     def __init__(self, player: int, name: str, address: int, parent): | ||||
|         super().__init__(player, name, address if address else None, parent) | ||||
|         self.event = True if address == 0 else False | ||||
| 
 | ||||
|     def __init__(self, player: int, name: str, address: typing.Optional[int], parent): | ||||
|         super().__init__(player, name, address, parent) | ||||
|         self.event = not address | ||||
| 
 | ||||
| 
 | ||||
| advancement_table = { | ||||
|     "Who is Cutting Onions?": AdvData(42000, 'Overworld'), | ||||
|  | @ -105,7 +109,7 @@ advancement_table = { | |||
|     "Librarian": AdvData(42090, 'Overworld'), | ||||
|     "Overpowered": AdvData(42091, 'Overworld'), | ||||
| 
 | ||||
|     "Ender Dragon": AdvData(0, 'The End') | ||||
|     "Ender Dragon": AdvData(None, 'The End') | ||||
| } | ||||
| 
 | ||||
| exclusion_table = { | ||||
|  | @ -134,10 +138,9 @@ exclusion_table = { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| events_table = { | ||||
|     "Ender Dragon": "Victory" | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| lookup_id_to_name: typing.Dict[int, str] = {loc_data.id: loc_name for loc_name, loc_data in advancement_table.items() if loc_data.id} | ||||
| lookup_id_to_name: typing.Dict[int, str] = {loc_data.id: loc_name for loc_name, loc_data in advancement_table.items() if | ||||
|                                             loc_data.id} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue