Module:Sandbox/LVL: Difference between revisions

LVL (talk | contribs)
Blanked the page
Tag: Blanking
LVL (talk | contribs)
No edit summary
Line 1: Line 1:
local p = {}
local ItemData = require('Module:ItemData')
local Lang    = require('Module:Lang')
local Dict    = require('Module:Dictionary')


-- localised labels cached once
local labels = {
    title  = Dict.translate('Items'),
    weapon  = Lang.get_string('CitadelCategoryWeapon', {fallback_str='en'}),
    armor  = Lang.get_string('CitadelCategoryArmor',  {fallback_str='en'}),
    tech    = Lang.get_string('CitadelCategoryTech',  {fallback_str='en'}),
}
-- tiny helper to build a gradient bar
local function gradientBar(text, targetPage)
    return string.format(
        '<div style="text-align:center;width:100%;margin:5px 0;background-image:linear-gradient(#987556,#e8be86);border-radius:8px;">' ..
        '[[%s|<span style="color:#FFF5E8;font-family:\'Retail Demo\',sans-serif;font-weight:bold;text-shadow:0 2px 2px #000,0 0 2px #000;">%s</span>]]</div>',
        targetPage,
        text
    )
end
function p.main()
    local cats = {
        { name='Weapon', label=labels.weapon, page=Dict.translate('Weapon Item', {lang_code_override='en'})..'{{if_lang}}' },
        { name='Armor',  label=labels.armor,  page=Dict.translate('Armor Item',  {lang_code_override='en'})..'{{if_lang}}' },
        { name='Tech',  label=labels.tech,  page=Dict.translate('Tech Item',  {lang_code_override='en'})..'{{if_lang}}' },
    }
    local pieces = {}
    for _, c in ipairs(cats) do
        table.insert(pieces,
            '|group' .. #pieces+1 .. ' = ' ..
            '|list'  .. #pieces  .. '  = ' ..
            gradientBar(c.label, c.page) ..
            '{{#invoke:ItemData/nav|write_item_slot_subgroup|'..c.name..'|get_item_nav_bulletpoints}}'
        )
    end
    -- build the Navbox call
    return mw.getCurrentFrame():expandTemplate{
        title = 'Navbox',
        args  = {
            name      = 'Items',
            title      = '[[Item{{if_lang}}|<span style="color:#FFF5E8;font-weight:bold;font-family:\'Retail Demo\',serif;font-size:18px;text-shadow:0 2px 2px #000,0 0 2px #000;">'..labels.title..'</span>]]',
            state      = '',
            titlestyle = 'border-radius:8px;background-image:linear-gradient(#987556,#e8be86);font-family:\'PT Serif\',serif;',
            groupstyle = 'border-radius:8px 0 0 8px;background-image:linear-gradient(#c1a671,#d0bb95);font-family:\'Forevs Demo Bold\',serif;padding:5px;text-align:center;',
            abovestyle = 'background:#bdad9f;',
            aboveclass = 'hlist',
            ['']      = table.concat(pieces, '\n')
        }
    }
end
return p