PKHeX/PKHeX.WinForms/Controls/PKM Editor/EditPK6.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00

55 lines
1.4 KiB
C#

using System;
using PKHeX.Core;
namespace PKHeX.WinForms.Controls;
public partial class PKMEditor
{
private void PopulateFieldsPK6()
{
if (Entity is not PK6 pk6)
throw new FormatException(nameof(Entity));
LoadMisc1(pk6);
LoadMisc2(pk6);
LoadMisc3(pk6);
LoadMisc4(pk6);
LoadMisc6(pk6);
CB_GroundTile.SelectedValue = pk6.Gen4 ? (int)pk6.GroundTile : 0;
CB_GroundTile.Visible = Label_GroundTile.Visible = pk6.Gen4;
LoadPartyStats(pk6);
UpdateStats();
}
private PK6 PreparePK6()
{
if (Entity is not PK6 pk6)
throw new FormatException(nameof(Entity));
SaveMisc1(pk6);
SaveMisc2(pk6);
SaveMisc3(pk6);
SaveMisc4(pk6);
SaveMisc6(pk6);
pk6.GroundTile = (GroundTileType)WinFormsUtil.GetIndex(CB_GroundTile);
// Toss in Party Stats
SavePartyStats(pk6);
// Unneeded Party Stats (Status, Flags, Unused)
pk6.Data[0xE8] = pk6.Data[0xE9] = pk6.Data[0xEA] = pk6.Data[0xEB] =
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)
pk6.FixMemories();
pk6.RefreshChecksum();
return pk6;
}
}