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.
This commit is contained in:
Kaphotics 2016-07-18 20:25:54 -07:00
parent 016a0e3aee
commit 85ffe06807
5 changed files with 9 additions and 11 deletions

View file

@ -1163,11 +1163,15 @@ namespace PKHeX
CB_Ability.SelectedIndex = abil < 0 || abil >= CB_Ability.Items.Count ? 0 : abil; CB_Ability.SelectedIndex = abil < 0 || abil >= CB_Ability.Items.Count ? 0 : abil;
} }
// PKX Data Calculation Functions // // PKX Data Calculation Functions //
private void setIsShiny() private void setIsShiny(object sender)
{ {
pkm.PID = Util.getHEXval(TB_PID.Text); if (sender == TB_PID)
pkm.TID = (int)Util.ToUInt32(TB_TID.Text); pkm.PID = Util.getHEXval(TB_PID.Text);
pkm.SID = (int)Util.ToUInt32(TB_SID.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; bool isShiny = pkm.IsShiny;
// Set the Controls // Set the Controls
@ -2054,8 +2058,6 @@ namespace PKHeX
if (SAV.Generation < 6) if (SAV.Generation < 6)
return; return;
pkm.TID = (int)Util.ToUInt32(TB_TID.Text);
pkm.SID = (int)Util.ToUInt32(TB_SID.Text);
var TSV = pkm.TSV; var TSV = pkm.TSV;
Tip1.SetToolTip(TB_TID, "TSV: " + TSV.ToString("0000")); Tip1.SetToolTip(TB_TID, "TSV: " + TSV.ToString("0000"));
Tip2.SetToolTip(TB_SID, "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_TID.Text) > ushort.MaxValue) TB_TID.Text = "65535";
if (Util.ToUInt32(TB_SID.Text) > ushort.MaxValue) TB_SID.Text = "65535"; if (Util.ToUInt32(TB_SID.Text) > ushort.MaxValue) TB_SID.Text = "65535";
setIsShiny(); setIsShiny(sender);
getQuickFiller(dragout); getQuickFiller(dragout);
updateIVs(null, null); // If the EC is changed, EC%6 (Characteristic) might be changed. 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 TB_PID.Select(60, 0); // position cursor at end of field

View file

@ -96,7 +96,6 @@ namespace PKHeX
TB_ExtraByte.Text = pk3.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); TB_ExtraByte.Text = pk3.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
updateStats(); updateStats();
setIsShiny();
TB_EXP.Text = pk3.EXP.ToString(); TB_EXP.Text = pk3.EXP.ToString();
Label_Gender.Text = gendersymbols[pk3.Gender]; Label_Gender.Text = gendersymbols[pk3.Gender];

View file

@ -113,7 +113,6 @@ namespace PKHeX
TB_ExtraByte.Text = pk4.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); TB_ExtraByte.Text = pk4.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
updateStats(); updateStats();
setIsShiny();
TB_EXP.Text = pk4.EXP.ToString(); TB_EXP.Text = pk4.EXP.ToString();
Label_Gender.Text = gendersymbols[pk4.Gender]; Label_Gender.Text = gendersymbols[pk4.Gender];

View file

@ -122,7 +122,6 @@ namespace PKHeX
TB_ExtraByte.Text = pk5.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); TB_ExtraByte.Text = pk5.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
updateStats(); updateStats();
setIsShiny();
TB_EXP.Text = pk5.EXP.ToString(); TB_EXP.Text = pk5.EXP.ToString();
Label_Gender.Text = gendersymbols[pk5.Gender]; Label_Gender.Text = gendersymbols[pk5.Gender];

View file

@ -137,7 +137,6 @@ namespace PKHeX
TB_ExtraByte.Text = pk6.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString(); TB_ExtraByte.Text = pk6.Data[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
updateStats(); updateStats();
setIsShiny();
TB_EXP.Text = pk6.EXP.ToString(); TB_EXP.Text = pk6.EXP.ToString();
Label_Gender.Text = gendersymbols[pk6.Gender]; Label_Gender.Text = gendersymbols[pk6.Gender];