WARFRAME Wiki
Advertisement
WARFRAME Wiki

Documentation for this module may be created at Module:Warframes/infobox/doc

--	<nowiki>
local WarframeData = mw.loadData([[Module:Warframes/data]])
local ConclaveData = mw.loadData([[Module:Warframes/Conclave/data]])

local Math = require([[Module:Math]])
local Polarity = require([[Module:Polarity]])
local Tooltip = require([[Module:Tooltips]])
local Version = require([[Module:Version]])
local InfoboxBuilder = require([[Module:InfoboxBuilder]])
local Lang = mw.language.new('en')	-- Using for number formatting

local function override(arg)
	return arg and arg..'[[Category:InfoboxOverride]]'
end

return {
buildInfobox = function(frame)
	local args = frame.args
	local name = args['Name']
	local warframe = nil

	if args['Conclave'] == 'false' then
		warframe = WarframeData.Warframes[name] or WarframeData.Archwings[name] or
				WarframeData.Necramechs[name] or WarframeData.Operators[name]
	else
		warframe = ConclaveData.Warframes[name]
	end
	
	assert(warframe ~= nil, 'p.buildInfobox(frame): Missing "'..name..'" entry in [[Module:Warframes/data]]')
	
	local SquadPortrait = ''
	if warframe['SquadPortrait'] ~= nil then
		SquadPortrait = '[[File:'..warframe['SquadPortrait']..'|x40px]] '
	end
	
	local imageGallery = {}
	for label, fileName in pairs(warframe.FullImages) do
		table.insert(imageGallery, fileName..'|'..label)
	end
	table.insert(imageGallery, warframe.Image..'|In-Game Menus')
	imageGallery = table.concat(imageGallery, '\n')
	
	local compatibilityTags = {}
	for _, tag in ipairs(warframe.CompatibilityTags or {}) do
		table.insert(compatibilityTags, tag)
	end
	compatibilityTags = table.concat(compatibilityTags, ', ')
	
	local Infobox = InfoboxBuilder('WARFRAME Wiki:L10n/general.json', 'WARFRAME Wiki:L10n/warframes.json', 'WARFRAME Wiki:L10n/meta.json')
		:tag('title')
			:tag('default')
				:wikitext(SquadPortrait)
				:tag('b'):wikitext(name..'[[Category:'..name..']][[Category:'..warframe.Type..'s]]'):done()
			:done()
		:done()
		:tag('image'):attr('source', 'Image')
			:tag('default')
				:tag('gallery'):wikitext(imageGallery):done()
			:done()
		:done()
		:group()
			:caption('CodexSecret', warframe.CodexSecret and '[[Codex|%s]][[Category:Codex Secret]]' or nil, 'codex-secret')
			:caption('UpdateInfoboxData', '[[Module:Warframes/data|📝 %s]]', 'update-infobox-data')
		:done()
		
		:group():header('%s', 'description')
			:caption('Description', warframe.Description and warframe.Description)
		:done()
		
		:group():header('%s', 'passive')
			:caption('Passive', warframe.Passive and warframe.Passive)
		:done()
		
		:group():header('%s', 'abilities')
			:row('Ability1', '%s', Tooltip.full(warframe.Abilities[1], 'Ability'), 'first-ability')
			:row('Ability2', '%s', Tooltip.full(warframe.Abilities[2], 'Ability'), 'second-ability')
			:row('Ability3', '%s', Tooltip.full(warframe.Abilities[3], 'Ability'), 'third-ability')
			:row('Ability4', '%s', Tooltip.full(warframe.Abilities[4], 'Ability'), 'fourth-ability')
		:done()
		
		:group():header('%s', 'general-information')
			:row('Sex', '%s', warframe.Sex and (name ~= 'Xaku' and warframe.Sex..'[[Category:'..warframe.Sex..'s]]' or warframe.Sex..'[[Category:'..warframe.Sex..']]'), 'sex')
			:row('Mastery', '[[Mastery Rank|%s]]', warframe.Mastery or '0', 'mastery-rank')
			:row('MaxRank', '%s', warframe.MaxRank, 'max-rank')
			:row('Health', '[[Health|%s]]', warframe.Health and warframe.Health..' ('..(warframe.HealthRank30 or warframe.Health+100)..' at Rank 30)', 'health')
			:row('Shield', '[[Shield|%s]]', warframe.Shield and warframe.Shield..' ('..(warframe.ShieldRank30 or warframe.Shield+100)..' at Rank 30)', 'shields')
			:row('Armor', '[[Armor|%s]]', warframe.ArmorRank30 and warframe.Armor..' ('..warframe.ArmorRank30..' at Rank 30)' or warframe.Armor, 'armor')
			:row('Energy', '[[Energy Capacity|%s]]', warframe.Energy and warframe.Energy..' ('..(warframe.EnergyRank30 or warframe.Energy+50)..' at Rank 30)', 'energy')
			:row('InitialEnergy', '[[Energy Capacity#Warframe Starting Energy|%s]]', warframe.InitialEnergy and warframe.InitialEnergy, 'initial-energy')
			:row('Sprint', '[[Sprint Speed|%s]]', Lang:formatNum(warframe.Sprint), 'sprint-speed')
			:row('Mobility', '[[Mobility|%s]]', warframe.Mobility and Lang:formatNum(warframe.Mobility), 'mobility')
			:row('Stamina', '%s', warframe.Stamina, 'stamina')
			:row('AuraPolarity', '[[Aura|%s]]', warframe.AuraPolarity and Polarity._polarity(warframe.AuraPolarity)  or 'None', 'aura-polarity')
			:row('ExilusPolarity', '[[Exilus Adapter|%s]]', warframe.ExilusPolarity and Polarity._polarity(warframe.ExilusPolarity)  or 'None', 'exilus-polarity')
			:row('Polarities', '[[Mods#Polarity|%s]]', Polarity._pols(warframe.Polarities), 'polarities')
			:row('Introduced', '%s', warframe.Introduced and Version._getVersionLink(warframe.Introduced)..Version._getVersionCategory(warframe.Introduced), 'introduced')
			:row('Themes', '%s', warframe.Themes, 'themes')
			:row('Progenitor', '[[Lich System#Progenitor Warframe|%s]]', warframe.Progenitor and Tooltip.full(warframe.Progenitor, 'DamageTypes'), 'progenitor-element')
			:row('Subsumed', '[[Helminth#Ability Replacement|%s]]', warframe.Subsumed and Tooltip.full(warframe.Subsumed, 'Ability'), 'subsumed-ability')
			:row('Tactical', '[[Railjack/Tactical Menu#Ability Kinesis|%s]]', warframe.Tactical and Tooltip.full(warframe.Tactical, 'Ability'), 'tactical-ability')
			:row('CompatibilityTags', '[[Compatibility Tag|%s]]', warframe.CompatibilityTags and compatibilityTags, 'compatibility-tags')
			:row('SellPrice', '%s', warframe.SellPrice and (Tooltip.icon('Credits', 'Resources')..' '..Lang:formatNum(warframe.SellPrice)), 'sell-price')
		:done()
		:group():header('%s', 'official-drop-tables')
			:caption('official-drop-tables', 'https://www.warframe.com/droptables', 'official-drop-tables')
		:done()
	:done()

	return frame:preprocess(tostring(Infobox))
end
}
Advertisement