Esempio n. 1
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)
        {
            ClericMulgrut quest = player.IsDoingQuest(typeof(ClericMulgrut)) as ClericMulgrut;

            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();
            }
        }
Esempio n. 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 TalkToHughGallen(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 (hughGallen.CanGiveQuest(typeof(ClericMulgrut), player) <= 0)
            {
                return;
            }

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

            hughGallen.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    hughGallen.SayTo(player, "I have a [bit of information] you might be interested in should you wish to hear it.");
                    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 "bit of information":
                        hughGallen.SayTo(player, "Listen close! Lord Prydwen once had a faithful cleric known as Mulgrut. His service to our realm was unparalleled, yet, during Arthur's siege on Lancelot, Mulgrut's son Durren [was slain].");
                        break;

                    case "was slain":
                        hughGallen.SayTo(player, "Yes! Mulgrut [never recovered] from that. He turned his eyes from God and never looked back.");
                        break;

                    case "never recovered":
                        hughGallen.SayTo(player, "Aye! Even in death his soul never rests. If you are interested, I can tell you how to [make a profit] from this!");
                        break;

                    // If the player offered his help, we send the quest dialog now!
                    case "make a profit":
                        player.Out.SendQuestSubscribeCommand(hughGallen, QuestMgr.GetIDForQuestType(typeof(ClericMulgrut)), "Do you accept the Cleric Mulgrut quest? \n[Levels 5-10]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    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;
                    }
                }
            }
        }