2018-06-24 05:00:01 +00:00
|
|
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2018-07-02 02:17:37 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Verifies the <see cref="PKM.ConsoleRegion"/> and <see cref="PKM.Country"/> of origin values.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class ConsoleRegionVerifier : Verifier
|
2018-06-24 05:00:01 +00:00
|
|
|
|
{
|
|
|
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Geography;
|
|
|
|
|
public override void Verify(LegalityAnalysis data)
|
|
|
|
|
{
|
|
|
|
|
var result = VerifyConsoleRegion(data.pkm);
|
|
|
|
|
data.AddLine(result);
|
|
|
|
|
}
|
2018-06-30 22:01:16 +00:00
|
|
|
|
private CheckResult VerifyConsoleRegion(PKM pkm)
|
2018-06-24 05:00:01 +00:00
|
|
|
|
{
|
|
|
|
|
int consoleRegion = pkm.ConsoleRegion;
|
|
|
|
|
if (consoleRegion >= 7)
|
2018-06-30 22:01:16 +00:00
|
|
|
|
return GetInvalid(V301);
|
|
|
|
|
|
|
|
|
|
if (!Legal.IsConsoleRegionCountryValid(consoleRegion, pkm.Country))
|
|
|
|
|
return GetInvalid(V302);
|
|
|
|
|
|
|
|
|
|
return GetValid(V303);
|
2018-06-24 05:00:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|