From 5f5d7e1d0a3e66d0c5464be51d13a7720abe0444 Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Sat, 24 Jan 2026 20:11:26 +0400 Subject: [PATCH] fix: quest item bar --- Core/ItemDetection.lua | 28 ++++++++++++++++++++- UI/QuestItemBar.lua | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/Core/ItemDetection.lua b/Core/ItemDetection.lua index 5714d0d..0da65c3 100644 --- a/Core/ItemDetection.lua +++ b/Core/ItemDetection.lua @@ -291,7 +291,12 @@ local function DetectQuestUsable(lines) -- Check for yellow "Use:" text if line.r and line.g and line.b then local isYellow = (line.r > 0.9 and line.g > 0.75 and line.b < 0.2) - if isYellow and string.find(line.leftLower, "use:") then + if isYellow and line.leftLower and string.find(line.leftLower, "use:") then + return true + end + -- Also check for green "Use:" text (some quest items have green use text) + local isGreen = (line.r < 0.3 and line.g > 0.9 and line.b < 0.3) + if isGreen and line.leftLower and string.find(line.leftLower, "use:") then return true end end @@ -299,6 +304,27 @@ local function DetectQuestUsable(lines) return false end +-- Debug function to dump tooltip lines for an item +-- Usage: /script Guda.Modules.ItemDetection:DebugTooltip(bagID, slotID) +function ItemDetection:DebugTooltip(bagID, slotID) + local itemLink = GetContainerItemLink(bagID, slotID) + if not itemLink then + addon:Print("No item at " .. bagID .. ":" .. slotID) + return + end + + addon:Print("=== Tooltip Debug for " .. bagID .. ":" .. slotID .. " ===") + local lines = ScanTooltipLines(bagID, slotID, itemLink) + addon:Print("Total lines: " .. table.getn(lines)) + + for i, line in ipairs(lines) do + local text = line.left or "(no text)" + local r, g, b = line.r or 0, line.g or 0, line.b or 0 + addon:Print(string.format("[%d] r=%.2f g=%.2f b=%.2f: %s", i, r, g, b, text)) + end + addon:Print("=== End Tooltip Debug ===") +end + -- Durability pattern for filtering out broken item red text local durabilityPattern = DURABILITY_TEMPLATE and string.gsub(DURABILITY_TEMPLATE, "%%d", "%%d+") or nil diff --git a/UI/QuestItemBar.lua b/UI/QuestItemBar.lua index e8de95c..bd9c754 100644 --- a/UI/QuestItemBar.lua +++ b/UI/QuestItemBar.lua @@ -668,4 +668,60 @@ function QuestItemBar:Initialize() addon:Debug("QuestItemBar initialized") end +-- Debug function to diagnose QuestItemBar issues +-- Usage: /script Guda.Modules.QuestItemBar:Debug() +function QuestItemBar:Debug() + addon:Print("=== QuestItemBar Debug ===") + + -- Check setting + local showQuestBar = addon.Modules.DB:GetSetting("showQuestBar") + addon:Print("showQuestBar setting: " .. tostring(showQuestBar)) + + -- Check frame + local frame = Guda_QuestItemBar + addon:Print("Frame exists: " .. tostring(frame ~= nil)) + if frame then + addon:Print("Frame shown: " .. tostring(frame:IsShown())) + end + + -- Scan all bags for potential quest items + addon:Print("--- Scanning bags ---") + local foundCount = 0 + for bagID = 0, 4 do + local numSlots = GetContainerNumSlots(bagID) + for slotID = 1, numSlots do + local texture, count = GetContainerItemInfo(bagID, slotID) + if texture then + local itemLink = GetContainerItemLink(bagID, slotID) + local itemData = addon.Modules.BagScanner:ScanSlot(bagID, slotID) + + if itemData then + local props = addon.Modules.ItemDetection:GetItemProperties(itemData, bagID, slotID) + + -- Show items that are quest-related OR have Quest class + if props.isQuestItem or props.isQuestUsable or (itemData.class and itemData.class == "Quest") then + foundCount = foundCount + 1 + addon:Print(string.format("[%d:%d] %s", bagID, slotID, itemData.name or "Unknown")) + addon:Print(string.format(" class=%s, isQuest=%s, isUsable=%s, isStarter=%s", + tostring(itemData.class), + tostring(props.isQuestItem), + tostring(props.isQuestUsable), + tostring(props.isQuestStarter))) + + -- Check if it would show in bar + local wouldShow = props.isQuestItem and props.isQuestUsable and not props.isQuestStarter + addon:Print(" Would show in bar: " .. tostring(wouldShow)) + end + end + end + end + end + + if foundCount == 0 then + addon:Print("No quest-related items found in bags") + end + + addon:Print("=== End Debug ===") +end + QuestItemBar.isLoaded = true