Module:Infobox Item

From Discord Dungeons Wiki
Revision as of 14:55, 31 March 2022 by Mackan (talk | contribs)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Infobox Item/doc

--------------------------
-- Module for [[Template:Infobox Item]]
------------------------
local p = {}

local infobox = require('Module:Infobox')
local onmain = require('Module:Mainonly').on_main
local commas = require('Module:Addcommas')._add
VariablesLua = mw.ext.VariablesLua

function p.main(frame)
	local args = frame:getParent().args
	local ret = infobox.new(args)

	ret:defineParams{
		--- General 
		{ name = 'name', func = 'name' },
		{ name = 'version', func = 'has_content' },
		{ name = 'aka', func = 'has_content' },
		{ name = 'image', func = 'image' },
		{ name = 'image_smw', func = { name = image_smw, params = { 'image' }, flag = 'p' } },

		{ name = 'release', func = 'release' },
		{ name = 'removal', func = 'removal' },
		{ name = 'members', func = 'has_content' },
		{ name = 'quest', func = 'has_content' },

		{ name = 'tradeable', func = tradeablearg },
		{ name = 'equipable', func = 'has_content' },
		{ name = 'usable', func = 'has_content' },

		{ name = 'buyvalue', func = 'has_content' },
		{ name = 'sellvalue', func = 'has_content' },


		-- css class name to hide rows on undefined versions
		{ name = 'market_sell_limit', func = 'has_content'},
		{ name = 'market_buy_limit', func = 'has_content' },


        { name = 'usesinfobox', func = { name = tostring, params = { 'Item' }, flag = 'r' } },
		{ name = 'id', func = 'has_content' },
	}

	ret:setMaxButtons(7)
	ret:create()
end

return p