Esempio n. 1
0
 private void AppendSpareSlotsGroup(ArmorSetViewModel result)
 {
     if (result.SpareSlots != null)
     {
         builder.Append($"{string.Join(",", result.SpareSlots)}:");
     }
 }
Esempio n. 2
0
        private void AppendAdditionalSkillsGroup(ArmorSetViewModel result)
        {
            string key = string.Join(
                ";",
                result.AdditionalSkills
                .Select(x => $"{x.Skill.Id},{x.TotalLevel}")
                );

            builder.Append($"{key}:");
        }
Esempio n. 3
0
        private void AppendJewelsGroup(ArmorSetViewModel result)
        {
            string key = string.Join(
                ";",
                result.Jewels
                .Select(x => $"{x.Jewel.Id},{x.Count}")
                );

            builder.Append($"{key}:");
        }
Esempio n. 4
0
        private void AppendDefenseGroup(ArmorSetViewModel result)
        {
            int baseDef = 0;
            int maxDef  = 0;
            int augDef  = 0;

            for (int i = 0; i < result.ArmorPieces.Count; i++)
            {
                if (result.ArmorPieces[i] == null)
                {
                    continue;
                }

                baseDef += result.ArmorPieces[i].Defense.Base;
                maxDef  += result.ArmorPieces[i].Defense.Max;
                augDef  += result.ArmorPieces[i].Defense.Augmented;
            }

            builder.Append($"{baseDef},{maxDef},{augDef}:");
        }
Esempio n. 5
0
        private void AppendResistancesGroup(ArmorSetViewModel result)
        {
            int fire    = 0;
            int water   = 0;
            int thunder = 0;
            int ice     = 0;
            int dragon  = 0;

            for (int i = 0; i < result.ArmorPieces.Count; i++)
            {
                if (result.ArmorPieces[i] == null)
                {
                    continue;
                }

                fire    += result.ArmorPieces[i].Resistances.Fire;
                water   += result.ArmorPieces[i].Resistances.Water;
                thunder += result.ArmorPieces[i].Resistances.Thunder;
                ice     += result.ArmorPieces[i].Resistances.Ice;
                dragon  += result.ArmorPieces[i].Resistances.Dragon;
            }

            builder.Append($"{fire},{water},{thunder},{ice},{dragon}:");
        }
Esempio n. 6
0
        private string CreateGroupKey(ArmorSetViewModel result)
        {
            if (grouping == SearchResultsGrouping.None)
            {
                return(null);
            }

            builder.Clear();

            if ((grouping & SearchResultsGrouping.RequiredDecorations) == SearchResultsGrouping.RequiredDecorations)
            {
                AppendJewelsGroup(result);
            }

            if ((grouping & SearchResultsGrouping.Defense) == SearchResultsGrouping.Defense)
            {
                AppendDefenseGroup(result);
            }

            if ((grouping & SearchResultsGrouping.AdditionalSKills) == SearchResultsGrouping.AdditionalSKills)
            {
                AppendAdditionalSkillsGroup(result);
            }

            if ((grouping & SearchResultsGrouping.SpareSlots) == SearchResultsGrouping.SpareSlots)
            {
                AppendSpareSlotsGroup(result);
            }

            if ((grouping & SearchResultsGrouping.Resistances) == SearchResultsGrouping.Resistances)
            {
                AppendResistancesGroup(result);
            }

            return(builder.ToString());
        }
Esempio n. 7
0
        public BitmapSource RenderToImage(ArmorSetViewModel searchResult, IEnumerable <int> weaponSlots)
        {
            var root = new StackPanel
            {
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true,
                Orientation         = Orientation.Horizontal,
            };

            root.Children.Add(new Rectangle
            {
                Fill   = Brushes.Transparent,
                Width  = 2.0,
                Height = 1.0
            });

            var weaponSlotsAndAbilities = new StackPanel
            {
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true,
            };

            var weaponSlotsPanel = new StackPanel
            {
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true,
                Orientation         = Orientation.Horizontal,
                Margin = new Thickness(4.0),
            };

            weaponSlotsPanel.Children.Add(new TextBlock
            {
                Text = "Weapon slots: ",
                VerticalAlignment = VerticalAlignment.Center
            });

            var factoryPanel = new FrameworkElementFactory(typeof(StackPanel));

            factoryPanel.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);

            if (weaponSlots.Any(x => x > 0))
            {
                weaponSlotsPanel.Children.Add(new ItemsControl
                {
                    ItemsSource       = weaponSlots,
                    Height            = 24.0,
                    VerticalAlignment = VerticalAlignment.Center,
                    ItemTemplate      = (DataTemplate)App.Current.FindResource("SlotImageView"),
                    ItemsPanel        = new ItemsPanelTemplate(factoryPanel)
                });
            }
            else
            {
                weaponSlotsPanel.Children.Add(new TextBlock
                {
                    Text = "none",
                    VerticalAlignment = VerticalAlignment.Center,
                    FontStyle         = FontStyles.Italic
                });
            }

            weaponSlotsAndAbilities.Children.Add(weaponSlotsPanel);

            weaponSlotsAndAbilities.Children.Add(new ItemsControl
            {
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true,
                VerticalAlignment   = VerticalAlignment.Top,
                ItemsSource         = searchResult.DesiredAbilities.Select(x => new AbilityViewModel(x, null)
                {
                    IsChecked = true
                }).ToArray(),
                ItemTemplate = (DataTemplate)App.Current.FindResource("SelectedAbilityView"),
                Margin       = new Thickness(4.0),
                Focusable    = false
            });

            root.Children.Add(weaponSlotsAndAbilities);

            root.Children.Add(new ContentControl
            {
                UseLayoutRounding   = true,
                SnapsToDevicePixels = true,
                Content             = searchResult,
                ContentTemplate     = (DataTemplate)App.Current.FindResource("SearchResultArmorSetView")
            });

            return(ServicesContainer.GetService <IRenderService>().RenderToImage(root));
        }