Thread Tools Display Modes
10-17-10, 09:02 PM   #1
lilgulps
A Theradrim Guardian
 
lilgulps's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 62
Buff Frame Positioning Whats Wrong with my code?

Sometimes the buff frames look like this but iv'e moved my minimap so i'm not sure why


Here is my code

Code:
  --rdy up for Cata

  BUFF_FLASH_TIME_ON = 0.8;
  BUFF_FLASH_TIME_OFF = 0.8;
  BUFF_MIN_ALPHA = 0.9;

  local addon = CreateFrame("Frame")
  local _G = getfenv(0)
  
	BuffFrame:SetScale(1.0)
	TemporaryEnchantFrame:SetScale(1.0)
   
  addon:SetScript("OnEvent", function(self, event, ...)
    local unit = ...;
    if(event=="PLAYER_ENTERING_WORLD") 
    then
     	ConsolidatedBuffs:ClearAllPoints()
	ConsolidatedBuffs:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -10, -8)
	ConsolidatedBuffs:SetScale(1.0)
	addon:runthroughicons()
    end
    if ( event == "UNIT_AURA" ) then
      if ( unit == PlayerFrame.unit ) then
        addon:runthroughicons()
      end
    end
  end)
  
  function addon:runthroughicons()
    local i = 1
    while _G["BuffButton"..i] 
    do 
      addon:checkgloss("BuffButton"..i,1) 
      i = i + 1 
    end
    i = 1
    while _G["DebuffButton"..i] 
    do 
      addon:checkgloss("DebuffButton"..i,2) 
      i = i + 1 
    end
    i = 1
    while _G["TempEnchant"..i] 
    do 
      addon:checkgloss("TempEnchant"..i,3) 
      i = i + 1 
    end
  end

  function addon:checkgloss(name,icontype)
    local b = _G[name.."Border"]
    local i = _G[name.."Icon"]
    local f = _G[name]
    local c = _G[name.."Gloss"]
    local ff = _G[name.."Duration"]
    
    ff:SetFont(NAMEPLATE_FONT, 10, nil)
    ff:ClearAllPoints()
    ff:SetPoint("TOP",f,"BOTTOM",0,0)

    if not c then

      local fg = CreateFrame("Frame", name.."Gloss", f)
      fg:SetAllPoints(f)

      local t = f:CreateTexture(name.."GlossTexture","ARTWORK")
      t:SetTexture("Interface\\AddOns\\rBuff\\Textures\\gloss")
      t:SetPoint("TOPLEFT", fg, "TOPLEFT", -0, 0)
      t:SetPoint("BOTTOMRIGHT", fg, "BOTTOMRIGHT", 0, -0)
      
      i:SetTexCoord(0.1,0.9,0.1,0.9)
      i:SetPoint("TOPLEFT", fg, "TOPLEFT", 2, -2)
      i:SetPoint("BOTTOMRIGHT", fg, "BOTTOMRIGHT", -2, 2)
        
    end

    local tex = _G[name.."GlossTexture"]    
    
    if icontype == 2 and b then
      local red,green,blue = b:GetVertexColor();    
      tex:SetTexture("Interface\\AddOns\\rBuff\\Textures\\grey")
      tex:SetVertexColor(red,green,blue)
    else
      tex:SetTexture("Interface\\AddOns\\rBuff\\Textures\\gloss")
      tex:SetVertexColor(1,1,1)      
    end  
    
    if b then b:SetAlpha(0) end
	 
  end

  SecondsToTimeAbbrev = function(time)
    local hr, m, s, text
    if time <= 0 then text = ""
    elseif(time < 3600 and time > 60) then
      hr = floor(time / 3600)
      m = floor(mod(time, 3600) / 60 + 1)
      text = format("%dm", m)
    elseif time < 60 then
      m = floor(time / 60)
      s = mod(time, 60)
      text = (m == 0 and format("%ds", s))
    else
      hr = floor(time / 3600 + 1)
      text = format("%dh", hr)
    end
    return text
  end
  
  addon:RegisterEvent("UNIT_AURA");
  addon:RegisterEvent("PLAYER_ENTERING_WORLD");

Last edited by lilgulps : 10-17-10 at 09:05 PM. Reason: Wrong picture
  Reply With Quote
10-17-10, 10:10 PM   #2
lilgulps
A Theradrim Guardian
 
lilgulps's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 62
More Info

When I mount up and sometimes when more than one buff is applied they correct themselves but as soon as my mount goes away they are gone again
  Reply With Quote
10-17-10, 10:32 PM   #3
lilgulps
A Theradrim Guardian
 
lilgulps's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 62
Fixed added a BuffFrame:SetPoint()
I guess i wasn't setting that
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Buff Frame Positioning Whats Wrong with my code?


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