2019-10-27 19:57:04 +00:00
|
|
|
|
using System;
|
|
|
|
|
using PKHeX.Core;
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
namespace PKHeX.WinForms.Controls
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2017-05-23 04:55:05 +00:00
|
|
|
|
public partial class PKMEditor
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void PopulateFieldsPK6()
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PK6 pk6)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadMisc1(pk6);
|
|
|
|
|
LoadMisc2(pk6);
|
|
|
|
|
LoadMisc3(pk6);
|
|
|
|
|
LoadMisc4(pk6);
|
|
|
|
|
LoadMisc6(pk6);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2021-06-30 03:58:06 +00:00
|
|
|
|
CB_EncounterType.SelectedValue = pk6.Gen4 ? (int)pk6.GroundTile : 0;
|
2019-10-27 19:57:04 +00:00
|
|
|
|
CB_EncounterType.Visible = Label_EncounterType.Visible = pk6.Gen4;
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadPartyStats(pk6);
|
2017-06-18 01:37:19 +00:00
|
|
|
|
UpdateStats();
|
2016-07-09 23:17:55 +00:00
|
|
|
|
}
|
2019-10-08 01:40:09 +00:00
|
|
|
|
|
2019-10-27 19:57:04 +00:00
|
|
|
|
private PK6 PreparePK6()
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2020-12-23 05:24:41 +00:00
|
|
|
|
if (Entity is not PK6 pk6)
|
2019-10-27 19:57:04 +00:00
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SaveMisc1(pk6);
|
|
|
|
|
SaveMisc2(pk6);
|
|
|
|
|
SaveMisc3(pk6);
|
|
|
|
|
SaveMisc4(pk6);
|
|
|
|
|
SaveMisc6(pk6);
|
2020-03-14 02:56:53 +00:00
|
|
|
|
CheckTransferPIDValid(pk6);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2021-06-30 03:58:06 +00:00
|
|
|
|
pk6.GroundTile = (GroundTileType)WinFormsUtil.GetIndex(CB_EncounterType);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
|
|
|
|
// Toss in Party Stats
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SavePartyStats(pk6);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
|
|
|
|
// Unneeded Party Stats (Status, Flags, Unused)
|
|
|
|
|
pk6.Data[0xE8] = pk6.Data[0xE9] = pk6.Data[0xEA] = pk6.Data[0xEB] =
|
2021-02-09 04:26:53 +00:00
|
|
|
|
pk6.Data[0xEF] =
|
2016-07-09 23:17:55 +00:00
|
|
|
|
pk6.Data[0xFE] = pk6.Data[0xFF] = pk6.Data[0x100] =
|
|
|
|
|
pk6.Data[0x101] = pk6.Data[0x102] = pk6.Data[0x103] = 0;
|
|
|
|
|
|
|
|
|
|
pk6.FixMoves();
|
|
|
|
|
pk6.FixRelearn();
|
2017-05-23 04:55:05 +00:00
|
|
|
|
if (ModifyPKM)
|
2016-07-09 23:17:55 +00:00
|
|
|
|
pk6.FixMemories();
|
|
|
|
|
pk6.RefreshChecksum();
|
|
|
|
|
return pk6;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|