Module:AB2 rank names

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

local prefixes = { nil,        -- 1-8 'Elder',    -- 9-15 'Master',   -- 16-22 'Pristine', -- 23-29 'Epic',     -- 30-36 'Ancient',  -- 37-43 'Mythic',   -- 44-50 nil,        -- 51+ }

local materials = { 'Bronze', 'Silver', 'Gold', 'Azure', 'Emerald', 'Amethyst', 'Diamond' }

local function getRankName(rank) if rank <= 1 then return 'Vanilla' elseif rank >= 51 then return 'Legendary' else -- rank >= 2, rank <= 50 local prefix = prefixes[math.floor((rank - 2) / 7) + 1] local material = materials[(rank - 2) % 7 + 1] if prefix == nil then return material else return prefix .. ' ' .. material end end end

local p = {}

p.getCardRank = function(frame) local args = getArgs(frame) local rank = tonumber(args[1]) return getRankName(rank) end

p.getSlingshotRank = function(frame) local args = getArgs(frame) local rank = tonumber(args[1]) return getRankName(rank + 1) end

return p