Exemple #1
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsTriggered)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                // When a gold amount and task is specified, the player must have that amount of gold or another task is called
                if (goldAmount > 0 && taskSymbol != null && !string.IsNullOrEmpty(taskSymbol.Name))
                {
                    // Does player have enough gold?
                    if (GameManager.Instance.PlayerEntity.GoldPieces >= goldAmount)
                    {
                        // Then deduct gold and fire trigger
                        GameManager.Instance.PlayerEntity.GoldPieces -= goldAmount;
                    }
                    else
                    {
                        // Otherwise trigger secondary task and exit without firing trigger
                        ParentQuest.StartTask(taskSymbol);
                        return(false);
                    }
                }

                if (id != 0)
                {
                    ParentQuest.ShowMessagePopup(id);
                }

                // Rearm person click after current task
                ParentQuest.ScheduleClickRearm(person);

                return(true);
            }

            return(false);
        }
Exemple #2
0
        public override bool CheckTrigger(Task caller)
        {
            // Always return true once owning Task is triggered
            // Another action will need to rearm/unset this task if another click is required
            // This seems to fit how classic works based on current observation
            if (caller.IsTriggered)
            {
                return(true);
            }

            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return(false);
            }

            // Get related Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return(false);
            }

            // Check player clicked flag
            if (person.HasPlayerClicked)
            {
                // Check if player has item
                if (GameManager.Instance.PlayerEntity.Items.Contains(item))
                {
                    // Rearm person click after current task
                    ParentQuest.ScheduleClickRearm(person);

                    // Show message popup, remove item, return true on trigger
                    ParentQuest.ShowMessagePopup(id);
                    GameManager.Instance.PlayerEntity.ReleaseQuestItemForReoffer(item.DaggerfallUnityItem);
                    return(true);
                }
            }

            return(false);
        }