示例#1
0
        protected static void PlayerUseSlot(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = (GamePlayer)sender;

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

            if (quest == null)
            {
                return;
            }

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

                InventoryItem item = player.Inventory.GetItem((eInventorySlot)uArgs.Slot);
                if (item != null && item.Id_nb == bloatedFang.Id_nb)
                {
                    if (player.IsWithinRadius(arachneida, 500) && !arachneida.IsAlive)
                    {
                        SendSystemMessage(player, "You use the bloated spider fang to retrieve Arachneida's chitin!");
                        GiveItem(player, spiderChitin);

                        quest.Step = 4;
                    }
                }
            }
        }
示例#2
0
        protected static void PlayerEnterWorld(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }

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

            if (quest != null)
            {
                GameEventMgr.AddHandler(player, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
                GameEventMgr.AddHandler(player, GamePlayerEvent.UseSlot, new DOLEventHandler(PlayerUseSlot));
            }
        }
示例#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)
        {
            HuntForArachneida quest = player.IsDoingQuest(typeof(HuntForArachneida)) as HuntForArachneida;

            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
        /* This is the method we declared as callback for the hooks we set to
         * Sir Quait. It will be called whenever a player right clicks on Sir Quait
         * or when he whispers something to him.
         */

        protected static void TalkToKealan(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 (kealan.CanGiveQuest(typeof(HuntForArachneida), player) <= 0)
            {
                return;
            }

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

            kealan.TurnTo(player);
            //Did the player rightclick on Sir Quait?
            if (e == GameObjectEvent.Interact)
            {
                //We check if the player is already doing the quest
                if (quest == null)
                {
                    //If the player qualifies, we begin talking...
                    kealan.SayTo(player, "Aye, hello there! Have ye come to hunt the [giant spider] deep down in the [forrest]?");
                    return;
                }
                else
                {
                    //If the player is already doing the quest, we ask if he found the fur!
                    if (player.Inventory.GetFirstItemByID(bloatedFang.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null)
                    {
                        kealan.SayTo(player, "Good, you managed to retrieve a bloated spider fang, but did you also slay Arachneida?");
                    }
                    else if (player.Inventory.GetFirstItemByID(spiderChitin.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null)
                    {
                        kealan.SayTo(player, "Ah, I see you killed her, I knew you were other than the rest. Now hand me over the chitin and fang so that I can give you your reward.");
                    }
                    else
                    {
                        kealan.SayTo(player, "Go now, and bring back her chitin as prof of your success.");
                    }
                    return;
                }
            }
            else if (e == GameLivingEvent.WhisperReceive)
            {
                WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args;
                //We also check if the player is already doing the quest
                if (quest == null)
                {
                    //Do some small talk :)
                    switch (wArgs.Text)
                    {
                    case "giant spider":
                        kealan.SayTo(player, "Ay, she's that big she even got her own name, everybody calls her \"Arachneida\". But take care nobody who went out to [hunt] her ever returned.");
                        break;

                    case "forrest":
                        kealan.SayTo(player, "She lives in the forrest east of here. It's a dark forrest full of bloated spiders so take care of yourself if you go there.");
                        break;

                    //If the player offered his "help", we send the quest dialog now!
                    case "hunt":
                        player.Out.SendQuestSubscribeCommand(kealan, QuestMgr.GetIDForQuestType(typeof(HuntForArachneida)), "Do you want to hunt Arachneida?");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "bloated spider fang":
                        kealan.SayTo(player, "There should be lots of them out there near Arachneida's lair.");
                        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;
                    }
                }
            }
        }