diff --git a/CodexPathMap.lua b/CodexPathMap.lua index a45a0d4..b690505 100644 --- a/CodexPathMap.lua +++ b/CodexPathMap.lua @@ -193,9 +193,17 @@ function PM.Compute(mapID) local world = WorldOfMap(mapID) local cells = world and Path.Cells(world) local map + res.world, res.fit, res.ncells = world, "none", 0 if cells and next(cells) then + for _ in pairs(cells) do res.ncells = res.ncells + 1 end res.swap = DetectSwap(world, cells, mapID) - map = Fit(world, cells, mapID, res.swap) or FitFromMap(world, mapID, res.swap) + map = Fit(world, cells, mapID, res.swap) + if map then + res.fit = "cells" + else + map = FitFromMap(world, mapID, res.swap) + if map then res.fit = "map" end + end end local bins = {} local function Bin(x, y, kind, w) @@ -552,5 +560,30 @@ function PM.Toggle(mapID) if PM.on then PM.Hide() else PM.Show(mapID) end end +-- /fwwege diag: Diagnose fuer die Karte, die gerade angezeigt wird (warum ist das Wegenetz leer?) +function PM.Diag() + local CM = _G.C_Map + local mapID = CurrentMapID() + FW:Print("Wegenetz-Diagnose: Karte " .. tostring(mapID)) + if not mapID then return end + local info = CM and CM.GetMapInfo and select(2, pcall(CM.GetMapInfo, mapID)) + FW:Print("Name: " .. tostring(type(info) == "table" and info.name or "?") .. ", Eltern-Karte: " .. tostring(type(info) == "table" and info.parentMapID or "?")) + local ok, cont, wp = false, nil, nil + if CM and CM.GetWorldPosFromMapPos then ok, cont, wp = pcall(CM.GetWorldPosFromMapPos, mapID, Vec(0.5, 0.5)) end + local vx, vy + if ok and wp and wp.GetXY then vx, vy = wp:GetXY() end + FW:Print(string.format("Kartenmitte in Weltkoordinaten: ok=%s, Welt=%s, x=%s, y=%s", tostring(ok), tostring(cont), tostring(vx), tostring(vy))) + local res = PM.Compute(mapID) + if not res then FW:Print("Compute: nil") return end + FW:Print(string.format("Welt %s, Zellen der Welt: %d, gespeicherte Achsen-Vertauschung: %s, benutzt: %s", + tostring(res.world), res.ncells or 0, tostring(Codex.db.settings.pathSwap), tostring(res.swap))) + FW:Print(string.format("Umrechnung: %s (cells = aus Zellen, map = aus Kartenmitte, none = keine)", tostring(res.fit))) + local c = res.counts + FW:Print(string.format("Punkte auf dieser Karte: eigene %d, fremde %d, Beute %d, Uebergaenge %d, Luecken %d, Orte %d", + c.w or 0, c.r or 0, c.d or 0, c.x or 0, c.g or 0, c.s or 0)) +end + SLASH_FREEWOODPATHMAP1 = "/fwwege" -SlashCmdList["FREEWOODPATHMAP"] = function() PM.Toggle() end +SlashCmdList["FREEWOODPATHMAP"] = function(msg) + if type(msg) == "string" and msg:lower():match("^%s*diag") then PM.Diag() else PM.Toggle() end +end diff --git a/Freewood-OctoWoW-Codex.toc b/Freewood-OctoWoW-Codex.toc index 6ad1ae9..e192d1c 100644 --- a/Freewood-OctoWoW-Codex.toc +++ b/Freewood-OctoWoW-Codex.toc @@ -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.141 +## Version: 0.1.142 ## Dependencies: Freewood-OctoWoW-Core ## OptionalDeps: Freewood-OctoWoW-CodexData, Freewood-OctoWoW-ForeverData