I didn't realise you wanted a solution and not a hint (which is a good thing as I meant divide by 10 not modulo by it).
With changing as little as possible:
Lua Code:
local numPrevious = 0
caelUI.powersound:SetScript("OnEvent", function(self, event, unit, powerType)
...
if event == "UNIT_POWER" then
...
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 = math.floor(UnitPower("player", SPELL_POWER_DEMONIC_FURY) / 250)
numMax = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) / 250
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 > numPrevious then
if num ~= 0 and num ~= numMax then
PlaySoundFile(caelMedia.files.soundCombo, "Master")
elseif num == numMax then
PlaySoundFile(caelMedia.files.soundComboMax, "Master")
end
end
numPrevious = num
end
end