equipment slot audit

Guide for equipment slot audit

Equipment Slot Mismatch Audit

Issue

There is a discrepancy between the EquipmentSlot enum in items.rs and the implementation in equipment.rs.

items.rs (Enum)

pub enum EquipmentSlot {
    Head,
    Body,
    Legs,
    Weapon,
    Shield,
    Hands,
    Feet,
    Cape,
    Ammo, // Present here
}
Missing: Neck, Ring, Boon.

equipment.rs (DB Schema)

pub struct PlayerEquipment {
    pub head: Option<String>,
    pub neck: Option<String>, // Present here
    pub body: Option<String>,
    pub legs: Option<String>,
    pub weapon: Option<String>,
    pub shield: Option<String>,
    pub hands: Option<String>,
    pub feet: Option<String>,
    pub cape: Option<String>,
    pub ring: Option<String>, // Present here
    pub boon: Option<String>, // Present here
    // Missing: Ammo
}

Consequences

  1. Cannot define Neck/Ring items: ItemDef uses EquipmentSlot. Since Neck isn't in the enum, we can't create amulets properly in code.
  2. Cannot equip Ammo: The database and PlayerEquipment struct lack an ammo column. Ranged combat requiring arrows will fail to find equipped ammo.

Recommendations

  1. Update EquipmentSlot Enum: Add Neck, Ring, Boon to the enum in items.rs.
  2. Update Database Schema: Add ammo column to player_equipment table.
    ALTER TABLE player_equipment ADD COLUMN ammo VARCHAR;
  3. Update PlayerEquipment Struct: Add ammo: Option<String> to the struct in equipment.rs.
  4. Update EquipmentManager: Handle definitions for new slots.