diff KBF.lua @ 66:6f1457157688

do less in on update, strata-based workaround for the SAH bug with failing to hide aura buttons
author Chris Mellon <arkanes@gmail.com>
date Tue, 28 Feb 2012 13:44:48 -0600
parents e19d0380b9f3
children 673fd9893f1e
line wrap: on
line diff
--- a/KBF.lua	Sat Dec 03 07:30:24 2011 -0600
+++ b/KBF.lua	Tue Feb 28 13:44:48 2012 -0600
@@ -6,6 +6,7 @@
 
 
 function kbf:OnInitialize()
+	self.oocQueue = {}
 	-- config settings - account wide shared profile by default
 	self.db = LibStub("AceDB-3.0"):New("KBFSavedVars", self.defaultConfig, true)
 	-- create frames here so that they will be correctly stored in location cache by 
@@ -19,7 +20,7 @@
     self.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("KBF", "KBF");
     self:RegisterChatCommand("kbf", "ToggleAnchor")
     
-    self.oocQueue = {}
+    
 end
 
 function kbf:OnEnable()
@@ -102,26 +103,28 @@
         if not boundIndex then
 			break
         end
-        local hasbuff = UnitAura(unit, boundIndex)
-        --self:Print(hasbuff, idx, boundIndex)
-        if not hasbuff then
-        	if frame.icon then frame.icon:Hide() end
-        	if frame.statusbar then frame.statusbar:Hide() end
-        	if frame.statusbarbg then frame.statusbarbg:Hide() end
-        	if frame.text then frame.text:Hide() end
-        	if frame.timertext then frame.timertext:Hide() end
-        	break 
-        end
-        buffCount = buffCount + 1
-        
-        if self.dirty then 
-            if self:BindBarToBuff(frame, unit) then break end
-        end
-        frame.icon:Show()
-		frame.statusbar:Show()
-		frame.statusbarbg:Show()
-		frame.text:Show()
-		frame.timertext:Show()
+        if self.dirty then
+			local hasbuff = UnitAura(unit, boundIndex)
+			--self:Print(hasbuff, idx, boundIndex)
+			if not hasbuff then
+				if frame.icon then frame.icon:Hide() end
+				if frame.statusbar then frame.statusbar:Hide() end
+				if frame.statusbarbg then frame.statusbarbg:Hide() end
+				if frame.text then frame.text:Hide() end
+				if frame.timertext then frame.timertext:Hide() end
+				break 
+			end
+			buffCount = buffCount + 1
+			
+			if self.dirty then 
+				if self:BindBarToBuff(frame, unit) then break end
+			end
+			frame.icon:Show()
+			frame.statusbar:Show()
+			frame.statusbarbg:Show()
+			frame.text:Show()
+			frame.timertext:Show()
+		end
         self:UpdateBarExpirationTime(frame)
         -- Don't forget to refresh shown tooltips
         if (GameTooltip:IsOwned(frame)) then
@@ -249,6 +252,7 @@
     	["Instant Poison"] = {8680, 60*60},
     	["Wound Poison"] = {13218, 60*60},
     	["Deadly Poison"] = {2823, 60*60},
+    	["Crippling Poison"] = {3408, 60*60}
     
     }
     local spellId = nil
@@ -375,16 +379,17 @@
     local textcolor = {1, 1, 1, 1}
     local timertextcolor = {1, 1, 1, 1}
     if not frame then
-        frame = CreateFrame("Button", nil, UIParent) -- the "top level" frame that represents the bar as a whole
+        frame = CreateFrame("Button", "ABC", UIParent) -- the "top level" frame that represents the bar as a whole
         frame:SetHeight(height)
         frame:SetWidth(width + height)
     end
     local bar = frame
-    bar.icon = CreateFrame("Button", nil, bar) -- the icon
-    bar.statusbarbg = CreateFrame("StatusBar", nil, bar) -- the bars background
-    bar.statusbar = CreateFrame("StatusBar", nil, bar) -- and the bars foreground
+    bar.icon = CreateFrame("Button", "ABC-Icon", bar) -- the icon
+    bar.statusbarbg = CreateFrame("StatusBar", "ABC-BG", bar) -- the bars background
+    bar.statusbar = CreateFrame("StatusBar", "ABC-status", bar) -- and the bars foreground
     bar.text = bar.statusbar:CreateFontString(nil, "OVERLAY") -- the label text
     bar.timertext = bar.statusbar:CreateFontString(nil, "OVERLAY") -- and the timer text
+	
 
     -- the icon
     bar.icon:ClearAllPoints()
@@ -409,7 +414,7 @@
     end
     setupStatusBar(bar.statusbarbg, bgcolor)
     setupStatusBar(bar.statusbar, color)
-    bar.statusbarbg:SetFrameLevel(bar.statusbarbg:GetFrameLevel()-1) -- make sure the bg frame stays in the back
+    bar.statusbarbg:SetFrameLevel(bar.statusbar:GetFrameLevel()-1) -- make sure the bg frame stays in the back
     -- timer text
     bar.timertext:SetFontObject(GameFontHighlight)
     bar.timertext:SetFont(GameFontHighlight:GetFont())
@@ -472,7 +477,8 @@
     
     -- this is the "button" in the aura flow that represents the consolidated buffs.
     -- pre-creating it here in order to perform customization
-    local consolidateProxy = CreateFrame("BUTTON", nil, UIParent, "SecureHandlerClickTemplate")
+    local consolidateProxy = CreateFrame("BUTTON", "KBFConsolidateProxy", UIParent, "SecureHandlerClickTemplate")
+    consolidateProxy:SetFrameStrata("HIGH")
     consolidateProxy:SetNormalTexture("Interface\\TargetingFrame\\UI-StatusBar")
     consolidateProxy:SetWidth(200 +16)
 	consolidateProxy:SetHeight(16)
@@ -521,7 +527,7 @@
 	-- TODO: 4.3 SAH has a bug that messes up buff binding when a consolidate proxy
 	-- and/or weapon enchants are present, don't use them. Set up a standalone enchant window to be managed 
 	-- independently
-    frame:SetAttribute("includeWeapons", nil)
+    frame:SetAttribute("includeWeapons", 100)
     frame:Show() -- has to be shown, otherwise the child frames don't show
     return frame
 end