1"""Models for the Character Profile API.
2
3Forever characters have no realm. A character's address is its ``name-surname`` slug, such as
4``/profile/wow/character/psyence-spiritbound``, and an app token can read any character. Battle.net has no search for
5characters: you look one up by its exact name and surname.
6"""
7
8from msgspec import field
9
10from wow.models._common import Document, IdName, IdRef, Link, Model, Ref, TypedName
11from wow.models.guild import GuildRef
12from wow.models.item import ItemPreview, ItemPreviewSet
13
14__all__ = [
15 "AchievementCategoryProgress",
16 "AchievementEvent",
17 "AppearanceCustomization",
18 "AppearanceCustomizationChoice",
19 "AppearanceCustomizationOption",
20 "AppearanceItem",
21 "CharacterAchievement",
22 "CharacterAchievementStatistics",
23 "CharacterAchievements",
24 "CharacterAppearance",
25 "CharacterCollections",
26 "CharacterCompletedQuests",
27 "CharacterEquipment",
28 "CharacterHunterPet",
29 "CharacterHunterPets",
30 "CharacterMedia",
31 "CharacterMediaAsset",
32 "CharacterMounts",
33 "CharacterPets",
34 "CharacterProfession",
35 "CharacterProfessions",
36 "CharacterProfile",
37 "CharacterPvpSummary",
38 "CharacterQuests",
39 "CharacterRef",
40 "CharacterReputation",
41 "CharacterReputations",
42 "CharacterSpecializations",
43 "CharacterStatistics",
44 "CharacterStatus",
45 "CharacterToys",
46 "CharacterTransmogs",
47 "CollectedMount",
48 "CollectedPet",
49 "CollectedPetStats",
50 "CollectedToy",
51 "CombatRating",
52 "CombatRatingValue",
53 "CriteriaProgress",
54 "EnchantmentSlot",
55 "EquippedItem",
56 "GuildCrest",
57 "GuildCrestBackground",
58 "GuildCrestColor",
59 "GuildCrestColorRgba",
60 "GuildCrestPart",
61 "ItemEnchantment",
62 "ItemTransmog",
63 "LearnedSpecialization",
64 "LearnedTalent",
65 "LearnedTalentTooltip",
66 "ProfessionTierProgress",
67 "PvpMapStatistics",
68 "PvpMatchStatistics",
69 "ReputationStanding",
70 "SpecializationGroup",
71 "StatValue",
72 "Statistic",
73 "StatisticCategory",
74 "TransmogSlot",
75]
76
77
[docs]
78class CharacterRef(Model):
79 """The character a profile document belongs to."""
80
81 key: Link
82 id: int
83 name: str
84 surname: str
85 slug: str
86
87
[docs]
88class CharacterProfile(Document):
89 """A character's summary, with links to every other part of its profile.
90
91 Attributes:
92 name_search: The full name as Battle.net indexes it, such as ``Psyence Spiritbound``.
93 last_login_timestamp: When the character last logged out, in Unix milliseconds. Battle.net updates a profile
94 when its character logs out.
95 is_remix: Whether this is a Remix character.
96 guild: The character's guild, or ``None`` if it has none.
97 hunter_pets: A link to a hunter's pets. Only hunters have it.
98 """
99
100 id: int
101 name: str
102 surname: str
103 name_search: str
104 gender: TypedName
105 faction: TypedName
106 race: Ref
107 character_class: Ref
108 ruleset: Ref
109 level: int
110 experience: int
111 achievement_points: int
112 average_item_level: int
113 equipped_item_level: int
114 last_login_timestamp: int
115 is_remix: bool
116 achievements: Link
117 achievements_statistics: Link
118 appearance: Link
119 collections: Link
120 encounters: Link
121 equipment: Link
122 media: Link
123 mythic_keystone_profile: Link
124 professions: Link
125 pvp_summary: Link
126 quests: Link
127 reputations: Link
128 specializations: Link
129 statistics: Link
130 titles: Link
131 guild: GuildRef | None = None
132 hunter_pets: Link | None = None
133
134
[docs]
135class CharacterStatus(Document):
136 """Whether a character still exists. ``id`` changes if the character was deleted and its name reused."""
137
138 id: int
139 is_valid: bool
140
141
147
148
154
155
[docs]
156class PvpMatchStatistics(Model):
157 """How many battlegrounds a character played, won and lost on one map."""
158
159 played: int
160 won: int
161 lost: int
162
163
[docs]
164class PvpMapStatistics(Model):
165 """A character's record on one battleground map."""
166
167 world_map: IdName
168 match_statistics: PvpMatchStatistics
169
170
[docs]
171class CharacterPvpSummary(Document):
172 """A character's lifetime honorable kills and PvP rank, and their record on each battleground they have played."""
173
174 character: CharacterRef
175 honorable_kills: int
176 pvp_rank: int
177 pvp_map_statistics: tuple[PvpMapStatistics, ...] = ()
178
179
[docs]
180class EnchantmentSlot(Model):
181 """Where an enchantment sits on an item.
182
183 A permanent enchant carries ``type`` ``PERMANENT``. A temporary one, such as a weapon imbue, carries only an id.
184 """
185
186 id: int
187 type: str | None = None
188
189
[docs]
190class ItemEnchantment(Model):
191 """An enchantment on an equipped item, and the item that applied it.
192
193 A spell's imbue, such as a shaman's Rockbiter, has no ``source_item``.
194 """
195
196 enchantment_id: int
197 display_string: str
198 enchantment_slot: EnchantmentSlot
199 source_item: Ref | None = None
200
201
[docs]
202class ItemTransmog(Model):
203 """The appearance an equipped item is transmogrified to.
204
205 Shoulders can show a different appearance on each side; ``second_item`` is the other side's.
206 """
207
208 item: Ref
209 display_string: str
210 item_modified_appearance_id: int
211 second_item: Ref | None = None
212 second_item_modified_appearance_id: int | None = None
213
214
[docs]
215class EquippedItem(ItemPreview, kw_only=True):
216 """An item a character wears: the item's tooltip plus its slot, enchantments and transmog."""
217
218 slot: TypedName
219 quantity: int | None = None
220 enchantments: tuple[ItemEnchantment, ...] = ()
221 transmog: ItemTransmog | None = None
222
223
[docs]
224class CharacterEquipment(Document):
225 """Every item a character wears, and each item set it wears pieces of with the bonuses those pieces give."""
226
227 character: CharacterRef
228 equipped_items: tuple[EquippedItem, ...] = ()
229 equipped_item_sets: tuple[ItemPreviewSet, ...] = ()
230
231
[docs]
232class StatValue(Model):
233 """A primary stat, armor or a resistance: its value before and after gear and buffs."""
234
235 base: int
236 effective: int
237
238
[docs]
239class CombatRating(Model):
240 """A secondary stat's rating, such as speed or avoidance.
241
242 ``value`` is the percentage the rating gives. Sheets Battle.net wrote before its 2026-11-05 update leave it out
243 for speed and avoidance.
244 """
245
246 rating_bonus: float
247 rating_normalized: int
248 value: float | None = None
249
250
[docs]
251class CombatRatingValue(CombatRating):
252 """A secondary stat's rating and the percentage it gives, such as crit or dodge."""
253
254 value: float
255
256
[docs]
257class CharacterStatistics(Document, kw_only=True):
258 """A character's stats sheet, as the character pane shows it.
259
260 Battle.net writes the sheet when the character logs out. Sheets written before its 2026-11-05 update lack the
261 hit, expertise, defense, ranged and movement stats, so those are ``None`` until the character plays again.
262 """
263
264 character: CharacterRef
265 health: int
266 power: int
267 power_type: Ref
268 strength: StatValue
269 agility: StatValue
270 intellect: StatValue
271 stamina: StatValue
272 spirit: StatValue
273 armor: StatValue
274 bonus_armor: int
275 attack_power: int
276 ranged_attack_power: int | None = None
277 spell_power: int
278 spell_penetration: int
279 spell_healing: int | None = None
280 mana_regen: float
281 mana_regen_combat: float
282 main_hand_damage_min: float
283 main_hand_damage_max: float
284 main_hand_speed: float
285 main_hand_dps: float
286 off_hand_damage_min: float
287 off_hand_damage_max: float
288 off_hand_speed: float
289 off_hand_dps: float
290 ranged_damage_min: float | None = None
291 ranged_damage_max: float | None = None
292 melee_hit: CombatRatingValue | None = None
293 ranged_hit: CombatRatingValue | None = None
294 spell_hit: CombatRatingValue | None = None
295 off_hand_hit: CombatRatingValue | None = None
296 expertise: float | None = None
297 off_hand_expertise: float | None = None
298 armor_penetration: float | None = None
299 defense: StatValue | None = None
300 melee_crit: CombatRatingValue
301 melee_haste: CombatRatingValue
302 ranged_crit: CombatRatingValue
303 ranged_haste: CombatRatingValue
304 spell_crit: CombatRatingValue
305 spell_haste: CombatRatingValue
306 mastery: CombatRatingValue
307 lifesteal: CombatRatingValue
308 dodge: CombatRatingValue
309 parry: CombatRatingValue
310 block: CombatRatingValue
311 speed: CombatRating
312 avoidance: CombatRating
313 movement_speed: float | None = None
314 versatility: float
315 versatility_damage_done_bonus: float
316 versatility_healing_done_bonus: float
317 versatility_damage_taken_bonus: float
318 fire_resistance: StatValue
319 frost_resistance: StatValue
320 nature_resistance: StatValue
321 shadow_resistance: StatValue
322 arcane_resistance: StatValue
323
324
334
335
[docs]
336class LearnedTalent(Model):
337 """A talent a character has put points into, and the rank it reached."""
338
339 talent: IdName
340 talent_rank: int
341 spell_tooltip: LearnedTalentTooltip
342
343
[docs]
344class LearnedSpecialization(Model):
345 """The talents a character has learned in one specialization's tree."""
346
347 specialization: Ref
348 specialization_name: str
349 spent_points: int
350 talents: tuple[LearnedTalent, ...] = ()
351
352
[docs]
353class SpecializationGroup(Model):
354 """One talent loadout. ``is_active`` marks the one the character uses now."""
355
356 is_active: bool
357 specializations: tuple[LearnedSpecialization, ...] = ()
358
359
[docs]
360class CharacterSpecializations(Document):
361 """A character's talent loadouts."""
362
363 character: CharacterRef
364 specialization_groups: tuple[SpecializationGroup, ...] = ()
365
366
[docs]
367class ProfessionTierProgress(Model):
368 """A character's skill in one profession tier, and the recipes it knows there."""
369
370 tier: IdName
371 skill_points: int
372 max_skill_points: int
373 known_recipes: tuple[Ref, ...] = ()
374
375
[docs]
376class CharacterProfession(Model):
377 """A profession a character has learned."""
378
379 profession: Ref
380 tiers: tuple[ProfessionTierProgress, ...] = ()
381
382
[docs]
383class CharacterProfessions(Document):
384 """A character's primary professions, such as Mining, and secondary ones, such as Cooking."""
385
386 character: CharacterRef
387 primaries: tuple[CharacterProfession, ...] = ()
388 secondaries: tuple[CharacterProfession, ...] = ()
389
390
[docs]
391class ReputationStanding(Model):
392 """A character's standing with one faction.
393
394 Attributes:
395 raw: Reputation earned in total.
396 value: Progress within the current tier, out of ``max``.
397 tier: The tier's position, counting up from Hated.
398 name: The tier's name, such as ``Honored``.
399 """
400
401 raw: int
402 value: int
403 max: int
404 tier: int
405 name: str
406
407
[docs]
408class CharacterReputation(Model):
409 """A character's standing with one faction."""
410
411 faction: Ref
412 standing: ReputationStanding
413
414
[docs]
415class CharacterReputations(Document):
416 """Every faction a character has met."""
417
418 character: CharacterRef
419 reputations: tuple[CharacterReputation, ...] = ()
420
421
[docs]
422class CriteriaProgress(Model):
423 """A character's progress on an achievement's criteria, or on one part of them."""
424
425 id: int
426 is_completed: bool
427 amount: int | None = None
428 child_criteria: tuple[CriteriaProgress, ...] = ()
429
430
[docs]
431class CharacterAchievement(Model):
432 """An achievement a character has made progress on. ``completed_timestamp`` is set once it is earned."""
433
434 id: int
435 achievement: Ref
436 criteria: CriteriaProgress
437 completed_timestamp: int | None = None
438
439
[docs]
440class AchievementCategoryProgress(Model):
441 """How many achievements, and points, a character has earned in one category."""
442
443 category: Ref
444 quantity: int
445 points: int
446
447
[docs]
448class AchievementEvent(Model):
449 """An achievement a character earned recently, and when, in Unix milliseconds."""
450
451 achievement: Ref
452 timestamp: int
453
454
[docs]
455class CharacterAchievements(Document):
456 """A character's achievements, points and recent achievement events."""
457
458 character: CharacterRef
459 total_quantity: int
460 total_points: int
461 statistics: Link
462 achievements: tuple[CharacterAchievement, ...] = ()
463 category_progress: tuple[AchievementCategoryProgress, ...] = ()
464 recent_events: tuple[AchievementEvent, ...] = ()
465
466
[docs]
467class Statistic(Model):
468 """One counter on the statistics pane, such as Total kills."""
469
470 id: int
471 name: str
472 quantity: float
473 last_updated_timestamp: int
474 description: str | None = None
475
476
[docs]
477class StatisticCategory(Model):
478 """A group of statistics, such as Kills, with its sub-groups."""
479
480 id: int
481 name: str
482 statistics: tuple[Statistic, ...] = ()
483 sub_categories: tuple[StatisticCategory, ...] = ()
484
485
[docs]
486class CharacterAchievementStatistics(Document):
487 """A character's statistics pane: kills, deaths, consumables and more."""
488
489 character: CharacterRef
490 categories: tuple[StatisticCategory, ...] = ()
491
492
[docs]
493class CharacterCollections(Document):
494 """Links to every collection a character has."""
495
496 character: CharacterRef
497 mounts: Link
498 pets: Link
499 toys: Link
500 heirlooms: Link
501 transmogs: Link
502
503
[docs]
504class CollectedMount(Model):
505 """A mount a character has collected."""
506
507 mount: Ref
508 is_useable: bool
509 is_favorite: bool = False
510
511
[docs]
512class CharacterMounts(Document):
513 """A character's mounts."""
514
515 mounts: tuple[CollectedMount, ...] = ()
516
517
[docs]
518class CollectedPetStats(Model):
519 """A collected battle pet's breed and stats."""
520
521 breed_id: int
522 health: int
523 power: int
524 speed: int
525
526
[docs]
527class CollectedPet(Model):
528 """A battle pet a character has collected. ``id`` names this pet, ``species`` its kind."""
529
530 id: int
531 species: Ref
532 level: int
533 quality: TypedName
534 stats: CollectedPetStats
535 creature_display: IdRef
536 is_favorite: bool = False
537
538
[docs]
539class CharacterPets(Document):
540 """A character's battle pets, and how many battle slots it has unlocked."""
541
542 unlocked_battle_pet_slots: int
543 pets: tuple[CollectedPet, ...] = ()
544
545
[docs]
546class CollectedToy(Model):
547 """A toy a character has collected."""
548
549 toy: Ref
550 is_favorite: bool = False
551
552
[docs]
553class CharacterToys(Document):
554 """A character's toys."""
555
556 toys: tuple[CollectedToy, ...] = ()
557
558
[docs]
559class TransmogSlot(Model):
560 """The appearances a character has collected for one equipment slot."""
561
562 slot: TypedName
563 appearances: tuple[IdRef, ...] = ()
564
565
[docs]
566class CharacterTransmogs(Document):
567 """A character's collected appearances, by slot."""
568
569 slots: tuple[TransmogSlot, ...] = ()
570
571
[docs]
572class CharacterQuests(Document):
573 """The quests a character has in its quest log, and a link to the ones it has completed."""
574
575 character: CharacterRef
576 completed: Link
577 in_progress: tuple[Ref, ...] = ()
578
579
[docs]
580class CharacterCompletedQuests(Document):
581 """Every quest a character has completed."""
582
583 character: CharacterRef
584 quests: tuple[Ref, ...] = ()
585
586
[docs]
587class GuildCrestColorRgba(Model):
588 """The RGBA color a crest color renders as. Only some crest colors carry one."""
589
590 r: int
591 g: int
592 b: int
593 a: float
594
595
[docs]
596class GuildCrestColor(Model):
597 """A crest color: its catalog id, and its RGBA value when Battle.net sends one."""
598
599 id: int
600 rgba: GuildCrestColorRgba | None = None
601
602
[docs]
603class GuildCrestPart(Model):
604 """A guild crest's border or its emblem: the catalog id, its color and its rendered media."""
605
606 id: int
607 color: GuildCrestColor
608 media: IdRef
609
610
[docs]
611class GuildCrestBackground(Model):
612 """A guild crest's background color."""
613
614 color: GuildCrestColor
615
616
[docs]
617class GuildCrest(Model):
618 """A character's guild's crest, as its tabard renders it."""
619
620 background: GuildCrestBackground
621 border: GuildCrestPart
622 emblem: GuildCrestPart
623
624
[docs]
625class AppearanceCustomizationOption(Model):
626 """A customization category, such as Hair Style."""
627
628 id: int
629 name: str
630
631
[docs]
632class AppearanceCustomizationChoice(Model):
633 """A customization choice a character made. Some choices, such as a hairstyle, carry a name."""
634
635 id: int
636 display_order: int
637 name: str | None = None
638
639
[docs]
640class AppearanceCustomization(Model):
641 """One customization slot and the choice a character made in it."""
642
643 option: AppearanceCustomizationOption
644 choice: AppearanceCustomizationChoice
645
646
[docs]
647class AppearanceItem(Model):
648 """One item contributing to a character's rendered appearance.
649
650 ``item_appearance_modifier_id`` and ``subclass`` only appear for some slots, such as cloaks. A split-slot item,
651 such as shoulders transmogrified to two different appearances, also carries a ``secondary_*`` set for the other
652 side.
653 """
654
655 id: int
656 slot: TypedName
657 enchant: int
658 internal_slot_id: int
659 item_appearance_modifier_id: int | None = None
660 subclass: int | None = None
661 secondary_id: int | None = None
662 secondary_item_appearance_modifier_id: int | None = None
663 secondary_subclass: int | None = None
664
665
[docs]
666class CharacterAppearance(Document):
667 """A character's rendered appearance: its gear, customizations and guild crest.
668
669 ``guild_crest`` is absent for a guildless character.
670 """
671
672 character: CharacterRef
673 playable_race: Ref
674 playable_class: Ref
675 gender: TypedName
676 faction: TypedName
677 items: tuple[AppearanceItem, ...] = ()
678 customizations: tuple[AppearanceCustomization, ...] = ()
679 guild_crest: GuildCrest | None = None
680
681
[docs]
682class CharacterHunterPet(Model):
683 """One tamed pet in a hunter's stable.
684
685 ``is_active`` marks the pet in the hunter's active pet slot; ``is_summoned`` marks the one currently summoned.
686 """
687
688 name: str
689 level: int
690 slot: int
691 creature: Ref
692 creature_display: IdRef
693 is_active: bool = False
694 is_summoned: bool = False
695
696
[docs]
697class CharacterHunterPets(Document):
698 """A hunter's tamed pets.
699
700 Only hunters have this document; one with no pets currently tamed answers with no ``hunter_pets`` at all.
701 """
702
703 character: CharacterRef
704 hunter_pets: tuple[CharacterHunterPet, ...] = ()