PKHeX/PKHeX.WinForms/Controls/PKM Editor/EditPK2.cs
Kurt b41f2a3062 Extract logic from PKX
Extract Species Name logic to SpeciesName
Extract Language logic to Language
Remove FormConverter wrapper for string[] fetch
Rearrange some logic to more appropriate locations, update access
modifiers / types
Move some pkm array methods to arrayutil, make generic

PKX.GetVCLanguage was a dupe of _K12.GuessedLanguage() so just expose
the method

PKX is now back to pkm data manip only
2019-09-18 19:58:23 -07:00

44 lines
1.1 KiB
C#

using PKHeX.Core;
namespace PKHeX.WinForms.Controls
{
public partial class PKMEditor
{
private void PopulateFieldsPK2()
{
if (!(pkm is PK2 pk2))
return;
LoadMisc1(pk2);
LoadMisc2(pk2);
TID_Trainer.LoadIDValues(pk2);
TB_MetLevel.Text = pk2.Met_Level.ToString();
CB_MetLocation.SelectedValue = pk2.Met_Location;
CB_MetTimeOfDay.SelectedIndex = pk2.Met_TimeOfDay;
// Attempt to detect language
CB_Language.SelectedValue = pk2.GuessedLanguage();
LoadPartyStats(pk2);
UpdateStats();
}
private PKM PreparePK2()
{
if (!(pkm is PK2 pk2))
return null;
SaveMisc1(pk2);
SaveMisc2(pk2);
pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text);
pk2.Met_Location = WinFormsUtil.GetIndex(CB_MetLocation);
pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex;
SavePartyStats(pk2);
pk2.FixMoves();
return pk2;
}
}
}