diff --git a/CHANGELOG.md b/CHANGELOG.md index de15b58..14fb4e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ ### Bug Fixes +- **[Fix - Tooltip Crash On Unit Hover]** Fixed a crash on every unit tooltip (`attempt to call global '_TooltipHasLeftLine'`): the dedupe helper was defined *after* `AddUnitDataToTooltip`, so that function couldn't see the local. It's now defined before all `Add*DataToTooltip` functions. - **[Tooltip - Robust ID Resolution For Hex/Object GUIDs]** Tooltip NPC IDs are now resolved with the learner's robust GUID parser (`QuestieLearner:GetIdAndTypeFromGUID`, now public) as a fallback when the naive `strsplit("-", guid)` can't parse the GUID — e.g. legacy `0x` hex GUIDs — which previously left the NPC ID line silently unwritten. The Object ID line gained a matching fallback: when a hovered object's name isn't in the lookup, it resolves the ID from the object's GUID via the new `QuestieLearner:GetObjectIdFromGUID`. Both ID lines are also deduped per tooltip. - **[Tooltip - ID Lines No Longer Vanish On Re-Hover]** The "Item ID" / "NPC ID" lines were only added when the hovered item/unit *changed* (`lastItemId`/`lastGuid` gate). But WoW clears and re-fires `OnTooltipSetItem`/`OnTooltipSetUnit` for the *same* item/unit, rebuilding the tooltip — and the gate skipped re-adding the line on the rebuilt tooltip, so the ID disappeared (e.g. hovering the same quest item twice). The ID lines are now (re)added on every render and deduplicated per tooltip (via `_TooltipHasLeftLine`), so they're always present exactly once. - **[Learner - Exclude Critters & Fix Sunstrider Object Mis-Key]** Critters (Rabbit, Deer, Sheep, Cow, Cat, …) are never quest-relevant but were being recorded by the learner when killed, polluting the DB. The learner now refuses to record critters (a static list of common classic critters plus runtime detection via `UnitCreatureType` for Ascension's custom critters, flagged the moment a unit token is available on mouseover/target), purges any already-recorded critters on `InjectLearnedData` and on sight, and skips them in every learn path. Also fixed object spawns mis-stored under the Eversong parent areaID `3430` (e.g. object 180516 "Shrine of Dath'Remar", which is on Sunstrider): the migration now moves any `3430`-keyed spawn — and the matching home-zone field — to Sunstrider's uiMapID `1241`, since legitimate Eversong data is always keyed by `1941`. diff --git a/Modules/Tooltips/TooltipHandler.lua b/Modules/Tooltips/TooltipHandler.lua index 96186db..bcebee1 100644 --- a/Modules/Tooltips/TooltipHandler.lua +++ b/Modules/Tooltips/TooltipHandler.lua @@ -17,6 +17,26 @@ local UnitGUID = QuestieCompat.UnitGUID local lastGuid +-- True if the tooltip already shows a left-column line beginning with `label`. Used so the +-- ID lines can be (re)added on EVERY tooltip render without ever duplicating within a single +-- tooltip. The id lines must be re-added every render because WoW clears and re-fires +-- OnTooltipSetItem/OnTooltipSetUnit for the same item/unit, and the old "only when the id +-- changed" gate skipped re-adding the line on the rebuilt tooltip — so the ID vanished. +-- Defined here (before the Add*DataToTooltip functions) so all of them can see it. +local function _TooltipHasLeftLine(tooltip, label) + local frameName = tooltip and tooltip.GetName and tooltip:GetName() + if not frameName then return false end + local numLines = tooltip:NumLines() + for i = 1, (numLines or 0) do + local fontString = _G[frameName .. "TextLeft" .. i] + local text = fontString and fontString:GetText() + if text and string.find(text, label, 1, true) == 1 then + return true + end + end + return false +end + -- ============================================================ -- NPCs that DROP an item which STARTS a quest (quest-starter drops) -- Shows in tooltip like: @@ -433,24 +453,6 @@ end -- Rest of original file -- ======================= --- True if the tooltip already shows a left-column line beginning with `label`. Used so the --- ID lines can be (re)added on EVERY tooltip render without ever duplicating within a single --- tooltip. The id lines must be added every render because WoW clears and re-fires --- OnTooltipSetItem/OnTooltipSetUnit for the same item/unit, and the old "only when the id --- changed" gate skipped re-adding the line on the rebuilt tooltip — so the ID vanished. -local function _TooltipHasLeftLine(tooltip, label) - local frameName = tooltip and tooltip.GetName and tooltip:GetName() - if not frameName then return false end - local numLines = tooltip:NumLines() - for i = 1, (numLines or 0) do - local fontString = _G[frameName .. "TextLeft" .. i] - local text = fontString and fontString:GetText() - if text and string.find(text, label, 1, true) == 1 then - return true - end - end - return false -end local lastItemId = 0; function _QuestieTooltips:AddItemDataToTooltip()