diff --git a/FlightFinder/FlightFinder.lua b/FlightFinder/FlightFinder.lua index ce8612c..9f8d110 100644 --- a/FlightFinder/FlightFinder.lua +++ b/FlightFinder/FlightFinder.lua @@ -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 +local db, known, log local function Visible(id) local f = ns.nodes[id][4] @@ -130,6 +130,9 @@ local function Chain(id) mapID = info.parentMapID end chains[id] = c + if log then + log.chain[id] = c.zone or (c.found and "no zone") or "not found" + end return c end @@ -157,6 +160,18 @@ local function LearnZone(uiMapID) 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 @@ -165,13 +180,20 @@ local function LearnZone(uiMapID) end end --- a flight master's taxi map lists every node on the continent; "NONE" ones aren't known yet +-- 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. +local HAVE = { CURRENT = true, REACHABLE = true } local function LearnTaxiMap() if not (NumTaxiNodes and TaxiNodeName and TaxiNodeGetType) then return end + log.taxi = {} for i = 1, NumTaxiNodes() do - if TaxiNodeGetType(i) ~= "NONE" then + 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 if Visible(id) then known[id] = true @@ -330,8 +352,12 @@ 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 + end FlightFinderCharDB.known = FlightFinderCharDB.known or {} - db, known = FlightFinderDB, FlightFinderCharDB.known + FlightFinderCharDB.log = { map = {}, chain = {} } + db, known, log = FlightFinderDB, FlightFinderCharDB.known, FlightFinderCharDB.log Attach() elseif name == "Blizzard_WorldMap" then Attach() diff --git a/tests/test_ff.lua b/tests/test_ff.lua index f198f55..bdc1642 100644 --- a/tests/test_ff.lua +++ b/tests/test_ff.lua @@ -161,10 +161,10 @@ check(show(1415)[8], "Thelsamar still marked on the continent map") check(show(1426)[6], "Ironforge marked on Dun Morogh") -- taxi map: Thelsamar reachable, Ironforge not yet discovered -taxi = { { "Thelsamar, Loch Modan", "REACHABLE" }, { "Ironforge, Dun Morogh", "NONE" } } +taxi = { { "Thelsamar, Loch Modan", "REACHABLE" }, { "Ironforge, Dun Morogh", "DISTANT" } } eventFrame.scripts.OnEvent(eventFrame, "TAXIMAP_OPENED") check(not show(1432)[8], "taxi map taught Thelsamar") -check(show(1426)[6], "NONE taxi node stays undiscovered") +check(show(1426)[6], "DISTANT taxi node stays undiscovered") -- same-named flight masters next to each other: one marker, known if either is faction = "Horde"