模块:ListOfPossibleModifiers

来自Terraria Wiki
跳到导航 跳到搜索
亦可参看英文模块:Module:ListOfPossibleModifiers。那边可能有更完整或更正确的信息。

This module displays a table of all items and the modifiers they can receive. The data is generated automatically from Terraria's source code using {{possible modifiers}}.

It is used on List of possible modifiers.


------- 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',
	},

	['fr'] = {
		['th_image'] = 'Image',
		['th_name'] = 'Nom',
		['th_Large'] = 'Grand',
		['th_Massive'] = 'Massif',
		['th_Dangerous'] = 'Dangereux',
		['th_Savage'] = 'Sauvage',
		['th_Sharp'] = 'Aiguisé',
		['th_Pointy'] = 'Pointu',
		['th_Tiny'] = 'Minuscule',
		['th_Terrible'] = 'Terrible',
		['th_Small'] = 'Petit',
		['th_Dull'] = 'Terne',
		['th_Unhappy'] = 'Misérable',
		['th_Bulky'] = 'Mastoc',
		['th_Shameful'] = 'Coupable',
		['th_Heavy'] = 'Lourd',
		['th_Light'] = 'Léger',
		['th_Sighted'] = 'Voyant',
		['th_Rapid'] = 'Rapide',
		['th_Hasty'] = 'Hâtif',
		['th_Intimidating'] = 'Intimidant',
		['th_Deadly_ref'] = 'Variante d\'armes à distance',
		['th_Staunch'] = 'Fervent',
		['th_Awful'] = 'Atroce',
		['th_Lethargic'] = 'Léthargique',
		['th_Awkward'] = 'Gauche',
		['th_Powerful'] = 'Puissant',
		['th_Mystic'] = 'Mystique',
		['th_Adept'] = 'Adepte',
		['th_Masterful'] = 'Autoritaire',
		['th_Inept'] = 'Inepte',
		['th_Ignorant'] = 'Ignorant',
		['th_Deranged'] = 'Dérangé',
		['th_Intense'] = 'Intense',
		['th_Taboo'] = 'Tabou',
		['th_Celestial'] = 'Céleste',
		['th_Furious'] = 'Furieux',
		['th_Keen'] = 'Appliqué',
		['th_Superior'] = 'Supérieur',
		['th_Forceful'] = 'Énergique',
		['th_Broken'] = 'Cassé',
		['th_Damaged'] = 'Endommagé',
		['th_Shoddy'] = 'Exécrable',
		['th_Quick'] = 'Bref',
		['th_Deadly'] = 'Fatal',
		['th_Agile'] = 'Agile',
		['th_Nimble'] = 'Leste',
		['th_Murderous'] = 'Meurtrier',
		['th_Slow'] = 'Lent',
		['th_Sluggish'] = 'Apathique',
		['th_Lazy'] = 'Paresseux',
		['th_Annoying'] = 'Ennuyeux',
		['th_Nasty'] = 'Méchant',
		['th_Manic'] = 'Frénétique',
		['th_Hurtful'] = 'Offensant',
		['th_Strong'] = 'Fort',
		['th_Unpleasant'] = 'Désagréable',
		['th_Weak'] = 'Faible',
		['th_Ruthless'] = 'Impitoyable',
		['th_Frenzying'] = 'Déchaîné',
		['th_Godly'] = 'Divin',
		['th_Demonic'] = 'Démoniaque',
		['th_Zealous'] = 'Zélé',
		['th_Legendary'] = 'Légendaire',
		['th_Unreal'] = 'Irréel',
		['th_Mythical'] = 'Mythique',
		['th_Legendary_ref'] = 'Variante du Terrarien',
	},

	['pt'] = {
		['th_image'] = 'Imagem',
		['th_name'] = 'Nome',
		['th_Large'] = 'Grande',
		['th_Massive'] = 'Enorme',
		['th_Dangerous'] = 'Perigoso',
		['th_Savage'] = 'Bárbaro',
		['th_Sharp'] = 'Afiado',
		['th_Pointy'] = 'Pontudo',
		['th_Tiny'] = 'Minúsculo',
		['th_Terrible'] = 'Terrível',
		['th_Small'] = 'Pequeno',
		['th_Dull'] = 'Fraco',
		['th_Unhappy'] = 'Infeliz',
		['th_Bulky'] = 'Volumoso',
		['th_Shameful'] = 'Vergonhoso',
		['th_Heavy'] = 'Pesado',
		['th_Light'] = 'Luz',
		['th_Sighted'] = 'Visto',
		['th_Rapid'] = 'Acelerado',
		['th_Hasty'] = 'Rápido',
		['th_Intimidating'] = 'Intimidador',
		['th_Deadly_ref'] = 'Variante das armas de ataque à distância',
		['th_Staunch'] = 'Convicto',
		['th_Awful'] = 'Terrível',
		['th_Lethargic'] = 'Letárgico',
		['th_Awkward'] = 'Estranho',
		['th_Powerful'] = 'Poderoso',
		['th_Mystic'] = 'Místico',
		['th_Adept'] = 'Adepto',
		['th_Masterful'] = 'Mestre',
		['th_Inept'] = 'Incapaz',
		['th_Ignorant'] = 'Ignorante',
		['th_Deranged'] = 'Demente',
		['th_Intense'] = 'Intenso',
		['th_Taboo'] = 'Tabu',
		['th_Celestial'] = 'Celestial',
		['th_Furious'] = 'Furioso',
		['th_Keen'] = 'Disposto',
		['th_Superior'] = 'Superior',
		['th_Forceful'] = 'Vigoroso',
		['th_Broken'] = 'Quebrado',
		['th_Damaged'] = 'Danificado',
		['th_Shoddy'] = 'Pobre',
		['th_Quick'] = 'Rápido',
		['th_Deadly'] = 'Mortal',
		['th_Agile'] = 'Ágil',
		['th_Nimble'] = 'Ligeiro',
		['th_Murderous'] = 'Assassino',
		['th_Slow'] = 'Lento',
		['th_Sluggish'] = 'Vagaroso',
		['th_Lazy'] = 'Preguiçoso',
		['th_Annoying'] = 'Irritante',
		['th_Nasty'] = 'Nojento',
		['th_Manic'] = 'Maníaco',
		['th_Hurtful'] = 'Doloroso',
		['th_Strong'] = 'Forte',
		['th_Unpleasant'] = 'Desagradável',
		['th_Weak'] = 'Fraco',
		['th_Ruthless'] = 'Implacável',
		['th_Frenzying'] = 'Enlouquecedor',
		['th_Godly'] = 'Divino',
		['th_Demonic'] = 'Demoníaco',
		['th_Zealous'] = 'Zeloso',
		['th_Legendary'] = 'Lendário',
		['th_Unreal'] = 'Surreal',
		['th_Mythical'] = 'Mítico',
		['th_Legendary_ref'] = 'Variante do Terrariano',
	},
	['zh'] = {
		['th_image'] = '图像',
		['th_name'] = '名称',
		['th_Large'] = '大',
		['th_Massive'] = '巨大',
		['th_Dangerous'] = '危险',
		['th_Savage'] = '凶残',
		['th_Sharp'] = '锋利',
		['th_Pointy'] = '尖锐',
		['th_Tiny'] = '微小',
		['th_Terrible'] = '可怕',
		['th_Small'] = '小',
		['th_Dull'] = '钝',
		['th_Unhappy'] = '倒霉',
		['th_Bulky'] = '笨重',
		['th_Shameful'] = '可耻',
		['th_Heavy'] = '重',
		['th_Light'] = '轻',
		['th_Sighted'] = '精准',
		['th_Rapid'] = '迅速',
		['th_Hasty'] = '急速',
		['th_Intimidating'] = '恐怖',
		['th_Deadly_ref'] = '远程武器变体版本',
		['th_Staunch'] = '可靠',
		['th_Awful'] = '讨厌',
		['th_Lethargic'] = '无力',
		['th_Awkward'] = '粗笨',
		['th_Powerful'] = '强大',
		['th_Mystic'] = '神秘',
		['th_Adept'] = '精巧',
		['th_Masterful'] = '精湛',
		['th_Inept'] = '笨拙',
		['th_Ignorant'] = '无知',
		['th_Deranged'] = '错乱',
		['th_Intense'] = '威猛',
		['th_Taboo'] = '禁忌',
		['th_Celestial'] = '天界',
		['th_Furious'] = '狂怒',
		['th_Keen'] = '锐利',
		['th_Superior'] = '高端',
		['th_Forceful'] = '强力',
		['th_Broken'] = '碎裂',
		['th_Damaged'] = '破损',
		['th_Shoddy'] = '粗劣',
		['th_Quick'] = '迅捷',
		['th_Deadly'] = '致命',
		['th_Agile'] = '灵活',
		['th_Nimble'] = '灵巧',
		['th_Murderous'] = '残暴',
		['th_Slow'] = '缓慢',
		['th_Sluggish'] = '迟钝',
		['th_Lazy'] = '呆滞',
		['th_Annoying'] = '惹恼',
		['th_Nasty'] = '凶险',
		['th_Manic'] = '狂躁',
		['th_Hurtful'] = '致伤',
		['th_Strong'] = '强劲',
		['th_Unpleasant'] = '粗鲁',
		['th_Weak'] = '软弱',
		['th_Ruthless'] = '无情',
		['th_Frenzying'] = '暴怒',
		['th_Godly'] = '神级',
		['th_Demonic'] = '恶魔',
		['th_Zealous'] = '狂热',
		['th_Legendary'] = '传奇',
		['th_Unreal'] = '虚幻',
		['th_Mythical'] = '神话',
		['th_Legendary_ref'] = '泰拉悠悠球变体版本',
	},
}

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

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

