Add roamer3 active/level editing

This commit is contained in:
Kurt 2018-07-07 21:31:07 -07:00
parent ae04218c5f
commit 4dcac24f34
3 changed files with 50 additions and 1 deletions

View file

@ -2,7 +2,7 @@
namespace PKHeX.Core
{
public class Roamer3
public class Roamer3 : IContestStats
{
private readonly SaveFile SAV;
private readonly int Offset;
@ -36,6 +36,25 @@ namespace PKHeX.Core
get => SpeciesConverter.GetG4Species(BitConverter.ToInt16(SAV.Data, Offset + 8));
set => SAV.SetData(BitConverter.GetBytes((ushort)SpeciesConverter.GetG3Species(value)), Offset + 8);
}
public int HP_Current
{
get => BitConverter.ToInt16(SAV.Data, Offset + 10);
set => SAV.SetData(BitConverter.GetBytes((short)value), Offset + 10);
}
public int CurrentLevel
{
get => SAV.Data[Offset + 12];
set => SAV.Data[Offset + 12] = (byte)value;
}
public int Status { get => SAV.Data[Offset + 0x0D]; set => SAV.Data[Offset + 0x0D] = (byte)value; }
public int CNT_Cool { get => SAV.Data[Offset + 0x0E]; set => SAV.Data[Offset + 0x0E] = (byte)value; }
public int CNT_Beauty { get => SAV.Data[Offset + 0x0F]; set => SAV.Data[Offset + 0x0F] = (byte)value; }
public int CNT_Cute { get => SAV.Data[Offset + 0x10]; set => SAV.Data[Offset + 0x10] = (byte)value; }
public int CNT_Smart { get => SAV.Data[Offset + 0x11]; set => SAV.Data[Offset + 0x11] = (byte)value; }
public int CNT_Tough { get => SAV.Data[Offset + 0x12]; set => SAV.Data[Offset + 0x12] = (byte)value; }
public int CNT_Sheen { get => 0; set { } }
public bool Active { get => SAV.Data[Offset + 0x13] == 1; set => SAV.Data[Offset + 0x13] = (byte)(value ? 1 : 0); }
// Derived Properties
private int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); }

View file

@ -48,6 +48,9 @@
this.CB_Species = new System.Windows.Forms.ComboBox();
this.Label_Species = new System.Windows.Forms.Label();
this.CHK_Shiny = new System.Windows.Forms.CheckBox();
this.CHK_Active = new System.Windows.Forms.CheckBox();
this.NUD_Level = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit();
this.SuspendLayout();
//
// B_Save
@ -255,11 +258,30 @@
this.CHK_Shiny.Text = "Shiny?";
this.CHK_Shiny.UseVisualStyleBackColor = true;
//
// CHK_Active
//
this.CHK_Active.AutoSize = true;
this.CHK_Active.Location = new System.Drawing.Point(201, 61);
this.CHK_Active.Name = "CHK_Active";
this.CHK_Active.Size = new System.Drawing.Size(68, 30);
this.CHK_Active.TabIndex = 91;
this.CHK_Active.Text = "Roaming\r\n(Active)";
this.CHK_Active.UseVisualStyleBackColor = true;
//
// NUD_Level
//
this.NUD_Level.Location = new System.Drawing.Point(193, 12);
this.NUD_Level.Name = "NUD_Level";
this.NUD_Level.Size = new System.Drawing.Size(45, 20);
this.NUD_Level.TabIndex = 92;
//
// SAV_Roamer3
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(278, 143);
this.Controls.Add(this.NUD_Level);
this.Controls.Add(this.CHK_Active);
this.Controls.Add(this.CHK_Shiny);
this.Controls.Add(this.Label_Species);
this.Controls.Add(this.CB_Species);
@ -287,6 +309,7 @@
this.Name = "SAV_Roamer3";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Roamer Editor";
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -312,5 +335,7 @@
public System.Windows.Forms.ComboBox CB_Species;
private System.Windows.Forms.Label Label_Species;
private System.Windows.Forms.CheckBox CHK_Shiny;
private System.Windows.Forms.CheckBox CHK_Active;
private System.Windows.Forms.NumericUpDown NUD_Level;
}
}

View file

@ -33,6 +33,9 @@ namespace PKHeX.WinForms
var iv = new[] {TB_HPIV, TB_ATKIV, TB_DEFIV, TB_SPEIV, TB_SPAIV, TB_SPDIV};
for (int i = 0; i < iv.Length; i++)
iv[i].Text = IVs[i].ToString();
CHK_Active.Checked = Reader.Active;
NUD_Level.Value = Math.Min(NUD_Level.Maximum, Reader.CurrentLevel);
}
private void SaveData()
{
@ -44,6 +47,8 @@ namespace PKHeX.WinForms
Reader.PID = Util.GetHexValue(TB_PID.Text);
Reader.Species = WinFormsUtil.GetIndex(CB_Species);
Reader.IVs = IVs;
Reader.Active = CHK_Active.Checked;
Reader.CurrentLevel = (int)NUD_Level.Value;
}
private void B_Save_Click(object sender, EventArgs e)
{