diff KBF.lua @ 3:bb1143608eb4

Correctly pull the index from the secure attribute in order to bind the right buff to the right frame
author Chris Mellon <arkanes@gmai.com>
date Tue, 12 Oct 2010 17:16:28 -0500
parents cf6e612a1c7e
children 75634f25a762
line wrap: on
line diff
--- a/KBF.lua	Tue Oct 12 16:52:47 2010 -0500
+++ b/KBF.lua	Tue Oct 12 17:16:28 2010 -0500
@@ -24,13 +24,15 @@
     for idx=1,99 do
         local frame = self.secureFrame:GetAttribute("child"..idx)
         if not frame then break end
-        self:BindBarToBuff(idx, frame, unit, "HELPFUL")
+        self:BindBarToBuff(frame, unit)
     end
 end
 
-function kbf:BindBarToBuff(idx, parentFrame, unit, filter)
+function kbf:BindBarToBuff(parentFrame, unit)
+    local index = parentFrame:GetAttribute("index")
+    local filter = parentFrame:GetAttribute("filter")
     local name, rank, icon, count, debuffType, duration, expirationTime, 
-        unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, idx, "HELPFUL")
+        unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, index, filter)
 -- This shouldn't be neccesary as the bar is parented to the frame, which is
 -- hidden by the group handler
     if not parentFrame.icon then
@@ -145,17 +147,19 @@
     --local frame = anchor
     frame:SetAttribute("filter", "HELPFUL")
     frame:SetAttribute("template", "KBFSecureUnitAuraTemplate")
-    frame:SetAttribute("point", "CENTER")
+    frame:SetAttribute("point", "TOP")
     frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header
     frame:SetAttribute("consolidateTo", nil)
     --frame:SetAttribute("wrapXOffset", 0)
     --frame:SetAttribute("wrapYOffset", -34)
     frame:SetAttribute("xOffset", 0)
-    frame:SetAttribute("yOffset", 16)
-    frame:SetAttribute("minWidth", 32)
-    frame:SetAttribute("minHeight", 32)
+    frame:SetAttribute("yOffset", -16)
+    frame:SetAttribute("minWidth",  216)
+    frame:SetAttribute("minHeight", 16)
     frame:SetAttribute("unit", "player") -- TODO: figure out the vehicle swapping stuff
-    frame:SetPoint("BOTTOM", anchor, "TOP", 0, 0)
+    frame:SetAttribute("sortMethod", "NAME")
+    frame:SetAttribute("sortOrder", "-")
+    frame:SetPoint("TOP", anchor, "BOTTOM", 0, 0)
     frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
                          edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
                          tile = true, tileSize = 16, edgeSize = 16,