wowlab_engine_domain/dbc/semantics/
proc_attributes.rs1use super::SemanticSupport;
2
3bitflags::bitflags! {
4 #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
6 pub struct ProcAttributes: u32 {
7 const REQUIRE_EXPERIENCE_OR_HONOR = 1 << 0;
8 const TRIGGERED_CAN_PROC = 1 << 1;
9 const REQUIRE_POWER_COST = 1 << 2;
10 const REQUIRE_SPELL_MODIFIER = 1 << 3;
11 const USE_STACKS_FOR_CHARGES = 1 << 4;
12 const REDUCE_PROC_ABOVE_LEVEL_60 = 1 << 7;
13 const CANNOT_PROC_FROM_ITEM_CAST = 1 << 8;
14 }
15}
16
17impl ProcAttributes {
18 #[must_use]
19 pub const fn from_dbc(raw: u32) -> Self {
20 Self::from_bits_retain(raw)
21 }
22}
23
24#[derive(Clone, Copy, Debug, Eq, PartialEq)]
26#[non_exhaustive]
27pub enum ProcAttributeKind {
28 RequireExperienceOrHonor,
29 TriggeredCanProc,
30 RequirePowerCost,
31 RequireSpellModifier,
32 UseStacksForCharges,
33 ReduceProcAboveLevel60,
34 CannotProcFromItemCast,
35}
36
37#[derive(Clone, Copy, Debug, Eq, PartialEq)]
39pub struct ProcAttributeSemantic {
40 pub kind: ProcAttributeKind,
41 pub flag: ProcAttributes,
42 pub name: &'static str,
43 pub support: SemanticSupport,
44 pub handler: &'static str,
45}
46
47const fn proc_attribute(
48 kind: ProcAttributeKind,
49 flag: ProcAttributes,
50 name: &'static str,
51 support: SemanticSupport,
52 handler: &'static str,
53) -> ProcAttributeSemantic {
54 ProcAttributeSemantic {
55 kind,
56 flag,
57 name,
58 support,
59 handler,
60 }
61}
62
63#[rustfmt::skip]
65pub const PROC_ATTRIBUTE_SEMANTICS: &[ProcAttributeSemantic] = &[
66 proc_attribute(ProcAttributeKind::RequireExperienceOrHonor, ProcAttributes::REQUIRE_EXPERIENCE_OR_HONOR, "Require Experience or Honor", SemanticSupport::Unsupported, "experience and honor eligibility are outside simulation combat state"),
67 proc_attribute(ProcAttributeKind::TriggeredCanProc, ProcAttributes::TRIGGERED_CAN_PROC, "Triggered Can Proc", SemanticSupport::Unsupported, "server-side triggered-spell proc override is not yet mapped into proc provenance"),
68 proc_attribute(ProcAttributeKind::RequirePowerCost, ProcAttributes::REQUIRE_POWER_COST, "Require Power Cost", SemanticSupport::Unsupported, "proc candidate power-cost eligibility is not yet retained"),
69 proc_attribute(ProcAttributeKind::RequireSpellModifier, ProcAttributes::REQUIRE_SPELL_MODIFIER, "Require Spell Modifier", SemanticSupport::Unsupported, "server-side charge-drop spell-modifier eligibility is not yet retained"),
70 proc_attribute(ProcAttributeKind::UseStacksForCharges, ProcAttributes::USE_STACKS_FOR_CHARGES, "Use Stacks for Charges", SemanticSupport::Generic, "DBC impact-proc lowering selects aura-stack consumption"),
71 proc_attribute(ProcAttributeKind::ReduceProcAboveLevel60, ProcAttributes::REDUCE_PROC_ABOVE_LEVEL_60, "Reduce Proc Above Level 60", SemanticSupport::Unsupported, "server-side level scaling is not yet modeled"),
72 proc_attribute(ProcAttributeKind::CannotProcFromItemCast, ProcAttributes::CANNOT_PROC_FROM_ITEM_CAST, "Cannot Proc From Item Cast", SemanticSupport::Unsupported, "item-cast proc provenance is not yet retained"),
73];
74
75pub const CONSUMED_PROC_ATTRIBUTES: &[ProcAttributeKind] =
77 &[ProcAttributeKind::UseStacksForCharges];
78
79#[must_use]
80pub fn proc_attribute_semantic(kind: ProcAttributeKind) -> Option<&'static ProcAttributeSemantic> {
81 PROC_ATTRIBUTE_SEMANTICS
82 .iter()
83 .find(|semantic| semantic.kind == kind)
84}