×
Create a new article
Write your page title here:
We currently have 770 articles on Angry Birds Wiki. Type your article name above or create one of the articles listed here!



    Angry Birds Wiki
    770Articles

    Module:AB2 rank names

    Revision as of 22:13, 22 August 2021 by fandom:angrybirds>Ytxmobile (get rank)
    This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

    This module allows you to get the rank names of cards and the Slingshot in Angry Birds 2.

    Usage

    {{#invoke:AB2 rank names|getCardRank|<rank>}}
    {{#invoke:AB2 rank names|getSlingshotRank|<rank>}}
    
    • <rank>: a positive integer.

    Examples

    Card ranks

    • {{#invoke:AB2 rank names|getCardRank|1}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getCardRank|10}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getCardRank|25}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getCardRank|51}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getCardRank|100}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.

    Slingshot ranks

    • {{#invoke:AB2 rank names|getSlingshotRank|1}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getSlingshotRank|10}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getSlingshotRank|25}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getSlingshotRank|51}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.
    • {{#invoke:AB2 rank names|getSlingshotRank|100}}
      gives: Lua error in package.lua at line 80: module 'Dev:Arguments' not found.

    See also

    Angry Birds 2 modules

    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'
    	end
    	
    	-- rank >= 2, rank <= 49
    	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
    
    local p = {}
    
    p.getRankName = function(frame)
    	local args = getArgs(frame)
    	local rank = tonumber(args[1])
    	return getRankName(rank)
    end
    
    return p
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.