Exemple #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)
        {
            ArrowsForYettaFletcher quest = player.IsDoingQuest(typeof(ArrowsForYettaFletcher)) as ArrowsForYettaFletcher;

            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();
            }
        }
Exemple #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 TalkToYettaFletcher(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 (yettaFletcher.CanGiveQuest(typeof(ArrowsForYettaFletcher), player) <= 0)
            {
                return;
            }

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

            yettaFletcher.TurnTo(player);
            //Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    //Player is not doing the quest...
                    yettaFletcher.SayTo(player, "Greetings to you, young " + player.CharacterClass.Name + ". I was wondering if I might have a few minutes of your time. I have [a matter] I need some help with. Unfortunately I have been unable to find anyone to help me so far.");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        yettaFletcher.SayTo(player, "Welcome back, young " + player.Name + ". Please give me one bundle of decaying zombie legs.");
                        quest.Step = 5;
                    }
                    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 "a matter":
                        yettaFletcher.SayTo(player, "Until a few years ago, I was a scout for the Defenders of Albion. I spent my time out in the Frontiers, looking for invaders from Midgard and Hibernia. Because of my skills, I was chosen to lead a group of Defenders in an attack on Dun nGed Watchtower. While the attack was a success and we took the tower, I [barely survived].");
                        break;

                    case "barely survived":
                        yettaFletcher.SayTo(player, "A stray arrow from a Hibernian ranger just missed my heart. I was brought back to Castle Sauvage where I was healed enough to travel here to Cotswold Village. Once I recovered, I asked to leave the Defenders. My superiors agreed to let me go, but asked if I would continue to help them in [any way] I could.");
                        break;

                    case "any way":
                        yettaFletcher.SayTo(player, "They were in need of good arrows for their scouts, since the scouts on in the Frontiers rarely have time to make their own arrows. I agreed and the Defenders set up a nice little shop for me here. Between them and the residents of Cotswold, I barely have time to keep up with their demands. That’s where [you can] help me.");
                        break;

                    case "you can":
                        yettaFletcher.SayTo(player, "I am running low on supplies for making my special arrows for the Defenders. They are slightly different than the ones I sell, so I can’t just get the supplies anywhere. If you have some time, I would be willing [to pay you] to retrieve some supplies for me. Are you interested?");
                        break;

                    //If the player offered his help, we send the quest dialog now!
                    case "to pay you":
                        player.Out.SendQuestSubscribeCommand(yettaFletcher, QuestMgr.GetIDForQuestType(typeof(ArrowsForYettaFletcher)), "Will you help Yetta Fletcher \nobtain the supplies she needs? \n[Levels 4-7]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "shafts":
                        if (quest.Step == 1)
                        {
                            yettaFletcher.SayTo(player, "I have tried many different things for the shafts in my attempt to make special arrows for the Defenders. Surprisingly, the leg bones of decayed zombies seem to make lightweight but strong shafts for arrows. If you can bring me two bundles of [decayed zombie] legs, you will be helping me out quite a bit.");
                        }
                        break;

                    case "decayed zombie":
                        if (quest.Step == 1)
                        {
                            yettaFletcher.SayTo(player, "To find the decaying zombies, leave this building and head south to the river. Follow the bank of the river south, taking care to avoid the river sprites. There is a graveyard along the river, south of here. You’ll find the decayed zombies there as well as on the hill northeast of the graveyard. Return to me when you have two bundles of decayed zombie legs, please.");
                            quest.Step = 2;
                        }
                        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;
                    }
                }
            }
        }