예제 #1
0
        protected static void PlayerEnterThirdFieldArea(DOLEvent e, object sender, EventArgs args)
        {
            AreaEventArgs   aargs  = args as AreaEventArgs;
            GamePlayer      player = aargs.GameObject as GamePlayer;
            GreenerPastures quest  = player.IsDoingQuest(typeof(GreenerPastures)) as GreenerPastures;

            if (quest != null && quest.Step == 3)
            {
                player.Out.SendDialogBox(eDialogCode.SimpleWarning, 0x00, 0x00, 0x00, 0x00, eDialogType.Ok, true, "You've located the last field on Asma's \nMap. Turning over the map, you jot down \na few notes about your impressions. \nYour quest journal has been updated.");
                quest.Step = 4;
            }
        }
예제 #2
0
        protected static void PlayerLeftWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            GreenerPastures quest = player.IsDoingQuest(typeof(GreenerPastures)) as GreenerPastures;

            if (quest != null)
            {
                GameEventMgr.RemoveHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
                GameEventMgr.RemoveHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
            }
        }
예제 #3
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)
        {
            GreenerPastures quest = player.IsDoingQuest(typeof(GreenerPastures)) as GreenerPastures;

            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();
            }
        }
예제 #4
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(GreenerPastures), player) <= 0)
            {
                return;
            }

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

            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, "Good night. I wish I had time to talk, " + player.CharacterClass.Name + ", but I'm in the process of trying to find a new field to lease. I'd like to return to my life as a farmer. It's not that Cotswold isn't a nice village, but I feel more at home in the [field].");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        farmerAsma.SayTo(player, "Ah, you've returned. I hope you were able to find the fields without too much difficulty. I'm still learning my way around the area.  Which field would you recommend renting?");
                        SendMessage(player, "[I'd recommend the first field.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
                        SendMessage(player, "[The second field is best.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
                        SendMessage(player, "[You should rent the third one.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
                    }
                    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 "field":
                        farmerAsma.SayTo(player, "Ah, yes, Camelot Hills, where the wind comes sweepin' down the plain, and the wavin' barley can sure smell sweet when the wind comes right behind the rain. I have a lead on some fields that are up for lease, but I don't have time to [check them out].");
                        break;

                    case "check them out":
                        farmerAsma.SayTo(player, "Would you be willing to take a look at these fields for me and let me know if you think they are worth leasing?");
                        //If the player offered his help, we send the quest dialog now!
                        player.Out.SendQuestSubscribeCommand(farmerAsma, QuestMgr.GetIDForQuestType(typeof(GreenerPastures)), "Will you help Farmer Asma \nsearch for new farmland?\n[Level 2-5]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "them":
                        if (quest.Step < 4)
                        {
                            farmerAsma.SayTo(player, "When you're done taking a look at the fields, please return to me and let me know what you saw.");
                        }
                        break;

                    case "I'd recommend the first field.":
                    case "The second field is best.":
                    case "You should rent the third one.":
                        if (quest.Step == 4)
                        {
                            farmerAsma.SayTo(player, "Excellent. I'll speak to the owner tomorrow. May I have the map back?");
                        }
                        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;
                    }
                }
            }
        }