示例#1
0
 private bool onSplashScreenOpened(SplashScreenEvents.SplashScreenOpened evt)
 {
     if (pendingQuestSuspend)
     {
         Mascot mascot = questToMascotMap[ActiveQuest.Id];
         mascot.InteractionBehaviours.Reset();
         deactivateQuest(Quest.QuestState.Suspended);
         pendingQuestSuspend = false;
     }
     else if (pendingQuestStart || pendingQuestReplay)
     {
         if (pendingQuestReplay)
         {
             pendingQuest.Replay();
             pendingQuestReplay = false;
         }
         pendingQuest.Activate();
         Mascot mascot = questToMascotMap[pendingQuest.Id];
         mascot.ResumableQuests.Remove(pendingQuest);
         mascot.InteractionBehaviours.Reset();
         pendingQuestStart = false;
         pendingQuest      = null;
     }
     dispatcher.DispatchEvent(new TrayEvents.SelectTrayScreen("ControlsScreen"));
     return(false);
 }
示例#2
0
        private bool onLevelUp(ProgressionEvents.LevelUp evt)
        {
            bool flag  = false;
            bool flag2 = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();

            foreach (QuestDefinition value in knownQuests.Values)
            {
                if (!(value.Mascot.name == evt.MascotName))
                {
                    continue;
                }
                if (value.LevelRequirement >= evt.MascotLevel)
                {
                    Quest quest = GetQuest(value.name);
                    quest.UpdateLockedState();
                }
                if (evt.MascotLevel == value.LevelRequirement && flag2)
                {
                    Service.Get <NotificationBreadcrumbController>().AddPersistentBreadcrumb(breadcrumbType, value.name);
                    string breadcrumbId = $"{value.Mascot.AbbreviatedName}{value.ChapterNumber}";
                    if (Service.Get <NotificationBreadcrumbController>().GetBreadcrumbCount(breadcrumbId) == 0)
                    {
                        Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId);
                    }
                    flag = true;
                }
            }
            if (flag)
            {
                Mascot mascot        = Service.Get <MascotService>().GetMascot(evt.MascotName);
                string breadcrumbId2 = $"{mascot.AbbreviatedName}Quest";
                Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId2);
            }
            return(false);
        }
