Add fossil & message bottle item for hover text & editor

This commit is contained in:
Kurt
2020-05-02 14:06:03 -07:00
parent 38a7895752
commit 73b4d0c2fd
6 changed files with 262 additions and 108 deletions

View File

@@ -35,6 +35,20 @@ private List<ComboItem> CreateItemDataSource(string[] strings)
return dataSource;
}
public List<ComboItem> CreateItemDataSource(IReadOnlyCollection<ushort> dict, bool none = true)
{
var display = itemlistdisplay;
var result = new List<ComboItem>(dict.Count);
foreach (var x in dict)
result.Add(new ComboItem(display[x], x));
if (none)
result.Add(new ComboItem(itemlist[0], Item.NONE));
result.SortByText();
return result;
}
public List<ComboItem> CreateItemDataSource(IReadOnlyCollection<KeyValuePair<ushort, ushort>> dict, bool none = true)
{
var display = itemlistdisplay;
@@ -87,7 +101,7 @@ public static string[] GetItemDisplayList(string[] items)
return items;
}
public string GetItemName(Item item)
public string GetItemName(IHeldItem item)
{
var index = item.ItemId;
if (index == Item.NONE)
@@ -103,6 +117,14 @@ public string GetItemName(Item item)
return $"{display} - {makes}";
}
if (kind == ItemKind.Kind_FossilUnknown)
{
var display = itemlistdisplay[index];
var fossilID = item.Count;
var fossilName = GetItemName(fossilID);
return $"{display} - {fossilName}";
}
return GetItemName(index);
}
@@ -120,16 +142,8 @@ public string GetItemName(FieldItem item)
return "???";
}
var kind = ItemInfo.GetItemKind(index);
if (kind == ItemKind.Kind_DIYRecipe)
{
var display = itemlistdisplay[index];
var recipeID = item.Count;
var isKnown = RecipeList.Recipes.TryGetValue(recipeID, out var result);
var makes = isKnown ? GetItemName(result) : recipeID.ToString("000");
return $"{display} - {makes}";
}
if (item.IsRoot)
return GetItemName((IHeldItem)item);
return GetItemName(index);
}

View File

@@ -172,7 +172,6 @@ public void SetExtensionTiles(FieldItem tile, in int x, in int y)
}
}
/// <summary>
/// Checks if writing the <see cref="tile"/> at the specified <see cref="x"/> and <see cref="y"/> coordinates will overlap with any existing tiles.
/// </summary>

View File

