equipment.Function.parseSuitLoadout - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / equipment / parseSuitLoadout

Function: parseSuitLoadout()

parseSuitLoadout(event): SuitLoadout

Defined in: src/equipment/suit-loadout.ts:327

Import a journal SuitLoadout, SwitchSuitLoadout or CreateSuitLoadout event.

Parameters

event

SuitLoadoutEvent

The event object, as the game wrote it.

Returns

SuitLoadout

The frozen SuitLoadout.

Remarks

A mount name is matched case-insensitively, with surrounding whitespace ignored, and the loadout reports the catalogue's own spelling — so fitted.mount === 'PrimaryWeapon1' holds whatever spelling the source used. Weapon and recipe symbols are matched the same way.

The suit has to resolve: an unknown SuitName is a TypeError, because the grade, the mounts and every stat come from it. Everything else the catalogues cannot resolve is left out of the loadout and reported by SuitLoadout.importOutcomes, so one unknown weapon does not cost a caller the rest of the event.

SuitID, SuitModuleID, LoadoutID and LoadoutName are kept: they name the items the Commander owns and the loadout slot they sit in, which is what a later LoadoutEquipModule event joins to. event, timestamp and the _Localised display text are dropped.

Throws

If event is not shaped like one. event must be an object whose SuitName is a string naming a catalogued suit; Modules, SuitMods and WeaponMods must be arrays whenever they are present; each module must be an object with a string SlotName and ModuleName, no two claiming the same mount; and each modification must be a string. Every other field is trusted.

Examples

import { parseSuitLoadout } from '@elite-dangerous-almanac/core/equipment/suit-loadout';

const loadout = parseSuitLoadout({
    event: 'SwitchSuitLoadout',
    SuitID: 1700482757598197,
    SuitName: 'tacticalsuit_class5',
    SuitMods: ['suit_nightvision', 'suit_increasedammoreserves'],
    LoadoutID: 4293000007,
    LoadoutName: 'Double Trouble',
    Modules: [
        {
            SlotName: 'PrimaryWeapon1',
            SuitModuleID: 1701103603778031,
            ModuleName: 'wpn_m_launcher_rocket_sauto',
            Class: 5,
            WeaponMods: ['weapon_clipsize'],
        },
    ],
});

loadout.suit.name; // -> 'Dominator Suit'
loadout.grade; // -> 5
loadout.name; // -> 'Double Trouble'
loadout.weapons[0]?.weapon.name; // -> 'Karma L-6'
loadout.weapons[0]?.metrics.damagePerSecond; // -> 119.2

A stat the game shows on foot is the catalogue's base with the fitted modifiers folded onto it. The suit's Extra Ammo Capacity reaches the weapon that carries the reserve.

import { applyPersonalModifiers } from '@elite-dangerous-almanac/core/equipment/engineering';
import { parseSuitLoadout } from '@elite-dangerous-almanac/core/equipment/suit-loadout';

const loadout = parseSuitLoadout({
    SuitName: 'tacticalsuit_class5',
    SuitMods: ['suit_increasedshieldregen', 'suit_increasedammoreserves'],
    Modules: [
        {
            SlotName: 'PrimaryWeapon1',
            ModuleName: 'wpn_m_launcher_rocket_sauto',
            Class: 5,
            WeaponMods: [],
        },
    ],
});

const fitted = loadout.weapons[0]!;
applyPersonalModifiers('shieldRegeneration', loadout.stats.shieldRegeneration, loadout.modifiers);
// -> 3.1
applyPersonalModifiers('reserveAmmo', fitted.weapon.reserveAmmo, fitted.modifiers); // -> 12
⚠️ **GitHub.com Fallback** ⚠️