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| style=\"text-align: center;\"|", "", "", "", "", "", "", "", "", "",		"", "", "", "", "",	}

local brs = ""

if tArgs[1] and tArgs[1] ~= "Common" then tECR[1] = "|-\n! style=\"text-align: center;\"|" tECR[2] = RARITY({tArgs[1]:lower, "ECR", "30"}) tECR[3] = " " tECR[4] = RARITY({tArgs[1]:lower, 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], "50", 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