Module:Properties

From Pacific Drive Wiki

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

local p = {}

p.properties = {
    ability_boost = {
        icon = 'BOOST.png',
        name = 'Boost Ability',
        color = '#dce2a0',
    },
    ability_bracer = {
        icon = 'Bracer.png',
        name = 'Bracer Shield Ability',
        color = '#dce2a0',
    },
    ability_bubble = {
        icon = 'BUBBLE-SHIELD.png',
        name = 'Anti-Radiation Shield Ability',
        color = '#dce2a0',
    },
    ability_grip = {
        icon = 'POWER-GRIP-TIRE 2.png',
        name = 'Grip Ability',
        color = '#dce2a0',
    },
    ability_impact = {
        icon = 'Impact Shield.png',
        name = 'Impact Shield Ability',
        color = '#dce2a0',
    },
    battery_capacity = {
        icon = 'BATTERIES.png',
        name = 'Capacity',
        color = '#dce2a0',
    },
    battery_drain = {
        icon = 'Battery Drain.png',
        name = 'Battery Drain',
        color = '#eaaa8a',
    },
    battery_gain = {
        icon = 'Battery Gain.png',
        name = 'Battery Gain',
        color = '#beec9b',
    },
    blocks_charged = {
        icon = 'Charged Block.png',
        name = 'Blocks Charged',
        color = '#fcc300',
    },
    blocks_flat = {
        icon = 'Flat Block.png',
        name = 'Blocks Flat',
        color = '#dce2a0',
    },
    blocks_blown = {
        icon = 'Flat Block.png',
        name = 'Blocks Blown Out',
        color = '#dce2a0',
    },
    brightness = {
        icon = 'BRIGHTNESS.png',
        name = 'Brightness',
        color = '#dce2a0',
    },
    consume = {
        icon = 'BATTERIES.png',
        name = 'Consume',
        color = '#dce2a0',
    },
    damage_explosive = {
        icon = 'HAZARD-EXPLOSIVE.png',
        name = 'Explosive Damage',
        color = '#dce2a0',
    },
    damage_impact = {
        icon = 'Physical DMG.png',
        name = 'Impact Damage',
        color = '#dce2a0',
    },
    damage_piercing = {
        icon = 'HAZARD-PIERCING.png',
        name = 'Piercing Damage',
        color = '#dce2a0',
    },
    damage_electrical = {
        icon = 'HAZARD-ELECTRICAL.png',
        name = 'Eletrical Damage',
        color = '#dce2a0',
    },
    durability = {
        icon = 'Durability.png',
        name = 'Durability',
        color = '#dce2a0',
    },
    fuel_capacity = {
        icon = 'FUELS.png',
        name = 'Capacity',
        color = '#dce2a0',
    },
    fuel_consumption = {
        icon = 'FUEL-CAN.png',
        name = 'Fuel Consumption (MPG)',
        color = '#dce2a0',
    },
    fuel_gain = {
        icon = 'Fuel Gain.png',
        name = 'Fuel Gain',
        color = '#dce2a0',
    },
    grip_rating_offroad = {
        icon = 'COLL-WHEEL.png',
        name = 'Offroad Rating',
        color = '#dce2a0',
    },
    grip_rating_road = {
        icon = 'COLL-WHEEL.png',
        name = 'Road Rating',
        color = '#dce2a0',
    },
    grip_rating_water = {
        icon = 'COLL-WHEEL.png',
        name = 'Water Rating',
        color = '#dce2a0',
    },
    hands_only = {
        icon = 'HANDS-ONLY.png',
        name = 'Hands Only',
        color = '#dce2a0',
    },
    health = {
        icon = 'Health.png',
        name = 'Health',
        color = '#dce2a0',
    },
    health_gain = {
        icon = 'W-Health.png',
        name = 'Health Gain',
        color = '#dce2a0',
    },
    horsepower = {
        icon = 'ENGINES.png',
        name = 'Horsepower',
        color = '#dce2a0',
    },
    item_size = {
        icon = 'ITEM-SIZE.png',
        name = 'Item Size (Grid Units)',
        color = '#dce2a0',
    },
    light_range = {
        icon = 'LIGHTS.png',
        name = 'Light Range',
        color = '#dce2a0',
    },
    resist_acid = {
        icon = 'HAZARD-ACID.png',
        name = 'Acid Resist (%)',
        color = '#dce2a0',
    },
    resist_electrical = {
        icon = 'HAZARD-ELECTRICAL.png',
        name = 'Electrical Resist (%)',
        color = '#dce2a0',
    },
    resist_explosive = {
        icon = 'HAZARD-EXPLOSIVE.png',
        name = 'Explosive Resist (%)',
        color = '#dce2a0',
    },
    resist_impact = {
        icon = 'Physical DMG.png',
        name = 'Impact Resist (%)',
        color = '#dce2a0',
    },
    resist_radiation = {
        icon = 'HAZARD-RADIATION.png',
        name = 'Radiation Resist (%)',
        color = '#dce2a0',
    },
    stack_size = {
        icon = 'STACK-SIZE.png',
        name = 'Stack Size',
        color = '#dce2a0',
    },
}

function p.main(frame)
    local res = ''
    for pair_raw in mw.text.gsplit(frame.args.stats, ',', true) do
        local pair = mw.text.split(pair_raw, '=', true)
        local key = pair[1]
        local value = pair[2]
        local property = p.properties[key]
        if not property then
            return string.format("Property %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 property]]</span><span style="width: 14em; border-left: solid; border-color: %s; border-width: 2px; font-size: 24px; padding: 2px 8px 2px 8px; margin: 0;flex: 1 1 auto;">[[%s]]</span><span style="padding-right: 8px; font-size: 24px;flex:0 0 auto;">%s</span></div>',
        res, property.color, property.icon, property.name, property.color, property.name, value)
    end
    return res
end

return p