mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
Validate VC transfer consoleregion-language relationship
This commit is contained in:
parent
ef51f53e9a
commit
6a9aa891f1
2 changed files with 59 additions and 7 deletions
|
@ -1,4 +1,6 @@
|
|||
namespace PKHeX.Core
|
||||
using static PKHeX.Core.LanguageID;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information for <see cref="IRegionOrigin.ConsoleRegion"/> and <see cref="IRegionOrigin.Country"/> data.
|
||||
|
@ -24,5 +26,43 @@
|
|||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares the <see cref="IRegionOrigin.ConsoleRegion"/> and language ID to determine if the language is available within that region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Used to check for Virtual Console language availability. VC Games were region locked to the Console, meaning not all language games are available.
|
||||
/// </remarks>
|
||||
/// <param name="consoleRegion">Console region.</param>
|
||||
/// <param name="language">Language of region</param>
|
||||
/// <returns>Language is available within Console Region</returns>
|
||||
public static bool IsRegionLockedLanguageValidVC(int consoleRegion, int language) => consoleRegion switch
|
||||
{
|
||||
0 or 6 => language == 1, // Japan & Taiwan
|
||||
1 => language is (int)English or (int)Spanish or (int)French, // Americas
|
||||
2 => language is (int)English or (int)Spanish or (int)French or (int)German or (int)Italian, // Europe
|
||||
5 => language is (int)Korean, // Korea
|
||||
_ => false, // China & Invalid
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Compares the <see cref="IRegionOrigin.ConsoleRegion"/> and <see cref="IRegionOrigin.Country"/> to determine if the country is available within that region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Used to check for gift availability.
|
||||
/// </remarks>
|
||||
/// <param name="consoleRegion">Console region.</param>
|
||||
/// <param name="language">Language of region</param>
|
||||
/// <returns>Language is available within Console Region</returns>
|
||||
public static bool IsRegionLockedLanguageValid(int consoleRegion, int language) => consoleRegion switch
|
||||
{
|
||||
0 => language is (int)Japanese, // Japan & Taiwan
|
||||
1 => language is (int)English or (int)Spanish or (int)French, // Americas
|
||||
2 => language is (int)English or (int)Spanish or (int)French or (int)German or (int)Italian, // Europe
|
||||
4 => language is (int)ChineseS or (int)ChineseT, // China
|
||||
5 => language is (int)Korean, // Korea
|
||||
6 => language is (int)ChineseS or (int)ChineseT,
|
||||
_ => false, // China & Invalid
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,19 +18,20 @@ namespace PKHeX.Core
|
|||
|
||||
public void VerifyTransferLegalityG12(LegalityAnalysis data)
|
||||
{
|
||||
VerifyOTGender(data);
|
||||
VerifyTransferVCNatureEXP(data);
|
||||
VerifyShinyXorIfShiny(data);
|
||||
VerifyVCOTGender(data);
|
||||
VerifyVCNatureEXP(data);
|
||||
VerifyVCShinyXorIfShiny(data);
|
||||
VerifyVCGeolocation(data);
|
||||
}
|
||||
|
||||
private void VerifyOTGender(LegalityAnalysis data)
|
||||
private void VerifyVCOTGender(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
if (pkm.OT_Gender == 1 && pkm.Version != (int)GameVersion.C)
|
||||
data.AddLine(GetInvalid(LG2OTGender));
|
||||
}
|
||||
|
||||
private void VerifyTransferVCNatureEXP(LegalityAnalysis data)
|
||||
private void VerifyVCNatureEXP(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
var met = pkm.Met_Level;
|
||||
|
@ -68,7 +69,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
}
|
||||
|
||||
private static void VerifyShinyXorIfShiny(LegalityAnalysis data)
|
||||
private static void VerifyVCShinyXorIfShiny(LegalityAnalysis data)
|
||||
{
|
||||
// Star, not square. Requires transferring a shiny and having the initially random PID to already be a Star shiny.
|
||||
// (15:65536, ~1:4096) odds on a given shiny transfer!
|
||||
|
@ -76,6 +77,17 @@ namespace PKHeX.Core
|
|||
if (xor is <= 15 and not 0)
|
||||
data.AddLine(Get(LEncStaticPIDShiny, ParseSettings.Gen7TransferStarPID, CheckIdentifier.PID));
|
||||
}
|
||||
|
||||
private static void VerifyVCGeolocation(LegalityAnalysis data)
|
||||
{
|
||||
if (data.pkm is not PK7 pk7)
|
||||
return;
|
||||
|
||||
// VC Games were region locked to the Console, meaning not all language games are available.
|
||||
var within = Locale3DS.IsRegionLockedLanguageValidVC(pk7.ConsoleRegion, pk7.Language);
|
||||
if (!within)
|
||||
data.AddLine(GetInvalid(string.Format(LOTLanguage, $"!={(LanguageID)pk7.Language}", ((LanguageID)pk7.Language).ToString()), CheckIdentifier.Language));
|
||||
}
|
||||
|
||||
public void VerifyTransferLegalityG3(LegalityAnalysis data)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue