private void EditInventoryItem(IInventoryItem item) { if (item is Weapon) { Weapon weapon = (Weapon)item; EditWeaponWindow window1 = new EditWeaponWindow(player, weapon, true); if (window1.ShowDialog(this)) { weapon.CopyValues(window1.Weapon); player.WeaponBonuses[weapon] = new WeaponBonusValue(window1.ToHitAdjustments, window1.DamageAdjustments); } } else if (item is Armor) { Armor armor = (Armor)item; EditArmorWindow window2 = new EditArmorWindow(armor); if (window2.ShowDialog(this)) { armor.CopyValues(window2.Armor); } } else if (item is Shield) { Shield shield = (Shield)item; EditShieldWindow window3 = new EditShieldWindow(shield); if (window3.ShowDialog(this)) { shield.CopyValues(window3.Shield); } } }
private void btnInvArmor_Click(object sender, RoutedEventArgs e) { if (player.Armor == null) { return; } EditArmorWindow window = new EditArmorWindow(player.Armor); if (window.ShowDialog(this)) { player.Armor.CopyValues(window.Armor); } }