Module:ItemSacrifices
Jump to navigation
Jump to search
Documentation
No documentation subpage exists yet for this module. Create one now.
local getData = require('Module:Iteminfo').getItemStat
local info = require('Module:Iteminfo').info
local tr = require('Module:Tr')
local unused = require('Module:Iteminfo/idSets').getIdSet('Unused')
local na
local no_item
local lang
local l10n_info = {
["en"] = {
["id"] = "ID",
["item"] = "Item",
["research"] = "Research",
["deprecated"] = "(Deprecated)",
},
["ru"] = {
["item"] = "Предмет",
["research"] = "Исследование",
["deprecated"] = "(Отсутствует)"
},
["vi"] = {
["item"] = "Vật phẩm",
},
["zh"] = {
["id"] = "ID",
["item"] = "物品",
["research"] = "研究",
["deprecated"] = "(废案)",
}
}
local l10n_table
local function l10n(key)
return l10n_table[key] or l10n_info['en'][key] or ''
end
local replaceName = {
[115] = "Shadow Orb (item)",
[669] = "Fish (item)",
[989] = 'Enchanted Sword (item)',
[1435] = "The Destroyer (item)",
[1475] = "Darkness (Painting)",
[2436] = "Jellyfish (bait)",
[2437] = "Jellyfish (bait)",
[2438] = "Jellyfish (bait)",
[3062] = "Crimson Heart (item)",
[4633] = "Oasis (Painting)",
[4725] = "Graveyard (Painting)",
}
local function row(id)
local result = '<tr><td>' .. id .. '</td>'
local name = getData(id, 'name')
local sac = getData(id, 'sacrifices')
local linkName = ''
if unused[id] then
result = result .. '<td>' .. no_item .. '</td>' .. '<td>' .. na .. '</td></tr>'
else
linkName = replaceName[id] or name
if lang == 'en' then
result = result .. '<td>[[' .. linkName .. '|' .. name .. ']]</td>'
else
result = result .. '<td>[[' .. tr.translateLink(linkName, lang) .. '|' .. tr.translate(name, lang) .. ']]</td>'
end
result = result .. '<td>' .. (sac ~= 0 and sac or na) .. '</td></tr>'
end
return result
end
return {
main = function(frame)
lang = frame:expandTemplate{ title = 'lang' }
l10n_table = l10n_info[lang] or l10n_info['en']
na = frame:expandTemplate{ title = 'na' }
no_item = '<span style="display:none">~</span><i class="note-text">' .. l10n('deprecated') .. '</i>'
local result = { '<table class="terraria lined sortable">',
'<tr><th>' .. l10n('id') .. '</th><th>' .. l10n('item') .. '</th>' .. '<th>' .. l10n('research') .. '</th></tr>'
}
for i = info.IDs.min, info.IDs.max do
result[#result + 1] = row(i)
end
result[#result + 1] = '</table>'
return table.concat(result, '\n')
end,
}