Module:ECR

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

local p = {}

local RARITY = require("Module:Rarity").rarity 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 tECR = { "", "", "", "", "",		"|-\n| align=\"center\"|", "", "", "", "", "", "", "", "", "",		"", "", "", "", "",	}

local brs = ""

if tArgs[1] and tArgs[1] ~= "Common" then tECR[1] = "|-\n! style=\"text-align: center;\"|" tECR[2] = RARITY({tArgs[1], "ECR", "40"}) tECR[3] = " " tECR[4] = RARITY({tArgs[1], nil, "20"}) tECR[5] = "\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[11 + 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[9] = TOK({tArgs["T"], "50"}) tECR[10] = brs brs = " " end

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

return table.concat(tECR) end

return p