evtc\buff/
initial.rs
1use crate::{
2 event::{impl_common, CommonEvent},
3 extract::Extract,
4 Event, TryExtract,
5};
6
7#[cfg(feature = "serde")]
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone)]
12#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
13pub struct BuffInitialEvent {
14 #[cfg_attr(feature = "serde", serde(flatten))]
16 pub common: CommonEvent,
17
18 pub duration: i32,
20
21 pub original_duration: i32,
23
24 pub stack_active: u8,
26
27 pub stack_id: u32,
29}
30
31impl_common!(BuffInitialEvent);
32
33impl Extract for BuffInitialEvent {
34 #[inline]
35 unsafe fn extract(event: &Event) -> Self {
36 Self {
37 common: event.into(),
38 duration: event.value,
39 original_duration: event.buff_dmg,
40 stack_active: event.is_shields,
41 stack_id: event.get_pad_id(),
42 }
43 }
44}
45
46impl TryExtract for BuffInitialEvent {
47 #[inline]
48 fn can_extract(event: &Event) -> bool {
49 event.is_buffinitial()
50 }
51}