diff --git a/FlightFinder/FlightFinder.lua b/FlightFinder/FlightFinder.lua index f000e11..4733f4e 100644 --- a/FlightFinder/FlightFinder.lua +++ b/FlightFinder/FlightFinder.lua @@ -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() diff --git a/README.md b/README.md index 8adf84a..fbd0e4a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Each addon works on its own, so copy only the ones you want. Vendor Flag and Que - Its minimap markers skip quests started by an item, and quests with profession or reputation requirements. - Quest Shopping List's prices are Auctionator's last-seen prices, so run "Search all" for current ones. Rewards count gold plus item value, not XP. - Ship Routes' dock names and the list of which paths are transports are curated by hand in `ShipRoutes/tools/generate.py`, because the client doesn't record which ship sails which path. Lanes between continents follow hand-placed sea waypoints there too, since the ships teleport mid-ocean. The Zephras Isle airships have no line, since the island isn't on the world map, and they have no known faction, so they show in neutral gold. -- Flight Finder learns which flight points you have from the map and from flight masters' taxi maps. If a zone's map doesn't list them, open any flight master once and the rest fill in. +- Flight Finder learns which flight points you have only from a flight master's taxi map, since Forever's map lists every flight point as known. Until you talk to any flight master once on a character, every flight point shows. - Fish Key finds Fishing on Blizzard's action bars, `CLICK` bindings to addon buttons, and spell or macro bindings. It doesn't see bar addons that bind keys through their own override bindings, such as Bartender. While you fish it raises the interact range to 30 yards, so a closer NPC or object can be picked over the bobber. ## Tests diff --git a/tests/test_ff.lua b/tests/test_ff.lua index 9b7186e..50f84f0 100644 --- a/tests/test_ff.lua +++ b/tests/test_ff.lua @@ -158,10 +158,12 @@ check(show(1432)[8], "Thelsamar on Loch Modan") check(not show(1434)[18], "Horde Booty Bay hidden for Alliance") check(show(1434)[19], "Alliance Booty Bay shown") --- the map API knows Menethil: no marker, and it's remembered for the continent map -apiKnown[1437] = { 7 } -check(not show(1437)[7], "known Menethil not marked") +-- Forever's map API lists every node as discovered: it must not teach anything +apiKnown[1437] = { 7, 8, 6 } +check(show(1437)[7], "map API doesn't mark Menethil known") apiKnown[1437] = nil +FlightFinderCharDB.known[7] = true +check(not show(1437)[7], "known Menethil not marked") check(not show(1415)[7], "Menethil stays known on the continent map") check(show(1415)[8], "Thelsamar still marked on the continent map") -- city node shows on its zone and on the city map inside it