Skip to content

Commit

Permalink
Add popup for world quest pickup
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed Aug 22, 2024
1 parent b9f46a1 commit f863172
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions Event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f863172

Please sign in to comment.