Пример #1
0
        protected static void PlayerEnterWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

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

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

                if (quest.Step == 3 && (!ladyLegada.IsAlive || ladyLegada.ObjectState != GameObject.eObjectState.Active))
                {
                    ladyLegada.X       = legadaEnd.X;
                    ladyLegada.Y       = legadaEnd.Y;
                    ladyLegada.Z       = legadaEnd.Z;
                    ladyLegada.Heading = legadaEnd.Heading;
                    ladyLegada.AddToWorld();
                }
            }
        }
Пример #2
0
        protected static void PlayerLeftWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

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

            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 == ladyLegada.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 (ladyLegada != null)
                    {
                        ladyLegada.Delete();
                    }
                }
            }
        }
Пример #3
0
        protected static void TalkToLadyLegada(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 (addrir.CanGiveQuest(typeof(TraitorInMagMell), player) <= 0)
            {
                return;
            }

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

            ladyLegada.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest != null && quest.Step >= 2)
                {
                    ladyLegada.SayTo(player, "Greetings Ally. It is good to see you here. My time 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":
                        ladyLegada.SayTo(player, "Our Queen has laid out the plans for Mag Mell and is eager to have your assistance. Here are the plans, memorize your part. Do not fail us in this, lest dire circumstances befall you. Till we meet again.");
                        if (quest.Step == 3)
                        {
                            GiveItem(ladyLegada, player, sluaghPlans);

                            new RegionTimer(ladyLegada, new RegionTimerCallback(quest.CastLadyLegada), 10000);
                            new RegionTimer(ladyLegada, new RegionTimerCallback(quest.RemoveLadyLegada), 12000);

                            quest.Step = 4;
                        }

                        break;
                    }
                }
            }
        }
Пример #4
0
        protected static void PlayerUseSlot(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

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

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

            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(legadaEnd, 2500))
                    {
                        foreach (GamePlayer visPlayer in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                        {
                            visPlayer.Out.SendSpellCastAnimation(player, 1, 20);
                        }

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

                        if (!ladyLegada.IsAlive || ladyLegada.ObjectState != GameObject.eObjectState.Active)
                        {
                            ladyLegada.X       = legadaStart.X;
                            ladyLegada.Y       = legadaStart.Y;
                            ladyLegada.Z       = legadaStart.Z;
                            ladyLegada.Heading = legadaStart.Heading;
                            ladyLegada.AddToWorld();
                            ladyLegada.WalkTo(legadaEnd.X, legadaEnd.Y, legadaEnd.Z, ladyLegada.MaxSpeed);
                        }

                        quest.Step = 3;
                    }
                }
            }
        }
Пример #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)
        {
            TraitorInMagMell quest = player.IsDoingQuest(typeof(TraitorInMagMell)) as TraitorInMagMell;

            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();
            }
        }
Пример #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 (addrir.CanGiveQuest(typeof(TraitorInMagMell), player) <= 0)
            {
                return;
            }

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

            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 (!addrir.GiveQuest(typeof(TraitorInMagMell), player, 1))
                {
                    return;
                }

                addrir.SayTo(player, "Excellent! Now listen, Samyr was to meet with the Sluagh today! He gave us a [necklace] that helped him transform into a Sluagh for a small amount of time.");

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

                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
Пример #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 TalkToAddrir(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 (addrir.CanGiveQuest(typeof(TraitorInMagMell), player) <= 0)
            {
                return;
            }

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

            addrir.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    addrir.SayTo(player, "Lirone, this Sluagh problem has its roots deeper into Mag Mell than I originally thought! We have apprehended a [traitor]!");
                    return;
                }
                else
                {
                    switch (quest.Step)
                    {
                    case 1:
                        addrir.SayTo(player, "Go west from Mag Mell towards Tir na Nog. You will come to the base of the foot hills. Head southwest-south along the base of the hills. The necklace will alert you when you are in the correct place. Hurry now. Time is wasting.");
                        break;

                    case 4:
                        addrir.SayTo(player, "Vinde, you've returned. I'm sure you were successful with your mission. Come come my friend. Hand over the information.");
                        break;

                    case 5:
                        addrir.SayTo(player, "For you, a nice pair of boots to help keep your feet dry and clean. Thank you again for the help you've given me in this matter Lirone. I shall report this to Fagan at once.");
                        if (quest.Step == 5)
                        {
                            quest.FinishQuest();
                        }

                        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 "ire fairies": SendReply(player,"I managed to have a little chat with some of the guardsmen, and it turns out there is a [traitor] here in Cotswold!"); break;
                    case "traitor":
                        addrir.SayTo(player, "Aye Lirone. I could scarcely believe my ears when I heard the news. A man by the name of Samyr has been in [league] with the Sluagh for a while now.");
                        break;

                    case "league":
                        addrir.SayTo(player, "Samyr has given up some information, but not nearly as much as we hoped for. Fagan has asked me to recruit anyone I could to help deal with this problem. Are you up for the [challenge] Lirone?");
                        break;

                    // If the player offered his "help", we send the quest dialog now!
                    case "challenge":
                        player.Out.SendQuestSubscribeCommand(addrir, QuestMgr.GetIDForQuestType(typeof(TraitorInMagMell)), "Will you help Mag Mell by taking on this vital mission?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "necklace":
                        addrir.SayTo(player, "Aye. I am giving it to you to use for this meeting. You will not have to say anything, or so Samyr says. Just go to the [meeting location], use the necklace and wait for the Sluagh.");
                        break;

                    case "meeting location":
                        addrir.SayTo(player, "Go west from Mag Mell towards Tir na Nog. You will come to the base of the foot hills. Head southwest-south along the base of the hills. Hurry now. Time is wasting.");
                        if (quest.Step == 1)
                        {
                            quest.Step = 2;
                        }

                        break;

                    // step 5
                    case "reward":
                        addrir.SayTo(player, "For you, a nice pair of boots to help keep your feet dry and clean. Thank you again for the help you've given me in this matter Lirone. I shall report this to Fagan at once.");
                        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;
                    }
                }
            }
        }