private static void InitializeSettings(LegalitySettings cfg) { APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons; APILegality.SetMatchingBalls = cfg.SetMatchingBalls; APILegality.UseXOROSHIRO = cfg.UseXOROSHIRO; Legalizer.AllowBruteForce = cfg.AllowBruteForce; }
private static void InitializeAutoLegality(LegalitySettings cfg) { Task.Run(InitializeCoreStrings); Task.Run(() => EncounterEvent.RefreshMGDB()); InitializeTrainerDatabase(cfg); InitializeSettings(cfg); }
private static void InitializeSettings(LegalitySettings cfg) { APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons; APILegality.SetMatchingBalls = cfg.SetMatchingBalls; APILegality.ForceSpecifiedBall = cfg.ForceSpecifiedBall; APILegality.UseXOROSHIRO = cfg.UseXOROSHIRO; Legalizer.EnableEasterEggs = cfg.EnableEasterEggs; }
public static void EnsureInitialized(LegalitySettings cfg) { if (Initialized) { return; } Initialized = true; InitializeAutoLegality(cfg); }
private static void InitializeSettings(LegalitySettings cfg) { APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons; APILegality.SetMatchingBalls = cfg.SetMatchingBalls; APILegality.ForceSpecifiedBall = cfg.ForceSpecifiedBall; APILegality.UseXOROSHIRO = cfg.UseXOROSHIRO; Legalizer.EnableEasterEggs = cfg.EnableEasterEggs; APILegality.AllowTrainerOverride = cfg.AllowTrainerDataOverride; APILegality.AllowBatchCommands = cfg.AllowBatchCommands; }
private static void InitializeAutoLegality(LegalitySettings cfg) { InitializeCoreStrings(); if (!EncounterEvent.Initialized) { EncounterEvent.RefreshMGDB(cfg.MGDBPath); } InitializeTrainerDatabase(cfg); InitializeSettings(cfg); }
private static void InitializeAutoLegality(LegalitySettings cfg) { InitializeCoreStrings(); if (!EncounterEvent.Initialized) { EncounterEvent.RefreshMGDB(); } InitializeTrainerDatabase(cfg); InitializeSettings(cfg); // Legalizer.AllowBruteForce = false; }
private static void InitializeTrainerDatabase(LegalitySettings cfg) { // Seed the Trainer Database with enough fake save files so that we return a generation sensitive format when needed. string OT = cfg.GenerateOT; int TID = cfg.GenerateTID16; int SID = cfg.GenerateSID16; int lang = (int)cfg.GenerateLanguage; var externalSource = cfg.GeneratePathTrainerInfo; if (!string.IsNullOrWhiteSpace(externalSource) && Directory.Exists(externalSource)) { TrainerSettings.LoadTrainerDatabaseFromPath(externalSource); } SaveFile GetFallbackBlank(int generation) { var blankSav = SaveUtil.GetBlankSAV(generation, OT); blankSav.Language = lang; blankSav.TID = TID; blankSav.SID = SID; blankSav.OT = OT; return(blankSav); } for (int i = 1; i < PKX.Generation + 1; i++) { var fallback = GetFallbackBlank(i); var exist = TrainerSettings.GetSavedTrainerData(i, fallback); if (exist == fallback) { TrainerSettings.Register(fallback); } } var trainer = TrainerSettings.GetSavedTrainerData(PKX.Generation); PKMConverter.SetPrimaryTrainer(trainer); }
private static void InitializeTrainerDatabase(LegalitySettings cfg) { // Seed the Trainer Database with enough fake save files so that we return a generation sensitive format when needed. string OT = cfg.GenerateOT; int TID = cfg.GenerateTID16; int SID = cfg.GenerateSID16; int lang = (int)cfg.GenerateLanguage; var externalSource = cfg.GeneratePathTrainerInfo; if (!string.IsNullOrWhiteSpace(externalSource) && Directory.Exists(externalSource)) { TrainerSettings.LoadTrainerDatabaseFromPath(externalSource); } for (int i = 1; i < PKX.Generation + 1; i++) { var versions = GameUtil.GetVersionsInGeneration(i, PKX.Generation); foreach (var v in versions) { var fallback = new SimpleTrainerInfo(v) { Language = lang, TID = TID, SID = SID, OT = OT, }; var exist = TrainerSettings.GetSavedTrainerData(v, i, fallback); if (exist is SimpleTrainerInfo) // not anything from files; this assumes ALM returns SimpleTrainerInfo for non-user-provided fake templates. { TrainerSettings.Register(fallback); } } } var trainer = TrainerSettings.GetSavedTrainerData(PKX.Generation); PKMConverter.SetPrimaryTrainer(trainer); }
private static void InitializeSettings(LegalitySettings cfg) { APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons; APILegality.SetMatchingBalls = cfg.SetMatchingBalls; }