View Single Post
09-15-10, 01:15 PM   #35
kbc8090
A Murloc Raider
Join Date: Mar 2010
Posts: 6
First of all, I'm not very well versed in LUA code, but I know my way around somewhat. I tried using my current version of rBuff (from old RothUI) on Cataclysm and the anchor points were all messed up, but I ended up fixing that, and finally I noticed I couldn't cancel my buffs. Well after looking at the FrameXML on tekkub's github it really left me with no answers, since nBuff (From NeavUI) was working fine. Well there were some constants at the top of the rBuff file, specifically the following:

Code:
  BUFF_FLASH_TIME_ON = 0.8;
  BUFF_FLASH_TIME_OFF = 0.8;
  BUFF_MIN_ALPHA = 0.50;
  BUFF_MAX_DISPLAY = 50;
Well, after removing all of those, I seem to be able to cancel my buffs by right clicking the icon just fine.

I did add the following constant, and everything is still fine:

Code:
 BUFFS_PER_ROW = 20;
Not sure if this helps anything, but it's currently working in the latest Cataclysm beta.

Here's the entirety of the LUA for my rBuff if anyone cares:

Code:
  BUFFS_PER_ROW = 20;
  
  local myscale = 1
  local bordertex = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss"
  local castcol = { r = 0.9, g = 0.6, b = 0.4, }
  local bdc = { r = castcol.r*0.2, g = castcol.g*0.2, b = castcol.b*0.2, a = 0.93, }

  local addon = CreateFrame("Frame")
  local _G = getfenv(0)
  
  addon:SetScript("OnEvent", function(self, event, ...)
    local unit = ...;
    if(event=="PLAYER_ENTERING_WORLD") 
    then
      BuffFrame:ClearAllPoints()
      TemporaryEnchantFrame:ClearAllPoints()
      TemporaryEnchantFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -9, -10)
      TempEnchant2:ClearAllPoints()
      TempEnchant2:SetPoint('TOPRIGHT', TempEnchant1, 'TOPLEFT', -4, 0)
      TempEnchant3:ClearAllPoints()
      TempEnchant3:SetPoint('TOPRIGHT', TempEnchant2, 'TOPLEFT', -4, 0)
      BuffFrame:SetPoint("TOPRIGHT", TemporaryEnchantFrame, "TOPRIGHT", -9, -10)
      BuffFrame:SetScale(myscale)
      TemporaryEnchantFrame:SetScale(myscale)
      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, 11, "THINOUTLINE")
    ff:ClearAllPoints()
    ff:SetPoint("TOP",f,"BOTTOM",0,7)

    if not c then

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

      local t = f:CreateTexture(name.."GlossTexture","BACKGROUND")
      t:SetTexture(bordertex)
      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(bordertex)
      tex:SetVertexColor(red*0.5,green*0.5,blue*0.5,bdc.a)
    elseif icontype == 3 and b then
      tex:SetTexture(bordertex)
      tex:SetVertexColor(0.5,0,0.5,bdc.a)
    else
      tex:SetTexture(bordertex)
      tex:SetVertexColor(bdc.r,bdc.g,bdc.b,bdc.a)
    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 kbc8090 : 09-15-10 at 01:18 PM.