Add Gen 1 Pikachu Friendship Support (Closes #538)

This commit is contained in:
Michael Scire 2017-01-05 01:14:19 -08:00
parent 860742bd33
commit 89622862b2
3 changed files with 42 additions and 0 deletions

View file

@ -243,6 +243,12 @@ namespace PKHeX
get { return 0; }
set { }
}
public byte PikaFriendship
{
get { return Data[Japanese ? 0x2712 : 0x271C]; }
set { Data[Japanese ? 0x2712 : 0x271C] = value; }
}
public override int PlayedHours
{
get { return BitConverter.ToUInt16(Data, Japanese ? 0x2CA0 : 0x2CED); }

View file

@ -92,6 +92,8 @@
this.LBL_BattleStyle = new System.Windows.Forms.Label();
this.CB_BattleStyle = new System.Windows.Forms.ComboBox();
this.CHK_BattleEffects = new System.Windows.Forms.CheckBox();
this.L_PikaFriend = new System.Windows.Forms.Label();
this.MT_PikaFriend = new System.Windows.Forms.MaskedTextBox();
this.GB_Adventure.SuspendLayout();
this.GB_Map.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).BeginInit();
@ -105,6 +107,8 @@
//
// GB_Adventure
//
this.GB_Adventure.Controls.Add(this.L_PikaFriend);
this.GB_Adventure.Controls.Add(this.MT_PikaFriend);
this.GB_Adventure.Controls.Add(this.L_Started);
this.GB_Adventure.Controls.Add(this.CAL_AdventureStartDate);
this.GB_Adventure.Controls.Add(this.CAL_HoFDate);
@ -792,6 +796,27 @@
this.CHK_BattleEffects.Text = "Use Battle Effects";
this.CHK_BattleEffects.UseVisualStyleBackColor = true;
//
// L_PikaFriend
//
this.L_PikaFriend.AutoSize = true;
this.L_PikaFriend.Location = new System.Drawing.Point(7, 44);
this.L_PikaFriend.Name = "L_PikaFriend";
this.L_PikaFriend.Size = new System.Drawing.Size(100, 13);
this.L_PikaFriend.TabIndex = 73;
this.L_PikaFriend.Text = "Pikachu Friendship:";
this.L_PikaFriend.Visible = false;
//
// MT_PikaFriend
//
this.MT_PikaFriend.Location = new System.Drawing.Point(111, 40);
this.MT_PikaFriend.Mask = "000";
this.MT_PikaFriend.Name = "MT_PikaFriend";
this.MT_PikaFriend.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_PikaFriend.Size = new System.Drawing.Size(39, 20);
this.MT_PikaFriend.TabIndex = 72;
this.MT_PikaFriend.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.MT_PikaFriend.Visible = false;
//
// SAV_SimpleTrainer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -891,5 +916,7 @@
private System.Windows.Forms.Label LBL_BattleStyle;
private System.Windows.Forms.ComboBox CB_BattleStyle;
private System.Windows.Forms.CheckBox CHK_BattleEffects;
private System.Windows.Forms.Label L_PikaFriend;
private System.Windows.Forms.MaskedTextBox MT_PikaFriend;
}
}

View file

@ -25,6 +25,8 @@ namespace PKHeX
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;
TB_OTName.Text = SAV.OT;
CB_Gender.SelectedIndex = SAV.Gender;
MT_TID.Text = SAV.TID.ToString("00000");
@ -55,6 +57,8 @@ namespace PKHeX
CB_BattleStyle.SelectedIndex = sav1.BattleStyleSwitch ? 0 : 1;
CB_SoundType.SelectedIndex = sav1.Sound;
CB_TextSpeed.SelectedIndex = sav1.TextSpeed;
MT_PikaFriend.Text = sav1.PikaFriendship.ToString();
}
if (SAV is SAV2)
@ -174,6 +178,11 @@ namespace PKHeX
sav1.Coin = (ushort) Util.ToUInt32(MT_Coins.Text);
sav1.Badges = badgeval & 0xFF;
var pf = Util.ToUInt32(MT_PikaFriend.Text);
if (pf > 255)
pf = 255;
sav1.PikaFriendship = (byte) pf;
sav1.BattleEffects = CHK_BattleEffects.Checked;
sav1.BattleStyleSwitch = CB_BattleStyle.SelectedIndex == 0;
sav1.Sound = CB_SoundType.SelectedIndex;