1"""Models for the Item, Item Class and Item Set APIs."""
2
3from msgspec import field
4
5from wow.models._common import Document, IdRef, LocalizedString, Model, Ref, TypedName
6
7__all__ = [
8 "Item",
9 "ItemAbilityRequirement",
10 "ItemArmor",
11 "ItemClass",
12 "ItemClassIndex",
13 "ItemDisplayValue",
14 "ItemDps",
15 "ItemFactionRequirement",
16 "ItemHolidayRequirement",
17 "ItemPlayableRequirement",
18 "ItemPreview",
19 "ItemPreviewSet",
20 "ItemPreviewSetItem",
21 "ItemPreviewSpell",
22 "ItemReagent",
23 "ItemRecipe",
24 "ItemReputationRequirement",
25 "ItemRequirements",
26 "ItemSearchData",
27 "ItemSellPrice",
28 "ItemSellPriceStrings",
29 "ItemSet",
30 "ItemSetEffect",
31 "ItemSetIndex",
32 "ItemSetRequirements",
33 "ItemSkillRequirement",
34 "ItemStartsQuest",
35 "ItemStat",
36 "ItemStatColor",
37 "ItemStatDisplay",
38 "ItemWeapon",
39 "ItemWeaponDamage",
40]
41
42
[docs]
43class ItemClassIndex(Document):
44 """Every item class, such as Weapon or Consumable."""
45
46 item_classes: tuple[Ref, ...]
47
48
[docs]
49class ItemClass(Document):
50 """An item class with its subclasses. A class with no subclasses, such as WoW Token, lists none."""
51
52 id: int
53 name: str
54 item_subclasses: tuple[Ref, ...] = ()
55
56
[docs]
57class ItemSetIndex(Document):
58 """Every item set."""
59
60 item_sets: tuple[Ref, ...]
61
62
[docs]
63class ItemSetEffect(Model):
64 """One bonus an item set grants at a piece-count threshold.
65
66 ``is_active`` is set only in a character's equipment, when the character wears enough pieces for the bonus.
67 """
68
69 display_string: str
70 required_count: int
71 is_active: bool = False
72
73
[docs]
74class ItemSet(Document):
75 """An equipment set and the bonuses wearing pieces of it grants."""
76
77 id: int
78 name: str
79 items: tuple[Ref, ...]
80 effects: tuple[ItemSetEffect, ...] = ()
81
82
[docs]
83class ItemDisplayValue(Model):
84 """An integer value with its rendered tooltip label, such as durability, item level or weapon speed."""
85
86 display_string: str
87 value: int
88
89
[docs]
90class ItemDps(Model):
91 """A weapon's damage-per-second rating with its rendered tooltip label."""
92
93 display_string: str
94 value: float
95
96
[docs]
97class ItemPlayableRequirement(Model):
98 """The classes, or the races, that can use an item."""
99
100 display_string: str
101 links: tuple[Ref, ...]
102
103
[docs]
104class ItemReputationRequirement(Model):
105 """The reputation standing an item needs. ``min_reputation_level`` counts tiers up from Hated, which is 0."""
106
107 faction: Ref
108 min_reputation_level: int
109 display_string: str
110
111
[docs]
112class ItemAbilityRequirement(Model):
113 """A spell a character must know before using an item, such as a riding skill."""
114
115 spell: Ref
116 display_string: str
117
118
[docs]
119class ItemFactionRequirement(Model):
120 """The one faction, Horde or Alliance, that can use an item."""
121
122 value: TypedName
123 display_string: str
124
125
[docs]
126class ItemHolidayRequirement(Model):
127 """The world event an item needs, such as Love is in the Air."""
128
129 display_string: str
130
131
[docs]
132class ItemRequirements(Model):
133 """What a character needs before equipping an item."""
134
135 level: ItemDisplayValue | None = None
136 playable_classes: ItemPlayableRequirement | None = None
137 playable_races: ItemPlayableRequirement | None = None
138 reputation: ItemReputationRequirement | None = None
139 skill: ItemSkillRequirement | None = None
140 ability: ItemAbilityRequirement | None = None
141 faction: ItemFactionRequirement | None = None
142 holiday: ItemHolidayRequirement | None = None
143
144
[docs]
145class ItemPreviewSpell(Model):
146 """A spell an item grants or procs, with the tooltip text describing it."""
147
148 spell: Ref
149 description: str
150 display_color: ItemStatColor | None = None
151
152
[docs]
153class ItemStatColor(Model):
154 """The RGBA color the tooltip renders a stat line in."""
155
156 r: int
157 g: int
158 b: int
159 a: float
160
161
[docs]
162class ItemStatDisplay(Model):
163 """A stat's rendered label and tooltip color."""
164
165 display_string: str
166 color: ItemStatColor
167
168
[docs]
169class ItemStat(Model):
170 """One stat line on an item's tooltip, such as ``+5 Agility``. A few lines, such as resistances, have only text."""
171
172 display: ItemStatDisplay
173 type: TypedName | None = None
174 value: int | None = None
175 is_equip_bonus: bool = False
176 is_hidden: bool = False
177
178
[docs]
179class ItemArmor(Model):
180 """An armor or a block value line on an item's tooltip."""
181
182 value: int
183 display: ItemStatDisplay
184
185
[docs]
186class ItemSellPriceStrings(Model):
187 """A sell price split into the coins the tooltip shows."""
188
189 header: str
190 gold: str
191 silver: str
192 copper: str
193
194
[docs]
195class ItemSellPrice(Model):
196 """What a vendor pays for an item, in copper, with its tooltip text."""
197
198 value: int
199 display_strings: ItemSellPriceStrings
200
201
[docs]
202class ItemSkillRequirement(Model):
203 """A profession skill level, such as Tailoring 300."""
204
205 profession: Ref
206 level: int
207 display_string: str
208
209
[docs]
210class ItemSetRequirements(Model):
211 """What a character needs before an item set's bonuses apply."""
212
213 skill: ItemSkillRequirement
214
215
[docs]
216class ItemPreviewSetItem(Model):
217 """One piece of an item set, as an item's tooltip lists it.
218
219 ``is_equipped`` is set only in a character's equipment, for the pieces the character wears.
220 """
221
222 item: Ref
223 is_equipped: bool = False
224
225
[docs]
226class ItemPreviewSet(Model):
227 """The item set an item belongs to, as its tooltip shows it.
228
229 In a character's equipment, ``display_string`` counts the pieces worn, such as ``Rotmender's Raiment (4/5)``.
230 """
231
232 item_set: Ref
233 items: tuple[ItemPreviewSetItem, ...]
234 display_string: str
235 effects: tuple[ItemSetEffect, ...] = ()
236 requirements: ItemSetRequirements | None = None
237
238
[docs]
239class ItemWeaponDamage(Model):
240 """A weapon's damage range."""
241
242 min_value: int
243 max_value: int
244 display_string: str
245 damage_class: TypedName
246
247
[docs]
248class ItemWeapon(Model):
249 """Weapon-specific tooltip data: speed, damage range and resulting DPS. Some weapons show only their damage."""
250
251 damage: ItemWeaponDamage
252 attack_speed: ItemDisplayValue | None = None
253 dps: ItemDps | None = None
254
255
[docs]
256class ItemStartsQuest(Model):
257 """The quest that an item starts when a character uses it."""
258
259 quest: Ref
260 display_string: str
261
262
[docs]
263class ItemReagent(Model):
264 """One reagent that a recipe uses, and how many."""
265
266 reagent: Ref
267 quantity: int
268
269
[docs]
270class ItemRecipe(Model):
271 """What a recipe item makes, and the reagents it uses."""
272
273 item: ItemPreview
274 reagents: tuple[ItemReagent, ...]
275 reagents_display_string: str
276
277
[docs]
278class ItemPreview(Model):
279 """The rendered tooltip for an item: everything the game client shows on hover."""
280
281 item: IdRef
282 quality: TypedName
283 name: str
284 media: IdRef
285 item_class: Ref
286 item_subclass: Ref
287 inventory_type: TypedName
288 binding: TypedName | None = None
289 unique_equipped: str | None = None
290 limit_category: str | None = None
291 name_description: ItemStatDisplay | None = None
292 description: str | None = None
293 armor: ItemArmor | None = None
294 shield_block: ItemArmor | None = None
295 weapon: ItemWeapon | None = None
296 stats: tuple[ItemStat, ...] = ()
297 spells: tuple[ItemPreviewSpell, ...] = ()
298 requirements: ItemRequirements | None = None
299 durability: ItemDisplayValue | None = None
300 charges: ItemDisplayValue | None = None
301 container_slots: ItemDisplayValue | None = None
302 expiration_time_left: ItemDisplayValue | None = None
303 level: ItemDisplayValue | None = None
304 sell_price: ItemSellPrice | None = None
305 set_: ItemPreviewSet | None = field(name="set", default=None)
306 recipe: ItemRecipe | None = None
307 item_starts_quest: ItemStartsQuest | None = None
308 crafting_reagent: str | None = None
309 toy: str | None = None
310 bonus_list: tuple[int, ...] = ()
311 context: int | None = None
312 is_subclass_hidden: bool = False
313
314
[docs]
315class Item(Document):
316 """An item, Thunderfury included."""
317
318 id: int
319 name: str
320 quality: TypedName
321 level: int
322 required_level: int
323 media: IdRef
324 item_class: Ref
325 item_subclass: Ref
326 inventory_type: TypedName
327 is_equippable: bool
328 is_stackable: bool
329 max_count: int
330 purchase_price: int
331 purchase_quantity: int
332 sell_price: int
333 preview_item: ItemPreview
334 description: str | None = None
335 appearances: tuple[IdRef, ...] = ()
336
337
338class _ItemSearchIdOnly(Model):
339 """An id-only reference, as search results carry it."""
340
341 id: int
342
343
344class _ItemSearchLocalizedRef(Model):
345 """An id and localized name, as search results carry nested class and subclass refs."""
346
347 id: int
348 name: LocalizedString
349
350
351class _ItemSearchLocalizedType(Model):
352 """A ``type`` constant with its localized label, as search results carry it."""
353
354 type: str
355 name: LocalizedString
356
357
[docs]
358class ItemSearchData(Model):
359 """One item as indexed for search: every locale's name at once, no ``_links``."""
360
361 id: int
362 name: LocalizedString
363 quality: _ItemSearchLocalizedType
364 level: int
365 required_level: int
366 media: _ItemSearchIdOnly
367 item_class: _ItemSearchLocalizedRef
368 item_subclass: _ItemSearchLocalizedRef
369 inventory_type: _ItemSearchLocalizedType
370 is_equippable: bool
371 is_stackable: bool
372 max_count: int
373 purchase_price: int
374 purchase_quantity: int
375 sell_price: int
376 appearances: tuple[_ItemSearchIdOnly, ...] = ()