Exemplo 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)
        {
            HuntForSlith quest = player.IsDoingQuest(typeof(HuntForSlith)) as HuntForSlith;

            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();
            }
        }
Exemplo 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 TalkToCommanderBurcrif(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 (commanderBurcrif.CanGiveQuest(typeof(HuntForSlith), player) <= 0)
            {
                return;
            }

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

            commanderBurcrif.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    commanderBurcrif.SayTo(player, "Hail! I hear tell of a rumor. Would you perhaps like 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 "hear it":
                        commanderBurcrif.SayTo(player, "Some talk of a red snake that will only come should he become [displeased].");
                        break;

                    case "displeased":
                        commanderBurcrif.SayTo(player, "I know not what might truly displease a snake, but I do know where he may be found. Are you [interested]?");
                        break;

                    // If the player offered his help, we send the quest dialog now!
                    case "interested":
                        player.Out.SendQuestSubscribeCommand(commanderBurcrif, QuestMgr.GetIDForQuestType(typeof(HuntForSlith)), "Do you accept the Hunt for Slith quest? \n[Levels 4-8]");
                        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;
                    }
                }
            }
        }