mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Codex.git
synced 2026-11-03 00:56:55 +00:00
0.1.220: Flugkarte offen: bestes Direktziel des Spiels waehlen (automatisch fliegen)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e1b89f4843
commit
0c5ef961c0
@@ -377,6 +377,51 @@ function Taxi.Edges()
|
||||
return list
|
||||
end
|
||||
|
||||
-- Ort eines Flugpunkts (m, x, y und/oder cs) fuer die Wegrechnung; nil, wenn unbekannt
|
||||
function Taxi.Point(id)
|
||||
local nd = Taxi.Node(id)
|
||||
if not nd then return nil end
|
||||
local seed = Taxi.Seed
|
||||
return EndPoint(nd, seed and seed.n[nd.n])
|
||||
end
|
||||
|
||||
-- Geschaetzte Flugzeit (Sekunden) von Flugpunkt a nach b (ids): gemessen, sonst kuerzester Weg im mitgelieferten Netz
|
||||
-- (ueber Zwischenstationen; das Spiel fliegt sie ohne Halt). nil, wenn nichts bekannt.
|
||||
local estCache = {}
|
||||
function Taxi.EstimateSecs(a, b)
|
||||
if a == b then return 0 end
|
||||
local routes = Taxi.Routes()
|
||||
local r = routes[a .. ">" .. b] or routes[b .. ">" .. a]
|
||||
if r and r.t then return r.t end
|
||||
local na, nb = Taxi.Node(a), Taxi.Node(b)
|
||||
local seed = Taxi.Seed
|
||||
if not (na and nb and na.n and nb.n and seed) then return nil end
|
||||
local c = estCache[na.n]
|
||||
if not c or c.rev ~= Taxi.rev then
|
||||
local adj = {}
|
||||
for _, e in ipairs(seed.e) do
|
||||
adj[e[1]] = adj[e[1]] or {}
|
||||
adj[e[1]][#adj[e[1]] + 1] = { e[2], e[3] }
|
||||
end
|
||||
local dist, done = { [na.n] = 0 }, {}
|
||||
while true do
|
||||
local cur, cd
|
||||
for k, d in pairs(dist) do
|
||||
if not done[k] and (not cd or d < cd) then cur, cd = k, d end
|
||||
end
|
||||
if not cur then break end
|
||||
done[cur] = true
|
||||
for _, e in ipairs(adj[cur] or {}) do
|
||||
local nd = cd + e[2]
|
||||
if not dist[e[1]] or nd < dist[e[1]] then dist[e[1]] = nd end
|
||||
end
|
||||
end
|
||||
c = { rev = Taxi.rev, dist = dist }
|
||||
estCache[na.n] = c
|
||||
end
|
||||
return c.dist[nb.n]
|
||||
end
|
||||
|
||||
function Taxi.ClearRemote()
|
||||
local db = Codex.db
|
||||
if db then db.taxir, db.taxin = nil, nil end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Notes: Learns quests, creatures and drops while you play: who gives and takes a quest, rewards, objectives, drop chances.
|
||||
## Notes-deDE: Lernt beim Spielen Quests, Kreaturen und Beute: wer eine Quest vergibt und annimmt, Belohnungen, Ziele, Drop-Chancen.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.219
|
||||
## Version: 0.1.220
|
||||
## Dependencies: Freewood-OctoWoW-Core
|
||||
## SavedVariablesPerCharacter: FreewoodSnapshot
|
||||
## OptionalDeps: Freewood-OctoWoW-CodexData, Freewood-OctoWoW-ForeverData
|
||||
|
||||
Reference in New Issue
Block a user