Пример #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;
        }
Пример #2
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");
        }
Пример #3
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);
        }
Пример #4
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;
        }