JackJack

JackJack

792 Downloads

Exclude portals from directions when quest requirements not met

fechan opened this issue ยท 1 comments

commented

Some portals only appear after you've completed a quest, and other only while you're currently in a certain quest. We should exclude portals based on whether the player meets these requirements.

https://wowpedia.fandom.com/wiki/API_C_QuestLog.IsQuestFlaggedCompleted

Not sure how to check if a quest is ongoing.

commented

https://wowpedia.fandom.com/wiki/API_GetQuestLogIndexByID
https://wowpedia.fandom.com/wiki/API_GetNumQuestLeaderBoards
https://wowpedia.fandom.com/wiki/API_GetQuestLogLeaderBoard

local questID = 12345 -- Replace with the ID of the quest you want to check

-- Get the index of the quest in the player's quest log
local questIndex = GetQuestLogIndexByID(questID)

-- Check if the quest is in the player's quest log
if questIndex then
  -- The quest is in the player's quest log. Now we need to check if it has been completed.
  local _, _, _, _, _, _, _, questComplete = GetQuestLogTitle(questIndex)
  if questComplete then
    -- The quest has been completed
  else
    -- The quest has been started but not completed
    -- Now we can check the progress of the quest
    local numObjectives = GetNumQuestLeaderBoards(questIndex)
    for i = 1, numObjectives do
      local description, _, done = GetQuestLogLeaderBoard(i, questIndex)
      if not done then
        -- This objective has not been completed
      end
    end
  end
else
  -- The quest is not in the player's quest log, so it has not been started
end