示例#3
0
        public override void OnEnter()
        {
            Mascot mascot = Service.Get <MascotService>().GetMascot(MascotName);

            mascot.RandomWorldDialogOverride = Dialog;
            Finish();
        }
        public void Update()
        {
            if (Mascot == null)
            {
                return;
            }
            Quest activeQuest = Service.Get <QuestService>().ActiveQuest;

            if (Mascot.IsQuestGiver && activeQuest == null && Mascot.HasAvailableQuests() && Service.Get <QuestService>().IsQuestActionIndicatorsEnabled)
            {
                if ((!hasCheckedIndicator || !isShowingIndicator) && Mascot.InteractionBehaviours.ShowIndicator)
                {
                    dispatcher.DispatchEvent(new ActionIndicatorEvents.AddActionIndicator(indicatorData));
                    isShowingIndicator = true;
                }
            }
            else if (!hasCheckedIndicator || isShowingIndicator)
            {
                dispatcher.DispatchEvent(new ActionIndicatorEvents.RemoveActionIndicator(indicatorData));
                isShowingIndicator = false;
            }
            if (state == States.Dialog && !Mascot.IsTalking)
            {
                setState(States.Idle);
            }
            hasCheckedIndicator = true;
        }
        protected override void OnEnable()
        {
            if (!Owner.CompareTag("Player"))
            {
                return;
            }
            EventDispatcher  eventDispatcher   = Service.Get <EventDispatcher>();
            MascotController componentInParent = SceneRefs.ActionSequencer.GetTrigger(Owner).GetComponentInParent <MascotController>();
            Mascot           mascot            = componentInParent.Mascot;

            if (mascot.InteractionBehaviours.ZoomIn && Controller != null)
            {
                CinematographyEvents.CameraLogicChangeEvent evt = default(CinematographyEvents.CameraLogicChangeEvent);
                evt.Controller = Controller;
                eventDispatcher.DispatchEvent(evt);
            }
            if (mascot.InteractionBehaviours.LowerTray && TrayClosed)
            {
                GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
                if (gameObject != null)
                {
                    StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                    component.SendEvent(new ExternalEvent("Root", "minnpc"));
                }
            }
            if (MainNavDisabled)
            {
                eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElementGroup("MainNavButtons"));
            }
            if (mascot.InteractionBehaviours.SuppressQuestNotifier)
            {
                eventDispatcher.DispatchEvent(new HudEvents.SuppressQuestNotifier(suppress: true, autoShow: true));
            }
            if (mascot.InteractionBehaviours.MoveToTalkSpot)
            {
                LocomoteToAction component2 = Owner.GetComponent <LocomoteToAction>();
                if (component2 != null)
                {
                    component2.IsEnabled = true;
                    if (mascot.InteractionBehaviours.OverrideInteracteeTxform)
                    {
                        component2.Waypoints = new List <Transform>(1);
                        component2.IsEnabled = true;
                        Transform transform = new GameObject().transform;
                        transform.position = mascot.InteractionBehaviours.DesiredInteracteeTxform.position;
                        transform.rotation = mascot.InteractionBehaviours.DesiredInteracteeTxform.rotation;
                        component2.Waypoints.Add(transform);
                    }
                }
            }
            else
            {
                LocomoteToAction component2 = Owner.GetComponent <LocomoteToAction>();
                if (component2 != null)
                {
                    component2.IsEnabled = false;
                }
            }
        }
        public override void OnEnter()
        {
            Mascot mascot = Service.Get <MascotService>().GetMascot(MascotName);

            prevDialog = mascot.ActiveQuestDialog;
            mascot.ActiveQuestDialog = Dialog;
            Finish();
        }
示例#7
0
 private bool onQuestUpdated(QuestEvents.QuestUpdated evt)
 {
     if (evt.Quest.State == Quest.QuestState.Active && evt.Quest != ActiveQuest)
     {
         if (ActiveQuest != null)
         {
             deactivateQuest(Quest.QuestState.Suspended);
         }
         ActiveQuest = evt.Quest;
     }
     else if (evt.Quest.State == Quest.QuestState.Completed && evt.Quest == ActiveQuest && evt.Quest.TimesCompleted == 1)
     {
         if (evt.Quest.Definition.name == Service.Get <GameStateController>().FTUEConfig.FtueQuestId)
         {
             foreach (Quest value in availableQuests.Values)
             {
                 if (value.State == Quest.QuestState.Available)
                 {
                     Service.Get <NotificationBreadcrumbController>().AddPersistentBreadcrumb(breadcrumbType, value.Definition.name);
                     string breadcrumbId = $"{value.Definition.Mascot.AbbreviatedName}{value.Definition.ChapterNumber}";
                     if (Service.Get <NotificationBreadcrumbController>().GetBreadcrumbCount(breadcrumbId) == 0)
                     {
                         Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId);
                     }
                     string breadcrumbId2 = $"{value.Mascot.AbbreviatedName}Quest";
                     Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId2);
                 }
             }
         }
         else
         {
             bool   flag             = false;
             bool   flag2            = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();
             string name             = evt.Quest.Definition.Mascot.name;
             int    levelRequirement = evt.Quest.Definition.LevelRequirement;
             foreach (QuestDefinition value2 in knownQuests.Values)
             {
                 if (value2.Mascot.name == name && value2.ChapterNumber == evt.Quest.Definition.ChapterNumber + 1 && levelRequirement == value2.LevelRequirement && flag2)
                 {
                     Service.Get <NotificationBreadcrumbController>().AddPersistentBreadcrumb(breadcrumbType, value2.name);
                     string breadcrumbId = $"{value2.Mascot.AbbreviatedName}{value2.ChapterNumber}";
                     if (Service.Get <NotificationBreadcrumbController>().GetBreadcrumbCount(breadcrumbId) == 0)
                     {
                         Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId);
                     }
                     flag = true;
                 }
             }
             if (flag)
             {
                 Mascot mascot        = Service.Get <MascotService>().GetMascot(name);
                 string breadcrumbId2 = $"{mascot.AbbreviatedName}Quest";
                 Service.Get <NotificationBreadcrumbController>().AddBreadcrumb(breadcrumbId2);
             }
         }
     }
     return(false);
 }
