コード例 #1
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 TalkToVerNuren(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
            AndrewsSkins quest = player.IsDoingQuest(typeof(AndrewsSkins)) as AndrewsSkins;

            verNuren.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest != null)
                {
                    if (quest.Step < 3)
                    {
                        // Player is doing the quest...
                        verNuren.SayTo(player, "Greetings to you traveler.  Is there something I can help you with today?");
                        return;
                    }
                }
            }

            // The player whispered to NPC (clicked on the text inside the [] or with /whisper)
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                if (quest != null)
                {
                    switch (wArgs.Text)
                    {
                    case "thread":
                        if (quest.Step == 2)
                        {
                            verNuren.SayTo(player, "Oh yes.  I know what you're talking about.  Geor told me the other day that he was out of the thread he needs to make his armor.  No worries.  I have some right here.  Now please, take this straight to Geor.");

                            GiveItem(verNuren, player, spoolOfLeatherworkingThread);

                            player.GainExperience(GameLiving.eXPSource.Quest, 40, true);
                            long money = Money.GetMoney(0, 0, 0, 3, Util.Random(50));
                            player.AddMoney(money, "You are awarded 3 silver and some copper!");
                            InventoryLogging.LogInventoryAction("(QUEST;" + quest.Name + ")", player, eInventoryActionType.Quest, money);

                            quest.Step = 3;
                        }

                        break;
                    }
                }
            }
        }
コード例 #2
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 TalkToGeorNadren(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
            AndrewsSkins quest = player.IsDoingQuest(typeof(AndrewsSkins)) as AndrewsSkins;

            georNadren.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest != null)
                {
                    switch (quest.Step)
                    {
                    case 1:
                        georNadren.SayTo(player, "Hello there friend.  How may I be of service today?");
                        break;

                    case 3:
                        georNadren.SayTo(player, "Welcome back friend.  Did you get the thread I need?");
                        break;
                    }
                }
            }

            // The player whispered to NPC (clicked on the text inside the [])
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                if (quest != null)
                {
                    switch (wArgs.Text)
                    {
                    case "errand":
                        if (quest.Step == 2)
                        {
                            georNadren.SayTo(player, "I need a few spools of thread in order to continue making the armor I sell.  Ver Nuren's wife makes the thread I use.  Go ask him if he has any for me.  Come back to me when you have some.");
                        }

                        break;
                    }
                }
            }
        }
コード例 #3
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)
        {
            AndrewsSkins quest = player.IsDoingQuest(typeof(AndrewsSkins)) as AndrewsSkins;

            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();
            }
        }
コード例 #4
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 TalkToAndrewWyatt(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 (andrewWyatt.CanGiveQuest(typeof(AndrewsSkins), player) <= 0)
            {
                return;
            }

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

            andrewWyatt.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    andrewWyatt.SayTo(player, "Greetings friend.  I am Andrew Wyatt, local hunter in these parts.  You must be a fresh, young adventurer, aren't you?  Well then, I might have an [errand] for you to run.");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        andrewWyatt.SayTo(player, "Ah, back so soon friend?  Well then, I take it you [finished] my errand?");
                    }

                    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 "errand":
                        andrewWyatt.SayTo(player, "Aye friend.  I hunt all manner of creatures, but my specialty is bears.  I hunt every type of bear out there.  I use every part of them too.  I need to run my next shipment of skins to Geor Nadren in [Camelot].");
                        break;

                    case "Camelot":
                        andrewWyatt.SayTo(player, "I'll tell you what.  If you take my skins to him, I'll set you up with a little reward for your troubles.  I'm enjoying my time here in the tavern, and I'd like to stay a little longer.  What do you say?  Are you [up] for it or not?");
                        break;

                    // If the player offered his help, we send the quest dialog now!
                    case "up":
                        player.Out.SendQuestSubscribeCommand(andrewWyatt, QuestMgr.GetIDForQuestType(typeof(AndrewsSkins)), "Will you deliver these skins to \nGeor Nadren in Camelot City?\n[Level " + player.Level + "]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "finished":
                        if (quest.Step == 4)
                        {
                            andrewWyatt.SayTo(player, "I knew I could count on you.  All right then, as promised, a small reward for your troubles.  Use it well, and good luck " + player.Name + ".  Perhaps I'll have some other work for you in the future.");
                            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;
                    }
                }
            }
        }