Module:ItemID
Aller à la navigation
Aller à la recherche
Documentation
Voir aussi la page anglaise du module : Module:ItemID. Elle pourra contenir des informations plus complètes et actuelles.
Aucune sous-page de documentation n'existe déjà pour ce module. En créer une maintenant.
local i18n = {
Id = 'ID',
Name = 'Nom',
InternalName = 'Nom interne',
Deprecated = '(Obsolète)',
}
local total = 5087 -- as in 1.4.1
local data={}
local unused = require('Module:Iteminfo/idSets').getIdSet('Unused')
local last = 0
local output = mw.html.create('table'):addClass('terraria sortable lined aligncenter')
local currentFrame
function printRow(row)
local itemid = tonumber(row.itemid)
if itemid > last + 1 then
for id = last+1, itemid-1 do
local tr = output:tag('tr')
tr:tag('td'):wikitext(id)
if unused[id] then
tr:tag('td'):attr('colspan', 3):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated)
else
local name = currentFrame:expandTemplate{title = 'itemNameFromId', args = {id, lang='en'}}
tr:tag('td'):wikitext(('[[%s]] (%s)'):format(currentFrame:expandTemplate{title = 'tr', args = {name}}, name))
tr:tag('td'):wikitext('???')
end
end
end
local tr = output:tag('tr')
tr:tag('td'):wikitext(itemid)
tr:tag('td'):wikitext(('[[%s|%s]] (%s)'):format(row.page, currentFrame:expandTemplate{title = 'tr', args = {row.name}}, row.name))
tr:tag('td'):wikitext(tostring(mw.html.create('code'):wikitext(row.internalname)))
last = itemid
end
return {
main=function(frame)
currentFrame = frame
local header = output:tag('tr')
header:tag('th'):wikitext(i18n.Id)
header:tag('th'):wikitext(i18n.Name)
header:tag('th'):wikitext(i18n.InternalName)
-- There are more than 5000 items now.
local result = mw.ext.cargo.query(
'Items',
'_pageName=page, itemid, name, imagefile, internalname',
{
groupBy = 'itemid',
orderBy = 'itemid',
where = 'itemid IS NOT NULL AND itemid <=4000 AND internalname <> "None" AND internalname <> "" ',
limit = 5000
}
)
for _, row in ipairs(result) do
printRow(row)
end
local result = mw.ext.cargo.query(
'Items',
'_pageName=page, itemid, name, imagefile , internalname',
{
groupBy = 'itemid',
orderBy = 'itemid',
where = 'itemid IS NOT NULL AND itemid > 4000 AND internalname <> "None" AND internalname <> "" ',
limit = 5000
}
)
for _, row in ipairs(result) do
printRow(row)
end
-- tails
for id = last+1, total do
local tr = output:tag('tr')
tr:tag('td'):wikitext(id)
if unused[id] then
tr:tag('td'):attr('colspan', 2):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated)
else
local name = currentFrame:expandTemplate{title = 'itemNameFromId', args = {id, lang='en'}}
tr:tag('td'):wikitext(('[[%s]] (%s)'):format(currentFrame:expandTemplate{title = 'tr', args = {name}}, name))
tr:tag('td'):wikitext('???')
end
end
return output
end,
}