@@ -4,7 +4,7 @@ namespace NHSE.Core
{
public static class GameLists
{
public static IReadOnlyList<ushort> Bugs = new ushort[]
public static readonly IReadOnlyList<ushort> Bugs = new ushort[]
{
00582, // brown cicada
00583, // tiger butterfly
@@ -93,7 +93,7 @@ public static class GameLists
07374, // maple leaf
};
public static IReadOnlyList<ushort> Fish = new ushort[]
public static readonly IReadOnlyList<ushort> Fish = new ushort[]
{
00328, // crucian carp
00329, // goldfish
@@ -182,6 +182,82 @@ public static class GameLists
12514, // water egg
};
public static readonly IReadOnlyList<ushort> Fossils = new ushort[]
{00169, // ankylo skull
00170, // ankylo torso
00171, // ankylo tail
00177, // archelon skull
00178, // archelon tail
00180, // megacero skull
00181, // megacero torso
00182, // megacero tail
00184, // dimetrodon skull
00185, // dimetrodon torso
00188, // iguanodon skull
00189, // iguanodon torso
00190, // iguanodon tail
00192, // ophthalmo skull
00193, // ophthalmo torso
00195, // mammoth skull
00196, // mammoth torso
00198, // pachy skull
00199, // pachy tail
00202, // parasaur skull
00203, // parasaur torso
00204, // parasaur tail
00206, // ptera body
00207, // right ptera wing
00208, // left ptera wing
00210, // deinony torso
00211, // deinony tail
00213, // sabertooth skull
00214, // sabertooth tail
00216, // diplo skull
00217, // diplo neck
00218, // diplo chest
00219, // diplo pelvis
00220, // diplo tail
00222, // spino skull
00223, // spino torso
00224, // spino tail
00226, // stego skull
00227, // stego torso
00228, // stego tail
00234, // plesio skull
00235, // plesio body
00236, // plesio tail
00238, // T. rex skull
00239, // T. rex torso
00240, // T. rex tail
00242, // tricera skull
00243, // tricera torso
00244, // tricera tail
00294, // amber
00295, // ammonite
00296, // coprolite
00298, // archaeopteryx
00300, // dinosaur track
00301, // australopith
00302, // shark-tooth pattern
00303, // trilobite
04651, // anomalocaris
04658, // right megalo side
04659, // left megalo side
04660, // dunkleosteus
04662, // myllokunmingia
04663, // eusthenopteron
04664, // acanthostega
04665, // juramaia
04688, // brachio skull
04689, // brachio chest
04690, // brachio pelvis
04691, // brachio tail
04697, // quetzal torso
04698, // right quetzal wing
04699, // left quetzal wing
07251, // diplo tail tip
};
public static readonly IReadOnlyList<ushort> Art = new ushort[]
{
00002, // scenic painting

View File

@@ -42,6 +42,7 @@ void DumpB(string fn, byte[] bytes)
DumpS("fish.txt", GetFishList(pathBCSV, itemNames));
DumpS("bugs.txt", GetInsectList(pathBCSV, itemNames));
DumpS("fossils.txt", GetFossilList(pathBCSV, itemNames));
DumpS("eventFlagPlayer.txt", GetEventFlagNames(pathBCSV));
DumpS("eventFlagVillager.txt", GetVillagerEventFlagNames(pathBCSV));
DumpS("eventFlagLand.txt", GetLandEventFlagNames(pathBCSV));
@@ -293,6 +294,11 @@ public static IEnumerable<ushort> GetInsectList(string pathBCSV, string fn = "In
return GetItemList(pathBCSV, fn, 0x20CB67BC);
}
public static IEnumerable<ushort> GetFossilList(string pathBCSV, string fn = "MuseumFossilDonateInfo.bcsv")
{
return GetItemList(pathBCSV, fn, 0xB76B7D37);
}
public static IEnumerable<ushort> GetFishList(string pathBCSV, string fn = "FishStatusParam.bcsv")
{
return GetItemList(pathBCSV, fn, 0x20CB67BC);
@@ -310,6 +316,12 @@ public static IEnumerable<string> GetFishList(string pathBCSV, IReadOnlyList<str
return insects.Select(z => $"{z:00000}, // {items[z]}");
}
public static IEnumerable<string> GetFossilList(string pathBCSV, IReadOnlyList<string> items, string fn = "MuseumFossilDonateInfo.bcsv")
{
var fossils = GetFossilList(pathBCSV, fn);
return fossils.Select(z => $"{z:00000}, // {items[z]}");
}
private static IEnumerable<ushort> GetItemList(string pathBCSV, string fn, uint keyItemIDColumn)
{
var bcsv = BCSVConverter.GetBCSV(pathBCSV, fn);

View File

@@ -42,7 +42,7 @@ private void InitializeComponent()
this.Menu_View = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_Set = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_Delete = new System.Windows.Forms.ToolStripMenuItem();
this.CB_NamedItemArgument = new System.Windows.Forms.ComboBox();
this.CB_Recipe = new System.Windows.Forms.ComboBox();
this.FLP_Controls = new System.Windows.Forms.FlowLayoutPanel();
this.FLP_Count = new System.Windows.Forms.FlowLayoutPanel();
this.FLP_Uses = new System.Windows.Forms.FlowLayoutPanel();
@@ -61,17 +61,18 @@ private void InitializeComponent()
this.CHK_IsWatered = new System.Windows.Forms.CheckBox();
this.NUD_WaterDays = new System.Windows.Forms.NumericUpDown();
this.L_WaterDays = new System.Windows.Forms.Label();
this.CHK_Gold = new System.Windows.Forms.CheckBox();
this.CHK_WV2 = new System.Windows.Forms.CheckBox();
this.CHK_WV1 = new System.Windows.Forms.CheckBox();
this.CHK_WV0 = new System.Windows.Forms.CheckBox();
this.CHK_WV3 = new System.Windows.Forms.CheckBox();
this.CHK_WV2 = new System.Windows.Forms.CheckBox();
this.CHK_WV5 = new System.Windows.Forms.CheckBox();
this.CHK_WV4 = new System.Windows.Forms.CheckBox();
this.CHK_WV3 = new System.Windows.Forms.CheckBox();
this.CHK_WV8 = new System.Windows.Forms.CheckBox();
this.CHK_WV7 = new System.Windows.Forms.CheckBox();
this.CHK_WV6 = new System.Windows.Forms.CheckBox();
this.CHK_WV9 = new System.Windows.Forms.CheckBox();
this.CHK_WV8 = new System.Windows.Forms.CheckBox();
this.CHK_Gold = new System.Windows.Forms.CheckBox();
this.CB_Fossil = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Uses)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Flag0)).BeginInit();
@@ -111,7 +112,6 @@ private void InitializeComponent()
this.NUD_Count.Name = "NUD_Count";
this.NUD_Count.Size = new System.Drawing.Size(56, 20);
this.NUD_Count.TabIndex = 2;
this.NUD_Count.ValueChanged += new System.EventHandler(this.NUD_Count_ValueChanged);
//
// L_Count
//
@@ -222,30 +222,31 @@ private void InitializeComponent()
this.Menu_Delete.Size = new System.Drawing.Size(107, 22);
this.Menu_Delete.Text = "Delete";
//
// CB_NamedItemArgument
// CB_Recipe
//
this.CB_NamedItemArgument.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_NamedItemArgument.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_NamedItemArgument.DropDownWidth = 322;
this.CB_NamedItemArgument.FormattingEnabled = true;
this.CB_NamedItemArgument.Location = new System.Drawing.Point(3, 24);
this.CB_NamedItemArgument.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
this.CB_NamedItemArgument.Name = "CB_NamedItemArgument";
this.CB_NamedItemArgument.Size = new System.Drawing.Size(141, 21);
this.CB_NamedItemArgument.TabIndex = 14;
this.CB_NamedItemArgument.Visible = false;
this.CB_NamedItemArgument.SelectedValueChanged += new System.EventHandler(this.CB_NamedItemArgument_SelectedValueChanged);
this.CB_Recipe.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_Recipe.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_Recipe.DropDownWidth = 322;
this.CB_Recipe.FormattingEnabled = true;
this.CB_Recipe.Location = new System.Drawing.Point(3, 24);
this.CB_Recipe.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
this.CB_Recipe.Name = "CB_Recipe";
this.CB_Recipe.Size = new System.Drawing.Size(141, 21);
this.CB_Recipe.TabIndex = 14;
this.CB_Recipe.Visible = false;
this.CB_Recipe.SelectedValueChanged += new System.EventHandler(this.CB_CountAlias_SelectedValueChanged);
//
// FLP_Controls
//
this.FLP_Controls.Controls.Add(this.CB_ItemID);
this.FLP_Controls.Controls.Add(this.CB_NamedItemArgument);
this.FLP_Controls.Controls.Add(this.CB_Recipe);
this.FLP_Controls.Controls.Add(this.FLP_Count);
this.FLP_Controls.Controls.Add(this.FLP_Uses);
this.FLP_Controls.Controls.Add(this.FLP_Flag0);
this.FLP_Controls.Controls.Add(this.FLP_Flag1);
this.FLP_Controls.Controls.Add(this.FLP_Genetics);
this.FLP_Controls.Controls.Add(this.FLP_FlowerFlags);
this.FLP_Controls.Controls.Add(this.CB_Fossil);
this.FLP_Controls.Dock = System.Windows.Forms.DockStyle.Fill;
this.FLP_Controls.Location = new System.Drawing.Point(0, 0);
this.FLP_Controls.Name = "FLP_Controls";
@@ -481,19 +482,18 @@ private void InitializeComponent()
this.L_WaterDays.Text = "Days:";
this.L_WaterDays.Click += new System.EventHandler(this.L_WaterDays_Click);
//
// CHK_Gold
// CHK_WV2
//
this.CHK_Gold.AutoSize = true;
this.CHK_Gold.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_Gold.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_Gold.Location = new System.Drawing.Point(45, 88);
this.CHK_Gold.Margin = new System.Windows.Forms.Padding(0);
this.CHK_Gold.Name = "CHK_Gold";
this.CHK_Gold.Size = new System.Drawing.Size(54, 18);
this.CHK_Gold.TabIndex = 13;
this.CHK_Gold.Text = "Gold";
this.CHK_Gold.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_Gold.UseVisualStyleBackColor = true;
this.CHK_WV2.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV2.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV2.Location = new System.Drawing.Point(99, 40);
this.CHK_WV2.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV2.Name = "CHK_WV2";
this.CHK_WV2.Size = new System.Drawing.Size(48, 16);
this.CHK_WV2.TabIndex = 17;
this.CHK_WV2.Text = "V3";
this.CHK_WV2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV2.UseVisualStyleBackColor = true;
//
// CHK_WV1
//
@@ -521,32 +521,6 @@ private void InitializeComponent()
this.CHK_WV0.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV0.UseVisualStyleBackColor = true;
//
// CHK_WV3
//
this.CHK_WV3.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV3.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV3.Location = new System.Drawing.Point(3, 56);
this.CHK_WV3.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV3.Name = "CHK_WV3";
this.CHK_WV3.Size = new System.Drawing.Size(48, 16);
this.CHK_WV3.TabIndex = 16;
this.CHK_WV3.Text = "V4";
this.CHK_WV3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV3.UseVisualStyleBackColor = true;
//
// CHK_WV2
//
this.CHK_WV2.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV2.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV2.Location = new System.Drawing.Point(99, 40);
this.CHK_WV2.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV2.Name = "CHK_WV2";
this.CHK_WV2.Size = new System.Drawing.Size(48, 16);
this.CHK_WV2.TabIndex = 17;
this.CHK_WV2.Text = "V3";
this.CHK_WV2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV2.UseVisualStyleBackColor = true;
//
// CHK_WV5
//
this.CHK_WV5.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -573,6 +547,32 @@ private void InitializeComponent()
this.CHK_WV4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV4.UseVisualStyleBackColor = true;
//
// CHK_WV3
//
this.CHK_WV3.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV3.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV3.Location = new System.Drawing.Point(3, 56);
this.CHK_WV3.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV3.Name = "CHK_WV3";
this.CHK_WV3.Size = new System.Drawing.Size(48, 16);
this.CHK_WV3.TabIndex = 16;
this.CHK_WV3.Text = "V4";
this.CHK_WV3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV3.UseVisualStyleBackColor = true;
//
// CHK_WV8
//
this.CHK_WV8.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV8.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV8.Location = new System.Drawing.Point(99, 72);
this.CHK_WV8.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV8.Name = "CHK_WV8";
this.CHK_WV8.Size = new System.Drawing.Size(48, 16);
this.CHK_WV8.TabIndex = 23;
this.CHK_WV8.Text = "V9";
this.CHK_WV8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV8.UseVisualStyleBackColor = true;
//
// CHK_WV7
//
this.CHK_WV7.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -612,18 +612,33 @@ private void InitializeComponent()
this.CHK_WV9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV9.UseVisualStyleBackColor = true;
//
// CHK_WV8
// CHK_Gold
//
this.CHK_WV8.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV8.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_WV8.Location = new System.Drawing.Point(99, 72);
this.CHK_WV8.Margin = new System.Windows.Forms.Padding(0);
this.CHK_WV8.Name = "CHK_WV8";
this.CHK_WV8.Size = new System.Drawing.Size(48, 16);
this.CHK_WV8.TabIndex = 23;
this.CHK_WV8.Text = "V9";
this.CHK_WV8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_WV8.UseVisualStyleBackColor = true;
this.CHK_Gold.AutoSize = true;
this.CHK_Gold.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_Gold.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CHK_Gold.Location = new System.Drawing.Point(45, 88);
this.CHK_Gold.Margin = new System.Windows.Forms.Padding(0);
this.CHK_Gold.Name = "CHK_Gold";
this.CHK_Gold.Size = new System.Drawing.Size(54, 18);
this.CHK_Gold.TabIndex = 13;
this.CHK_Gold.Text = "Gold";
this.CHK_Gold.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_Gold.UseVisualStyleBackColor = true;
//
// CB_Fossil
//
this.CB_Fossil.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_Fossil.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_Fossil.DropDownWidth = 322;
this.CB_Fossil.FormattingEnabled = true;
this.CB_Fossil.Location = new System.Drawing.Point(3, 321);
this.CB_Fossil.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
this.CB_Fossil.Name = "CB_Fossil";
this.CB_Fossil.Size = new System.Drawing.Size(141, 21);
this.CB_Fossil.TabIndex = 21;
this.CB_Fossil.Visible = false;
this.CB_Fossil.SelectedValueChanged += new System.EventHandler(this.CB_CountAlias_SelectedValueChanged);
//
// ItemEditor
//
@@ -668,7 +683,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem Menu_View;
private System.Windows.Forms.ToolStripMenuItem Menu_Set;
private System.Windows.Forms.ToolStripMenuItem Menu_Delete;
private System.Windows.Forms.ComboBox CB_NamedItemArgument;
private System.Windows.Forms.ComboBox CB_Recipe;
private System.Windows.Forms.FlowLayoutPanel FLP_Controls;
private System.Windows.Forms.FlowLayoutPanel FLP_Count;
private System.Windows.Forms.FlowLayoutPanel FLP_Uses;
@@ -698,5 +713,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox CHK_WV6;
private System.Windows.Forms.CheckBox CHK_WV9;
private System.Windows.Forms.CheckBox CHK_WV8;
private System.Windows.Forms.ComboBox CB_Fossil;
}
}

