protected static void PlayerLeftWorld(DOLEvent e, object sender, EventArgs args) { GamePlayer player = sender as GamePlayer; if (player == null) { return; } IreFairyIre quest = player.IsDoingQuest(typeof(IreFairyIre)) as IreFairyIre; if (quest != null) { quest.deleteDragonflyHatchling(); } }
/* 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 TalkToColm(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 (masterFrederick.CanGiveQuest(typeof(IreFairyIre), player) <= 0) { return; } // We also check if the player is already doing the quest IreFairyIre quest = player.IsDoingQuest(typeof(IreFairyIre)) as IreFairyIre; colm.TurnTo(player); // Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest != null) { if (quest.Step == 5) { colm.SayTo(player, "Oh thank you Vinde for bringing back the baby. I know his parents will be relieved he's returned safe and sound. How did you manage to get him back? Did it use anything? A chain? A bridle?"); if (quest.dragonflyHatchling != null) { quest.dragonflyHatchling.StopFollowing(); quest.deleteDragonflyHatchling(); } } else if (quest.Step == 6) { colm.SayTo(player, "I know this isn't much, but I used to do a bit of adventuring in my time. I'm sure you'll be able to use this. Now, I think you should return to Master Frederick and let him or her know what's going on."); if (player.HasAbilityToUseItem(recruitsVest)) { GiveItem(colm, player, recruitsVest); } else { GiveItem(colm, player, recruitsQuiltedVest); } quest.Step = 7; } 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 "appreciation": colm.SayTo(player, "I know this isn't much, but I used to do a bit of adventuring in my time. I'm sure you'll be able to use this. Now, I think you should return to your trainer and let him or her know what's going on."); if (quest.Step == 6) { if (player.HasAbilityToUseItem(recruitsVest)) { GiveItem(colm, player, recruitsVest); } else { GiveItem(colm, player, recruitsQuiltedVest); } quest.Step = 7; } break; } } } }