Beispiel #1
0
        public void Add(OverlayItems item)
        {
            string PathValue = "";

            item.Position = GetId();

            OverlayItems.SimpleItem Item = item.Item;
            item._Legendary = new UniqueItem
            {
                ItemName          = "Unknown",
                LegendaryItemType = (UniqueItemType)Item.SNOItem.ItemType
            };

            PathValue = item.Legendary.LegendaryItemType.ToString();

            if (Item.ItemQuality == Controller.Enums.ItemQuality.Legendary)
            {
                if (UniqueItemsController.TryGet(Item.SNOItem.ActorName.ToLower()) != null)
                {
                    item._Legendary = UniqueItemsController.TryGet(Item.SNOItem.ActorName.ToLower());
                    PathValue       = item.Legendary.LegendaryItemType.ToString();

                    if (item.Legendary.LegendaryItemType == UniqueItemType.PlanLegendary_Smith)
                    {
                        PathValue = "PlanLegendary_Smith";
                    }
                }
            }

            else // Magic, Rare, White
            {
                item._Legendary.ItemName = ItemsTypesConversion.TryGet(((LegendaryItemsTypes)Item.SNOItem.ItemType).ToString());

                if (item._Legendary.LegendaryItemType.ToString().Contains("Generic"))
                {
                    PathValue = item.Legendary.ItemName;
                }
            }

            string Path           = UniqueItemsController.GetBaseItemName(Item.SNOItem.ActorName.ToLower());
            string ItemNamePath   = string.IsNullOrWhiteSpace(item._Legendary.Override) ? Path : Path + "_" + item._Legendary.Override;
            string ItemNamePather = (item._Legendary.LegendaryItemType == UniqueItemType.PlanLegendary_Smith) ? "SmithPlan" : ItemNamePath;

            item.PathType = Extensions.ItemImage(PathValue + "/" + ItemNamePather);

            Extensions.Execute.UIThread(() => itemsToAdd.Add(item));
        }
        public void PaintItem(OverlayItems Items, ushort ID)
        {
            OverlayItems.SimpleItem Item = Items.Item;

            Brush Color = TextColors.TryGet(Item.ItemQuality.ToString());

            UniqueItem Legendary = new UniqueItem {
                ItemName          = "Unknown",
                LegendaryItemType = (UniqueItemType)Item.SNOItem.ItemType
            };

            string PathType = Legendary.LegendaryItemType.ToString();

            if (Item.ItemQuality == Controller.Enums.ItemQuality.Legendary)
            {
                if (Item.SNOItem.SetItem)
                {
                    Color = TextColors.TryGet("Set");
                }

                if (UniqueItemsController.TryGet(Item.SNOItem.ActorName.ToLower()) != null)
                {
                    Legendary = UniqueItemsController.TryGet(Item.SNOItem.ActorName.ToLower());
                    PathType  = Legendary.LegendaryItemType.ToString();

                    if (Legendary.LegendaryItemType == UniqueItemType.PlanLegendary_Smith)
                    {
                        PathType = "PlanLegendary_Smith";
                    }
                }
            }

            else // Magic, Rare, White
            {
                Legendary.ItemName = ItemsTypesConversion.TryGet(((LegendaryItemsTypes)Item.SNOItem.ItemType).ToString());

                if (Legendary.LegendaryItemType.ToString().Contains("Generic"))
                {
                    PathType = Legendary.ItemName;
                }
            }

            Extensions.Execute.UIThread(() =>
            {
                Canvas xContainer = new Canvas {
                    Width = 370
                };
                Grid Container = new Grid {
                    Width = 370
                };

                Border Border = new Border {
                    Height = 64, BorderBrush = Transition.BorderBrush, BorderThickness = new Thickness(2), Opacity = 0.7
                };

                Grid NameContainerGrid = new Grid {
                    Height = 90, VerticalAlignment = VerticalAlignment.Center
                };

                StackPanel NameContainer = new StackPanel {
                    VerticalAlignment = VerticalAlignment.Center
                };
                StackPanel ItemContainer = new StackPanel {
                    Height = 90, Orientation = Orientation.Horizontal
                };

                Canvas Background = new Canvas {
                    Background = BackgroundGradient, Opacity = 1, Height = 59, Margin = new Thickness(1, 0, 0, 0)
                };

                StackPanel Image = new StackPanel {
                    Width = 85
                };
                StackPanel Name    = new StackPanel();
                TextBlock ItemName = new TextBlock {
                    FontFamily = Transition.FontFamily, VerticalAlignment = VerticalAlignment.Center, FontWeight = FontWeights.Normal,
                    Text       = Legendary.ItemName, Height = 25, FontSize = 18, Foreground = Color
                };

                StackPanel Ancient = new StackPanel {
                    Width = 4, Height = 60, Background = Brushes.Orange, Opacity = 0.5
                };
                string Path           = UniqueItemsController.GetBaseItemName(Item.SNOItem.ActorName.ToLower());
                string ItemNamePath   = string.IsNullOrWhiteSpace(Legendary.Override) ? Path : Path + "_" + Legendary.Override;
                string ItemNamePather = (Legendary.LegendaryItemType == UniqueItemType.PlanLegendary_Smith) ? "SmithPlan" : ItemNamePath;

                Image.Children.Add(new Image {
                    Source = Extensions.ItemImage(PathType + "/" + ItemNamePather), Width = 75, Height = 90
                });

                NameContainer.Children.Add(ItemName);

                if (Items.Account != null)
                {
                    TextBlock ItemNames = new TextBlock
                    {
                        FontFamily        = Transition.FontFamily,
                        VerticalAlignment = VerticalAlignment.Center,
                        FontWeight        = FontWeights.Normal,
                        Text       = Items.Account.Nickname,
                        Height     = 20,
                        FontSize   = 12.1,
                        Foreground = Items.Account.Foreground
                    };
                    NameContainer.Children.Add(ItemNames);
                }

                NameContainerGrid.Children.Add(NameContainer);
                Name.Children.Add(NameContainerGrid);

                if (Item.ShowAncient && Item.AncientItem)
                {
                    Border.BorderBrush = Color;
                    Ancient.Height     = 64;
                }

                ItemContainer.Children.Add(Image);
                ItemContainer.Children.Add(Name);

                Border.Child = Background;

                Container.Children.Add(Border);
                Container.Children.Add(ItemContainer);

                xContainer.Children.Add(Container);

                Elements.Children.Add(xContainer);

                xContainer.AnimateFade <Canvas>(0, 1, TimeSpan.FromSeconds(1));
                Active.Add(xContainer);
                Canvas.SetTop(xContainer, ID * 90);

                DeleteTimer(xContainer, Items.Transition, ID);
            });
        }