namespace Theriapolis.Core.Items; /// /// Equipment slot a single occupies when worn or /// wielded. Each slot holds at most one item. Two-handed weapons clear the /// OffHand slot when equipped. /// /// Natural-weapon enhancers (Fang Caps, Claw Sheaths, Hoof Plates, Antler Tips, /// Horn Rings) attach to a *specific* anatomical slot — they do not share with /// general-purpose worn items, so each gets its own enum entry. /// public enum EquipSlot : byte { MainHand = 0, OffHand = 1, Body = 2, Helm = 3, Cloak = 4, Boots = 5, AdaptivePack = 6, NaturalWeaponFang = 7, NaturalWeaponClaw = 8, NaturalWeaponHoof = 9, NaturalWeaponAntler = 10, NaturalWeaponHorn = 11, } public static class EquipSlotExtensions { /// /// Maps an string ("fang", "claw", /// "hoof", "antler", "horn") to the corresponding NaturalWeapon* slot. /// Returns null if the string isn't a recognized natural-weapon location. /// public static EquipSlot? FromEnhancerSlot(string? raw) => raw?.ToLowerInvariant() switch { "fang" => EquipSlot.NaturalWeaponFang, "claw" => EquipSlot.NaturalWeaponClaw, "hoof" => EquipSlot.NaturalWeaponHoof, "antler" => EquipSlot.NaturalWeaponAntler, "horn" => EquipSlot.NaturalWeaponHorn, _ => null, }; /// Parses a snake_case JSON value (e.g. "main_hand") into an EquipSlot. public static EquipSlot? FromJson(string? raw) => raw?.ToLowerInvariant() switch { "main_hand" => EquipSlot.MainHand, "off_hand" => EquipSlot.OffHand, "body" => EquipSlot.Body, "helm" => EquipSlot.Helm, "cloak" => EquipSlot.Cloak, "boots" => EquipSlot.Boots, "adaptive_pack" => EquipSlot.AdaptivePack, "natural_weapon_fang" => EquipSlot.NaturalWeaponFang, "natural_weapon_claw" => EquipSlot.NaturalWeaponClaw, "natural_weapon_hoof" => EquipSlot.NaturalWeaponHoof, "natural_weapon_antler" => EquipSlot.NaturalWeaponAntler, "natural_weapon_horn" => EquipSlot.NaturalWeaponHorn, _ => null, }; }