Exemple #1
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)
        {
            BuildingABetterBow quest = player.IsDoingQuest(typeof(BuildingABetterBow)) as BuildingABetterBow;

            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();
            }
        }
Exemple #2
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 TalkToElvarIronhand(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 (elvarIronhand.CanGiveQuest(typeof(BuildingABetterBow), player) <= 0)
            {
                return;
            }

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

            elvarIronhand.TurnTo(player);
            //Did the player rightclick on NPC?
            if (e == GameObjectEvent.Interact)
            {
                if (quest == null)
                {
                    //Player is not doing the quest...
                    elvarIronhand.SayTo(player, "Hello, adventurer. Are you here in response to the notice I posted in the [tavern]?");
                    return;
                }
                else
                {
                    if (quest.Step == 4)
                    {
                        elvarIronhand.SayTo(player, "You're back! I hope you were able to retrieve those bones without much trouble. I'm already drawing up the plans for the new bow.  May I have the bones?");
                    }
                    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 "tavern":
                        elvarIronhand.SayTo(player, "I was hoping to get someone to help me with a little side project. You see, in my spare time, I collect texts on weaponsmithing and I recently came across one about weapons used in less civilized [lands].");
                        break;

                    case "lands":
                        elvarIronhand.SayTo(player, "It seems that some nomadic tribes have perfected the art of reinforcing their bows with thin pieces of bone or horn.  The text claims that bows constructed this way shoot farther and hit harder than the ones used by our [scouts].");
                        break;

                    //If the player offered his help, we send the quest dialog now!
                    case "scouts":
                        elvarIronhand.SayTo(player, "I think combining this technique with our longbows could help give our forces the edge in the war against Midgard and Hibernia. Will you help me gather some of the materials to build a prototype?");
                        player.Out.SendQuestSubscribeCommand(elvarIronhand, QuestMgr.GetIDForQuestType(typeof(BuildingABetterBow)), "Will you help Elvar gather the \nmaterials for his prototype bow? \n[Levels 3-6]");
                        break;
                    }
                }
                else
                {
                    switch (wArgs.Text)
                    {
                    case "first":
                        if (quest.Step == 1)
                        {
                            elvarIronhand.SayTo(player, "If you travel southeast from Cotswold, toward Prydwen keep, you should find some skeletons near the bend in the river.  Return to me when you've gathered two well-preserved bones from them.");
                            quest.Step = 2;
                        }
                        break;

                    case "technique":
                        if (quest.Step == 5)
                        {
                            elvarIronhand.SayTo(player, "Thank you for your help, " + player.CharacterClass.Name + ". Here's a bit of copper for your time. Keep your eyes open for a good source of horn in case the bone prototype doesn't work out.");
                            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;
                    }
                }
            }
        }