From b31519904e1c340fb3c6406ec055dc5523edb86d Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Fri, 15 Oct 2010 18:06:27 +0100 Subject: [PATCH] Update for 4.x. This is a hack, but it works (ish) --- PerfectRaid.lua | 46 +++++++++++++++++++++++----------------------- PerfectRaid.toc | 4 ++-- PerfectRaid_Aggro.lua | 10 +++++----- PerfectRaid_Frames.lua | 6 +++--- PerfectRaid_Range.lua | 18 +++++++++--------- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/PerfectRaid.lua b/PerfectRaid.lua index 40442e6..d160721 100644 --- a/PerfectRaid.lua +++ b/PerfectRaid.lua @@ -78,24 +78,6 @@ function PerfectRaid:Initialize() end utils = self.utils - - if PerfectRaidDB then - if PerfectRaidDB.global then - if PerfectRaidDB.global.sv_converted then - PerfectRaidDB.global.sv_converted = nil - PerfectRaidDB.global.sv_version = self.rev - elseif PerfectRaidDB.global.sv_version > self.rev then - -- Got the bad rev number, revert - PerfectRaidDB.global.sv_version = self.rev - elseif PerfectRaidDB.global.sv_version < 112 then - -- We do this once, to make sure we catch everyone from - -- the last version of PerfectRaid - self:Print("You're upgrading from an old version of PerfectRaid") - PerfectRaidDB = {} - self:Print("All settings have been set to default") - end - end - end end function PerfectRaid:Enable() @@ -276,8 +258,21 @@ function PerfectRaid:CreateRaidFrame(idx) frame.dragparent = dragparent or frame frame.initialConfigFunction = PerfectRaid.ConfigureButton + frame:SetAttribute("initialConfigFunction", [===[ + local header = self:GetParent() + header:CallMethod("initialConfigFunction", self:GetName()) + ]===]) + frame:SetMovable(true) frame:SetClampedToScreen(true) + + -- HACK: Do everything while out of combat, because we are cheaters + local startingIndex = frame:GetAttribute("startingIndex") + frame:SetAttribute("startingIndex", -39) + frame:Show() + frame:Hide() + frame:SetAttribute("startingIndex", startindIndx) + frame:Show() self:RestorePosition(name) return frame @@ -436,7 +431,7 @@ local function OnShow(frame) local self = PerfectRaid local unit = frame:GetAttribute("unit") if unit == nil then - PerfectRaid:Print(debugstack()) + return end local unitname = UnitName(unit) @@ -555,11 +550,16 @@ function OnAttributeChanged(frame, name, value) end end -function PerfectRaid.ConfigureButton(button) - local self = PerfectRaid +function PerfectRaid.ConfigureButton(header, buttonName) + local self = PerfectRaid + + local button + if type(buttonName) == "string" then + button = _G[buttonName] + end - button:SetAttribute("initial-width", 225) - button:SetAttribute("initial-height", 14) + button:SetWidth(225) + button:SetHeight(14) -- Change with vehicle state: button:SetAttribute("toggleForVehicle", true) diff --git a/PerfectRaid.toc b/PerfectRaid.toc index fad364f..5dd2daa 100644 --- a/PerfectRaid.toc +++ b/PerfectRaid.toc @@ -1,6 +1,6 @@ -## Interface: 30300 +## Interface: 40000 ## Title: PerfectRaid -## Version: wowi:revision +## Version: @project-version@ ## Author: Cladhaire ## Notes: Simply powerful raid and party frames ## SavedVariables: PerfectRaidDB diff --git a/PerfectRaid_Aggro.lua b/PerfectRaid_Aggro.lua index 05a4aee..5fd076c 100644 --- a/PerfectRaid_Aggro.lua +++ b/PerfectRaid_Aggro.lua @@ -75,10 +75,10 @@ function Aggro:DONGLE_PROFILE_CHANGED(event, addon, svname, name) end end -local elapsed = 0 -function Aggro.OnUpdate() - elapsed = elapsed + arg1 - if elapsed >= rate then +local elapsed_counter = 0 +function Aggro.OnUpdate(frame, elapsed) + elapsed_counter = elapsed_counter + elapsed + if elapsed_counter >= rate then -- Aggro check for unit,tbl in pairs(frames) do if not targets[unit] then @@ -127,7 +127,7 @@ function Aggro.OnUpdate() end end end - elapsed = 0 + elapsed_counter = 0 end end diff --git a/PerfectRaid_Frames.lua b/PerfectRaid_Frames.lua index 7cbf148..70e5489 100644 --- a/PerfectRaid_Frames.lua +++ b/PerfectRaid_Frames.lua @@ -205,7 +205,7 @@ function Frames:CreateEditFrame(parent) frame.title = title local groupByDropDown = CreateFrame("Frame", "PRFrames_GroupByDropDown", frame, "UIDropDownMenuTemplate") - local clickFunc = function() UIDropDownMenu_SetSelectedValue(groupByDropDown, this.value) end + local clickFunc = function(self) UIDropDownMenu_SetSelectedValue(groupByDropDown, self.value) end groupByDropDown.Initialize = function() UIDropDownMenu_AddButton{text = L["None"], value = -1, func = clickFunc} UIDropDownMenu_AddButton{text = L["Group"], value = "GROUP", func = clickFunc} @@ -221,7 +221,7 @@ function Frames:CreateEditFrame(parent) local sortDropDown = CreateFrame("Frame", "PRFrames_SortDropDown", frame, "UIDropDownMenuTemplate") - local clickFunc = function() UIDropDownMenu_SetSelectedValue(sortDropDown, this.value) end + local clickFunc = function(self) UIDropDownMenu_SetSelectedValue(sortDropDown, self.value) end sortDropDown.Initialize = function() UIDropDownMenu_AddButton{text = L["None"], value = -1, func = clickFunc} UIDropDownMenu_AddButton{text = L["Name"], value = "NAME", func = clickFunc} @@ -312,7 +312,7 @@ function Frames:CreateEditFrame(parent) frame.colSpacing = colSpacing local colAnchorDropDown = CreateFrame("Frame", "PRFrames_ColAnchorDropDown", frame, "UIDropDownMenuTemplate") - local clickFunc = function() UIDropDownMenu_SetSelectedValue(colAnchorDropDown, this.value) end + local clickFunc = function() UIDropDownMenu_SetSelectedValue(colAnchorDropDown, self.value) end local points = {"TOP", "TOPLEFT", "TOPRIGHT", "LEFT", "RIGHT", "BOTTOM", "BOTTOMLEFT", "BOTTOMRIGHT"} colAnchorDropDown.Initialize = function() UIDropDownMenu_AddButton{text = L["None"], value = -1, func = clickFunc} diff --git a/PerfectRaid_Range.lua b/PerfectRaid_Range.lua index aa8331a..73fcd23 100644 --- a/PerfectRaid_Range.lua +++ b/PerfectRaid_Range.lua @@ -83,25 +83,25 @@ function Range:DONGLE_PROFILE_CHANGED(event, addon, svname, name) end local alpha = 1 -local elapsed = 0 -function Range.OnUpdate() - elapsed = elapsed + arg1 +local elapsed_counter = 0 +function Range.OnUpdate(frame, elapsed) + elapsed_counter = elapsed_counter + elapsed - if elapsed >= rate then + if elapsed_counter >= rate then for unit,tbl in pairs(frames) do - local inRange = UnitInRange(unit) == 1 + local inRange, checkedRange = UnitInRange(unit) - if inRange then - alpha = inalpha - else + if checkedRange and not inRange then alpha = outalpha + else + alpha = inalpha end for frame in pairs(tbl) do frame:SetAlpha(alpha) end end - elapsed = 0 + elapsed_counter = 0 end end -- 1.7.9.5