From acac6ace6f59cb2085b43cd67369953655c9db76 Mon Sep 17 00:00:00 2001 From: DuvelCorp Date: Mon, 14 Sep 2026 18:38:10 +0200 Subject: [PATCH] NPC Finder: fix zone-ID mislabel and show all zones per NPC - Translate the coord's WMA id to pfQuest before the MTH_DS_Zones parent lookup, so e.g. Feralas (WMA 121) no longer collides with pfQ 121 (Raven Hill) and prints its parent 'Duskwood' - Zone column now lists every distinct zone an NPC occupies, smallest-map first, so border/capital NPCs read 'Darnassus, Teldrassil' etc. (sort key matches) --- CHANGELOG.md | 9 ++++-- api/hunterbook-tab-npcfinder.lua | 51 ++++++++++++++++++++++++++++++-- api/hunterbook.lua | 4 +-- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6a36a4..13ee57f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ Resurrecting on Octowow. ### Added -- **SmartAmmo — low-ammo alerts**: SmartAmmo can now monitors the total matching arrows or bullets in your bags and equipped slot: Enable the option, choose a warning threshold (default: 200), and MetaHunt will ouput a chat and centered-screen alert when you cross it. Sarcasms are always enabled ofc. +- **SmartAmmo — low-ammo alerts**: SmartAmmo can now monitor the total matching arrows or bullets in your bags and equipped slot: Enable the option, choose a warning threshold (default: 200), and MetaHunt will ouput a chat and centered-screen alert when you cross it. Sarcasms are always enabled ofc. -- **New spell datastore**: Metahunt now have a datastore of all twow 1.18.1 hunter and pet spells. And you can browse them with new pages in the Book. +- **New spell datastore**: Metahunt now ships a datastore of all twow 1.18.1 hunter and pet spells. You can browse them with new pages in the Book. - **Trainer cost planning**: Added shared Hunter and Pet Trainer spell cost planning for spells available now, at the next training level, and still remaining. @@ -37,8 +37,13 @@ Resurrecting on Octowow. - **Web database links**: All links in the data that were pointing on old Turtle WoW DB have been replaced to point on the OctoWoW DB. +- **Addon's code repository change**: The addon repo is now hosted on Codeberg and the "update available" link will point on the new location. + + ### Fixed +- **NPC Finder — zone accuracy**: Fixed NPCs that could show a wrong zone (e.g. Feathermoon vendors in Feralas were labelled "Duskwood") caused by a zone-ID mix-up. NPCs that stand on a zone border or in a capital city now list **all** the zones they appear on, most precise first — e.g. "Darnassus, Teldrassil" or "Alterac, Hilsbrad". + - **zCraft — profession ranks**: zCraft now refreshes after learning a profession rank, without requiring a UI reload. - **Tooltips — your pet's info showing on other players**: In a party, mousing over or targeting another player could wrongly show YOUR pet's details (mood, loyalty, happiness, XP) on their tooltip. The own-pet detection no longer misfires on other units. diff --git a/api/hunterbook-tab-npcfinder.lua b/api/hunterbook-tab-npcfinder.lua index 0a00c5a..aac056f 100644 --- a/api/hunterbook-tab-npcfinder.lua +++ b/api/hunterbook-tab-npcfinder.lua @@ -69,8 +69,14 @@ local function MTH_BOOKTAB_GetZoneAndSubzone(zoneId) local zid = tonumber(zoneId) if not zid then return "-", "-" end local zoneName = MTH_BOOK_GetZoneName(zid) - local row = MTH_DS_Zones and (MTH_DS_Zones[zid] or MTH_DS_Zones[tostring(zid)]) - if row and row.parent and tonumber(row.parent) and tonumber(row.parent) ~= zid then + -- Coord zone IDs are WMA; MTH_DS_Zones is keyed by pfQuest area IDs. Translate + -- first, or WMA 121 (Feralas) collides with pfQ 121 (Raven Hill -> parent Duskwood). + local pfqId = zid + if type(MTH_MAP_WMA_TO_PFQ) == "table" then + pfqId = MTH_MAP_WMA_TO_PFQ[zid] or zid + end + local row = MTH_DS_Zones and (MTH_DS_Zones[pfqId] or MTH_DS_Zones[tostring(pfqId)]) + if row and row.parent and tonumber(row.parent) and tonumber(row.parent) ~= pfqId then local parentName = MTH_BOOK_GetZoneName(row.parent) if parentName and string.sub(parentName, 1, 5) ~= "Zone " then return parentName, zoneName @@ -105,6 +111,47 @@ function MTH_BOOKTAB_GetNPCZoneSummary(vendor) end MTH_BOOK_GetNPCZoneSummary = MTH_BOOKTAB_GetNPCZoneSummary +-- Zone column text: every distinct zone the NPC sits in, most-specific (smallest +-- map) first, so multi-location NPCs read e.g. "Darnassus, Teldrassil". +function MTH_BOOKTAB_GetNPCZoneDisplay(vendor) + if not vendor or not vendor.coords or table.getn(vendor.coords) == 0 then + return "-" + end + local seen = {} + local list = {} + for i = 1, table.getn(vendor.coords) do + local c = vendor.coords[i] + if c and c[3] then + local zoneName = MTH_BOOK_GetZoneName(c[3]) + if zoneName and zoneName ~= "-" and not seen[zoneName] then + seen[zoneName] = true + local area = nil + local size = MTH_DS_MinimapSizes and (MTH_DS_MinimapSizes[tonumber(c[3])] or MTH_DS_MinimapSizes[c[3]]) + if type(size) == "table" and tonumber(size[1]) and tonumber(size[2]) then + area = tonumber(size[1]) * tonumber(size[2]) + end + table.insert(list, { name = zoneName, area = area, order = i }) + end + end + end + local count = table.getn(list) + if count == 0 then return "-" end + -- Smallest map first; zones with no known size keep data order, at the end. + table.sort(list, function(x, y) + if x.area and y.area then + if x.area ~= y.area then return x.area < y.area end + return x.order < y.order + end + if x.area then return true end + if y.area then return false end + return x.order < y.order + end) + local names = {} + for i = 1, count do table.insert(names, list[i].name) end + return table.concat(names, ", ") +end +MTH_BOOK_GetNPCZoneDisplay = MTH_BOOKTAB_GetNPCZoneDisplay + function MTH_BOOK_NPCHasZoneId(vendor, zoneId) local zid = tonumber(zoneId) if not zid or not vendor or not vendor.coords then diff --git a/api/hunterbook.lua b/api/hunterbook.lua index 2eec678..9f4c3b5 100644 --- a/api/hunterbook.lua +++ b/api/hunterbook.lua @@ -1518,7 +1518,7 @@ local function MTH_BOOK_GetSortKey(entry, col) if not npc then return nil end local react = MTH_BOOK_GetNPCReactBucket(npc.fac) local functionSummary = MTH_BOOK_GetNPCFunctionSummary(npc) - local zoneName = MTH_BOOK_GetNPCZoneSummary(npc) + local zoneName = (type(MTH_BOOK_GetNPCZoneDisplay) == "function" and MTH_BOOK_GetNPCZoneDisplay(npc)) or MTH_BOOK_GetNPCZoneSummary(npc) if col == 1 then return tonumber(entry) or 0 end if col == 2 then local npcName = (MTH and MTH.GetLocalizedNPCNameById and MTH:GetLocalizedNPCNameById(entry, npc.name)) or npc.name @@ -4333,7 +4333,7 @@ local function MTH_BOOK_GetRowValues(entry) if not vendor then return { "", "", "", "", "" } end local react = MTH_BOOK_GetNPCReactBucket(vendor.fac) local functionSummary = MTH_BOOK_GetNPCFunctionSummary(vendor) - local zoneName = MTH_BOOK_GetNPCZoneSummary(vendor) + local zoneName = (type(MTH_BOOK_GetNPCZoneDisplay) == "function" and MTH_BOOK_GetNPCZoneDisplay(vendor)) or MTH_BOOK_GetNPCZoneSummary(vendor) local vendorName = (MTH and MTH.GetLocalizedNPCNameById and MTH:GetLocalizedNPCNameById(entry, vendor.name)) or vendor.name return { "|cFF33CCFF" .. tostring(entry) .. "|r",