示例#1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null || !(value is Item) || ((Item)value).Id <= 0)
     {
         return(null);
     }
     else
     {
         return(Icons.AnIcon(((Item)value).IconPath));
     }
 }
示例#2
0
        public void Update()
        {
#if SILVERLIGHT
            string iconPrefix = "..";
#else
            string iconPrefix = "/Rawr.UI.WPF;component";
#endif
            if (talentData != null)
            {
                Brush b;
                if (Current == talentData.MaxPoints)
                {
                    b = new SolidColorBrush(Colors.Yellow);
                    OverlayImage.Source = Icons.NewBitmapImage(new Uri(iconPrefix + "/Images/icon-over-yellow.png", UriKind.Relative));
                }
                else
                {
                    if (CanPutPoints())
                    {
                        b = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
                    }
                    else
                    {
                        b = new SolidColorBrush(Colors.White);
                    }

                    if (Current > 0)
                    {
                        OverlayImage.Source = Icons.NewBitmapImage(new Uri(iconPrefix + "/Images/icon-over-green.png", UriKind.Relative));
                    }
                    else
                    {
                        OverlayImage.Source = Icons.NewBitmapImage(new Uri(iconPrefix + "/Images/icon-over-grey.png", UriKind.Relative));
                    }
                }

                RankLabel.Text       = string.Format("{0}/{1}", Current, talentData.MaxPoints);
                RankLabel.Foreground = b;

                //TalentImage.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(TalentImage_ImageFailed);
                //TalentImage.Source = Icons.TalentIcon(TalentTree.Class, TalentTree.TreeName, talentData.Name, Current > 0);
                TalentImage.Source = Icons.AnIcon(talentData.Icon);

                ToolTipService.SetToolTip(this, GetTooltipString());
                this.Visibility = Visibility.Visible;
            }
            else
            {
                this.Visibility = Visibility.Collapsed;
            }
        }
示例#3
0
        public void ItemImage_ImageFailed(object o, ExceptionRoutedEventArgs e)
        {
            ItemImage.ImageFailed -= new EventHandler <ExceptionRoutedEventArgs>(ItemImage_ImageFailed);
#if DEBUG
            //TalentImage_ImageFailed2(o, e); // Tell me what happened
            //TalentImage.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(TalentImage_ImageFailed2);
#endif
            // Getting the Image from the Armory failed, lets try another source
            if (itemInstance != null)
            {
                ItemImage.Source = Icons.AnIcon(ItemInstance.Item.IconPath);
            }
            else if (NonItemImageSource != null)
            {
                ItemImage.Source = Icons.AnIcon(NonItemImageSource);
            }
        }
