Gen 6: Fix Pokemon Link data saving, enable modify BP and PM (#4401)

* Gen6: Fix Pokemon Link data saving, enable modify BP and PM
This commit is contained in:
R-YaTian
2024-12-17 10:35:48 +08:00
committed by GitHub
parent 8e42776610
commit c198ab08e0
2 changed files with 13 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
namespace PKHeX.WinForms
namespace PKHeX.WinForms
{
partial class SAV_Link6
{
@@ -200,6 +200,7 @@ private void InitializeComponent()
B_Export.TabIndex = 4;
B_Export.Text = "Export";
B_Export.UseVisualStyleBackColor = true;
B_Export.Enabled = false;
B_Export.Click += B_Export_Click;
//
// B_Import
@@ -303,7 +304,7 @@ private void InitializeComponent()
NUD_BP.Enabled = false;
NUD_BP.Location = new System.Drawing.Point(99, 74);
NUD_BP.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
NUD_BP.Maximum = new decimal(new int[] { 65535, 0, 0, 0 });
NUD_BP.Maximum = new decimal(new int[] { 9999, 0, 0, 0 });
NUD_BP.Name = "NUD_BP";
NUD_BP.Size = new System.Drawing.Size(68, 23);
NUD_BP.TabIndex = 144;

View File

@@ -10,7 +10,7 @@ public partial class SAV_Link6 : Form
private readonly SaveFile Origin;
private readonly ISaveBlock6Main SAV;
private PL6 Gifts;
private readonly PL6 Gifts;
public SAV_Link6(SaveFile sav)
{
@@ -52,10 +52,9 @@ private void B_Import_Click(object sender, EventArgs e)
{ WinFormsUtil.Alert("Invalid file length"); return; }
byte[] data = File.ReadAllBytes(ofd.FileName);
Gifts = new PL6(data);
data.AsSpan().CopyTo(Gifts.Data);
LoadLinkData();
B_Export.Enabled = true;
}
private void B_Export_Click(object sender, EventArgs e)
@@ -72,7 +71,6 @@ private void B_Export_Click(object sender, EventArgs e)
private void LoadLinkData()
{
RTB_LinkSource.Text = Gifts.Origin;
CHK_LinkAvailable.Checked = Gifts.Enabled;
NUD_BP.Value = Gifts.BattlePoints;
NUD_Pokemiles.Value = Gifts.Pokemiles;
@@ -98,6 +96,14 @@ private void LoadLinkData()
TB_PKM4.Text = GetSpecies(Gifts.Entity4.Species);
TB_PKM5.Text = GetSpecies(Gifts.Entity5.Species);
TB_PKM6.Text = GetSpecies(Gifts.Entity6.Species);
if (Gifts.Enabled)
{
NUD_BP.Enabled = true;
NUD_Pokemiles.Enabled = true;
B_Export.Enabled = true;
}
CHK_LinkAvailable.Checked = Gifts.Enabled;
}
private static string GetSpecies(ushort species)