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

        protected static void TalkToMasterGerol(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 (masterGerol.CanGiveQuest(typeof(BoarStew), player) <= 0)
            {
                return;
            }

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

            masterGerol.TurnTo(player);
            //Did the player rightclick on masterGerol?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    //Player hasn't the quest:
                    masterGerol.SayTo(player, "Good day, my friend. I am Gerol, Master and Healer of horses. The guards stop here frequently for my services. I'm no miracle worker, but I suppose if you're hurt, I could patch you up a bit, as well.");
                    masterGerol.SayTo(player, "Goodness, more new faces in town. Are you here to help me with my wonderful [stew]?");
                    return;
                }
            }
            // The player whispered to Sir Quait (clicked on the text inside the [])
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;

                //We also check if the player is already doing the quest
                if (quest == null)
                {
                    switch (wArgs.Text)
                    {
                    case "stew":
                        masterGerol.SayTo(player, "Oh yes! It is my speciality and one of the key components to helping people out when they are sick. Everyone knows that my wonderful stew brings along a speedy recovery. I am running low on the main [ingredient], do you think you could help me out?");
                        break;

                    case "ingredient":
                        player.Out.SendQuestSubscribeCommand(masterGerol, QuestMgr.GetIDForQuestType(typeof(BoarStew)), "Will you help Master Gerol? [Levels 19-22]");
                        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;
                    }
                }
            }
        }
Пример #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)
        {
            BoarStew quest = player.IsDoingQuest(typeof(BoarStew)) as BoarStew;

            if (quest == null)
            {
                return;
            }

            if (response == 0x00)
            {
                SendSystemMessage(player, "Good, now go out there and finish your work!");
            }
            else
            {
                SendSystemMessage(player, "Aborting Quest " + questTitle + ". You can start over again if you want.");
                quest.AbortQuest();
            }
        }