Skip to main content

wowlab_engine_gamedata/game_data/
consumables.rs

1//! Consumables selected for a sim run, resolved to their buff spells.
2
3use super::item_budget::ItemBudget;
4
5/// A resolved stat-buff consumable (potion, flask, or augment rune): buff spell + display name.
6#[derive(Clone, Debug, PartialEq)]
7pub struct ConsumableBuff {
8    pub spell_id: u32,
9    pub name: String,
10    pub item_budget: Option<ItemBudget>,
11}
12
13/// Resolved food buff whose magnitude comes from shared coefficient spell 1219179.
14#[derive(Clone, Debug, PartialEq)]
15pub struct FoodBuff {
16    pub spell_id: u32,
17    pub name: String,
18    pub coeff_spell_id: u32,
19    pub coeff_effect: u8,
20    pub amount_multiplier: f64,
21}
22
23/// Consumable buff spells selected for a sim run; `None` = that consumable is disabled.
24#[derive(Clone, Debug, Default, PartialEq)]
25pub struct ConsumableSpells {
26    pub potion: Option<ConsumableBuff>,
27    pub flask: Option<ConsumableBuff>,
28    pub food: Option<FoodBuff>,
29    pub augment_rune: Option<ConsumableBuff>,
30}
31
32impl ConsumableSpells {
33    /// Buff spell ids of every selected consumable (potion, flask, food, augment rune).
34    #[must_use]
35    pub fn spell_ids(&self) -> Vec<u32> {
36        let mut ids = Vec::new();
37
38        if let Some(p) = &self.potion {
39            ids.push(p.spell_id);
40        }
41
42        if let Some(f) = &self.flask {
43            ids.push(f.spell_id);
44        }
45
46        if let Some(f) = &self.food {
47            ids.push(f.spell_id);
48            ids.push(f.coeff_spell_id);
49        }
50
51        if let Some(a) = &self.augment_rune {
52            ids.push(a.spell_id);
53        }
54
55        ids
56    }
57}