Change gen4 (egg) met location setter

Closes #1135
clear both if zero
set value to dp location if a valid dp location, else set faraway place
set value to pthgss location if originated from pthgss
This commit is contained in:
Kurt 2017-05-18 22:40:35 -07:00
parent 54c824c4fb
commit 483998d930
3 changed files with 21 additions and 37 deletions

View file

@ -250,20 +250,16 @@ namespace PKHeX.Core
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x44);
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x7E);
}
else if (PtHGSS)
else if (value < 2000 && value > 111 || value < 3000 && value > 2010)
{
// Met location not in DP, set to Faraway Place
BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x44);
BigEndian.GetBytes((ushort)0xBBA).CopyTo(Data, 0x7E); // Faraway Place (for DP display)
}
else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010))
{
// Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x44);
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x7E);
BigEndian.GetBytes((ushort)0xBBA).CopyTo(Data, 0x7E);
}
else
{
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x44);
int pthgss = PtHGSS ? value : 0; // only set to PtHGSS loc if encountered in game
BigEndian.GetBytes((ushort)pthgss).CopyTo(Data, 0x44);
BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x7E);
}
}
@ -284,20 +280,16 @@ namespace PKHeX.Core
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x46);
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x80);
}
else if (PtHGSS)
else if (value < 2000 && value > 111 || value < 3000 && value > 2010)
{
// Met location not in DP, set to Faraway Place
BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x46);
BigEndian.GetBytes((ushort)0xBBA).CopyTo(Data, 0x80); // Faraway Place (for DP display)
}
else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010))
{
// Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x46);
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x80);
BigEndian.GetBytes((ushort)0xBBA).CopyTo(Data, 0x80);
}
else
{
BigEndian.GetBytes((ushort)0).CopyTo(Data, 0x46);
int pthgss = PtHGSS ? value : 0; // only set to PtHGSS loc if encountered in game
BigEndian.GetBytes((ushort)pthgss).CopyTo(Data, 0x46);
BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80);
}
}

View file

@ -238,20 +238,16 @@ namespace PKHeX.Core
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44);
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x7E);
}
else if (PtHGSS)
else if (value < 2000 && value > 111 || value < 3000 && value > 2010)
{
// Met location not in DP, set to Faraway Place
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x44);
BitConverter.GetBytes((ushort)0xBBA).CopyTo(Data, 0x7E); // Faraway Place (for DP display)
}
else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010))
{
// Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44);
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x7E);
BitConverter.GetBytes((ushort)0xBBA).CopyTo(Data, 0x7E);
}
else
{
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44);
int pthgss = PtHGSS ? value : 0; // only set to PtHGSS loc if encountered in game
BitConverter.GetBytes((ushort)pthgss).CopyTo(Data, 0x44);
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E);
}
}
@ -272,20 +268,16 @@ namespace PKHeX.Core
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x80);
}
else if (PtHGSS)
else if (value < 2000 && value > 111 || value < 3000 && value > 2010)
{
// Met location not in DP, set to Faraway Place
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)0xBBA).CopyTo(Data, 0x80); // Faraway Place (for DP display)
}
else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010))
{
// Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x80);
BitConverter.GetBytes((ushort)0xBBA).CopyTo(Data, 0x80);
}
else
{
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46);
int pthgss = PtHGSS ? value : 0; // only set to PtHGSS loc if encountered in game
BitConverter.GetBytes((ushort)pthgss).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80);
}
}

View file

@ -549,7 +549,7 @@ namespace PKHeX.Core
}
}
/// <summary>do {
/// <summary>
/// Checks if the PKM has its original met location.
/// </summary>
/// <returns>Returns false if the Met Location has been overwritten via generational transfer.</returns>