From 953fc9bdc38a730b380a948169795f595853b6b1 Mon Sep 17 00:00:00 2001 From: Road-block Date: Sun, 18 Feb 2018 17:15:11 +0200 Subject: [PATCH] Add readonly discount and progress tier settings to menu for members and command-line. --- localization.lua | 12 +++++++++ shootyepgp.lua | 68 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/localization.lua b/localization.lua index 12a07a5..f84a4f8 100644 --- a/localization.lua +++ b/localization.lua @@ -10,6 +10,12 @@ L:RegisterTranslations("enUS", function() return { ["Raid Only"] = true, ["Only show members in raid."] = true, ["Restarted"] = true, + ["Progress"] = true, + ["Print Progress Multiplier."] = true, + ["Offspec"] = true, + ["Print Offspec Price."] = true, + ["Progress Setting: %s"] = true, + ["Offspec Price: %s%%"] = true, -- bids ["shootyepgp bids"] = true, ["Winning Mainspec Bid: %s (%.03f PR)"] = true, @@ -408,4 +414,10 @@ L:RegisterTranslations("zhCN", function() return { ["Alts"] = "Alts", ["Logs cleared"] = "Logs cleared", ["Restarted"] = "Restarted", + ["Progress"] = "Progress", + ["Print Progress Multiplier."] = "Print Progress Multiplier.", + ["Offspec"] = "Offspec", + ["Print Offspec Price."] = "Print Offspec Price.", + ["Progress Setting: %s"] = "Progress Setting: %s", + ["Offspec Price: %s%%"] = "Offspec Price: %s%%", } end) \ No newline at end of file diff --git a/shootyepgp.lua b/shootyepgp.lua index 87e8eff..8ef73ae 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -61,7 +61,17 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { func = function() sepgp_bids:Toggle() end, + order = 1, }, + show = { + type = "execute", + name = L["Standings"], + desc = L["Show Standings Table."], + func = function() + sepgp_standings:Toggle() + end, + order = 2, + }, clearloot = { type = "execute", name = L["ClearLoot"], @@ -70,6 +80,7 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { sepgp_looted = {} sepgp:defaultPrint(L["Loot info cleared"]) end, + order = 3, }, clearlogs = { type = "execute", @@ -79,15 +90,26 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { sepgp_log = {} sepgp:defaultPrint(L["Logs cleared"]) end, + order = 4, }, - show = { + progress = { type = "execute", - name = L["Standings"], - desc = L["Show Standings Table."], + name = L["Progress"], + desc = L["Print Progress Multiplier."], func = function() - sepgp_standings:Toggle() + sepgp:defaultPrint(sepgp_progress) end, + order = 5, }, + offspec = { + type = "execute", + name = L["Offspec"], + desc = L["Print Offspec Price."], + func = function() + sepgp:defaultPrint(string.format("%s%%",sepgp_discount*100)) + end, + order = 6, + }, restart = { type = "execute", name = L["Restart"], @@ -96,6 +118,7 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { sepgp:OnEnable() sepgp:defaultPrint(L["Restarted"]) end, + order = 7, }, }}, {type = "group", handler = sepgp, args = { @@ -106,6 +129,25 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { func = function() sepgp_standings:Toggle() end, + order = 1, + }, + progress = { + type = "execute", + name = L["Progress"], + desc = L["Print Progress Multiplier."], + func = function() + sepgp:defaultPrint(sepgp_progress) + end, + order = 2, + }, + offspec = { + type = "execute", + name = L["Offspec"], + desc = L["Print Offspec Price."], + func = function() + sepgp:defaultPrint(string.format("%s%%",sepgp_discount*100)) + end, + order = 3, }, restart = { type = "execute", @@ -115,6 +157,7 @@ local admincmd, membercmd = {type = "group", handler = sepgp, args = { sepgp:OnEnable() sepgp:defaultPrint(L["Restarted"]) end, + order = 4, }, }} --[[{ @@ -267,7 +310,8 @@ function sepgp:OnMenuRequest() self:SetRefresh(true) GuildRoster() end - D:FeedAceOptionsTable(self:buildMenu()) + self._options = self:buildMenu() + D:FeedAceOptionsTable(self._options) end function sepgp:TipHook() @@ -766,6 +810,8 @@ function sepgp:addonComms(prefix,message,channel,sender) local sender_rank = string.format("%s(%s)",C:Colorize(BC:GetHexColor(class),sender),rank) settings_notice = settings_notice..string.format(L[" settings accepted from %s"],sender_rank) self:defaultPrint(settings_notice) + self._options.args["progress_tier_header"].name = string.format(L["Progress Setting: %s"],sepgp_progress) + self._options.args["set_discount_header"].name = string.format(L["Offspec Price: %s%%"],sepgp_discount*100) end end end @@ -1362,6 +1408,12 @@ function sepgp:buildMenu() sepgp:SetRefresh(true) end, } + options.args["progress_tier_header"] = { + type = "header", + name = string.format(L["Progress Setting: %s"],sepgp_progress), + order = 85, + hidden = function() return admin() end, + } options.args["progress_tier"] = { type = "text", name = L["Raid Progress"], @@ -1417,6 +1469,12 @@ function sepgp:buildMenu() isPercent = true, hidden = function() return not (admin()) end, } + options.args["set_discount_header"] = { + type = "header", + name = string.format(L["Offspec Price: %s%%"],sepgp_discount*100), + order = 111, + hidden = function() return admin() end, + } options.args["set_discount"] = { type = "range", name = L["Offspec Price %"],