Ejemplo n.º 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));
            }
        }
Ejemplo n.º 2
0
        protected static void PlayerEnterAskefruerArea(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.askefruer == null && quest.Step == 1)
            {
                // player near grove
                SendSystemMessage(player, "It's Fallen Askefruer! Quickly now, /use your box to capture the Askefruer! To USE an item, right click on the item and type /use.");
                quest.CreateAskefruer();

                foreach (GamePlayer visPlayer in quest.askefruer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    visPlayer.Out.SendSpellCastAnimation(quest.askefruer, 1, 20);
                }
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 4
0
        protected static void PlayerUseSlot(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;
            // player already morphed...

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

            if (quest == null)
            {
                return;
            }

            if (quest.Step == 1 && quest.askefruer != 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.askefruer, 500))
                    {
                        foreach (GamePlayer visPlayer in quest.askefruer.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                        {
                            visPlayer.Out.SendSpellCastAnimation(quest.askefruer, 1, 20);
                        }

                        SendSystemMessage(player, "You catch " + quest.askefruer.GetName(0, false) + " in your magical wodden box!");
                        new RegionTimer(player, new RegionTimerCallback(quest.DeleteAskefruer), 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.");
                    }
                }
            }
        }
Ejemplo n.º 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.askefruer != null && quest.askefruer.ObjectState == GameObject.eObjectState.Active)
                {
                    quest.askefruer.Delete();
                }
            }
        }
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 (dalikor.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 (!dalikor.GiveQuest(typeof(Nuisances), player, 1))
                {
                    return;
                }

                dalikor.SayTo(player, "Excellent, recruit! I believe the noise is coming from the south-southeast of this tower, near the base of the hills. You'll find that there are a lot of huldu near that area, but it is not them. Take this box. When you have discovered what or who is making this noise, USE the box to capture them, then bring it back to me. Be safe Eeinken.");

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

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

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

            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. I'm afraid we have a [serious problem] on our hands.");
                    return;
                }
                else
                {
                    if (quest.Step == 2)
                    {
                        dalikor.SayTo(player, "Welcome back recruit. Did you find out what was making all that racket?");
                    }
                    else if (quest.Step == 3)
                    {
                        dalikor.SayTo(player, "Hrm...Fallen Askefruer. This is what has been causing us our problems? Interesting. I want to thank you recruit for your hard work in helping us solve this problem. A [reward] is in store for you I think.");
                    }
                    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 "serious problem":
                        dalikor.SayTo(player, "There has been this noise that has been keeping the residents of Mularn up at night. I haven't been able to locate the source of the noise, neither have any of the guards. I was hoping you could try to [find] the noise.");
                        break;

                    //If the player offered his "help", we send the quest dialog now!
                    case "find":
                        player.Out.SendQuestSubscribeCommand(dalikor, QuestMgr.GetIDForQuestType(typeof(Nuisances)), "Will you help out Mularn and discover who or what is making this noise?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "reward":
                        dalikor.SayTo(player, "Yes, I think this will do quite nicely. Here you are Eeinken. Use it well, and I'm sure it will last you your first few seasons anyhow. Be sure to come and speak with me when you are ready for more adventure.");
                        if (quest.Step == 3)
                        {
                            quest.FinishQuest();
                            dalikor.SayTo(player, "Don't go far, I have need of your services again Eeinken.");
                        }
                        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;
                    }
                }
            }
        }