local currentFrame
local lang
local l10n_table

local eicons = require('Module:Exclusive').simpleEicons

local table_output = mw.html.create('table'):addClass('terraria sortable align-center'):attr( 'id', 'possible-modifiers-table' )

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') .. currentFrame:extensionTag{ name = 'ref', content = l10n('th_Deadly_ref'), args = {} })
	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') .. currentFrame:extensionTag{ name = 'ref', content = l10n('th_Legendary_ref'), args = {} })

	return
end

local function getPossibleModifiersSet(itemid)
	-- prepare set
	local pm_set = {}
	for i=1, 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 = mw.html.create('tr')
	row:tag('td'):wikitext(rowData.image)
	
	local rowcell = row:tag('td')
	rowcell:attr('align', 'left')
	rowcell:wikitext(currentFrame:expandTemplate{ title = 'tr', args = { rowData.name } }..' '..eicons(rowData.name))
	
	local possible_modifiers = getPossibleModifiersSet(rowData.itemid)
	for i=1, count do
		if i < 62 or 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
	
	return tostring(row)
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']
	
	local cargolimit = frame.args['limit']
	
	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 = 'name',
			where = 'unobtainable IS NULL AND (type HOLDS "weapon" OR listcat HOLDS "weapon items") AND damagetype IS NOT NULL AND damagetype != "Throwing" AND internalname != "None" ',
			limit = cargolimit
		}
	)
	
	for _, row in ipairs(result) do
		table_output:wikitext(printRow(row))
	end
	
	-- prepend an empty node in order to be able to select for styling the div that is automatically created around the table by Extension:Crusher
	local prepend = mw.html.create('div'):attr( 'id', 'possible-modifiers-table-prepend' )

	return tostring(prepend) .. tostring(table_output)

end,
}