/* 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) { AFewRepairs quest = player.IsDoingQuest(typeof(AFewRepairs)) as AFewRepairs; 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(); } }
/* This is the method we declared as callback for the hooks we set to * patrickYarley. It will be called whenever a player right clicks on Sir Quait * or when he whispers something to him. */ protected static void TalkToPatrickYarley(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; } AFewRepairs quest = player.IsDoingQuest(typeof(AFewRepairs)) as AFewRepairs; if (quest == null) { return; } patrickYarley.TurnTo(player); // Did the player rightclick on patrickYarley? if (e == GameObjectEvent.Interact) { // If the player is already doing the quest, we look if he has the items: if (quest.Step == 4) { patrickYarley.SayTo(player, "That was quick. Do you have the wood that my brother requested? Please give it to me now."); } if (quest.Step == 5) { patrickYarley.SayTo(player, "Were you able to get any more wood?"); } if (quest.Step == 6) { patrickYarley.SayTo(player, "That is more than enough wood. There is one other thing I will need to complete this project. Would you be able to help out with this [last errand]?"); } if ((quest.Step == 7) || (quest.Step == 8)) { patrickYarley.SayTo(player, "Do you have the boogey teeth?"); } return; } // The player whispered to Sir Quait (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; switch (wArgs.Text) { case "last errand": if (quest.Step == 6) { patrickYarley.SayTo(player, "The last thing I need is something to hold the boards in place. You may find this ironic but the best place to find these spikes is from the very creatures we are trying to keep out with this fence. It turns out that their long teeth make excellent nails for holding the elder wood in place. If you can slay one of these moor boogeys then it should provide enough for the job at hand. Return to me with these teeth and your task will be [complete]."); } break; case "complete": if (quest.Step == 6) { patrickYarley.SayTo(player, "You may find the moor boogeys roaming the hill to the east."); quest.Step = 7; } break; } } }
/* This is the method we declared as callback for the hooks we set to * briceYarley. It will be called whenever a player right clicks on Sir Quait * or when he whispers something to him. */ protected static void TalkToBriceYarley(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 (briceYarley.CanGiveQuest(typeof(AFewRepairs), player) <= 0) { return; } // We also check if the player is already doing the quest AFewRepairs quest = player.IsDoingQuest(typeof(AFewRepairs)) as AFewRepairs; briceYarley.TurnTo(player); // Did the player rightclick on briceYarley? 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 look if he has the items: if (quest.Step == 1) { briceYarley.SayTo(player, "There are some [elder beech] creatures to the north just inside the tree line beyond the fallen tower. If you cut down a few of them they should yield enough wood for the project."); } return; } else { // Player hasn't the quest: briceYarley.SayTo(player, "Welcome to Cornwall, " + player.CharacterClass.Name + ". My family has a bit of a [problem] and we would be grateful if you could lend a hand."); 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 "problem": briceYarley.SayTo(player, "We Yarleys raise these giant rooters which we bring to markets all across Albion. Perhaps you have tried some of our sausages at Ye Mug in Camelot? Well anyway we do a pretty good business here and the hours aren't too bad. It is a satisfying life but one that does not leave much time for [mastering the arts] of magic or swordplay."); break; case "mastering the arts": briceYarley.SayTo(player, "Raising your livestock a stone's throw from a dungeon of undead and other unsavory critters has its drawbacks as you might imagine. We are constantly on the lookout for [moor boogeys] that seem to have a genuine dislike for our rooters. Now our animals can hold their own in a fight, but we have enough to do around here without having to heal the hogs every other day."); break; case "moor boogeys": briceYarley.SayTo(player, "We have tried to kill off these pests but there always seems to be more of them. We [maintain this fence] to keep rooters in and the boogeys out."); break; case "maintain this fence": briceYarley.SayTo(player, "This old barrier is in need of some repair but we are a bit low on lumber at the moment. Would you be interested in [gathering] some supplies for our fence?"); break; // If the player offered his "help", we send the quest dialog now! case "gathering": player.Out.SendQuestSubscribeCommand(briceYarley, QuestMgr.GetIDForQuestType(typeof(AFewRepairs)), "Will you help the Yarleys with a few repairs? [Levels 35-37]"); 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 "elder beech": if (quest.Step == 1) { briceYarley.SayTo(player, "Bring the lumber to my brother, Patrick. You will find him along the fence to the east. I will make sure he knows to expect your return."); quest.Step = 2; } break; } } } }