Jump to content

Module:InventorySlot

From SankoQuest Wiki

Documentation for this module may be created at Module:InventorySlot/doc

local p = {}

local function slot(frame, item, qty)
    local root = mw.html.create('span')
        :addClass('sanko-inventory-slot')

    if item and item ~= '' then
        root:wikitext(frame:expandTemplate{ title = 'ItemSprite', args = { item, size = '28', link = item } })
        if qty and qty ~= '' and qty ~= '1' then
            root:tag('span')
                :addClass('sanko-inventory-qty')
                :wikitext(qty)
        end
    end

    return tostring(root)
end

function p.slot(frame)
    return slot(frame, frame.args.item or frame.args[1], frame.args.qty or frame.args[2])
end

function p._slot(frame, item, qty)
    return slot(frame, item, qty)
end

return p