コード例 #1
0
 private static void InitializeSettings(LegalitySettings cfg)
 {
     APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons;
     APILegality.SetMatchingBalls   = cfg.SetMatchingBalls;
     APILegality.UseXOROSHIRO       = cfg.UseXOROSHIRO;
     Legalizer.AllowBruteForce      = cfg.AllowBruteForce;
 }
コード例 #2
0
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     Task.Run(InitializeCoreStrings);
     Task.Run(() => EncounterEvent.RefreshMGDB());
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public static void EnsureInitialized(LegalitySettings cfg)
 {
     if (Initialized)
     {
         return;
     }
     Initialized = true;
     InitializeAutoLegality(cfg);
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     InitializeCoreStrings();
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB(cfg.MGDBPath);
     }
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
 }
コード例 #7
0
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     InitializeCoreStrings();
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
     // Legalizer.AllowBruteForce = false;
 }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 private static void InitializeSettings(LegalitySettings cfg)
 {
     APILegality.SetAllLegalRibbons = cfg.SetAllLegalRibbons;
     APILegality.SetMatchingBalls   = cfg.SetMatchingBalls;
 }