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',
      ['color']         = '#ba7e1b'
   },
   ['xp'] = {
      ['name']          = 'Experience',
      ['link']          = 'XP',
      ['image']         = 'Experience_sm.png',
      ['color']         = '#bc65ee'
   },
   ['mb'] = {
      ['name']          = 'Megabuck',
      ['image']         = 'Megabucks_sm.png',
      ['color']         = '#72aa39'
   },
   ['poplim'] = {
      ['name']          = 'Population Limits',
      ['link']          = 'Population',
      ['image']         = 'Population_Limits.png',
      ['color']         = '#254d8d'
   },
   ['pop'] = {
      ['name']          = 'Population',
      ['image']         = 'Population_sm.png',
      ['color']         = '#c1a120'
   },
   ['power'] = {
      ['name']          = 'Power',
      ['image']         = 'Power_sm.png',
      ['color']         = '#ac9c2d'
   },
   ['water'] = {
      ['name']          = 'Water',
      ['image']         = 'Water_sm.png',
      ['color']         = '#8688d1'
   },
   ['heart'] = {
      ['name']          = 'Reputation',
      ['image']         = 'Reputation_sm.png',
      ['color']         = '#e65a5a'
   }
}
 
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, dp )
    local retVal
    local color
 
    if not p.limiterData[ name ]['color'] then
        color = 'black'
    else
        color = p.limiterData[name]['color']
    end
 
    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 dp == nil then
            if (amount % 1) == 0 then
                retVal = '<span style="color:'..color..';"><b>'..fNum(amount)..'</b></span>&nbsp;'..file
            else
                retVal = '<span style="color:'..color..';"><b>'..fNum(amount, 2)..'</b></span>&nbsp;'..file
            end
        else
            retVal = '<span style="color:'..color..';"><b>'..fNum(amount, dp)..'</b></span>&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.