Module:ResourceTables

From Pacific Drive Wiki

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

local p = {}

p.items = {
    scrap_metal = {
        icon = 'STEEL-SCRAP.png',
        name = 'Scrap Metal',
        color = '#821c8d',
    },
    copper_wire = {
        icon = 'COPPER WIRE.png',
        name = 'Copper Wire',
        color = '#9b0d4c',
    },
    explosives = {
        icon = 'EXPLOSIVE.png',
        name = 'Explosives',
        color = '#C29400',
    },
    electronics = {
        icon = 'CIRCUITRY.png',
        name = 'Electronics',
        color = '#df0d20',
    },
    plasma = {
        icon = 'PLASMA.png',
        name = 'Plasma',
        color = '#39868e',
    },
    plastic = {
        icon = 'PLASTIC.png',
        name = 'Plastic',
        color = '#1b6c19',
    },
    duct_tape = {
        icon = 'TAPE.png',
        name = 'Duct Tape',
        color = '#df0d20',
    },
    gas_cylinder = {
        icon = 'GAS-CYLINDER.png',
        name = 'Gas Cylinder',
        color = '#005266',
    },
    gear = {
        icon = 'GEAR.png',
        name = 'Gear',
        color = '#f8f7aa',
    },
    rubber = {
        icon = 'RUBBER.png',
        name = 'Rubber',
        color = '#f5bb00',
    },
    pressurized_cartridges = {
        icon = 'PRESS-CYLINDER.png',
        name = 'Pressurized Cartridges',
        color = '#1b6c19',
    },
    thermosap_crystal = {
        icon = 'THERMOFLUX-CRYSTAL.png',
        name = 'ThermoSap Crystal',
        color = '#f5bb00',
    },    
    ninev_battery = {
        icon = '9V-BATTERY.png',
        name = '9v Battery',
        color = '#39868e',
    },   
    glass_shards = {
        icon = 'GLASS.png',
        name = 'Glass Shards',
        color = '#75951b',
    },  
    chemicals = {
        icon = 'CHEMICALS.png',
        name = 'Chemicals',
        color = '#f5bb00',
    },   
    marsh_eggs = {
        icon = 'MACROPHAGE.png',
        name = 'Marsh Eggs',
        color = '#821c8d',
    },
    bulb = {
        icon = 'BULB.png',
        name = 'Bulb',
        color = '#f8f7aa',
    },
    steel_sheet = {
        icon = 'STEEL-SHEET Inverted.png',
        name = 'Steel Sheet',
        color = '#f8f7aa',
    },
    lead_platelet = {
        icon = 'LEAD.png',
        name = 'Lead Platelet',
        color = '#75951b',
    },
    fabric = {
        icon = 'FABRIC.png',
        name = 'Fabric',
        color = '#005266',
    },
    bioflare = {
        icon = 'Bioflare.png',
        name = 'Bioflare',
        color = '#df0d20',
    },
    road_flare = {
        icon = 'FLARE.png',
        name = 'Road Flare',
        color = '#df0d20',
    },
    circuit_board = {
        icon = 'BREADBOARD.png',
        name = 'Circuit Board',
        color = '#f8f7aa',
    },
    carbonfiberglass = {
        icon = 'CARBON-FIBREGLASS.png',
        name = 'Carbonfiberglass',
        color = '#f8f7aa',
    },
    olympium_fragment = {
        icon = 'ANOMALY-METAL.png', -- Placeholder
        name = 'Olympium Fragment',
        color = '#770a3c',
    },
    lim_magnet = {
        icon = 'MAGNET.png',
        name = 'LIM Magnet',
        color = '#005266',
    },
    lim_chip = {
        icon = 'LIM-CHIP.png',
        name = 'LIM Chip',
        color = '#f8f7aa',
    },
    red_balloon = {
        icon = 'GRAVITY-GEL.png',
        name = 'Red Balloon',
        color = '#df0d20',
    },
    swamp_coral = {
        icon = 'BIOLUMINESCENCE.png',
        name = 'Swamp Coral',
        color = '#b00b1d',
    },
    tree_candy = {
        icon = 'TREE_CANDY.png',
        name = 'Tree Candy',
        color = '#770a3c',
    },
    no_items = {
        icon = 'PC-Theft.png',
        name = 'None',
        color = '#000000',
    },
    gasoline = {
        icon = 'Fuel_Barrel_Icon.png',
        name = 'Fuel',
        color = '#E36B01',
    },
    energy_corrupted = {
        icon = 'Corrupted_Anchor.png',
        name = 'Corrupted Energy',
        color = '#aa0063',
    },
    energy_stable = {
        icon = 'Stable_Anchor.png',
        name = 'Stable Energy',
        color = '#c0b354',
    },
    energy_unstable = {
        icon = 'Unstable_Anchor.png',
        name = 'Unstable Energy',
        color = '#cb3801',
    },
  frequency_file = {
        icon = 'Records_Icon.png',
        name = 'Frequency File',
        color = '#0b340a',
    },
}

function p.main(frame)
    local res = ''
    for key, value in frame.args.items:gmatch("([%w_]+)") do
        local item = p.items[key]
        if not item then
            return string.format("Item %s not found.", key)
        end
        res = string.format('%s<div style="color: #eaecc3; display: flex; align-items: center; max-width: 24em; padding: 0; margin: 0; border: solid; border-color: %s; border-width: 2px;"><span style="margin: 0; padding-left: 8px; padding-right: 8px;">[[File:%s|26px|alt=Icon for the %s resource]]</span><span style="width: 14em; border-left: solid; border-color: %s; border-width: 2px; font-size: 24px; padding: 2px 8px 2px 8px; margin: 0;">[[%s]]</span></div>',
        res, item.color, item.icon, item.name, item.color, item.name)
    end
    return res
end

return p