1"""WoW: Forever's dungeons and raids, as group owners pick them for their voice channel's status.
2
3Dungeons are split at level 37 because a Discord select holds at most 25 options; each list stays in level order.
4New instances go here by hand when Blizzard adds them.
5"""
6
7import re
8from typing import Final
9
10DUNGEONS_LOW: Final = (
11 "Ragefire Chasm",
12 "Hall of Thanes",
13 "Ruins of Lordaeron",
14 "The Deadmines",
15 "Wailing Caverns",
16 "Shadowfang Keep",
17 "Blackfathom Deeps",
18 "Excavation Site: Wetlands",
19 "The Stockade",
20 "City of Dalaran",
21 "Gnomeregan",
22 "Razorfen Kraul",
23 "Scarlet Monastery: Graveyard",
24 "Scarlet Monastery: Library",
25 "Scarlet Monastery: Armory",
26 "Scarlet Monastery: Cathedral",
27 "The Drowned City",
28)
29"""Dungeons for levels 13 to 40."""
30
31DUNGEONS_HIGH: Final = (
32 "Uldaman",
33 "Razorfen Downs",
34 "Zul'Farrak",
35 "Krol'dok Stronghold",
36 "Maraudon",
37 "Alcaz Prison",
38 "Sunken Temple",
39 "Blackrock Depths",
40 "Blackmaw Hold",
41 "Lower Blackrock Spire",
42 "Upper Blackrock Spire",
43 "Shaper's Terrace",
44 "Dire Maul: East",
45 "Dire Maul: West",
46 "Dire Maul: North",
47 "Stratholme",
48 "Scholomance",
49)
50"""Dungeons for levels 37 to 60."""
51
52RAIDS: Final = ("Hyjal Summit", "Barrow Deeps", "Onyxia's Lair")
53
54_GUIDE_SLUGS: Final[dict[str, str]] = {
55 "Ragefire Chasm": "ragefire-chasm",
56 "Hall of Thanes": "hall-of-thanes",
57 "Ruins of Lordaeron": "ruins-of-lordaeron",
58 "The Deadmines": "deadmines",
59 "Wailing Caverns": "wailing-caverns",
60 "Shadowfang Keep": "shadowfang-keep",
61 "Blackfathom Deeps": "blackfathom-deeps",
62 "Excavation Site: Wetlands": "excavation-site-wetlands",
63 "The Stockade": "stockade",
64 "City of Dalaran": "city-of-dalaran",
65 "Gnomeregan": "gnomeregan",
66 "Razorfen Kraul": "razorfen-kraul",
67 "Scarlet Monastery: Graveyard": "scarlet-monastery-graveyard",
68 "Scarlet Monastery: Library": "scarlet-monastery-library",
69 "Scarlet Monastery: Armory": "scarlet-monastery-armory",
70 "Scarlet Monastery: Cathedral": "scarlet-monastery-cathedral",
71 "The Drowned City": "drowned-city",
72 "Uldaman": "uldaman",
73 "Razorfen Downs": "razorfen-downs",
74 "Zul'Farrak": "zul-farrak",
75 "Krol'dok Stronghold": "kroldok-stronghold",
76 "Maraudon": "maraudon",
77 "Alcaz Prison": "alcaz-prison",
78 "Sunken Temple": "sunken-temple",
79 "Blackrock Depths": "blackrock-depths",
80 "Blackmaw Hold": "blackmaw-hold",
81 "Lower Blackrock Spire": "lower-blackrock-spire",
82 "Upper Blackrock Spire": "upper-blackrock-spire",
83 "Shaper's Terrace": "shapers-terrace",
84 "Dire Maul: East": "dire-maul-east",
85 "Dire Maul: West": "dire-maul-west",
86 "Dire Maul: North": "dire-maul-north",
87 "Stratholme": "stratholme",
88 "Scholomance": "scholomance",
89}
90"""Each dungeon's guide page slug on sidequest-guild.com (the site's src/data/dungeons/<slug>.json)."""
91
92GUIDE_URLS: Final[dict[str, str]] = {
93 name: f"https://sidequest-guild.com/dungeons/{slug}/" for name, slug in _GUIDE_SLUGS.items()
94}
95"""Guild guide links on sidequest-guild.com, by the same names as ``DUNGEONS_LOW``/``DUNGEONS_HIGH``/``RAIDS``."""
96
97_APOSTROPHE_RE: Final = re.compile("[\u2018\u2019\u02bc]")
98_SEPARATOR_RE: Final = re.compile(r"[:\-]")
99_WHITESPACE_RE: Final = re.compile(r"\s+")
100
101
102def _normalize(name: str) -> str:
103 """``name`` folded for matching: straight apostrophes, ``:``/``-`` as spaces, no leading "The", casefolded."""
104 text = _WHITESPACE_RE.sub(" ", _SEPARATOR_RE.sub(" ", _APOSTROPHE_RE.sub("'", name)).strip()).casefold()
105 return text.removeprefix("the ")
106
107
108_INSTANCE_NAMES: Final = DUNGEONS_LOW + DUNGEONS_HIGH + RAIDS
109_DIRECT: Final[dict[str, tuple[str, ...]]] = {_normalize(name): (name,) for name in _INSTANCE_NAMES}
110"""Every instance post name, normalized, mapped to itself: covers an exact name with any spelling of its
111separator ("Dire Maul: East"/"Dire Maul - East"/"Dire Maul East"), a leading "The", or a curly apostrophe."""
112
113_ALIASES: Final[dict[str, tuple[str, ...]]] = {
114 "dire maul": ("Dire Maul: East", "Dire Maul: West", "Dire Maul: North"),
115 "scarlet monastery": (
116 "Scarlet Monastery: Graveyard",
117 "Scarlet Monastery: Library",
118 "Scarlet Monastery: Armory",
119 "Scarlet Monastery: Cathedral",
120 ),
121 "blackrock spire": ("Lower Blackrock Spire", "Upper Blackrock Spire"),
122 "temple of atal'hakkar": ("Sunken Temple",),
123 "onyxia": ("Onyxia's Lair",),
124 "stormwind stockade": ("The Stockade",),
125}
126"""Hotfix-post bullet names that don't match an instance post name once normalized: a whole wing-less instance
127fanning out to every wing, or another name Blizzard's patch notes use for one. Unlisted names resolve directly.
128"""
129
130
[docs]
131def resolve_instances(name: str) -> tuple[str, ...]:
132 """The instance post names a hotfix-post bullet called ``name`` covers; empty if it doesn't name an instance."""
133 key = _normalize(name)
134 return _ALIASES.get(key) or _DIRECT.get(key, ())