Module:Change

--[==[-- -- LUA script to get Reward Changes -- getRC: get Reward Changes data based on input parameters --]==]

local p = {}

local EC = require("Module:EC").getEC local UpdateNo = require("Module:UpdateNumber").getVersion local util = require("Module:Utility")

function p.getRC(frame) local tArgs = util.getArgs(frame) local tOut = "" local k = 1 for i, item in pairs(tArgs) do		if tArgs[k + 1] then local tRC = { "", "the ", "", " rewards", " changed from ", "", tArgs[k + 2], " to ", "", tArgs[k + 3] }

if tArgs[k + 4] then tRC[1] = ", " else tRC[1] = " and " end

if k == 1 then tRC[1] = " " tRC[2] = (tArgs["P"] or "The") .. " "			end if tArgs[k + 1] == "Cost" then tRC[4] = "purchase cost" if tArgs[k + 2]:match("^([^,]-)%s*[,%#]%s*([%/%,%d%?%-]*)$") then tRC[7] = EC({tArgs[k + 2]}) else tRC[7] = "" .. tArgs[k + 2] .. "" end if tArgs[k + 3]:match("^([^,]-)%s*[,%#]%s*([%/%,%d%?%-]*)$") then tRC[10] = EC({tArgs[k + 3]}) else tRC[10] = "" .. tArgs[k + 3] .. "" end elseif tArgs[k + 1] == "Build" then tRC[4] = "building time" elseif tArgs[k + 1] == "Time" then tRC[4] = "collect time" elseif tArgs[k + 1] == "XP" or tArgs[k + 1] == "Magic" then tRC[3] = tArgs[k + 1] .. " (" .. EC({tArgs[k + 1]}) .. ")" else tRC[4] = tArgs[k + 1]:lower end tOut = tOut .. table.concat(tRC) k = k + 3 end end return tOut .. " with " .. UpdateNo({tArgs[1], "D"}) .. "." end

return p