Module:ListOfPossibleModifiers

--- l10n info -- local l10n_info = { ['en'] = { ['th_image'] = 'Image', ['th_name'] = 'Name', ['th_Large'] = 'Large', ['th_Massive'] = 'Massive', ['th_Dangerous'] = 'Dangerous', ['th_Savage'] = 'Savage', ['th_Sharp'] = 'Sharp', ['th_Pointy'] = 'Pointy', ['th_Tiny'] = 'Tiny', ['th_Terrible'] = 'Terrible', ['th_Small'] = 'Small', ['th_Dull'] = 'Dull', ['th_Unhappy'] = 'Unhappy', ['th_Bulky'] = 'Bulky', ['th_Shameful'] = 'Shameful', ['th_Heavy'] = 'Heavy', ['th_Light'] = 'Light', ['th_Sighted'] = 'Sighted', ['th_Rapid'] = 'Rapid', ['th_Hasty'] = 'Hasty', ['th_Intimidating'] = 'Intimidating', ['th_Deadly_ref'] = 'Ranged weapons variant', ['th_Staunch'] = 'Staunch', ['th_Awful'] = 'Awful', ['th_Lethargic'] = 'Lethargic', ['th_Awkward'] = 'Awkward', ['th_Powerful'] = 'Powerful', ['th_Mystic'] = 'Mystic', ['th_Adept'] = 'Adept', ['th_Masterful'] = 'Masterful', ['th_Inept'] = 'Inept', ['th_Ignorant'] = 'Ignorant', ['th_Deranged'] = 'Deranged', ['th_Intense'] = 'Intense', ['th_Taboo'] = 'Taboo', ['th_Celestial'] = 'Celestial', ['th_Furious'] = 'Furious', ['th_Keen'] = 'Keen', ['th_Superior'] = 'Superior', ['th_Forceful'] = 'Forceful', ['th_Broken'] = 'Broken', ['th_Damaged'] = 'Damaged', ['th_Shoddy'] = 'Shoddy', ['th_Quick'] = 'Quick', ['th_Deadly'] = 'Deadly', ['th_Agile'] = 'Agile', ['th_Nimble'] = 'Nimble', ['th_Murderous'] = 'Murderous', ['th_Slow'] = 'Slow', ['th_Sluggish'] = 'Sluggish', ['th_Lazy'] = 'Lazy', ['th_Annoying'] = 'Annoying', ['th_Nasty'] = 'Nasty', ['th_Manic'] = 'Manic', ['th_Hurtful'] = 'Hurtful', ['th_Strong'] = 'Strong', ['th_Unpleasant'] = 'Unpleasant', ['th_Weak'] = 'Weak', ['th_Ruthless'] = 'Ruthless', ['th_Frenzying'] = 'Frenzying', ['th_Godly'] = 'Godly', ['th_Demonic'] = 'Demonic', ['th_Zealous'] = 'Zealous', ['th_Legendary'] = 'Legendary', ['th_Unreal'] = 'Unreal', ['th_Mythical'] = 'Mythical', ['th_Legendary_ref'] = 'Terrarian variant',

}, }

--- The following is not related to l10n. --

local getPossibleModifiers = require('Module:Possible modifiers').getPossibleModifiers

local currentFrame local lang local l10n_table

local table_output = mw.html.create('table'):addClass('terraria sortable align-center')

local template_yes local template_no

local count = 84 -- total number of modifiers

local l10n = function(key) return l10n_table[key] or l10n_info['en'][key] end

