Skip to content

Commit

Permalink
Merge pull request cralor#3 from laytya/master
Browse files Browse the repository at this point in the history
Fixes for quest detection
  • Loading branch information
Azgaardian authored Jun 27, 2023
2 parents 4a58385 + b5bc23f commit da05dd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local function MapPoint(zone, x, y, desc)
TourGuide:Debug( string.format("Mapping %q - %s (%.2f, %.2f)", desc, zone, x, y))
local zi, zc = zone and zonei[zone], zone and zonec[zone]
if not zi then
if zone then TourGuide:PrintF(L["Cannot find zone %q, using current zone."], zone)
if zone then TourGuide:Print(L["Cannot find zone %q, using current zone."], zone)
else TourGuide:Print(L["No zone provided, using current zone."]) end

zi, zc = GetCurrentMapZone(), GetCurrentMapContinent()
Expand Down
3 changes: 2 additions & 1 deletion QuestTracking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ end

local orig = GetQuestReward
GetQuestReward = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
local quest = string.gsub(GetTitleText(), "%[%d*%??%]%s", "")
local quest = string.gsub(GetTitleText(), "%[[0-9%+%-]+]%s", "")

TourGuide:Debug( "GetQuestReward", quest)
TourGuide:CompleteQuest(quest, true)

Expand Down
10 changes: 2 additions & 8 deletions TourGuide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,12 @@ function TourGuide:LoadNextGuide()
end


local firstcall = true
function TourGuide:GetQuestLogIndexByName(name)
name = name or self.quests[self.current]
name = string.gsub(name,L.PART_GSUB, "")
for i=1,GetNumQuestLogEntries() do
local title, _, _, isHeader = GetQuestLogTitle(i)
if firstcall and not isHeader then
firstcall = nil
if string.sub(title, 1, 1) == "[" then self:Print("Another addon, most likely a \"Quest Level\" addon, is preventing TourGuide's quest detection from working correctly.") end
end
title = string.gsub(title, "%[[0-9%+%-]+]%s", "")
if not isHeader and title == name then return i end
end
end
Expand Down Expand Up @@ -306,16 +302,14 @@ function TourGuide:CompleteQuest(name, noupdate)
return
end

local i = self.current
local action, quest
while not action do
for i in ipairs(self.actions) do
action, quest = self:GetObjectiveInfo(i)
self:Debug( string.format("Action %q Quest %q",action,quest))
if action == "TURNIN" and not self:GetObjectiveStatus(i) and name == string.gsub(quest,L.PART_GSUB, "") then
self:Debug( string.format("Saving quest turnin %q", quest))
return self:SetTurnedIn(i, true, noupdate)
end
i = i + 1
end
self:Debug( string.format("Quest %q not found!", name))
end
Expand Down

0 comments on commit da05dd1

Please sign in to comment.