Hi, so i've had this little addon issuing a sound for each combo point and then another sound to warn me when i reached 5 (some people use bars on their screen for that, i prefer sounds) but then i decided i wanted to level a paladin and thought, why not make this work for each classes that this kind of "points".
So i came up with this:
Code:
local _, caelUI = ...
caelUI.powersound = caelUI.createModule("PowerSound")
local num, numMax, power, spec
local powers = {
["MONK"] = "CHI",
["PALADIN"] = "HOLY_POWER",
["PRIEST"] = "SHADOW_ORBS",
["WARLOCK"] = {
[1] = "SOUL_SHARDS",
[2] = "DEMONIC_FURY",
[3] = "BURNING_EMBERS",
}
}
caelUI.powersound:SetScript("OnEvent", function(self, event, unit, powerType)
if unit ~= "player" then return end
if event == "UNIT_COMBO_POINTS" then
num = GetComboPoints("player", "target")
numMax = MAX_COMBO_POINTS
if num ~= 0 and num ~= numMax then
PlaySoundFile(caelMedia.files.soundCombo, "Master")
elseif num == numMax then
PlaySoundFile(caelMedia.files.soundComboMax, "Master")
end
end
if event == "UNIT_POWER" then
spec = GetSpecialization()
if powerType ~= powers[caelUI.playerClass] and powerType ~= powers[caelUI.playerClass][spec] then return end
if caelUI.playerClass == "MONK" then
num = UnitPower("player", SPELL_POWER_CHI)
numMax = UnitPowerMax("player", SPELL_POWER_CHI)
elseif caelUI.playerClass == "PALADIN" then
num = UnitPower("player", SPELL_POWER_HOLY_POWER)
numMax = UnitPowerMax("player", SPELL_POWER_HOLY_POWER)
elseif caelUI.playerClass == "PRIEST" then
num = UnitPower("player", SPELL_POWER_SHADOW_ORBS)
numMax = PRIEST_BAR_NUM_ORBS -- UnitPowerMax("player", SPELL_POWER_SHADOW_ORBS)
--[[
elseif caelUI.playerClass == "WARLOCK" then
if spec then
if spec == SPEC_WARLOCK_AFFLICTION then
num = UnitPower("player", SPELL_POWER_SOUL_SHARDS)
numMax = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS)
elseif spec == SPEC_WARLOCK_DEMONOLOGY then
num = UnitPower("player", SPELL_POWER_DEMONIC_FURY)
numMax = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY)
elseif spec == SPEC_WARLOCK_DESTRUCTION then
num = UnitPower("player", SPELL_POWER_BURNING_EMBERS)
numMax = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS)
end
end
--]]
end
if num ~= 0 and num ~= numMax then
PlaySoundFile(caelMedia.files.soundCombo, "Master")
elseif num == numMax then
PlaySoundFile(caelMedia.files.soundComboMax, "Master")
end
end
end)
for _, event in next, {
"UNIT_COMBO_POINTS",
"UNIT_POWER",
} do
caelUI.powersound:RegisterEvent(event)
end
Obviously, for combo points it works perfectly, but for other classes not so much.
The issues (that i need help with) are the following:
Paladin: Over time, the Holy power decreases and the problem is that each time i loose one point, it beeps, it shouldn't.
Warlock: This one is the worst, different power source for each spec, the power does decrease over time, burning embers seems to beep for every spell i cast, not just when i gain one ember, in fewer words, warlocks are a mess.
Anyone would have any idea how i could improve this little addon ?