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

            if (player == null)
            {
                return;
            }

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

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

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

            if (player == null)
            {
                return;
            }

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

            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 == ladyFelin.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 (ladyFelin != null)
                    {
                        ladyFelin.Delete();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected static void TalkToLadyFelin(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(TraitorInCotswold), player) <= 0)
            {
                return;
            }

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

            ladyFelin.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest != null && quest.Step >= 2)
                {
                    ladyFelin.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":
                        ladyFelin.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(ladyFelin, player, fairyPlans);

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

                            quest.Step = 4;
                        }

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

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

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

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

                        player.Model = ladyFelin.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 (!ladyFelin.IsAlive || ladyFelin.ObjectState != GameObject.eObjectState.Active)
                        {
                            ladyFelin.X       = felinStart.X;
                            ladyFelin.Y       = felinStart.Y;
                            ladyFelin.Z       = felinStart.Z;
                            ladyFelin.Heading = felinStart.Heading;
                            ladyFelin.AddToWorld();
                            ladyFelin.WalkTo(felinEnd.X, felinEnd.Y, felinEnd.Z, ladyFelin.MaxSpeed);
                        }

                        quest.Step = 3;
                    }
                }
            }
        }
Ejemplo 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)
        {
            TraitorInCotswold quest = player.IsDoingQuest(typeof(TraitorInCotswold)) as TraitorInCotswold;

            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();
            }
        }
Ejemplo 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 (masterFrederick.CanGiveQuest(typeof(TraitorInCotswold), player) <= 0)
            {
                return;
            }

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

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

                masterFrederick.SayTo(player, "Excellent job recruit. He said his contact's name was Lady Felin. I wasn't aware fairies had any sort of royalty, but that's not important. Here, take this. You'll need to use it in order to [infiltrate] the meeting tonight.");

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

                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
Ejemplo 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 TalkToMasterFrederick(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(TraitorInCotswold), player) <= 0)
            {
                return;
            }

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

            masterFrederick.TurnTo(player);

            // Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    // Player is not doing the quest...
                    masterFrederick.SayTo(player, "Vinde! I have some important news regarding the recent capture of the [ire fairies].");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        masterFrederick.SayTo(player, "Vinde, you've returned. I'm sure you were successful with your mission. Come come my friend. Hand over the information.");
                    }
                    else if (quest.Step == 5)
                    {
                        masterFrederick.SayTo(player, "Hrm...These plans are sketchy, at best. I wonder if Shaemus was supposed to add in his two coppers. Interesting nonetheless. Thank you for helping us out Vinde. I have [something] here for you.");
                    }
                    else
                    {
                        masterFrederick.SayTo(player, "I know, it's not our speciality, but it's something we have to do for the betterment of the realm! Now, according to Shaemus, he was meeting them at a [small grove] to the south of Cotswold.");
                    }

                    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":
                        masterFrederick.SayTo(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":
                        masterFrederick.SayTo(player, "I know, it's shocking. I can hardly believe it myself. The guards were more than happy to share their information, so I wanted to pass it along to you. Apparently, this man named Shaemus was in [league] with the fairies.");
                        break;

                    case "league":
                        masterFrederick.SayTo(player, "His deal with them was to share in the profits of their stealing. I can't believe someone's greed would allow them to make deals with ire fairies! Well, anyhow, he gave us some further information on his [dealings] with them.");
                        break;

                    case "dealings":
                        masterFrederick.SayTo(player, "Shaemus uses a necklace that changes his appearance so he looks like one of the ire fairies. He said it's easier to deal with them that way. The guards confiscated it and it's currently in my possession. I was wondering if you would help us with this severe [problem]. What do you say Vinde, will you help us?");
                        break;

                    // If the player offered his "help", we send the quest dialog now!
                    case "problem":
                        player.Out.SendQuestSubscribeCommand(masterFrederick, QuestMgr.GetIDForQuestType(typeof(TraitorInCotswold)), "Will you help Cotswold by taking on this vital mission?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "infiltrate":
                        masterFrederick.SayTo(player, "I know, it's not our speciality, but it's something we have to do for the betterment of the realm! Now, according to Shaemus, he was meeting them at a [small grove] to the south of Cotswold.");
                        break;

                    case "small grove":
                        masterFrederick.SayTo(player, "He was supposed to be getting more information on their plans, so you shouldn't need to say much. Make your way to the grove and wait for the ire fairies. Return to me when you've gotten the information we're looking for.");
                        if (quest.Step == 1)
                        {
                            quest.Step = 2;
                        }

                        break;

                    // step 5
                    case "something":
                        masterFrederick.SayTo(player, "Here you are my friend. These boots will help keep your feet dry and warm on those days when you think the weather in Albion is against you. Be well my friend. We will talk again soon.");
                        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;
                    }
                }
            }
        }