evtc\player/
spec.rs

1use super::Profession;
2use num_enum::{FromPrimitive, IntoPrimitive};
3
4#[cfg(feature = "serde")]
5use serde::{Deserialize, Serialize};
6
7#[cfg(feature = "strum")]
8use strum::{Display, EnumCount, EnumIter, IntoStaticStr, VariantNames};
9
10/// Player specialization.
11#[derive(
12    Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, FromPrimitive,
13)]
14#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
15#[cfg_attr(
16    feature = "strum",
17    derive(Display, EnumCount, EnumIter, IntoStaticStr, VariantNames)
18)]
19#[repr(u32)]
20pub enum Specialization {
21    /// Unknown or invalid.
22    #[default]
23    Unknown = 0,
24
25    // mesmer
26    Dueling = 1,
27    Domination = 10,
28    Inspiration = 23,
29    Illusions = 24,
30    Chronomancer = 40,
31    Chaos = 45,
32    Mirage = 59,
33    Virtuoso = 66,
34
35    // necromancer
36    DeathMagic = 2,
37    BloodMagic = 19,
38    Reaper = 34,
39    Curses = 39,
40    SoulReaping = 50,
41    Spite = 53,
42    Scourge = 60,
43    Harbinger = 64,
44
45    // revenant
46    Invocation = 3,
47    Retribution = 9,
48    Corruption = 14,
49    Devastation = 15,
50    Salvation = 12,
51    Herald = 52,
52    Renegade = 63,
53    Vindicator = 69,
54
55    // warrior
56    Strength = 4,
57    Tactics = 11,
58    Berserker = 18,
59    Defense = 22,
60    Arms = 36,
61    Discipline = 51,
62    Spellbreaker = 61,
63    Bladesworn = 68,
64
65    // ranger
66    Druid = 5,
67    Marksmanship = 8,
68    NatureMagic = 25,
69    Skirmishing = 30,
70    Beastmastery = 32,
71    WildernessSurvival = 33,
72    Soulbeast = 55,
73    Untamed = 72,
74
75    // engineer
76    Explosives = 6,
77    Tools = 21,
78    Alchemy = 29,
79    Firearms = 38,
80    Scrapper = 43,
81    Inventions = 47,
82    Holosmith = 57,
83    Mechanist = 70,
84
85    // thief
86    Daredevil = 7,
87    ShadowArts = 20,
88    DeadlyArts = 28,
89    CriticalStrikes = 35,
90    Trickery = 44,
91    Acrobatics = 54,
92    Deadeye = 58,
93    Specter = 71,
94
95    // guardian
96    Valor = 13,
97    Radiance = 16,
98    Dragonhunter = 27,
99    Zeal = 42,
100    Virtues = 46,
101    Honor = 49,
102    Firebrand = 62,
103    Willbender = 65,
104
105    // elementalist
106    Water = 17,
107    Earth = 26,
108    Fire = 31,
109    Arcane = 37,
110    Air = 41,
111    Tempest = 48,
112    Weaver = 56,
113    Catalyst = 67,
114}
115
116impl Specialization {
117    /// Returns the [`Profession`] corresponding to the specialization.
118    #[inline]
119    pub fn profession(&self) -> Profession {
120        match self {
121            Self::Unknown => Profession::Unknown,
122
123            Self::Dueling
124            | Self::Domination
125            | Self::Inspiration
126            | Self::Illusions
127            | Self::Chronomancer
128            | Self::Chaos
129            | Self::Mirage
130            | Self::Virtuoso => Profession::Mesmer,
131
132            Self::DeathMagic
133            | Self::BloodMagic
134            | Self::Reaper
135            | Self::Curses
136            | Self::SoulReaping
137            | Self::Spite
138            | Self::Scourge
139            | Self::Harbinger => Profession::Necromancer,
140
141            Self::Invocation
142            | Self::Retribution
143            | Self::Corruption
144            | Self::Devastation
145            | Self::Salvation
146            | Self::Herald
147            | Self::Renegade
148            | Self::Vindicator => Profession::Revenant,
149
150            Self::Strength
151            | Self::Tactics
152            | Self::Berserker
153            | Self::Defense
154            | Self::Arms
155            | Self::Discipline
156            | Self::Spellbreaker
157            | Self::Bladesworn => Profession::Warrior,
158
159            Self::Druid
160            | Self::Marksmanship
161            | Self::NatureMagic
162            | Self::Skirmishing
163            | Self::Beastmastery
164            | Self::WildernessSurvival
165            | Self::Soulbeast
166            | Self::Untamed => Profession::Ranger,
167
168            Self::Explosives
169            | Self::Tools
170            | Self::Alchemy
171            | Self::Firearms
172            | Self::Scrapper
173            | Self::Inventions
174            | Self::Holosmith
175            | Self::Mechanist => Profession::Engineer,
176
177            Self::Daredevil
178            | Self::ShadowArts
179            | Self::DeadlyArts
180            | Self::CriticalStrikes
181            | Self::Trickery
182            | Self::Acrobatics
183            | Self::Deadeye
184            | Self::Specter => Profession::Thief,
185
186            Self::Valor
187            | Self::Radiance
188            | Self::Dragonhunter
189            | Self::Zeal
190            | Self::Virtues
191            | Self::Honor
192            | Self::Firebrand
193            | Self::Willbender => Profession::Guardian,
194
195            Self::Water
196            | Self::Earth
197            | Self::Fire
198            | Self::Arcane
199            | Self::Air
200            | Self::Tempest
201            | Self::Weaver
202            | Self::Catalyst => Profession::Elementalist,
203        }
204    }
205}