Flight Finder: find zones via the continent map

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-12 15:17:56 +00:00
parent 5f6cdfe6b2
commit 62c016d672
2 changed files with 84 additions and 45 deletions

View file

@ -14,14 +14,14 @@ end
local RECTS = {
[1415] = { inst = 0, top = 7467, bottom = -16000, left = 16000, right = -19200, type = 2, parent = 947 },
[1414] = { inst = 1, top = 12800, bottom = -11733, left = 17067, right = -19733, type = 2, parent = 947 },
[1437] = { inst = 0, top = -1500, bottom = -4800, left = 200, right = -4800, type = 3, parent = 1415 }, -- Wetlands
[1437] = { inst = 0, top = -1500, bottom = -5600, left = 200, right = -4800, type = 3, parent = 1415 }, -- Wetlands (rect reaches over Thelsamar)
[1432] = { inst = 0, top = -4500, bottom = -6300, left = -1700, right = -4500, type = 3, parent = 1415 }, -- Loch Modan
[1426] = { inst = 0, top = -3400, bottom = -6600, left = 1500, right = -2500, type = 3, parent = 1415 }, -- Dun Morogh
[1426] = { inst = 0, top = -4200, bottom = -6600, left = 1500, right = -2500, type = 3, parent = 1415 }, -- Dun Morogh
[1455] = { inst = 0, top = -4500, bottom = -5200, left = -700, right = -1500, type = 3, parent = 1426 }, -- Ironforge
[1434] = { inst = 0, top = -11000, bottom = -15000, left = 2000, right = -2000, type = 3, parent = 1415 }, -- Stranglethorn
}
-- which zone the client puts a world point in: first matching rect among these, smallest first
local ZONES = { 1455, 1437, 1432, 1426, 1434 }
-- zones the continent map highlights, in hit-test order
local ZONES = { 1432, 1426, 1437, 1434 }
Enum = { UIMapType = { Cosmic = 0, World = 1, Continent = 2, Zone = 3, Dungeon = 4, Micro = 5 } }
function CreateVector2D(x, y)
@ -40,14 +40,21 @@ C_Map = {
if not r then return nil end
return r.inst, CreateVector2D(r.top + (r.bottom - r.top) * v.y, r.left + (r.right - r.left) * v.x)
end,
-- like Forever: only ever answers with the continent
GetMapPosFromWorldPos = function(inst, pos)
return inst == 0 and 1415 or 1414, CreateVector2D(0, 0)
end,
-- the zone under a continent map point, or the continent itself
GetMapInfoAtPosition = function(cont, u, v)
local c = RECTS[cont]
local x, y = c.top + (c.bottom - c.top) * v, c.left + (c.right - c.left) * u
for _, id in ipairs(ZONES) do
local r = RECTS[id]
if r.inst == inst and pos.x <= r.top and pos.x >= r.bottom and pos.y <= r.left and pos.y >= r.right then
return id, CreateVector2D(0, 0)
if r.parent == cont and r.inst == c.inst and x <= r.top and x >= r.bottom and y <= r.left and y >= r.right then
return { mapID = id, mapType = r.type, parentMapID = cont }
end
end
return inst == 0 and 1415 or 1414, CreateVector2D(0, 0)
return { mapID = cont, mapType = c.type, parentMapID = 947 }
end,
CanSetUserWaypointOnMap = function(id) return RECTS[id].type == 3 end,
SetUserWaypoint = function(p) waypoint = p end,
@ -157,8 +164,9 @@ check(not show(1437)[7], "known Menethil not marked")
apiKnown[1437] = nil
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 (Ironforge sits in Dun Morogh)
-- city node shows on its zone and on the city map inside it
check(show(1426)[6], "Ironforge marked on Dun Morogh")
check(show(1455)[6], "Ironforge marked on the Ironforge city map")
-- taxi map: Thelsamar reachable, Ironforge not yet discovered
taxi = { { "Thelsamar, Loch Modan", "REACHABLE" }, { "Ironforge, Dun Morogh", "DISTANT" } }