Quantcast

Modified mana check to target only mana. Not the other power management options available to some specs.

Xruptor [08-02-16 - 19:37]
Modified mana check to target only mana.  Not the other power management options available to some specs.
Filename
xanSoundAlerts.lua
diff --git a/xanSoundAlerts.lua b/xanSoundAlerts.lua
index 49e78d6..909e62b 100644
--- a/xanSoundAlerts.lua
+++ b/xanSoundAlerts.lua
@@ -44,8 +44,30 @@ function f:UNIT_HEALTH()
 	end
 end

+--https://github.com/Gethe/wow-ui-source/blob/beta/FrameXML/UnitFrame.lua#L24
+-- SPELL_POWER_MANA            0       "MANA"
+-- SPELL_POWER_RAGE            1       "RAGE"
+-- SPELL_POWER_FOCUS           2       "FOCUS"
+-- SPELL_POWER_ENERGY          3       "ENERGY"
+-- SPELL_POWER_COMBO_POINTS    4       "COMBO_POINTS"
+-- SPELL_POWER_RUNES           5       "RUNES"
+-- SPELL_POWER_RUNIC_POWER     6       "RUNIC_POWER"
+-- SPELL_POWER_SOUL_SHARDS     7       "SOUL_SHARDS"
+-- SPELL_POWER_LUNAR_POWER     8       "LUNAR_POWER"
+-- SPELL_POWER_HOLY_POWER      9       "HOLY_POWER"
+-- SPELL_POWER_ALTERNATE_POWER 10      ???
+-- SPELL_POWER_MAELSTROM       11      "MAELSTROM"
+-- SPELL_POWER_CHI             12      "CHI"
+-- SPELL_POWER_INSANITY        13      "INSANITY"
+-- SPELL_POWER_OBSOLETE        14      ???
+-- SPELL_POWER_OBSOLETE2       15      ???
+-- SPELL_POWER_ARCANE_CHARGES  16      "ARCANE_CHARGES"
+-- SPELL_POWER_FURY            17      "FURY"
+-- SPELL_POWER_PAIN            18      "PAIN"
+
+--only worry about mana, don't care about special power types really for now
 function f:UNIT_POWER()
-	if ((UnitPower("player") / UnitPowerMax("player")) <= lowManaThreshold) then
+	if ((UnitPower("player", SPELL_POWER_MANA) / UnitPowerMax("player", SPELL_POWER_MANA)) <= lowManaThreshold) then
 		if (not lowMana) then
 			PlaySoundFile("Interface\\AddOns\\xanSoundAlerts\\sounds\\LowMana.ogg", "Master")
 			lowMana = true