Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-11-14, 12:02 PM   #1
eiszeit
A Chromatic Dragonspawn
 
eiszeit's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 154
Anticipation tracking on oUF frame

Hello there!

I am trying to track my Anticipation stacks (Rogue Lvl 90 Talent where you can store up additional 5 combo points) on my oUF layout.

This is the code inside my function library

Lua Code:
  1. local anticipation = {}
  2.  
  3. lib.createAnticipation = function()
  4.     local frame =  CreateFrame("Frame", nil, oUF_LynPlayer)
  5.     frame:SetFrameLevel(oUF_LynPlayer:GetFrameLevel()+1)
  6.     frame:SetSize(((cfg.power.width + 2) * 5) + 5, cfg.power.height)
  7.     frame:SetPoint('CENTER', UIParent, 0, 0)
  8.    
  9.     for i = 1, 5 do
  10.         anticipation[i] = CreateFrame("StatusBar", nil, frame)
  11.         anticipation[i]:SetStatusBarTexture(cfg.barGw)
  12.         anticipation[i]:SetStatusBarColor(1, 0.3, 0)
  13.         anticipation[i]:SetHeight(cfg.power.height)
  14.         anticipation[i]:SetWidth(cfg.power.width)
  15.         anticipation[i]:SetPoint('LEFT', anticipation[i-1], 'RIGHT', 2, 0)
  16.        
  17.         anticipation[i].bg = CreateFrame("Frame", nil, anticipation[i])
  18.         anticipation[i].bg:SetFrameLevel(anticipation[i]:GetFrameLevel()-1)
  19.         anticipation[i].bg:SetPoint("TOPLEFT", -1, 1)
  20.         anticipation[i].bg:SetPoint("BOTTOMRIGHT", 1, -1)
  21.         anticipation[i].bg:SetBackdrop({
  22.                     bgFile = cfg.background,
  23.                     tile = false,
  24.                     tileSize = 16,
  25.                     edgeSize = 0,
  26.                     insets = {
  27.                       left = 0,
  28.                       right = 0,
  29.                       top = 0,
  30.                       bottom = 0,
  31.                     },
  32.                   })
  33.         anticipation[i].bg:SetBackdropColor(0,0,0,1)
  34.        
  35.         anticipation[i]:Hide()
  36.     end
  37.    
  38. end
  39.  
  40. lib.updateAnticipation = function(self, event)
  41.     if self.unit ~= "player" then return end
  42.    
  43.     for i = 1, 5 do anticipation[i]:Hide() end
  44.     local stacks = select(4, UnitBuff('player', GetSpellInfo(115189))) -- Anticipation stacks
  45.     if stacks then
  46.         for i = 1, stacks do
  47.             anticipation[i]:Show()
  48.         end
  49.     end
  50.  
  51.        
  52. end

... and these are called on my oUF player frame:

Lua Code:
  1. self:RegisterEvent('PLAYER_LOGIN', lib.createAnticipation)
  2. self:RegisterEvent('UNIT_AURA', lib.updateAnticipation)

My problem is now, it doesn't throw errors, the event call works (chat prints out correct Anticipation stacks when I get one/loose one) - but it doesn't show my frames.
__________________
Lyn • I'm a mess of unfinished thoughts
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Anticipation tracking on oUF frame


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off