2019-10-27 19:57:04 +00:00
|
|
|
|
using System;
|
|
|
|
|
using PKHeX.Core;
|
2016-07-09 23:17:55 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
|
|
|
|
|
|
public partial class PKMEditor
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
private void PopulateFieldsPK3()
|
|
|
|
|
{
|
|
|
|
|
if (Entity is not G3PKM pk3)
|
|
|
|
|
throw new FormatException(nameof(Entity));
|
|
|
|
|
|
|
|
|
|
LoadMisc1(pk3);
|
|
|
|
|
LoadMisc2(pk3);
|
|
|
|
|
LoadMisc3(pk3);
|
|
|
|
|
|
|
|
|
|
CB_Ability.SelectedIndex = pk3.AbilityBit && CB_Ability.Items.Count > 1 ? 1 : 0;
|
2022-11-25 01:42:17 +00:00
|
|
|
|
if (pk3 is IShadowCapture s)
|
2022-06-18 18:04:24 +00:00
|
|
|
|
LoadShadow3(s);
|
|
|
|
|
|
|
|
|
|
LoadPartyStats(pk3);
|
|
|
|
|
UpdateStats();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private G3PKM PreparePK3()
|
2016-07-09 23:17:55 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
if (Entity is not G3PKM pk3)
|
|
|
|
|
throw new FormatException(nameof(Entity));
|
|
|
|
|
|
|
|
|
|
SaveMisc1(pk3);
|
|
|
|
|
SaveMisc2(pk3);
|
|
|
|
|
SaveMisc3(pk3);
|
|
|
|
|
|
|
|
|
|
pk3.AbilityBit = CB_Ability.SelectedIndex != 0;
|
2022-11-25 01:42:17 +00:00
|
|
|
|
if (Entity is IShadowCapture ck3)
|
2022-06-18 18:04:24 +00:00
|
|
|
|
SaveShadow3(ck3);
|
|
|
|
|
|
|
|
|
|
SavePartyStats(pk3);
|
|
|
|
|
pk3.FixMoves();
|
|
|
|
|
pk3.RefreshChecksum();
|
|
|
|
|
return pk3;
|
2016-07-09 23:17:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|