diff --git a/CHANGELOG.md b/CHANGELOG.md index f8c0567..f96501e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ - **[Tooltip - First-Hover Resize Pop]** Removed the unconditional `QuestieTooltips:ResizeTooltip(self)` call from `AddItemDataToTooltip`. With the flicker fix in place, the resize pass still fired once per item hover and triggered ElvUI's smooth-resize animation, causing a visible frame pop on first hover. ElvUI already manages tooltip sizing correctly, so the Questie resize call is no longer needed for item tooltips. - **[QuestieLearner - Quest Detail Field Mapping]** Fixed three quest-field index bugs in `OnQuestDetail` / `OnQuestAccepted` that were silently corrupting learner `questDataOverrides`. The detail handler was writing the objectives text into `data[6]` (the `requiredRaces` bitmask field), the quest body into `data[17]` (the `zoneOrSort` field), and the current zone areaId into `data[8]` (the `objectivesText` table field). Each write permanently blocked the correct value for that field because `LearnQuest` only writes nil keys. The detail handler now only writes `name` and `zoneOrSort`, and the accepted handler is annotated to make the schema restrictions explicit so future fields are not added by guess. - **[QuestieLearner - Accepted Handler Reducer]** Collapsed a redundant second pass over the quest log in `OnQuestAccepted` that was about to introduce a `local logIdx = 0` redeclaration. The index found while building the data table is now reused for the subsequent objective-mapping scan instead of being re-derived from scratch. +- **[Tooltip - Item ID Always Shown]** `AddItemDataToTooltip` previously gated the "Item ID" line on the item having a registered quest-objective tooltip — for items that are not part of any quest objective (e.g. trade goods, vendor trash, quest-start items with no other Questie data attached), the option to show IDs had no visible effect. The line is now added for every item hover when the option is enabled, mirroring the NPC/Object tooltip behavior. Also switched the call to `self:AddDoubleLine` so the ID lands on the actual frame that fired `OnTooltipSetItem` (which can be `ItemRefTooltip` for chat links, not just `GameTooltip`). +- **[Tooltip - Item Starts Quest]** Item tooltips now surface a "Drops a quest !" line with the quest title when the item has a non-zero `startQuest` value in the static DB / Ascension override table and the player does not already have the quest (active or turned in). The item→quest relationship is a build-time DB field — we never know it ahead of runtime observation — so it is read directly from `QueryItemSingle` at hover time. The line uses `QuestieLib:GetColoredQuestName` so the quest title respects the same level/complete state formatting the rest of Questie uses. ### Tooltip diff --git a/Modules/Tooltips/TooltipHandler.lua b/Modules/Tooltips/TooltipHandler.lua index 25f9714..c1d94b0 100644 --- a/Modules/Tooltips/TooltipHandler.lua +++ b/Modules/Tooltips/TooltipHandler.lua @@ -9,6 +9,8 @@ local l10n = QuestieLoader:ImportModule("l10n") local QuestieDB = QuestieLoader:ImportModule("QuestieDB") ---@type QuestiePlayer local QuestiePlayer = QuestieLoader:ImportModule("QuestiePlayer") +---@type QuestieLib +local QuestieLib = QuestieLoader:ImportModule("QuestieLib") --- COMPATIBILITY --- local UnitGUID = QuestieCompat.UnitGUID @@ -360,10 +362,31 @@ function _QuestieTooltips:AddItemDataToTooltip() if name and itemId and (lastItemId ~= itemId) then QuestieTooltips.lastGametooltipItem = name local tooltipData = QuestieTooltips:GetTooltip("i_" .. (itemId or 0)); - if tooltipData then - if Questie.db.profile.enableTooltipsItemID == true then - GameTooltip:AddDoubleLine("Item ID", "|cFFFFFFFF" .. itemId .. "|r") + -- Item ID is shown unconditionally for every item hover (matches the + -- behavior of NPC/Object tooltips), so users can always copy/paste + -- the ID even for items that have no quest objective or starter + -- data attached. The line is always added when the itemId changes + -- regardless of whether tooltipData is non-nil. + if Questie.db.profile.enableTooltipsItemID == true then + self:AddDoubleLine("Item ID", "|cFFFFFFFF" .. itemId .. "|r") + end + -- If the item starts a quest (the player must right-click/use it, + -- or talk to an NPC while it's in their bag), surface that so the + -- player can see which quest the item unlocks without first + -- having to look it up. We never knew the item's startQuest + -- until runtime, so this is read directly from the static DB / + -- Ascension override table. + local startQuestId = QuestieDB and QuestieDB.QueryItemSingle + and tonumber(QuestieDB.QueryItemSingle(itemId, "startQuest") or 0) or 0 + if startQuestId and startQuestId > 0 and (not _PlayerHasQuest(startQuestId)) then + local questTitle = QuestieLib and QuestieLib.GetColoredQuestName + and QuestieLib:GetColoredQuestName(startQuestId, Questie.db.profile.enableTooltipsQuestLevel, true, true) + or nil + if questTitle and questTitle ~= "" then + self:AddDoubleLine(QUEST_START_LINE, questTitle) end + end + if tooltipData then for _, v in next, tooltipData do self:AddLine(v) end