WARFRAME Wiki
Advertisement
WARFRAME Wiki

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

--	<nowiki>
local Math = require([[Module:Math]])
local Polarity = require([[Module:Polarity]])

local function makeDTooltip(dt)
	return string.format('<span class="tooltip" data-param="%s" data-param2="DamageTypes">[[File:Dmg%sSmall64.png|x19px]]&nbsp;<span style="border-bottom:1px dotted;">[[%s]]</span></span>',
		dt, dt, dt
	)
end

local function makeATooltip(ability)
	return string.format('<span class="tooltip" data-param="%s" data-param2="Ability">[[File:%s130xDark.png|x19px]]&nbsp;<span style="border-bottom:1px dotted;">[[%s]]</span></span>',
		ability, ability:gsub(' ', ''), ability
	)
end

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 = {}

	if args['Conclave'] == 'false' then
		warframe = mw.loadData([[Module:Warframes/data]]).Warframes[name];
	else
		warframe = mw.loadData([[Module:Warframes/Conclave/data]]).Warframes[name];
	end

	local infobox = mw.html.create('infobox')
		:tag('title')
			:tag('default')
				:tag('b'):wikitext(name..'[[Category:'..name..']]'):done()
			:done()
		:done()
		:tag('image'):attr('source', 'Image')
			:tag('default'):wikitext(warframe.Image or 'Panel.png'):done()
		:done()
		:tag('data'):attr('source', 'Sex')
			:tag('label'):wikitext('Sex'):done()
			:tag('default'):wikitext(warframe.Sex and (name ~= 'Xaku' and warframe.Sex..'[[Category:'..warframe.Sex..'s]]' or warframe.Sex..'[[Category:'..warframe.Sex..']]')):done()
		:done()
		:tag('data'):attr('source', 'Mastery')
			:tag('label'):wikitext('[[Mastery Rank]]'):done()
			:tag('default'):wikitext(warframe.Mastery or '0'):done()
		:done()
		:tag('data'):attr('source', 'Health')
			:tag('label'):wikitext('[[Health]]'):done()
			:tag('default'):wikitext(warframe.Health and warframe.Health..' ('..(warframe.HealthRank30 or warframe.Health*3)..' at R30)'):done()
		:done()
		:tag('data'):attr('source', 'Shield')
			:tag('label'):wikitext('[[Shield]]'):done()
			:tag('default'):wikitext(warframe.Shield and warframe.Shield..' ('..(warframe.ShieldRank30 or warframe.Shield*3)..' at R30)'):done()
		:done()
		:tag('data'):attr('source', 'Armor')
			:tag('label'):wikitext('[[Armor]]'):done()
			:tag('default'):wikitext(warframe.ArmorRank30 and warframe.Armor..' ('..warframe.ArmorRank30..' at R30)' or warframe.Armor):done()
		:done()
		:tag('data'):attr('source', 'Energy')
			:tag('label'):wikitext('[[Energy Capacity|Energy]]'):done()
			:tag('default'):wikitext(warframe.Energy and warframe.Energy..' ('..(warframe.EnergyRank30 or Math.round(warframe.Energy*1.5, 0.1))..' at R30)'):done()
		:done()
		:tag('data'):attr('source', 'Sprint')
			:tag('label'):wikitext('[[Sprint Speed]]'):done()
			:tag('default'):wikitext(warframe.Sprint):done()
		:done()
		:tag('data'):attr('source', 'Mobility')
			:tag('label'):wikitext('Mobility'):done()
			:tag('default'):wikitext(warframe.Mobility):done()
		:done()
		:tag('data'):attr('source', 'AuraPolarity')
			:tag('label'):wikitext('[[Aura|Aura Polarity]]'):done()
			:tag('default'):wikitext(warframe.AuraPolarity and Polarity._polarity(warframe.AuraPolarity)  or 'None'):done()
		:done()
		:tag('data'):attr('source', 'ExilusPolarity')
			:tag('label'):wikitext('[[Exilus Adapter|Exilus Polarity]]'):done()
			:tag('default'):wikitext(warframe.ExilusPolarity and Polarity._polarity(warframe.ExilusPolarity)  or 'None'):done()
		:done()
		:tag('data'):attr('source', 'Polarities')
			:tag('label'):wikitext('[[Mods#Polarity|Polarities]]'):done()
			:tag('default'):wikitext(Polarity._pols(warframe.Polarities)):done()
		:done()
		:tag('data'):attr('source', 'Introduced')
			:tag('label'):wikitext('Introduced'):done()
			:tag('default'):wikitext(warframe.Introduced and '{{ver|'..warframe.Introduced..'}}'):done()
		:done()
		:tag('data'):attr('source', 'Themes')
			:tag('label'):wikitext('Themes'):done()
			:tag('default'):wikitext(warframe.Themes):done()
		:done()
		:tag('data'):attr('source', 'Progenitor')
			:tag('label'):wikitext('[[Kuva Lich#Progenitor Warframe|Progenitor]] Element'):done()
			:tag('default'):wikitext(warframe.Progenitor and makeDTooltip(warframe.Progenitor)):done()
		:done()
		:tag('data'):attr('source', 'Subsumed')
			:tag('label'):wikitext('[[Helminth#Ability Replacement|Subsumed Ability]]'):done()
			:tag('default'):wikitext(warframe.Subsumed and makeATooltip(warframe.Subsumed)):done()
		:done()

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