Module:SoulUnlock: Difference between revisions

Sur (talk | contribs)
m write_table data centered
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local p = {}
local p = {}
local util_module = require('Module:Utilities')
local util_module = require('Module:Utilities')
local dictionary_module = require('Module:Dictionary')
local soul_unlocks_data = mw.loadJsonData("Data:SoulUnlockData.json")
local soul_unlocks_data = mw.loadJsonData("Data:SoulUnlockData.json")
local localization_map = {
local localization_map = {
Line 76: Line 77:
ret = ret .. "Index" .. i .. ": "
ret = ret .. "Index" .. i .. ": "
for key, value in pairs(data) do
for key, value in pairs(data) do
ret = ret .. string.format("  %s:%s, ", p.localize(key), value)
local display_value = value
--Add 600
                if key == "RequiredSouls" then
                display_value = display_value + 600
                end
            ret = ret .. string.format("  %s:%s, ", p.localize(key), display_value)
end
end
ret = ret .. '<br>'
ret = ret .. '<br>'
Line 97: Line 103:
last_index = #accumulated_data
last_index = #accumulated_data
last_value = accumulated_data[last_index][soul_unlock_key]
last_value = accumulated_data[last_index][soul_unlock_key]
return last_value
    --Add 600
    if soul_unlock_key == "RequiredSouls" then
        return last_value + 600
        else
        return last_value
        end
end
end


Line 117: Line 128:
local tr = ''
local tr = ''
tr = tr .. '<th>' .. '' .. '</th>'
tr = tr .. '<th>' .. '' .. '</th>'
tr = tr .. '<th colspan="3">' .. 'Individual' .. '</th>'
tr = tr .. '<th colspan="3">' .. dictionary_module.translate('Individual') .. '</th>'
tr = tr .. '<th colspan="3">' .. 'Accumulative' .. '</th>'
tr = tr .. '<th colspan="3">' .. dictionary_module.translate('Accumulative') .. '</th>'
ret = ret .. '<tr>' .. tr .. '</tr>'
ret = ret .. '<tr>' .. tr .. '</tr>'
Line 138: Line 149:
-- Retrieve souls agg_record
-- Retrieve souls agg_record
local required_souls = agg_record['RequiredSouls']
local required_souls = agg_record['RequiredSouls']
local souls_str = '{{Souls|' .. required_souls .. '}}'
--Add 600
local souls_str = '{{Souls|' .. (required_souls + 600) .. '}}'
tr = tr .. '<td>' .. souls_str .. '</td>'
tr = tr .. '<td>' .. souls_str .. '</td>'