Module:Infobox/Item

--Get Required Modules local loadLib = require('Module:LoadLib')

loadLib(_G, {	infobox='Infobox',	mRarity='RarityTier',	yesno='Yesno',	mLink='Link',	odds='Odds', }) local slot = require( Module:Inventory slot ).slot

mw.html.create = require('Module:Html').create local curTitle = mw.title.getCurrentTitle

--Begin Exports local p = {}

function p.infoboxItem(frame) local args = getArgs(frame) local pagename = curTitle.text or "Diamond" local title = args.title or pagename local sections = {} for j = 1,10,1 do		local sectionExists = j==1 or args["tab"..j]		if sectionExists then local i = j==1 and "" or j			sections[#sections+1] = { tab= args["tab"..j] or args["tab"..i], -- purposefully use "j" here since default section does actually use "tab1" image= args["image"..i] or pagename..".png", caption= args["caption"..i] or args["imagecaption"..i], slot_item= yesno(args["slot_item"..i], true) and " "..string.gsub(slot{ args["slot_item"..i] or pagename }, "\n", "").." " or nil, type= args["type"..i] or "Item", id= args["id"..i] and " ", aka= args["aka"..i], rarity= args["rarity"..i] and mRarity.link{ args["rarity"..i], addcategory=true }, collection= args["collection"..i] and mLink.collectionLink{ args["collection"..i], showIcon=true }, source= args["source"..i], obtained= args["obtained"..i] or args["obtain"..i], drop_chance= args["drop_chance"..i] or args["odds"..i] and odds.odds{ args["drop_chance"..i] or args["odds"..i], big=true }, uses= args["uses"..i], minion_xp= args["minion_xp"..i] and "", lore= args["lore"..i], item_slots= args["item_slots"..i], }		end end

-- Make infobox local ibox = infobox.create ibox:addTitle{ title } local panel = ibox:addPanel for i,sdata in ipairs(sections) do       local section = panel:addSection{ label=sdata.tab } section :addImage{ sdata.image, caption={ sdata.caption } } :addData{ sdata.slot_item } :addData{ sdata.type, label="Type" } :addData{ sdata.id, label="Item ID" } :addData{ sdata.aka, label="Also known as" } :addData{ sdata.rarity, label="Rarity" } :addData{ sdata.collection, label="Collection" } :addData{ sdata.source, label="Source" } :addData{ sdata.obtained, label="Obtained via" } :addData{ sdata.drop_chance, label="Drop Chance" } :addData{ sdata.uses, label="Uses" } :addData{ sdata.minion_xp, label='Minion XP ' } :addData{ sdata.lore, label="Lore" } :addData{ sdata.item_slots, label="Item Slots" } end mw.log(ibox) return ibox:preprocess end

--Finish Module/Exports return p