Module:MultiItems

local p = {}

local util = require("Module:Utility") local EC = require("Module:EC").getEC local TOK = require("Module:CharacterToken").getTokenDirect local CHEST = require("Module:EnchantedChest").getChest local cData = mw.loadData( 'Module:ItemCollection/data' )

local tItem = {}

local function ITEM(iData, iName, size) local conv = { ["ch"] = "cp", ["cos"] = "cp", }

local iDisp = iName:gsub("^([^%(]-)%/([^%(]-)$", "%2")

if tonumber(size) then local fname = mw.ustring.gsub(mw.ustring.lower(iName), "[':\"%,%.]", "")		fname = fname:gsub(" ", "_")		if iData[2] == "pf" then			fname = fname:gsub("_float$", "")		else			fname = fname:gsub("^([^%(]-)%/([^%(]-)$", "%1-%2")			fname = mw.ustring.gsub(fname, "^([^%(]-) *%(([^%(]-)%)$", "%1_%2")		end

local tItemData = {	"", "", "" }

if iData["C"] and cData["Categories"][iData["C"]] then local category = iData["C"] tItemData[1] = '' tItemData[16] = ' ' tItem[3] = ' ' end

return table.concat(tItemData) else return table.concat({"", (iDisp or iName), ""}) end end

function p.getOneItem(item, count, size, withName, tRewards, type) tItem = {"", (type and "" or (" " .. util.th_comma(count))), (withName and " " or ""), "", "",			(withName and " " or ""), }

local iName = item local iData = cData.Items[iName] if iData == nil then iData = cData["Items"][iName:match("(.+)%-%d+$")] end

if iName:match("Chests") and not iName:match("Wacky Lunch Chests") then tItem[1] = CHEST({item, (size or 35)}) if withName then tItem[4] = CHEST({item, "L"}) if (tonumber(nCount) or 0) > 1 then tItem[5] = "s" end end item = "CHEST-" .. item elseif iData and iData[2] then tItem[1] = ITEM(iData, iName, (size and tonumber(size)+5 or 47)) tItem[2] = "" if withName then tItem[4] = ITEM(iData, item, "L") end item = "ZITM-" .. item elseif item:match("^EC") then tItem[1] = EC({item, nil, nil, "E", (size or 35)}) if withName then tItem[4] = EC({item, "L", S=((tonumber(nCount) or 0)== 1)}) end else tItem[1] = TOK(item, (size or 35)) if withName then tItem[4] = TOK(item, "L") if (tonumber(nCount) or 0) > 1 then tItem[5] = "s" end end item = "TOK-" .. item end

if nCount == 0 then tItem[2] = " ?" end

if tRewards and type then if not tRewards[item] then tRewards[item] = {I = table.concat(tItem)} end if not tRewards[item][type] then tRewards[item][type] = nCount else tRewards[item][type] = (tRewards[item][type] + nCount) end return tRewards end

return table.concat(tItem) end

return p