Example #1
0
        /* This is the method we declared as callback for the hooks we set to
         * Sir Quait. It will be called whenever a player right clicks on Sir Quait
         * or when he whispers something to him.
         */

        protected static void TalkToElvarTambor(DOLEvent e, object sender, EventArgs args)
        {
            // We get the player from the event arguments and check if he qualifies
            GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer;

            if (player == null)
            {
                return;
            }

            // We also check if the player is already doing the quest
            YdeniasCrush quest = player.IsDoingQuest(typeof(YdeniasCrush)) as YdeniasCrush;

            elvarTambor.TurnTo(player);

            // The player whispered to NPC (clicked on the text inside the [])
            if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                if (quest != null)
                {
                    switch (wArgs.Text)
                    {
                    case "Cotswold":
                        elvarTambor.SayTo(player, "If you are traveling back that way, would you mind delivering this letter to Ydenia for me?  I would be ever so appreciative.");
                        if (quest.Step == 2)
                        {
                            player.GainExperience(GameLiving.eXPSource.Quest, 10, true);
                            long money = Money.GetMoney(0, 0, 0, 2, Util.Random(50));
                            player.AddMoney(money, "You are awarded 2 silver and some copper!");
                            InventoryLogging.LogInventoryAction("(QUEST;" + quest.Name + ")", player, eInventoryActionType.Quest, money);

                            // give letter
                            GiveItem(elvarTambor, player, letterToYdenia);

                            quest.Step = 3;
                        }

                        break;
                    }
                }
            }
        }
Example #2
0
        /* This is our callback hook that will be called when the player clicks
         * on any button in the quest offer dialog. We check if he accepts or
         * declines here...
         */

        private static void CheckPlayerAbortQuest(GamePlayer player, byte response)
        {
            YdeniasCrush quest = player.IsDoingQuest(typeof(YdeniasCrush)) as YdeniasCrush;

            if (quest == null)
            {
                return;
            }

            if (response == 0x00)
            {
                SendSystemMessage(player, "Good, no go out there and finish your work!");
            }
            else
            {
                SendSystemMessage(player, "Aborting Quest " + questTitle + ". You can start over again if you want.");
                quest.AbortQuest();
            }
        }
Example #3
0
        /* This is the method we declared as callback for the hooks we set to
         * NPC. It will be called whenever a player right clicks on NPC
         * or when he whispers something to him.
         */

        protected static void TalkToYdeniaPhilpott(DOLEvent e, object sender, EventArgs args)
        {
            // We get the player from the event arguments and check if he qualifies
            GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer;

            if (player == null)
            {
                return;
            }

            if (ydeniaPhilpott.CanGiveQuest(typeof(YdeniasCrush), player) <= 0)
            {
                return;
            }

            // We also check if the player is already doing the quest
            YdeniasCrush quest = player.IsDoingQuest(typeof(YdeniasCrush)) as YdeniasCrush;

            ydeniaPhilpott.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    ydeniaPhilpott.SayTo(player, "Hello there!  Are you new here?  My name is Ydenia.  I am a minstrel.  I lost my husband two years ago in a great battle in Pennine Mountains.  I was sad for a very long time, but now, I am [happy] again.");
                    return;
                }
                else
                {
                    if (quest.Step == 3)
                    {
                        ydeniaPhilpott.SayTo(player, "Oh!  Thank you for delivering my letter for me!  Did he have one in return?");
                    }

                    return;
                }
            }

            // The player whispered to NPC (clicked on the text inside the [])
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                if (quest == null)
                {
                    // Do some small talk :)
                    switch (wArgs.Text)
                    {
                    case "happy":
                        ydeniaPhilpott.SayTo(player, "Oh yes!  I have met someone who is very interesting.  I think about him all the time when we are apart, which is often.  His name is Elvar Tambor, and he is a weapons merchant in Prydwen Keep.  We [met] about six months ago.");
                        break;

                    case "met":
                        ydeniaPhilpott.SayTo(player, "He came to Cotswold to do some business with the other merchants here and came into the tavern for a drink.  He listened to me play and then came over and talked with me when I was done.  He said he would like to [write] to me");
                        break;

                    case "write":
                        ydeniaPhilpott.SayTo(player, "So we have been writing to each other ever since.  I rarely get the chance to go to Prydwen Keep, so it's just easier if I send someone over there to deliver the letters for me.  Say, how would you like to earn a [few silvers] and deliver this for me");
                        break;

                    // If the player offered his help, we send the quest dialog now!
                    case "few silvers":
                        player.Out.SendQuestSubscribeCommand(ydeniaPhilpott, QuestMgr.GetIDForQuestType(typeof(YdeniasCrush)), "Will you deliver the letter to \nElvar Tambor for Ydenia?\n[Level " + player.Level + "]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "something":
                        if (quest.Step == 4)
                        {
                            ydeniaPhilpott.SayTo(player, "I found this in my belongings.  I don't use it anymore, so I thought you could use it.  Thank you again Gwonn.  You have made both of us very happy today.");
                            quest.FinishQuest();
                        }

                        break;

                    case "abort":
                        player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest));
                        break;
                    }
                }
            }
        }