Skip to main content

warcraft3_stats_observer/
ability.rs

1use crate::string_utils::PaddedString;
2
3const MAX_NAME_LENGTH: usize = 36;
4const MAX_BUTTON_ART_LENGTH: usize = 100;
5
6/// State for a single hero ability slot.
7#[repr(C, packed)]
8pub struct AbilityInfo {
9    /// Game-internal ability ID.
10    pub id: u32,
11    /// Display name.
12    pub name: PaddedString<MAX_NAME_LENGTH>,
13    /// Maximum cooldown of the ability, in seconds.
14    pub cooldown: f32,
15    /// Cooldown remaining before the ability can be used again, in seconds.
16    pub cooldown_remaining: f32,
17    /// Current learned level of the ability.
18    pub level: u32,
19    /// Path to the ability's button icon.
20    pub button_art: PaddedString<MAX_BUTTON_ART_LENGTH>,
21    /// Non-zero when the ability belongs to a hero.
22    pub is_hero_ability: u8,
23    /// Total damage dealt by uses of this ability.
24    pub damage_dealt: u32,
25    /// Total healing done by uses of this ability.
26    pub healing_done: u32,
27}
28
29// Number generated from SIZE fields of https://github.com/TinkerWorX/Blizzard.Net.Warcraft3
30// noinspection RsAssertEqual
31const _: () = assert!(size_of::<AbilityInfo>() == 161);