From b302dbe5a4662a806204a729d1537b00893e6110 Mon Sep 17 00:00:00 2001 From: Road-block Date: Fri, 8 Dec 2017 18:07:41 +0200 Subject: [PATCH] Separate member and admin chat commands. /shooty to see available commands. Force tablets to top on closing, to workaround a bug with tablets appearing empty. --- bids.lua | 7 ++++ logs.lua | 7 ++++ loot.lua | 7 ++++ reserves.lua | 7 ++++ shootyepgp.lua | 88 ++++++++++++++++++++++++++++++++++++++------------ shootyepgp.toc | 2 +- standings.lua | 9 +++++- 7 files changed, 105 insertions(+), 22 deletions(-) diff --git a/bids.lua b/bids.lua index 484ff88..bd5e95a 100644 --- a/bids.lua +++ b/bids.lua @@ -55,7 +55,14 @@ function sepgp_bids:setHideScript() end end +function sepgp_bids:Top() + if T:IsRegistered("sepgp_bids") and (T.registry.sepgp_bids.tooltip) then + T.registry.sepgp_bids.tooltip.scroll=0 + end +end + function sepgp_bids:Toggle(forceShow) + self:Top() if T:IsAttached("sepgp_bids") then T:Detach("sepgp_bids") if (T:IsLocked("sepgp_bids")) then diff --git a/logs.lua b/logs.lua index b109ddc..6d448d7 100644 --- a/logs.lua +++ b/logs.lua @@ -60,7 +60,14 @@ function sepgp_logs:setHideScript() end end +function sepgp_logs:Top() + if T:IsRegistered("sepgp_logs") and (T.registry.sepgp_logs.tooltip) then + T.registry.sepgp_logs.tooltip.scroll=0 + end +end + function sepgp_logs:Toggle(forceShow) + self:Top() if T:IsAttached("sepgp_logs") then T:Detach("sepgp_logs") if (T:IsLocked("sepgp_logs")) then diff --git a/loot.lua b/loot.lua index 5715a12..f43d2a0 100644 --- a/loot.lua +++ b/loot.lua @@ -60,7 +60,14 @@ function sepgp_loot:setHideScript() end end +function sepgp_loot:Top() + if T:IsRegistered("sepgp_loot") and (T.registry.sepgp_loot.tooltip) then + T.registry.sepgp_loot.tooltip.scroll=0 + end +end + function sepgp_loot:Toggle(forceShow) + self:Top() if T:IsAttached("sepgp_loot") then T:Detach("sepgp_loot") if (T:IsLocked("sepgp_loot")) then diff --git a/reserves.lua b/reserves.lua index 0253340..43da50f 100644 --- a/reserves.lua +++ b/reserves.lua @@ -55,7 +55,14 @@ function sepgp_reserves:setHideScript() end end +function sepgp_reserves:Top() + if T:IsRegistered("sepgp_reserves") and (T.registry.sepgp_reserves.tooltip) then + T.registry.sepgp_reserves.tooltip.scroll=0 + end +end + function sepgp_reserves:Toggle(forceShow) + self:Top() if T:IsAttached("sepgp_reserves") then T:Detach("sepgp_reserves") if (T:IsLocked("sepgp_reserves")) then diff --git a/shootyepgp.lua b/shootyepgp.lua index 38919ab..6d078d8 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -22,24 +22,6 @@ sepgp.VARS = { bankde = "Bank-D/E", reminder = C:Red("Unassigned"), } -sepgp.cmdtable = {type = "group", handler = sepgp, args = { - show = { - type = "execute", - name = "Standings", - desc = "Show Standings Table.", - func = function() - sepgp_standings:Toggle() - end, - }, - restart = { - type = "execute", - name = "Restart", - desc = "Restart shootyepgp if having startup problems.", - func = function() - sepgp:OnEnable() - end, - }, -}} sepgp._playerName = (UnitName("player")) local shooty_reservechan = "Reserves" local shooty_reservecall = string.format("{shootyepgp}Type \"+\" if on main, or \"+\" (without quotes) if on alt within %dsec.",sepgp.VARS.timeout) @@ -68,7 +50,73 @@ do hexColorQuality[ITEM_QUALITY_COLORS[i].hex] = i end end - +local admincmd, membercmd = {type = "group", handler = sepgp, args = { + bids = { + type = "execute", + name = "Bids", + desc = "Show Bids Table.", + func = function() + sepgp_bids:Toggle() + end, + }, + clearloot = { + type = "execute", + name = "ClearLoot", + desc = "Clear Loot Table.", + func = function() + sepgp_looted = {} + end, + }, + clearlogs = { + type = "execute", + name = "ClearLogs", + desc = "Clear Logs Table.", + func = function() + sepgp_log = {} + end, + }, + show = { + type = "execute", + name = "Standings", + desc = "Show Standings Table.", + func = function() + sepgp_standings:Toggle() + end, + }, + restart = { + type = "execute", + name = "Restart", + desc = "Restart shootyepgp if having startup problems.", + func = function() + sepgp:OnEnable() + end, + }, + }}, +{type = "group", handler = sepgp, args = { + show = { + type = "execute", + name = "Standings", + desc = "Show Standings Table.", + func = function() + sepgp_standings:Toggle() + end, + }, + }} + --[[{ + type = "execute", + name = "Standings", + desc = "Show Standings Table.", + func = function() + sepgp_standings:Toggle() + end, + }]] +sepgp.cmdtable = function() + if (admin()) then + return admincmd + else + return membercmd + end +end sepgp.reserves = {} sepgp.bids_main,sepgp.bids_off,sepgp.bid_item = {},{},{} sepgp.timer = CreateFrame("Frame") @@ -183,7 +231,7 @@ function sepgp:AceEvent_FullyInitialized() -- SYNTHETIC EVENT, later than PLAYER for i=1,5 do table.insert(UISpecialFrames,string.format("Tablet20DetachedFrame%d",i)) end - self:RegisterChatCommand({"/shooty","/sepgp","/shootyepgp"},self.cmdtable) + self:RegisterChatCommand({"/shooty","/sepgp","/shootyepgp"},self.cmdtable()) self._hasInitFull = true end diff --git a/shootyepgp.toc b/shootyepgp.toc index 1228f1b..9fad1da 100644 --- a/shootyepgp.toc +++ b/shootyepgp.toc @@ -5,7 +5,7 @@ ## X-Website: https://github.com/Road-block/shootyepgp/releases/latest ## X-Category: Guild ## X-Credits: shooty -## Version: 3.30.2 +## Version: 3.30.3 ## X-Alpha: ## OptionalDeps: Ace2 ## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_raidonly, sepgp_dbver, sepgp_debug diff --git a/standings.lua b/standings.lua index 0041a12..f7ac178 100644 --- a/standings.lua +++ b/standings.lua @@ -209,7 +209,14 @@ function sepgp_standings:setHideScript() end end +function sepgp_standings:Top() + if T:IsRegistered("sepgp_standings") and (T.registry.sepgp_standings.tooltip) then + T.registry.sepgp_standings.tooltip.scroll=0 + end +end + function sepgp_standings:Toggle() + self:Top() if T:IsAttached("sepgp_standings") then T:Detach("sepgp_standings") if (T:IsLocked("sepgp_standings")) then @@ -228,7 +235,7 @@ end function sepgp_standings:ToggleRaidOnly() sepgp_raidonly = not sepgp_raidonly - self:Refresh() + self:Top() sepgp:SetRefresh(true) end