Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Join the Playtest on Steam Now: SpiritVale

Module:GamePassives: Difference between revisions

From SpiritVale Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 55: Line 55:
row:tag("th"):wikitext(label):done()
row:tag("th"):wikitext(label):done()
row:tag("td"):wikitext(value):done()
row:tag("td"):wikitext(value):done()
end
-- Tag section header rows as body rows too (for centering)
local function addSectionHeader(tbl, label)
local row = tbl:tag("tr")
row:addClass("spiritvale-passive-body-row")
local cell = row:tag("th")
cell:attr("colspan", 2)
cell:addClass("spiritvale-infobox-section-header")
cell:wikitext(label)
end
end


Line 109: Line 98:
return nil
return nil
end
end
local parts = {}
local parts = {}
if block.Base ~= nil then
if block.Base ~= nil then
table.insert(parts, string.format("Base %s", tostring(block.Base)))
table.insert(parts, string.format("Base %s", tostring(block.Base)))
Line 116: Line 107:
table.insert(parts, string.format("%s / Lv", tostring(block["Per Level"])))
table.insert(parts, string.format("%s / Lv", tostring(block["Per Level"])))
end
end
if #parts == 0 then
if #parts == 0 then
return nil
return nil
end
end
return table.concat(parts, ", ")
return table.concat(parts, ", ")
end
end
Line 149: Line 142:


-- Optional qualifiers (weapon/stance/etc.), if present in data
-- Optional qualifiers (weapon/stance/etc.), if present in data
local qual = eff.Weapon or eff["Weapon"] or eff["Weapon Type"]
local qual =
or eff.Stance or eff["Stance"] or eff["Stance Type"]
eff.Weapon or eff["Weapon"] or eff["Weapon Type"] or
eff.Stance or eff["Stance"] or eff["Stance Type"]


if type(qual) == "string" and qual ~= "" then
if type(qual) == "string" and qual ~= "" then
Line 179: Line 173:
local detail = {}
local detail = {}


local dur = s.Duration
if type(s.Duration) == "table" then
if type(dur) == "table" then
local t = formatBasePer(s.Duration)
local t = formatBasePer(dur)
if t then
if t then
table.insert(detail, "Duration " .. t)
table.insert(detail, "Duration " .. t)
Line 187: Line 180:
end
end


local ch = s.Chance
if type(s.Chance) == "table" then
if type(ch) == "table" then
local t = formatBasePer(s.Chance)
local t = formatBasePer(ch)
if t then
if t then
table.insert(detail, "Chance " .. t)
table.insert(detail, "Chance " .. t)
Line 221: Line 213:
local names = r["Status Name"]
local names = r["Status Name"]
local label
local label
if type(names) == "table" then
if type(names) == "table" then
label = table.concat(names, ", ")
label = table.concat(names, ", ")
Line 231: Line 224:
local bp = formatBasePer(r)
local bp = formatBasePer(r)
local seg = label
local seg = label
if bp then
if bp then
seg = seg .. " – " .. bp
seg = seg .. " – " .. bp
end
end
table.insert(parts, seg)
table.insert(parts, seg)
end
end
Line 247: Line 242:


local parts = {}
local parts = {}
for _, ev in ipairs(list) do
for _, ev in ipairs(list) do
if type(ev) == "table" then
if type(ev) == "table" then
Line 269: Line 265:
return
return
end
end
local flags = {}
local flags = {}
for k, v in pairs(sub) do
for k, v in pairs(sub) do
Line 275: Line 272:
end
end
end
end
table.sort(flags)
table.sort(flags)
if #flags > 0 then
if #flags > 0 then
table.insert(parts, string.format("%s: %s", label, table.concat(flags, ", ")))
table.insert(parts, string.format("%s: %s", label, table.concat(flags, ", ")))
Line 379: Line 378:
-- General
-- General
------------------------------------------------------------------
------------------------------------------------------------------
addSectionHeader(root, "General")
addRow(root, "Max Level", rec["Max Level"] and tostring(rec["Max Level"]))
addRow(root, "Max Level", rec["Max Level"] and tostring(rec["Max Level"]))


Line 395: Line 393:
or (req["Required Weapons"] and #req["Required Weapons"] > 0)
or (req["Required Weapons"] and #req["Required Weapons"] > 0)
or (req["Required Stances"] and #req["Required Stances"] > 0) then
or (req["Required Stances"] and #req["Required Stances"] > 0) then
addSectionHeader(root, "Requirements")


if type(req["Required Skills"]) == "table" and #req["Required Skills"] > 0 then
if type(req["Required Skills"]) == "table" and #req["Required Skills"] > 0 then
Line 402: Line 398:
for _, rs in ipairs(req["Required Skills"]) do
for _, rs in ipairs(req["Required Skills"]) do
local sname = rs["Skill Name"] or rs["Skill ID"] or "Unknown"
local sname = rs["Skill Name"] or rs["Skill ID"] or "Unknown"
local level = rs["Required Level"]
local rlv  = rs["Required Level"]
if level then
if rlv then
table.insert(skillParts, string.format("%s (Lv.%s)", sname, level))
table.insert(skillParts, string.format("%s (Lv.%s)", sname, rlv))
else
else
table.insert(skillParts, sname)
table.insert(skillParts, sname)
Line 420: Line 416:
------------------------------------------------------------------
------------------------------------------------------------------
local peRows = passiveEffectRows(rec["Passive Effects"])
local peRows = passiveEffectRows(rec["Passive Effects"])
if #peRows > 0 then
for _, r in ipairs(peRows) do
addSectionHeader(root, "Passive Effects")
addRow(root, r.label, r.value)
for _, r in ipairs(peRows) do
addRow(root, r.label, r.value)
end
end
end


Line 433: Line 426:
local statusRem  = formatStatusRemoval(rec["Status Removal"])
local statusRem  = formatStatusRemoval(rec["Status Removal"])
if statusApps or statusRem then
if statusApps or statusRem then
addSectionHeader(root, "Status Effects")
addRow(root, "Applies", statusApps)
addRow(root, "Applies", statusApps)
addRow(root, "Removes", statusRem)
addRow(root, "Removes", statusRem)
Line 443: Line 435:
local modsText = formatModifiers(rec.Modifiers)
local modsText = formatModifiers(rec.Modifiers)
if modsText then
if modsText then
addSectionHeader(root, "Modifiers")
addRow(root, "Flags", modsText)
addRow(root, "Flags", modsText)
end
end
Line 452: Line 443:
local eventsText = formatEvents(rec.Events)
local eventsText = formatEvents(rec.Events)
if eventsText then
if eventsText then
addSectionHeader(root, "Events")
addRow(root, "Triggers", eventsText)
addRow(root, "Triggers", eventsText)
end
end
Line 460: Line 450:
------------------------------------------------------------------
------------------------------------------------------------------
if type(rec.Notes) == "table" and #rec.Notes > 0 then
if type(rec.Notes) == "table" and #rec.Notes > 0 then
addSectionHeader(root, "Notes")
addRow(root, "Notes", asUl(rec.Notes) or table.concat(rec.Notes, "<br />"))
addRow(root, "Notes", asUl(rec.Notes) or table.concat(rec.Notes, "<br />"))
end
end