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 pub combat_sim_use: bool,
44}
45
46impl Extract for BuffInfo {
47 #[inline]
48 unsafe fn extract(event: &Event) -> Self {
49 Self {
50 skill_id: event.skill_id,
51 category: event.is_offcycle,
52 stacking_type: event.pad61,
53 max_stacks: event.src_master_instance_id,
54 duration_cap: event.overstack_value,
55 invulnerable: event.is_flanking != 0,
56 invert: event.is_shields != 0,
57 resistance: event.pad62 != 0,
58 combat_sim_use: event.pad64 != 0,
59 }
60 }
61}
62
63impl TryExtract for BuffInfo {
64 #[inline]
65 fn can_extract(event: &Event) -> bool {
66 event.get_statechange() == StateChange::BuffInfo
67 }
68}
69
70#[derive(
74 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
75)]
76#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
77#[repr(u8)]
78pub enum BuffCategory {
79 Boon = 0,
81
82 Any = 1,
84
85 Condition = 2,
87
88 Food = 5,
90
91 Upgrade = 7,
93
94 Boost = 9,
96
97 Trait = 12,
99
100 Transform = 13,
102
103 Enhancement = 14,
105
106 Stance = 17,
108}
109
110#[derive(
114 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
115)]
116#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
117#[repr(u8)]
118pub enum BuffCategoryOld {
119 Boon = 0,
121
122 Any = 1,
124
125 Condition = 2,
127
128 Food = 4,
130
131 Upgrade = 6,
133
134 Boost = 8,
136
137 Trait = 11,
139
140 Transform = 12,
142
143 Enhancement = 13,
145
146 Stance = 16,
148}
149
150#[derive(
154 Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, IntoPrimitive, TryFromPrimitive,
155)]
156#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
157#[cfg_attr(
158 feature = "strum",
159 derive(Display, EnumCount, EnumIter, IntoStaticStr, VariantNames)
160)]
161#[repr(u8)]
162pub enum BuffStackType {
163 StackingConditionalLoss = 0,
167
168 Queue = 1,
170
171 CappedDuration = 2,
173
174 Regeneration = 3,
176
177 Stacking = 4,
179
180 Force = 5,
182}