2017-10-03 06:13:40 +00:00
|
|
|
|
using PKHeX.Core;
|
2016-09-02 21:20:39 +00:00
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
namespace PKHeX.WinForms.Controls
|
2016-09-02 21:20:39 +00:00
|
|
|
|
{
|
2017-05-23 04:55:05 +00:00
|
|
|
|
public partial class PKMEditor
|
2016-09-02 21:20:39 +00:00
|
|
|
|
{
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void PopulateFieldsPK2()
|
2016-09-02 21:20:39 +00:00
|
|
|
|
{
|
2017-10-03 06:13:40 +00:00
|
|
|
|
if (!(pkm is PK2 pk2))
|
2016-09-02 21:20:39 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadMisc1(pk2);
|
|
|
|
|
LoadMisc2(pk2);
|
2016-09-04 01:57:54 +00:00
|
|
|
|
|
|
|
|
|
TB_MetLevel.Text = pk2.Met_Level.ToString();
|
|
|
|
|
CB_MetLocation.SelectedValue = pk2.Met_Location;
|
|
|
|
|
CB_MetTimeOfDay.SelectedIndex = pk2.Met_TimeOfDay;
|
2016-09-02 21:20:39 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
// Attempt to detect language
|
|
|
|
|
if (pk2.Japanese)
|
2017-10-20 02:59:31 +00:00
|
|
|
|
CB_Language.SelectedValue = 1;
|
2017-10-03 06:13:40 +00:00
|
|
|
|
else if (pk2.Korean)
|
2017-10-20 02:59:31 +00:00
|
|
|
|
CB_Language.SelectedValue = 8;
|
2017-10-03 06:13:40 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int lang = PKX.GetSpeciesNameLanguage(pk2.Species, pk2.Nickname, 2);
|
|
|
|
|
CB_Language.SelectedValue = lang > 0 ? lang : 2;
|
|
|
|
|
}
|
2016-09-02 21:20:39 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
LoadPartyStats(pk2);
|
2017-06-18 01:37:19 +00:00
|
|
|
|
UpdateStats();
|
2016-09-02 21:20:39 +00:00
|
|
|
|
}
|
2017-10-03 06:13:40 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private PKM PreparePK2()
|
2016-09-02 21:20:39 +00:00
|
|
|
|
{
|
2017-10-03 06:13:40 +00:00
|
|
|
|
if (!(pkm is PK2 pk2))
|
2016-09-02 21:20:39 +00:00
|
|
|
|
return null;
|
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SaveMisc1(pk2);
|
|
|
|
|
SaveMisc2(pk2);
|
|
|
|
|
|
2016-09-04 01:57:54 +00:00
|
|
|
|
pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text);
|
2017-06-18 01:37:19 +00:00
|
|
|
|
pk2.Met_Location = WinFormsUtil.GetIndex(CB_MetLocation);
|
2016-09-04 01:57:54 +00:00
|
|
|
|
pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex;
|
2016-09-02 21:20:39 +00:00
|
|
|
|
|
2017-10-03 06:13:40 +00:00
|
|
|
|
SavePartyStats(pk2);
|
2016-09-02 21:20:39 +00:00
|
|
|
|
pk2.FixMoves();
|
|
|
|
|
return pk2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|