diff --git a/alts.lua b/alts.lua index ffc05fa..c84c711 100644 --- a/alts.lua +++ b/alts.lua @@ -45,14 +45,13 @@ function sepgp_alts:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_alts" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_alts") then - T:Attach("sepgp_alts") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_alts") then + T:Attach("sepgp_alts") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -74,10 +73,12 @@ function sepgp_alts:Toggle(forceShow) T:ToggleLocked("sepgp_alts") end self:setHideScript() - elseif (forceShow) then - sepgp_alts:Refresh() else - T:Attach("sepgp_alts") -- hide + if (forceShow) then + sepgp_alts:Refresh() + else + T:Attach("sepgp_alts") -- hide + end end end diff --git a/bids.lua b/bids.lua index b68d44b..9fa06c0 100644 --- a/bids.lua +++ b/bids.lua @@ -45,14 +45,13 @@ function sepgp_bids:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_bids" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_bids") then - T:Attach("sepgp_bids") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_bids") then + T:Attach("sepgp_bids") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -74,10 +73,12 @@ function sepgp_bids:Toggle(forceShow) T:ToggleLocked("sepgp_bids") end self:setHideScript() - elseif (forceShow) then - sepgp_bids:Refresh() else - T:Attach("sepgp_bids") -- hide + if (forceShow) then + sepgp_bids:Refresh() + else + T:Attach("sepgp_bids") -- hide + end end end diff --git a/logs.lua b/logs.lua index 97d5909..e05b9a8 100644 --- a/logs.lua +++ b/logs.lua @@ -50,14 +50,13 @@ function sepgp_logs:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_logs" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_logs") then - T:Attach("sepgp_logs") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_logs") then + T:Attach("sepgp_logs") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -79,10 +78,12 @@ function sepgp_logs:Toggle(forceShow) T:ToggleLocked("sepgp_logs") end self:setHideScript() - elseif (forceShow) then - sepgp_logs:Refresh() else - T:Attach("sepgp_logs") -- hide + if (forceShow) then + sepgp_logs:Refresh() + else + T:Attach("sepgp_logs") -- hide + end end end diff --git a/loot.lua b/loot.lua index 143b390..0f0af28 100644 --- a/loot.lua +++ b/loot.lua @@ -50,14 +50,13 @@ function sepgp_loot:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_loot" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_loot") then - T:Attach("sepgp_loot") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_loot") then + T:Attach("sepgp_loot") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -79,10 +78,12 @@ function sepgp_loot:Toggle(forceShow) T:ToggleLocked("sepgp_loot") end self:setHideScript() - elseif (forceShow) then - sepgp_loot:Refresh() else - T:Attach("sepgp_loot") -- hide + if (forceShow) then + sepgp_loot:Refresh() + else + T:Attach("sepgp_loot") -- hide + end end end diff --git a/reserves.lua b/reserves.lua index 23c0da3..4866db6 100644 --- a/reserves.lua +++ b/reserves.lua @@ -45,14 +45,13 @@ function sepgp_reserves:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_reserves" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_reserves") then - T:Attach("sepgp_reserves") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_reserves") then + T:Attach("sepgp_reserves") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -74,10 +73,12 @@ function sepgp_reserves:Toggle(forceShow) T:ToggleLocked("sepgp_reserves") end self:setHideScript() - elseif (forceShow) then - sepgp_reserves:Refresh() else - T:Attach("sepgp_reserves") -- hide + if (forceShow) then + sepgp_reserves:Refresh() + else + T:Attach("sepgp_reserves") -- hide + end end end diff --git a/shootyepgp.lua b/shootyepgp.lua index 31a44fc..df63c8d 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -80,6 +80,7 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { desc = L["Clear Loot Table."], func = function() sepgp_looted = {} + sepgp_loot:Refresh() sepgp:defaultPrint(L["Loot info cleared"]) end, order = 3, @@ -90,6 +91,7 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { desc = L["Clear Logs Table."], func = function() sepgp_log = {} + sepgp_logs:Refresh() sepgp:defaultPrint(L["Logs cleared"]) end, order = 4, @@ -494,7 +496,6 @@ function sepgp:OnEnable() -- PLAYER_LOGIN (2) else self:RegisterEvent("AceEvent_FullyInitialized") end - self:RegisterChatCommand({"/shooty","/sepgp","/shootyepgp"},self.cmdtable()) end function sepgp:OnDisable() @@ -505,7 +506,6 @@ end function sepgp:AceEvent_FullyInitialized() -- SYNTHETIC EVENT, later than PLAYER_LOGIN, PLAYER_ENTERING_WORLD (3) --table.insert(sepgp_debug,{[date("%b/%d %H:%M:%S")]="AceEvent_FullyInitialized"}) if self._hasInitFull then return end - self._options = self:buildMenu() for i=1,NUM_CHAT_WINDOWS do local tab = getglobal("ChatFrame"..i.."Tab") @@ -517,9 +517,7 @@ function sepgp:AceEvent_FullyInitialized() -- SYNTHETIC EVENT, later than PLAYER shooty_debugchat:SetMaxLines(1024) break end - end - - self:RegisterEvent("CHAT_MSG_ADDON","addonComms") + end if (sepgp_main == nil) or (sepgp_main == "") then if (IsInGuild()) then @@ -658,6 +656,10 @@ function sepgp:delayedInit() if IsGuildLeader() and ( (sepgp_dbver == nil) or (major_ver > sepgp_dbver) ) then sepgp[string.format("v%dtov%d",(sepgp_dbver or 2),major_ver)](sepgp) end + -- init options and comms + self._options = self:buildMenu() + self:RegisterChatCommand({"/shooty","/sepgp","/shootyepgp"},self.cmdtable()) + self:RegisterEvent("CHAT_MSG_ADDON","addonComms") -- broadcast our version local addonMsg = string.format("VERSION;%s;%d",sepgp._versionString,major_ver) self:addonMessage(addonMsg,"GUILD") @@ -1485,7 +1487,9 @@ function sepgp:buildRosterTable() if (sepgp_raidonly) and GetNumRaidMembers() > 0 then for i = 1, GetNumRaidMembers(true) do local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i) - r[name] = true + if (name) then + r[name] = true + end end end sepgp.alts = {} @@ -2049,8 +2053,9 @@ function sepgp:processLoot(player,itemLink,source) return end local class,_ - if player == YOU or player == self._playerName then - class = UnitClass("player") -- localized + if player == YOU then player = self._playerName end + if player == self._playerName then + class = UnitClass("player") -- localized else _, class = self:verifyGuildMember(player,true) -- localized end @@ -2101,8 +2106,8 @@ end function sepgp:make_escable(framename,operation) local found - for i in UISpecialFrames do - if UISpecialFrames[i]==framename then + for i,f in ipairs(UISpecialFrames) do + if f==framename then found = i end end @@ -2352,7 +2357,7 @@ StaticPopupDialogs["SHOOTY_EPGP_AUTO_GEARPOINTS"] = { button1 = L["GP Actions"], button2 = L["Remind me Later"], OnAccept = function() - sepgp:EasyMenu(sepgp_auto_gp_menu, sepgp._menuFrame, this, 0, 0, "MENU") + sepgp:EasyMenu(sepgp_auto_gp_menu, sepgp._menuFrame, this, 0, 0, "MENU", 1) return true end, OnCancel = function(data,reason) @@ -2377,22 +2382,20 @@ StaticPopupDialogs["SHOOTY_EPGP_AUTO_GEARPOINTS"] = { whileDead = 1, hideOnEscape = 1 } - -function sepgp:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode) +function sepgp:EasyMenu_Initialize(level, menuList) + for i, info in ipairs(menuList) do + if (info.text) then + info.index = i + UIDropDownMenu_AddButton( info, level ) + end + end +end +function sepgp:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, level) if ( displayMode == "MENU" ) then menuFrame.displayMode = displayMode end - UIDropDownMenu_Initialize(menuFrame, function() sepgp:EasyMenu_Initialize(level, menuList) end, displayMode, nil, menuList) - ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList) -end -function sepgp:EasyMenu_Initialize(level, menuList) - for index = 1, table.getn( menuList ) do - local value = menuList[index] - if (value.text) then - value.index = index; - UIDropDownMenu_AddButton( value, level ); - end - end + UIDropDownMenu_Initialize(menuFrame, function() sepgp:EasyMenu_Initialize(level, menuList) end, displayMode, level) + ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y) end -- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_groupbyarmor,sepgp_groupbyrole,sepgp_raidonly,sepgp_decay,sepgp_minep,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_altspool,sepgp_altpercent,sepgp_log,sepgp_dbver,sepgp_looted,sepgp_debug diff --git a/shootyepgp.toc b/shootyepgp.toc index 0dca360..c248a19 100644 --- a/shootyepgp.toc +++ b/shootyepgp.toc @@ -8,7 +8,7 @@ ## X-Category: Guild ## X-Credits: shooty, Qcat(zhCN) ## Version: 3.50 -## X-Alpha: +## X-Alpha: 3.50.1 ## OptionalDeps: Ace2 ## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_groupbyarmor, sepgp_groupbyrole, sepgp_raidonly, sepgp_dbver, sepgp_debug ## SavedVariablesPerCharacter: sepgp_main, sepgp_log, sepgp_looted, sepgp_decay, sepgp_minep, sepgp_reservechannel, sepgp_progress, sepgp_discount, sepgp_altspool, sepgp_altpercent diff --git a/standings.lua b/standings.lua index 67a2596..4045144 100644 --- a/standings.lua +++ b/standings.lua @@ -288,14 +288,13 @@ function sepgp_standings:setHideScript() while (tablet) and i<100 do if tablet.owner ~= nil and tablet.owner == "sepgp_standings" then sepgp:make_escable(string.format("Tablet20DetachedFrame%d",i),"add") - if not (tablet:GetScript("OnHide")) then - tablet:SetScript("OnHide",function() - if not T:IsAttached("sepgp_standings") then - T:Attach("sepgp_standings") - this:SetScript("OnHide",nil) - end - end) - end + tablet:SetScript("OnHide",nil) + tablet:SetScript("OnHide",function() + if not T:IsAttached("sepgp_standings") then + T:Attach("sepgp_standings") + this:SetScript("OnHide",nil) + end + end) break end i = i+1 @@ -311,16 +310,18 @@ end function sepgp_standings:Toggle(forceShow) self:Top() - if T:IsAttached("sepgp_standings") then + if T:IsAttached("sepgp_standings") then -- hidden T:Detach("sepgp_standings") -- show if (T:IsLocked("sepgp_standings")) then T:ToggleLocked("sepgp_standings") end self:setHideScript() - elseif (forceShow) then - sepgp_standings:Refresh() else - T:Attach("sepgp_standings") -- hide + if (forceShow) then + sepgp_standings:Refresh() + else + T:Attach("sepgp_standings") -- hide + end end end