Skip to content

Commit

Permalink
Merge pull request #221 from Gogo1951/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Gogo1951 authored Nov 11, 2022
2 parents a3c2bcf + 9d54411 commit 8d8ec65
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 7 deletions.
50 changes: 50 additions & 0 deletions AnnounceReset.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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, successreset) then
if (UnitIsGroupLeader("player")) then
if (IsInRaid()) then
SendChatMessage(addon.instanceResetString, "RAID")
elseif (IsInGroup()) then
SendChatMessage(addon.instanceResetString, "PARTY")
end
end
elseif strmatch(msg, failedreset) then
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")
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
28 changes: 22 additions & 6 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,7 @@ function addon:OnInitialize()
talentTooltips = true,
gearSummaryTooltips = true,
charSheetGear = true,
announceInstanceReset = true,
}
}

Expand Down Expand Up @@ -2762,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"],
Expand All @@ -2783,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 = {
Expand All @@ -2796,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)
Expand Down
1 change: 1 addition & 0 deletions Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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*:",
Expand Down
3 changes: 2 additions & 1 deletion Groupie.toc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Core.lua
GroupBrowser.lua
RightClick.lua
Listener.lua
AutoResponse.lua
AutoResponse.lua
AnnounceReset.lua

0 comments on commit 8d8ec65

Please sign in to comment.