Skip to content

Commit

Permalink
Properly accept popup quests
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Sep 19, 2024
1 parent fd354db commit 4e4a013
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local ITEM_CASH_REWARDS = {
}

local ignoredQuests = {}
local function isQuestIgnored(questID, title)
local function isQuestIgnored(questID, title, override)
local ignore
if ignoredQuests[questID] then
return true
Expand All @@ -26,6 +26,10 @@ local function isQuestIgnored(questID, title)
elseif C_QuestLog.IsWorldQuest(questID) then
-- these are usually always material delivery quests, don't want to waste that
ignore = true
elseif override then
-- this is so we can override popup quests that are not being tracked, as they can
-- get quite annoying
ignore = false
elseif C_QuestLog.IsQuestTrivial(questID) and not C_Minimap.IsTrackingHiddenQuests() then
ignore = true
end
Expand Down Expand Up @@ -107,6 +111,7 @@ local function handleQuestList()
end
end

local popups = {}
local function handleQuestDetail()
if addon:IsPaused() or addon:IsNPCIgnored() then
return
Expand Down Expand Up @@ -135,9 +140,14 @@ local function handleQuestDetail()
-- when not triggered in combination with QuestGetAutoAccept-style quests this is just
-- a normal quest popup, as if it was shared by an unknown player, so we'll just accept it
AcceptQuest()
elseif not isQuestIgnored(questID) then
elseif not isQuestIgnored(questID, nil, popups[questID]) then
AcceptQuest()
end

if popups[questID] then
-- just remove the already accepted/completed quest from the tracker
RemoveAutoQuestPopUp(questID)
end
end

local function handleQuestProgress()
Expand Down Expand Up @@ -234,6 +244,8 @@ local function handleQuestPopup()

for index = 1, numPopups do
local questID, questType = GetAutoQuestPopUp(index)
popups[questID] = true

if questType == 'OFFER' and addon:GetOption('accept') then
ShowQuestOffer(questID)
elseif questType == 'COMPLETE' and addon:GetOption('complete') then
Expand Down

0 comments on commit 4e4a013

Please sign in to comment.