Skip to main content

wowlab_types/types/
spell_render.rs

1use serde::{Deserialize, Serialize};
2
3use crate::data::SpellEffect;
4
5#[derive(Clone, Debug, Default, Deserialize, Serialize)]
6#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
7#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
8pub struct ResolvedPaperdollStats {
9    pub attack_power: f64,
10    pub spell_power: f64,
11    /// Source for `$pri`.
12    pub primary_stat: f64,
13    pub intellect: f64,
14    pub crit: f64,
15    pub haste: f64,
16    pub mastery: f64,
17    pub versatility: f64,
18}
19
20/// Weapon damage and speed; source for `$mws`/`$mwb`/`$ows`/`$owb`.
21#[derive(Clone, Debug, Default, Deserialize, Serialize)]
22#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
23#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
24pub struct WeaponDamage {
25    pub main_min: f64,
26    pub main_max: f64,
27    pub main_speed: f64,
28    pub off_min: f64,
29    pub off_max: f64,
30    pub off_speed: f64,
31}
32
33#[derive(Clone, Debug, Default, Deserialize, Serialize)]
34#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
35#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
36pub struct ResolvedPaperdoll {
37    pub spec_id: u32,
38    /// `ChrSpecialization.OrderIndex`; `$?cN` conditionals name this plus one.
39    pub spec_order_index: u8,
40    pub class_id: u32,
41    pub level: u32,
42    pub is_male: bool,
43    pub max_health: f64,
44    pub role_mult: f64,
45    pub stats: ResolvedPaperdollStats,
46    pub weapon: WeaponDamage,
47    pub known_spell_ids: Vec<u32>,
48    pub active_aura_ids: Vec<u32>,
49}
50
51#[derive(Clone, Debug, Default, Deserialize, Serialize)]
52#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
53#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
54pub struct SpellRenderSpell {
55    pub id: u32,
56    pub description: String,
57    pub description_variables: String,
58    pub cast_time: i32,
59    pub recovery_time: i32,
60    pub duration: i32,
61    pub max_charges: i32,
62    pub max_stacks: i32,
63    pub range_max_0: f32,
64    /// Source for `$procrppm`.
65    pub proc_rppm: f32,
66    /// Source for `$proccooldown`.
67    pub internal_cooldown: i32,
68    pub file_name: String,
69    pub name: String,
70    pub effects: Vec<SpellEffect>,
71}
72
73#[derive(Clone, Debug, Default, Deserialize, Serialize)]
74#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
75#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
76pub struct SpellRenderInput {
77    pub self_spell: SpellRenderSpell,
78    pub cross_spells: Vec<SpellRenderSpell>,
79    pub paperdoll: ResolvedPaperdoll,
80}