示例#8
0
 public Quest(QuestDefinition dQuest, Mascot mascot)
 {
     dispatcher   = Service.Get <EventDispatcher>();
     Definition   = dQuest;
     Mascot       = mascot;
     QuestSubFsms = new Dictionary <string, Fsm>();
     state        = QuestState.Locked;
     resetQuestItems();
 }
示例#9
0
        private bool onRestartQuestRequest(QuestEvents.RestartQuest evt)
        {
            trace("Restarting quest {0}", evt.Quest.Id);
            Service.Get <INetworkServicesManager>().QuestService.RestartQuest(evt.Quest.Id);
            Mascot mascot = questToMascotMap[evt.Quest.Id];

            mascot.ResumableQuests.Remove(pendingQuest);
            AdventureReminderTutorial.ClearReminderCount(evt.Quest.Mascot.Name);
            return(false);
        }
示例#10
0
        public void UpdateLockedState()
        {
            bool flag = false;

            if (Definition.isMemberOnly && !Service.Get <CPDataEntityCollection>().IsLocalPlayerMember())
            {
                flag = true;
            }
            if (!flag)
            {
                int num = Service.Get <ProgressionService>().MascotLevel(Definition.Mascot.name);
                if (num < Definition.LevelRequirement)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                Mascot          mascot          = null;
                QuestDefinition questDefinition = null;
                bool            flag2           = false;
                bool            flag3           = false;
                for (int i = 0; i < Definition.CompletedQuestRequirement.Length; i++)
                {
                    questDefinition = Definition.CompletedQuestRequirement[i];
                    mascot          = Service.Get <MascotService>().GetMascot(questDefinition.Mascot.name);
                    foreach (Quest availableQuest in mascot.AvailableQuests)
                    {
                        if (availableQuest.Definition.name == questDefinition.name)
                        {
                            flag2 = true;
                            if (availableQuest.TimesCompleted == 0)
                            {
                                flag3 = true;
                                break;
                            }
                        }
                    }
                }
                if (flag3 || !flag2)
                {
                    flag = true;
                }
            }
            if (!flag && unlockedTimeMilliseconds > Service.Get <INetworkServicesManager>().GameTimeMilliseconds)
            {
                flag = true;
            }
            if (!flag)
            {
                state = QuestState.Available;
            }
        }
