Example #1
0
        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();
        }
Example #2
0
        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();

            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();

            SearchResultsViewModel.ResetResults();
        }
Example #3
0
        public GroupedArmorSetHeaderViewModel(SearchResultsViewModel parent, IList <ArmorSetViewModel> items)
        {
            this.parent      = parent;
            SelectionCommand = new AnonymousCommand(OnSelection);

            foreach (EnumFlagViewModel <SearchResultsGrouping> flag in parent.GroupFlags)
            {
                if (flag.IsSet == false)
                {
                    continue;
                }

                switch (flag.EnumValue)
                {
                case SearchResultsGrouping.RequiredDecorations:
                    HasRequiredDecorations = true;
                    break;

                case SearchResultsGrouping.Defense:
                    HasDefense = true;
                    break;

                case SearchResultsGrouping.SpareSlots:
                    HasSpareSlots = true;
                    break;

                case SearchResultsGrouping.AdditionalSKills:
                    HasAdditionalSkills = true;
                    break;

                case SearchResultsGrouping.Resistances:
                    HasResistances = true;
                    break;
                }
            }

            ArmorSetViewModel source = items[0];

            Jewels = source.Jewels;

            AdditionalSkills = source.AdditionalSkills;

            SpareSlots = source.SpareSlots;

            TotalBaseDefense      = source.TotalBaseDefense;
            TotalMaxDefense       = source.TotalMaxDefense;
            TotalAugmentedDefense = source.TotalAugmentedDefense;

            TotalFireResistance    = source.TotalFireResistance;
            TotalWaterResistance   = source.TotalWaterResistance;
            TotalThunderResistance = source.TotalThunderResistance;
            TotalIceResistance     = source.TotalIceResistance;
            TotalDragonResistance  = source.TotalDragonResistance;

            Items = items;
        }
Example #4
0
        internal void WeaponSlotsChanged()
        {
            CreateSolverData();

            if (IsAutoSearch)
            {
                SearchResultsViewModel.SearchArmorSets();
            }

            if (loadoutManager != null)
            {
                loadoutManager.IsModified = true;
            }
        }
Example #5
0
        public RootViewModel()
        {
            SearchResultsViewModel = new SearchResultsViewModel(this);

            CloseApplicationCommand = new AnonymousCommand(OnCloseApplication);

            OpenSkillSelectorCommand          = new AnonymousCommand(OpenSkillSelector);
            AdvancedSearchCommand             = new AnonymousCommand(AdvancedSearch);
            OpenDecorationsOverrideCommand    = new AnonymousCommand(OpenDecorationsOverride);
            OpenEquipmentOverrideCommand      = new AnonymousCommand(OpenEquipmentOverride);
            OpenSearchResultProcessingCommand = new AnonymousCommand(OpenSearchResultProcessing);

            AboutCommand = new AnonymousCommand(OnAbout);

            SearchResultProcessing = new SearchResultProcessingViewModel(this);
            InParameters           = new InParametersViewModel(this);
            WeaponsContainer       = new WeaponsContainerViewModel(this);
            EquipmentOverride      = new EquipmentOverrideViewModel(this);

            SetupLocalization();

            Extensions = new ExtensionSelectorViewModel(this);
        }