/* 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) { NyrasPackage quest = player.IsDoingQuest(typeof(NyrasPackage)) as NyrasPackage; 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(); } }
protected static void TalkToTaran(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; } //We also check if the player is already doing the quest NyrasPackage quest = player.IsDoingQuest(typeof(NyrasPackage)) as NyrasPackage; Taran.TurnTo(player); //Did the player rightclick on Sir Quait? if (e == GameObjectEvent.Interact) { if (player.Inventory.GetFirstItemByID(SmallBoxforTaran.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null) { Taran.SayTo(player, "Welcome friend. What can I do for you today?"); } else if (quest.Step == 2) { Taran.SayTo(player, "Ah, the box I've been waiting for from Nyra. Thank you friend. If you'll wait just one second, I have a letter I'd like for you to take back to [her]."); } return; } else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; switch (wArgs.Text) { case "her": Taran.SayTo(player, "Here you are, and a few silvers for your troubles. Good luck friend, and than you for the delivery."); quest.Step = 3; GiveItem(player, LettertoNyra, false); player.GainExperience(GameLiving.eXPSource.Quest, 10, true); break; } } }
protected static void TalkToNyra(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 (Nyra.CanGiveQuest(typeof(NyrasPackage), player) <= 0) { return; } //We also check if the player is already doing the quest NyrasPackage quest = player.IsDoingQuest(typeof(NyrasPackage)) as NyrasPackage; Nyra.TurnTo(player); //Did the player rightclick on Sir Quait? if (e == GameObjectEvent.Interact) { //We check if the player is already doing the quest if (quest != null) { //If the player is already doing the quest, we ask if he found the fur! if (player.Inventory.GetFirstItemByID(SmallBoxforTaran.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null) { Nyra.SayTo(player, "Welcome back friend! I take it you didn't have any problems finding him? Did he have anything to say?"); } else if (player.Inventory.GetFirstItemByID(LettertoNyra.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null) { Nyra.SayTo(player, "Welcome back friend! I take it you didn't have any problems finding him? Did he have anything to say?"); } else if (quest.Step == 4) { Nyra.SayTo(player, "Excellent! I was hoping he would like it. It was a small box of oranges. I know he loves them, and my parents have a small orange tree grove. Well, I think it's time I gave you [something]."); } return; } else { Nyra.SayTo(player, "Hi there! You seem new to Mag Mell. I guess it's lucky that you ran into me! I have something I need done, and you look like the person to do this [errand] for me!"); 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 "errand": Nyra.SayTo(player, "Oh yes. See, I have something that needs to be delivered to Taran the Smith over by Tir na Nog. Do you think you'd be [able] to do that for me?"); break; case "able": player.Out.SendQuestSubscribeCommand(Nyra, QuestMgr.GetIDForQuestType(typeof(NyrasPackage)), "Will you deliver Nyra's package to Taran the smith? [Level 1]"); 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; case "something": Nyra.SayTo(player, "Here you are. This is a ring I used a very long time ago, but I have no need for it now. I think it will suit you better. Thank you again my friend. Good journeys to you."); quest.FinishQuest(); break; } } } }