diff --git a/PKHeX.WinForms/Controls/PKM Editor/EditPK1.cs b/PKHeX.WinForms/Controls/PKM Editor/EditPK1.cs index 716b73f54..e2a5ecfd6 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/EditPK1.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/EditPK1.cs @@ -10,6 +10,7 @@ private void PopulateFieldsPK1() return; LoadMisc1(pk1); + TID_Trainer.LoadIDValues(pkm); // Attempt to detect language CB_Language.SelectedValue = PKX.GetVCLanguage(pk1); diff --git a/PKHeX.WinForms/Controls/PKM Editor/EditPK2.cs b/PKHeX.WinForms/Controls/PKM Editor/EditPK2.cs index 5885402ae..68fd3cbb6 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/EditPK2.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/EditPK2.cs @@ -12,6 +12,7 @@ private void PopulateFieldsPK2() LoadMisc1(pk2); LoadMisc2(pk2); + TID_Trainer.LoadIDValues(pkm); TB_MetLevel.Text = pk2.Met_Level.ToString(); CB_MetLocation.SelectedValue = pk2.Met_Location; CB_MetTimeOfDay.SelectedIndex = pk2.Met_TimeOfDay; diff --git a/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs b/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs index 4f8081037..f4f27e7dd 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs @@ -33,15 +33,14 @@ private void SaveSpeciesLevelEXP(PKM pk) pk.EXP = Util.ToUInt32(TB_EXP.Text); } - private void LoadOTID(PKM pk) + private void LoadOT(PKM pk) { GB_OT.BackgroundImage = null; TB_OT.Text = pk.OT_Name; Label_OTGender.Text = gendersymbols[pk.OT_Gender]; Label_OTGender.ForeColor = GetGenderColor(pk.OT_Gender); - TID_Trainer.LoadIDValues(pk); } - private void SaveOTID(PKM pk) + private void SaveOT(PKM pk) { pk.OT_Name = TB_OT.Text; pk.OT_Gender = PKX.GetGenderFromString(Label_OTGender.Text); @@ -162,7 +161,7 @@ private void LoadMisc1(PKM pk) { LoadSpeciesLevelEXP(pk); LoadNickname(pk); - LoadOTID(pk); + LoadOT(pk); LoadIVs(pk); LoadEVs(pk); LoadMoves(pk); @@ -171,7 +170,7 @@ private void SaveMisc1(PKM pk) { SaveSpeciesLevelEXP(pk); SaveNickname(pk); - SaveOTID(pk); + SaveOT(pk); SaveMoves(pk); } @@ -209,6 +208,7 @@ private void LoadMisc3(PKM pk) CHK_Fateful.Checked = pk.FatefulEncounter; LoadContestStats(pk); + TID_Trainer.LoadIDValues(pk); // Load Extrabyte Value TB_ExtraByte.Text = pk.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 89a008232..276be6cf3 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1019,43 +1019,15 @@ private void UpdateOriginGame(object sender, EventArgs e) GameVersion Version = (GameVersion)WinFormsUtil.GetIndex(CB_GameOrigin); // check if differs - GameVersion newTrack = GameUtil.GetMetLocationVersionGroup(Version); - if (newTrack != origintrack && FieldsLoaded) - { - pkm.Version = (int)Version; - TID_Trainer.LoadIDValues(pkm); - } + var group = GameUtil.GetMetLocationVersionGroup(Version); + if (group == GameVersion.GSC && pkm.Format >= 7) + group = GameVersion.USUM; + else if (pkm.Format < 3) + group = GameVersion.GSC; - if (newTrack != origintrack) - { - var met_list = GameInfo.GetLocationList(Version, pkm.Format, egg: false); - InitializeBinding(CB_MetLocation); - CB_MetLocation.DataSource = new BindingSource(met_list, null); - - if (FieldsLoaded) - { - SetMarkings(); // Set/Remove the Nativity marking when gamegroup changes too - int metLoc = EncounterSuggestion.GetSuggestedTransferLocation(pkm); - CB_MetLocation.SelectedValue = Math.Max(0, metLoc); - } - - var egg_list = GameInfo.GetLocationList(Version, pkm.Format, egg: true); - InitializeBinding(CB_EggLocation); - CB_EggLocation.DataSource = new BindingSource(egg_list, null); - if (FieldsLoaded) - CB_EggLocation.SelectedIndex = CHK_AsEgg.Checked ? 1 : 0; // daycare : none - - origintrack = newTrack; - - // Stretch C/XD met location dropdowns - int width = CB_EggLocation.DropDownWidth; - if (Version == GameVersion.CXD && pkm.Format == 3) - width = 2 * width; - CB_MetLocation.DropDownWidth = width; - - if (!FieldsLoaded) - CB_GameOrigin.Focus(); // hacky validation forcing - } + if (group != origintrack) + ReloadMetLocations(Version); + origintrack = group; // Visibility logic for Gen 4 encounter type; only show for Gen 4 Pokemon. if (pkm.Format >= 4) @@ -1068,9 +1040,40 @@ private void UpdateOriginGame(object sender, EventArgs e) if (!FieldsLoaded) return; + pkm.Version = (int)Version; + TID_Trainer.LoadIDValues(pkm); UpdateLegality(); } + private void ReloadMetLocations(GameVersion Version) + { + InitializeBinding(CB_MetLocation); + InitializeBinding(CB_EggLocation); + + var met_list = GameInfo.GetLocationList(Version, pkm.Format, egg: false); + CB_MetLocation.DataSource = new BindingSource(met_list, null); + + var egg_list = GameInfo.GetLocationList(Version, pkm.Format, egg: true); + CB_EggLocation.DataSource = new BindingSource(egg_list, null); + + // Stretch C/XD met location dropdowns + int width = CB_EggLocation.DropDownWidth; + if (Version == GameVersion.CXD && pkm.Format == 3) + width *= 2; + CB_MetLocation.DropDownWidth = width; + + if (FieldsLoaded) + { + SetMarkings(); // Set/Remove the Nativity marking when gamegroup changes too + int metLoc = EncounterSuggestion.GetSuggestedTransferLocation(pkm); + CB_MetLocation.SelectedValue = Math.Max(0, metLoc); + CB_EggLocation.SelectedIndex = CHK_AsEgg.Checked ? 1 : 0; // daycare : none + } + else + { + CB_GameOrigin.Focus(); // hacky validation forcing + } + } private void UpdateExtraByteValue(object sender, EventArgs e) { if (CB_ExtraBytes.Items.Count == 0 || !(sender is MaskedTextBox mtb))