local function createHeader local header = table_output:tag('tr') local headercell = header:tag('th') headercell:addClass('unsortable') headercell:wikitext(l10n('th_image')) header:tag('th'):wikitext(l10n('th_name')) header:tag('th'):tag('small'):wikitext(l10n('th_Large')) header:tag('th'):tag('small'):wikitext(l10n('th_Massive')) header:tag('th'):tag('small'):wikitext(l10n('th_Dangerous')) header:tag('th'):tag('small'):wikitext(l10n('th_Savage')) header:tag('th'):tag('small'):wikitext(l10n('th_Sharp')) header:tag('th'):tag('small'):wikitext(l10n('th_Pointy')) header:tag('th'):tag('small'):wikitext(l10n('th_Tiny')) header:tag('th'):tag('small'):wikitext(l10n('th_Terrible')) header:tag('th'):tag('small'):wikitext(l10n('th_Small')) header:tag('th'):tag('small'):wikitext(l10n('th_Dull')) header:tag('th'):tag('small'):wikitext(l10n('th_Unhappy')) header:tag('th'):tag('small'):wikitext(l10n('th_Bulky')) header:tag('th'):tag('small'):wikitext(l10n('th_Shameful')) header:tag('th'):tag('small'):wikitext(l10n('th_Heavy')) header:tag('th'):tag('small'):wikitext(l10n('th_Light')) header:tag('th'):tag('small'):wikitext(l10n('th_Sighted')) header:tag('th'):tag('small'):wikitext(l10n('th_Rapid')) header:tag('th'):tag('small'):wikitext(l10n('th_Hasty')) header:tag('th'):tag('small'):wikitext(l10n('th_Intimidating')) header:tag('th'):tag('small'):wikitext(l10n('th_Deadly')):tag('ref'):wikitext(l10n('th_Deadly_ref')) header:tag('th'):tag('small'):wikitext(l10n('th_Staunch')) header:tag('th'):tag('small'):wikitext(l10n('th_Awful')) header:tag('th'):tag('small'):wikitext(l10n('th_Lethargic')) header:tag('th'):tag('small'):wikitext(l10n('th_Awkward')) header:tag('th'):tag('small'):wikitext(l10n('th_Powerful')) header:tag('th'):tag('small'):wikitext(l10n('th_Mystic')) header:tag('th'):tag('small'):wikitext(l10n('th_Adept')) header:tag('th'):tag('small'):wikitext(l10n('th_Masterful')) header:tag('th'):tag('small'):wikitext(l10n('th_Inept')) header:tag('th'):tag('small'):wikitext(l10n('th_Ignorant')) header:tag('th'):tag('small'):wikitext(l10n('th_Deranged')) header:tag('th'):tag('small'):wikitext(l10n('th_Intense')) header:tag('th'):tag('small'):wikitext(l10n('th_Taboo')) header:tag('th'):tag('small'):wikitext(l10n('th_Celestial')) header:tag('th'):tag('small'):wikitext(l10n('th_Furious')) header:tag('th'):tag('small'):wikitext(l10n('th_Keen')) header:tag('th'):tag('small'):wikitext(l10n('th_Superior')) header:tag('th'):tag('small'):wikitext(l10n('th_Forceful')) header:tag('th'):tag('small'):wikitext(l10n('th_Broken')) header:tag('th'):tag('small'):wikitext(l10n('th_Damaged')) header:tag('th'):tag('small'):wikitext(l10n('th_Shoddy')) header:tag('th'):tag('small'):wikitext(l10n('th_Quick')) header:tag('th'):tag('small'):wikitext(l10n('th_Deadly')) header:tag('th'):tag('small'):wikitext(l10n('th_Agile')) header:tag('th'):tag('small'):wikitext(l10n('th_Nimble')) header:tag('th'):tag('small'):wikitext(l10n('th_Murderous')) header:tag('th'):tag('small'):wikitext(l10n('th_Slow')) header:tag('th'):tag('small'):wikitext(l10n('th_Sluggish')) header:tag('th'):tag('small'):wikitext(l10n('th_Lazy')) header:tag('th'):tag('small'):wikitext(l10n('th_Annoying')) header:tag('th'):tag('small'):wikitext(l10n('th_Nasty')) header:tag('th'):tag('small'):wikitext(l10n('th_Manic')) header:tag('th'):tag('small'):wikitext(l10n('th_Hurtful')) header:tag('th'):tag('small'):wikitext(l10n('th_Strong')) header:tag('th'):tag('small'):wikitext(l10n('th_Unpleasant')) header:tag('th'):tag('small'):wikitext(l10n('th_Weak')) header:tag('th'):tag('small'):wikitext(l10n('th_Ruthless')) header:tag('th'):tag('small'):wikitext(l10n('th_Frenzying')) header:tag('th'):tag('small'):wikitext(l10n('th_Godly')) header:tag('th'):tag('small'):wikitext(l10n('th_Demonic')) header:tag('th'):tag('small'):wikitext(l10n('th_Zealous')) header:tag('th'):tag('small'):wikitext(l10n('th_Legendary')) header:tag('th'):tag('small'):wikitext(l10n('th_Unreal')) header:tag('th'):tag('small'):wikitext(l10n('th_Mythical')) header:tag('th'):tag('small'):wikitext(l10n('th_Legendary')):tag('ref'):wikitext(l10n('th_Legendary_ref'))

return end

local function getPossibleModifiersSet(itemid) -- prepare set local pm_set = {} for i=0, count do		pm_set[i] = false end -- fill set local pm_table = getPossibleModifiers(itemid) for _, modifierid in ipairs(pm_table) do		pm_set[modifierid] = true end return pm_set end

local function printRow(rowData) local row = table_output:tag('tr') row:tag('td'):wikitext(rowData.image) local rowcell = row:tag('td') rowcell:attr('align', 'left') rowcell:wikitext(currentFrame:expandTemplate{ title = 'eil', args = { rowData.name, small = 'n' } }) possible_modifiers = getPossibleModifiersSet(rowData.itemid) for i=0, count do		if i 80 then -- skip accessory modifiers local rowcell = row:tag('td') if possible_modifiers[i] then rowcell:wikitext(template_yes) else rowcell:wikitext(template_no) end end end end

- -- main return object return {

go = function(frame) -- init cache currentFrame = frame lang = frame.args['lang'] or frame:expandTemplate{ title='lang' } l10n_table = l10n_info[lang] or l10n_info['en'] template_yes = currentFrame:expandTemplate{ title = 'yes', args = {} } template_no = currentFrame:expandTemplate{ title = 'no', args = {} } createHeader -- There are more than 5000 items now. local result = mw.ext.cargo.query(		'Items',		'itemid, name, image',		{			groupBy = 'itemid',			orderBy = 'itemid',			where = 'itemid IS NOT NULL AND itemid <= 4000 AND unobtainable IS NULL AND type HOLDS "weapon" OR listcat HOLDS "weapon items" ',			limit = 50		}	) for _, row in ipairs(result) do		printRow(row) end -- local result = mw.ext.cargo.query(		'Items',		'itemid, name, image',		{			groupBy = 'itemid',			orderBy = 'itemid',			where = 'itemid IS NOT NULL AND itemid > 4000 AND unobtainable IS NULL AND type HOLDS "weapon" OR listcat HOLDS "weapon items" ',			limit = 5000		}	)	for _, row in ipairs(result) do		printRow(row)	end return output

end, }