/* This is the method we declared as callback for the hooks we set to * Sir Quait. It will be called whenever a player right clicks on Sir Quait * 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; } //We also check if the player is already doing the quest AgainstTheGrain quest = player.IsDoingQuest(typeof(AgainstTheGrain)) as AgainstTheGrain; farmerAsma.TurnTo(player); if (e == GameObjectEvent.Interact) { if (quest != null && quest.Step == 1) { //Player is doing the quest... farmerAsma.SayTo(player, "Hello, adventurer. Pardon me if I do not seem enthusiastic about meeting you, but a terrible thing has just [happened]."); return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest != null) { switch (wArgs.Text) { case "happened": SendMessage(player, "You start to ask Farmer Asma if she's the person Minstrel Laridia was talking about, the farmer continues speaking before you can organize your thoughts.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); farmerAsma.SayTo(player, "You see, I used to lease land close to Vetusta Abbey, where I raised barley. Being a farmer never made me wealthy, but it was satisfying. I never had any problems with the Church or my neighbors, so I was shocked when the Abbey asked me to [leave]."); break; case "leave": farmerAsma.SayTo(player, "They said they needed the land for something else, but they never mentioned the details. I packed up and left, coming to Cotswold in search of a new plot to lease. Days later, I learned the Church had given the land to people promoting a new [sport]."); break; case "sport": farmerAsma.SayTo(player, "A game, can you believe it? I was curious, so I attended a match. When I could see through the crowds of garishly-dressed gentry, it looked to me like a bunch of men chasing pigs around with sticks! I don't understand, but it's quite [popular]."); break; case "popular": farmerAsma.SayTo(player, "I can remember playing something similar in my childhood on the farm, but suddenly, it's become a bona fide sport. I just...well, I don't understand why they had to take away my farm for a silly [diversion]."); player.Out.SendEmoteAnimation(farmerAsma, eEmote.MidgardFrenzy); break; case "diversion": farmerAsma.SayTo(player, "I'm sure it will fade from popularity within a few months. All fads do, and then where will I be? Most likey, I'll still be trying to reestablish myself elsewhere. Well, I need to get back to what I was doing. Thank you for lending a sympathetic ear."); quest.Step = 2; break; } } } }
/* 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) { AgainstTheGrain quest = player.IsDoingQuest(typeof(AgainstTheGrain)) as AgainstTheGrain; 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(); } }
/* 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 TalkToLaridiaTheMinstrel(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 (laridiaTheMinstrel.CanGiveQuest(typeof(AgainstTheGrain), player) <= 0) { return; } //We also check if the player is already doing the quest AgainstTheGrain quest = player.IsDoingQuest(typeof(AgainstTheGrain)) as AgainstTheGrain; laridiaTheMinstrel.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... laridiaTheMinstrel.SayTo(player, "Good night, friend. Have you spent much time traveling our [realm]?"); return; } else { if (quest.Step == 2) { SendMessage(player, "You tell Laridia that the rumor of the displaced farmer is true, and that Farmer Asma is searching for a way to reestablish herself.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); laridiaTheMinstrel.SayTo(player, "I had a feeling this rumor might turn out to be true. It angers me that Farmer Asma didn't enter into consideration when the pig herders were looking for a field. We'll have to find a way to help her get back on her [feet]."); } 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 "realm": laridiaTheMinstrel.SayTo(player, "If you haven't, then you should take an excursion. I've never been the kind of person that can spend her entire life in one place. I relish change and new experiences! If I had more time, I'd share my stories with you, but I'm [occupied] at the moment."); break; case "occupied": laridiaTheMinstrel.SayTo(player, "I heard a disturbing rumor yesterday. It seems that a farmer with a longstanding lease near Vetusta Abbey was recently evicted from the land. Fields where she used to grow barley are now serving as a site for the debut of a new [sport]."); break; case "sport": laridiaTheMinstrel.SayTo(player, "Yes, it seems that 'pig herding' is taking Albion by storm. I'm always interested in new amusements, but I don't think that it's right for these things to cost people their livelihoods. Do you have time to investigate this rumor for me?"); //If the player offered his help, we send the quest dialog now! player.Out.SendQuestSubscribeCommand(laridiaTheMinstrel, QuestMgr.GetIDForQuestType(typeof(AgainstTheGrain)), "Will you investigate Minstrel\nLaridia's story?\n[Level 1-4]"); break; } } else { switch (wArgs.Text) { case "feet": if (quest.Step == 2) { laridiaTheMinstrel.SayTo(player, "I'm going to see if I can think of a way to help Farmer Asma. You might want to check back with her later, too, as she may have her own ideas. In the meantime, here's a bit of coin for your help."); 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; } } } }