示例#11
0
        public QuestService(Manifest manifest, PersistentBreadcrumbTypeDefinitionKey breadcrumbType)
        {
            this.breadcrumbType = breadcrumbType;
            dispatcher          = Service.Get <EventDispatcher>();
            MascotService          mascotService = Service.Get <MascotService>();
            List <QuestDefinition> list          = new List <QuestDefinition>();

            ScriptableObject[] assets = manifest.Assets;
            foreach (ScriptableObject scriptableObject in assets)
            {
                string             fileNameWithoutExtension = Path.GetFileNameWithoutExtension(scriptableObject.name);
                Mascot             mascot  = mascotService.GetMascot(fileNameWithoutExtension);
                ScriptableObject[] assets2 = ((Manifest)scriptableObject).Assets;
                foreach (ScriptableObject scriptableObject2 in assets2)
                {
                    QuestDefinition questDefinition = (QuestDefinition)scriptableObject2;
                    knownQuests[scriptableObject2.name]      = questDefinition;
                    questToMascotMap[scriptableObject2.name] = mascot;
                    list.Add(questDefinition);
                }
                mascot.KnownQuests = list.ToArray();
                list.Clear();
            }
            eventChannel = new EventChannel(dispatcher);
            eventChannel.AddListener <QuestEvents.SuspendQuest>(onSuspendQuestRequest);
            eventChannel.AddListener <QuestEvents.ResumeQuest>(onResumeQuestRequest);
            eventChannel.AddListener <QuestEvents.StartQuest>(onStartQuestRequest);
            eventChannel.AddListener <QuestEvents.ReplayQuest>(onReplayQuestRequest);
            eventChannel.AddListener <QuestEvents.RestartQuest>(onRestartQuestRequest);
            eventChannel.AddListener <SplashScreenEvents.SplashScreenOpened>(onSplashScreenOpened);
            eventChannel.AddListener <SplashScreenEvents.SplashScreenClosed>(onSplashScreenClosed);
            eventChannel.AddListener <QuestEvents.QuestUpdated>(onQuestUpdated);
            eventChannel.AddListener <QuestEvents.QuestInitializationComplete>(onQuestInitializationComplete);
            eventChannel.AddListener <RewardEvents.RewardPopupComplete>(onRewardPopupComplete);
            eventChannel.AddListener <QuestEvents.SetPlayerOutOfWorld>(onSetPlayerOutOfWorld);
            eventChannel.AddListener <SceneTransitionEvents.TransitionStart>(onSceneTransition);
            eventChannel.AddListener <QuestEvents.RegisterQuestSubFsm>(onRegisterQuestSubFsm);
            eventChannel.AddListener <InWorldUIEvents.DisableActionIndicators>(onDisableActionIndicators);
            eventChannel.AddListener <InWorldUIEvents.EnableActionIndicators>(onEnableActionIndicators);
            eventChannel.AddListener <QuestServiceEvents.QuestStatesRecieved>(onQuestStatesReceived);
            eventChannel.AddListener <QuestServiceErrors.QuestProgressionError>(onQuestProgressionError);
            eventChannel.AddListener <ProgressionEvents.LevelUp>(onLevelUp);
            updateQuestGivers(0);
            timeLockedCheckTimer = new Timer(2f, repeat: true, delegate
            {
                onTimerTick();
            });
            CoroutineRunner.StartPersistent(timeLockedCheckTimer.Start(), this, "timeLockedQuestTimer");
        }
示例#12
0
 public override void OnEnter()
 {
     mascotComponent = Service.Get <MascotService>().GetMascot(Mascot.name);
     mascotComponent.IsDefaultInteractDisabled                      = DisableDefaultInteract;
     mascotComponent.InteractionBehaviours.ZoomIn                   = false;
     mascotComponent.InteractionBehaviours.ZoomOut                  = false;
     mascotComponent.InteractionBehaviours.LowerTray                = false;
     mascotComponent.InteractionBehaviours.RestoreTray              = false;
     mascotComponent.InteractionBehaviours.ShowIndicator            = false;
     mascotComponent.InteractionBehaviours.SuppressQuestNotifier    = false;
     mascotComponent.InteractionBehaviours.RestoreQuestNotifier     = false;
     mascotComponent.InteractionBehaviours.MoveToTalkSpot           = false;
     mascotComponent.InteractionBehaviours.OverrideInteracteeTxform = false;
     Service.Get <EventDispatcher>().AddListener <QuestEvents.OnMascotInteract>(onMascotInteract);
 }
