WARFRAME Wiki
Advertisement
WARFRAME Wiki

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

--	<nowiki>
local Table = require([[Module:Table]])
local Tooltip = require([[Module:Tooltips]])
local DropTable = require([[Module:DropTables]])
local Vendor = require([[Module:Vendors]])
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 incompatibilityTags = {}
	for _, tag in ipairs(arcaneData.IncompatibilityTags or {}) do
		table.insert(incompatibilityTags, tag)
	end
	incompatibilityTags = table.concat(incompatibilityTags, ', ')
	
	local Infobox = InfoboxBuilder('WARFRAME Wiki:L10n/general.json', 'WARFRAME Wiki:L10n/meta.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')
			:caption('UpdateInfoboxData', '[[Module:Arcane/data|📝 %s]]', 'update-infobox-data')
		: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 ~= '' and arcaneData.Criteria..'<br />' or '')..arcaneData.Description):done()
					:done()
				:done()
			:done()
		:done()

		:group():header('%s', 'general-information')
			:row('Type', '%s', arcaneData.Type..'[[Category:'..arcaneData.Type..' Arcanes]]', 'type')
			:row('Rarity', '[[Rarity|%s]]', arcaneData.Rarity..'[[Category:'..arcaneData.Rarity..' Arcanes]]', 'rarity')
			:row('IsRefreshable', '%s', arcaneData.IsRefreshable and '✔️' or '❌', 'refreshable')
			:row('IncompatibilityTags', '[[Compatibility Tag|%s]]', arcaneData.IncompatibilityTags and incompatibilityTags, 'incompatibility-tags')
			:row('MaxRank', '%s', arcaneData.MaxRank or 'N/A', 'max-rank')
			:row('ArcaneMax', 'Arcanes Required to Max', ((arcaneData.MaxRank + 1) * (arcaneData.MaxRank + 2)) / 2)
			:row('Dissolution', '[[Arcane Dissolution|%s]]', arcaneData.Dissolution and Tooltip.icon('Vosfor', 'Resources')..'&nbsp;'..arcaneData.Dissolution or 'Cannot Sell', 'dissolution')
			:row('TradingTax', '[[Trade System|%s]]', Tooltip.icon('Credits', 'Resources')..'&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 vendorStr = Vendor._buildVendorSourceStrings(name)
	
	Infobox:group():header('%s', 'vendor-sources')
		:tag('data'):attr('source', 'Offerings')
			:tag('default')
				:tag('div'):addClass('tabber-borderless')
					:wikitext(('<tabber>%s</tabber>'):format(
					(vendorStr ~= '') and '|-|Vendors='..vendorStr..'\n' or ''
				)):done()
			:done()
		:done()
	:done()
	:group():header('%s', 'official-drop-tables')
		:caption('official-drop-tables', 'https://www.warframe.com/droptables', 'official-drop-tables')
	:done()
	
	return frame:preprocess(tostring(Infobox))
end
}
Advertisement