Add special notes about particular appearances
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
public class ItemAppearance {
|
||||
public string Appearance { get; set; } = string.Empty;
|
||||
public string Slot { get; set; } = string.Empty;
|
||||
public string Notes { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ItemList {
|
||||
|
||||
1
NethackHelper/ItemDisplay.Designer.cs
generated
1
NethackHelper/ItemDisplay.Designer.cs
generated
@@ -36,6 +36,7 @@
|
||||
itemListView.Location = new System.Drawing.Point(0, 0);
|
||||
itemListView.MultiSelect = false;
|
||||
itemListView.Name = "itemListView";
|
||||
itemListView.ShowItemToolTips = true;
|
||||
itemListView.Size = new System.Drawing.Size(610, 568);
|
||||
itemListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
itemListView.TabIndex = 0;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.ComponentModel;
|
||||
namespace NethackHelper {
|
||||
public partial class ItemDisplay : UserControl {
|
||||
public const string UNIDENTIFIED = "[randomized]";
|
||||
public const string TOOLTIP_SUFFIX = " *";
|
||||
public static readonly Color SELECTED_COLOR = Color.Black;
|
||||
public static readonly Color UNSELECTED_COLOR = Color.Gray;
|
||||
|
||||
@@ -67,11 +68,12 @@ namespace NethackHelper {
|
||||
this.appearanceContextMenus.Clear();
|
||||
|
||||
var appearanceSlots = itemList.Appearances.Select(app => app.Slot).Distinct().ToList();
|
||||
var appearanceMap = itemList.Appearances.ToDictionary(appearance => appearance.Appearance);
|
||||
foreach (var slot in appearanceSlots) {
|
||||
ContextMenuStrip contextMenuStrip = new();
|
||||
var appearances = itemList.Appearances.Where(app => app.Slot == slot).Select(app => app.Appearance).Order().ToList();
|
||||
var appearances = itemList.Appearances.Where(app => app.Slot == slot).OrderBy(appearance => appearance.Appearance).ToList();
|
||||
foreach (var appearance in appearances) {
|
||||
contextMenuStrip.Items.Add(appearance, null, (sender, e) => this.PickAppearance(appearance));
|
||||
contextMenuStrip.Items.Add(appearance.Appearance, null, (sender, e) => this.PickAppearance(appearance));
|
||||
}
|
||||
this.appearanceContextMenus.Add(slot, contextMenuStrip);
|
||||
}
|
||||
@@ -142,6 +144,10 @@ namespace NethackHelper {
|
||||
for (var i = 0; i < this.Columns.Count; i++) {
|
||||
if (this.Columns[i].Attribute == ItemAttribute.Appearance) {
|
||||
listViewItem.SubItems[i].Text = record.Appearance;
|
||||
if (appearanceMap.TryGetValue(record.Appearance, out var appearance) && appearance.Notes != string.Empty) {
|
||||
listViewItem.ToolTipText = appearance.Notes;
|
||||
listViewItem.SubItems[i].Text += TOOLTIP_SUFFIX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,16 +207,19 @@ namespace NethackHelper {
|
||||
subItem.ForeColor = SELECTED_COLOR;
|
||||
}
|
||||
}
|
||||
if (!item.Checked) {
|
||||
item.ToolTipText = "";
|
||||
}
|
||||
this.itemListView.Sort();
|
||||
this.ProcessCurrentItemContextMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private void PickAppearance(string appearance) {
|
||||
private void PickAppearance(ItemAppearance appearance) {
|
||||
if (itemListView.SelectedItems.Count == 1) {
|
||||
var item = this.itemListView.SelectedItems[0];
|
||||
var name = item.Text;
|
||||
this.AppearanceMap[name] = appearance;
|
||||
this.AppearanceMap[name] = appearance.Appearance;
|
||||
item.Checked = true;
|
||||
var baseFont = item.Font;
|
||||
for (var i = 0; i < this.Columns.Count; i++) {
|
||||
@@ -218,9 +227,13 @@ namespace NethackHelper {
|
||||
subItem.Font = new Font(baseFont, FontStyle.Regular);
|
||||
subItem.ForeColor = UNSELECTED_COLOR;
|
||||
if (this.Columns[i].Attribute == ItemAttribute.Appearance) {
|
||||
subItem.Text = appearance;
|
||||
subItem.Text = appearance.Appearance;
|
||||
if (appearance.Notes != string.Empty) {
|
||||
subItem.Text += TOOLTIP_SUFFIX;
|
||||
}
|
||||
}
|
||||
}
|
||||
item.ToolTipText = appearance.Notes;
|
||||
this.itemListView.Sort();
|
||||
this.ProcessCurrentItemContextMenu();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ appearances:
|
||||
slot: helm
|
||||
- appearance: visored helmet
|
||||
slot: helm
|
||||
notes: protectes against blinding attacks of ravens and venom-spitting attacks of cobras
|
||||
- appearance: piece of cloth
|
||||
slot: cloak
|
||||
- appearance: opera cloak
|
||||
@@ -92,6 +93,7 @@ appearances:
|
||||
slot: gloves
|
||||
- appearance: riding gloves
|
||||
slot: gloves
|
||||
notes: increases chance of successfully saddling a steed
|
||||
- appearance: fencing gloves
|
||||
slot: gloves
|
||||
- appearance: mud boots
|
||||
@@ -100,8 +102,10 @@ appearances:
|
||||
slot: boots
|
||||
- appearance: riding boots
|
||||
slot: boots
|
||||
notes: increases chance of successfully saddling a steed
|
||||
- appearance: snow boots
|
||||
slot: boots
|
||||
notes: prevents fumbling effect of ice
|
||||
- appearance: hiking boots
|
||||
slot: boots
|
||||
- appearance: combat boots
|
||||
|
||||
@@ -82,6 +82,7 @@ appearances:
|
||||
slot: helm
|
||||
- appearance: visored helmet
|
||||
slot: helm
|
||||
notes: protectes against blinding attacks of ravens and venom-spitting attacks of cobras
|
||||
- appearance: piece of cloth
|
||||
slot: cloak
|
||||
- appearance: opera cloak
|
||||
@@ -96,6 +97,7 @@ appearances:
|
||||
slot: gloves
|
||||
- appearance: riding gloves
|
||||
slot: gloves
|
||||
notes: increases chance of successfully saddling a steed
|
||||
- appearance: fencing gloves
|
||||
slot: gloves
|
||||
- appearance: mud boots
|
||||
@@ -104,8 +106,10 @@ appearances:
|
||||
slot: boots
|
||||
- appearance: riding boots
|
||||
slot: boots
|
||||
notes: increases chance of successfully saddling a steed
|
||||
- appearance: snow boots
|
||||
slot: boots
|
||||
notes: prevents fumbling effect of ice
|
||||
- appearance: hiking boots
|
||||
slot: boots
|
||||
- appearance: combat boots
|
||||
|
||||
@@ -60,6 +60,7 @@ appearances:
|
||||
- appearance: dark green
|
||||
- appearance: purple-red
|
||||
- appearance: smoky
|
||||
notes: can summon djinni
|
||||
- appearance: brown
|
||||
- appearance: pink
|
||||
- appearance: cyan
|
||||
@@ -69,6 +70,7 @@ appearances:
|
||||
- appearance: orange
|
||||
- appearance: sky blue
|
||||
- appearance: milky
|
||||
notes: can summon ghost
|
||||
- appearance: effervescent
|
||||
- appearance: dark
|
||||
- appearance: yellow
|
||||
|
||||
@@ -60,6 +60,7 @@ appearances:
|
||||
- appearance: dark green
|
||||
- appearance: purple-red
|
||||
- appearance: smoky
|
||||
notes: can summon djinni
|
||||
- appearance: brown
|
||||
- appearance: pink
|
||||
- appearance: cyan
|
||||
@@ -69,6 +70,7 @@ appearances:
|
||||
- appearance: orange
|
||||
- appearance: sky blue
|
||||
- appearance: milky
|
||||
notes: can summon ghost
|
||||
- appearance: effervescent
|
||||
- appearance: dark
|
||||
- appearance: yellow
|
||||
|
||||
@@ -62,29 +62,46 @@
|
||||
appearances:
|
||||
- appearance: pearl
|
||||
- appearance: engagement
|
||||
notes: edible by rock moles, xorns, and rust monsters
|
||||
- appearance: silver
|
||||
notes: edible by rock moles and xorns
|
||||
- appearance: clay
|
||||
- appearance: jade
|
||||
- appearance: diamond
|
||||
notes: can be used for semi-permanent engraving
|
||||
- appearance: iron
|
||||
notes: edible by rock moles, xorns, and rust monsters
|
||||
- appearance: shiny
|
||||
notes: edible by rock moles, xorns, and rust monsters
|
||||
- appearance: gold
|
||||
notes: edible by rock moles and xorns
|
||||
- appearance: coral
|
||||
- appearance: agate
|
||||
- appearance: ivory
|
||||
- appearance: twisted
|
||||
notes: edible by rock moles, xorns, and rust monsters
|
||||
- appearance: bronze
|
||||
notes: edible by rock moles and xorns
|
||||
- appearance: wooden
|
||||
notes: edible by gelatinous cubes
|
||||
- appearance: black onyx
|
||||
- appearance: topaz
|
||||
notes: can be used for semi-permanent engraving
|
||||
- appearance: emerald
|
||||
notes: can be used for semi-permanent engraving
|
||||
- appearance: steel
|
||||
notes: can be used for semi-permanent engraving; edible by rock moles, xorns, and rust monsters
|
||||
- appearance: brass
|
||||
notes: edible by rock moles and xorns
|
||||
- appearance: granite
|
||||
- appearance: moonstone
|
||||
- appearance: sapphire
|
||||
notes: can be used for semi-permanent engraving
|
||||
- appearance: wire
|
||||
notes: edible by rock moles, xorns, and rust monsters
|
||||
- appearance: copper
|
||||
notes: edible by rock moles and xorns
|
||||
- appearance: opal
|
||||
- appearance: tiger eye
|
||||
- appearance: ruby
|
||||
- appearance: ruby
|
||||
notes: can be used for semi-permanent engraving
|
||||
@@ -147,6 +147,7 @@ appearances:
|
||||
- appearance: dark brown
|
||||
- appearance: copper
|
||||
- appearance: dull
|
||||
notes: can put you to sleep
|
||||
- appearance: dog eared
|
||||
- appearance: white
|
||||
- appearance: velvet
|
||||
|
||||
@@ -150,6 +150,7 @@ appearances:
|
||||
- appearance: dark brown
|
||||
- appearance: copper
|
||||
- appearance: dull
|
||||
notes: can put you to sleep
|
||||
- appearance: dog eared
|
||||
- appearance: white
|
||||
- appearance: velvet
|
||||
|
||||
@@ -52,9 +52,11 @@ appearances:
|
||||
- appearance: curved
|
||||
- appearance: iridium
|
||||
- appearance: marble
|
||||
notes: stone to flesh will make into a meat stick
|
||||
- appearance: short
|
||||
- appearance: uranium
|
||||
- appearance: balsa
|
||||
notes: requires only 5 strength to break
|
||||
- appearance: ebony
|
||||
- appearance: iron
|
||||
- appearance: oak
|
||||
@@ -67,10 +69,12 @@ appearances:
|
||||
- appearance: spiked
|
||||
- appearance: copper
|
||||
- appearance: glass
|
||||
notes: fragile
|
||||
- appearance: long
|
||||
- appearance: platinum
|
||||
- appearance: steel
|
||||
- appearance: crystal
|
||||
notes: fragile
|
||||
- appearance: hexagonal
|
||||
- appearance: maple
|
||||
- appearance: runed
|
||||
|
||||
Reference in New Issue
Block a user