DungeonPreQuest: mark talk-only steps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d98cf3392c
commit
801608e066
3 changed files with 87 additions and 23 deletions
|
|
@ -103,10 +103,13 @@ for k, v in pairs(modules) do
|
|||
end
|
||||
|
||||
local WANT = { "name", "questLevel", "requiredRaces", "requiredClasses", "preQuestGroup", "preQuestSingle",
|
||||
"zoneOrSort", "nextQuestInChain", "breadcrumbForQuestId", "breadcrumbs", "objectives", "specialFlags" }
|
||||
"zoneOrSort", "nextQuestInChain", "breadcrumbForQuestId", "breadcrumbs", "objectives", "triggerEnd", "finishedBy", "specialFlags" }
|
||||
local wanted = {}
|
||||
for _, n in ipairs(WANT) do wanted[realKeys[n]] = true end
|
||||
|
||||
-- These hold one list per kind of thing, and an edit can skip a kind.
|
||||
local grouped = { [realKeys.objectives] = true, [realKeys.finishedBy] = true }
|
||||
|
||||
local function contains(list, v) for _, x in ipairs(list) do if x == v then return true end end return false end
|
||||
|
||||
local changed = {}
|
||||
|
|
@ -120,7 +123,15 @@ local function apply(id, fixes)
|
|||
else sets[k] = v end
|
||||
end
|
||||
for k, v in pairs(removes) do
|
||||
if wanted[k] and type(row[k]) == "table" and type(v) == "table" then
|
||||
if grouped[k] and type(row[k]) == "table" and type(v) == "table" then
|
||||
for g, list in pairs(v) do
|
||||
if type(row[k][g]) == "table" then
|
||||
local kept = {}
|
||||
for _, x in ipairs(row[k][g]) do if not contains(list, x) then kept[#kept + 1] = x end end
|
||||
row[k][g] = kept
|
||||
end
|
||||
end
|
||||
elseif wanted[k] and type(row[k]) == "table" and type(v) == "table" then
|
||||
local kept = {}
|
||||
for _, x in ipairs(row[k]) do if not contains(v, x) then kept[#kept + 1] = x end end
|
||||
row[k] = kept
|
||||
|
|
@ -128,7 +139,15 @@ local function apply(id, fixes)
|
|||
end
|
||||
for k, v in pairs(sets) do row[k] = v end
|
||||
for k, v in pairs(adds) do
|
||||
if wanted[k] and type(v) == "table" then
|
||||
if grouped[k] and type(v) == "table" then
|
||||
row[k] = type(row[k]) == "table" and row[k] or {}
|
||||
for g, list in pairs(v) do
|
||||
row[k][g] = row[k][g] or {}
|
||||
for _, x in ipairs(list) do
|
||||
if not contains(row[k][g], x) then table.insert(row[k][g], x) end
|
||||
end
|
||||
end
|
||||
elseif wanted[k] and type(v) == "table" then
|
||||
row[k] = type(row[k]) == "table" and row[k] or {}
|
||||
for _, x in ipairs(v) do if not contains(row[k], x) then table.insert(row[k], x) end end
|
||||
end
|
||||
|
|
@ -212,8 +231,17 @@ table.sort(ids)
|
|||
for _, id in ipairs(ids) do
|
||||
local r = q[id]
|
||||
out:write("[", id, "]={")
|
||||
-- A quest handed in at an object means going there, usually inside the dungeon.
|
||||
local endsAtObject = type(r.finishedBy) == "table" and type(r.finishedBy[2]) == "table" and next(r.finishedBy[2]) ~= nil
|
||||
local hasWork = r.triggerEnd ~= nil or endsAtObject
|
||||
if type(r.objectives) == "table" then
|
||||
for _, group in pairs(r.objectives) do
|
||||
if type(group) == "table" and next(group) ~= nil then hasWork = true end
|
||||
end
|
||||
end
|
||||
if hasWork then out:write("hasWork=true,") end
|
||||
for _, n in ipairs(WANT) do
|
||||
if r[n] ~= nil and n ~= "objectives" then out:write(n, "=", ser(r[n]), ",") end
|
||||
if r[n] ~= nil and n ~= "objectives" and n ~= "triggerEnd" and n ~= "finishedBy" then out:write(n, "=", ser(r[n]), ",") end
|
||||
end
|
||||
out:write("},\n")
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue