Thread: UnitPowerAlt
View Single Post
02-07-11, 05:22 PM   #5
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
I created a little power bar that fits my unit frames and UI, but feel free to modify it to your own needs.

This should cover all the known bosses/quests that use the alt power bar as well as it's function and value.

(Add under shared stuff)

*EDIT*
Oh, and tested and works! :P

lua Code:
  1. -- alt power bar
  2.     local AltPowerBar = CreateFrame("StatusBar", nil, self)
  3.     AltPowerBar:SetWidth(cfg.widthF)
  4.     AltPowerBar:SetHeight(17)
  5.     AltPowerBar:SetStatusBarTexture(settings.texture)
  6.     AltPowerBar:SetStatusBarColor(1,0,0)
  7.     AltPowerBar:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 226)
  8.     AltPowerBar.bd = SetBD(AltPowerBar, backdrop, {0.17, 0.17, 0.17, 1})
  9.    
  10.     AltPowerBar.type = AltPowerBar:CreateFontString(nil, "OVERLAY")
  11.     AltPowerBar.type:SetFontObject(cfg.Font)
  12.     AltPowerBar.type:SetText("")
  13.     AltPowerBar.type:SetPoint("LEFT",4,0)
  14.        
  15.     AltPowerBar.value = AltPowerBar:CreateFontString(nil, "OVERLAY")
  16.     AltPowerBar.value:SetFontObject(cfg.Font)
  17.     AltPowerBar.value:SetJustifyH("RIGHT")
  18.     AltPowerBar.value:SetPoint("RIGHT",-2,0)
  19.     AltPowerBar.value:SetText("")
  20.    
  21.     AltPowerBar:RegisterEvent("UNIT_POWER")
  22.     --AltPowerBar:RegisterEvent("PLAYER_ENTERING_WORLD")
  23.     AltPowerBar:SetScript("OnEvent", function(self,event,...)
  24.         alternatePower = UnitPower("player", ALTERNATE_POWER_INDEX)
  25.         ZoneName = GetRealZoneText()
  26.         subZoneName = GetSubZoneText()
  27.        
  28.         if alternatePower >= 0 then
  29.             AltPowerBar.value:SetText(alternatePower)
  30.         else
  31.             AltPowerBar.value:SetText(0)
  32.         end
  33.        
  34.         if ZoneName == "Twilight Highlands" then -- Iso'Rath Quest (Maw of Madness)
  35.             AltPowerBar:SetStatusBarColor(0.5,0.8,0.3)
  36.             AltPowerBar.type:SetText("DIGESTION")
  37.         elseif ZoneName == "The Bastion of Twilight" then -- Cho'Gall
  38.             AltPowerBar:SetStatusBarColor(0.5,0,1)
  39.             AltPowerBar.type:SetText("CORRUPTION")
  40.         elseif ZoneName == "Blackwing Descent" then -- Atramedes and Nefarion
  41.             if subZoneName == "The Athenaeum" then
  42.                 AltPowerBar:SetStatusBarColor(0,0.5,1)
  43.                 AltPowerBar.type:SetText("SOUNDLVL")
  44.             else --elseif subZoneName == "Vault of the Shadowflame" --Onyxia Rage
  45.                 AltPowerBar:SetStatusBarColor(0,0.5,1)
  46.                 AltPowerBar.type:SetText("ONYRAGE")
  47.             end
  48.         end
  49.     end)
__________________


Last edited by sacrife : 02-07-11 at 06:35 PM.
  Reply With Quote