Module:ECR

--[==[-- -- LUA script to get Enchanted Chests Rewards -- getECR: get Enchanted Chests Rewards data based on input parameters --]==]

local p = {}

local EC = require("Module:EC").getEC local TOK = require("Module:CharacterToken").getToken local MULT = require("Module:MultiItems").getItems local util = require("Module:Utility")

function p.getECR(frame) local tArgs = util.getArgs(frame)

local rType = { --["Common"]   = 1, ["Uncommon"] = 2, ["Rare"]     = 3, ["Epic"]     = 4, ["Legendary"] = 5, }

local tECR = { "", "", "", "", "",		"", "", "", "", "",		"", "|-\n| align=\"center\"|", "", "", "", "", "", "", "", "",		"", "", "", "", "",	}

local brs = ""

if tArgs[1] and rType[tArgs[1]] then tECR[1] = "|-\n! style=\"text-align: center;\"|[[File:c-rarity-"		tECR[2] = string.lower(tArgs[1])		tECR[3] = ".png|350px|"		tECR[4] = tArgs[1]		tECR[5] = "]] "

local space = "" --tECR[6] - tECR[10] = rarity stars for i = 1,rType[tArgs[1]] do			tECR[5 + i] = space .. ""			space= " " end tECR[11] = "\n" end

local tTypes = { {"C",  "Cp"}, {"Cos", "Cp"}, {"Ba", "Ba"}, {"Bc", "Bc"}, {"D",  "D"}, {"Pf", "Pf", "Float"}, }

for i, data in ipairs(tTypes) do		-- tArgs[?] = List of Items separated by $ (dollar sign) -- -- tECR[20] - tECR[25] if tArgs[data[1]] then tECR[19 + i] =	MULT({tArgs[data[1]], data[2], nil, data[3]}) brs = " " end end

--T = List of Tokens entries separated by $ (dollar sign) entry format Character,Token,Count -- if tArgs["T"] then tECR[17] = TOK({tArgs["T"], "50"}) tECR[18] = brs brs = " " end

-- Ec = List of Currencies entries separated by $ (dollar sign) entry format Currency / Event,Count -- if tArgs["Ec"] then tECR[14] = EC({tArgs["Ec"], "", "", "I"}) tECR[15] = brs end

return table.concat(tECR) end

return p