示例#13
0
 public Quest GetQuest(QuestDefinition questDef, Mascot mascot = null, bool createIfNotFound = true)
 {
     if (!availableQuests.TryGetValue(questDef.name, out var value) && createIfNotFound)
     {
         if (mascot == null)
         {
             mascot = questToMascotMap[questDef.name];
         }
         trace("Creating quest {0}", questDef.name);
         value = new Quest(questDef, mascot);
         availableQuests[questDef.name] = value;
         mascot.AvailableQuests.Add(value);
         value.StateChanged += onQuestStateChanged;
     }
     return(value);
 }
示例#14
0
 private void deactivateQuest(Quest.QuestState state, bool doCleanup = true)
 {
     if (ActiveQuest != null)
     {
         trace("Deactivating quest {0} with state {1}", ActiveQuest.Id, state);
         ActiveQuest.Deactivate(state);
         if (state == Quest.QuestState.Suspended)
         {
             Mascot mascot = questToMascotMap[ActiveQuest.Id];
             mascot.ResumableQuests.Add(ActiveQuest);
         }
         ActiveQuest = null;
         Service.Get <ZonePathing>().ClearWaypoint();
     }
     Service.Get <TutorialBreadcrumbController>().RemoveAllBreadcrumbs();
     if (doCleanup)
     {
         dispatcher.DispatchEvent(default(HudEvents.ResetQuestNotifier));
         RemotePlayerVisibilityState.ShowRemotePlayers();
     }
     Service.Get <EventDispatcher>().DispatchEvent(default(CinematographyEvents.ClearGroupCullingOverride));
     setPlayerOutOfWorld(isOutOfWorld: false);
 }
示例#15
0
 private void updateQuestGivers(int playerLevel)
 {
     trace("Updating quest givers for playerlevel {0}", playerLevel);
     foreach (KeyValuePair <string, QuestDefinition> knownQuest in knownQuests)
     {
         if (availableQuests.ContainsKey(knownQuest.Key))
         {
             continue;
         }
         QuestDefinition value = knownQuest.Value;
         bool            flag  = playerLevel >= value.LevelRequirement;
         if (flag)
         {
             trace("Checking completed requirements for quest {0}", knownQuest.Key);
             QuestDefinition[] completedQuestRequirement = value.CompletedQuestRequirement;
             foreach (QuestDefinition questDefinition in completedQuestRequirement)
             {
                 if (availableQuests.TryGetValue(questDefinition.name, out var value2))
                 {
                     if (value2.State != Quest.QuestState.Completed)
                     {
                         flag = false;
                         break;
                     }
                     continue;
                 }
                 flag = false;
                 break;
             }
         }
         if (flag)
         {
             Mascot mascot = questToMascotMap[value.name];
             GetQuest(value, mascot);
         }
     }
 }
        protected override void OnEnable()
        {
            if (!Owner.CompareTag("Player"))
            {
                return;
            }
            EventDispatcher  eventDispatcher   = Service.Get <EventDispatcher>();
            MascotController componentInParent = SceneRefs.ActionSequencer.GetTrigger(Owner).GetComponentInParent <MascotController>();

            mascot = componentInParent.Mascot;
            if (mascot.InteractionBehaviours.ZoomOut && Controller != null)
            {
                CinematographyEvents.CameraLogicResetEvent evt = default(CinematographyEvents.CameraLogicResetEvent);
                evt.Controller = Controller;
                eventDispatcher.DispatchEvent(evt);
            }
            if (mascot.InteractionBehaviours.RestoreTray)
            {
                GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
                if (gameObject != null)
                {
                    StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                    component.SendEvent(new ExternalEvent("Root", "exit_cinematic"));
                    if (!string.IsNullOrEmpty(ScreenName))
                    {
                        component.SendEvent(new ExternalEvent("ScreenContainerContent", ScreenName));
                    }
                }
                eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElementGroup("MainNavButtons"));
            }
            if (mascot.InteractionBehaviours.RestoreQuestNotifier)
            {
                eventDispatcher.DispatchEvent(new HudEvents.SuppressQuestNotifier(suppress: false));
            }
        }
