public void Initialize() { var baseInfo = _configRepository.GetItemConfig(); if (_baseInfo != null && _baseInfo.Equals(baseInfo)) { return; } _baseInfo = baseInfo; _equipmentFactory.Initialize(baseInfo.ItemBase, baseInfo.Category, baseInfo.ItemLevel); _itemBase = _equipmentFactory.GetBaseItem(); _affixes = new ObservableCollection <Affix>(_equipmentFactory.GetPossibleAffixes()); CraftingTree.ClearConditions(); CraftingTree.Initialize(); Condition = null; _selected = Tree.Tree[0].Value; Tree.UpdateTree(CraftingTree, _selected); OnPropertyChanged(nameof(Condition)); OnPropertyChanged(nameof(Tree)); }
private void OnNextClick(object sender, RoutedEventArgs e) { if (_currentControlIndex >= _controls.Count - 1) { return; } _controls[_currentControlIndex].OnClose(); _currentControlIndex++; SelectedStep = _controls[_currentControlIndex] as ContentControl; OnPropertyChanged(nameof(SelectedStep)); if (_controls[_currentControlIndex] == ItemList) { var baseInfo = BaseSelection.BaseInformation; var affixes = _equipmentFactory.GetPossibleAffixes(); var baseItem = _equipmentFactory.GetBaseItem(); ItemList.Initialize(affixes, baseItem, baseInfo); } else if (_controls[_currentControlIndex] == Crafting) { var itemList = ItemList.ItemPrototypes.ToList(); Crafting.Initialize(null, _equipmentFactory, _currencyFactory, itemList, BaseSelection.ItemCost); } else if (_controls[_currentControlIndex] == Results) { var currencySpent = -1; Results.Initialize(Crafting.MatchingItems, currencySpent); } OnPropertyChanged(nameof(IsReady)); }
private void UpdateAffixDescriptions() { if (SelectedBase == null) { AffixDescriptions = string.Empty; OnPropertyChanged(nameof(AffixDescriptions)); return; } StringBuilder builder = new StringBuilder(); _factory.Initialize(SelectedBase, Categories.IndexOf(_selectedCategory), ItemLevel); var affixes = _factory.GetPossibleAffixes(); var types = affixes.GroupBy(x => x.Type); var totalWeight = affixes.Sum(x => x.Weight); foreach (var type in types) { if (type.Key == "Meta") { continue; } builder.AppendLine(type.Key); var groups = type.GroupBy(x => x.Group); foreach (var group in groups) { var items = group.ToList(); builder.AppendLine("\t" + group.Key); if (items.Any(x => x.StatName2 != null && !x.StatName2.Contains("Dummy"))) { builder.AppendLine("\tStat 1: " + items[0].StatName1); builder.AppendLine("\tStat 2: " + items[0].StatName2); } if (items.Any(x => x.StatName3 != null && !x.StatName3.Contains("Dummy"))) { builder.AppendLine("\tStat 3: " + items[0].StatName3); } foreach (var item in items) { var chance = item.Weight / (float)totalWeight * 100; if (item.StatName2 != null && !item.StatName2.Contains("Dummy")) { builder.AppendLine("\t\tilvl: " + item.ILvl + "\tT" + item.Tier + "\t" + chance.ToString("0.###") + "%\t"); builder.AppendLine("\t\t\t\t\t" + item.StatMin1 + "-" + item.StatMax1); builder.AppendLine("\t\t\t\t\t" + item.StatMin2 + "-" + item.StatMax2); if (item.StatName3 != null && !item.StatName3.Contains("Dummy")) { builder.AppendLine("\t\t\t\t" + "ilvl: " + item.ILvl + "\t" + item.StatMin3 + " - " + item.StatMax3); } } else { builder.AppendLine("\t\tilvl: " + item.ILvl + "\tT" + item.Tier + "\t" + chance.ToString("0.###") + "%\t" + item.StatMin1 + "-" + item.StatMax1); } } } } AffixDescriptions = builder.ToString(); OnPropertyChanged(nameof(AffixDescriptions)); }