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

            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();
            }
        }
Ejemplo 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 TalkToFarmerAsma(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 (farmerAsma.CanGiveQuest(typeof(RevengeTheOtherWhiteMeat), player) <= 0)
            {
                return;
            }

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

            farmerAsma.TurnTo(player);
            //Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    //Player is not doing the quest...
                    farmerAsma.SayTo(player, "Greetings, " + player.CharacterClass.Name + ".  You wouldn't believe how expensive it is to lease land here in the Camelot Hills area. Just the other day, I went to check out some fields, and the asking price is just too high.  Things were better in the Black [Mountains].");
                    return;
                }
                else
                {
                    if (quest.Step == 3)
                    {
                        farmerAsma.SayTo(player, "Did you really kill [Wilbur]?");
                    }
                    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 "Mountains":
                        farmerAsma.SayTo(player, "It seemed like an ideal place for a farm.  It's shame those pig herders had to select it as the site for their new 'sport.' I still get angry just thinking about it. I mean, who do they think they are, tossing me out [like that]?.");
                        break;

                    case "like that":
                        farmerAsma.SayTo(player, "I wish I could give them a taste of their own medicine. If someone took something important away from them... Hey, that gives me an idea! Are you willing to help me get a little revenge on those pig herders?");
                        //If the player offered his help, we send the quest dialog now!
                        player.Out.SendQuestSubscribeCommand(farmerAsma, QuestMgr.GetIDForQuestType(typeof(RevengeTheOtherWhiteMeat)), "Will you help Farmer Asma get \nrevenge on the pig herders?\n[Level 5-8]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "mind":
                        if (quest.Step == 1)
                        {
                            farmerAsma.SayTo(player, "Just as a farmer's land is the source of her livelihood, the pig herders' prize pig must be the center of their game. If a little accident should befall their precious pig, they will know exactly how I felt when my farm was [taken away].");
                        }
                        break;

                    case "taken away":
                        if (quest.Step == 1)
                        {
                            farmerAsma.SayTo(player, "When the game isn't in session, they keep the pig in an area adjacent to the field.  To get there, travel through the city of Camelot and exit through the North Gate, near the main Church building. After exiting the city, you'll need to travel [west].");
                        }
                        break;

                    case "west":
                        if (quest.Step == 1)
                        {
                            farmerAsma.SayTo(player, "You'll see Vetusta Abbey in the distance. Keep running toward it, and you'll see a field and some stables. The pigs should be in that area. The pig you're looking for is one they've nicknamed Wilbur.");
                            quest.Step = 2;
                        }
                        break;

                    case "Wilbur":
                        if (quest.Step == 3)
                        {
                            SendMessage(player, "You tell Farmer Asma that you succeeded in killing Wilbur, but that one of the pig herders discovered you and chased you away.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
                            farmerAsma.SayTo(player, "They saw you? Oh, no...what have I done? I feel terrible, Gwonn.  I shouldn't have asked you to kill Wilbur, but we can't undo what's been done.  If the guards come looking for you, I'll tell them that I'm the one who did [the deed].");
                        }
                        break;

                    case "the deed":
                        if (quest.Step == 3)
                        {
                            farmerAsma.SayTo(player, "You don't think they'll come after me, do you? I mean, pigs die all the time. We make food out of them, and they turn into pork and bacon and all kinds of good [things]...");
                        }
                        break;

                    case "things":
                        if (quest.Step == 3)
                        {
                            SendMessage(player, "Farmer Asma begins to ramble and soon becomes incoherent. When she realizes what's happened, she takes a deep breath and tries to compose herself.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
                            farmerAsma.SayTo(player, "Oh, my. I'm so sorry, I just...well, I don't know what to do. I need a break from farming and pigs, and rural life. Maybe I'll take up something completely different...like brewing. Yes, brewing! Please take these coins and never speak of this again.");
                            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;
                    }
                }
            }
        }