示例#17
0
        public override void OnEnter()
        {
            Mascot mascot = Service.Get <MascotService>().GetMascot(MascotName);

            mascot.InteractionBehaviours.ZoomIn                = ZoomIn;
            mascot.InteractionBehaviours.ZoomOut               = ZoomOut;
            mascot.InteractionBehaviours.LowerTray             = LowerTray;
            mascot.InteractionBehaviours.RestoreTray           = RestoreTray;
            mascot.InteractionBehaviours.ShowIndicator         = ShowIndicator;
            mascot.InteractionBehaviours.SuppressQuestNotifier = SuppressQuestNotifier;
            mascot.InteractionBehaviours.RestoreQuestNotifier  = RestoreQuestNotifier;
            mascot.InteractionBehaviours.MoveToTalkSpot        = MoveToTalkSpot;
            if (DesiredInteracteeTxform.Value != null)
            {
                mascot.InteractionBehaviours.OverrideInteracteeTxform = OverrideInteracteeTxform;
                mascot.InteractionBehaviours.DesiredInteracteeTxform  = DesiredInteracteeTxform.Value.transform;
            }
            else
            {
                mascot.InteractionBehaviours.OverrideInteracteeTxform = false;
            }
            mascot.WantsToTalk = true;
            Finish();
        }
示例#18
0
 public OnMascotInteract(Mascot mascot)
 {
     Mascot = mascot;
 }
        public override void OnExit()
        {
            Mascot mascot = Service.Get <MascotService>().GetMascot(MascotName);

            mascot.ActiveQuestDialog = prevDialog;
        }
示例#20
0
        public override void OnExit()
        {
            Mascot mascot = Service.Get <MascotService>().GetMascot(MascotName);

            mascot.RandomWorldDialogOverride = null;
        }
示例#21
0
        private void showGivingQuestDialog(Mascot mascot)
        {
            DialogList      dialogList      = null;
            bool            flag            = false;
            bool            flag2           = false;
            bool            flag3           = true;
            QuestDefinition questDefinition = null;
            Quest           quest           = null;

            for (int i = 0; i < mascot.KnownQuests.Length; i++)
            {
                questDefinition = mascot.KnownQuests[i];
                if (questDefinition.Prototyped)
                {
                    continue;
                }
                for (int j = 0; j < mascot.AvailableQuests.Count; j++)
                {
                    if (mascot.AvailableQuests[j].Definition.Title == questDefinition.Title)
                    {
                        quest = mascot.AvailableQuests[j];
                        break;
                    }
                }
                if (quest != null && quest.TimesCompleted == 0)
                {
                    flag3 = false;
                    if (quest.State != Quest.QuestState.Locked && (!questDefinition.isMemberOnly || Service.Get <CPDataEntityCollection>().IsLocalPlayerMember()))
                    {
                        dialogList = Definition.QuestGiverDialog;
                        break;
                    }
                }
                if (quest == null || quest.State == Quest.QuestState.Locked)
                {
                    int num = Service.Get <ProgressionService>().MascotLevel(mascot.Definition.name);
                    if (questDefinition.LevelRequirement > num)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag = true;
                    }
                    flag3 = false;
                }
                quest = null;
            }
            if (dialogList == null && !Service.Get <CPDataEntityCollection>().IsLocalPlayerMember())
            {
                dialogList = Definition.QuestGiverDialogMemberLocked;
            }
            else if (flag3)
            {
                dialogList = Definition.QuestGiverDialogAllComplete;
            }
            else if (dialogList == null)
            {
                if (flag)
                {
                    dialogList = Definition.QuestGiverDialogTimeLocked;
                }
                else if (flag2)
                {
                    dialogList = Definition.QuestGiverDialogLevelLocked;
                }
            }
            if (dialogList == null || dialogList.Entries.Length == 0)
            {
                dialogList = Definition.QuestGiverDialog;
            }
            showDialog(dialogList.SelectRandom(), false);
        }