Example #1
0
        public async Task <IState> Execute(ISession session, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            // Always get a fresh PlayerData when checking tutorial state.
            var tutState = (await session.Client.Player.GetPlayer()).PlayerData.TutorialState;

            if (tutState.Contains(TutorialState.FirstTimeExperienceComplete))
            {
                // If we somehow marked the tutorial as complete but have not yet created an avatar,
                // then create it.
                if (!tutState.Contains(TutorialState.AvatarSelection))
                {
                    var avatarRes = await session.Client.Player.SetAvatar(new PlayerAvatar()
                    {
                        Backpack = 0,
                        Eyes     = 0,
                        Avatar   = 0,
                        Hair     = 0,
                        Hat      = 0,
                        Pants    = 0,
                        Shirt    = 0,
                        Shoes    = 0,
                        Skin     = 0
                    });

                    EncounterTutorialCompleteResponse res = await
                                                            session.Client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>()
                    {
                        TutorialState.AvatarSelection
                    });
                }
                return(new InfoState());
            }

            if (!tutState.Contains(TutorialState.LegalScreen))
            {
                EncounterTutorialCompleteResponse res = await
                                                        session.Client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>()
                {
                    TutorialState.LegalScreen
                });

                if (res.Result == EncounterTutorialCompleteResponse.Types.Result.Success)
                {
                    session.EventDispatcher.Send(new NoticeEvent()
                    {
                        Message = "Just read the Niantic ToS, looks legit, accepting!"
                    });
                    await DelayingUtils.DelayAsync(5000, 2000, cancellationToken);
                }
                else
                {
                    session.EventDispatcher.Send(new NoticeEvent()
                    {
                        Message = "Error reading the Niantic ToS!"
                    });
                }
            }
            if (!session.LogicSettings.AutoFinishTutorial)
            {
                InitialTutorialForm form = new InitialTutorialForm(this, tutState, session);

                if (form.ShowDialog() == DialogResult.OK)
                {
                }
                else
                {
                    return(new CheckTosState());
                }
            }
            else
            {
                if (!tutState.Contains(TutorialState.AvatarSelection))
                {
                    //string genderString = GlobalSettings.PromptForString(session.Translation, session.Translation.GetTranslation(TranslationString.FirstStartSetupAutoCompleteTutGenderPrompt), new string[] { "Male", "Female" }, "You didn't set a valid gender.", false);

                    //Gender gen;
                    //switch (genderString)
                    //{
                    //    case "Male":
                    //    case "male":
                    //        gen = Gender.Male;
                    //        break;
                    //    case "Female":
                    //    case "female":
                    //        gen = Gender.Female;
                    //        break;
                    //    default:
                    //        // We should never get here, since the prompt should only allow valid options.
                    //        gen = Gender.Male;
                    //        break;
                    //}


                    var avatarRes = await session.Client.Player.SetAvatar(new PlayerAvatar()
                    {
                        Backpack = 0,
                        Eyes     = 0,
                        Hair     = 0,
                        Hat      = 0,
                        Pants    = 0,
                        Shirt    = 0,
                        Shoes    = 0,
                        Skin     = 0,
                        Avatar   = 1
                    });

                    if (avatarRes.Status == SetAvatarResponse.Types.Status.AvatarAlreadySet ||
                        avatarRes.Status == SetAvatarResponse.Types.Status.Success)
                    {
                        await session.Client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>()
                        {
                            TutorialState.AvatarSelection
                        });

                        session.EventDispatcher.Send(new NoticeEvent()
                        {
                            Message = $"Selected your avatar, now you are Male!"
                        });
                    }
                }
                if (!tutState.Contains(TutorialState.PokemonCapture))
                {
                    await CatchFirstPokemon(session, cancellationToken);
                }
                if (!tutState.Contains(TutorialState.NameSelection))
                {
                    await SelectNickname(session, cancellationToken);
                }
                if (!tutState.Contains(TutorialState.FirstTimeExperienceComplete))
                {
                    await
                    session.Client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>()
                    {
                        TutorialState.FirstTimeExperienceComplete
                    });

                    session.EventDispatcher.Send(new NoticeEvent()
                    {
                        Message = "First time experience complete, looks like i just spinned an virtual pokestop :P"
                    });
                    await DelayingUtils.DelayAsync(3000, 2000, cancellationToken);
                }
            }
            return(new InfoState());
        }
