DungeonPreQuest: minimap markers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-10 13:28:44 +00:00
parent d873b7f6fa
commit ef6cb6ab60
13 changed files with 2682 additions and 7 deletions

View file

@ -157,3 +157,76 @@ local function show(id)
print(id, q[id] and q[id].name, table.concat(list, " | "))
end
for _, id in ipairs({ 65, 155, 166, 8928, 8916, 94501 }) do show(id) end
-- Quest giver locations and the rules for when each quest can be picked up.
-- Quests whose requirements the addon can't check get no marker.
if arg[3] then
local UNSUPPORTED = { "requiredSkill", "requiredMinRep", "requiredMaxRep", "requiredSpell", "requiredSpecialization",
"requiredRanks", "availableUntilCompleted", "availableStartingWith", "disabledByQuest", "parentQuest", "requiredMaxLevel" }
local MAX_SPAWNS = 20
local function isRepeatable(r) return r.specialFlags and r.specialFlags % 2 == 1 end
local function unsupported(r)
if isRepeatable(r) then return true end
for _, field in ipairs(UNSUPPORTED) do
local v = r[field]
if v ~= nil and v ~= 0 then return true end
end
return false
end
local function addSpawns(flat, source, list)
for _, id in ipairs(list or {}) do
for zone, coords in pairs(source[id] or {}) do
local map = data.areaToMap[zone]
if map then
for _, c in ipairs(coords) do
if c[1] and c[1] > 0 and c[2] and c[2] > 0 and #flat < MAX_SPAWNS * 3 then
flat[#flat + 1] = map
flat[#flat + 1] = string.format("%.4f", c[1] / 100)
flat[#flat + 1] = string.format("%.4f", c[2] / 100)
end
end
end
end
end
end
local function list(t)
if type(t) ~= "table" or #t == 0 then return "nil" end
return "{" .. table.concat(t, ",") .. "}"
end
local stats = { pinned = 0, unsupported = 0, noPlace = 0 }
local pinOut = assert(io.open(arg[3], "w"))
pinOut:write("-- Generated from QuestieDB's Forever data. Do not edit.\n")
pinOut:write("local _, ns = ...\n\nns.raceBits = {")
local races = {}
for race in pairs(data.raceBits) do races[#races + 1] = race end
table.sort(races)
for _, race in ipairs(races) do pinOut:write("[", race, "]=", string.format("%.0f", data.raceBits[race]), ",") end
pinOut:write("}\n\nns.pinQuests = {\n")
for _, id in ipairs(ids) do
local r = q[id]
if unsupported(r) then
stats.unsupported = stats.unsupported + 1
else
local flat = {}
local starters = type(r.startedBy) == "table" and r.startedBy or {}
addSpawns(flat, data.npcs, starters[1])
addSpawns(flat, data.objects, starters[2])
if #flat == 0 then
stats.noPlace = stats.noPlace + 1
else
stats.pinned = stats.pinned + 1
pinOut:write(string.format("[%d]={n=%q,l=%d,r=%.0f,c=%d,p=%s,g=%s,x=%s,nx=%d,b=%d,s={%s}},\n",
id, r.name or "?", r.requiredLevel or 0, r.requiredRaces or 0, r.requiredClasses or 0,
list(r.preQuestSingle), list(r.preQuestGroup), list(r.exclusiveTo),
r.nextQuestInChain or 0, r.breadcrumbForQuestId or 0, table.concat(flat, ",")))
end
end
end
pinOut:write("}\n")
pinOut:close()
print("markers", stats.pinned, "skipped: requirements", stats.unsupported, "no location", stats.noPlace)
end