Quantcast

* Small optimization to range checking code

James Whitehead II [01-25-08 - 06:38]
* Small optimization to range checking code
* Fix for buff conditions (in theory)
* Changed tooltip anchor to use UnitFrame_UpdateTooltip() instead of manual anchoring
* Made the raise frame a member instead of a local
Filename
PerfectRaid.lua
PerfectRaid_Buffs.lua
PerfectRaid_Highlight.lua
PerfectRaid_Range.lua
diff --git a/PerfectRaid.lua b/PerfectRaid.lua
index 7581bb0..073d1ec 100644
--- a/PerfectRaid.lua
+++ b/PerfectRaid.lua
@@ -657,6 +657,7 @@ function PerfectRaid.ConfigureButton(button)

 	local raise = CreateFrame("Frame", nil, button.healthbar)
 	raise:SetAllPoints()
+	button.raise = raise
 	--raise:Show()

 	local font = raise:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
diff --git a/PerfectRaid_Buffs.lua b/PerfectRaid_Buffs.lua
index f174a5c..6c54713 100644
--- a/PerfectRaid_Buffs.lua
+++ b/PerfectRaid_Buffs.lua
@@ -1,4 +1,4 @@
---[[-------------------------------------------------------------------------
+ --[[-------------------------------------------------------------------------
   Copyright (c) 2006, Jim Whitehead II <cladhaire@gmail.com>
   All rights reserved.

@@ -208,34 +208,36 @@ function Buffs:UNIT_AURA(event, unit)
 		local group = raidLookup[unit]

 		-- Handle the condition checking for the buff, taking strictness into account
-		if entry.strict then
-			-- Set up a boolean value so we can trip it if a filter fails
-			local pass = true
-
-			for i,name in pairs(entry.cond) do
-				if conds[name] and not conds[name](unit, class, group) then
-					pass = false
-				end
-			end
-
-			if pass then
-				if num and num > 1 then
-					table.insert(work, entry.colortext .. "(" .. num .. ")")
-				else
-					table.insert(work, entry.colortext)
+		if checkcond then
+			if entry.strict then
+				-- Set up a boolean value so we can trip it if a filter fails
+				local pass = true
+
+				for i,name in pairs(entry.cond) do
+					if conds[name] and not conds[name](unit, class, group) then
+						pass = false
+					end
 				end
-			end
-		else
-			-- Simply iterate each of the conditions, and break when we match
-			for i,name in pairs(entry.cond) do
-				if conds[name] and conds[name](unit, class, group) then
+
+				if pass then
 					if num and num > 1 then
 						table.insert(work, entry.colortext .. "(" .. num .. ")")
 					else
 						table.insert(work, entry.colortext)
 					end
-
-					break
+				end
+			else
+				-- Simply iterate each of the conditions, and break when we match
+				for i,name in pairs(entry.cond) do
+					if conds[name] and conds[name](unit, class, group) then
+						if num and num > 1 then
+							table.insert(work, entry.colortext .. "(" .. num .. ")")
+						else
+							table.insert(work, entry.colortext)
+						end
+
+						break
+					end
 				end
 			end
 		end
diff --git a/PerfectRaid_Highlight.lua b/PerfectRaid_Highlight.lua
index 68127f7..c6f0a6a 100644
--- a/PerfectRaid_Highlight.lua
+++ b/PerfectRaid_Highlight.lua
@@ -60,14 +60,11 @@ local backdrop = {

 local function OnEnter(frame)
 	local opt = PerfectRaid.db.profile.highlight
-	if opt.tooltip then
-		if frame.unit then
-			GameTooltip:SetOwner(frame, "ANCHOR_BOTTOMRIGHT")
-			GameTooltip:SetUnit(frame.unit)
-		end
+	if( opt.tooltip and frame.unit ) then
+		UnitFrame_UpdateTooltip(frame)
 	end

-	if opt.mouseover then
+	if( opt.mouseover ) then
 		frame:SetBackdropColor(0.9, 0.9, 0.9, 0.3)
 	end
 end
diff --git a/PerfectRaid_Range.lua b/PerfectRaid_Range.lua
index 8b083f8..d2ab101 100644
--- a/PerfectRaid_Range.lua
+++ b/PerfectRaid_Range.lua
@@ -104,10 +104,10 @@ function Range:DONGLE_PROFILE_CHANGED(event, addon, svname, name)
 	end
 end

+local alpha = 1
 local elapsed = 0
 function Range.OnUpdate()
 	elapsed = elapsed + arg1
-	local alpha = 1

 	if elapsed >= rate then
 		for unit,tbl in pairs(frames) do