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 PopulateFieldsPK3()
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2019-10-27 19:57:04 +00:00
|
|
|
|
if (!(Entity is G3PKM pk3))
|
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadMisc1(pk3);
|
|
|
|
|
LoadMisc2(pk3);
|
|
|
|
|
LoadMisc3(pk3);
|
|
|
|
|
|
2017-04-14 23:24:41 +00:00
|
|
|
|
CB_Ability.SelectedIndex = pk3.AbilityBit && CB_Ability.Items.Count > 1 ? 1 : 0;
|
2018-07-07 00:37:07 +00:00
|
|
|
|
if (pk3 is IShadowPKM s)
|
|
|
|
|
LoadShadow3(s);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadPartyStats(pk3);
|
2017-06-18 01:37:19 +00:00
|
|
|
|
UpdateStats();
|
2017-10-03 06:13:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-27 19:57:04 +00:00
|
|
|
|
private G3PKM PreparePK3()
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2019-10-27 19:57:04 +00:00
|
|
|
|
if (!(Entity is G3PKM pk3))
|
|
|
|
|
throw new FormatException(nameof(Entity));
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SaveMisc1(pk3);
|
|
|
|
|
SaveMisc2(pk3);
|
|
|
|
|
SaveMisc3(pk3);
|
|
|
|
|
|
2018-07-07 00:37:07 +00:00
|
|
|
|
pk3.AbilityBit = CB_Ability.SelectedIndex != 0;
|
2019-10-27 19:57:04 +00:00
|
|
|
|
if (Entity is IShadowPKM ck3)
|
2018-07-07 00:37:07 +00:00
|
|
|
|
SaveShadow3(ck3);
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SavePartyStats(pk3);
|
|
|
|
|
pk3.FixMoves();
|
2016-07-09 23:17:55 +00:00
|
|
|
|
pk3.RefreshChecksum();
|
|
|
|
|
return pk3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|