コード例 #1
0
ファイル: LawrencesOil.cs プロジェクト: mywebext/DOL
        /* 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)
        {
            LawrencesOil quest = player.IsDoingQuest(typeof(LawrencesOil)) as LawrencesOil;

            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();
            }
        }
コード例 #2
0
ファイル: LawrencesOil.cs プロジェクト: mywebext/DOL
        /* 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 TalkToBrotherLawrence(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 (brotherLawrence.CanGiveQuest(typeof(LawrencesOil), player) <= 0)
            {
                return;
            }

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

            brotherLawrence.TurnTo(player);
            //Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    //Player is not doing the quest...
                    brotherLawrence.SayTo(player, "Greetings. My name is Brother Lawrence, and I'm the head healer here in Cotswold. It's my responsibility to keep the townspeople in good health and ward off the plague.  People come to me with everything from cuts and rashes to more [serious] ailments.");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        brotherLawrence.SayTo(player, "Welcome back, " + player.CharacterClass.Name + ". I've almost finished making my preparations for the demonstration. May I have the flask of oil?");
                    }
                    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 "serious":
                        brotherLawrence.SayTo(player, "Even in a small community like Cotswold, I'm almost always busy.  The Church teaches us to use prayers and magic to speed the natural healing process, but that requires a lot of energy. It's not uncommon for healers to be worn out at the end of the [day].");
                        break;

                    //If the player offered his help, we send the quest dialog now!
                    case "day":
                        brotherLawrence.SayTo(player, "It's exhausting work, but I believe I've found my calling.  I think I may have discovered a way to help deal with minor injuries and preserve the use of magic for more serious cases. Are you willing to help me prepare for a demonstration of my methods?");
                        player.Out.SendQuestSubscribeCommand(brotherLawrence, QuestMgr.GetIDForQuestType(typeof(LawrencesOil)), "Will you help Brother Lawrence gather \nthe oil he needs for his demonstration? \n[Levels 4-7]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "healing":
                        if (quest.Step == 1)
                        {
                            brotherLawrence.SayTo(player, "So far, I've used it as the base for a variety of salves and other treatments. It's proven very valuable in healing minor injuries, rashes and infections.  If we work quickly, I can have all my supplies ready in time for the [demonstration].");
                        }
                        break;

                    case "demonstration":
                        if (quest.Step == 1)
                        {
                            brotherLawrence.SayTo(player, "Here's a flask to store the oil in. Killing two of the river spritelings should provide enough oil for the demonstration and the next week's use. To find the spritelings, cross the bridge toward Camelot, but turn south before you get to the gates. Continue following the west bank of the river to the south, and you should see the spritelings before you come to the entrance to the Housing areas.");

                            GiveItem(brotherLawrence, player, lawrencesEmptyFlask);

                            quest.Step = 2;
                        }
                        break;

                    case "methods":
                        if (quest.Step == 5)
                        {
                            brotherLawrence.SayTo(player, "Here's a bit of copper for your trouble. I wish I could offer more, but times are tough right now. If you are ever in need of healing, please don't hesitate to visit me.");
                            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;
                    }
                }
            }
        }