Exemplo n.º 1
0
        protected static void PlayerEnterWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            if (quest != null)
            {
                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));

                if (quest.Step == 3 && (!ladyHinda.IsAlive || ladyHinda.ObjectState != GameObject.eObjectState.Active))
                {
                    ladyHinda.X       = hindaEnd.X;
                    ladyHinda.Y       = hindaEnd.Y;
                    ladyHinda.Z       = hindaEnd.Z;
                    ladyHinda.Heading = hindaEnd.Heading;
                    ladyHinda.AddToWorld();
                }
            }
        }
Exemplo n.º 2
0
        protected static void PlayerLeftWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            if (quest != null)
            {
                GameEventMgr.RemoveHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
                GameEventMgr.RemoveHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));

                // remorph player back...
                if (player.Model == ladyHinda.Model)
                {
                    GameClient client = player.Client;
                    player.Model = (ushort)client.Account.Characters[client.ActiveCharIndex].CreationModel;
                    SendSystemMessage(player, "You change back to your normal form!");
                }

                if (quest.Step == 3)
                {
                    if (ladyHinda != null)
                    {
                        ladyHinda.Delete();
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected static void TalkToLadyHinda(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 (dalikor.CanGiveQuest(typeof(TraitorInMularn), player) <= 0)
            {
                return;
            }

            // We also check if the player is already doing the quest
            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            ladyHinda.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest != null && quest.Step >= 2)
                {
                    ladyHinda.SayTo(player, "Ah, our loyal ally, you have made it to our meeting. I was afraid you would not show. You have proven me wrong and strengthened my faith in your servitude to us. My time here is short, so I will make this [brief].");
                    return;
                }

                return;
            }
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                if (quest != null)
                {
                    // Do some small talk :)
                    switch (wArgs.Text)
                    {
                    case "brief":
                        ladyHinda.SayTo(player, "I have with me the plans for tomorrow night. We will need your help in being prepared. Your instructions are written on the parchment. Take it and memorize your duties, lest our Queen be angered. I bid you farewell for now.");
                        if (quest.Step == 3)
                        {
                            GiveItem(ladyHinda, player, askefruerPlans);

                            new RegionTimer(ladyHinda, new RegionTimerCallback(quest.CastLadyFelin), 10000);
                            new RegionTimer(ladyHinda, new RegionTimerCallback(quest.RemoveLadyFelin), 12000);

                            quest.Step = 4;
                        }

                        break;
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected static void PlayerUseSlot(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

            // player already morphed...
            if (player.Model == ladyHinda.Model)
            {
                return;
            }

            TraitorInMularn quest = (TraitorInMularn)player.IsDoingQuest(typeof(TraitorInMularn));

            if (quest == null)
            {
                return;
            }

            if (quest.Step == 2 || quest.Step == 3)
            {
                UseSlotEventArgs uArgs = (UseSlotEventArgs)args;

                InventoryItem item = player.Inventory.GetItem((eInventorySlot)uArgs.Slot);
                if (item != null && item.Id_nb == necklaceOfDoppelganger.Id_nb)
                {
                    if (player.IsWithinRadius(hindaEnd, 2500))
                    {
                        foreach (GamePlayer visPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                        {
                            visPlayer.Out.SendSpellCastAnimation(player, 1, 20);
                        }

                        player.Model = ladyHinda.Model;                                                  // morph to fairie
                        SendSystemMessage(player, "You change into a new form!");
                        new RegionTimer(player, new RegionTimerCallback(quest.ResetPlayerModel), 60000); // call after 10 minutes

                        if (!ladyHinda.IsAlive || ladyHinda.ObjectState != GameObject.eObjectState.Active)
                        {
                            ladyHinda.X       = hindaStart.X;
                            ladyHinda.Y       = hindaStart.Y;
                            ladyHinda.Z       = hindaStart.Z;
                            ladyHinda.Heading = hindaStart.Heading;
                            ladyHinda.AddToWorld();
                            ladyHinda.WalkTo(hindaEnd.X, hindaEnd.Y, hindaEnd.Z, ladyHinda.MaxSpeed);
                        }

                        quest.Step = 3;
                    }
                }
            }
        }
Exemplo n.º 5
0
        /* 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)
        {
            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            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();
            }
        }
Exemplo n.º 6
0
        /* 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 CheckPlayerAcceptQuest(GamePlayer player, byte response)
        {
            // We recheck the qualification, because we don't talk to players
            // who are not doing the quest
            if (dalikor.CanGiveQuest(typeof(TraitorInMularn), player) <= 0)
            {
                return;
            }

            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            if (quest != null)
            {
                return;
            }

            if (response == 0x00)
            {
                SendReply(player, "Oh well, if you change your mind, please come back!");
            }
            else
            {
                // Check if we can add the quest!
                if (!dalikor.GiveQuest(typeof(TraitorInMularn), player, 1))
                {
                    return;
                }

                dalikor.SayTo(player, "Thank you recruit. Now, listen. The traitor has a necklace that allows him to change into the shape of an Askefruer. He says it makes them more comfortable with him. I [have] the necklace with me.");

                // give necklace
                GiveItem(dalikor, player, necklaceOfDoppelganger);

                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
Exemplo n.º 7
0
        /* 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 TalkToDalikor(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 (dalikor.CanGiveQuest(typeof(TraitorInMularn), player) <= 0)
            {
                return;
            }

            // We also check if the player is already doing the quest
            TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn;

            dalikor.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    dalikor.SayTo(player, "Recruit Eeinken. It seems as though we have caught a traitor within the walls of Mularn! A man by the name of Njarmir has been conspiring with the Askefruer. He has recently told us of a [meeting] he was to have with them.");
                    return;
                }
                else
                {
                    switch (quest.Step)
                    {
                    case 1:
                        dalikor.SayTo(player, "Thank you recruit. Now, listen. The traitor has a necklace that allows him to change into the shape of an Askefruer. He says it makes them more comfortable with him. I [have] the necklace with me.");
                        break;

                    case 2:
                    case 3:
                        dalikor.SayTo(player, "The traitor described the location as a place between to the north-northeast from the griffin handler, near some small pine trees. I'm sorry there isn't more to go on, but that is all I have. Hurry now Eeinken.");
                        break;

                    case 4:
                        dalikor.SayTo(player, "Welcome back recruit. Have you met with success? Were you able to secure any information from the Askefruer?");
                        break;

                    case 5:
                        dalikor.SayTo(player, "Ah! The plans of the Askefruer. Ah, but they are in a language I do not understand. I will have to take this to the elders of Mularn for further study. Before I do that, though, I have [something] here for you.");
                        break;
                    }

                    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 "meeting":
                        dalikor.SayTo(player, "He was to get further instructions from the Askefruer about his mission to help their queen. Now that he is in custody, we need to be sure we do not tip our hand to the Askefruer too quickly. I am asking you to go in his [stead].");
                        break;

                    case "stead":
                        dalikor.SayTo(player, "Will you do this for Mularn Eeinken? Will you go in this traitor's place and get the [information] we need to stop the Askefruer from continuing to make trouble for us?");
                        break;

                    // If the player offered his "help", we send the quest dialog now!
                    case "information":
                        player.Out.SendQuestSubscribeCommand(dalikor, QuestMgr.GetIDForQuestType(typeof(TraitorInMularn)), "Will you help Mularn by taking on this vital mission?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "have":
                        dalikor.SayTo(player, "The traitor described the location as a place between to the north-northeast from the griffin handler, near some small pine trees. I'm sorry there isn't more to go on, but that is all I have. Hurry now Eeinken.");
                        if (quest.Step == 1)
                        {
                            quest.Step = 2;
                        }

                        break;

                    // step 5
                    case "something":
                        dalikor.SayTo(player, "You did such an excellent job going to the meeting and posing as an Askefruer that I have this for you. It isn't much, but it will help to protect you from the elements. Now, if you'll excuse me, I must be off to speak with the elders.");
                        if (quest.Step == 5)
                        {
                            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;
                    }
                }
            }
        }