2019-10-27 19:57:04 +00:00
|
|
|
|
using System;
|
|
|
|
|
using PKHeX.Core;
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
namespace PKHeX.WinForms.Controls
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2017-05-23 04:55:05 +00:00
|
|
|
|
public partial class PKMEditor
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void PopulateFieldsPK7()
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PK7 pk7)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadMisc1(pk7);
|
|
|
|
|
LoadMisc2(pk7);
|
|
|
|
|
LoadMisc3(pk7);
|
|
|
|
|
LoadMisc4(pk7);
|
|
|
|
|
LoadMisc6(pk7);
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadPartyStats(pk7);
|
2017-06-18 01:37:19 +00:00
|
|
|
|
UpdateStats();
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
2017-10-03 06:13:40 +00:00
|
|
|
|
|
2019-10-27 19:57:04 +00:00
|
|
|
|
private PK7 PreparePK7()
|
2016-10-20 01:19:01 +00:00
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PK7 pk7)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SaveMisc1(pk7);
|
|
|
|
|
SaveMisc2(pk7);
|
|
|
|
|
SaveMisc3(pk7);
|
|
|
|
|
SaveMisc4(pk7);
|
|
|
|
|
SaveMisc6(pk7);
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
|
|
|
|
// Toss in Party Stats
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SavePartyStats(pk7);
|
2016-10-20 01:19:01 +00:00
|
|
|
|
|
|
|
|
|
// Unneeded Party Stats (Status, Flags, Unused)
|
2021-07-31 01:05:17 +00:00
|
|
|
|
pk7.Status_Condition = pk7.DirtType = pk7.DirtLocation =
|
|
|
|
|
pk7.Data[0xEF] =
|
2016-10-20 01:19:01 +00:00
|
|
|
|
pk7.Data[0xFE] = pk7.Data[0xFF] = pk7.Data[0x100] =
|
|
|
|
|
pk7.Data[0x101] = pk7.Data[0x102] = pk7.Data[0x103] = 0;
|
|
|
|
|
|
|
|
|
|
pk7.FixMoves();
|
|
|
|
|
pk7.FixRelearn();
|
2017-05-23 04:55:05 +00:00
|
|
|
|
if (ModifyPKM)
|
2016-10-20 01:19:01 +00:00
|
|
|
|
pk7.FixMemories();
|
|
|
|
|
pk7.RefreshChecksum();
|
|
|
|
|
return pk7;
|
|
|
|
|
}
|
2018-11-14 03:10:31 +00:00
|
|
|
|
|
|
|
|
|
private void PopulateFieldsPB7()
|
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PB7 pk7)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2018-11-14 03:10:31 +00:00
|
|
|
|
|
|
|
|
|
LoadMisc1(pk7);
|
|
|
|
|
LoadMisc2(pk7);
|
|
|
|
|
LoadMisc3(pk7);
|
|
|
|
|
LoadMisc4(pk7);
|
|
|
|
|
LoadMisc6(pk7);
|
|
|
|
|
LoadAVs(pk7);
|
|
|
|
|
SizeCP.LoadPKM(pk7);
|
|
|
|
|
|
|
|
|
|
LoadPartyStats(pk7);
|
|
|
|
|
UpdateStats();
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-27 19:57:04 +00:00
|
|
|
|
private PB7 PreparePB7()
|
2018-11-14 03:10:31 +00:00
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PB7 pk7)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2018-11-14 03:10:31 +00:00
|
|
|
|
|
|
|
|
|
SaveMisc1(pk7);
|
|
|
|
|
SaveMisc2(pk7);
|
|
|
|
|
SaveMisc3(pk7);
|
|
|
|
|
SaveMisc4(pk7);
|
|
|
|
|
SaveMisc6(pk7);
|
|
|
|
|
|
|
|
|
|
// Toss in Party Stats
|
|
|
|
|
SavePartyStats(pk7);
|
|
|
|
|
|
|
|
|
|
if (pk7.Stat_CP == 0)
|
|
|
|
|
pk7.ResetCP();
|
|
|
|
|
|
|
|
|
|
// heal values to original
|
|
|
|
|
pk7.FieldEventFatigue1 = pk7.FieldEventFatigue2 = 100;
|
|
|
|
|
|
|
|
|
|
pk7.FixMoves();
|
|
|
|
|
pk7.FixRelearn();
|
|
|
|
|
if (ModifyPKM)
|
|
|
|
|
pk7.FixMemories();
|
|
|
|
|
pk7.RefreshChecksum();
|
|
|
|
|
return pk7;
|
|
|
|
|
}
|
2016-10-20 01:19:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|