2020-11-28 02:45:06 +00:00
using System.Collections.Generic ;
using System.Linq ;
namespace PKHeX.Core
2018-10-06 02:58:30 +00:00
{
public static class ParseSettings
{
2019-11-27 00:55:28 +00:00
internal static ITrainerInfo ActiveTrainer { get ; set ; } = new SimpleTrainerInfo ( GameVersion . Any ) { OT = string . Empty , Language = - 1 } ;
2018-10-06 02:58:30 +00:00
/// <summary>
/// Toggles whether or not the word filter should be used when checking the data.
/// </summary>
public static bool CheckWordFilter { get ; set ; } = true ;
/// <summary>
/// Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.
/// </summary>
public static bool AllowGBCartEra { get ; set ; }
/// <summary>
/// Setting to specify if an analysis should permit trading a Generation 1 origin file to Generation 2, then back. Useful for checking RBY Metagame rules.
/// </summary>
public static bool AllowGen1Tradeback { get ; set ; }
2018-10-06 20:43:05 +00:00
public static Severity NicknamedTrade { get ; set ; } = Severity . Invalid ;
public static Severity NicknamedMysteryGift { get ; set ; } = Severity . Fishy ;
public static Severity RNGFrameNotFound { get ; set ; } = Severity . Fishy ;
2020-09-26 01:04:44 +00:00
public static Severity Gen7TransferStarPID { get ; set ; } = Severity . Fishy ;
2020-01-11 00:08:34 +00:00
public static Severity Gen8MemoryLocationTextVariable { get ; set ; } = Severity . Fishy ;
2020-02-13 02:10:24 +00:00
public static Severity Gen8TransferTrackerNotPresent { get ; set ; } = Severity . Fishy ;
2018-10-06 20:43:05 +00:00
2020-11-28 02:45:06 +00:00
public static IReadOnlyList < string > MoveStrings = Util . GetMovesList ( GameLanguage . DefaultLanguage ) ;
public static IReadOnlyList < string > SpeciesStrings = Util . GetSpeciesList ( GameLanguage . DefaultLanguage ) ;
public static IEnumerable < string > GetMoveNames ( IEnumerable < int > moves ) = > moves . Select ( m = > ( uint ) m > = MoveStrings . Count ? LegalityCheckStrings . L_AError : MoveStrings [ m ] ) ;
public static void ChangeLocalizationStrings ( IReadOnlyList < string > moves , IReadOnlyList < string > species )
{
SpeciesStrings = species ;
MoveStrings = moves ;
}
2018-10-06 02:58:30 +00:00
/// <summary>
/// Checks to see if Crystal is available to visit/originate from.
/// </summary>
/// <remarks>Pokemon Crystal was never released in Korea.</remarks>
/// <param name="Korean">Korean data being checked</param>
/// <returns>True if Crystal data is allowed</returns>
public static bool AllowGen2Crystal ( bool Korean ) = > ! Korean ;
/// <summary>
/// Checks to see if Crystal is available to visit/originate from.
/// </summary>
/// <param name="pkm">Data being checked</param>
/// <returns>True if Crystal data is allowed</returns>
2018-10-07 22:36:32 +00:00
public static bool AllowGen2Crystal ( PKM pkm ) = > ! pkm . Korean ;
2018-10-06 02:58:30 +00:00
/// <summary>
/// Checks to see if the Move Reminder (Relearner) is available.
/// </summary>
/// <remarks> Pokemon Stadium 2 was never released in Korea.</remarks>
/// <param name="pkm">Data being checked</param>
/// <returns>True if Crystal data is allowed</returns>
public static bool AllowGen2MoveReminder ( PKM pkm ) = > ! pkm . Korean & & AllowGBCartEra ;
internal static bool IsFromActiveTrainer ( PKM pkm ) = > ActiveTrainer . IsFromTrainer ( pkm ) ;
2019-01-22 04:06:02 +00:00
/// <summary>
/// Initializes certain settings
/// </summary>
/// <param name="sav">Newly loaded save file</param>
/// <returns>Save file is Physical GB cartridge save file (not Virtual Console)</returns>
2018-10-06 02:58:30 +00:00
public static bool InitFromSaveFileData ( SaveFile sav )
{
ActiveTrainer = sav ;
if ( sav . Generation > = 3 )
return AllowGBCartEra = false ;
2020-12-05 13:36:23 +00:00
bool vc = ! sav . State . Exportable | | ( sav . Metadata . FileName ? . EndsWith ( "dat" ) ? ? false ) ; // default to true for non-exportable
2018-10-06 02:58:30 +00:00
return AllowGBCartEra = ! vc ; // physical cart selected
}
}
}