public void CreateSolverData() { if (SearchResultsViewModel.IsDataLoaded == false || SelectedAbilities == null) { return; } ISolverData solverData = GetSelectedSolverData(); var desiredAbilities = SelectedAbilities .Where(x => x.IsChecked) .Select(x => x.Ability) .ToList(); int[] weaponSlots = InParameters.Slots.Select(x => x.Value).ToArray(); var solverDataWeapon = new Weapon(-1, (WeaponType)(-1), weaponSlots, new IAbility[0], null); solverData.Setup( solverDataWeapon, GlobalData.Instance.Heads.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Chests.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Gloves.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Waists.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Legs.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Charms.Where(x => EquipmentMatchInParameters(x)), GlobalData.Instance.Jewels.Where(x => DecorationMatchInParameters(x)).Select(CreateSolverDataJewelModel), desiredAbilities ); UpdateMetrics(solverData); UpdateAdvancedSearch(); SearchResultsViewModel.ResetResults(); }
public void CreateSolverData() { if (IsDataLoaded == false || SelectedAbilities == null) { return; } ISolverData solverData = Extensions.SolverData.SelectedValue; var desiredAbilities = SelectedAbilities .Where(x => x.IsChecked) .Select(x => x.Ability) .ToList(); solverData.Setup( InParameters.Slots.Select(x => x.Value).ToList(), GlobalData.Instance.Heads.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Chests.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Gloves.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Waists.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Legs.Where(x => ArmorPieceMatchInParameters(x)), GlobalData.Instance.Charms.Where(x => EquipmentMatchInParameters(x)), GlobalData.Instance.Jewels.Where(x => DecorationMatchInParameters(x)).Select(CreateSolverDataJewelModel), desiredAbilities ); /*************************************************************/ var metrics = new SearchMetrics { Heads = solverData.AllHeads.Count(x => x.IsSelected), Chests = solverData.AllChests.Count(x => x.IsSelected), Gloves = solverData.AllGloves.Count(x => x.IsSelected), Waists = solverData.AllWaists.Count(x => x.IsSelected), Legs = solverData.AllLegs.Count(x => x.IsSelected), Charms = solverData.AllCharms.Count(x => x.IsSelected), }; if (solverData.AllJewels.Length > 0) { metrics.MinSlotSize = solverData.AllJewels.Min(x => x.Jewel.SlotSize); metrics.MaxSlotSize = solverData.AllJewels.Max(x => x.Jewel.SlotSize); } else { metrics.MinSlotSize = 0; metrics.MaxSlotSize = 0; } metrics.UpdateCombinationCount(); SearchMetrics = metrics; /*************************************************************/ UpdateAdvancedSearch(); rawFoundArmorSets = null; }