FANDOM


local p = {}
 
local fNum = require( 'Module:FormatNum' ).formatNum
local mFileLink = require( 'Dev:File link' )
 
p.limiters = {
   'coin',
   'mb',
   'xp',
   'pop',
   'poplim',
   'power',
   'water',
   'points',
   'rep',
   'pass',
   'passlim'
}
 
p.limiterData = {
   ['coin'] = {
      ['name']          = 'Coin',
      ['image']         = 'Coin_sm.png'
   },
   ['xp'] = {
      ['name']          = 'Experience',
      ['link']          = 'XP',
      ['image']         = 'Experience_sm.png'
   },
   ['mb'] = {
      ['name']          = 'Megabuck',
      ['image']         = 'Megabucks_sm.png'
   },
   ['poplim'] = {
      ['name']          = 'Population Limits',
      ['link']          = 'Population',
      ['image']         = 'Population_Limits.png'
   },
   ['pop'] = {
      ['name']          = 'Population',
      ['image']         = 'Population_sm.png'
   },
   ['power'] = {
      ['name']          = 'Power',
      ['image']         = 'Power_sm.png'
   },
   ['water'] = {
      ['name']          = 'Water',
      ['image']         = 'Water_sm.png'
   },
   ['heart'] = {
      ['name']          = 'Reputation',
      ['image']         = 'Reputation_sm.png'
   }
}
 
function p.lim( frame )
    local name = string.lower(frame.args[1])
    local amount = tonumber(frame.args[2]) or nil
 
    return p.limiter( name, amount )
end
 
function p.limiter( name, amount )
    local retVal
 
    if not p.limiterData[ name ] then
        file = nil
    else
        if p.limiterData[ name ]['link'] == {} or "" or nil then
            p.limiterData[ name ]['link'] = p.limiterData[ name ]['name']
        end
        file = mFileLink._main{file=p.limiterData[name]['image'], format='frameless', size='15px', link=p.limiterData[ name ]['link'], caption=p.limiterData[name]['name']}
    end
 
    if not p.limiterData[ name ] then
        retVal = "<b>Invalid Limiter Defined</b>"
    elseif amount == nil then
        retVal = file
    else
        if (amount % 1) == 0 then
            retVal = fNum(amount).."&nbsp;"..file
        else
            retVal = fNum(amount, 2).."&nbsp;"..file
        end
        return retVal
    end
    return retVal
end
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.