diff --git a/worlds/khrecom/Items.py b/worlds/khrecom/Items.py index 59316cc95db3..3a5cd212142e 100644 --- a/worlds/khrecom/Items.py +++ b/worlds/khrecom/Items.py @@ -1,4 +1,4 @@ -from typing import Dict, NamedTuple, Optional +from typing import Dict, NamedTuple, Optional, Set from BaseClasses import Item, ItemClassification @@ -10,7 +10,7 @@ class KHRECOMItem(Item): class KHRECOMItemData(NamedTuple): category: str sub: str = "None" - code: Optional[int] = None + code: int = 0 classification: ItemClassification = ItemClassification.filler @@ -250,3 +250,11 @@ def get_items_by_category(category: str, exclude: list) -> Dict[str, KHRECOMItem "Friend Card Jack": KHRECOMItemData("Friend Cards", code = 268_5007, classification = ItemClassification.progression), "Friend Card Pluto": KHRECOMItemData("Friend Cards", code = 268_5008, classification = ItemClassification.progression), } + +# Make item categories +item_name_groups: Dict[str, Set[str]] = {} +for item in item_table.keys(): + category = item_table[item].category + if category not in item_name_groups.keys(): + item_name_groups[category] = set() + item_name_groups[category].add(item) diff --git a/worlds/khrecom/Locations.py b/worlds/khrecom/Locations.py index 24e51c4a0780..f511b7567ed3 100644 --- a/worlds/khrecom/Locations.py +++ b/worlds/khrecom/Locations.py @@ -1,4 +1,4 @@ -from typing import Dict, NamedTuple, Optional +from typing import Dict, NamedTuple, Optional, Set from BaseClasses import Location @@ -307,3 +307,11 @@ def get_locations_by_category(category: str) -> Dict[str, KHRECOMLocationData]: } lookup_id_to_name: Dict[int, str] = {data.code: item_name for item_name, data in location_table.items() if data.code} + +# Make location categories +location_name_groups: Dict[str, Set[str]] = {} +for location in location_table.keys(): + category = location_table[location].category + if category not in location_name_groups.keys(): + location_name_groups[category] = set() + location_name_groups[category].add(location) diff --git a/worlds/khrecom/__init__.py b/worlds/khrecom/__init__.py index 05520f9ba0e9..29a27401e7e2 100644 --- a/worlds/khrecom/__init__.py +++ b/worlds/khrecom/__init__.py @@ -2,8 +2,8 @@ from BaseClasses import Tutorial, MultiWorld from worlds.AutoWorld import WebWorld, World -from .Items import KHRECOMItem, KHRECOMItemData, get_items_by_category, item_table -from .Locations import location_table +from .Items import KHRECOMItem, KHRECOMItemData, get_items_by_category, item_table, item_name_groups +from .Locations import location_table, location_name_groups from .Options import KHRECOMOptions, khrecom_option_groups from .Regions import create_regions from .Rules import set_rules @@ -48,6 +48,8 @@ class KHRECOMWorld(World): item_name_to_id = {name: data.code for name, data in item_table.items()} location_name_to_id = {name: data.code for name, data in location_table.items()} + item_name_groups = item_name_groups + location_name_groups = location_name_groups def create_items(self): self.place_predetermined_items()