mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 16:48:01 +00:00
217156d2b9
pk7->pk8 doesnt assign height/weight (zero), require zero for legal p*7->pk8 assigns a tracker value, enforce something is present for legal copy OT friendship (oops)
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Verifies the <see cref="PKM.ConsoleRegion"/> and <see cref="PKM.Country"/> of origin values.
|
|
/// </summary>
|
|
public sealed class ConsoleRegionVerifier : Verifier
|
|
{
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Geography;
|
|
|
|
public override void Verify(LegalityAnalysis data)
|
|
{
|
|
var result = VerifyConsoleRegion(data.pkm, data.Info.Generation);
|
|
data.AddLine(result);
|
|
}
|
|
|
|
private CheckResult VerifyConsoleRegion(PKM pkm, int gen)
|
|
{
|
|
int consoleRegion = pkm.ConsoleRegion;
|
|
if (consoleRegion >= 7)
|
|
return GetInvalid(LGeoHardwareRange);
|
|
|
|
if (gen >= 8 || pkm.Format >= 8 || pkm.GG)
|
|
return VerifyNoDataPresent(pkm, consoleRegion);
|
|
return Verify3DSDataPresent(pkm, consoleRegion);
|
|
}
|
|
|
|
private CheckResult Verify3DSDataPresent(PKM pkm, int consoleRegion)
|
|
{
|
|
if (!Legal.IsConsoleRegionCountryValid(consoleRegion, pkm.Country))
|
|
return GetInvalid(LGeoHardwareInvalid);
|
|
return GetValid(LGeoHardwareValid);
|
|
}
|
|
|
|
private CheckResult VerifyNoDataPresent(PKM pkm, int consoleRegion)
|
|
{
|
|
if (consoleRegion != 0 || pkm.Country != 0 || pkm.Region != 0)
|
|
return GetInvalid(LGeoHardwareInvalid);
|
|
return GetValid(LGeoHardwareValid);
|
|
}
|
|
}
|
|
}
|