mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-21 09:53:14 +00:00
a9892203c7
extract pkm loading routines to smaller methods reduce code duplication (rely on empty setters to ignore some calls) should be much easier to understand the load/save process; the original setup (pk6) was following the structure from 0x00-end, no point still doing that as everything is now abstracted.
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using PKHeX.Core;
|
|
|
|
namespace PKHeX.WinForms.Controls
|
|
{
|
|
public partial class PKMEditor
|
|
{
|
|
private void PopulateFieldsPK7()
|
|
{
|
|
if (!(pkm is PK7 pk7))
|
|
return;
|
|
|
|
LoadMisc1(pk7);
|
|
LoadMisc2(pk7);
|
|
LoadMisc3(pk7);
|
|
LoadMisc4(pk7);
|
|
LoadMisc6(pk7);
|
|
|
|
LoadPartyStats(pk7);
|
|
UpdateStats();
|
|
}
|
|
|
|
private PKM PreparePK7()
|
|
{
|
|
if (!(pkm is PK7 pk7))
|
|
return null;
|
|
|
|
CheckTransferPIDValid();
|
|
SaveMisc1(pk7);
|
|
SaveMisc2(pk7);
|
|
SaveMisc3(pk7);
|
|
SaveMisc4(pk7);
|
|
SaveMisc6(pk7);
|
|
|
|
// Toss in Party Stats
|
|
SavePartyStats(pk7);
|
|
|
|
// Unneeded Party Stats (Status, Flags, Unused)
|
|
pk7.Data[0xE8] = pk7.Data[0xE9] = pk7.Data[0xEA] = pk7.Data[0xEB] =
|
|
pk7.Data[0xED] = pk7.Data[0xEE] = pk7.Data[0xEF] =
|
|
pk7.Data[0xFE] = pk7.Data[0xFF] = pk7.Data[0x100] =
|
|
pk7.Data[0x101] = pk7.Data[0x102] = pk7.Data[0x103] = 0;
|
|
|
|
pk7.FixMoves();
|
|
pk7.FixRelearn();
|
|
if (ModifyPKM)
|
|
pk7.FixMemories();
|
|
pk7.RefreshChecksum();
|
|
return pk7;
|
|
}
|
|
}
|
|
}
|