From 637b16f0aa1444ce51c80fb9be60de1f7449a443 Mon Sep 17 00:00:00 2001 From: Urtgard <13890391+Urtgard@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:15:49 +0200 Subject: [PATCH] #158 fix start quest tracking --- Tooltip.lua | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Tooltip.lua b/Tooltip.lua index 9d64cc5..d89f80f 100644 --- a/Tooltip.lua +++ b/Tooltip.lua @@ -31,6 +31,21 @@ function WQA:CreateQTip() end end +---@param questID number +local function GetIconTexture(questID) + local texture = select(2, GetQuestLogRewardInfo(1, questID)) + if texture then + return texture + end + + local currencyInfo = C_QuestLog.GetQuestRewardCurrencyInfo(questID, 1, false) + if currencyInfo then + return currencyInfo.texture + end + + return [[Interface\GossipFrame\auctioneerGossipIcon]] +end + function WQA:UpdateQTip(tasks) local tooltip = self.tooltip if next(tasks) == nil then @@ -200,17 +215,12 @@ function WQA:UpdateQTip(tasks) zoneID = self:GetQuestZoneID(id) local x, y = C_TaskQuest.GetQuestLocation(id, zoneID) widget.questX, widget.questY = x or 0, y or 0 - widget.IconTexture = - select(2, GetQuestLogRewardInfo(1, id)) or - select(2, GetQuestLogRewardCurrencyInfo(1, id)) or - [[Interface\GossipFrame\auctioneerGossipIcon]] + widget.IconTexture = GetIconTexture(id) local function f(widget) if not widget.IconTexture then WQA:ScheduleTimer( function() - widget.IconTexture = - select(2, GetQuestLogRewardInfo(1, id)) or - select(2, GetQuestLogRewardCurrencyInfo(1, id)) + widget.IconTexture = GetIconTexture(id) f(widget) end, 1.5