Example #2
0
        public async Task <IState> Execute(ISession session, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var tutState = session.Profile.PlayerData.TutorialState;

            if (tutState.Contains(TutorialState.FirstTimeExperienceComplete))
            {
                return(new InfoState());
            }

            if (!tutState.Contains(TutorialState.LegalScreen))
            {
                await
                session.Client.Misc.MarkTutorialComplete(new RepeatedField <TutorialState>()
                {
                    TutorialState.LegalScreen
                });

                session.EventDispatcher.Send(new NoticeEvent()
                {
                    Message = "Just read the Niantic ToS, looks legit, accepting!"
                });
                await DelayingUtils.DelayAsync(5000, 2000, cancellationToken);
            }
            InitialTutorialForm form = new InitialTutorialForm(this, tutState, session);

            if (form.ShowDialog() == DialogResult.OK)
            {
            }
            else
            {
                return(new CheckTosState());
            }

            //if (!tutState.Contains(TutorialState.AvatarSelection))
            //{
            //    //string genderString = GlobalSettings.PromptForString(session.Translation, session.Translation.GetTranslation(TranslationString.FirstStartSetupAutoCompleteTutGenderPrompt), new string[] { "Male", "Female" }, "You didn't set a valid gender.", false);

            //    //Gender gen;
            //    //switch (genderString)
            //    //{
            //    //    case "Male":
            //    //    case "male":
            //    //        gen = Gender.Male;
            //    //        break;
            //    //    case "Female":
            //    //    case "female":
            //    //        gen = Gender.Female;
            //    //        break;
            //    //    default:
            //    //        // We should never get here, since the prompt should only allow valid options.
            //    //        gen = Gender.Male;
            //    //        break;
            //    //}


            //    //var avatarRes = await session.Client.Player.SetAvatar(new PlayerAvatar()
            //    //{
            //    //    Backpack = 0,
            //    //    Eyes = 0,
            //    //    Gender = gen,
            //    //    Hair = 0,
            //    //    Hat = 0,
            //    //    Pants = 0,
            //    //    Shirt = 0,
            //    //    Shoes = 0,
            //    //    Skin = 0
            //    //});
            //    //if (avatarRes.Status == SetAvatarResponse.Types.Status.AvatarAlreadySet ||
            //    //    avatarRes.Status == SetAvatarResponse.Types.Status.Success)
            //    //{
            //    //    await session.Client.Misc.MarkTutorialComplete(new RepeatedField<TutorialState>()
            //    //    {
            //    //        TutorialState.AvatarSelection
            //    //    });
            //    //    session.EventDispatcher.Send(new NoticeEvent()
            //    //    {
            //    //        Message = $"Selected your avatar, now you are {gen}!"
            //    //    });
            //    //}
            //}
            ////if (!tutState.Contains(TutorialState.PokemonCapture))
            ////{
            ////    await CatchFirstPokemon(session, cancellationToken);
            ////}
            //if (!tutState.Contains(TutorialState.NameSelection))
            //{
            //    await SelectNickname(session, cancellationToken);
            //}
            //if (!tutState.Contains(TutorialState.FirstTimeExperienceComplete))
            //{
            //    await
            //        session.Client.Misc.MarkTutorialComplete(new RepeatedField<TutorialState>()
            //        {
            //            TutorialState.FirstTimeExperienceComplete
            //        });
            //    session.EventDispatcher.Send(new NoticeEvent()
            //    {
            //        Message = "First time experience complete, looks like i just spinned an virtual pokestop :P"
            //    });
            //    await DelayingUtils.DelayAsync(3000, 2000, cancellationToken);
            //}
            return(new InfoState());
        }