Module:AB2 rank feathers

local getArgs = require('Module:Common').getArgs

local singleFeathers = { 0,                                              -- Vanilla (1) 100,  250,   550,   950,   1400,  1600,  1800,  -- Vanilla (2-8) 1900, 2100,  2300,  2400,  2600,  2900,  3100,  -- Elder (9-15) 3300, 3500,  3700,  3900,  5000,  6000,  7000,  -- Master (16-22) 9000, 12000, 15000, 17000, 18000, 19000, 23000, -- Pristine (23-29) 30000, 35000, 40000, 45000, 50000, 50000, 50000, -- Epic (30-36) 50000, 50000, 50000, 50000, 50000, 50000, 50000, -- Ancient (37-43) 50000, 50000, 50000, 50000, 50000, 50000, 50000, -- Mythic (44-50) 50000,                                          -- Legendary (51+) }

-- compute accumulated feathers local numBirds = 7 local accumulatedFeathers = (function	local accumulatedFeathers = {0}	for i = 2, #singleFeathers do		table.insert(accumulatedFeathers, singleFeathers[i] * numBirds + accumulatedFeathers[i-1])	end	return accumulatedFeathers end)

local p = {}

p.getSingleFeathers = function(frame) local args = getArgs(frame) local rank = tonumber(args[1]) if rank < 1 then return 0 elseif rank > #singleFeathers then rank = #singleFeathers end return singleFeathers[rank] end

p.getAccumulatedFeathers = function(frame) local args = getArgs(frame) local rank = tonumber(args[1]) if rank < 1 then return 0 elseif rank > #singleFeathers then local result = accumulatedFeathers[#singleFeathers] result = result + (rank - #singleFeathers) * singleFeathers[#singleFeathers] * numBirds return result end return accumulatedFeathers[rank] end

return p