Flight Finder: DISTANT taxi nodes aren't known
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e070e5dfa5
commit
5f6cdfe6b2
2 changed files with 32 additions and 6 deletions
|
|
@ -16,7 +16,7 @@ local COLORS = {
|
||||||
}
|
}
|
||||||
local SAME_PLACE = 400 -- yards: flight masters with one name this close count as one place
|
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 function Visible(id)
|
||||||
local f = ns.nodes[id][4]
|
local f = ns.nodes[id][4]
|
||||||
|
|
@ -130,6 +130,9 @@ local function Chain(id)
|
||||||
mapID = info.parentMapID
|
mapID = info.parentMapID
|
||||||
end
|
end
|
||||||
chains[id] = c
|
chains[id] = c
|
||||||
|
if log then
|
||||||
|
log.chain[id] = c.zone or (c.found and "no zone") or "not found"
|
||||||
|
end
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -157,6 +160,18 @@ local function LearnZone(uiMapID)
|
||||||
end
|
end
|
||||||
local ok, list = pcall(C_TaxiMap.GetTaxiNodesForMap, uiMapID)
|
local ok, list = pcall(C_TaxiMap.GetTaxiNodesForMap, uiMapID)
|
||||||
if ok and type(list) == "table" then
|
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
|
for _, info in ipairs(list) do
|
||||||
if info.nodeID and not info.isUndiscovered then
|
if info.nodeID and not info.isUndiscovered then
|
||||||
known[info.nodeID] = true
|
known[info.nodeID] = true
|
||||||
|
|
@ -165,13 +180,20 @@ local function LearnZone(uiMapID)
|
||||||
end
|
end
|
||||||
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()
|
local function LearnTaxiMap()
|
||||||
if not (NumTaxiNodes and TaxiNodeName and TaxiNodeGetType) then
|
if not (NumTaxiNodes and TaxiNodeName and TaxiNodeGetType) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
log.taxi = {}
|
||||||
for i = 1, NumTaxiNodes() do
|
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
|
for _, id in ipairs(byName[TaxiNodeName(i)] or {}) do
|
||||||
if Visible(id) then
|
if Visible(id) then
|
||||||
known[id] = true
|
known[id] = true
|
||||||
|
|
@ -330,8 +352,12 @@ frame:SetScript("OnEvent", function(_, event, name)
|
||||||
elseif name == addonName then
|
elseif name == addonName then
|
||||||
FlightFinderDB = FlightFinderDB or {}
|
FlightFinderDB = FlightFinderDB or {}
|
||||||
FlightFinderCharDB = FlightFinderCharDB 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 {}
|
FlightFinderCharDB.known = FlightFinderCharDB.known or {}
|
||||||
db, known = FlightFinderDB, FlightFinderCharDB.known
|
FlightFinderCharDB.log = { map = {}, chain = {} }
|
||||||
|
db, known, log = FlightFinderDB, FlightFinderCharDB.known, FlightFinderCharDB.log
|
||||||
Attach()
|
Attach()
|
||||||
elseif name == "Blizzard_WorldMap" then
|
elseif name == "Blizzard_WorldMap" then
|
||||||
Attach()
|
Attach()
|
||||||
|
|
|
||||||
|
|
@ -161,10 +161,10 @@ check(show(1415)[8], "Thelsamar still marked on the continent map")
|
||||||
check(show(1426)[6], "Ironforge marked on Dun Morogh")
|
check(show(1426)[6], "Ironforge marked on Dun Morogh")
|
||||||
|
|
||||||
-- taxi map: Thelsamar reachable, Ironforge not yet discovered
|
-- 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")
|
eventFrame.scripts.OnEvent(eventFrame, "TAXIMAP_OPENED")
|
||||||
check(not show(1432)[8], "taxi map taught Thelsamar")
|
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
|
-- same-named flight masters next to each other: one marker, known if either is
|
||||||
faction = "Horde"
|
faction = "Horde"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue