public static void AcceptQuest(uint player, string[] args)
        {
            if (args.Length <= 0)
            {
                const string Error = "'action-accept-quest' requires a questId argument.";
                SendMessageToPC(player, Error);
                Log.Write(LogGroup.Error, Error);
                return;
            }

            var questId = args[0];

            Quest.AcceptQuest(player, questId);
        }
Example #2
0
    /// <summary>
    /// Runs the dialogue functions of the given node
    /// </summary>
    private void HandleDialogueFunctions()
    {
        // Get a reference to the current active quest
        Quest q = GameManager.instance.GetActiveQuest();

        foreach (DialogueAction action in currentNode.actions)
        {
            switch (action.action)
            {
            // Rejects the quest
            case DialogueAction.Action.rejectQuest:
                q.RejectQuest();
                break;

            // Accepts the quest
            case DialogueAction.Action.acceptQuest:
                q.AcceptQuest();
                break;

            // Completes the quest. Often used by QuestItems
            case DialogueAction.Action.completeQuest:
                q.CompleteQuest();
                break;

            // Finishes the quest. Called at the end of a fail or win state. If it isn't, this will cause problems.
            case DialogueAction.Action.finishQuest:
                q.FinishQuest();
                break;

            // Increases friendship of the quest giver.
            // This value isn't saved yet, but THERE'S A REALLY COOL WAY TO DO IT SO DON'T SWEAT IT
            case DialogueAction.Action.affectFriendship:
                q.AffectFriendship(int.Parse(action.param));
                break;

            // Collects the current quest item
            case DialogueAction.Action.collectQuestItem:
                q.CollectQuestItem();
                break;

            // Destroys either the current quest item or a specific quest item. Be careful with the latter.
            case DialogueAction.Action.destroyQuestItem:

                if (action.param.Equals(""))
                {
                    q.DestroyQuestItem();
                }
                else
                {
                    q.DestroyQuestItem(int.Parse(action.param));
                }

                break;

            // Destroys all quest items
            case DialogueAction.Action.destroyAllQuestItems:
                q.DestroyAllQuestItems();
                break;

            // Increases the maximum stamina of the player
            case DialogueAction.Action.increaseStamina:
                GameManager.instance.IncreasePlayerStamina(float.Parse(action.param));
                break;

            // Affect a social value
            case DialogueAction.Action.affectSocialValue:

                string[] temp = action.param.Split(',');

                // Check if there is an appropriate number of arguments
                if (temp.Length == 2)
                {
                    int val = int.Parse(temp[1]);
                    // The biggest problem right now is that there is no validation for SVs.
                    // This would work, but it runs the risk of people using slightly different names and throwing saving off.
                    // I'll probably add some kind of validation here which would remove social, scrub all non-letters, etc.
                    GameManager.instance.AffectSocialValue(temp[0], val);
                }
                else
                {
                    Debug.LogError("Param Error: too many or few parameters!");
                }
                break;

            // Display a hint
            case DialogueAction.Action.showHint:
                GameManager.instance.ShowHint();
                break;
            }
        }
    }
        public static void DebugGiveQuest()
        {
            var player = GetLastUsedBy();

            Quest.AcceptQuest(player, "testQuest");
        }