示例#1
0
        /// <summary>
        /// Continuously checks where player is and sets target true/false based on site properties.
        /// </summary>
        public override void Update(Task caller)
        {
            bool result = false;

            // Get place resource
            Place place = ParentQuest.GetPlace(placeSymbol);

            if (place == null)
            {
                return;
            }

            // Check if player at this place
            result = place.IsPlayerHere();

            // Handle positive check
            if (result)
            {
                // "saying" popup
                // Only display this once or player can get a popup loop
                if (textId != 0 && !textShown)
                {
                    ParentQuest.ShowMessagePopup(textId);
                    textShown = true;
                }

                // Start target task
                ParentQuest.StartTask(taskSymbol);
            }
            else
            {
                // Clear target task
                ParentQuest.ClearTask(taskSymbol);
            }
        }
示例#2
0
        /// <summary>
        /// Continuously checks where player is and sets target true/false based on site properties.
        /// </summary>
        public override void Update(Task caller)
        {
            bool result = false;

            // Get place resource
            Place place = ParentQuest.GetPlace(placeSymbol);

            if (place == null)
            {
                return;
            }

            // Check if player at this place
            result = place.IsPlayerHere();

            // Handle positive check
            if (result)
            {
                // "saying" popup
                // TODO: Should this run every time or only once?
                if (textId != 0)
                {
                    ParentQuest.ShowMessagePopup(textId);
                }

                // Start target task
                ParentQuest.StartTask(taskSymbol);
            }
            else
            {
                // Clear target task
                ParentQuest.ClearTask(taskSymbol);
            }
        }
示例#3
0
        public override void Update(Task caller)
        {
            // Validate
            if (spellID == -1 || classicEffects == null || classicEffects.Length == 0 || taskSymbol == null || lastReadySpell == null)
            {
                lastReadySpell = null;
                return;
            }

            // Compare readied effect properties to spell record
            for (int i = 0; i < classicEffects.Length; i++)
            {
                // Effect slot must be populated
                if (classicEffects[i].type == -1 || classicEffects[i].subType == -1)
                {
                    continue;
                }

                // Bundle must have contain native effects matching this classic effect
                if (!lastReadySpell.HasMatchForClassicEffect(classicEffects[i]))
                {
                    lastReadySpell = null;
                    return;
                }
            }

            // Only reached here if action is running and matching spell is cast
            ParentQuest.StartTask(taskSymbol);
            SetComplete();
        }
示例#4
0
        public override void Update(Task caller)
        {
            // Attempt to get Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return;
            }

            // Let the item know it's being watched
            item.ActionWatching = true;

            // Player must be wearing item or item clicked with "use" in inventory
            if (GameManager.Instance.PlayerEntity.ItemEquipTable.IsEquipped(item.DaggerfallUnityItem) || item.UseClicked)
            {
                // Say message
                if (textID != 0)
                {
                    ParentQuest.ShowMessagePopup(textID);
                }

                // Trigger target task
                ParentQuest.StartTask(taskSymbol);

                // Clear watching flag
                item.ActionWatching = false;

                SetComplete();
            }
        }
示例#5
0
        public override void Update(Task caller)
        {
            // Attempt to get Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return;
            }

            // Let the item know it's being watched
            item.ActionWatching = true;

            // Player must "use" item from inventory
            if (item.UseClicked)
            {
                // Say message
                if (textID != 0)
                {
                    ParentQuest.ShowMessagePopup(textID);
                }

                // Trigger target task
                ParentQuest.StartTask(taskSymbol);

                // Clear watching flag
                item.ActionWatching = false;

                SetComplete();
            }
        }
示例#6
0
        public override void Update(Task caller)
        {
            // Attempt to get Item resource
            Item item = ParentQuest.GetItem(itemSymbol);

            if (item == null)
            {
                return;
            }

            // Check if player is wearing item
            if (!GameManager.Instance.PlayerEntity.ItemEquipTable.IsEquipped(item.DaggerfallUnityItem))
            {
                return;
            }

            // Say message
            if (textID != 0)
            {
                ParentQuest.ShowMessagePopup(textID);
            }

            // Trigger target task
            ParentQuest.StartTask(taskSymbol);

            SetComplete();
        }
        private void MessageBox_OnCustomButtonClick(DaggerfallMessageBox sender, string messageBoxButton)
        {
            Symbol task;

            buttons.TryGetValue(messageBoxButton, out task);
            ParentQuest.StartTask(task);
            sender.CloseWindow();
        }
示例#8
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);
        }
示例#9
0
        private void MessageBox_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            // Start yes or no task
            if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
            {
                ParentQuest.StartTask(yesTaskSymbol);
            }
            else
            {
                ParentQuest.StartTask(noTaskSymbol);
            }

            // Close prompt
            sender.CloseWindow();
        }
