Example #1
0
        public void CancelQuest(QuestInfo quest)
        {
            bool available = false, current = false, completed = false;

            ClientUserQuest userQuest = GameScene.Game.QuestLog.FirstOrDefault(x => x.Quest == quest);

            if (userQuest == null)
            {
                return;
            }

            if (CompletedTab.Quests.Contains(quest))
            {
                CompletedTab.Quests.Remove(quest);
                completed = true;
            }

            if (CurrentTab.Quests.Contains(quest))
            {
                CurrentTab.Quests.Remove(quest);
                current = true;
            }

            if (GameScene.Game.CanAccept(quest))
            {
                if (!AvailableTab.Quests.Contains(quest))
                {
                    AvailableTab.Quests.Add(quest);
                    available = true;
                }
            }

            GameScene.Game.QuestLog.Remove(userQuest);

            if (available)
            {
                AvailableTab.NeedUpdate = true;
                AvailableTab.UpdateQuestDisplay();
            }
            if (current)
            {
                CurrentTab.NeedUpdate = true;
                CurrentTab.UpdateQuestDisplay();
            }
            if (completed)
            {
                CompletedTab.NeedUpdate = true;
                CompletedTab.UpdateQuestDisplay();
            }
        }
Example #2
0
        public void QuestChanged(ClientUserQuest quest)
        {
            if (AvailableTab.SelectedQuest?.QuestInfo == quest.Quest)
            {
                AvailableTab.UpdateQuestDisplay();
            }

            if (CurrentTab.SelectedQuest?.QuestInfo == quest.Quest)
            {
                CurrentTab.UpdateQuestDisplay();
            }

            if (CompletedTab.SelectedQuest?.QuestInfo == quest.Quest)
            {
                CompletedTab.UpdateQuestDisplay();
            }
        }
Example #3
0
        public void PopulateQuests()
        {
            bool available = false, current = false, completed = false;

            foreach (QuestInfo quest in Globals.QuestInfoList.Binding)
            {
                ClientUserQuest userQuest = GameScene.Game.QuestLog.FirstOrDefault(x => x.Quest == quest);

                if (userQuest == null)
                {
                    if (!GameScene.Game.CanAccept(quest))
                    {
                        continue;
                    }

                    if (AvailableTab.Quests.Contains(quest))
                    {
                        continue;
                    }

                    AvailableTab.Quests.Add(quest);
                    available = true;
                    continue;
                }


                if (AvailableTab.Quests.Contains(quest))
                {
                    AvailableTab.Quests.Remove(quest);
                    available = true;
                }

                if (userQuest.Completed)
                {
                    if (CompletedTab.Quests.Contains(quest))
                    {
                        continue;
                    }

                    CompletedTab.Quests.Add(quest);
                    completed = true;

                    if (!CurrentTab.Quests.Contains(quest))
                    {
                        continue;
                    }

                    CurrentTab.Quests.Remove(quest);
                    current = true;

                    continue;
                }

                if (CurrentTab.Quests.Contains(quest))
                {
                    continue;
                }

                CurrentTab.Quests.Add(quest);
                current = true;
            }


            if (available)
            {
                AvailableTab.NeedUpdate = true;
                AvailableTab.UpdateQuestDisplay();
            }
            if (current)
            {
                CurrentTab.NeedUpdate = true;
                CurrentTab.UpdateQuestDisplay();
            }
            if (completed)
            {
                CompletedTab.NeedUpdate = true;
                CompletedTab.UpdateQuestDisplay();
            }
        }