Source code for wow.models.talent

  1"""Models for the Talent and Talent Tree APIs."""
  2
  3from msgspec import field
  4
  5from wow.models._common import Document, Link, Model, NamedLink, Ref
  6
  7__all__ = [
  8    "SpellTooltip",
  9    "Talent",
 10    "TalentClassRef",
 11    "TalentIndex",
 12    "TalentRankDescription",
 13    "TalentTree",
 14    "TalentTreeIndex",
 15    "TalentTreeMedia",
 16    "TalentTreeNode",
 17    "TalentTreeNodeRank",
 18    "TalentTreeNodeRankTooltip",
 19    "TalentTreeNodeType",
 20]
 21
 22
[docs] 23class TalentRankDescription(Model): 24 """The tooltip text for one rank of a talent.""" 25 26 rank: int 27 description: str
28 29
[docs] 30class TalentIndex(Document): 31 """Every talent across every class and specialization. Forever has 651 talents.""" 32 33 talents: tuple[Ref, ...]
34 35
[docs] 36class TalentClassRef(Model): 37 """The class a talent belongs to. Class-wide talents carry no ``name``.""" 38 39 key: Link 40 id: int 41 name: str | None = None
42 43
[docs] 44class Talent(Document): 45 """A single talent, with the spell it grants and its per-rank descriptions. 46 47 Specialization talents carry ``playable_specialization``; class-wide talents do not. Some talents are bare ids, 48 with no class, spell or ranks. 49 """ 50 51 id: int 52 playable_class: TalentClassRef | None = None 53 playable_specialization: Ref | None = None 54 spell: Ref | None = None 55 rank_descriptions: tuple[TalentRankDescription, ...] = ()
56 57
[docs] 58class TalentTreeIndex(Document): 59 """Every class and specialization talent tree. Forever has 9 class trees and 27 spec trees.""" 60 61 class_talent_trees: tuple[NamedLink, ...] 62 spec_talent_trees: tuple[NamedLink, ...]
63 64
[docs] 65class TalentTreeMedia(Model): 66 """A talent tree's media link, with no id of its own.""" 67 68 key: Link
69 70
[docs] 71class SpellTooltip(Model): 72 """The rendered tooltip for one talent rank's spell.""" 73 74 cast_time: str 75 description: str 76 spell: Ref 77 power_cost: str | None = None 78 cooldown: str | None = None 79 range_: str | None = field(name="range", default=None)
80 81
[docs] 82class TalentTreeNodeRankTooltip(Model): 83 """The talent and spell shown for one rank of a talent tree node.""" 84 85 talent: Ref 86 spell_tooltip: SpellTooltip
87 88
[docs] 89class TalentTreeNodeRank(Model): 90 """One learnable rank of a talent tree node.""" 91 92 rank: int 93 tooltip: TalentTreeNodeRankTooltip
94 95
[docs] 96class TalentTreeNodeType(Model): 97 """A talent tree node's kind, such as an active talent.""" 98 99 id: int 100 type: str
101 102
[docs] 103class TalentTreeNode(Model): 104 """One node in a specialization's talent tree, positioned on its grid.""" 105 106 id: int 107 display_row: int 108 display_col: int 109 raw_position_x: int 110 raw_position_y: int 111 node_type: TalentTreeNodeType 112 ranks: tuple[TalentTreeNodeRank, ...] 113 locked_by: tuple[int, ...] = () 114 unlocks: tuple[int, ...] = ()
115 116
[docs] 117class TalentTree(Document): 118 """One specialization's talent tree: its nodes, positions and prerequisites.""" 119 120 id: int 121 name: str 122 media: TalentTreeMedia 123 playable_class: Ref 124 playable_specialization: Ref 125 spec_talent_nodes: tuple[TalentTreeNode, ...]