Module:DropsLineRoatz

From Roat Pkz
Revision as of 09:11, 4 April 2024 by Hefner (talk | contribs) (Replaced content with "local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:DropsLineRoatz' }) local name = args.name or '' local quantity = args.quantity or '' local rarity = args.rarity or '' local rarity2 = args.rarity2 or '' local rarity3 = args.rarity3 or '' local output = '' -- Add the picture of the item if provided if args.image then output = output .. args.image...")
Jump to navigation Jump to search

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

local p = {}

function p.main(frame)
    local args = require('Module:Arguments').getArgs(frame, {
        wrappers = 'Template:DropsLineRoatz'
    })

    local name = args.name or ''
    local quantity = args.quantity or ''
    local rarity = args.rarity or ''
    local rarity2 = args.rarity2 or ''
    local rarity3 = args.rarity3 or ''

    local output = ''
    -- Add the picture of the item if provided
    if args.image then
        output = output .. args.image .. ' '
    end
    -- Add the name of the item
    output = output .. name
    -- Add the quantity and rarity
    output = output .. ' ' .. quantity .. ' ' .. rarity
    if rarity2 ~= '' then
        output = output .. ', ' .. rarity2
    end
    if rarity3 ~= '' then
        output = output .. ', ' .. rarity3
    end
    -- Add the price from the JSON data
    local geprices_data = mw.loadData('Module:GEPrices/data.json')
    local price = geprices_data[name]
    if price then
        output = output .. ' ' .. price
    end

    return output
end

return p