/* 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)
        {
            HeartOfSephucoth quest = player.IsDoingQuest(typeof(HeartOfSephucoth)) as HeartOfSephucoth;

            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();
            }
        }
        /* 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 TalkToEowylnAstos(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 (eowylnAstos.CanGiveQuest(typeof(HeartOfSephucoth), player) <= 0)
            {
                return;
            }

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

            eowylnAstos.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    eowylnAstos.SayTo(player, "Hail traveler! I may have a bit of [profitable information] for you!");
                    return;
                }
                else
                {
                    switch (quest.Step)
                    {
                    case 1:
                        eowylnAstos.SayTo(player, "You must seek out the monster Sephucoth! Slay it and bring me its heart!");
                        break;

                    case 2:
                        eowylnAstos.SayTo(player, "Hand to me the heart needed for this construct.");
                        break;

                    case 4:
                        eowylnAstos.SayTo(player, "Hand to me the polished bone needed for this construct.");
                        break;
                    }
                }
            }

            // 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 "profitable information":
                        eowylnAstos.SayTo(player, "I have learned how to [fashion a pendant] of immense value.");
                        break;

                    case "fashion a pendant":
                        eowylnAstos.SayTo(player, "I can do so, but I would require the heart from a [terrible beast].");
                        break;

                    // If the player offered his help, we send the quest dialog now!
                    case "terrible beast":
                        player.Out.SendQuestSubscribeCommand(eowylnAstos, QuestMgr.GetIDForQuestType(typeof(HeartOfSephucoth)), "Do you accept the \nHeart of Sephucoth quest? \n[Levels 7-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;
                    }
                }
            }
        }