View File

@@ -8,8 +8,11 @@ namespace NHSE.WinForms
public partial class ItemEditor : UserControl
{
private readonly List<ComboItem> Recipes = GameInfo.Strings.CreateItemDataSource(RecipeList.Recipes, false);
private readonly List<ComboItem> Fossils = GameInfo.Strings.CreateItemDataSource(GameLists.Fossils, false);
private readonly CheckBox[] Watered;
private bool Loading = true;
public ItemEditor()
{
InitializeComponent();
@@ -24,25 +27,28 @@ public ItemEditor()
};
}
private ItemKind kind;
private ushort itemID;
public void Initialize(List<ComboItem> items)
{
CB_ItemID.DisplayMember = nameof(ComboItem.Text);
CB_ItemID.ValueMember = nameof(ComboItem.Value);
CB_ItemID.DataSource = items;
CB_NamedItemArgument.DisplayMember = nameof(ComboItem.Text);
CB_NamedItemArgument.ValueMember = nameof(ComboItem.Value);
CB_NamedItemArgument.DataSource = Recipes;
CB_Recipe.DisplayMember = nameof(ComboItem.Text);
CB_Recipe.ValueMember = nameof(ComboItem.Value);
CB_Recipe.DataSource = Recipes;
CB_Fossil.DisplayMember = nameof(ComboItem.Text);
CB_Fossil.ValueMember = nameof(ComboItem.Value);
CB_Fossil.DataSource = Fossils;
LoadItem(Item.NO_ITEM);
}
public Item LoadItem(Item item)
{
Loading = true;
CB_ItemID.SelectedValue = (int)item.ItemId;
var kind = ItemInfo.GetItemKind(item.ItemId);
if (kind.IsFlower())
{
@@ -59,15 +65,20 @@ public Item LoadItem(Item item)
NUD_Uses.Value = item.UseCount;
NUD_Flag0.Value = item.Flags0;
NUD_Flag1.Value = item.Flags1;
LoadItemTypeValues(kind);
}
Loading = false;
return item;
}
public Item SetItem(Item item)
{
var id = WinFormsUtil.GetIndex(CB_ItemID);
item.ItemId = (ushort) id;
var id = (ushort)WinFormsUtil.GetIndex(CB_ItemID);
var kind = ItemInfo.GetItemKind(id);
item.ItemId = id;
if (kind.IsFlower())
{
item.Genes = SaveGenes();
@@ -89,47 +100,73 @@ public Item SetItem(Item item)
private void CB_ItemID_SelectedValueChanged(object sender, EventArgs e)
{
itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID);
kind = ItemInfo.GetItemKind(itemID);
var itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID);
var kind = ItemInfo.GetItemKind(itemID);
if (kind.IsFlower())
ToggleEditorVisibility(kind);
if (!Loading)
LoadItemTypeValues(kind);
}
private void LoadItemTypeValues(ItemKind k)
{
switch (k)
{
CB_NamedItemArgument.Visible = false;
case ItemKind.Kind_FossilUnknown:
CB_Fossil.SelectedValue = (int) NUD_Count.Value;
break;
case ItemKind.Kind_DIYRecipe:
case ItemKind.Kind_MessageBottle:
CB_Recipe.SelectedValue = (int) NUD_Count.Value;
break;
}
}
private void ToggleEditorVisibility(ItemKind k)
{
if (k.IsFlower())
{
CB_Recipe.Visible = false;
FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = false;
FLP_FlowerFlags.Visible = FLP_Genetics.Visible = true;
return;
}
switch (kind)
switch (k)
{
case ItemKind.Kind_DIYRecipe:
CB_NamedItemArgument.SelectedValue = (int) NUD_Count.Value;
case ItemKind.Kind_FossilUnknown:
CB_Fossil.Visible = true;
CB_NamedItemArgument.Visible = true;
CB_Recipe.Visible = false;
FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = false;
FLP_FlowerFlags.Visible = FLP_Genetics.Visible = false;
break;
case ItemKind.Kind_DIYRecipe:
case ItemKind.Kind_MessageBottle:
CB_Recipe.Visible = true;
CB_Fossil.Visible = false;
FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = false;
FLP_FlowerFlags.Visible = FLP_Genetics.Visible = false;
break;
default:
CB_NamedItemArgument.Visible = false;
CB_Fossil.Visible = false;
CB_Recipe.Visible = false;
FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = true;
FLP_FlowerFlags.Visible = FLP_Genetics.Visible = false;
break;
}
}
private void CB_NamedItemArgument_SelectedValueChanged(object sender,EventArgs e)
private void CB_CountAlias_SelectedValueChanged(object sender,EventArgs e)
{
var val = WinFormsUtil.GetIndex(CB_NamedItemArgument);
var val = WinFormsUtil.GetIndex((ComboBox)sender);
NUD_Count.Value = Math.Max(0, Math.Min(NUD_Count.Maximum, val));
}
private void NUD_Count_ValueChanged(object sender, EventArgs e)
{
if (kind == ItemKind.Kind_DIYRecipe)
CB_NamedItemArgument.SelectedValue = (int) NUD_Count.Value;
}
private void LoadGenes(FlowerGene genes)
{
CHK_R1.Checked = (genes & FlowerGene.R1) != 0;