1use crate::{extract::Extract, Event, StateChange, TryExtract};
2use num_enum::{IntoPrimitive, TryFromPrimitive};
3
4#[cfg(feature = "serde")]
5use serde::{Deserialize, Serialize};
6
7#[cfg(feature = "strum")]
8use strum::{Display, EnumCount, EnumIter, IntoStaticStr, VariantNames};
9
10#[derive(Debug, Clone)]
12#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
13pub struct BuffInfo {
14 pub skill_id: u32,
16
17 pub category: u8,
21
22 pub stacking_type: u8,
26
27 pub max_stacks: u16,
29
30 pub duration_cap: u32,
32
33 pub invulnerable: bool,
35
36 pub invert: bool,
38
39 pub resistance: bool,
41}
42
43impl Extract for BuffInfo {
44 #[inline]
45 unsafe fn extract(event: &Event) -> Self {
46 Self {
47 skill_id: event.skill_id,
48 category: event.is_offcycle,
49 stacking_type: event.pad61,
50 max_stacks: event.src_master_instance_id,
51 duration_cap: event.overstack_value,
52 invulnerable: event.is_flanking != 0,
53 invert: event.is_shields != 0,
54 resistance: event.pad62 != 0,
55 }
56 }
57}
58
59impl TryExtract for BuffInfo {
60 #[inline]
61 fn can_extract(event: &Event) -> bool {
62 event.get_statechange() == StateChange::BuffInfo
63 }
64}
65
66#[derive(
70 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
71)]
72#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
73#[repr(u8)]
74pub enum BuffCategory {
75 Boon = 0,
77
78 Any = 1,
80
81 Condition = 2,
83
84 Food = 5,
86
87 Upgrade = 7,
89
90 Boost = 9,
92
93 Trait = 12,
95
96 Transform = 13,
98
99 Enhancement = 14,
101
102 Stance = 17,
104}
105
106#[derive(
110 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
111)]
112#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
113#[repr(u8)]
114pub enum BuffCategoryOld {
115 Boon = 0,
117
118 Any = 1,
120
121 Condition = 2,
123
124 Food = 4,
126
127 Upgrade = 6,
129
130 Boost = 8,
132
133 Trait = 11,
135
136 Transform = 12,
138
139 Enhancement = 13,
141
142 Stance = 16,
144}
145
146#[derive(
150 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
151)]
152#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
153#[cfg_attr(
154 feature = "strum",
155 derive(Display, EnumCount, EnumIter, IntoStaticStr, VariantNames)
156)]
157#[repr(u8)]
158pub enum BuffStackType {
159 StackingConditionalLoss = 0,
163
164 Queue = 1,
166
167 CappedDuration = 2,
169
170 Regeneration = 3,
172
173 Stacking = 4,
175
176 Force = 5,
178}