diff --git a/PKHeX.Core/Saves/Substructures/Gen4/Poffin4.cs b/PKHeX.Core/Saves/Substructures/Gen4/Poffin4.cs
index 8776aa667..a91160b84 100644
--- a/PKHeX.Core/Saves/Substructures/Gen4/Poffin4.cs
+++ b/PKHeX.Core/Saves/Substructures/Gen4/Poffin4.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
namespace PKHeX.Core
{
@@ -10,23 +11,37 @@ public class Poffin4
public Poffin4(byte[] data, int offset)
{
Data = new byte[SIZE];
- Array.Copy(data, offset, data, 0, SIZE);
+ Array.Copy(data, offset, Data, 0, SIZE);
}
+ private const string Stats = nameof(Stats);
+
public Poffin4(byte[] data) => Data = data;
public PoffinFlavor4 Type{ get => (PoffinFlavor4)Data[0]; set => Data[0] = (byte)value; }
+
+ [Category(Stats), Description("Cool Stat Boost")]
public byte BoostSpicy { get => Data[1]; set => Data[1] = value; }
+
+ [Category(Stats), Description("Beauty Stat Boost")]
public byte BoostDry { get => Data[2]; set => Data[2] = value; }
+
+ [Category(Stats), Description("Cute Stat Boost")]
public byte BoostSweet { get => Data[3]; set => Data[3] = value; }
+
+ [Category(Stats), Description("Smart/Clever Stat Boost")]
public byte BoostBitter { get => Data[4]; set => Data[4] = value; }
+
+ [Category(Stats), Description("Tough Stat Boost")]
public byte BoostSour { get => Data[5]; set => Data[5] = value; }
+
+ [Category(Stats), Description("Sheen Stat Boost")]
public byte Smoothness { get => Data[6]; set => Data[6] = value; }
// public byte Unused { get => Data[7]; set => Data[7] = value; }
public bool IsManyStat => Type >= PoffinFlavor4.Rich;
- public int StatPrimary => IsManyStat ? -1 : (byte)Type / 5;
- public int StatSecondary => IsManyStat ? -1 : (byte)Type % 5;
+ public PoffinFlavor4 StatPrimary => IsManyStat ? PoffinFlavor4.None : (PoffinFlavor4)(((byte) Type / 5) * 6);
+ public PoffinFlavor4 StatSecondary => IsManyStat ? PoffinFlavor4.None : (PoffinFlavor4)(((byte)Type % 5) * 6);
public void SetAll(byte value = 255, PoffinFlavor4 type = PoffinFlavor4.Rich)
{
diff --git a/PKHeX.WinForms/PKHeX.WinForms.csproj b/PKHeX.WinForms/PKHeX.WinForms.csproj
index 3eff67567..7e248580d 100644
--- a/PKHeX.WinForms/PKHeX.WinForms.csproj
+++ b/PKHeX.WinForms/PKHeX.WinForms.csproj
@@ -301,6 +301,12 @@
+
+ UserControl
+
+
+ PoffinCase4Editor.cs
+
Form
@@ -710,6 +716,9 @@
Designer
Resources.Designer.cs
+
+ PoffinCase4Editor.cs
+
SAV_Apricorn.cs
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.Designer.cs
new file mode 100644
index 000000000..59261b486
--- /dev/null
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.Designer.cs
@@ -0,0 +1,101 @@
+namespace PKHeX.WinForms
+{
+ partial class PoffinCase4Editor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.LB_Poffins = new System.Windows.Forms.ListBox();
+ this.B_PoffinDel = new System.Windows.Forms.Button();
+ this.B_PoffinAll = new System.Windows.Forms.Button();
+ this.PG_Poffins = new System.Windows.Forms.PropertyGrid();
+ this.SuspendLayout();
+ //
+ // LB_Poffins
+ //
+ this.LB_Poffins.FormattingEnabled = true;
+ this.LB_Poffins.Location = new System.Drawing.Point(0, 2);
+ this.LB_Poffins.Name = "LB_Poffins";
+ this.LB_Poffins.Size = new System.Drawing.Size(120, 225);
+ this.LB_Poffins.TabIndex = 12;
+ this.LB_Poffins.SelectedIndexChanged += new System.EventHandler(this.LB_Poffins_SelectedIndexChanged);
+ //
+ // B_PoffinDel
+ //
+ this.B_PoffinDel.Location = new System.Drawing.Point(211, 201);
+ this.B_PoffinDel.Name = "B_PoffinDel";
+ this.B_PoffinDel.Size = new System.Drawing.Size(82, 26);
+ this.B_PoffinDel.TabIndex = 11;
+ this.B_PoffinDel.Text = "Delete All";
+ this.B_PoffinDel.UseVisualStyleBackColor = true;
+ this.B_PoffinDel.Click += new System.EventHandler(this.B_PoffinDel_Click);
+ //
+ // B_PoffinAll
+ //
+ this.B_PoffinAll.Location = new System.Drawing.Point(126, 201);
+ this.B_PoffinAll.Name = "B_PoffinAll";
+ this.B_PoffinAll.Size = new System.Drawing.Size(79, 26);
+ this.B_PoffinAll.TabIndex = 10;
+ this.B_PoffinAll.Text = "Give All";
+ this.B_PoffinAll.UseVisualStyleBackColor = true;
+ this.B_PoffinAll.Click += new System.EventHandler(this.B_PoffinAll_Click);
+ //
+ // PG_Poffins
+ //
+ this.PG_Poffins.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.PG_Poffins.HelpVisible = false;
+ this.PG_Poffins.Location = new System.Drawing.Point(126, 2);
+ this.PG_Poffins.Name = "PG_Poffins";
+ this.PG_Poffins.PropertySort = System.Windows.Forms.PropertySort.Categorized;
+ this.PG_Poffins.Size = new System.Drawing.Size(221, 195);
+ this.PG_Poffins.TabIndex = 9;
+ this.PG_Poffins.ToolbarVisible = false;
+ this.PG_Poffins.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PG_Poffins_PropertyValueChanged);
+ //
+ // PoffinCase4Editor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.LB_Poffins);
+ this.Controls.Add(this.B_PoffinDel);
+ this.Controls.Add(this.B_PoffinAll);
+ this.Controls.Add(this.PG_Poffins);
+ this.Name = "PoffinCase4Editor";
+ this.Size = new System.Drawing.Size(347, 232);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListBox LB_Poffins;
+ private System.Windows.Forms.Button B_PoffinDel;
+ private System.Windows.Forms.Button B_PoffinAll;
+ private System.Windows.Forms.PropertyGrid PG_Poffins;
+ }
+}
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.cs
new file mode 100644
index 000000000..65ea1c0c4
--- /dev/null
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Windows.Forms;
+using PKHeX.Core;
+
+namespace PKHeX.WinForms
+{
+ public partial class PoffinCase4Editor : UserControl
+ {
+ public PoffinCase4Editor() => InitializeComponent();
+ private PoffinCase4 Case;
+ private int CurrentIndex = -1;
+ private bool Updating;
+
+ public void Initialize(SAV4 sav)
+ {
+ Case = new PoffinCase4(sav);
+
+ LB_Poffins.Items.Clear();
+ for (int i = 0; i < Case.Poffins.Length; i++)
+ LB_Poffins.Items.Add(GetPoffinText(i));
+
+ LB_Poffins.SelectedIndex = 0;
+ }
+
+ private void RefreshList()
+ {
+ Updating = true;
+ for (int i = 0; i < Case.Poffins.Length; i++)
+ LB_Poffins.Items[i] = GetPoffinText(i);
+ Updating = false;
+ }
+
+ private string GetPoffinText(int i) => $"{i + 1:000} - {Case.Poffins[i].Type.ToString().Replace('_', '/')}";
+
+ public void Save()
+ {
+ SaveIndex(CurrentIndex);
+ Case.Save();
+ }
+
+ private void SaveIndex(int i)
+ {
+ // do nothing, propertygrid handles everything
+ if (i < 0)
+ return;
+ Updating = true;
+ LB_Poffins.Items[i] = GetPoffinText(i);
+ Updating = false;
+ }
+
+ private void LoadIndex(int i)
+ {
+ if (i < 0)
+ {
+ LB_Poffins.SelectedIndex = 0;
+ return;
+ }
+ PG_Poffins.SelectedObject = Case.Poffins[i];
+ }
+
+ private void LB_Poffins_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (Updating)
+ return;
+ SaveIndex(CurrentIndex);
+ LoadIndex(CurrentIndex = LB_Poffins.SelectedIndex);
+ }
+
+ private void B_PoffinAll_Click(object sender, EventArgs e)
+ {
+ Case.FillCase();
+ PG_Poffins.Refresh();
+ RefreshList();
+ }
+
+ private void B_PoffinDel_Click(object sender, EventArgs e)
+ {
+
+ Case.DeleteAll();
+ PG_Poffins.Refresh();
+ RefreshList();
+ }
+
+ private void PG_Poffins_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
+ {
+ SaveIndex(LB_Poffins.SelectedIndex);
+ }
+ }
+}
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.resx b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.resx
new file mode 100644
index 000000000..3b2f19be7
--- /dev/null
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/PoffinCase4Editor.resx
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.Designer.cs
index f35220c01..2bf6c52af 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.Designer.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.Designer.cs
@@ -101,8 +101,10 @@ private void InitializeComponent()
this.TAB_Walker = new System.Windows.Forms.TabPage();
this.B_UnlockCourses = new System.Windows.Forms.Button();
this.Tab_Misc = new System.Windows.Forms.TabPage();
- this.B_AllSealsLegal = new System.Windows.Forms.Button();
this.B_AllSealsIllegal = new System.Windows.Forms.Button();
+ this.B_AllSealsLegal = new System.Windows.Forms.Button();
+ this.Tab_Poffins = new System.Windows.Forms.TabPage();
+ this.poffinCase4Editor1 = new PKHeX.WinForms.PoffinCase4Editor();
this.TC_Misc.SuspendLayout();
this.TAB_Main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Coin)).BeginInit();
@@ -143,6 +145,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_CastleRankInfo)).BeginInit();
this.TAB_Walker.SuspendLayout();
this.Tab_Misc.SuspendLayout();
+ this.Tab_Poffins.SuspendLayout();
this.SuspendLayout();
//
// B_Cancel
@@ -169,10 +172,14 @@ private void InitializeComponent()
//
// TC_Misc
//
+ this.TC_Misc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.TC_Misc.Controls.Add(this.TAB_Main);
this.TC_Misc.Controls.Add(this.TAB_BF);
this.TC_Misc.Controls.Add(this.TAB_Walker);
this.TC_Misc.Controls.Add(this.Tab_Misc);
+ this.TC_Misc.Controls.Add(this.Tab_Poffins);
this.TC_Misc.Location = new System.Drawing.Point(12, 13);
this.TC_Misc.Name = "TC_Misc";
this.TC_Misc.SelectedIndex = 0;
@@ -1166,6 +1173,16 @@ private void InitializeComponent()
this.Tab_Misc.Text = "Misc";
this.Tab_Misc.UseVisualStyleBackColor = true;
//
+ // B_AllSealsIllegal
+ //
+ this.B_AllSealsIllegal.Location = new System.Drawing.Point(6, 49);
+ this.B_AllSealsIllegal.Name = "B_AllSealsIllegal";
+ this.B_AllSealsIllegal.Size = new System.Drawing.Size(120, 37);
+ this.B_AllSealsIllegal.TabIndex = 1;
+ this.B_AllSealsIllegal.Text = "Give All Seals (Illegal)";
+ this.B_AllSealsIllegal.UseVisualStyleBackColor = true;
+ this.B_AllSealsIllegal.Click += new System.EventHandler(this.OnBAllSealsLegalOnClick);
+ //
// B_AllSealsLegal
//
this.B_AllSealsLegal.Location = new System.Drawing.Point(6, 6);
@@ -1176,15 +1193,24 @@ private void InitializeComponent()
this.B_AllSealsLegal.UseVisualStyleBackColor = true;
this.B_AllSealsLegal.Click += new System.EventHandler(this.OnBAllSealsLegalOnClick);
//
- // B_AllSealsIllegal
+ // Tab_Poffins
//
- this.B_AllSealsIllegal.Location = new System.Drawing.Point(6, 49);
- this.B_AllSealsIllegal.Name = "B_AllSealsIllegal";
- this.B_AllSealsIllegal.Size = new System.Drawing.Size(120, 37);
- this.B_AllSealsIllegal.TabIndex = 1;
- this.B_AllSealsIllegal.Text = "Give All Seals (Illegal)";
- this.B_AllSealsIllegal.UseVisualStyleBackColor = true;
- this.B_AllSealsIllegal.Click += new System.EventHandler(this.OnBAllSealsLegalOnClick);
+ this.Tab_Poffins.Controls.Add(this.poffinCase4Editor1);
+ this.Tab_Poffins.Location = new System.Drawing.Point(4, 22);
+ this.Tab_Poffins.Name = "Tab_Poffins";
+ this.Tab_Poffins.Padding = new System.Windows.Forms.Padding(3);
+ this.Tab_Poffins.Size = new System.Drawing.Size(373, 239);
+ this.Tab_Poffins.TabIndex = 4;
+ this.Tab_Poffins.Text = "Poffins";
+ this.Tab_Poffins.UseVisualStyleBackColor = true;
+ //
+ // poffinCase4Editor1
+ //
+ this.poffinCase4Editor1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.poffinCase4Editor1.Location = new System.Drawing.Point(3, 3);
+ this.poffinCase4Editor1.Name = "poffinCase4Editor1";
+ this.poffinCase4Editor1.Size = new System.Drawing.Size(367, 233);
+ this.poffinCase4Editor1.TabIndex = 0;
//
// SAV_Misc4
//
@@ -1241,6 +1267,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_CastleRankInfo)).EndInit();
this.TAB_Walker.ResumeLayout(false);
this.Tab_Misc.ResumeLayout(false);
+ this.Tab_Poffins.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -1321,5 +1348,7 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage Tab_Misc;
private System.Windows.Forms.Button B_AllSealsIllegal;
private System.Windows.Forms.Button B_AllSealsLegal;
+ private System.Windows.Forms.TabPage Tab_Poffins;
+ private PoffinCase4Editor poffinCase4Editor1;
}
}
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs
index 08384d900..5cd88a8f3 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs
@@ -76,13 +76,22 @@ public SAV_Misc4(SaveFile sav)
ReadMain();
ReadBattleFrontier();
if (!SAV.HGSS)
+ {
TC_Misc.Controls.Remove(TAB_Walker);
+ poffinCase4Editor1.Initialize(SAV);
+ }
+ else
+ {
+ TC_Misc.Controls.Remove(Tab_Poffins);
+ }
}
private void B_Save_Click(object sender, EventArgs e)
{
SaveMain();
SaveBattleFrontier();
+ if (!SAV.HGSS)
+ poffinCase4Editor1.Save();
Origin.SetData(SAV.Data, 0);
Close();