From 4adfc7ef44f17e0caf9413a09986074536c03723 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Nov 2022 20:21:04 -0700 Subject: [PATCH 1/3] announce reset --- AnnounceReset.lua | 31 +++++++++++++++++++++++++++++++ Core.lua | 1 + Globals.lua | 1 + Groupie.toc | 3 ++- 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 AnnounceReset.lua diff --git a/AnnounceReset.lua b/AnnounceReset.lua new file mode 100644 index 0000000..bb62054 --- /dev/null +++ b/AnnounceReset.lua @@ -0,0 +1,31 @@ +local addonName, addon = ... +local GroupieAnnounceReset = addon:NewModule("GroupieAnnounceReset", "AceEvent-3.0") + +local locale = GetLocale() +if not addon.tableContains(addon.validLocales, locale) then + return +end +local L = LibStub('AceLocale-3.0'):GetLocale('Groupie') + + +local failedreset = "There are players still inside the instance." --This is actually a success, the message is a lie +local successreset = "has been reset." +local function AnnounceInstanceReset(_, msg, ...) + if addon.db.global.announceInstanceReset then + if strmatch(msg, failedreset) or strmatch(msg, successreset) then + if (UnitIsGroupLeader("player")) then + if (IsInRaid()) then + SendChatMessage(addon.instanceResetString, "RAID") + elseif (IsInGroup()) then + SendChatMessage(addon.instanceResetString, "RAID") + end + end + end + end +end + +function GroupieAnnounceReset:OnEnable() + self:RegisterEvent("CHAT_MSG_SYSTEM", function(...) + AnnounceInstanceReset(...) + end) +end diff --git a/Core.lua b/Core.lua index dae5195..eb7557c 100644 --- a/Core.lua +++ b/Core.lua @@ -1947,6 +1947,7 @@ function addon:OnInitialize() talentTooltips = true, gearSummaryTooltips = true, charSheetGear = true, + announceInstanceReset = true, } } diff --git a/Globals.lua b/Globals.lua index 2244f6e..1cec27f 100644 --- a/Globals.lua +++ b/Globals.lua @@ -27,6 +27,7 @@ addon.askForPlayerInfo = format("{rt3} %s : What Role are you?", addonName) addon.askForInstance = format("{rt3} %s : What are you inviting me to?", addonName) addon.autoRejectRequestString = "FYI, I have Auto-Reject enabled. Message me back and if it's a good fit I'll send you an invite. Thanks!" addon.autoRejectInviteString = "FYI, I have Auto-Reject enabled. Message me back and if it's a good fit I'll come. Thanks!" +addon.instanceResetString = format("{rt3} %s : All Instances Have Been Reset!", addonName) addon.PROTECTED_TOKENS = { [1] = "%s*{rt3}%s*groupie%s*:", [2] = "%s*groupie%s*{rt3}%s*:", diff --git a/Groupie.toc b/Groupie.toc index 8ef7ed0..a591c88 100644 --- a/Groupie.toc +++ b/Groupie.toc @@ -19,4 +19,5 @@ Core.lua GroupBrowser.lua RightClick.lua Listener.lua -AutoResponse.lua \ No newline at end of file +AutoResponse.lua +AnnounceReset.lua \ No newline at end of file From 152299373234b9b6f998e7107d271a14e22b595c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Nov 2022 00:11:36 -0700 Subject: [PATCH 2/3] announce instance reset toggle --- AnnounceReset.lua | 23 +++++++++++++++++++++-- Core.lua | 27 +++++++++++++++++++++------ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/AnnounceReset.lua b/AnnounceReset.lua index bb62054..2f0bc1b 100644 --- a/AnnounceReset.lua +++ b/AnnounceReset.lua @@ -12,20 +12,39 @@ local failedreset = "There are players still inside the instance." --This is act local successreset = "has been reset." local function AnnounceInstanceReset(_, msg, ...) if addon.db.global.announceInstanceReset then - if strmatch(msg, failedreset) or strmatch(msg, successreset) then + if strmatch(msg, successreset) then if (UnitIsGroupLeader("player")) then if (IsInRaid()) then SendChatMessage(addon.instanceResetString, "RAID") elseif (IsInGroup()) then - SendChatMessage(addon.instanceResetString, "RAID") + SendChatMessage(addon.instanceResetString, "PARTY") + end + end + elseif strmatch(msg, failedreset) then + local playersStillInside = " Anyone still inside can exit and re-enter" + if (UnitIsGroupLeader("player")) then + if (IsInRaid()) then + SendChatMessage(addon.instanceResetString .. playersStillInside, "RAID") + elseif (IsInGroup()) then + SendChatMessage(addon.instanceResetString .. playersStillInside, "PARTY") end end end end end +--filter the incorrect 'failed reset' message +function addon.resetChatFilter(self, event, msg, author, ...) + if strmatch(msg, failedreset) then + return true + end +end + function GroupieAnnounceReset:OnEnable() self:RegisterEvent("CHAT_MSG_SYSTEM", function(...) AnnounceInstanceReset(...) end) + if addon.db.global.announceInstanceReset then + ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", addon.resetChatFilter) + end end diff --git a/Core.lua b/Core.lua index eb7557c..4d3949b 100644 --- a/Core.lua +++ b/Core.lua @@ -2763,18 +2763,33 @@ function addon.SetupConfig() end end, }, - spacerdesc4 = { type = "description", name = " ", width = "full", order = 11 }, + announceResetToggle = { + type = "toggle", + name = "Announce Instance Reset in Party/Raid Chat", + order = 11, + width = "full", + get = function(info) return addon.db.global.announceInstanceReset end, + set = function(info, val) + addon.db.global.announceInstanceReset = val + if addon.db.global.announceInstanceReset then + ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", addon.resetChatFilter) + else + ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", addon.resetChatFilter) + end + end, + }, + spacerdesc4 = { type = "description", name = " ", width = "full", order = 12 }, header2 = { type = "description", name = "|cff" .. addon.groupieSystemColor .. L["GlobalOptions"].LFGData, - order = 12, + order = 13, fontSize = "medium" }, preserveDurationDropdown = { type = "select", style = "dropdown", name = "", - order = 13, + order = 14, width = 1.4, values = { [1] = L["GlobalOptions"].DurationDropdown["1"], [2] = L["GlobalOptions"].DurationDropdown["2"], @@ -2784,11 +2799,11 @@ function addon.SetupConfig() set = function(info, val) addon.db.global.minsToPreserve = val end, get = function(info) return addon.db.global.minsToPreserve end, }, - spacerdesc5 = { type = "description", name = " ", width = "full", order = 14 }, + spacerdesc5 = { type = "description", name = " ", width = "full", order = 15 }, header3 = { type = "description", name = "|cff" .. addon.groupieSystemColor .. L["GlobalOptions"].UIScale, - order = 15, + order = 16, fontSize = "medium" }, scaleSlider = { @@ -2797,7 +2812,7 @@ function addon.SetupConfig() min = 0.5, max = 2.0, step = 0.1, - order = 16, + order = 17, set = function(info, val) addon.db.global.UIScale = val GroupieFrame:SetScale(val) From 9d54411f1787fad0ef91336debec52f112171d41 Mon Sep 17 00:00:00 2001 From: Gogo1951 <55365231+Gogo1951@users.noreply.github.com> Date: Fri, 11 Nov 2022 11:27:46 -0600 Subject: [PATCH 3/3] Update AnnounceReset.lua --- AnnounceReset.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnnounceReset.lua b/AnnounceReset.lua index 2f0bc1b..4e37154 100644 --- a/AnnounceReset.lua +++ b/AnnounceReset.lua @@ -21,7 +21,7 @@ local function AnnounceInstanceReset(_, msg, ...) end end elseif strmatch(msg, failedreset) then - local playersStillInside = " Anyone still inside can exit and re-enter" + local playersStillInside = " Any players still inside will need to exit and then re-enter." if (UnitIsGroupLeader("player")) then if (IsInRaid()) then SendChatMessage(addon.instanceResetString .. playersStillInside, "RAID")