Flight Finder: learn only from taxi maps, drop debug log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-12 15:19:52 +00:00
parent 62c016d672
commit 46fd5cb8a9
3 changed files with 15 additions and 57 deletions

View file

@ -1,9 +1,9 @@
-- Flight Finder: marks the flight masters you haven't discovered yet on zone and continent
-- maps. Flight master positions are in Data.lua (generated from the client's TaxiNodes.db2).
--
-- A flight point counts as discovered when Blizzard's map API lists it as discovered for its
-- zone, or when a flight master's taxi map showed it as a destination. Both are remembered
-- per character, so continent maps and zones you haven't opened yet stay right.
-- A flight point counts as discovered once a flight master's taxi map showed it as a
-- destination; that's remembered per character. Blizzard's C_TaxiMap.GetTaxiNodesForMap is
-- no use in Forever: it lists every node in the continent, both factions, as discovered.
local addonName, ns = ...
local PREFIX = "|cff66bbffFlight Finder|r: "
@ -16,7 +16,7 @@ local COLORS = {
}
local SAME_PLACE = 400 -- yards: flight masters with one name this close count as one place
local db, known, log
local db, known
local function Visible(id)
local f = ns.nodes[id][4]
@ -157,9 +157,6 @@ local function Zone(id, continent)
cached = info.mapID
end
zones[key] = cached
if log then
log.zone[id] = cached or "none"
end
end
return cached or nil
end
@ -182,33 +179,6 @@ end
-- Learning which flight points the character has
---------------------------------------------------------------------------
-- Blizzard's own map list for a zone; learns its discovered nodes
local function LearnZone(uiMapID)
if not (C_TaxiMap and C_TaxiMap.GetTaxiNodesForMap) then
return
end
local ok, list = pcall(C_TaxiMap.GetTaxiNodesForMap, uiMapID)
if ok and type(list) == "table" then
-- diagnostic: what the client returns, saved for inspection
local rows = {}
for _, info in ipairs(list) do
local row = {}
for k, v in pairs(info) do
if k ~= "position" then
row[k] = tostring(v)
end
end
rows[#rows + 1] = row
end
log.map[uiMapID] = rows
for _, info in ipairs(list) do
if info.nodeID and not info.isUndiscovered then
known[info.nodeID] = true
end
end
end
end
-- a flight master's taxi map lists the faction's nodes on the continent. Forever marks the
-- ones not discovered yet as DISTANT (Blizzard's frame hides those), so only CURRENT and
-- REACHABLE count as known.
@ -217,10 +187,6 @@ local function LearnTaxiMap()
if not (NumTaxiNodes and TaxiNodeName and TaxiNodeGetType) then
return
end
log.taxi = {}
for i = 1, NumTaxiNodes() do
log.taxi[i] = tostring(TaxiNodeName(i)) .. " = " .. tostring(TaxiNodeGetType(i))
end
for i = 1, NumTaxiNodes() do
if HAVE[TaxiNodeGetType(i)] then
for _, id in ipairs(byName[TaxiNodeName(i)] or {}) do
@ -261,20 +227,11 @@ function provider:RefreshAllData()
if not info or not SHOWN_ON[info.mapType] then
return
end
local learned = {}
for id in pairs(ns.nodes) do
if Visible(id) and Leader(id) then
if Visible(id) and Leader(id) and not Discovered(id) then
local u, v = Place(mapID, info.mapType, id)
if u then
local continent = Continent(mapID)
local zone = continent and Zone(id, continent)
if zone and not learned[zone] then
learned[zone] = true
LearnZone(zone)
end
if not Discovered(id) then
map:AcquirePin(TEMPLATE, id):SetPosition(u, v)
end
map:AcquirePin(TEMPLATE, id):SetPosition(u, v)
end
end
end
@ -383,12 +340,11 @@ frame:SetScript("OnEvent", function(_, event, name)
elseif name == addonName then
FlightFinderDB = FlightFinderDB or {}
FlightFinderCharDB = FlightFinderCharDB or {}
if FlightFinderCharDB.version ~= 3 then
FlightFinderCharDB = { version = 3 } -- older versions learned every node as known
if FlightFinderCharDB.version ~= 4 then
FlightFinderCharDB = { version = 4 } -- older versions learned nodes the character lacks
end
FlightFinderCharDB.known = FlightFinderCharDB.known or {}
FlightFinderCharDB.log = { map = {}, zone = {} }
db, known, log = FlightFinderDB, FlightFinderCharDB.known, FlightFinderCharDB.log
db, known = FlightFinderDB, FlightFinderCharDB.known
Attach()
elseif name == "Blizzard_WorldMap" then
Attach()