Skip to main content

wowlab_engine_combat/
keys.rs

1//! Centralized string keys for dense-buffer slots (units, swing slots).
2
3use wowlab_types::game::GearSlot;
4
5/// Dense-buffer unit-slot keys.
6#[derive(Debug)]
7pub(crate) struct UnitKey;
8
9impl UnitKey {
10    /// Dense-buffer slot for the selected current-target projection.
11    pub(crate) const TARGET: &'static str = "target";
12}
13
14/// Map an auto-attack index to its swing slot key (0 = `main_hand`, 1 = `off_hand`, 2+ = `auto_N`).
15#[must_use]
16pub(crate) fn auto_attack_key(index: usize) -> String {
17    match index {
18        0 => GearSlot::MainHand.slug().to_string(),
19        1 => GearSlot::OffHand.slug().to_string(),
20        _ => format!("auto_{index}"),
21    }
22}