Exemplo n.º 1
0
        public async Task <SAV8SWSH> IdentifyTrainer(CancellationToken token)
        {
            // Check title so we can warn if mode is incorrect.
            string title = await SwitchConnection.GetTitleID(token).ConfigureAwait(false);

            if (title is not(SwordID or ShieldID))
            {
                throw new Exception($"{title} is not a valid SWSH title. Is your mode correct?");
            }

            Log("Grabbing trainer data of host console...");
            var sav = await GetFakeTrainerSAV(token).ConfigureAwait(false);

            InitSaveData(sav);

            if (!IsValidTrainerData())
            {
                throw new Exception("Trainer data is not valid. Refer to the SysBot.NET wiki for bad or no trainer data.");
            }
            if (await GetTextSpeed(token).ConfigureAwait(false) < TextSpeedOption.Fast)
            {
                throw new Exception("Text speed should be set to FAST. Fix this for correct operation.");
            }

            return(sav);
        }
        public async Task <SAV8BS> IdentifyTrainer(CancellationToken token)
        {
            // pull title so we know which set of offsets to use
            string title = await SwitchConnection.GetTitleID(token).ConfigureAwait(false);

            Offsets = title switch
            {
                BrilliantDiamondID => new PokeDataOffsetsBS_BD(),
                ShiningPearlID => new PokeDataOffsetsBS_SP(),
                _ => throw new Exception($"{title} is not a valid Pokémon BDSP title. Is your mode correct?"),
            };

            var sav = await GetFakeTrainerSAV(token).ConfigureAwait(false);

            InitSaveData(sav);

            if (!IsValidTrainerData())
            {
                throw new Exception("Trainer data is not valid. Refer to the SysBot.NET wiki for bad or no trainer data.");
            }
            if (await GetTextSpeed(token).ConfigureAwait(false) < TextSpeedOption.Fast)
            {
                throw new Exception("Text speed should be set to FAST. Fix this for correct operation.");
            }

            return(sav);
        }