diff --git a/worlds/grinch/Items.py b/worlds/grinch/Items.py index 3954e15a..b2b39354 100644 --- a/worlds/grinch/Items.py +++ b/worlds/grinch/Items.py @@ -1,19 +1,42 @@ from typing import NamedTuple, Optional +from .RamHandler import GrinchRamData from BaseClasses import Item -from BaseClasses import ItemClassification as IC +from BaseClasses import ItemClassification as IC #IC can be any name, saves having to type the whole word in code class GrinchItemData(NamedTuple): - type: str - code: Optional[int] + item_group: str #arbituary that can be whatever it can be, basically the field/property for item groups + id: Optional[int] classification: IC - update_ram_addr: Optional[list[GrinchRamData]] = None - value: Optional[int] = None #I can either set or add either hex or unsigned values through Client.py - binary_bit_pos: Optional[int] = None + update_ram_addr: list[GrinchRamData] bit_size: int = 1 + value: Optional[int] = None #none is empty/null + # Either set or add either hex or unsigned values through Client.py + # Hex uses 0x00, unsigned are base whole numbers + binary_bit_pos: Optional[int] = None + second_item_group: Optional[str] = None +class GrinchItem(Item): + game: str = "The Grinch" + +#Tells server what item id it is + @staticmethod + def get_apid(code: 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 + +#allows hinting of items via category +def get_item_names_per_category() -> dict[str, set[str]]: + categories: dict[str, set[str]] = {} + + for name, data in ALL_ITEMS_TABLE.items(): + categories.setdefault(data.item_group, set()).add(name) + + return categories #Gadgets +#All gadgets require at least 4 different blueprints to be unlocked in the computer in Mount Crumpit. GADGETS_TABLE: dict[str, GrinchItemData] = { "Binoculars": GrinchItemData("Gadgets", 100, IC.useful, [GrinchRamData(0x800102B6, value=0x40), GrinchRamData(0x800102B7, value=0x41), @@ -62,27 +85,27 @@ GADGETS_TABLE: dict[str, GrinchItemData] = { #Mission Specific Items MISSION_ITEMS_TABLE: dict[str, GrinchItemData] = { "Who Cloak": GrinchItemData("Mission Specific Items", 200, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=1)]), + [GrinchRamData(0x800101F9, binary_bit_pos=1)], second_item_group="Useful Items"), "Painting Bucket": GrinchItemData("Mission Specific Items", 201, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=2)]), + [GrinchRamData(0x800101F9, binary_bit_pos=2)], second_item_group="Useful Items"), "Scissors": GrinchItemData("Mission Specific Items", 202, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=7)]), + [GrinchRamData(0x800101F9, binary_bit_pos=7)], second_item_group="Useful Items"), "Glue Bucket": GrinchItemData("Mission Specific Items", 203, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=5)]), + [GrinchRamData(0x800101F9, binary_bit_pos=5)], second_item_group="Useful Items"), "Cable Car Access Card": GrinchItemData("Mission Specific Items", 204, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=6)]), + [GrinchRamData(0x800101F9, binary_bit_pos=6)], second_item_group="Useful Items"), "Drill": GrinchItemData("Mission Specific Items", 205, IC.progression, - [GrinchRamData(0x800101FA, binary_bit_pos=3)]), + [GrinchRamData(0x800101FA, binary_bit_pos=3)], second_item_group="Useful Items"), "Rope": GrinchItemData("Mission Specific Items", 206, IC.progression, - [GrinchRamData(0x800101FA, binary_bit_pos=2)]), + [GrinchRamData(0x800101FA, binary_bit_pos=2)], second_item_group="Useful Items"), "Hook": GrinchItemData("Mission Specific Items", 207, IC.progression, - [GrinchRamData(0x800101FA, binary_bit_pos=1)]), + [GrinchRamData(0x800101FA, binary_bit_pos=1)], second_item_group="Useful Items"), "Sculpting Tools": GrinchItemData("Mission Specific Items", 208, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=3)]), + [GrinchRamData(0x800101F9, binary_bit_pos=3)], second_item_group="Useful Items"), "Hammer": GrinchItemData("Mission Specific Items", 209, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=4)]), + [GrinchRamData(0x800101F9, binary_bit_pos=4)], second_item_group="Useful Items"), "Scout Clothes": GrinchItemData("Mission Specific Items", 210, IC.progression, - [GrinchRamData(0x800101F9, binary_bit_pos=8)]) + [GrinchRamData(0x800101F9, binary_bit_pos=8)], second_item_group="Useful Items") } #Sleigh Parts @@ -144,11 +167,21 @@ TRAPS_TABLE: dict[str, GrinchItemData] = { "Who sent me here?": GrinchItemData("Traps", 608, IC.trap, [GrinchRamData(0x8008FB94, value=1)]) } +#Movesets +MOVES_TABLE: dict[str, GrinchItemData] = { + "Bad Breath": GrinchItemData("Movesets", 700, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=1)]), + "Pancake": GrinchItemData("Movesets", 701, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=2)]), + "Push & Pull": GrinchItemData("Movesets", 702, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=3)]), + "Max": GrinchItemData("Movesets", 703, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=4)]), + "Tip Toe": GrinchItemData("Movesets", 704, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=5)]), +} +#Double star combines all dictionaries from each individual list together ALL_ITEMS_TABLE: dict[str, GrinchItemData] = { **GADGETS_TABLE, **MISSION_ITEMS_TABLE, **SLEIGH_PARTS_TABLE, **KEYS_TABLE, **MISC_ITEMS_TABLE, - **TRAPS_TABLE + **TRAPS_TABLE, + **MOVES_TABLE } \ No newline at end of file diff --git a/worlds/grinch/Locations.py b/worlds/grinch/Locations.py index 704fb6e4..c3f78365 100644 --- a/worlds/grinch/Locations.py +++ b/worlds/grinch/Locations.py @@ -5,10 +5,10 @@ from BaseClasses import ItemClassification as IC class GrinchLocationData(NamedTuple): region: str - type: str - code: Optional[int] + location_group: str + id: Optional[int] classification: IC - update_ram_addr: Optional[list[GrinchRamData]] = None + update_ram_addr: list[GrinchRamData] value: Optional[int] = None #I can either set or add either hex or unsigned values through Client.py binary_bit_pos: Optional[int] = None bit_size: int = 1 @@ -17,59 +17,69 @@ class GrinchLocation(Location): game: str = "The Grinch" location_group: str + @staticmethod + def get_apid(code: int): + base_id: int = 42069 + return base_id + code + grinch_locations = { +#Going to use current map id as indicator whether or not you visited a location #Visitsanity - "Enter Whoville": GrinchLocationData("Visitsanity", 100, [GrinchRamData()]), - "Enter the Post Office": GrinchLocationData("Visitsanity", 101, [GrinchRamData()]), - "Enter the Town Hall": GrinchLocationData("Visitsanity", 102, [GrinchRamData()]), - "Enter the Countdown-To-Xmas Clock Tower": GrinchLocationData("Visitsanity", 103, [GrinchRamData()]), - "Enter Who Forest": GrinchLocationData("Visitsanity", 104, [GrinchRamData()]), - "Enter the Ski Resort": GrinchLocationData("Visitsanity", 105, [GrinchRamData()]), - "Enter the Civic Center": GrinchLocationData("Visitsanity", 106, [GrinchRamData()]), - "Enter Who Dump": GrinchLocationData("Visitsanity", 107, [GrinchRamData()]), - "Enter the Guardian's House Mine Field": GrinchLocationData("Visitsanity", 108, [GrinchRamData()]), - "Enter the exterior of the Power Plant": GrinchLocationData("Visitsanity", 109, [GrinchRamData()]), - "Enter the interior of the Power Plant": GrinchLocationData("Visitsanity", 110, [GrinchRamData()]), - "Enter Who Lake": GrinchLocationData("Visitsanity", 111, [GrinchRamData()]), - "Enter the Submarine World": GrinchLocationData("Visitsanity", 112, [GrinchRamData()]), - "Enter the Scout's Hut": GrinchLocationData("Visitsanity", 113, [GrinchRamData()]), - "Enter the North Shore": GrinchLocationData("Visitsanity", 114, [GrinchRamData()]), - "Enter the Mayor's Villa": GrinchLocationData("Visitsanity", 115, [GrinchRamData()]), + "Enter Whoville": GrinchLocationData("Visitsanity", 100, [GrinchRamData(0x80010000, value=0x07)]), + "Enter the Post Office": GrinchLocationData("Visitsanity", 101, [GrinchRamData(0x80010000, value=0x0A)]), + "Enter the Town Hall": GrinchLocationData("Visitsanity", 102, [GrinchRamData(0x80010000, value=0x08)]), + "Enter the Countdown-To-Xmas Clock Tower": GrinchLocationData("Visitsanity", 103, [GrinchRamData(0x80010000, value=0x09)]), + "Enter Who Forest": GrinchLocationData("Visitsanity", 104, [GrinchRamData(0x80010000, value=0x0B)]), + "Enter the Ski Resort": GrinchLocationData("Visitsanity", 105, [GrinchRamData(0x80010000, value=0x0C)]), + "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 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)]), + "Enter the North Shore": GrinchLocationData("Visitsanity", 114, [GrinchRamData(0x80010000, value=0x14)]), + "Enter the Mayor's Villa": GrinchLocationData("Visitsanity", 115, [GrinchRamData(0x80010000, value=0x16)]), +#Need to find mission completion address for handful of locations that are not documented. +#Missions that have value are those ones we need to find the check for #Whoville Missions - "Smashing Snowmen": GrinchLocationData("Whoville Missions", 200, [GrinchRamData()]), - "Shuffling The Mail": GrinchLocationData("Whoville Missions", 201, [GrinchRamData()]), - "Painting The Mayor's Posters": GrinchLocationData("Whoville Missions", 202, [GrinchRamData()]), - "Launching Eggs Into Houses": GrinchLocationData("Whoville Missions", 203, [GrinchRamData()]), - "Modifying The Mayor's Statue": GrinchLocationData("Whoville Missions", 204, [GrinchRamData()]), - "Advancing The Countdown-To-Xmas Clock": GrinchLocationData("Whoville Missions", 205, [GrinchRamData()]), - "Squashing All Gifts in Whoville": GrinchLocationData("Whoville Missions", 206, [GrinchRamData()]), + "Smashing Snowmen": GrinchLocationData("Whoville Missions", 200, [GrinchRamData(0x8001020C, value=10)]), + "Shuffling The Mail": GrinchLocationData("Whoville Missions", 201, [GrinchRamData(0x800100BE, binary_bit_pos=1)]), + "Painting The Mayor's Posters": GrinchLocationData("Whoville Missions", 202, [GrinchRamData(0x800100C6, value=10)]), + "Launching Eggs Into Houses": GrinchLocationData("Whoville Missions", 203, [GrinchRamData(0x800100C7, value=10)]), + "Modifying The Mayor's Statue": GrinchLocationData("Whoville Missions", 204, [GrinchRamData(0x800100BE, binary_bit_pos=2)]), + "Advancing The Countdown-To-Xmas Clock": GrinchLocationData("Whoville Missions", 205, [GrinchRamData(0x800100BE, binary_bit_pos=3)]), + "Squashing All Gifts in Whoville": GrinchLocationData("Whoville Missions", 206, [GrinchRamData(0x8001005C, value=500)]), #Who Forest Missions - "Making Xmas Trees Droop": GrinchLocationData("Who Forest Missions", 300, [GrinchRamData()]), - "Sabotaging Snow Cannon With Glue": GrinchLocationData("Who Forest Missions", 301, [GrinchRamData()]), - "Putting Beehives In Cabins": GrinchLocationData("Who Forest Missions", 302, [GrinchRamData()]), - "Sliming The Mayor's Skis": GrinchLocationData("Who Forest Missions", 303, [GrinchRamData()]), - "Replacing The Candles On The Cake With Fireworks": GrinchLocationData("Who Forest Missions", 304, [GrinchRamData()]), - "Squashing All Gifts in Who Forest": GrinchLocationData("Who Forest Missions", 305, [GrinchRamData()]), + "Making Xmas Trees Droop": GrinchLocationData("Who Forest Missions", 300, [GrinchRamData(0x800100C8, value=10)]), + "Sabotaging Snow Cannon With Glue": GrinchLocationData("Who Forest Missions", 301, [GrinchRamData(0x800100BE, binary_bit_pos=4)]), + "Putting Beehives In Cabins": GrinchLocationData("Who Forest Missions", 302, [GrinchRamData(0x800100CA, value=10)]), + "Sliming The Mayor's Skis": GrinchLocationData("Who Forest Missions", 303, [GrinchRamData(0x800100BE, binary_bit_pos=5)]), + "Replacing The Candles On The Cake With Fireworks": GrinchLocationData("Who Forest Missions", 304, [GrinchRamData(0x800100BE, binary_bit_pos=6)]), + "Squashing All Gifts in Who Forest": GrinchLocationData("Who Forest Missions", 305, [GrinchRamData(0x8001005E, value=750)]), #Who Dump Missions - "Stealing Food From Birds": GrinchLocationData("Who Dump Missions", 400, [GrinchRamData()]), - "Feeding The Computer With Robot Parts": GrinchLocationData("Who Dump Missions", 401, [GrinchRamData()]), - "Infesting The Mayor's House With Rats": GrinchLocationData("Who Dump Missions", 402, [GrinchRamData()]), - "Conducting The Stinky Gas To Who-Bris' Shack": GrinchLocationData("Who Dump Missions", 403, [GrinchRamData()]), - "Shaving Who Dump Guardian": GrinchLocationData("Who Dump Missions", 404, [GrinchRamData()]), - "Short-Circuiting Power-Plant": GrinchLocationData("Who Dump Missions", 405, [GrinchRamData()]), - "Squashing All Gifts in Who Dump": GrinchLocationData("Who Dump Missions", 406, [GrinchRamData()]), + "Stealing Food From Birds": GrinchLocationData("Who Dump Missions", 400, [GrinchRamData(0x800100CB, value=10)]), + "Feeding The Computer With Robot Parts": GrinchLocationData("Who Dump Missions", 401, [GrinchRamData(0x800100BF, binary_bit_pos=3)]), + "Infesting The Mayor's House With Rats": GrinchLocationData("Who Dump Missions", 402, [GrinchRamData(0x800100BE, binary_bit_pos=7)]), + "Conducting The Stinky Gas To Who-Bris' Shack": GrinchLocationData("Who Dump Missions", 403, [GrinchRamData(0x800100BE, binary_bit_pos=8)]), + "Shaving Who Dump Guardian": GrinchLocationData("Who Dump Missions", 404, [GrinchRamData(0x800100BF, binary_bit_pos=1)]), + "Short-Circuiting Power-Plant": GrinchLocationData("Who Dump Missions", 405, [GrinchRamData(0x800100BF, binary_bit_pos=2)]), + "Squashing All Gifts in Who Dump": GrinchLocationData("Who Dump Missions", 406, [GrinchRamData(0x80010060, value=750)]), #Who Lake Missions - "Putting Thistles In Shorts": GrinchLocationData("Who Lake Missions", 500, [GrinchRamData()]), - "Sabotaging The Tents": GrinchLocationData("Who Lake Missions", 501, [GrinchRamData()]), - "Drilling Holes In Canoes": GrinchLocationData("Who Lake Missions", 502, [GrinchRamData()]), - "Modifying The Marine Mobile": GrinchLocationData("Who Lake Missions", 503, [GrinchRamData()]), - "Hooking The Mayor's Bed To The Motorboat": GrinchLocationData("Who Lake Missions", 504, [GrinchRamData()]), - "Squashing All Gifts in Who Lake": GrinchLocationData("Who Lake Missions", 505, [GrinchRamData()]), + "Putting Thistles In Shorts": GrinchLocationData("Who Lake Missions", 500, [GrinchRamData(0x800100E6, value=10)]), + "Sabotaging The Tents": GrinchLocationData("Who Lake Missions", 501, [GrinchRamData(0x800100E5, value=10)]), + "Drilling Holes In Canoes": GrinchLocationData("Who Lake Missions", 502, [GrinchRamData(0x800100EE, value=10)]), + "Modifying The Marine Mobile": GrinchLocationData("Who Lake Missions", 503, [GrinchRamData(0x800100BF, binary_bit_pos=5)]), + "Hooking The Mayor's Bed To The Motorboat": GrinchLocationData("Who Lake Missions", 504, [GrinchRamData(0x800100BF, binary_bit_pos=4)]), + "Squashing All Gifts in Who Lake": GrinchLocationData("Who Lake Missions", 505, [GrinchRamData(0x80010062, value=1000)]), +#Need to find binary values for individual blueprints, but all ram addresses are found +#Blueprints #Binoculars Blueprints - "Binoculars Blueprint - Post Office Roof": GrinchLocationData("Binocular Blueprints", 600, [GrinchRamData()]), - "Binoculars Blueprint - City Hall Library - Left Side": GrinchLocationData("Binocular Blueprints", 601, [GrinchRamData()]), - "Binoculars Blueprint - City Hall Library - Front Side": GrinchLocationData("Binocular Blueprints", 602, [GrinchRamData()]), - "Binoculars Blueprint - City Hall Library - Right Side": GrinchLocationData("Binocular Blueprints", 603, [GrinchRamData()]), + "Binoculars Blueprint - Post Office Roof": GrinchLocationData("Binocular Blueprints", 600, [GrinchRamData(0x80100824, binary_bit_pos=0)]), + "Binoculars Blueprint - City Hall Library - Left Side": GrinchLocationData("Binocular Blueprints", 601, [GrinchRamData(0x8001021F, binary_bit_pos=0)]), + "Binoculars Blueprint - City Hall Library - Front Side": GrinchLocationData("Binocular Blueprints", 602, [GrinchRamData(0x8001021F, binary_bit_pos=0)]), + "Binoculars Blueprint - City Hall Library - Right Side": GrinchLocationData("Binocular Blueprints", 603, [GrinchRamData(0x8001021F, binary_bit_pos=0)]), #Rotten Egg Launcher Blueprints "Rotten Egg Launcher Blueprint - Outside City Hall": GrinchLocationData("Rotten Egg Launcher Blueprints", 700, [GrinchRamData()]), "Rotten Egg Launcher Blueprint - Outside Clock Tower": GrinchLocationData("Rotten Egg Launcher Blueprints", 701, [GrinchRamData()]), @@ -139,4 +149,7 @@ grinch_locations = { "Grinch Copter Blueprint - Who Lake South Shore - Submarine World - Underwater": GrinchLocationData("Grinch Copter Blueprints", 1213, [GrinchRamData()]), "Grinch Copter Blueprint - Who Lake North Shore - Mayor's Villa - Tree Branch": GrinchLocationData("Grinch Copter Blueprints", 1214, [GrinchRamData()]), "Grinch Copter Blueprint - Who Lake North Shore - Mayor's Villa - Cave": GrinchLocationData("Grinch Copter Blueprints", 1215, [GrinchRamData()]) +#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 diff --git a/worlds/grinch/Options.py b/worlds/grinch/Options.py index 08618a8f..f1f8bfc2 100644 --- a/worlds/grinch/Options.py +++ b/worlds/grinch/Options.py @@ -7,10 +7,27 @@ from Options import FreeText, NumericOption, Toggle, DefaultOnToggle, Choice, Te class ProgressiveVacuum(DefaultOnToggle): """ Determines whether you get access to main areas progressively - Default: Whoville > Who Forest > Who Dump > Who Lake + + Enabled: Whoville > Who Forest > Who Dump > Who Lake """ display_name = "Progressive Vacuum Access" +class Missionsanity(Choice): + """ + How mission checks are randomized in the pool + + None: Does not add mission checks + Completion: Only completing the mission gives you a check + Individual: Individual tasks for one mission, such as individual snowmen squashed, are checks. + Both: Both individual tasks and mission completion are randomized. + """ + display_name = "Mission Locations" + option_none = 0 + option_completion = 1 + option_individual = 2 + option_both = 3 + default = 1 + # class StartingArea(Choice): # """ # Here, you can select which area you'll start the game with. Whichever one you pick is the region you'll have access to at the start of the Multiworld. @@ -43,4 +60,5 @@ class UnlimitedRottenEggs(Toggle): @dataclass class GrinchOptions(PerGameCommonOptions):#DeathLinkMixin progressive_vacuum: ProgressiveVacuum - unlimited_rotten_eggs: UnlimitedRottenEggs \ No newline at end of file + unlimited_rotten_eggs: UnlimitedRottenEggs + missionsanity: Missionsanity \ No newline at end of file diff --git a/worlds/grinch/RAMAddress.py b/worlds/grinch/RAMAddress.py deleted file mode 100644 index e69de29b..00000000 diff --git a/worlds/grinch/RamHandler.py b/worlds/grinch/RamHandler.py new file mode 100644 index 00000000..faf6ef4f --- /dev/null +++ b/worlds/grinch/RamHandler.py @@ -0,0 +1,8 @@ +from typing import NamedTuple + + +class GrinchRamData(NamedTuple): + ram_address: int + value: int = None + binary_bit_position: int = None + bit_size: int = 1 diff --git a/worlds/grinch/Regions.py b/worlds/grinch/Regions.py index 700b8bbb..c8488c88 100644 --- a/worlds/grinch/Regions.py +++ b/worlds/grinch/Regions.py @@ -31,4 +31,5 @@ supadow_list = [ "Dankamania Supadow", "The Copter Race Contest Supadow" ] + def create_regions(player: int, world: World, options: GrinchOptions): diff --git a/worlds/grinch/__init__.py b/worlds/grinch/__init__.py index 7884468c..d90ecbe1 100644 --- a/worlds/grinch/__init__.py +++ b/worlds/grinch/__init__.py @@ -7,4 +7,7 @@ from . import Options class GrinchWorld(World): game: ClassVar[str] = "The Grinch" options_dataclass = Options.GrinchOptions - options = Options.GrinchOptions \ No newline at end of file + 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