PKHeX/PKHeX.WinForms/Controls/PKM Editor/EditPK6.cs

58 lines
1.6 KiB
C#
Raw Normal View History

using System;
using PKHeX.Core;
2016-07-09 23:17:55 +00:00
namespace PKHeX.WinForms.Controls
2016-07-09 23:17:55 +00:00
{
public partial class PKMEditor
2016-07-09 23:17:55 +00:00
{
private void PopulateFieldsPK6()
2016-07-09 23:17:55 +00:00
{
if (!(Entity is PK6 pk6))
throw new FormatException(nameof(Entity));
2016-07-09 23:17:55 +00:00
LoadMisc1(pk6);
LoadMisc2(pk6);
LoadMisc3(pk6);
LoadMisc4(pk6);
LoadMisc6(pk6);
2016-07-09 23:17:55 +00:00
CB_EncounterType.SelectedValue = pk6.Gen4 ? pk6.EncounterType : 0;
CB_EncounterType.Visible = Label_EncounterType.Visible = pk6.Gen4;
2016-07-09 23:17:55 +00:00
LoadPartyStats(pk6);
UpdateStats();
2016-07-09 23:17:55 +00:00
}
private PK6 PreparePK6()
2016-07-09 23:17:55 +00:00
{
if (!(Entity is PK6 pk6))
throw new FormatException(nameof(Entity));
2016-07-09 23:17:55 +00:00
CheckTransferPIDValid();
SaveMisc1(pk6);
SaveMisc2(pk6);
SaveMisc3(pk6);
SaveMisc4(pk6);
SaveMisc6(pk6);
2016-07-09 23:17:55 +00:00
pk6.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
2016-07-09 23:17:55 +00:00
// Toss in Party Stats
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] =
pk6.Data[0xED] = pk6.Data[0xEE] = pk6.Data[0xEF] =
pk6.Data[0xFE] = pk6.Data[0xFF] = pk6.Data[0x100] =
pk6.Data[0x101] = pk6.Data[0x102] = pk6.Data[0x103] = 0;
pk6.FixMoves();
pk6.FixRelearn();
if (ModifyPKM)
2016-07-09 23:17:55 +00:00
pk6.FixMemories();
pk6.RefreshChecksum();
return pk6;
}
}
}