View Single Post
02-19-14, 08:50 AM   #5
Oppugno
A Fallenroot Satyr
Join Date: Sep 2012
Posts: 22
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:
  1. local numPrevious = 0
  2.  
  3. caelUI.powersound:SetScript("OnEvent", function(self, event, unit, powerType)
  4.     ...
  5.     if event == "UNIT_POWER" then
  6.         ...
  7.         elseif caelUI.playerClass == "WARLOCK" then
  8.             if spec then
  9.                 if spec == SPEC_WARLOCK_AFFLICTION then
  10.                     num = UnitPower("player", SPELL_POWER_SOUL_SHARDS)
  11.                     numMax = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS)
  12.                 elseif spec == SPEC_WARLOCK_DEMONOLOGY then
  13.                     num = math.floor(UnitPower("player", SPELL_POWER_DEMONIC_FURY) / 250)
  14.                     numMax = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) / 250
  15.                 elseif spec == SPEC_WARLOCK_DESTRUCTION then
  16.                     num = UnitPower("player", SPELL_POWER_BURNING_EMBERS)
  17.                     numMax = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS)
  18.                 end        
  19.             end
  20.         end
  21.  
  22.         if num > numPrevious then
  23.             if num ~= 0 and num ~= numMax then
  24.                 PlaySoundFile(caelMedia.files.soundCombo, "Master")
  25.             elseif num == numMax then
  26.                 PlaySoundFile(caelMedia.files.soundComboMax, "Master")
  27.             end
  28.         end
  29.         numPrevious = num
  30.     end
  31. end

Last edited by Oppugno : 02-19-14 at 09:20 AM. Reason: UnitPower("player", SPELL_POWER_BURNING_EMBERS) returns full embers not partials.
  Reply With Quote