示例#10
0
        public override void Update(Task caller)
        {
            // Attempt to get Item resource
            Item item = ParentQuest.GetItem(targetItem);

            if (item == null)
            {
                SetComplete();
                throw new Exception(string.Format("Could not find Item resource symbol {0}", targetItem));
            }

            // Start target task based on player carrying item
            if (GameManager.Instance.PlayerEntity.Items.Contains(item))
            {
                ParentQuest.StartTask(targetTask);
            }
        }
示例#11
0
        public override void Update(Task caller)
        {
            if (!questStarted)
            {
                // Start quest from name and store UID if found
                quest = GameManager.Instance.QuestListsManager.GetQuest(questName);
                if (quest != null)
                {
                    questUId = quest.UID;
                    QuestMachine.Instance.ScheduleQuest(quest);
                }
                else
                {
                    questUId = null;
                }

                questStarted = true;
            }

            if (quest == null)
            {
                // Try to retrieve quest after deserialization
                if (questUId != null)
                {
                    quest = QuestMachine.Instance.GetQuest(questUId.Value);
                }

                // Set 'failure' task if quest is not found
                if (quest == null)
                {
                    ParentQuest.StartTask(failureSymbol);
                    SetComplete();
                    return;
                }
            }

            if (quest.QuestComplete)
            {
                // Set 'success' or 'failure' task
                ParentQuest.StartTask(quest.QuestSuccess ? successSymbol : failureSymbol);
                SetComplete();
                quest = null;
            }
        }
示例#12
0
        public override void Update(Task caller)
        {
            // Validate
            if (string.IsNullOrEmpty(effectKey) || taskSymbol == null || lastReadySpell == null)
            {
                lastReadySpell = null;
                return;
            }

            // Compare readied spell for target effect
            for (int i = 0; i < lastReadySpell.Settings.Effects.Length; i++)
            {
                if (lastReadySpell.Settings.Effects[i].Key == effectKey)
                {
                    ParentQuest.StartTask(taskSymbol);
                    SetComplete();
                    break;
                }
            }
        }
示例#13
0
        public override void Update(Task caller)
        {
            // Get related Person resource
            Person person = ParentQuest.GetPerson(npcSymbol);

            if (person == null)
            {
                return;
            }

            // Check faction with this NPC
            // Note: Believe this should be >= check despite name of action - to confirm
            if (GameManager.Instance.PlayerEntity.FactionData.GetReputation(person.FactionData.id) < minReputation)
            {
                return;
            }

            // Start target task
            ParentQuest.StartTask(taskSymbol);

            SetComplete();
        }
示例#14
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // When an amount is specified
            if (amount > 0)
            {
                if (goldOnly)
                {
                    // Does player have enough gold?
                    if (GameManager.Instance.PlayerEntity.GoldPieces >= amount)
                    {
                        // Then deduct gold and start paid task
                        GameManager.Instance.PlayerEntity.GoldPieces -= amount;
                        ParentQuest.StartTask(paidTaskSymbol);
                    }
                    else
                    {
                        // Otherwise trigger secondary task and exit
                        ParentQuest.StartTask(notTaskSymbol);
                    }
                }
                else
                {
                    // Does player have enough money?
                    if (GameManager.Instance.PlayerEntity.GetGoldAmount() >= amount)
                    {
                        // Then deduct money and start paid task
                        GameManager.Instance.PlayerEntity.DeductGoldAmount(amount);
                        ParentQuest.StartTask(paidTaskSymbol);
                    }
                    else
                    {
                        // Otherwise trigger secondary task and exit
                        ParentQuest.StartTask(notTaskSymbol);
                    }
                }
            }
        }
        private void MessageBox_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
        {
            // Start selected task
            if (messageBoxButton == (DaggerfallMessageBox.MessageBoxButtons)opt1button)
            {
                ParentQuest.StartTask(opt1TaskSymbol);
            }
            else if (messageBoxButton == (DaggerfallMessageBox.MessageBoxButtons)opt2button)
            {
                ParentQuest.StartTask(opt2TaskSymbol);
            }
            else if (messageBoxButton == (DaggerfallMessageBox.MessageBoxButtons)opt3button)
            {
                ParentQuest.StartTask(opt3TaskSymbol);
            }
            else if (messageBoxButton == (DaggerfallMessageBox.MessageBoxButtons)opt4button)
            {
                ParentQuest.StartTask(opt4TaskSymbol);
            }

            // Close prompt
            sender.CloseWindow();
        }
示例#16
0
 public override void Update(Task caller)
 {
     ParentQuest.StartTask(taskSymbol);
     SetComplete();
 }