From f863172faf0ef7caf2e1824dd7e21a96bf90a81a Mon Sep 17 00:00:00 2001 From: Aldric Ducreux Date: Thu, 22 Aug 2024 03:20:20 +0200 Subject: [PATCH] Add popup for world quest pickup --- Event.lua | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/Event.lua b/Event.lua index b1fa6d9..7c51903 100644 --- a/Event.lua +++ b/Event.lua @@ -122,34 +122,47 @@ end) function AprRC.event.functions.accept(event, questId) -- Pickup - if AprRC:HasStepOption("DroppableQuest") then - local currentStep = AprRC:GetLastStep() - currentStep.DropQuest = questId - currentStep.DroppableQuest.Qid = questId + local function AddQuestToStep(questId) + if AprRC:HasStepOption("DroppableQuest") then + local currentStep = AprRC:GetLastStep() + currentStep.DropQuest = questId + currentStep.DroppableQuest.Qid = questId + AprRC:saveQuestInfo() + return + end + if AprRC:HasStepOption("ChromiePick") then + local currentStep = AprRC:GetLastStep() + currentStep.PickUp = { questId } + AprRC:saveQuestInfo() + return + end + if not AprRC:IsCurrentStepFarAway() and AprRC:HasStepOption("PickUp") then + local currentStep = AprRC:GetLastStep() + tinsert(currentStep.PickUp, questId) + else + local step = { PickUp = { questId } } + AprRC:SetStepCoord(step) + AprRC:NewStep(step) + end + -- update saved quest AprRC:saveQuestInfo() - return end - if AprRC:HasStepOption("ChromiePick") then - local currentStep = AprRC:GetLastStep() - currentStep.PickUp = { questId } - AprRC:saveQuestInfo() + if C_QuestLog.IsWorldQuest(questId) then + APR.questionDialog:CreateQuestionPopup( + "New world quest, do you want to add it?", + function() + AddQuestToStep(questId) + end + ) return end - if not AprRC:IsCurrentStepFarAway() and AprRC:HasStepOption("PickUp") then - local currentStep = AprRC:GetLastStep() - tinsert(currentStep.PickUp, questId) - else - local step = { PickUp = { questId } } - AprRC:SetStepCoord(step) - AprRC:NewStep(step) - end - -- update saved quest - AprRC:saveQuestInfo() + + AddQuestToStep(questId) end function AprRC.event.functions.remove(event, questId, ...) -- LeaveQuests - if not C_QuestLog.IsQuestFlaggedCompleted(questId) then + if not C_QuestLog.IsQuestFlaggedCompleted(questId) and not C_QuestLog.IsWorldQuest(questId) then if AprRC:HasStepOption("LeaveQuests") then local currentStep = AprRC:GetLastStep() tinsert(currentStep.LeaveQuests, questId)