/// <summary> /// Equips an item /// </summary> /// <param name="item">Item to equip</param> public void EquipItem(ItemBase item, [Range(-1, 1)] int slot = -1) { ItemBase replacedItem = null; // Holds data about the replaced item if (Inv.EquipItem(item, out replacedItem, slot)) { switch (item) { case Ring i: foreach (KeyValuePair <PlayerModifiers, int> mod in i.Modifiers) { ApplyPlayerModifiers(mod); } break; case Necklace i: foreach (KeyValuePair <PlayerModifiers, int> mod in i.Modifiers) { ApplyPlayerModifiers(mod); } break; case Armor i: foreach (KeyValuePair <DamageModifiers, int> mod in i.ArmorModifiers) { ApplyArmorModifiers(mod); } break; case Weapon i: foreach (KeyValuePair <DamageModifiers, int> mod in i.WeaponDamageModifers) { ApplyWeaponModifiers(mod); } break; } } if (replacedItem != null) { switch (replacedItem) { case Ring i: foreach (KeyValuePair <PlayerModifiers, int> mod in i.Modifiers) { RemovePlayerModifiers(mod); } break; case Necklace i: foreach (KeyValuePair <PlayerModifiers, int> mod in i.Modifiers) { RemovePlayerModifiers(mod); } break; case Armor i: foreach (KeyValuePair <DamageModifiers, int> mod in i.ArmorModifiers) { RemoveArmorModifiers(mod); } break; case Weapon i: foreach (KeyValuePair <DamageModifiers, int> mod in i.WeaponDamageModifers) { RemoveWeaponModifiers(mod); } break; } } UpdateAttackPower(); UpdateArmorValue(); }