diff --git a/NHSE.Core/Structures/ItemRemakeInfo.cs b/NHSE.Core/Structures/ItemRemakeInfo.cs index e70bb8f..ff20b44 100644 --- a/NHSE.Core/Structures/ItemRemakeInfo.cs +++ b/NHSE.Core/Structures/ItemRemakeInfo.cs @@ -16,8 +16,7 @@ public class ItemRemakeInfo public readonly bool ReFabricPattern0VisibleOff; - public ItemRemakeInfo(short index, ushort id, sbyte count, byte[] bc0, byte[] bc1, byte[] fc0, byte[] fc1, - bool fp0) + public ItemRemakeInfo(short index, ushort id, sbyte count, byte[] bc0, byte[] bc1, byte[] fc0, byte[] fc1, bool fp0) { Index = index; ItemUniqueID = id; @@ -34,28 +33,63 @@ public class ItemRemakeInfo private const string Invalid = nameof(Invalid); - public string GetColorDescription(int colorIndex) + public bool HasBodyColor(int variant) => ReBodyPatternColors0[variant] != 14 || ReBodyPatternColors1[variant] != 14; + public bool HasFabricColor(int variant) => ReFabricPatternColors0[variant] != 14 || ReFabricPatternColors1[variant] != 14; + + public string GetBodyDescription(int colorIndex) { - var bc0 = ReBodyPatternColors0[colorIndex]; - var bc1 = ReBodyPatternColors1[colorIndex]; - if (bc0 == (byte) ItemCustomColor.None) - return "Invalid"; - - var c0 = ((ItemCustomColor)bc0).ToString(); - if (bc1 == (byte)ItemCustomColor.None || bc0 == bc1) - return c0; - - var c1 = ((ItemCustomColor) bc1).ToString(); - - return $"{c0}-{c1}"; + var c0 = ReBodyPatternColors0[colorIndex]; + var c1 = ReBodyPatternColors1[colorIndex]; + return GetColorText(c0, c1); } - public string GetColorSummary() + public string GetFabricDescription(int colorIndex) + { + var c0 = ReFabricPatternColors0[colorIndex]; + var c1 = ReFabricPatternColors1[colorIndex]; + return GetColorText(c0, c1); + } + + private static string GetColorText(byte c0, byte c1) + { + if (c0 == (byte) ItemCustomColor.None) + { + if (c1 == (byte) ItemCustomColor.None) + return "Invalid"; + return GetColorText(c1); + } + + var s0 = GetColorText(c0); + if (c1 == (byte) ItemCustomColor.None || c0 == c1) + return s0; + + var s1 = GetColorText(c1); + + return $"{s0}-{s1}"; + } + + private static string GetColorText(byte value) => ((ItemCustomColor)value).ToString(); + + public string GetBodySummary() { var sb = new StringBuilder(); for (int i = 0; i < 8; i++) { - var cd = GetColorDescription(i); + var cd = GetBodyDescription(i); + if (cd == Invalid) + continue; + + sb.Append(i).Append('=').AppendLine(cd); + } + return sb.ToString(); + } + + public string GetFabricSummary() + { + var sb = new StringBuilder(); + for (int i = 0; i < 8; i++) + { + var cd = GetFabricDescription(i); if (cd == Invalid) continue; diff --git a/NHSE.Core/Structures/ItemRemakeInfoData.cs b/NHSE.Core/Structures/ItemRemakeInfoData.cs index 2732cb1..4abdf14 100644 --- a/NHSE.Core/Structures/ItemRemakeInfoData.cs +++ b/NHSE.Core/Structures/ItemRemakeInfoData.cs @@ -7,7 +7,7 @@ namespace NHSE.Core /// public static class ItemRemakeInfoData { - public static Dictionary List = new Dictionary + public static readonly IReadOnlyDictionary List = new Dictionary { {0072, new ItemRemakeInfo(0072, 01288, 5, new byte[] {10, 12, 08, 04, 06, 01, 14, 14}, new byte[] {06, 06, 06, 06, 06, 06, 14, 14}, new byte[] {14, 14, 14, 14, 14, 14, 14, 14}, new byte[] {14, 14, 14, 14, 14, 14, 14, 14}, false)}, // fan palm {0076, new ItemRemakeInfo(0076, 02605, 7, new byte[] {08, 12, 00, 09, 10, 06, 04, 02}, new byte[] {08, 12, 00, 09, 10, 06, 04, 02}, new byte[] {14, 14, 14, 14, 14, 14, 14, 14}, new byte[] {00, 02, 05, 06, 14, 14, 14, 14}, false)}, // wooden simple bed diff --git a/NHSE.WinForms/Controls/ItemEditor.Designer.cs b/NHSE.WinForms/Controls/ItemEditor.Designer.cs index 747bdd1..31a3cd0 100644 --- a/NHSE.WinForms/Controls/ItemEditor.Designer.cs +++ b/NHSE.WinForms/Controls/ItemEditor.Designer.cs @@ -44,7 +44,10 @@ private void InitializeComponent() this.Menu_Delete = new System.Windows.Forms.ToolStripMenuItem(); this.CB_Recipe = new System.Windows.Forms.ComboBox(); this.FLP_Controls = new System.Windows.Forms.FlowLayoutPanel(); + this.CB_Fossil = new System.Windows.Forms.ComboBox(); this.FLP_Count = new System.Windows.Forms.FlowLayoutPanel(); + this.L_RemakeBody = new System.Windows.Forms.Label(); + this.L_RemakeFabric = new System.Windows.Forms.Label(); this.FLP_Uses = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Flag0 = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Flag1 = new System.Windows.Forms.FlowLayoutPanel(); @@ -72,8 +75,6 @@ private void InitializeComponent() this.CHK_WV6 = new System.Windows.Forms.CheckBox(); this.CHK_WV9 = new System.Windows.Forms.CheckBox(); this.CHK_Gold = new System.Windows.Forms.CheckBox(); - this.CB_Fossil = new System.Windows.Forms.ComboBox(); - this.L_RemakeColors = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Uses)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Flag0)).BeginInit(); @@ -241,37 +242,77 @@ private void InitializeComponent() // this.FLP_Controls.Controls.Add(this.CB_ItemID); this.FLP_Controls.Controls.Add(this.CB_Recipe); + this.FLP_Controls.Controls.Add(this.CB_Fossil); this.FLP_Controls.Controls.Add(this.FLP_Count); - this.FLP_Controls.Controls.Add(this.L_RemakeColors); + this.FLP_Controls.Controls.Add(this.L_RemakeBody); + this.FLP_Controls.Controls.Add(this.L_RemakeFabric); 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"; - this.FLP_Controls.Size = new System.Drawing.Size(211, 352); + this.FLP_Controls.Size = new System.Drawing.Size(211, 408); this.FLP_Controls.TabIndex = 15; // + // 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, 47); + 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); + // // FLP_Count // this.FLP_Count.Controls.Add(this.NUD_Count); this.FLP_Count.Controls.Add(this.L_Count); + this.FLP_Controls.SetFlowBreak(this.FLP_Count, true); this.FLP_Count.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_Count.Location = new System.Drawing.Point(0, 46); + this.FLP_Count.Location = new System.Drawing.Point(0, 69); this.FLP_Count.Margin = new System.Windows.Forms.Padding(0); this.FLP_Count.Name = "FLP_Count"; this.FLP_Count.Size = new System.Drawing.Size(147, 26); this.FLP_Count.TabIndex = 16; // + // L_RemakeBody + // + this.L_RemakeBody.AutoSize = true; + this.FLP_Controls.SetFlowBreak(this.L_RemakeBody, true); + this.L_RemakeBody.Location = new System.Drawing.Point(3, 101); + this.L_RemakeBody.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.L_RemakeBody.Name = "L_RemakeBody"; + this.L_RemakeBody.Size = new System.Drawing.Size(75, 13); + this.L_RemakeBody.TabIndex = 22; + this.L_RemakeBody.Text = "*RemakeBody"; + this.L_RemakeBody.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // L_RemakeFabric + // + this.L_RemakeFabric.AutoSize = true; + this.FLP_Controls.SetFlowBreak(this.L_RemakeFabric, true); + this.L_RemakeFabric.Location = new System.Drawing.Point(3, 126); + this.L_RemakeFabric.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.L_RemakeFabric.Name = "L_RemakeFabric"; + this.L_RemakeFabric.Size = new System.Drawing.Size(80, 13); + this.L_RemakeFabric.TabIndex = 23; + this.L_RemakeFabric.Text = "*RemakeFabric"; + this.L_RemakeFabric.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // FLP_Uses // this.FLP_Uses.Controls.Add(this.NUD_Uses); this.FLP_Uses.Controls.Add(this.L_Uses); this.FLP_Uses.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_Uses.Location = new System.Drawing.Point(0, 72); + this.FLP_Uses.Location = new System.Drawing.Point(0, 145); this.FLP_Uses.Margin = new System.Windows.Forms.Padding(0); this.FLP_Uses.Name = "FLP_Uses"; this.FLP_Uses.Size = new System.Drawing.Size(147, 26); @@ -282,7 +323,7 @@ private void InitializeComponent() this.FLP_Flag0.Controls.Add(this.NUD_Flag0); this.FLP_Flag0.Controls.Add(this.L_Flag0); this.FLP_Flag0.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_Flag0.Location = new System.Drawing.Point(0, 98); + this.FLP_Flag0.Location = new System.Drawing.Point(0, 171); this.FLP_Flag0.Margin = new System.Windows.Forms.Padding(0); this.FLP_Flag0.Name = "FLP_Flag0"; this.FLP_Flag0.Size = new System.Drawing.Size(147, 26); @@ -293,7 +334,7 @@ private void InitializeComponent() this.FLP_Flag1.Controls.Add(this.NUD_Flag1); this.FLP_Flag1.Controls.Add(this.L_Flag1); this.FLP_Flag1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_Flag1.Location = new System.Drawing.Point(0, 124); + this.FLP_Flag1.Location = new System.Drawing.Point(0, 197); this.FLP_Flag1.Margin = new System.Windows.Forms.Padding(0); this.FLP_Flag1.Name = "FLP_Flag1"; this.FLP_Flag1.Size = new System.Drawing.Size(147, 26); @@ -310,7 +351,7 @@ private void InitializeComponent() this.FLP_Genetics.Controls.Add(this.CHK_S2); this.FLP_Genetics.Controls.Add(this.CHK_S1); this.FLP_Genetics.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_Genetics.Location = new System.Drawing.Point(0, 150); + this.FLP_Genetics.Location = new System.Drawing.Point(0, 223); this.FLP_Genetics.Margin = new System.Windows.Forms.Padding(0); this.FLP_Genetics.Name = "FLP_Genetics"; this.FLP_Genetics.Size = new System.Drawing.Size(106, 65); @@ -437,7 +478,7 @@ private void InitializeComponent() this.FLP_FlowerFlags.Controls.Add(this.CHK_WV9); this.FLP_FlowerFlags.Controls.Add(this.CHK_Gold); this.FLP_FlowerFlags.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.FLP_FlowerFlags.Location = new System.Drawing.Point(0, 215); + this.FLP_FlowerFlags.Location = new System.Drawing.Point(0, 288); this.FLP_FlowerFlags.Margin = new System.Windows.Forms.Padding(0); this.FLP_FlowerFlags.Name = "FLP_FlowerFlags"; this.FLP_FlowerFlags.Size = new System.Drawing.Size(147, 105); @@ -628,38 +669,13 @@ private void InitializeComponent() 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); - // - // L_RemakeColors - // - this.L_RemakeColors.AutoSize = true; - this.L_RemakeColors.Location = new System.Drawing.Point(150, 326); - this.L_RemakeColors.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); - this.L_RemakeColors.Name = "L_RemakeColors"; - this.L_RemakeColors.Size = new System.Drawing.Size(51, 13); - this.L_RemakeColors.TabIndex = 22; - this.L_RemakeColors.Text = "*Remake"; - this.L_RemakeColors.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ItemEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.FLP_Controls); this.Name = "ItemEditor"; - this.Size = new System.Drawing.Size(211, 352); + this.Size = new System.Drawing.Size(211, 408); ((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Uses)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Flag0)).EndInit(); @@ -728,6 +744,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_WV9; private System.Windows.Forms.CheckBox CHK_WV8; private System.Windows.Forms.ComboBox CB_Fossil; - private System.Windows.Forms.Label L_RemakeColors; + private System.Windows.Forms.Label L_RemakeBody; + private System.Windows.Forms.Label L_RemakeFabric; } } diff --git a/NHSE.WinForms/Controls/ItemEditor.cs b/NHSE.WinForms/Controls/ItemEditor.cs index fb0c1f0..16f8a0f 100644 --- a/NHSE.WinForms/Controls/ItemEditor.cs +++ b/NHSE.WinForms/Controls/ItemEditor.cs @@ -110,13 +110,19 @@ private void CB_ItemID_SelectedValueChanged(object sender, EventArgs e) var remake = ItemRemakeUtil.GetRemakeIndex(itemID); if (remake < 0) { - L_RemakeColors.Visible = false; + L_RemakeBody.Visible = false; + L_RemakeFabric.Visible = false; } else { - var summary = ItemRemakeInfoData.List[remake].GetColorSummary(); - L_RemakeColors.Text = summary; - L_RemakeColors.Visible = summary.Length != 0; + var info = ItemRemakeInfoData.List[remake]; + var body = info.GetBodySummary(); + L_RemakeBody.Text = body; + L_RemakeBody.Visible = body.Length != 0; + + var fabric = info.GetFabricSummary(); + L_RemakeFabric.Text = fabric; + L_RemakeFabric.Visible = fabric.Length != 0; } } diff --git a/NHSE.WinForms/Subforms/Player/ItemReceivedEditor.cs b/NHSE.WinForms/Subforms/Player/ItemReceivedEditor.cs index 2a19729..5c906e1 100644 --- a/NHSE.WinForms/Subforms/Player/ItemReceivedEditor.cs +++ b/NHSE.WinForms/Subforms/Player/ItemReceivedEditor.cs @@ -65,7 +65,7 @@ private void FillRemake(IReadOnlyList items) string name = $"{remakeIndex:0000} V{variant:0} - {itemName}"; if (ItemRemakeInfoData.List.TryGetValue((short) remakeIndex, out var info)) - name = $"{name} ({info.GetColorDescription(variant)})"; + name = $"{name} ({info.GetBodyDescription(variant)})"; CLB_Remake.Items.Add(name, flag); }