示例#4
0
        public void character_CalculationsInvalidated(object sender, EventArgs e)
        {
            if (character != null)
            {
                TheItem = character[Slot];
                if (TheItem == null || TheItem.Item == null)
                {
                    IconImage.Source      = null;
                    EnchantButton.Content = "";
                    TinkerButton.Content  = "";
                    gear = null;
                    IconImageGem1.Source = null; GemButton1.IsEnabled = false; SetSocketColor(GemButton1, ItemSlot.None);
                    IconImageGem2.Source = null; GemButton2.IsEnabled = false; SetSocketColor(GemButton2, ItemSlot.None);
                    IconImageGem3.Source = null; GemButton3.IsEnabled = false; SetSocketColor(GemButton3, ItemSlot.None);
                }
                else
                {
                    IconImage.Source      = Icons.AnIcon(TheItem.Item.IconPath);
                    EnchantButton.Content = TheItem.Enchant.ShortName;
                    ReforgeButton.Content = TheItem.Reforging != null ? TheItem.Reforging.VeryShortName : "NR";
                    TinkerButton.Content  = TheItem.Tinkering.ShortName;
                    gear = TheItem;

                    Item eItem = new Item();
                    if (TheItem.Enchant != null)
                    {
                        eItem.Name    = TheItem.Enchant.Name;
                        eItem.Quality = ItemQuality.Temp;
                        eItem.Stats   = TheItem.Enchant.Stats;
                    }
                    enchant = eItem;

                    Item tItem = new Item();
                    if (TheItem.Tinkering != null)
                    {
                        tItem.Name    = TheItem.Tinkering.Name;
                        tItem.Quality = ItemQuality.Temp;
                        tItem.Stats   = TheItem.Tinkering.Stats;
                    }
                    tinkering = tItem;

                    Item rItem = new Item();
                    if (TheItem.Reforging != null)
                    {
                        rItem.Name    = TheItem.Reforging.ToString();
                        rItem.Quality = ItemQuality.Temp;
                    }
                    reforge = rItem;

                    // There are several special sockets, we need to account for them
                    int nonBSSocketCount = (TheItem.Item.SocketColor1 != ItemSlot.None ? 1 : 0)
                                           + (TheItem.Item.SocketColor2 != ItemSlot.None ? 1 : 0)
                                           + (TheItem.Item.SocketColor3 != ItemSlot.None ? 1 : 0);
                    bool BSSlot_Wrist = Slot == CharacterSlot.Wrist && Character.WristBlacksmithingSocketEnabled && (Character.PrimaryProfession == Profession.Blacksmithing || Character.SecondaryProfession == Profession.Blacksmithing);
                    bool BSSlot_Glove = Slot == CharacterSlot.Hands && Character.HandsBlacksmithingSocketEnabled && (Character.PrimaryProfession == Profession.Blacksmithing || Character.SecondaryProfession == Profession.Blacksmithing);
                    bool BSSlot_Waist = Slot == CharacterSlot.Waist && Character.WaistBlacksmithingSocketEnabled;
                    // If there is no gem socket there, hide the selector
                    GemButton1.IsEnabled = TheItem.Item.SocketColor1 != ItemSlot.None || (nonBSSocketCount == 0 && (BSSlot_Wrist || BSSlot_Glove || BSSlot_Waist));
                    GemButton2.IsEnabled = TheItem.Item.SocketColor2 != ItemSlot.None || (nonBSSocketCount == 1 && (BSSlot_Wrist || BSSlot_Glove || BSSlot_Waist));
                    GemButton3.IsEnabled = TheItem.Item.SocketColor3 != ItemSlot.None || (nonBSSocketCount == 2 && (BSSlot_Wrist || BSSlot_Glove || BSSlot_Waist));
                    // Use the Gem's image if it exists
                    IconImageGem1.Source = TheItem.Gem1 != null?Icons.AnIcon(TheItem.Gem1.IconPath) : null;

                    IconImageGem2.Source = TheItem.Gem2 != null?Icons.AnIcon(TheItem.Gem2.IconPath) : null;

                    IconImageGem3.Source = TheItem.Gem3 != null?Icons.AnIcon(TheItem.Gem3.IconPath) : null;

                    // Remove any previously registered Events that can be fired
                    ComparisonItemListGem1.SelectedItemsGemChanged -= new EventHandler(ComparisonItemListGem1_SelectedItemsGemChanged);
                    ComparisonItemListGem2.SelectedItemsGemChanged -= new EventHandler(ComparisonItemListGem2_SelectedItemsGemChanged);
                    ComparisonItemListGem3.SelectedItemsGemChanged -= new EventHandler(ComparisonItemListGem3_SelectedItemsGemChanged);
                    // Set up the selector so that it uses the right slot type
                    ComparisonItemListGem1.GemIndex = 1;
                    ComparisonItemListGem2.GemIndex = 2;
                    ComparisonItemListGem3.GemIndex = 3;
                    ComparisonItemListGem1.GemSlot  = GetProperGemSlot(TheItem.Item.SocketColor1);
                    ComparisonItemListGem2.GemSlot  = GetProperGemSlot(TheItem.Item.SocketColor2);
                    ComparisonItemListGem3.GemSlot  = GetProperGemSlot(TheItem.Item.SocketColor3);
                    // Update the socket colors
                    SetSocketColors();
                    // Set the Gem lists' selected items to the core item's gems
                    ComparisonItemListGem1.SelectedItem = TheItem.Gem1;
                    ComparisonItemListGem2.SelectedItem = TheItem.Gem2;
                    ComparisonItemListGem3.SelectedItem = TheItem.Gem3;
                    // Let the comp lists know they need to behave differently from a normal list
                    ComparisonItemListGem1.IsAnItemsGem = true;
                    ComparisonItemListGem2.IsAnItemsGem = true;
                    ComparisonItemListGem3.IsAnItemsGem = true;
                    // Register the Events that can be fired
                    ComparisonItemListGem1.SelectedItemsGemChanged += new EventHandler(ComparisonItemListGem1_SelectedItemsGemChanged);
                    ComparisonItemListGem2.SelectedItemsGemChanged += new EventHandler(ComparisonItemListGem2_SelectedItemsGemChanged);
                    ComparisonItemListGem3.SelectedItemsGemChanged += new EventHandler(ComparisonItemListGem3_SelectedItemsGemChanged);
                }
            }
        }
