//Equip gear piece (will swap out existing equipment if there is any) public void Equip(Item gear) { //Remove this gear from inventory GetComponent <Inventory>().RemoveItemFromInventory(gear.ID, 1); //Swap this with whatever is currently in that slot Item piece = equippedGear[(int)gear.GearType]; equippedGear[(int)gear.GearType] = gear; //Update slot number gear.Slot = (int)gear.GearType; //If the slot was occupied, add the item back to the inventory if (piece != null) { GetComponent <Inventory>().AddItemToInventory(piece); } //This will add a new entry (if nothing is equipped) or overwrite an existing one networkManager.AddEquipment(gear); //Reload enchantments Stats.ReloadEnchantments(); }