private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player") && Service.Get <QuestService>().ActiveQuest == null && !AdventureReminderTutorial.IsReminderTutorialShown(MascotName) && Service.Get <TutorialManager>().TryStartTutorial(TutorialDefinition.Id))
     {
         AdventureReminderTutorial.SetReminderTutorialShown(MascotName);
     }
 }
        private IEnumerator applyReceivedQuestStates(QuestServiceEvents.QuestStatesRecieved evt)
        {
            while (!QuestPlayerIsReady)
            {
                yield return(null);
            }
            CPDataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();

            foreach (QuestState questState in evt.QuestStates)
            {
                if (!questToMascotMap.TryGetValue(questState.questId, out var value))
                {
                    continue;
                }
                QuestDefinition questDefinition = knownQuests[questState.questId];
                if (questDefinition.Prototyped)
                {
                    continue;
                }
                Quest quest = GetQuest(questDefinition, value);
                if (quest == null)
                {
                    continue;
                }
                if (questState.status == QuestStatus.ACTIVE && (ActiveQuest == null || ActiveQuest != quest) && !quest.IsActivating && pendingQuest != quest && quest.Definition.IsPausable)
                {
                    trace(Time.time + ": applyReceivedQuestStates() setting " + quest.Id + " to SUSPENDED");
                    Service.Get <INetworkServicesManager>().QuestService.SetStatus(questState.questId, QuestStatus.SUSPENDED);
                    continue;
                }
                trace(Time.time + ": applyReceivedQuestStates() quest.UpdateState()");
                quest.UpdateState(questState);
                if (quest.State == Quest.QuestState.Suspended)
                {
                    if (!value.ResumableQuests.Contains(quest))
                    {
                        value.ResumableQuests.Add(quest);
                    }
                }
                else if (quest == ActiveQuest && !quest.IsActivating)
                {
                    trace(Time.time + ": applyReceivedQuestStates() calling RestoreAsync()");
                    GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(dataEntityCollection.LocalPlayerHandle);
                    if (component != null)
                    {
                        quest.RestoreAsync(component.GameObject);
                    }
                }
                if (quest.TimesCompleted == 0 && (quest.State == Quest.QuestState.Available || quest.State == Quest.QuestState.Suspended))
                {
                    AdventureReminderTutorial.SetAvailableAdventureTimestamp(value.Name);
                }
            }
            dispatcher.DispatchEvent(default(QuestEvents.QuestSyncCompleted));
            IsQuestDataRecieved = true;
        }
        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);
        }
 private bool onResumeQuestRequest(QuestEvents.ResumeQuest evt)
 {
     trace("Resuming quest {0}", evt.Quest.Id);
     CoroutineRunner.Start(ShowStartQuestSplashscreen(evt.Quest), this, "Load splash screen");
     pendingQuest      = evt.Quest;
     pendingQuestStart = true;
     AdventureReminderTutorial.ClearReminderCount(evt.Quest.Mascot.Name);
     Service.Get <ICPSwrveService>().Action("game.quest", "resume", evt.Quest.Mascot.Name, evt.Quest.Id);
     return(false);
 }
Exemple #5
0
 private void setNumPlayingDaysWithAvailableAdventure()
 {
     foreach (Mascot mascot in mascotService.Mascots)
     {
         if (mascot.IsQuestGiver)
         {
             AdventureReminderTutorial.SetNumPlayingDaysWithAvailableAdventure(mascot.Name);
         }
     }
 }
 private bool onStartQuestRequest(QuestEvents.StartQuest evt)
 {
     trace("Starting quest {0}", evt.Quest.Id);
     if (evt.Quest.Id != Service.Get <GameStateController>().FTUEConfig.FtueQuestId)
     {
         CoroutineRunner.Start(ShowStartQuestSplashscreen(evt.Quest), this, "Load splash screen");
         pendingQuest      = evt.Quest;
         pendingQuestStart = true;
     }
     Service.Get <ICPSwrveService>().StartTimer("questtime", "quest." + evt.Quest.Definition.name);
     AdventureReminderTutorial.ClearReminderCount(evt.Quest.Mascot.Name);
     return(false);
 }