/* 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 TalkToBaeth(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 (npcBaeth.CanGiveQuest(typeof(WingsOfTheIsleHibernia), player) <= 0) { return; } //We also check if the player is already doing the quest WingsOfTheIsleHibernia quest = player.IsDoingQuest(typeof(WingsOfTheIsleHibernia)) as WingsOfTheIsleHibernia; if (quest != null) { return; } npcBaeth.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { quest = new WingsOfTheIsleHibernia(); quest.QuestGiver = npcBaeth; quest.OfferQuest(player); } } }
/* 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) { WingsOfTheIsleHibernia quest = player.IsDoingQuest(typeof(WingsOfTheIsleHibernia)) as WingsOfTheIsleHibernia; if (quest == null) { return; } if (response != 0x00) { 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 TalkToBaeth(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(npcBaeth.CanGiveQuest(typeof(WingsOfTheIsleHibernia), player) <= 0) return; //We also check if the player is already doing the quest WingsOfTheIsleHibernia quest = player.IsDoingQuest(typeof(WingsOfTheIsleHibernia)) as WingsOfTheIsleHibernia; if (quest != null) return; npcBaeth.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { quest = new WingsOfTheIsleHibernia(); quest.QuestGiver = npcBaeth; quest.OfferQuest(player); } } }
protected static void TalkToJessica(DOLEvent e, object sender, EventArgs args) { GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } WingsOfTheIsleHibernia quest = player.IsDoingQuest(typeof(WingsOfTheIsleHibernia)) as WingsOfTheIsleHibernia; if (quest == null) { return; } if (e == GameObjectEvent.Interact) { if (quest.Step == 1) { npcJessica.SayTo(player, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Hib.WingsOfTheIsle.Jessica1")); } else if (quest.Step == 3) // step 2 is the /search and is advanced when item is found { foreach (QuestGoal goal in quest.Goals) { if (goal.Id == STEP3_GOAL_ID && goal.IsAchieved == false) { RemoveItem(player, reedFlute, false); // Jessica will display the conclusion text in the quest dialog quest.QuestGiver = npcJessica; quest.ChooseRewards(player); } } } } else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (wArgs.Text == "island") { npcJessica.SayTo(player, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Hib.WingsOfTheIsle.Jessica2")); } else if (wArgs.Text == "lost") { foreach (QuestGoal goal in quest.Goals) { if (goal.Id == STEP1_GOAL_ID && goal.IsAchieved == false) { goal.Advance(); quest.AddGoal(STEP2_GOAL_ID, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Hib.WingsOfTheIsle.Goal2", player.Name), QuestGoal.GoalType.ScoutMission, 1, null); npcJessica.SayTo(player, LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Hib.WingsOfTheIsle.Jessica3")); quest.Step = 2; break; } } } } }