示例#5
0
        public void UpdateTooltip()
        {
            Item actualItem = null;

            if (ItemInstance != null)
            {
                actualItem = ItemInstance.Item;
            }
            else if (Item != null)
            {
                actualItem = Item;
            }
            else if (ItemSet != null)
            {
                NonItemTooltip();
                return;
            }
            else if (CurrentString != null && CurrentString != "")
            {
                NonItemTooltip();
                return;
            }
            else
            {
                RootLayout.Visibility = Visibility.Collapsed;
                return;
            }
            RootLayout.Visibility = Visibility.Visible;

            ItemName.Text       = ItemInstance != null ? ItemInstance.Name : (actualItem != null ? actualItem.Name : "");
            ItemName.Foreground = new SolidColorBrush(ColorForQuality(actualItem != null ? actualItem.Quality : ItemQuality.Common));

            #region Displaying Item Types
            var liTypes = new List <string>();

            if (actualItem != null && (actualItem.Type != ItemType.None || (actualItem.Type == ItemType.None &&
                                                                            (actualItem.Slot == ItemSlot.Back || actualItem.Slot == ItemSlot.Neck || actualItem.Slot == ItemSlot.Finger || actualItem.Slot == ItemSlot.Trinket))))
            {
                //if (Properties.GeneralSettings.Default.DisplayExtraItemInfo) {
                if (actualItem.ItemLevel > 0)
                {
                    liTypes.Add(string.Format("[{0}]", actualItem.ItemLevel));
                }

                liTypes.Add(string.Format("[{0}]", actualItem.Id));

                if (actualItem.Bind != BindsOn.None)
                {
                    liTypes.Add(string.Format("[{0}]", actualItem.Bind));
                }

                if (!string.IsNullOrEmpty(actualItem.SlotString))
                {
                    liTypes.Add(string.Format("[{0}]", actualItem.SlotString));
                }

                if (actualItem.Type != ItemType.None)
                {
                    liTypes.Add(string.Format("[{0}]", actualItem.Type));
                }
                //}
            }
            List2Panel(TypesPanel, liTypes, new SolidColorBrush(Colors.Gray), false);

            #endregion // Displaying Item Types

            #region Displaying Item Stats
            List <string> statsList       = new List <string>();
            List <string> unusedStatsList = new List <string>();
            if (Rawr.Properties.GeneralSettings.Default.DisplayUnusedStats)
            {
                statsList.Add("Used Stats:");
                unusedStatsList.Add("Unused Stats:");
            }

            if (actualItem != null)
            {
                // Pull the Actual Stats, including Random Suffix if it has one
                Stats stats = actualItem.Stats;
                if (ItemInstance != null && ItemInstance.RandomSuffixId != 0)
                {
                    stats = stats.Clone();
                    RandomSuffix.AccumulateStats(stats, actualItem, ItemInstance.RandomSuffixId);
                }
                // Relevant Stats
                Stats relevantStats = Calculations.GetRelevantStats(stats);
                var   nonzeroStats  = relevantStats.Values(x => x != 0);
                foreach (System.Reflection.PropertyInfo info in nonzeroStats.Keys)
                {
                    float value = nonzeroStats[info];
                    if (Stats.IsPercentage(info))
                    {
                        value *= 100;
                    }
                    value = (float)Math.Round(value * 100f) / 100f;
                    string text = string.Format("{0}{1}", value, Extensions.DisplayName(info));
                    statsList.Add(text);
                }
                if (actualItem.DPS > 0)
                {
                    float  dps  = (float)Math.Round(actualItem.DPS * 100f) / 100f;
                    string text = dps + " DPS";
                    statsList.Add(text);
                    text = actualItem.Speed + " Speed";
                    statsList.Add(text);
                }
                foreach (SpecialEffect effect in relevantStats.SpecialEffects())
                {
                    string text = effect.ToString();
                    statsList.Add(text);
                }
                // Irrelevant Stats
                Stats unusedStats        = stats - relevantStats;
                var   unusedNonzeroStats = unusedStats.Values(x => x != 0);
                foreach (System.Reflection.PropertyInfo info in unusedNonzeroStats.Keys)
                {
                    float value = unusedNonzeroStats[info];
                    if (Stats.IsPercentage(info))
                    {
                        value *= 100;
                    }
                    value = (float)Math.Round(value * 100f) / 100f;
                    string text = string.Format("{0}{1}", value, Extensions.DisplayName(info));
                    unusedStatsList.Add(text);
                }
                foreach (SpecialEffect effect in unusedStats.SpecialEffects())
                {
                    string text = effect.ToString();
                    unusedStatsList.Add(text);
                }
            }
            if (statsList.Count > 1 || !Rawr.Properties.GeneralSettings.Default.DisplayUnusedStats)
            {
                if (unusedStatsList.Count <= 1 && Rawr.Properties.GeneralSettings.Default.DisplayUnusedStats)
                {
                    // Take off the "Used Stats" statement, we dont need to differentiate
                    statsList.RemoveAt(0);
                }
                List2Panel(StatPanel, statsList, null, true);
            }
            else
            {
                StatPanel.Children.Clear();
            }
            if (Rawr.Properties.GeneralSettings.Default.DisplayUnusedStats && unusedStatsList.Count > 1)
            {
                List2Panel(UnusedStatPanel, unusedStatsList, new SolidColorBrush(Colors.Gray), true);
            }
            else
            {
                UnusedStatPanel.Children.Clear();
            }
            #endregion

            #region Displaying Item Sets

            if (actualItem != null && actualItem.SetName != null && actualItem.SetName != "")
            {
                SetLabel.Text       = string.Format("Set: {0}", actualItem.SetName);
                SetLabel.Visibility = Visibility.Visible;
            }
            else
            {
                SetLabel.Text       = "";
                SetLabel.Visibility = Visibility.Collapsed;
            }

            #endregion

            #region Setting Up Gems
            bool hasGems = false;
            if (actualItem == null || actualItem.SocketColor1 == ItemSlot.None)
            {
                GemColor1.Visibility      = Visibility.Collapsed;
                GemImage1.Visibility      = Visibility.Collapsed;
                GemStat1.Visibility       = Visibility.Collapsed;
                GemNamesLabel1.Visibility = Visibility.Collapsed;
            }
            else
            {
                GemColor1.Visibility = Visibility.Visible;
                GemColor1.Background = new SolidColorBrush(ColorForGem(actualItem.SocketColor1));

                GemImage1.Visibility = Visibility.Visible;
                GemImage1.Source     = null;

                GemStat1.Visibility = Visibility.Visible;
                GemStat1.Children.Clear();
                GemNamesLabel1.Visibility = Visibility.Visible;
                hasGems = true;
            }
            if (actualItem == null || actualItem.SocketColor2 == ItemSlot.None)
            {
                GemColor2.Visibility      = Visibility.Collapsed;
                GemImage2.Visibility      = Visibility.Collapsed;
                GemStat2.Visibility       = Visibility.Collapsed;
                GemNamesLabel2.Visibility = Visibility.Collapsed;
            }
            else
            {
                GemColor2.Visibility = Visibility.Visible;
                GemColor2.Background = new SolidColorBrush(ColorForGem(actualItem.SocketColor2));

                GemImage2.Visibility = Visibility.Visible;
                GemImage2.Source     = null;

                GemStat2.Visibility = Visibility.Visible;
                GemStat2.Children.Clear();
                GemNamesLabel2.Visibility = Visibility.Visible;
                hasGems = true;
            }
            if (actualItem == null || actualItem.SocketColor3 == ItemSlot.None)
            {
                GemColor3.Visibility      = Visibility.Collapsed;
                GemImage3.Visibility      = Visibility.Collapsed;
                GemStat3.Visibility       = Visibility.Collapsed;
                GemNamesLabel3.Visibility = Visibility.Collapsed;
            }
            else
            {
                GemColor3.Visibility = Visibility.Visible;
                GemColor3.Background = new SolidColorBrush(ColorForGem(actualItem.SocketColor3));

                GemImage3.Visibility = Visibility.Visible;
                GemImage3.Source     = null;

                GemStat3.Visibility = Visibility.Visible;
                GemStat3.Children.Clear();
                GemNamesLabel3.Visibility = Visibility.Visible;
                hasGems = true;
            }
            if (hasGems)
            {
                GemStack.Visibility         = Visibility.Visible;
                SocketBonusLabel.Visibility = Visibility.Visible;
                SocketBonusLabel.Text       = "Socket Bonus: " + (actualItem.SocketBonus.ToString().Length == 0 ? "None" : actualItem.SocketBonus.ToString());
            }
            else
            {
                SocketBonusLabel.Visibility = Visibility.Collapsed;
            }
            #endregion

            #region Gem Sockets
            EnchantLabel.Visibility = Visibility.Collapsed;

            if (ItemInstance != null)
            {
                if (ItemInstance.EnchantId > 0 && ItemInstance.Enchant != null)
                {
                    EnchantLabel.Text       = /*ItemInstance.Enchant.Name + ": "
                                               + */Calculations.GetRelevantStats(ItemInstance.Enchant.Stats).ToString();
                    EnchantLabel.Visibility = Visibility.Visible;
                }
                if (ItemInstance.Gem1 != null)
                {
                    if (actualItem.SocketColor1 == ItemSlot.None)
                    {
                        GemColor1.Visibility = Visibility.Visible;
                        GemColor1.Background = new SolidColorBrush(ColorForGem(ItemSlot.Prismatic));
                        GemImage1.Visibility = Visibility.Visible;
                        GemImage1.Source     = null;
                        GemStat1.Visibility  = Visibility.Visible;
                        GemStat1.Children.Clear();
                        hasGems = true;
                    }
                    GemImage1.Source = Icons.AnIcon(ItemInstance.Gem1.IconPath);
                    foreach (string s in Calculations.GetRelevantStats(ItemInstance.Gem1.Stats).ToString().Split(','))
                    {
                        string    r = s.Contains("Armor Penetration") ? s.Replace("Armor Penetration", "ArP") : s;
                        TextBlock t = new TextBlock();
                        t.Text = r.Trim();
                        GemStat1.Children.Add(t);
                    }
                    GemNamesLabel1.Text = "- " + ItemInstance.Gem1.Name;
                }
                if (ItemInstance.Gem2 != null)
                {
                    if (actualItem.SocketColor2 == ItemSlot.None)
                    {
                        GemColor2.Visibility = Visibility.Visible;
                        GemColor2.Background = new SolidColorBrush(ColorForGem(ItemSlot.Prismatic));
                        GemImage2.Visibility = Visibility.Visible;
                        GemImage2.Source     = null;
                        GemStat2.Visibility  = Visibility.Visible;
                        GemStat2.Children.Clear();
                        hasGems = true;
                    }
                    GemImage2.Source = Icons.AnIcon(ItemInstance.Gem2.IconPath);
                    foreach (string s in Calculations.GetRelevantStats(ItemInstance.Gem2.Stats).ToString().Split(','))
                    {
                        string    r = s.Contains("Armor Penetration") ? s.Replace("Armor Penetration", "ArP") : s;
                        TextBlock t = new TextBlock();
                        t.Text = r.Trim();
                        GemStat2.Children.Add(t);
                    }
                    GemNamesLabel2.Text = "- " + ItemInstance.Gem2.Name;
                }
                if (ItemInstance.Gem3 != null)
                {
                    if (actualItem.SocketColor3 == ItemSlot.None)
                    {
                        GemColor3.Visibility = Visibility.Visible;
                        GemColor3.Background = new SolidColorBrush(ColorForGem(ItemSlot.Prismatic));
                        GemImage3.Visibility = Visibility.Visible;
                        GemImage3.Source     = null;
                        GemStat3.Visibility  = Visibility.Visible;
                        GemStat3.Children.Clear();
                        hasGems = true;
                    }
                    GemImage3.Source = Icons.AnIcon(ItemInstance.Gem3.IconPath);
                    foreach (string s in Calculations.GetRelevantStats(ItemInstance.Gem3.Stats).ToString().Split(','))
                    {
                        string    r = s.Contains("Armor Penetration") ? s.Replace("Armor Penetration", "ArP") : s;
                        TextBlock t = new TextBlock();
                        t.Text = r.Trim();
                        GemStat3.Children.Add(t);
                    }
                    GemNamesLabel3.Text = "- " + ItemInstance.Gem3.Name;
                }
                if (actualItem != null && (!Item.GemMatchesSlot(itemInstance.Gem1, actualItem.SocketColor1) ||
                                           !Item.GemMatchesSlot(itemInstance.Gem2, actualItem.SocketColor2) ||
                                           !Item.GemMatchesSlot(itemInstance.Gem3, actualItem.SocketColor3)))
                {
                    SocketBonusLabel.Foreground = new SolidColorBrush(Colors.Gray);
                }
                else
                {
                    SocketBonusLabel.Foreground = new SolidColorBrush(Colors.Black);
                }
            }
            #endregion

            #region Reforging
#if RAWR4
            if (ItemInstance != null && ItemInstance.Reforging != null && ItemInstance.Reforging.ReforgeAmount > 0)
            {
                ReforgingLabel.Text       = string.Format("Reforge {0} {1} → {2}", ItemInstance.Reforging.ReforgeAmount, Extensions.SpaceCamel(ItemInstance.Reforging.ReforgeFrom.ToString()), Extensions.SpaceCamel(ItemInstance.Reforging.ReforgeTo.ToString()));
                ReforgingLabel.Visibility = Visibility.Visible;
            }
            else
            {
                ReforgingLabel.Visibility = Visibility.Collapsed;
            }
#endif
            #endregion

            #region Location Section
            // the actualItem.Id check to make sure it's an item, not a reforging or something
            if (actualItem != null && actualItem.Id > 0 && actualItem.Id < (int)AvailableItemIDModifiers.Reforges)
            {
                if (/*actualItem.LocationInfo != null &&*/
                    /*actualItem.LocationInfo.Count > 0 &&*/
                    ((LocationLabel.Text = actualItem.GetFullLocationDesc) != ""))
                {
                    LocationLabel.Visibility = Visibility.Visible;
                }
                else
                {
                    LocationLabel.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                LocationLabel.Visibility = Visibility.Collapsed;
            }
            #endregion

            #region Additional Items, like in Build Upgrade List
            ItemsGrid.Children.Clear();
            ItemsGrid.RowDefinitions.Clear();
            if (CharacterItems == null || CharacterItems.Length == 0)
            {
                ItemsGrid.Visibility = Visibility.Collapsed;
            }
            else
            {
                ItemsGrid.Visibility = Visibility.Visible;
                int row = 0;
                foreach (ItemInstance characterItem in CharacterItems)
                {
                    ItemsGrid.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });

                    if (characterItem == null)
                    {
                        continue;
                    }
                    Image iconImage = new Image();
                    iconImage.Style  = Resources["SmallIconStyle"] as Style;
                    iconImage.Source = Icons.AnIcon(characterItem.Item.IconPath);
                    Grid.SetColumn(iconImage, 0);
                    Grid.SetRow(iconImage, row);
                    ItemsGrid.Children.Add(iconImage);

                    if (characterItem.Gem1Id > 0)
                    {
                        Image gem1Image = new Image();
                        gem1Image.Style  = Resources["SmallIconStyle"] as Style;
                        gem1Image.Source = Icons.AnIcon(characterItem.Gem1.IconPath);
                        Grid.SetColumn(gem1Image, 1);
                        Grid.SetRow(gem1Image, row);
                        ItemsGrid.Children.Add(gem1Image);
                    }

                    if (characterItem.Gem2Id > 0)
                    {
                        Image gem2Image = new Image();
                        gem2Image.Style  = Resources["SmallIconStyle"] as Style;
                        gem2Image.Source = Icons.AnIcon(characterItem.Gem2.IconPath);
                        Grid.SetColumn(gem2Image, 2);
                        Grid.SetRow(gem2Image, row);
                        ItemsGrid.Children.Add(gem2Image);
                    }

                    if (characterItem.Gem3Id > 0)
                    {
                        Image gem3Image = new Image();
                        gem3Image.Style  = Resources["SmallIconStyle"] as Style;
                        gem3Image.Source = Icons.AnIcon(characterItem.Gem3.IconPath);
                        Grid.SetColumn(gem3Image, 3);
                        Grid.SetRow(gem3Image, row);
                        ItemsGrid.Children.Add(gem3Image);
                    }

                    TextBlock nameText = new TextBlock();
                    if (characterItem.EnchantId > 0)
                    {
                        nameText.Text = string.Format("{0} ({1})", characterItem.Item.Name, characterItem.Enchant.Name);
                    }
                    else
                    {
                        nameText.Text = string.Format("{0}", characterItem.Item.Name);
                    }
                    nameText.Foreground = new SolidColorBrush(ColorForQuality(characterItem.Item.Quality));
                    Grid.SetColumn(nameText, 4);
                    Grid.SetRow(nameText, row);
                    ItemsGrid.Children.Add(nameText);

                    row++;
                }
            }
            #endregion
        }
