Module:Sandbox/GauTest/Township: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 926: Line 926:
function p.GetWorshipTable()
function p.GetWorshipTable()
local function GetCheckpointCell(checkpoint)
local function GetCheckpointCell(checkpoint)
return '\r\n|-\r\n!'..checkpoint..'%<br>'..Icons.Icon({'Worship', type='township', notext=true})..' '..(checkpoint*Township.maxWorship)..'/'..Township.maxWorship
return '\r\n|-\r\n!'..Icons.Icon({'Worship', type='township', notext=true})..'<br>'..checkpoint..'%<br>'..(checkpoint*Township.maxWorship/100)..'/'..Township.maxWorship
end
end
Line 959: Line 959:
-- Total sum
-- Total sum
table.insert(ret, '\r\n|-\r\n!Total')
table.insert(ret, '\r\n|-\r\n!Total')
for i, checkpoint in ipairs(Township.worshipCheckpoints) do
for _, worship in ipairs(Township.worships) do
for _, worship in ipairs(Township.worships) do
if worship.isHidden == false then
if worship.isHidden == false then
local modifiers = Shared.clone(worship.modifiers)
local modifiers = Shared.clone(worship.modifiers)
for _, checkpoint in ipairs(worship.checkpoints) do
for _, checkpoint in ipairs(worship.checkpoints) do
for modifier, magnitude in pairs(checkpoint) do
for modifier, magnitude in pairs(checkpoint) do
if modifiers[modifier] == nil then
if modifiers[modifier] == nil then
modifiers[modifier] = magnitude
modifiers[modifier] = magnitude
else
else
modifiers[modifier] = modifiers[modifier] + magnitude
modifiers[modifier] = modifiers[modifier] + magnitude
end
end
end
end
end
572

edits