Ejemplo n.º 1
0
        /// <summary>
        /// Callback for highlighting a new item.
        /// Updates the text box on the main form.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">SackPanelEventArgs data</param>
        private void NewItemHighlightedCallback(object sender, SackPanelEventArgs e)
        {
            Item           item      = e.Item;
            SackCollection sack      = e.Sack;
            SackPanel      sackPanel = (SackPanel)sender;

            if (item == null)
            {
                // Only do something if this sack is the "owner" of the current item highlighted.
                if (sack == this.lastSackHighlighted)
                {
                    this.itemText.Text = string.Empty;

                    // hide the tooltip
                    ItemTooltip.HideTooltip();
                }
            }
            else
            {
                var itt = ItemTooltip.ShowTooltip(this, item, sackPanel);

                this.itemText.ForeColor = ItemGfxHelper.GetColor(itt.Data.Item, itt.Data.BaseItemInfoDescription);
                this.itemText.Text      = itt.Data.FullNameBagTooltip.RemoveAllTQTags();
            }

            this.lastSackHighlighted      = sack;
            this.lastSackPanelHighlighted = sackPanel;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Callback for highlighting a new item.
        /// Updates the text box on the main form.
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">SackPanelEventArgs data</param>
        private void NewItemHighlightedCallback(object sender, SackPanelEventArgs e)
        {
            Item           item      = e.Item;
            SackCollection sack      = e.Sack;
            SackPanel      sackPanel = (SackPanel)sender;

            if (item == null)
            {
                // Only do something if this sack is the "owner" of the current item highlighted.
                if (sack == this.lastSackHighlighted)
                {
                    this.itemText.Text = string.Empty;

                    // hide the tooltip
                    this.tooltipText = null;
                    this.tooltip.ChangeText(this.tooltipText);
                }
            }
            else
            {
                string text  = ItemProvider.ToFriendlyName(item);
                Color  color = ItemGfxHelper.GetColorTag(item, text);
                text = Item.ClipColorTag(text);
                this.itemText.ForeColor = color;
                this.itemText.Text      = text;

                string attributes = ItemHtmlHelper.GetAttributes(item, true);                 // true means hide uninteresting attributes
                string setitems   = ItemHtmlHelper.GetItemSetString(item);
                string reqs       = ItemHtmlHelper.GetRequirements(item);

                // combine the 2
                if (reqs.Length < 1)
                {
                    this.tooltipText = attributes;
                }
                else if (setitems.Length < 1)
                {
                    string reqTitle = HtmlHelper.MakeSafeForHtml("?Requirements?");
                    reqTitle = string.Format(CultureInfo.InvariantCulture, "<font size=+2 color={0}>{1}</font><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Potion)), reqTitle);
                    string separator = string.Format(CultureInfo.InvariantCulture, "<hr color={0}><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    this.tooltipText = string.Concat(attributes, separator, reqs);
                }
                else
                {
                    string reqTitle = HtmlHelper.MakeSafeForHtml("?Requirements?");
                    reqTitle = string.Format(CultureInfo.InvariantCulture, "<font size=+2 color={0}>{1}</font><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Potion)), reqTitle);
                    string separator1 = string.Format(CultureInfo.InvariantCulture, "<hr color={0}>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    string separator2 = string.Format(CultureInfo.InvariantCulture, "<hr color={0}><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    this.tooltipText = string.Concat(attributes, separator1, setitems, separator2, reqs);
                }

                // show tooltip
                this.tooltipText = string.Concat(HtmlHelper.TooltipBodyTag(Database.DB.Scale), this.tooltipText);
                this.tooltip.ChangeText(this.tooltipText);
            }

            this.lastSackHighlighted      = sack;
            this.lastSackPanelHighlighted = sackPanel;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the name of the item
        /// </summary>
        /// <param name="item">item being displayed</param>
        /// <returns>string with the item name</returns>
        private static string GetName(Item item)
        {
            string itemName = HtmlHelper.MakeSafeForHtml(ItemProvider.ToFriendlyName(item, true, false));
            string bgcolor  = "#2e1f15";

            Color color = ItemGfxHelper.GetColorTag(item, itemName);

            itemName = Item.ClipColorTag(itemName);
            itemName = string.Format(CultureInfo.InvariantCulture, "<font size=+1 color={0}><b>{1}</b></font>", HtmlHelper.HtmlColor(color), itemName);
            return(string.Format(CultureInfo.InvariantCulture, "<body bgcolor={0} text=white><font face=\"Albertus MT\" size=2>{1}", bgcolor, itemName));
        }
Ejemplo n.º 4
0
        public Result(string container, string containerName, int sackNumber, SackType sackType, Item item)
        {
            this.Container     = container ?? throw new ArgumentNullException(nameof(container));
            this.ContainerName = containerName ?? throw new ArgumentNullException(nameof(containerName));
            this.SackNumber    = sackNumber;
            this.SackType      = sackType;
            this.Item          = item ?? throw new ArgumentNullException(nameof(item));
            this.ItemName      = Entities.Item.ClipColorTag(ItemProvider.ToFriendlyName(item));
            ItemStyle computedItemStyle = item.ItemStyle;

            this.ItemStyle = ItemStyleHelper.Translate(computedItemStyle);
            this.Color     = ItemGfxHelper.GetColor(computedItemStyle);
            var requirementVariables = ItemProvider.GetRequirementVariables(item).Values;

            this.RequiredLevel = GetRequirement(requirementVariables, "levelRequirement");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the tooltip for the sack contents.
        /// </summary>
        /// <param name="button">Button number of the sack</param>
        /// <returns>string listing the sack's contents.</returns>
        private string GetSackToolTip(BagButtonBase button)
        {
            // Get the list of items and return them as a string
            SackCollection sack = this.Player.GetSack(button.ButtonNumber + this.BagPanelOffset);

            if (sack == null)
            {
                return(null);
            }

            if (sack.IsEmpty)
            {
                return(string.Format(CultureInfo.CurrentCulture, "{0}<b>{1}</b>", HtmlHelper.TooltipTitleTag(Database.DB.Scale), HtmlHelper.MakeSafeForHtml(Resources.VaultGroupBoxEmpty)));
            }

            StringBuilder toolTipStringBuilder = new StringBuilder();

            toolTipStringBuilder.Append(HtmlHelper.TooltipTitleTag(Database.DB.Scale));
            bool first = true;

            foreach (Item item in sack)
            {
                if (this.DragInfo.IsActive && item == this.DragInfo.Item)
                {
                    // skip the item being dragged
                    continue;
                }

                if (!first)
                {
                    toolTipStringBuilder.Append("<br>");
                }

                first = false;
                string itemString = HtmlHelper.MakeSafeForHtml(ItemProvider.ToFriendlyName(item));
                Color  color      = ItemGfxHelper.GetColorTag(item, itemString);
                itemString = Item.ClipColorTag(itemString);
                string htmlcolor = HtmlHelper.HtmlColor(color);
                string htmlLine  = string.Format(CultureInfo.CurrentCulture, "<font color={0}><b>{1}</b></font>", htmlcolor, itemString);
                toolTipStringBuilder.Append(htmlLine);
            }

            return(toolTipStringBuilder.ToString());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns a string containing the tool tip text for the highlighted result.
        /// </summary>
        /// <param name="selectedResult">Currently selected Result</param>
        /// <returns>String containing the tool tip for the Result.</returns>
        private string GetToolTip(Result selectedResult)
        {
            if (selectedResult == null || selectedResult.Item == null)
            {
                // hide the tooltip
                this.tooltipText = null;
                ////this.tooltip.ChangeText(this.tooltipText);
            }
            else
            {
                string attributes = ItemHtmlHelper.GetAttributes(selectedResult.Item, true);                 // true means hide uninteresting attributes
                string setitems   = ItemHtmlHelper.GetItemSetString(selectedResult.Item);
                string reqs       = ItemHtmlHelper.GetRequirements(selectedResult.Item);

                // combine the 2
                if (reqs.Length < 1)
                {
                    this.tooltipText = attributes;
                }
                else if (setitems.Length < 1)
                {
                    string reqTitle = HtmlHelper.MakeSafeForHtml("?Requirements?");
                    reqTitle = string.Format(CultureInfo.InvariantCulture, "<font size=+2 color={0}>{1}</font><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Potion)), reqTitle);
                    string separator = string.Format(CultureInfo.InvariantCulture, "<hr color={0}><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    this.tooltipText = string.Concat(attributes, separator, reqs);
                }
                else
                {
                    string reqTitle = HtmlHelper.MakeSafeForHtml("?Requirements?");
                    reqTitle = string.Format(CultureInfo.InvariantCulture, "<font size=+2 color={0}>{1}</font><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Potion)), reqTitle);
                    string separator1 = string.Format(CultureInfo.InvariantCulture, "<hr color={0}>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    string separator2 = string.Format(CultureInfo.InvariantCulture, "<hr color={0}><br>", HtmlHelper.HtmlColor(ItemGfxHelper.GetColor(ItemStyle.Broken)));
                    this.tooltipText = string.Concat(attributes, separator1, setitems, separator2, reqs);
                }

                // show tooltip
                this.tooltipText = string.Concat(HtmlHelper.TooltipBodyTag(Database.DB.Scale), this.tooltipText);
                ////this.tooltip.ChangeText(this.tooltipText);
            }

            return(this.tooltipText);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the tooltip for a sack.  Summarizes the items within the sack
        /// </summary>
        /// <param name="button">button the mouse is over.  Corresponds to a sack</param>
        /// <returns>string to be displayed in the tooltip</returns>
        private string GetSackToolTip(BagButtonBase button)
        {
            // Get the list of items and return them as a string
            int            bagID = button.ButtonNumber;
            SackCollection sack;

            if (bagID == 0)
            {
                if (this.Player == null)
                {
                    sack = null;
                }
                else
                {
                    sack = this.Player.EquipmentSack;
                }
            }
            else if (bagID == 1)
            {
                sack = this.transferStash.Sack;
            }
            else if (bagID == 2)
            {
                sack = this.stash.Sack;
            }
            else
            {
                sack = this.relicVaultStash.Sack;
            }

            if (sack == null || sack.IsEmpty)
            {
                return(null);
            }

            StringBuilder answer = new StringBuilder();

            answer.Append(HtmlHelper.TooltipTitleTag(Database.DB.Scale));
            bool first = true;

            foreach (Item item in sack)
            {
                if (this.DragInfo.IsActive && item == this.DragInfo.Item)
                {
                    // skip the item being dragged
                    continue;
                }

                if (item.BaseItemId.Length == 0)
                {
                    // skip empty items
                    continue;
                }

                if (!first)
                {
                    answer.Append("<br>");
                }

                first = false;
                string text  = HtmlHelper.MakeSafeForHtml(ItemProvider.ToFriendlyName(item));
                Color  color = ItemGfxHelper.GetColorTag(item, text);
                text = Item.ClipColorTag(text);
                string htmlcolor = HtmlHelper.HtmlColor(color);
                string htmlLine  = string.Format(CultureInfo.CurrentCulture, "<font color={0}><b>{1}</b></font>", htmlcolor, text);
                answer.Append(htmlLine);
            }

            return(answer.ToString());
        }