Add Pikachu Beach Score editing for YW saves

Closes #2585
This commit is contained in:
Kurt 2019-12-21 15:17:05 -08:00
parent 8309060298
commit ce463d057a
4 changed files with 39 additions and 1 deletions

View file

@ -263,6 +263,12 @@ namespace PKHeX.Core
set => Data[Offsets.PikaFriendship] = value;
}
public int PikaBeachScore
{
get => BigEndian.BCDToInt32(Data, Offsets.PikaBeachScore, 2);
set => SetData(BigEndian.Int32ToBCD(Math.Min(9999, value), 2), Offsets.PikaBeachScore);
}
public override string PlayTimeString => !PlayedMaximum ? base.PlayTimeString : $"{base.PlayTimeString} {Checksums.CRC16_CCITT(Data):X4}";
public override int PlayedHours

View file

@ -15,6 +15,7 @@
Badges = 0x2602,
TID = 0x2605,
PikaFriendship = 0x271C,
PikaBeachScore = 0x2741,
PrinterBrightness = 0x2744,
PCItems = 0x27E6,
CurrentBoxIndex = 0x284C,
@ -39,6 +40,7 @@
Badges = 0x25F8,
TID = 0x25FB,
PikaFriendship = 0x2712,
PikaBeachScore = 0x2737,
PrinterBrightness = 0x273A,
PCItems = 0x27DC,
CurrentBoxIndex = 0x2842,
@ -62,6 +64,7 @@
public int Badges { get; private set; }
public int TID { get; private set; }
public int PikaFriendship { get; private set; }
public int PikaBeachScore { get; private set; }
public int PrinterBrightness { get; private set; }
public int PCItems { get; private set; }
public int CurrentBoxIndex { get; private set; }

View file

@ -29,6 +29,8 @@
private void InitializeComponent()
{
this.GB_Adventure = new System.Windows.Forms.GroupBox();
this.L_PikaBeach = new System.Windows.Forms.Label();
this.MT_PikaBeach = new System.Windows.Forms.MaskedTextBox();
this.L_PikaFriend = new System.Windows.Forms.Label();
this.MT_PikaFriend = new System.Windows.Forms.MaskedTextBox();
this.L_Started = new System.Windows.Forms.Label();
@ -106,6 +108,8 @@
//
// GB_Adventure
//
this.GB_Adventure.Controls.Add(this.L_PikaBeach);
this.GB_Adventure.Controls.Add(this.MT_PikaBeach);
this.GB_Adventure.Controls.Add(this.L_PikaFriend);
this.GB_Adventure.Controls.Add(this.MT_PikaFriend);
this.GB_Adventure.Controls.Add(this.L_Started);
@ -127,6 +131,27 @@
this.GB_Adventure.TabStop = false;
this.GB_Adventure.Text = "Adventure Info";
//
// L_PikaBeach
//
this.L_PikaBeach.AutoSize = true;
this.L_PikaBeach.Location = new System.Drawing.Point(7, 68);
this.L_PikaBeach.Name = "L_PikaBeach";
this.L_PikaBeach.Size = new System.Drawing.Size(83, 13);
this.L_PikaBeach.TabIndex = 75;
this.L_PikaBeach.Text = "Pikachu Beach:";
this.L_PikaBeach.Visible = false;
//
// MT_PikaBeach
//
this.MT_PikaBeach.Location = new System.Drawing.Point(111, 64);
this.MT_PikaBeach.Mask = "0000";
this.MT_PikaBeach.Name = "MT_PikaBeach";
this.MT_PikaBeach.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_PikaBeach.Size = new System.Drawing.Size(39, 20);
this.MT_PikaBeach.TabIndex = 74;
this.MT_PikaBeach.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.MT_PikaBeach.Visible = false;
//
// L_PikaFriend
//
this.L_PikaFriend.AutoSize = true;
@ -918,5 +943,7 @@
private System.Windows.Forms.CheckBox CHK_BattleEffects;
private System.Windows.Forms.Label L_PikaFriend;
private System.Windows.Forms.MaskedTextBox MT_PikaFriend;
private System.Windows.Forms.Label L_PikaBeach;
private System.Windows.Forms.MaskedTextBox MT_PikaBeach;
}
}

View file

@ -31,7 +31,7 @@ namespace PKHeX.WinForms
L_Coins.Visible = B_MaxCoins.Visible = MT_Coins.Visible = SAV.Generation < 3;
CB_Gender.Visible = SAV.Generation > 1;
L_PikaFriend.Visible = MT_PikaFriend.Visible = SAV.Generation == 1;
L_PikaFriend.Visible = MT_PikaFriend.Visible = L_PikaBeach.Visible = MT_PikaBeach.Visible = SAV.Generation == 1;
TB_OTName.Text = SAV.OT;
CB_Gender.SelectedIndex = SAV.Gender;
@ -63,6 +63,7 @@ namespace PKHeX.WinForms
CB_TextSpeed.SelectedIndex = sav1.TextSpeed;
MT_PikaFriend.Text = sav1.PikaFriendship.ToString();
MT_PikaBeach.Text = sav1.PikaBeachScore.ToString();
if (!sav1.Version.Contains(GameVersion.YW))
{
L_PikaFriend.Visible = MT_PikaFriend.Visible = false;
@ -204,6 +205,7 @@ namespace PKHeX.WinForms
sav1.Coin = (ushort)Math.Min(Util.ToUInt32(MT_Coins.Text), SAV.MaxCoins);
sav1.Badges = badgeval & 0xFF;
sav1.PikaFriendship = (byte)Math.Min(255, Util.ToUInt32(MT_PikaFriend.Text));
sav1.PikaBeachScore = (byte)Math.Min(9999, Util.ToUInt32(MT_PikaBeach.Text));
sav1.BattleEffects = CHK_BattleEffects.Checked;
sav1.BattleStyleSwitch = CB_BattleStyle.SelectedIndex == 0;
sav1.Sound = CB_SoundType.SelectedIndex;