Skip to content

Commit ef8ca83

Browse files
committed
Added a new option to now allow accepting instance lockouts (fixes #9)
1 parent 3b88d90 commit ef8ca83

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

main.lua

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,16 @@ function DialogKey:GetValidPopupButtons()
247247
end
248248

249249
-- Takes a global string like '%s has challenged you to a duel.' and converts it to a format suitable for string.find
250-
local summon_match = CONFIRM_SUMMON:gsub("%%d", ".+"):format(".+", ".+", ".+")
251-
local duel_match = DUEL_REQUESTED:format(".+")
252-
local resurrect_match = RESURRECT_REQUEST_NO_SICKNESS:format(".+")
253-
local groupinvite_match = INVITATION:format(".+")
250+
local summonMatch = CONFIRM_SUMMON:gsub("%%d", ".+"):format(".+", ".+", ".+")
251+
local duelMatch = DUEL_REQUESTED:format(".+")
252+
local resurrectMatch = RESURRECT_REQUEST_NO_SICKNESS:format(".+")
253+
local groupinviteMatch = INVITATION:format(".+")
254+
local instanceLogMatches = {
255+
INSTANCE_LOCK_TIMER:format(".+", ".+"),
256+
INSTANCE_LOCK_TIMER_PREVIOUSLY_SAVED:format(".+", ".+"),
257+
INSTANCE_LOCK_WARNING:format(".+"),
258+
INSTANCE_LOCK_WARNING_PREVIOUSLY_SAVED:format(".+"),
259+
}
254260

255261
--- @param popupFrame StaticPopupTemplate # One of the StaticPopup1-4 frames
256262
--- @return Frame|nil|false # The button to click, nil if no button should be clicked, false if the text is empty and should be checked again later
@@ -262,11 +268,16 @@ function DialogKey:GetPopupButton(popupFrame)
262268
if not text or text == " " or text == "" then return false end
263269

264270
-- Don't accept group invitations if the option is enabled
265-
if self.db.dontAcceptInvite and text:find(groupinvite_match) then return end
271+
if self.db.dontAcceptInvite and text:find(groupinviteMatch) then return end
266272

267273
-- Don't accept summons/duels/resurrects if the options are enabled
268-
if self.db.dontClickSummons and text:find(summon_match) then return end
269-
if self.db.dontClickDuels and text:find(duel_match) then return end
274+
if self.db.dontClickSummons and text:find(summonMatch) then return end
275+
if self.db.dontClickDuels and text:find(duelMatch) then return end
276+
if self.db.dontAcceptInstanceLocks then
277+
for _, match in pairs(instanceLogMatches) do
278+
if text:find(match) then return end
279+
end
280+
end
270281

271282
-- If resurrect dialog has three buttons, and the option is enabled, use the middle one instead of the first one (soulstone, etc.)
272283
-- Located before resurrect/release checks/returns so it happens even if you have releases/revives disabled
@@ -279,7 +290,7 @@ function DialogKey:GetPopupButton(popupFrame)
279290
return popupFrame.button2
280291
end
281292

282-
if self.db.dontClickRevives and (text == RECOVER_CORPSE or text:find(resurrect_match)) then return end
293+
if self.db.dontClickRevives and (text == RECOVER_CORPSE or text:find(resurrectMatch)) then return end
283294
if self.db.dontClickReleases and canRelease then return end
284295

285296
-- Ignore blacklisted popup dialogs!

options.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ns.defaultOptions = {
2323
dontClickRevives = true,
2424
dontClickReleases = true,
2525
dontAcceptInvite = true,
26+
dontAcceptInstanceLocks = false,
2627
useSoulstoneRez = true,
2728
handleCraftingOrders = true,
2829
handlePlayerChoice = true,
@@ -334,6 +335,12 @@ If you have trouble finding the name, try "/fstack", pressing ALT until the fram
334335
desc = "Don't allow DialogKey to accept Raid/Party Invitations",
335336
descStyle = "inline", width = "full", type = "toggle",
336337
},
338+
dontAcceptInstanceLocks = {
339+
order = increment(),
340+
name = wrapName("Don't Accept Instance Lockouts"),
341+
desc = "Don't allow DialogKey to accept/\"save\" Instance Lockouts",
342+
descStyle = "inline", width = "full", type = "toggle",
343+
},
337344
dontClickSummons = {
338345
order = increment(),
339346
name = wrapName("Don't Accept Summons"),

0 commit comments

Comments
 (0)