示例#6
0
        private void NonItemTooltip()
        {
            RootLayout.Visibility = Visibility.Visible;
            try {
                string Title = CurrentString.Split('|')[0].Trim();
                string Desc  = CurrentString.Split('|')[1].Trim();

                ItemName.Text       = Title;
                ItemName.Foreground = new SolidColorBrush(Colors.Purple);

                // Hide Item related fields
                TypesPanel.Visibility       = Visibility.Collapsed;
                StatPanel.Visibility        = Visibility.Collapsed;
                GemStack.Visibility         = Visibility.Collapsed;
                GemNamesLabel1.Visibility   = Visibility.Collapsed;
                GemNamesLabel2.Visibility   = Visibility.Collapsed;
                GemNamesLabel3.Visibility   = Visibility.Collapsed;
                SocketBonusLabel.Visibility = Visibility.Collapsed;
                EnchantLabel.Visibility     = Visibility.Collapsed;
                ReforgingLabel.Visibility   = Visibility.Collapsed;
                SetLabel.Visibility         = Visibility.Collapsed;
                UnusedStatPanel.Visibility  = Visibility.Collapsed;

                LocationLabel.Visibility = Visibility.Visible;
                LocationLabel.Text       = Desc;

                if (ItemSet != null && ItemSet.Count > 0)
                {
                    ItemsGrid.Visibility = Visibility.Visible;
                    #region Additional Items, like in Build Upgrade List
                    ItemsGrid.Children.Clear();
                    ItemsGrid.RowDefinitions.Clear();
                    int row = 0;
                    foreach (ItemInstance setItem in ItemSet)
                    {
                        ItemsGrid.RowDefinitions.Add(new RowDefinition()
                        {
                            Height = GridLength.Auto
                        });
                        if (setItem == null)
                        {
                            continue;
                        }

                        Image iconImage = new Image();
                        iconImage.Style  = Resources["SmallIconStyle"] as Style;
                        iconImage.Source = Icons.AnIcon(setItem.Item.IconPath);
                        Grid.SetColumn(iconImage, 0);
                        Grid.SetRow(iconImage, row);
                        ItemsGrid.Children.Add(iconImage);

                        if (setItem.Gem1Id > 0)
                        {
                            Image gem1Image = new Image();
                            gem1Image.Style  = Resources["SmallIconStyle"] as Style;
                            gem1Image.Source = Icons.AnIcon(setItem.Gem1.IconPath);
                            Grid.SetColumn(gem1Image, 1);
                            Grid.SetRow(gem1Image, row);
                            ItemsGrid.Children.Add(gem1Image);
                        }

                        if (setItem.Gem2Id > 0)
                        {
                            Image gem2Image = new Image();
                            gem2Image.Style  = Resources["SmallIconStyle"] as Style;
                            gem2Image.Source = Icons.AnIcon(setItem.Gem2.IconPath);
                            Grid.SetColumn(gem2Image, 2);
                            Grid.SetRow(gem2Image, row);
                            ItemsGrid.Children.Add(gem2Image);
                        }

                        if (setItem.Gem3Id > 0)
                        {
                            Image gem3Image = new Image();
                            gem3Image.Style  = Resources["SmallIconStyle"] as Style;
                            gem3Image.Source = Icons.AnIcon(setItem.Gem3.IconPath);
                            Grid.SetColumn(gem3Image, 3);
                            Grid.SetRow(gem3Image, row);
                            ItemsGrid.Children.Add(gem3Image);
                        }

                        TextBlock nameText = new TextBlock();
                        if (setItem.EnchantId > 0)
                        {
                            nameText.Text = string.Format("{0} ({1})", setItem.Item.Name, setItem.Enchant.Name);
                        }
                        else
                        {
                            nameText.Text = string.Format("{0}", setItem.Item.Name);
                        }
                        nameText.Foreground = new SolidColorBrush(ColorForQuality(setItem.Item.Quality));
                        Grid.SetColumn(nameText, 4);
                        Grid.SetRow(nameText, row);
                        ItemsGrid.Children.Add(nameText);

                        row++;
                    }
                    #endregion
                }
                else
                {
                    ItemsGrid.Visibility = Visibility.Collapsed;
                }
            } catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title        = "Error setting up a Non-Item Tooltip",
                    Function     = "NonItemTooltip()",
                    TheException = ex,
                }.Show();
            }
        }