EquipmentLoadout

Class

Namespace: GGG.Equipment

Owns the runtime state and rules for one equipment loadout. It has no dependency on inventory, combat, input, UI, animation, or character presentation.

public sealed class EquipmentLoadout : IEquipment

Inheritance

object ← EquipmentLoadout

Implements

IEquipment

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

EquipmentLoadout(EquipmentLoadoutDefinition, EquipmentCatalog)

Creates a new EquipmentLoadout instance.

public EquipmentLoadout(EquipmentLoadoutDefinition loadoutDefinition, EquipmentCatalog catalog)

Parameters

loadoutDefinition EquipmentLoadoutDefinition

The equipment loadout configuration.

catalog EquipmentCatalog

The catalog used to resolve definitions.

Properties

Slots

Gets the runtime slots in their configured order.

public IReadOnlyList<EquipmentSlot> Slots { get; }

Property Value

IReadOnlyList<EquipmentSlot>

Methods

CanEquip(ItemInstance, EquipmentSlotDefinition)

Determines whether the item can occupy the specified equipment slot.

public bool CanEquip(ItemInstance item, EquipmentSlotDefinition slotDefinition)

Parameters

item ItemInstance

The runtime item instance to inspect or modify.

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

Returns

bool

Whether the specified condition is satisfied.

ContainsSlot(EquipmentSlotDefinition)

Determines whether the loadout contains the requested slot definition.

public bool ContainsSlot(EquipmentSlotDefinition slotDefinition)

Parameters

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

Returns

bool

Whether the specified condition is satisfied.

IsEquipped(ItemInstance)

Determines whether the specified item is currently equipped.

public bool IsEquipped(ItemInstance item)

Parameters

item ItemInstance

The runtime item instance to inspect or modify.

Returns

bool

Whether the specified condition is satisfied.

TryClear(out IReadOnlyList<ItemInstance>)

Attempts to clear all occupied slots, returning removed items.

public bool TryClear(out IReadOnlyList<ItemInstance> unequippedItems)

Parameters

unequippedItems IReadOnlyList<ItemInstance>

Receives items unequipped by the operation.

Returns

bool

Whether the operation succeeded.

TryEquip(ItemInstance, EquipmentSlotDefinition, out ItemInstance)

Attempts to equip an item in the specified slot.

public bool TryEquip(ItemInstance item, EquipmentSlotDefinition slotDefinition, out ItemInstance replacedItem)

Parameters

item ItemInstance

The runtime item instance to inspect or modify.

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

replacedItem ItemInstance

Receives an item displaced from the equipment slot, if any.

Returns

bool

Whether the operation succeeded.

TryEquip(ItemInstance, EquipmentSlotDefinition)

Attempts to equip an item in the specified slot.

public bool TryEquip(ItemInstance item, EquipmentSlotDefinition slotDefinition)

Parameters

item ItemInstance

The runtime item instance to inspect or modify.

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

Returns

bool

Whether the operation succeeded.

TryGetEquippedItem(EquipmentSlotDefinition, out ItemInstance)

Attempts to find the item equipped in the specified slot.

public bool TryGetEquippedItem(EquipmentSlotDefinition slotDefinition, out ItemInstance item)

Parameters

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

item ItemInstance

Receives the resulting item when successful.

Returns

bool

Whether the operation succeeded.

TryGetSlot(EquipmentSlotDefinition, out EquipmentSlot)

Attempts to find the specified runtime slot.

public bool TryGetSlot(EquipmentSlotDefinition slotDefinition, out EquipmentSlot slot)

Parameters

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

slot EquipmentSlot

Receives the matching runtime slot when found.

Returns

bool

Whether the operation succeeded.

TryGetSlot(string, out EquipmentSlot)

Attempts to find the specified runtime slot.

public bool TryGetSlot(string slotId, out EquipmentSlot slot)

Parameters

slotId string

The identifier of the equipment slot.

slot EquipmentSlot

Receives the matching runtime slot when found.

Returns

bool

Whether the operation succeeded.

TryUnequip(EquipmentSlotDefinition, out ItemInstance)

Attempts to remove the equipped item from the specified slot.

public bool TryUnequip(EquipmentSlotDefinition slotDefinition, out ItemInstance unequippedItem)

Parameters

slotDefinition EquipmentSlotDefinition

The equipment slot definition to inspect or use.

unequippedItem ItemInstance

Receives the previously equipped item when successful.

Returns

bool

Whether the operation succeeded.

Changed

Raised when the underlying runtime state changes.

public event Action<EquipmentChange> Changed

Event Type

Action<EquipmentChange>