using System;
namespace RynthCore.Plugin.RynthDefective.Items;
///
/// One thing the character carries or wears, as the client reports it. A plain data holder: the
/// reader (HostInventory) fills it, everything else (slot matching, item kinds, the weapon picker)
/// works on it without the host, so it can be tested offline.
///
internal sealed class CarriedItem
{
public uint Id;
public string Name = string.Empty;
public uint Wcid;
/// MaterialType (int 131): "Silver" in "Silver Wand"; 0 = none / unknown.
public int Material;
/// ItemType flags (the client's TryGetItemType).
public uint ItemType;
/// PublicWeenieDesc bitfield (healer, food ...); 0 when the engine can't read it.
public uint Bitfield;
/// Stack size (at least 1) and the largest stack (1 = not stackable).
public int Stack = 1, MaxStack = 1;
/// Uses left / most uses (Structure 92 / MaxStructure 91): kits, essences; MaxUses 0 = none.
public int Uses, MaxUses;
/// ValidLocations (int 9): the EquipMask slots it can go into; 0 = it can't be worn or wielded.
public int ValidLocations;
/// The slot it is wielded in now (0 = in a pack).
public int WieldedLocation;
/// CombatUse (int 51): 1 melee, 2 missile, 3 ammo, 4 shield, 5 two-handed.
public int CombatUse;
/// DamageType (int 45) and UiEffects (int 18): the element of a caster.
public int DamageType, UiEffects;
/// Icon, underlay and overlay texture ids (0x06......), 0 = none.
public uint Icon, Underlay, Overlay;
public bool Wielded => WieldedLocation != 0;
/// The name with the material in front ("Silver Wand"), as the character sees it in the game.
public string FullName => ItemNames.Full(Name, Material);
public override string ToString() => $"0x{Id:X8} {FullName}";
}