예제 #1
0
        protected static void PlayerEnterWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

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

            if (quest != null)
            {
                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
예제 #2
0
        protected static void PlayerEnterSluaghArea(DOLEvent e, object sender, EventArgs args)
        {
            AreaEventArgs aargs  = args as AreaEventArgs;
            GamePlayer    player = aargs.GameObject as GamePlayer;
            Nuisances     quest  = player.IsDoingQuest(typeof(Nuisances)) as Nuisances;

            if (quest != null && quest.sluagh == null && quest.Step == 1)
            {
                // player near grove
                SendSystemMessage(player, "Sluaghs! Quick! USE your Magical Wooden Box to capture the sluagh footsoldier! To USE an item, right click on the item and type /use.");
                quest.CreateSluagh();

                foreach (GamePlayer visPlayer in quest.sluagh.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    visPlayer.Out.SendSpellCastAnimation(quest.sluagh, 1, 20);
                }
            }
        }
예제 #3
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)
        {
            Nuisances quest = player.IsDoingQuest(typeof(Nuisances)) as Nuisances;

            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();
            }
        }
예제 #4
0
        protected static void PlayerUseSlot(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

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

            if (quest == null)
            {
                return;
            }

            if (quest.Step == 1 && quest.sluagh != null)
            {
                UseSlotEventArgs uArgs = (UseSlotEventArgs)args;

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

                        SendSystemMessage(player, "You catch the sluagh footsoldier in your magical wodden box!");
                        new RegionTimer(player, new RegionTimerCallback(quest.DeleteSluagh), 2000);

                        ReplaceItem(player, emptyMagicBox, fullMagicBox);

                        quest.Step = 2;
                    }
                    else
                    {
                        SendSystemMessage(player, "There is nothing within the reach of the magic box that can be cought.");
                    }
                }
            }
        }
예제 #5
0
        protected static void PlayerLeftWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

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

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

                if (quest.sluagh != null && quest.sluagh.ObjectState == GameObject.eObjectState.Active)
                {
                    quest.sluagh.Delete();
                }
            }
        }
예제 #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(Nuisances), player) <= 0)
            {
                return;
            }

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

            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(Nuisances), player, 1))
                {
                    return;
                }

                addrir.SayTo(player, "Excellent recruit! Now here, take this magical box. I have a feeling there is something out there, and I would like for you to catch it, as proof to Fagan that something needs to be done. When you find the spot that is the noisiest, USE the box and capture whatever it is. Good luck Lirone. Return to me as quickly as you can.");

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

                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(Nuisances), player) <= 0)
            {
                return;
            }

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

            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, "Ah, my friend. I'm afraid there is a [new problem] that we must deal with.");
                    return;
                }
                else
                {
                    switch (quest.Step)
                    {
                    case 1:
                        addrir.SayTo(player, "Excellent recruit! Now here, take this magical box. I have a feeling there is something out there, and I would like for you to catch it, as proof to Fagan that something needs to be done. When you find the spot that is the noisiest, USE the box and capture whatever it is. Good luck Lirone. Return to me as quickly as you can.");
                        break;

                    case 3:
                        addrir.SayTo(player, "Sluagh...These beasts are evil, evil creatures. I can't begin to imagine why they are here. I will have to bring this to Fagan's attention immediately. Thank you Lirone, for showing this to me. Please take this as a show of my appreciation for your bravery and dedication to not only Mag Mell, but to Hibernia. I shall go present this to Fagan straight away. Be safe until my return Lirone.");
                        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 "new problem":
                        addrir.SayTo(player, "Aye Lirone. There is this hideously loud noise that is coming from somewhere to the North of Mag Mell. It is driving the citizens mad! Fagan has offered a reward to the first person who can [quell] the noise.");
                        break;

                    case "quell":
                        addrir.SayTo(player, "Will you do this for us recruit? Will you find out the cause of this noise and [stop] it?");
                        break;

                    // If the player offered his "help", we send the quest dialog now!
                    case "stop":
                        player.Out.SendQuestSubscribeCommand(addrir, QuestMgr.GetIDForQuestType(typeof(Nuisances)), "Will you help out Mag Mell and discover who or what is making this noise?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    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;
                    }
                }
            }
        }