WARFRAME Wiki

Read about the future of the Fandom platform and the WARFRAME wiki! Any feedback would be appreciated! User blog:Cephalon Scientia/2022 Fandom Community Connect. - 06:11, 6 June 2022 (UTC)

READ MORE

WARFRAME Wiki
Advertisement
WARFRAME Wiki

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

--	<nowiki>
local Table = require([[Module:Table]])
local DropTable = require([[Module:DropTables]])
local InfoboxBuilder = require([[Module:InfoboxBuilder]])
local ArcaneData = mw.loadData([[Module:Arcane/data]])
local DropData = mw.loadData([[Module:DropTables/data]])
local Lang = mw.language.new('en')

-- Trading tax for Rank 0 Arcanes
local TAX_MAP = {
	Common = 2000,
	Uncommon = 4000,
	Rare = 8000,
	Legendary = 100000,
}

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

return {
buildInfobox = function(frame)
	local args = frame.args;
	local name = mw.text.decode(args['Name'])
	local arcaneData = ArcaneData.Arcanes[name]
	assert(arcaneData ~= nil, 'buildInfobox(frame): "'..name..'" does not exist in [[Module:Arcane/data]]')
	
	local Infobox = InfoboxBuilder('MediaWiki:Custom-General/i18n.json')
		:tag('title')
			:tag('default')
				:tag('b'):wikitext(name..'[[Category:Arcane Enhancements]]'):done()
			:done()
		:done()
		:tag('image'):attr('source', 'Image')
			:tag('default'):wikitext(arcaneData.Image or 'Panel.png'):done()
		:done()
		:group()
			-- All Arcanes are tradable
			:caption('Tradable', '[[File:TradableIcon.png|x32px|class=icon dark-invert]] [[Trading|{{text|green|%s}}]]', 'tradable')
		:done()
		
		:group():header('%s', 'max-rank-description')
			:tag('data'):attr('source', 'Description')
				:tag('default')
					:tag('div'):css('text-align', 'center')
						:tag('b'):wikitext(arcaneData.Criteria..'<br />'..arcaneData.Description):done()
					:done()
				:done()
			:done()
		:done()

		:group():header('%s', 'general-information')
			:row('Type', '%s', arcaneData.Type..'[[Category:'..arcaneData.Type..' Arcanes]]', 'type')
			:row('Rarity', '%s', arcaneData.Rarity..'[[Category:'..arcaneData.Rarity..' Arcanes]]', 'rarity')
			:row('IsRefreshable', '%s', arcaneData.IsRefreshable and '✔️' or '❌', 'refreshable')
			:row('MaxRank', '%s', arcaneData.MaxRank or 'N/A', 'max-rank')
			:row('ArcaneMax', 'Arcanes Required to Max', ((arcaneData.MaxRank + 1) * (arcaneData.MaxRank + 2)) / 2)
			:row('TradingTax', '[[Trade System|%s]]', '[[File:Credits64.png|x20px|link=Credits]]&nbsp;'..Lang:formatNum(TAX_MAP[arcaneData.Rarity]), 'trading-tax')
			:row('Introduced', '%s', arcaneData.Introduced and '{{ver|'..arcaneData.Introduced..'}}[[Category:Update '..arcaneData.Introduced:sub(1, (string.find(arcaneData.Introduced, '%.') or 0) - 1)..']]', 'introduced')
			--:row('InternalName', '%s', arcaneData.InternalName and '<code>'..arcaneData.InternalName..'</code>' or nil, 'internal-name')
		:done()
	
	local missionStr, enemyStr = DropTable._buildDropTableSourceStrings(name)
	
	Infobox:group():header('%s', 'drop-table-sources')
		:tag('data'):attr('source', 'Drops')
			:tag('default')
				:tag('div'):addClass('tabber-borderless')
					:wikitext(('<tabber>%s%s</tabber>'):format(
					(missionStr ~= '') and '|-|Missions='..missionStr..'\n' or '',
					(enemyStr ~= '') and '|-|Enemies='..enemyStr..'\n' or ''
				)):done()
			:done()
		:done()
	:done()
	
	return frame:preprocess(tostring(Infobox))
end
}
Advertisement