diff --git a/worlds/grinch/Items.py b/worlds/grinch/Items.py index 66304baf..65630ff5 100644 --- a/worlds/grinch/Items.py +++ b/worlds/grinch/Items.py @@ -16,10 +16,10 @@ class GrinchItem(Item): #Tells server what item id it is @staticmethod - def get_apid(code: int): + def get_apid(id: int): #If you give me an input id, I will return the Grinch equivalent server/ap id base_id: int = 42069 - return base_id + code if code is not None else None + return base_id + id if id is not None else None #allows hinting of items via category def get_item_names_per_category() -> dict[str, set[str]]: @@ -147,7 +147,7 @@ KEYS_TABLE: dict[str, GrinchItemData] = { #Misc Items MISC_ITEMS_TABLE: dict[str, GrinchItemData] = { "Fully Healed Grinch": GrinchItemData("Health Items", 500, IC.filler, [GrinchRamData(0x800E8FDC, value=120)]), - "Heart of Stones": GrinchItemData("Health Items", 501, IC.useful, [GrinchRamData(0x800100ED, value=1)]), + "Heart of Stone": GrinchItemData("Health Items", 501, IC.useful, [GrinchRamData(0x800100ED, value=1)]), "5 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 502, IC.filler, [GrinchRamData(0x80010058, value=5)]), "10 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 503, IC.filler, [GrinchRamData(0x80010058, value=10)]), "20 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 504, IC.filler, [GrinchRamData(0x80010058, value=20)]) @@ -184,4 +184,10 @@ ALL_ITEMS_TABLE: dict[str, GrinchItemData] = { **MISC_ITEMS_TABLE, **TRAPS_TABLE, **MOVES_TABLE -} \ No newline at end of file +} + +def grinch_items_to_id() -> dict[str, int]: + item_mappings: dict[str, int] = {} + for ItemName, ItemData in ALL_ITEMS_TABLE.items(): + item_mappings.update({ItemName: GrinchItem.get_apid(ItemData.id)}) + return item_mappings \ No newline at end of file diff --git a/worlds/grinch/Locations.py b/worlds/grinch/Locations.py index 54b81b05..ec1ca4d7 100644 --- a/worlds/grinch/Locations.py +++ b/worlds/grinch/Locations.py @@ -13,9 +13,9 @@ class GrinchLocation(Location): game: str = "The Grinch" @staticmethod - def get_apid(code: int): + def get_apid(id: int): base_id: int = 42069 - return base_id + code + return base_id + id grinch_locations = { #Going to use current map id as indicator whether or not you visited a location @@ -29,8 +29,8 @@ grinch_locations = { "Enter the Civic Center": GrinchLocationData("Visitsanity", 106, [GrinchRamData(0x80010000, value=0x0D)]), "Enter Who Dump": GrinchLocationData("Visitsanity", 107, [GrinchRamData(0x80010000, value=0x0E)]), "Enter the Guardian's House Mine Field": GrinchLocationData("Visitsanity", 108, [GrinchRamData(0x80010000, value=0x11)]), - "Enter the exterior of the Power Plant": GrinchLocationData("Visitsanity", 109, [GrinchRamData(0x80010000, value=0x10)]), - "Enter the interior of the Power Plant": GrinchLocationData("Visitsanity", 110, [GrinchRamData(0x80010000, value=0x0F)]), + "Enter the Power Plant": GrinchLocationData("Visitsanity", 109, [GrinchRamData(0x80010000, value=0x10)]), + "Enter the Generator Building": GrinchLocationData("Visitsanity", 110, [GrinchRamData(0x80010000, value=0x0F)]), "Enter Who Lake": GrinchLocationData("Visitsanity", 111, [GrinchRamData(0x80010000, value=0x12)]), "Enter the Submarine World": GrinchLocationData("Visitsanity", 112, [GrinchRamData(0x80010000, value=0x17)]), "Enter the Scout's Hut": GrinchLocationData("Visitsanity", 113, [GrinchRamData(0x80010000, value=0x13)]), @@ -106,7 +106,7 @@ grinch_locations = { "Octopus Climbing Device Blueprint - Mayor's House Vent Cage": GrinchLocationData("Octopus Climbing Device Blueprints", 1003, [GrinchRamData(0x80010252, binary_bit_pos=2)]), "Octopus Climbing Device Blueprint - Left Pipe": GrinchLocationData("Octopus Climbing Device Blueprints", 1004, [GrinchRamData(0x80010252, binary_bit_pos=5)]), "Octopus Climbing Device Blueprint - Near Power Plant Wall on left side": GrinchLocationData("Octopus Climbing Device Blueprints", 1005, [GrinchRamData(0x80010252, binary_bit_pos=1)]), - "Octopus Climbing Device Blueprint - Near Who-Bris' Shack": GrinchLocationData("Octopus Climbing Device Blueprints", 1006, [GrinchRamData()]), + "Octopus Climbing Device Blueprint - Near Who-Bris' Shack": GrinchLocationData("Octopus Climbing Device Blueprints", 1006, [GrinchRamData(0x80010252, binary_bit_pos=3)]), "Octopus Climbing Device Blueprint - Guardian's House - Left side of Guardian House": GrinchLocationData("Octopus Climbing Device Blueprints", 1007, [GrinchRamData(0x8001026E, binary_bit_pos=3)]), "Octopus Climbing Device Blueprint - Guardian's House - Right side of Guardian House": GrinchLocationData("Octopus Climbing Device Blueprints", 1008, [GrinchRamData(0x8001026E, binary_bit_pos=5)]), "Octopus Climbing Device Blueprint - Inside Guardian's House": GrinchLocationData("Octopus Climbing Device Blueprints", 1009, [GrinchRamData(0x8001026E, binary_bit_pos=3)]), @@ -130,16 +130,16 @@ grinch_locations = { #Grinch Copter Blueprints "Grinch Copter Blueprint - Whoville City Hall - Safe Room": GrinchLocationData("Grinch Copter Blueprints", 1200, [GrinchRamData(0x8001020B, binary_bit_pos=8)]), "Grinch Copter Blueprint - Whoville City Hall - Statue Room": GrinchLocationData("Grinch Copter Blueprints", 1201, [GrinchRamData(0x80010220, binary_bit_pos=1)]), - "Grinch Copter Blueprint - Whoville Clock Tower - Before Bells": GrinchLocationData("Grinch Copter Blueprints", 1202, [GrinchRamData()]), - "Grinch Copter Blueprint - Whoville Clock Tower - After Bells": GrinchLocationData("Grinch Copter Blueprints", 1203, [GrinchRamData()]), + "Grinch Copter Blueprint - Whoville Clock Tower - Before Bells": GrinchLocationData("Grinch Copter Blueprints", 1202, [GrinchRamData(0x80010265, binary_bit_pos=4)]), + "Grinch Copter Blueprint - Whoville Clock Tower - After Bells": GrinchLocationData("Grinch Copter Blueprints", 1203, [GrinchRamData(0x80010265, binary_bit_pos=3)]), "Grinch Copter Blueprint - Who Forest Ski Resort - Inside Dog's Fence": GrinchLocationData("Grinch Copter Blueprints", 1204, [GrinchRamData(0x80010234, binary_bit_pos=8)]), "Grinch Copter Blueprint - Who Forest Ski Resort - Max Cave": GrinchLocationData("Grinch Copter Blueprints", 1205, [GrinchRamData(0x80010234, binary_bit_pos=7)]), "Grinch Copter Blueprint - Who Forest Civic Center - Climb across wall": GrinchLocationData("Grinch Copter Blueprints", 1206, [GrinchRamData(0x8001022A, binary_bit_pos=8)]), "Grinch Copter Blueprint - Who Forest Civic Center - Shoot the Icicle": GrinchLocationData("Grinch Copter Blueprints", 1207, [GrinchRamData(0x8001022B, binary_bit_pos=1)]), - "Grinch Copter Blueprint - Who Dump Outside of Power Plant - First": GrinchLocationData("Grinch Copter Blueprints", 1208, [GrinchRamData(0x80010265, binary_bit_pos=2)]), - "Grinch Copter Blueprint - Who Dump Outside of Power Plant - Second Gate": GrinchLocationData("Grinch Copter Blueprints", 1209, [GrinchRamData(0x80010265, binary_bit_pos=3)]), - "Grinch Copter Blueprint - Who Dump Inside of Power Plant - Before Mission": GrinchLocationData("Grinch Copter Blueprints", 1210, [GrinchRamData(0x8001026B, binary_bit_pos=1)]), - "Grinch Copter Blueprint - Who Dump Inside of Power Plant - After Mission": GrinchLocationData("Grinch Copter Blueprints", 1211, [GrinchRamData(0x8001026B, binary_bit_pos=2)]), + "Grinch Copter Blueprint - Who Dump Power Plant - First": GrinchLocationData("Grinch Copter Blueprints", 1208, [GrinchRamData(0x80010265, binary_bit_pos=2)]), + "Grinch Copter Blueprint - Who Dump Power Plant - Second Gate": GrinchLocationData("Grinch Copter Blueprints", 1209, [GrinchRamData(0x80010265, binary_bit_pos=3)]), + "Grinch Copter Blueprint - Who Dump Generator Building - Before Mission": GrinchLocationData("Grinch Copter Blueprints", 1210, [GrinchRamData(0x8001026B, binary_bit_pos=1)]), + "Grinch Copter Blueprint - Who Dump Generator Building - After Mission": GrinchLocationData("Grinch Copter Blueprints", 1211, [GrinchRamData(0x8001026B, binary_bit_pos=2)]), "Grinch Copter Blueprint - Who Lake South Shore - Submarine World - Above Surface": GrinchLocationData("Grinch Copter Blueprints", 1212, [GrinchRamData(0x80010289, binary_bit_pos=4)]), "Grinch Copter Blueprint - Who Lake South Shore - Submarine World - Underwater": GrinchLocationData("Grinch Copter Blueprints", 1213, [GrinchRamData(0x80010289, binary_bit_pos=5)]), "Grinch Copter Blueprint - Who Lake North Shore - Mayor's Villa - Tree Branch": GrinchLocationData("Grinch Copter Blueprints", 1214, [GrinchRamData(0x80010275, binary_bit_pos=8)]), @@ -147,4 +147,10 @@ grinch_locations = { #Sleigh Room Locations "Stealing All Gifts": GrinchLocationData("Sleigh Ride", 1300, [GrinchRamData(0x800100BF, binary_bit_pos=7)]), "Neutralizing Santa": GrinchLocationData("Sleigh Ride", 1301, [GrinchRamData(0x800100BF, binary_bit_pos=8)]) -} \ No newline at end of file +} + +def grinch_locations_to_id() -> dict[str,int]: + location_mappings: dict[str, int] = {} + for LocationName, LocationData in grinch_locations.items(): + location_mappings.update({LocationName: GrinchLocation.get_apid(LocationData.id)}) + return location_mappings \ No newline at end of file diff --git a/worlds/grinch/Regions.py b/worlds/grinch/Regions.py index c8488c88..1d41643c 100644 --- a/worlds/grinch/Regions.py +++ b/worlds/grinch/Regions.py @@ -1,6 +1,8 @@ from BaseClasses import Region, MultiWorld from .Locations import GrinchLocation, grinch_locations from .Options import GrinchOptions +from . import GrinchWorld +from BaseClasses import Region mainareas_list = [ "Mount Crumpit", @@ -17,8 +19,8 @@ subareas_list = [ "Ski Resort", "Civic Center", "Minefield", - "Outside Power Plant", - "Inside Power Plant", + "Power Plant", + "Generator Building", "Submarine World", "Scout's Hut", "North Shore", @@ -32,4 +34,43 @@ supadow_list = [ "The Copter Race Contest Supadow" ] -def create_regions(player: int, world: World, options: GrinchOptions): +def create_regions(world: "GrinchWorld"): + for mainarea in mainareas_list: + #Each area in mainarea, create a region for the given player + world.multiworld.regions.append(Region(mainarea, world.player, world.multiworld)) + for subarea in subareas_list: + #Each area in subarea, create a region for the given player + world.multiworld.regions.append(Region(subarea, world.player, world.multiworld)) + for supadow in supadow_list: + #Each area in supadow, create a region for the given player + world.multiworld.regions.append(Region(supadow, world.player, world.multiworld)) + +def grinchconnect(world: "GrinchWorld", current_region_name: str, connected_region_name: str): + current_region = world.get_region(current_region_name) + connected_region = world.get_region(connected_region_name) + #Goes from current to connected + current_region.connect(connected_region) + #Goes from connected to current + connected_region.connect(current_region) + +def connect_regions(world: "GrinchWorld"): + grinchconnect(world, "Mount Crumpit", "Whoville") + grinchconnect(world, "Mount Crumpit", "Who Forest") + grinchconnect(world, "Mount Crumpit", "Who Dump") + grinchconnect(world, "Mount Crumpit", "Who Lake") + grinchconnect(world, "Mount Crumpit", "Sleigh Room") + grinchconnect(world, "Mount Crumpit", "Spin N' Win Supadow") + grinchconnect(world, "Mount Crumpit", "Dankamania Supadow") + grinchconnect(world, "Mount Crumpit", "The Copter Race Contest Supadow") + grinchconnect(world, "Whoville", "Post Office") + grinchconnect(world, "Whoville", "City Hall") + grinchconnect(world, "Whoville", "Countdown to X-Mas Tower") + grinchconnect(world, "Who Forest", "Ski Resort") + grinchconnect(world, "Who Forest", "Civic Center") + grinchconnect(world, "Who Dump", "Minefield") + grinchconnect(world, "Who Dump", "Power Plant") + grinchconnect(world, "Power Plant", "Generator Building") + grinchconnect(world, "Who Lake", "Submarine World") + grinchconnect(world, "Who Lake", "Scout's Hut") + grinchconnect(world, "Who Lake", "North Shore") + grinchconnect(world, "North Shore", "Mayor's Villa") diff --git a/worlds/grinch/__init__.py b/worlds/grinch/__init__.py index d90ecbe1..9bf7aa46 100644 --- a/worlds/grinch/__init__.py +++ b/worlds/grinch/__init__.py @@ -1,3 +1,6 @@ +from .Locations import grinch_locations_to_id +from .Items import grinch_items_to_id + from typing import ClassVar from worlds.AutoWorld import World @@ -9,5 +12,6 @@ class GrinchWorld(World): options_dataclass = Options.GrinchOptions options = Options.GrinchOptions topology_present = True #not an open world game, very linear - item_name_to_id = - location_name_to_id = \ No newline at end of file + item_name_to_id: ClassVar[dict[str,int]] = grinch_items_to_id() + location_name_to_id = ClassVar[dict[str,int]] = grinch_locations_to_id() + required_client_version = (0, 6, 2) \ No newline at end of file