From 85ffe068077b1a72057af3190869c5104fafa255 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 18 Jul 2016 20:25:54 -0700 Subject: [PATCH] Fix setIsShiny Thanks Wanderer1391! Set value back only if it was the one that updated the value. No need to prompt update after loading as it refreshes when each field loads. --- MainWindow/Main.cs | 16 +++++++++------- MainWindow/MainPK3.cs | 1 - MainWindow/MainPK4.cs | 1 - MainWindow/MainPK5.cs | 1 - MainWindow/MainPK6.cs | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 13b715576..59e094680 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1163,11 +1163,15 @@ namespace PKHeX CB_Ability.SelectedIndex = abil < 0 || abil >= CB_Ability.Items.Count ? 0 : abil; } // PKX Data Calculation Functions // - private void setIsShiny() + private void setIsShiny(object sender) { - pkm.PID = Util.getHEXval(TB_PID.Text); - pkm.TID = (int)Util.ToUInt32(TB_TID.Text); - pkm.SID = (int)Util.ToUInt32(TB_SID.Text); + if (sender == TB_PID) + pkm.PID = Util.getHEXval(TB_PID.Text); + else if (sender == TB_TID) + pkm.TID = (int)Util.ToUInt32(TB_TID.Text); + else if (sender == TB_SID) + pkm.SID = (int)Util.ToUInt32(TB_SID.Text); + bool isShiny = pkm.IsShiny; // Set the Controls @@ -2054,8 +2058,6 @@ namespace PKHeX if (SAV.Generation < 6) return; - pkm.TID = (int)Util.ToUInt32(TB_TID.Text); - pkm.SID = (int)Util.ToUInt32(TB_SID.Text); var TSV = pkm.TSV; Tip1.SetToolTip(TB_TID, "TSV: " + TSV.ToString("0000")); Tip2.SetToolTip(TB_SID, "TSV: " + TSV.ToString("0000")); @@ -2074,7 +2076,7 @@ namespace PKHeX if (Util.ToUInt32(TB_TID.Text) > ushort.MaxValue) TB_TID.Text = "65535"; if (Util.ToUInt32(TB_SID.Text) > ushort.MaxValue) TB_SID.Text = "65535"; - setIsShiny(); + setIsShiny(sender); getQuickFiller(dragout); updateIVs(null, null); // If the EC is changed, EC%6 (Characteristic) might be changed. TB_PID.Select(60, 0); // position cursor at end of field diff --git a/MainWindow/MainPK3.cs b/MainWindow/MainPK3.cs index de552ecaa..16f314364 100644 --- a/MainWindow/MainPK3.cs +++ b/MainWindow/MainPK3.cs @@ -96,7 +96,6 @@ namespace PKHeX TB_ExtraByte.Text = pk3.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); updateStats(); - setIsShiny(); TB_EXP.Text = pk3.EXP.ToString(); Label_Gender.Text = gendersymbols[pk3.Gender]; diff --git a/MainWindow/MainPK4.cs b/MainWindow/MainPK4.cs index c26762cfa..697193b01 100644 --- a/MainWindow/MainPK4.cs +++ b/MainWindow/MainPK4.cs @@ -113,7 +113,6 @@ namespace PKHeX TB_ExtraByte.Text = pk4.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); updateStats(); - setIsShiny(); TB_EXP.Text = pk4.EXP.ToString(); Label_Gender.Text = gendersymbols[pk4.Gender]; diff --git a/MainWindow/MainPK5.cs b/MainWindow/MainPK5.cs index 86defb20b..15f674aab 100644 --- a/MainWindow/MainPK5.cs +++ b/MainWindow/MainPK5.cs @@ -122,7 +122,6 @@ namespace PKHeX TB_ExtraByte.Text = pk5.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); updateStats(); - setIsShiny(); TB_EXP.Text = pk5.EXP.ToString(); Label_Gender.Text = gendersymbols[pk5.Gender]; diff --git a/MainWindow/MainPK6.cs b/MainWindow/MainPK6.cs index c42e920ee..ced541a41 100644 --- a/MainWindow/MainPK6.cs +++ b/MainWindow/MainPK6.cs @@ -137,7 +137,6 @@ namespace PKHeX TB_ExtraByte.Text = pk6.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); updateStats(); - setIsShiny(); TB_EXP.Text = pk6.EXP.ToString(); Label_Gender.Text = gendersymbols[pk6.Gender];