private void UpdateArtifactsEquipmentTab(List <Artifact> artifacts) { if (artifacts is not null) { artifacts = artifacts.ReorderItemsInList(); foreach (var artifact in artifacts) { // If the current Artifact is equipped, and its count is equal to 1 (so the only available Artifact is equipped), skip it // Otherwise, we'll create the block but with quantity of one less. if (User.Instance.CurrentHero.EquippedArtifacts.Contains(artifact) && artifact.Quantity == 1) { continue; } var border = new Border { Name = "Artifact" + artifact.Id + "ItemBorder", BorderThickness = new Thickness(2), BorderBrush = (SolidColorBrush)FindResource("BrushBlack"), Background = (SolidColorBrush)FindResource("BrushAccent1"), Padding = new Thickness(6), Margin = new Thickness(2), Tag = artifact, CornerRadius = new CornerRadius(3) }; border.PreviewMouseUp += ItemBorder_TryToEquip; var toolTip = ItemToolTipHelper.GenerateItemToolTip(artifact); border.ToolTip = toolTip; var grid = CreateArtifactGrid(artifact, User.Instance.CurrentHero.EquippedArtifacts.Contains(artifact)); border.Child = grid; ArtifactsPanel.Children.Add(border); } // Toggle ScrollBar visibility based on how many elements there are. if (ArtifactsPanel.Children.Count > InterfaceHelper.EquipmentItemsNeededToShowScrollBar || ArtifactsPanel.Children.Count > InterfaceHelper.EquipmentItemsNeededToShowScrollBarIfArtifactsAreEquipped && User.Instance.CurrentHero.EquippedArtifacts.Count > 0) { ArtifactsScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; } else { ArtifactsScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; } } }
private void UpdateRecipesEquipmentTab(List <Recipe> recipes) { if (recipes is not null) { recipes = recipes.ReorderItemsInList(); foreach (var recipe in recipes) { var border = new Border { BorderThickness = new Thickness(2), BorderBrush = (SolidColorBrush)FindResource("BrushBlack"), Background = (SolidColorBrush)FindResource("BrushAccent1"), Padding = new Thickness(6), Margin = new Thickness(2), Tag = recipe, CornerRadius = new CornerRadius(3) }; border.PreviewMouseUp += ItemBorder_TryToEquip; var toolTip = ItemToolTipHelper.GenerateItemToolTip(recipe); border.ToolTip = toolTip; var grid = CreateSingleItemGrid(recipe); border.Child = grid; RecipesPanel.Children.Add(border); } // Toggle ScrollBar visibility based on how many elements there are. if (RecipesPanel.Children.Count > InterfaceHelper.EquipmentItemsNeededToShowScrollBar) { RecipesScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; } else { RecipesScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; } } }
public void GenerateRewardsInterface() { foreach (var rewardPattern in _quest.QuestRewardPatterns) { var panel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 0, 5) }; var rewardIcon = new PackIcon { Width = 30, Height = 30, VerticalAlignment = VerticalAlignment.Center }; var rewardText = new TextBlock { FontSize = 22, VerticalAlignment = VerticalAlignment.Center }; ToolTip toolTip = null; SolidColorBrush rewardColor = null; switch (rewardPattern.QuestRewardType) { case RewardType.Material: var material = GameAssets.Materials.FirstOrDefault(x => x.Id == rewardPattern.QuestRewardId); toolTip = ItemToolTipHelper.GenerateItemToolTip(material); rewardIcon.Kind = PackIconKind.Cog; rewardText.Text = $"{rewardPattern.Quantity}x {material.Name}"; rewardColor = ColorsHelper.GetRarityColor(material.Rarity); break; case RewardType.Recipe: var recipe = GameAssets.Recipes.FirstOrDefault(x => x.Id == rewardPattern.QuestRewardId); toolTip = ItemToolTipHelper.GenerateItemToolTip(recipe); rewardIcon.Kind = PackIconKind.ScriptText; rewardText.Text = $"{rewardPattern.Quantity}x {recipe.Name}"; rewardColor = ColorsHelper.GetRarityColor(recipe.Rarity); break; case RewardType.Artifact: var artifact = GameAssets.Artifacts.FirstOrDefault(x => x.Id == rewardPattern.QuestRewardId); toolTip = ItemToolTipHelper.GenerateItemToolTip(artifact); rewardIcon.Kind = PackIconKind.DiamondStone; rewardText.Text = $"{rewardPattern.Quantity}x {artifact.Name}"; rewardColor = ColorsHelper.GetRarityColor(artifact.Rarity); break; case RewardType.Blessing: var blessing = GameAssets.Blessings.FirstOrDefault(x => x.Id == rewardPattern.QuestRewardId); toolTip = ItemToolTipHelper.GenerateBlessingToolTip(blessing); rewardIcon.Kind = PackIconKind.BookCross; rewardText.Text = $"{blessing.Name}"; rewardColor = ColorsHelper.GetRarityColor(blessing.Rarity); break; case RewardType.Ingot: var ingot = GameAssets.Ingots.FirstOrDefault(x => x.Id == rewardPattern.QuestRewardId); toolTip = ItemToolTipHelper.GenerateCurrencyToolTip <Ingot>((int)ingot.Rarity); rewardIcon.Kind = PackIconKind.Gold; rewardText.Text = $"{rewardPattern.Quantity}x {ingot.Name}"; rewardColor = ColorsHelper.GetRarityColor(ingot.Rarity); break; } rewardIcon.Foreground = rewardColor; rewardText.Foreground = rewardColor; panel.Children.Add(rewardIcon); panel.Children.Add(rewardText); panel.ToolTip = toolTip; RewardsPanel.Children.Add(panel); } }
public void RefreshEquippedArtifacts() { if (User.Instance.CurrentHero is null) { return; } // Add "Equipped" block. var equippedTextBlock = new TextBlock { Text = "Equipped", FontSize = 20, TextAlignment = TextAlignment.Center, FontFamily = (FontFamily)FindResource("FontRegularItalic"), Margin = new Thickness(5) }; ArtifactsPanel.Children.Insert(0, equippedTextBlock); // Add separator between equipped and not-equipped Artifacts. var separator = new Separator { Height = 2, Width = 200, Margin = new Thickness(10) }; ArtifactsPanel.Children.Insert(1, separator); if (User.Instance.CurrentHero.EquippedArtifacts.Count == 0) { var noArtifactsEquippedTextBlock = new TextBlock { Text = "You have no Artifacts equipped in this set\nEquip Artifacts by clicking them in this tab", FontSize = 16, TextAlignment = TextAlignment.Center, FontFamily = (FontFamily)FindResource("FontRegularItalic"), Margin = new Thickness(5), TextWrapping = TextWrapping.Wrap }; ArtifactsPanel.Children.Insert(1, noArtifactsEquippedTextBlock); return; } var equippedArtifacts = User.Instance.CurrentHero.EquippedArtifacts; // Add Equipped Artifacts borders (no quantity) with a different style. for (var i = 0; i < User.Instance.CurrentHero.EquippedArtifacts.Count; i++) { var equippedArtifact = equippedArtifacts[i]; var border = new Border { Name = "EquippedArtifact" + equippedArtifact.Id + "ItemBorder", BorderThickness = new Thickness(2), BorderBrush = (SolidColorBrush)FindResource("BrushBlack"), Background = (SolidColorBrush)FindResource("BrushAccent3"), Padding = new Thickness(6), Margin = new Thickness(2), Tag = equippedArtifact }; border.PreviewMouseUp += ItemBorder_TryToEquip; var toolTip = ItemToolTipHelper.GenerateItemToolTip(equippedArtifact); border.ToolTip = toolTip; var grid = CreateEquippedArtifactGrid(equippedArtifact); border.Child = grid; ArtifactsPanel.Children.Insert(1 + i, border); } }
private void GenerateRegionInfoPanel(Region region) { InfoPanel.Children.Clear(); var regionNameBlock = new TextBlock { Text = region.Name, FontSize = 26, FontFamily = (FontFamily)FindResource("FontFancy"), TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; var levelRequirementBlock = new TextBlock { Text = "Level Requirement: " + region.LevelRequirement, FontSize = 20, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; var descriptionBlock = new TextBlock { Text = region.Description, FontSize = 18, TextAlignment = TextAlignment.Justify, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), TextWrapping = TextWrapping.Wrap, FontFamily = (FontFamily)FindResource("FontFancy") }; var separator = new Separator { Height = 2, Width = 400, Margin = new Thickness(30) }; InfoPanel.Children.Add(regionNameBlock); InfoPanel.Children.Add(levelRequirementBlock); InfoPanel.Children.Add(descriptionBlock); InfoPanel.Children.Add(separator); var sortedMonsterPatterns = region.MonsterSpawnPatterns.OrderByDescending(x => GameAssets.BestiaryEntries.Any(y => y.Id == x.MonsterId && y.EntryType == BestiaryEntryType.Monster)).ThenByDescending(z => z.Frequency); foreach (var monsterPattern in sortedMonsterPatterns) { var monster = monsterPattern.Monster; var monsterDiscovered = GameAssets.BestiaryEntries.Any(x => x.Id == monster.Id && x.EntryType == BestiaryEntryType.Monster); var monsterNameBlock = new TextBlock { FontSize = 22, FontFamily = (FontFamily)FindResource("FontFancy"), TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; if (!monsterDiscovered) { monsterNameBlock.Text = "Unknown Monster"; monsterNameBlock.ToolTip = GeneralToolTipHelper.GenerateUndiscoveredEnemyToolTip(); } else { monsterNameBlock.Text = monster.Name; } InfoPanel.Children.Add(monsterNameBlock); if (!monsterDiscovered) { var monsterSeparator = new Separator { Height = 2, Width = 200, Margin = new Thickness(10) }; InfoPanel.Children.Add(monsterSeparator); continue; } var monsterHealthBlock = new TextBlock { Text = "Health: " + monster.Health, FontSize = 16, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; InfoPanel.Children.Add(monsterHealthBlock); var monsterDescriptionBlock = new TextBlock { Text = monster.Description, FontSize = 16, TextAlignment = TextAlignment.Justify, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), TextWrapping = TextWrapping.Wrap }; InfoPanel.Children.Add(monsterDescriptionBlock); var lootLabelBlock = new TextBlock { Text = "Loot: ", FontSize = 18, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; InfoPanel.Children.Add(lootLabelBlock); var sortedLootPatterns = monster.MonsterLootPatterns.OrderByDescending(x => GameAssets.BestiaryEntries.Any(y => y.Id == x.MonsterLootId && y.EntryType == BestiaryEntryType.MonsterLoot)).ThenBy(y => y.Item.Rarity); foreach (var lootPattern in sortedLootPatterns) { var item = lootPattern.Item; var monsterLootDiscovered = GameAssets.BestiaryEntries.Any(x => x.Id == item.Id && x.RelatedEnemyId == monster.Id && x.EntryType == BestiaryEntryType.MonsterLoot); var itemNameBlock = new TextBlock { TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), Foreground = ColorsHelper.GetRarityColor(item.Rarity), FontSize = 16 }; if (!monsterLootDiscovered) { itemNameBlock.Text = "Unknown " + item.RarityString + " " + lootPattern.MonsterLootType; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularItalic"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateUndiscoveredItemToolTip(); } else { itemNameBlock.Text = item is Recipe recipe ? recipe.FullName : item.Name; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularBold"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateItemToolTip(item); } InfoPanel.Children.Add(itemNameBlock); } var itemSeparator = new Separator { Height = 2, Width = 200, Margin = new Thickness(15) }; InfoPanel.Children.Add(itemSeparator); } }
private void GenerateDungeonInfoPanel(Dungeon dungeon) { InfoPanel.Children.Clear(); var dungeonNameBlock = new TextBlock { Text = dungeon.Name, FontSize = 26, FontFamily = (FontFamily)FindResource("FontFancy"), TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; var dungeonGroupBlock = new TextBlock { Text = dungeon.DungeonGroup.Name, FontSize = 20, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), Foreground = ColorsHelper.GetRarityColor((Rarity)dungeon.DungeonGroupId) }; var descriptionBlock = new TextBlock { Text = dungeon.Description, FontSize = 18, TextAlignment = TextAlignment.Justify, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), TextWrapping = TextWrapping.Wrap, FontFamily = (FontFamily)FindResource("FontFancy") }; var separator = new Separator { Height = 2, Width = 400, Margin = new Thickness(30) }; InfoPanel.Children.Add(dungeonNameBlock); InfoPanel.Children.Add(dungeonGroupBlock); InfoPanel.Children.Add(descriptionBlock); InfoPanel.Children.Add(separator); var sortedBosses = GameAssets.Bosses.Where(x => dungeon.BossIds.Contains(x.Id)).OrderByDescending(y => GameAssets.BestiaryEntries.Any(z => z.Id == y.Id && z.EntryType == BestiaryEntryType.Boss)); foreach (var boss in sortedBosses) { var bossDiscovered = GameAssets.BestiaryEntries.Any(x => x.Id == boss.Id && x.EntryType == BestiaryEntryType.Boss); var bossNameBlock = new TextBlock { FontSize = 22, FontFamily = (FontFamily)FindResource("FontFancy"), TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; if (!bossDiscovered) { bossNameBlock.Text = "Unknown Boss"; bossNameBlock.ToolTip = GeneralToolTipHelper.GenerateUndiscoveredEnemyToolTip(); } else { bossNameBlock.Text = boss.Name; } InfoPanel.Children.Add(bossNameBlock); if (!bossDiscovered) { var bossSeparator = new Separator { Height = 2, Width = 200, Margin = new Thickness(10) }; InfoPanel.Children.Add(bossSeparator); continue; } var bossAffixesStrings = new List <string>(); foreach (var affix in boss.Affixes) { var affixString = string.Concat(affix.ToString().Select(x => char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' '); bossAffixesStrings.Add(affixString); } var bossAffixBlock = new TextBlock { Text = "Affixes: " + string.Join(" / ", bossAffixesStrings), FontSize = 16, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; InfoPanel.Children.Add(bossAffixBlock); var bossHealthBlock = new TextBlock { Text = "Health: " + boss.Health, FontSize = 16, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; InfoPanel.Children.Add(bossHealthBlock); var bossDescriptionBlock = new TextBlock { Text = boss.Description, FontSize = 16, TextAlignment = TextAlignment.Justify, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), TextWrapping = TextWrapping.Wrap }; InfoPanel.Children.Add(bossDescriptionBlock); var lootLabelBlock = new TextBlock { Text = "Loot: ", FontSize = 18, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5) }; InfoPanel.Children.Add(lootLabelBlock); var sortedLootPatterns = boss.BossLootPatterns.OrderByDescending(x => GameAssets.BestiaryEntries.Any(y => y.Id == x.BossLootId && y.EntryType == BestiaryEntryType.BossLoot)).ThenBy(z => z.Item?.Rarity); foreach (var lootPattern in sortedLootPatterns) { var item = lootPattern.Item; bool bossLootDiscovered; var itemNameBlock = new TextBlock { TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(5), FontSize = 16 }; // If item is null, then the LootPattern represents a Blessing. // Todo: rework this cringe if (item is null) { var blessing = GameAssets.Blessings.FirstOrDefault(x => x.Id == lootPattern.BossLootId); bossLootDiscovered = GameAssets.BestiaryEntries.Any(x => x.Id == blessing.Id && x.RelatedEnemyId == boss.Id && x.EntryType == BestiaryEntryType.BossLoot && x.LootType == RewardType.Blessing); itemNameBlock.Foreground = ColorsHelper.GetRarityColor(blessing.Rarity); if (!bossLootDiscovered) { itemNameBlock.Text = "Unknown " + blessing.RarityString + " " + lootPattern.BossLootType; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularItalic"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateUndiscoveredItemToolTip(); } else { itemNameBlock.Text = blessing.Name; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularBold"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateBlessingToolTip(blessing); } } else { bossLootDiscovered = GameAssets.BestiaryEntries.Any(x => x.Id == item.Id && x.RelatedEnemyId == boss.Id && x.EntryType == BestiaryEntryType.BossLoot && x.LootType == lootPattern.BossLootType); itemNameBlock.Foreground = ColorsHelper.GetRarityColor(item.Rarity); if (!bossLootDiscovered) { itemNameBlock.Text = "Unknown " + item.RarityString + " " + lootPattern.BossLootType; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularItalic"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateUndiscoveredItemToolTip(); } else { itemNameBlock.Text = item is Recipe recipe ? recipe.FullName : item.Name; itemNameBlock.FontFamily = (FontFamily)FindResource("FontRegularBold"); itemNameBlock.ToolTip = ItemToolTipHelper.GenerateItemToolTip(item); } } InfoPanel.Children.Add(itemNameBlock); } var itemSeparator = new Separator { Height = 2, Width = 200, Margin = new Thickness(15) }; InfoPanel.Children.Add(itemSeparator); } }