using System.Collections.Generic;
using System.Linq;
namespace PKHeX.Core
{
public static class ParseSettings
{
internal static ITrainerInfo ActiveTrainer { get; set; } = new SimpleTrainerInfo(GameVersion.Any) { OT = string.Empty, Language = -1 };
///
/// Toggles whether or not the word filter should be used when checking the data.
///
public static bool CheckWordFilter { get; set; } = true;
///
/// Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.
///
public static bool AllowGBCartEra { get; set; }
///
/// 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.
///
public static bool AllowGen1Tradeback { get; set; }
public static Severity NicknamedTrade { get; set; } = Severity.Invalid;
public static Severity NicknamedMysteryGift { get; set; } = Severity.Fishy;
public static Severity RNGFrameNotFound { get; set; } = Severity.Fishy;
public static Severity Gen7TransferStarPID { get; set; } = Severity.Fishy;
public static Severity Gen8MemoryLocationTextVariable { get; set; } = Severity.Fishy;
public static Severity Gen8TransferTrackerNotPresent { get; set; } = Severity.Fishy;
public static IReadOnlyList MoveStrings = Util.GetMovesList(GameLanguage.DefaultLanguage);
public static IReadOnlyList SpeciesStrings = Util.GetSpeciesList(GameLanguage.DefaultLanguage);
public static IEnumerable GetMoveNames(IEnumerable moves) => moves.Select(m => (uint)m >= MoveStrings.Count ? LegalityCheckStrings.L_AError : MoveStrings[m]);
public static void ChangeLocalizationStrings(IReadOnlyList moves, IReadOnlyList species)
{
SpeciesStrings = species;
MoveStrings = moves;
}
///
/// Checks to see if Crystal is available to visit/originate from.
///
/// Pokemon Crystal was never released in Korea.
/// Korean data being checked
/// True if Crystal data is allowed
public static bool AllowGen2Crystal(bool Korean) => !Korean;
///
/// Checks to see if Crystal is available to visit/originate from.
///
/// Data being checked
/// True if Crystal data is allowed
public static bool AllowGen2Crystal(PKM pkm) => !pkm.Korean;
///
/// Checks to see if the Move Reminder (Relearner) is available.
///
/// Pokemon Stadium 2 was never released in Korea.
/// Data being checked
/// True if Crystal data is allowed
public static bool AllowGen2MoveReminder(PKM pkm) => !pkm.Korean && AllowGBCartEra;
internal static bool IsFromActiveTrainer(PKM pkm) => ActiveTrainer.IsFromTrainer(pkm);
///
/// Initializes certain settings
///
/// Newly loaded save file
/// Save file is Physical GB cartridge save file (not Virtual Console)
public static bool InitFromSaveFileData(SaveFile sav)
{
ActiveTrainer = sav;
if (sav.Generation >= 3)
return AllowGBCartEra = false;
bool vc = !sav.State.Exportable || (sav.Metadata.FileName?.EndsWith("dat") ?? false); // default to true for non-exportable
return AllowGBCartEra = !vc; // physical cart selected
}
}
}