private void SelectWeapon() { WeaponPrototype.Elements[] elements = currentElements .Where(e => e.HasValue) .Select(e => e.Value).ToArray(); foreach (WeaponPrototype weapon in weapons) { if (ContainerExtensions.ScrambledEquals(elements, weapon.ElementCombination)) { // Cleanup old selected weapon ChangeWeapon(weapon); break; } } }