FANDOM


local getArgs = require('Dev:Arguments').getArgs
local p = {}
local colors = {
    '#505050',
    '#ebc402',
    '#ed9511',
    '#fc6500',
    '#f00707'
}
 
local attr = {
    'Post Shot',
    'Middle Shot',
    '3pt Shot',
    'Short Dunk',
    'Long Dunk',
    'Short Layup',
    'Long Layup',
    'Steal',
    'Pass',
    'Tussle',
    'Block',
    'Rebound',
    'Speed',
    'Stamina'
}
 
function newTile(color)
    tile = mw.html.create('div')
    :cssText('width:15px;height:10px;display:inline-block;margin:0 2px')
    :css('background-color', color)
    return tile
end
 
function p.main(frame)
    return p._main(getArgs(frame))
end
 
function p._main(args)
    local tile, fullbar, bar, color, l_amount, r_amount
 
    local out = '{|cellpadding=4 align=center'
    for i = 1, #attr do
        bar = 1
        color = colors
        l_amount = tonumber(args[attr[i]])
        l_amount = l_amount == nil and 0 or l_amount
        r_amount = 20 - l_amount
 
        fullbar = mw.html.create('div'):cssText('display:inline-block;background:#151515;line-height:10px;padding:2px')
 
        for j = 1, l_amount do
            if(j*bar % 5 == 0) then bar = bar + 1
            else color = colors[bar+1] end
            fullbar:node(newTile(color))
        end
 
        if(r_amount ~= 0) then
            for k = 1, r_amount do
                fullbar:node(newTile(colors[1]))
            end
        end
 
 
        out = out.. '\n|style="text-align:right"|'..attr[i]..
                    '\n|'..tostring(fullbar)..
                    '<span style="display:none">+'..l_amount..'</span>\n|-'
    end
    return out..'\n|}'
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.