/// <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 { var result = ItemHtmlHelper.NewItemHighlightedTooltip(item); this.itemText.ForeColor = result.ForeColor; this.itemText.Text = result.FriendlyName; this.tooltipText = result.TooltipText; this.tooltip.ChangeText(this.tooltipText); } this.lastSackHighlighted = sack; this.lastSackPanelHighlighted = sackPanel; }
/// <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; }
/// <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; } else { var result = ItemHtmlHelper.NewItemHighlightedTooltip(selectedResult.Item); // show tooltip this.tooltipText = result.TooltipText; } return(this.tooltipText); }
/// <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); } // skip the item being dragged Item[] excluded = null; if (this.DragInfo.IsActive) { excluded = new Item[] { this.DragInfo.Item }; } var html = ItemHtmlHelper.GetSackToolTip(sack, excluded); return(html); }
/// <summary> /// Loads the item properties /// </summary> private void LoadProperties() { string[] bareAttr; bareAttr = ItemHtmlHelper.GetBareAttributes(this.item, this.filterExtra); string bgcolor = "#2e1f15"; // Base Item Attributes if (bareAttr[0].Length == 0) { this.webBrowser1.Hide(); this.label2.Hide(); } else { this.webBrowser1.DocumentText = string.Format(CultureInfo.InvariantCulture, "<body bgcolor={0} text=white><font face=\"Albertus MT\" size=1>{1}", bgcolor, bareAttr[0]); this.webBrowser1.Show(); this.label2.Show(); } // Prefix Attributes if (bareAttr[2].Length == 0) { this.webBrowser2.Hide(); this.label1.Hide(); } else { this.webBrowser2.DocumentText = string.Format(CultureInfo.InvariantCulture, "<body bgcolor={0} text=white><font face=\"Albertus MT\" size=1>{1}", bgcolor, bareAttr[2]); this.webBrowser2.Show(); this.label1.Show(); } // Suffix Attributes if (bareAttr[3].Length == 0) { this.webBrowser3.Hide(); this.label3.Hide(); } else { this.webBrowser3.DocumentText = string.Format(CultureInfo.InvariantCulture, "<body bgcolor={0} text=white><font face=\"Albertus MT\" size=1>{1}", bgcolor, bareAttr[3]); this.webBrowser3.Show(); this.label3.Show(); } }
/// <summary> /// Loads the item properties /// </summary> private void LoadProperties() { var result = ItemHtmlHelper.LoadProperties(this.item, this.filterExtra); // Base Item Attributes if (result.BaseItemAttributes.Any()) { this.webBrowser1.DocumentText = result.BaseItemAttributes; this.webBrowser1.Show(); this.label2.Show(); } else { this.webBrowser1.Hide(); this.label2.Hide(); } // Prefix Attributes if (result.PrefixAttributes.Any()) { this.webBrowser2.DocumentText = result.PrefixAttributes; this.webBrowser2.Show(); this.label1.Show(); } else { this.webBrowser2.Hide(); this.label1.Hide(); } // Suffix Attributes if (result.SuffixAttributes.Any()) { this.webBrowser3.DocumentText = result.SuffixAttributes; this.webBrowser3.Show(); this.label3.Show(); } else { this.webBrowser3.Hide(); this.label3.Hide(); } }
/// <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); }
/// <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); } // skip the item being dragged Item[] excluded = null; if (this.DragInfo.IsActive) { excluded = new Item[] { this.DragInfo.Item }; } var html = ItemHtmlHelper.GetSackToolTip(sack, excluded); return(html); }
public bool Apply(Item item) { return(ItemHtmlHelper.GetAttributes(item, true).ToUpperInvariant().Contains(attribute.ToUpperInvariant())); }
/// <summary> /// Dialog load methond /// </summary> /// <param name="sender">sender object</param> /// <param name="e">EventArgs data</param> private void ItemProperties_Load(object sender, EventArgs e) { this.filterExtra = false; this.itemName.DocumentText = ItemHtmlHelper.GetName(this.item); this.LoadProperties(); }