Archipelago/worlds/osrs/Items.py

86 lines
2.3 KiB
Python
Raw Normal View History

OSRS: Implement New Game (#1976) * MMBN3: Press program now has proper color index when received remotely * Initial commit of OSRS untangled from MMBN3 branch * Fixes some broken region connections * Removes some locations * Rearranges locations to fill in slots left by removed locations * Adds starting area rando * Moves Oak and Willow trees to resource regions * Fixes various PEP8 violations * Refactor of regions * Fixes variable capture issue with region rules * Partial completion of brutal grind logic * Finishes can_reach_skill function * Adds skill requirements to location rules, fixes regions rules * Adds documentation for OSRS * Removes match statement * Updates Data Version to test mode to prevent item name caching * Fixes starting spawn logic for east varrock * Fixes river lum crossing logic to not assume you can phase across water * Prevents equipping items when you haven't unlocked them * Changes canoe logic to not require huge levels * Skeletoning out some data I'll need for variable task system * Adds csvs and parser for logic * Adds Items parsing * Fixes the spawning logic to not default to Chunksanity when you didn't pick it * Begins adding generation rules for data-driven logic * Moves region handling and location creating to different methods * Adds logic limits to Options * Begun the location generation has * Randomly generates tasks for each skill until populated * Mopping up improper names, adding custom logic, and fixes location rolling * Drastically cleans up the location rolling loop * Modifies generation to properly use local variables and pass unit tests * Game is now generating, but rules don't seem to work * Lambda capture, my old nemesis. We meet again * Fixes issue with Corsair Cove item requirement causing logic loop * Okay one more fix, another variable capture * On second thought lets not have skull sceptre tasks. 'Tis a silly place * Removes QP from item pool (they're events not items) * Removes Stronghold floor tasks, no varbit to track them * Loads CSV with pkutil so it can be used in apworld * Fixes logic of skill tasks and adds QP requirements to long grinds * Fixes pathing in pkgutil call * Better handling for empty task categories, no longer throws errors * Fixes order for progressive tasks, removes un-checkable spider task * Fixes logic issues related to stew and the Blurite caves * Fixes issues generating causing tests to sporadically fail * Adds missing task that caused off-by-one error * Updates to new Options API * Updates generation to function properly with the Universal Tracker (Thanks Faris) * Replaces runtime CSV parsing with pre-made python files generated from CSVs * Switches to self.random and uses random.choice instead of doing it manually * Fixes to typing, variable names, iterators, and continue conditions * Replaces Name classes with Enums * Fixes parse error on region special rules * Skill requirements check now returns an accessrule instead of being one that checks options * Updates documentation and setup guide * Adjusts maximum numbers for combat and general tasks * Fixes region names so dictionary lookup works for chunksanity * Update worlds/osrs/docs/en_Old School Runescape.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Update worlds/osrs/docs/en_Old School Runescape.md Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> * Updates readme.md and codeowners doc * Removes erroneous East Varrock -> Al Kharid connection * Changes to canoe logic to account for woodcutting level options * Fixes embarassing typo on 'Edgeville' * Moves Logic CSVs to separate repository, addresses suggested changes on PR * Fixes logic error in east/west lumbridge regions. Fixes incorrect List typing in main * Removes task types with weight 0 from the list of rollable tasks * Missed another place that the task type had to be removed if 0 weight * Prevents adding an empty task weight if levels are too restrictive for tasks to be added * Removes giant blank space in error message * Adds player name to error for not having enough available tasks --------- Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>
2024-08-06 21:13:11 +00:00
import typing
from BaseClasses import Item, ItemClassification
from .Names import ItemNames
class ItemRow(typing.NamedTuple):
name: str
amount: int
progression: ItemClassification
class OSRSItem(Item):
game: str = "Old School Runescape"
QP_Items: typing.List[str] = [
ItemNames.QP_Cooks_Assistant,
ItemNames.QP_Demon_Slayer,
ItemNames.QP_Restless_Ghost,
ItemNames.QP_Romeo_Juliet,
ItemNames.QP_Sheep_Shearer,
ItemNames.QP_Shield_of_Arrav,
ItemNames.QP_Ernest_the_Chicken,
ItemNames.QP_Vampyre_Slayer,
ItemNames.QP_Imp_Catcher,
ItemNames.QP_Prince_Ali_Rescue,
ItemNames.QP_Dorics_Quest,
ItemNames.QP_Black_Knights_Fortress,
ItemNames.QP_Witchs_Potion,
ItemNames.QP_Knights_Sword,
ItemNames.QP_Goblin_Diplomacy,
ItemNames.QP_Pirates_Treasure,
ItemNames.QP_Rune_Mysteries,
ItemNames.QP_Misthalin_Mystery,
ItemNames.QP_Corsair_Curse,
ItemNames.QP_X_Marks_the_Spot,
ItemNames.QP_Below_Ice_Mountain
]
starting_area_dict: typing.Dict[int, str] = {
0: ItemNames.Lumbridge,
1: ItemNames.Al_Kharid,
2: ItemNames.Central_Varrock,
3: ItemNames.West_Varrock,
4: ItemNames.Edgeville,
5: ItemNames.Falador,
6: ItemNames.Draynor_Village,
7: ItemNames.Wilderness,
}
chunksanity_starting_chunks: typing.List[str] = [
ItemNames.Lumbridge,
ItemNames.Lumbridge_Swamp,
ItemNames.Lumbridge_Farms,
ItemNames.HAM_Hideout,
ItemNames.Draynor_Village,
ItemNames.Draynor_Manor,
ItemNames.Wizards_Tower,
ItemNames.Al_Kharid,
ItemNames.Citharede_Abbey,
ItemNames.South_Of_Varrock,
ItemNames.Central_Varrock,
ItemNames.Varrock_Palace,
ItemNames.East_Of_Varrock,
ItemNames.West_Varrock,
ItemNames.Edgeville,
ItemNames.Barbarian_Village,
ItemNames.Monastery,
ItemNames.Ice_Mountain,
ItemNames.Dwarven_Mines,
ItemNames.Falador,
ItemNames.Falador_Farm,
ItemNames.Crafting_Guild,
ItemNames.Rimmington,
ItemNames.Port_Sarim,
ItemNames.Mudskipper_Point,
ItemNames.Wilderness
]
# Some starting areas contain multiple regions, so if that area is rolled for Chunksanity, we need to map it to one
chunksanity_special_region_names: typing.Dict[str, str] = {
ItemNames.Lumbridge_Farms: 'Lumbridge Farms East',
ItemNames.Crafting_Guild: 'Crafting Guild Outskirts',
}