Esempio n. 1
0
        public override void Damage(int amount, Mobile from)
        {
            PlayerMobile pm = null;

            if (from is PlayerMobile)
            {
                pm = from as PlayerMobile;
            }
            else if (from is BaseCreature)
            {
                BaseCreature bc = from as BaseCreature;
                if (bc.Controlled == true)
                {
                    pm = bc.ControlMaster as PlayerMobile;
                }
            }

            if (pm != null)
            {
                BobQuest qs = pm.Quest as BobQuest;

                if (qs != null)
                {
                    //Are we in the right objective ?
                    if (qs.IsObjectiveInProgress(typeof(KillBunniesObjective)))
                    {
                        base.Damage(amount, from);
                    }
                    else
                    {
                        this.Say("You've killed enough bunnies, go see Bob");
                    }
                }
                else
                {
                    //Look for the quest state
                    LoggedQuestState state = LoggedQuestSystem.getQuestState(from, "Bunny Attack Quest");

                    //Switch on states
                    switch (state)
                    {
                    case LoggedQuestState.NOTINVOLVED:
                        this.Say("Stop it, go see bob if you want to play!");
                        break;

                    case LoggedQuestState.CANCELED:
                        this.Say("Stop it, you canceled, tough!");
                        break;

                    case LoggedQuestState.FINISHED:
                        this.Say("Stop it now, this is not your quest anymore");
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            //Look at the player
            this.Direction = GetDirectionTo(player);

            //New quest proposal
            //Create the quest
            QuestSystem newQuest = new BrianQuest(player);

            //First we check if we have done Bobs Quest
            LoggedQuestState state = LoggedQuestSystem.getQuestState(player, "Alfred's Quest");

            switch (state)
            {
            case LoggedQuestState.FINISHED:
                //Look for this quest's state
                LoggedQuestState Brianstate = LoggedQuestSystem.getQuestState(player, "Brian's Quest");

                //Switch on the state
                switch (Brianstate)
                {
                case LoggedQuestState.NOTINVOLVED:
                    //Are we already doing a quest ?
                    if (!(player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(BrianQuest))))
                    {
                        newQuest.AddConversation(
                            new GenericConversation(
                                "I'm sorry but you are already occupied, come back later<br><br>" +
                                "And I'll have a quest for you"
                                )
                            );
                        return;
                    }

                    newQuest.SendOffer();
                    break;

                case LoggedQuestState.ACCEPTED:
                    BrianQuest bq = player.Quest as BrianQuest;

                    //Being paranoiac, normally bq can't be null be let's be sure
                    if (bq != null)
                    {
                        //Ok we know we have a quest, are we in progress killing bunnies ?
                        if (bq.IsObjectiveInProgress(typeof(BriansKillsObjective)))
                        {
                            bq.AddConversation(new GenericConversation("You have not finished your quest"));
                        }
                        //No then we are wanting the reward
                        else
                        {
                            QuestObjective lastObj = bq.FindObjective(typeof(BriansReturnAfterKillsObjective));

                            //Ok normally it's got to be non null and it shouldn't be completed
                            //Yet another paranoiac test
                            if (lastObj != null && !lastObj.Completed)
                            {
                                //Send the player to Brian
                                this.Say("I told you to go see Charlie when you were finished...");
                            }
                        }
                    }
                    else
                    {
                        //Write to console, if you see this, you made a mistake in the quest name...
                        Console.WriteLine("Quest should not be null, what happenned?");
                    }
                    break;

                case LoggedQuestState.CANCELED:
                    this.Say("You canceled your quest, move along");
                    break;

                case LoggedQuestState.FINISHED:
                    this.Say("You have already finished this quest, move along");
                    break;

                case LoggedQuestState.DECLINED:
                    this.Say("You have refused this quest, move along");
                    break;

                default:
                    break;
                }
                break;

            case LoggedQuestState.ACCEPTED:
                this.Say("Finish Alfred's quest and come and see me");
                break;

            case LoggedQuestState.CANCELED:
                this.Say("You canceled Alfred's quest, move along");
                break;

            case LoggedQuestState.DECLINED:
                this.Say("You declined Alfred's quest, move along");
                break;

            case LoggedQuestState.NOTINVOLVED:
                this.Say("Ahhh, you must prove yourself first to Alfred");
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        public override void OnDeath(Container c)
        {
            Mobile       m  = this.FindMostRecentDamager(false);
            PlayerMobile pm = null;
            BobQuest     bq = null;

            bool ressurect = true;

            if (m is PlayerMobile)
            {
                pm = m as PlayerMobile;
            }
            else if (m is BaseCreature)
            {
                BaseCreature bc = m as BaseCreature;

                if (bc.Controlled == true)
                {
                    pm = bc.ControlMaster as PlayerMobile;
                }
            }

            if (pm != null)
            {
                bq = pm.Quest as BobQuest;
            }

            //Ok rabbit died by someone who's got the quest so it's all good
            if (bq != null)
            {
                if (bq.IsObjectiveInProgress(typeof(KillBunniesObjective)))
                {
                    ressurect = false;
                }
            }

            if (ressurect) //No marker or finished quest
            {
                BobsRabbit newrabbit = new BobsRabbit();

                Point3D nrpos = this.Location;

                nrpos.X += Utility.Random(8) - 4;
                nrpos.Y += Utility.Random(8) - 4;
                newrabbit.MoveToWorld(nrpos, Map.Trammel);

                if (pm != null)
                {
                    if (bq != null)
                    {
                        newrabbit.Say("You've killed enough rabbits don't you think ?");
                    }
                    else
                    {
                        //Look for the quest state
                        LoggedQuestState state = LoggedQuestSystem.getQuestState(pm, "Bunny Attack Quest");

                        //Switch on states
                        switch (state)
                        {
                        case LoggedQuestState.NOTINVOLVED:
                            this.Say("Stop it, go see bob if you want to play!");
                            break;

                        case LoggedQuestState.CANCELED:
                            this.Say("Stop it, you canceled, tough!");
                            break;

                        case LoggedQuestState.FINISHED:
                            this.Say("Stop it now, this is not your quest anymore");
                            break;

                        case LoggedQuestState.DECLINED:
                            this.Say("Stop it now, you declined, tough!");
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            base.OnDeath(c);
        }
Esempio n. 4
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            //Look at the player
            this.Direction = GetDirectionTo(player);

            //Look for the quest state
            LoggedQuestState state = LoggedQuestSystem.getQuestState(player, "Brian's Quest");

            //Switch on the state
            switch (state)
            {
            case LoggedQuestState.ACCEPTED:
                BrianQuest bq = player.Quest as BrianQuest;

                //Being paranoiac, normally bq can't be null be let's be sure
                if (bq != null)
                {
                    QuestObjective lastObj = bq.FindObjective(typeof(BriansReturnAfterKillsObjective));

                    //Ok normally it's got to be non null and it shouldn't be completed
                    //Yet another paranoiac test
                    if (lastObj != null && !lastObj.Completed)
                    {
                        //Give some gold
                        bool gold = true;

                        BrianQuest.GiveRewardTo(player, ref gold);

                        //Check if we gave it all
                        if (!gold)
                        {
                            //Last check, has the player done the Bob's quest ?
                            state = LoggedQuestSystem.getQuestState(player, "Bob's Quest");
                            if (state == LoggedQuestState.FINISHED)
                            {
                                bq.AddConversation(new GenericConversation(
                                                       "Charlie gives you your gold, at last this is over... <br><br>" +
                                                       "He looks up at you and says : <br>" +
                                                       "\"Ahhhh, I see you have also helped Bob! <br><br>" +
                                                       "Why don't you go see David, he'll have a special compensation for you\""));
                            }
                            else
                            {
                                bq.AddConversation(new GenericConversation(
                                                       "Charlie gives you your gold, at last this is over..."
                                                       )
                                                   );
                            }
                            lastObj.Complete();
                        }
                        else         //If not
                        {
                            bq.AddConversation(new GenericConversation("Your backpack is full, make room!"));
                        }
                    }
                }
                else
                {
                    //Write to console, if you see this, you made a mistake in the quest name...
                    Console.WriteLine("Quest should not be null, what happenned?");
                }
                break;

            default:
                this.Say("I have nothing to say to you...");
                break;
            }
        }
Esempio n. 5
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            //Look at the player
            this.Direction = GetDirectionTo(player);

            //Look for the quest state
            LoggedQuestState state = LoggedQuestSystem.getQuestState(player, "Bunny Attack Quest");

            //Switch on the state
            switch (state)
            {
            case LoggedQuestState.DECLINED:
            case LoggedQuestState.CANCELED:
            case LoggedQuestState.NOTINVOLVED:
                //New quest proposal
                //Create the quest
                QuestSystem newQuest = new BobQuest(player);

                if (player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(BobQuest)))
                {
                    newQuest.SendOffer();
                }
                else
                {
                    newQuest.AddConversation(
                        new GenericConversation(
                            "I'm sorry but you are already occupied, come back later<br><br>" +
                            "And I'll have a quest for you"
                            )
                        );
                }
                break;

            case LoggedQuestState.ACCEPTED:
                BobQuest bq = player.Quest as BobQuest;

                //Being paranoiac, normally bq can't be null be let's be sure
                if (bq != null)
                {
                    //Ok we know we have a quest, are we in progress killing bunnies ?
                    if (bq.IsObjectiveInProgress(typeof(KillBunniesObjective)))
                    {
                        bq.AddConversation(new GenericConversation("You have not finished your quest"));
                    }
                    //No then we are wanting the reward
                    else
                    {
                        QuestObjective lastObj = bq.FindObjective(typeof(ReturnAfterKillsObjective));

                        //Ok normally it's got to be non null and it shouldn't be completed
                        //Yet another paranoiac test
                        if (lastObj != null && !lastObj.Completed)
                        {
                            //Give some gold
                            bool gold = true;

                            BobQuest.GiveRewardTo(player, ref gold);

                            //Check if we gave it all
                            if (!gold)
                            {
                                //Last check, has the player done the Bob's quest ?
                                state = LoggedQuestSystem.getQuestState(player, "Brian's Quest");
                                if (state == LoggedQuestState.FINISHED)
                                {
                                    bq.AddConversation(new GenericConversation("As you leave bob, you can't help to think that you have "
                                                                               + "killed 5 innocent rabbits... <br><br>"
                                                                               + "He looks at you and says : \"Ahhhh, I see you have also helped Alfred and Brian! <br><br>" +
                                                                               "Why don't you go see David, he'll have a special compensation for you\""));
                                }
                                else
                                {
                                    bq.AddConversation(new GenericConversation(
                                                           "As you leave bob, you can't help to think that you have "
                                                           + "killed 5 innocent rabbits..."
                                                           )
                                                       );
                                }

                                lastObj.Complete();
                            }
                            else     //If not
                            {
                                bq.AddConversation(new GenericConversation("Your backpack is full, make room!"));
                            }
                        }
                    }
                }
                else
                {
                    //Write to console, if you see this, you made a mistake in the quest name...
                    Console.WriteLine("Quest should not be null, what happenned?");
                }
                break;

            case LoggedQuestState.FINISHED:
                this.Say("You have already finished this quest, move along");
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
            public override void OnClick()
            {
                PlayerMobile player = (PlayerMobile)m_Mobile;

                //Look for the quest state
                LoggedQuestState bobstate = LoggedQuestSystem.getQuestState(player, "Bunny Attack Quest");

                //No need to check Alfred -> If brian's quest is finished, then alfred's is too
                LoggedQuestState brianstate = LoggedQuestSystem.getQuestState(player, "Brian's Quest");

                if ((bobstate == LoggedQuestState.FINISHED) && (brianstate == LoggedQuestState.FINISHED))
                {
                    //Get David's State
                    LoggedQuestState davidstate = LoggedQuestSystem.getQuestState(player, "David's Quest");
                    //David's info
                    DavidLoggedQuestInfo davidinfo = null;

                    if (davidstate == LoggedQuestState.NOTINVOLVED)
                    {
                        //Create a DavidLoggedQuestInfo instance and replace the information for this entry
                        davidinfo = new DavidLoggedQuestInfo();

                        //Add entry
                        LoggedQuestSystem.questFinished(player, "David's Quest");

                        //Set Counter
                        davidinfo.Counter = 0;
                        davidinfo.State   = LoggedQuestState.FINISHED;

                        LoggedQuestSystem.updateQuestInfo(player, "David's Quest", davidinfo);
                    }
                    else
                    {
                        davidinfo = (DavidLoggedQuestInfo)LoggedQuestSystem.getQuestInfo(player, "David's Quest");
                    }

                    //Check counter
                    if (davidinfo.Counter < 2)
                    {
                        bool gold = true;
                        GiveRewardTo(player, ref gold);

                        //If given
                        if (!gold)
                        {
                            //Now update the counter
                            davidinfo.Counter++;
                            m_Giver.Say("Here, have some gold " + davidinfo.Counter);
                        }
                        else
                        {
                            m_Giver.Say("You don't even have room for gold!");
                        }
                    }
                    else
                    {
                        m_Giver.Say("Go away, I gave you gold twice!");
                    }
                }
                else
                {
                    m_Giver.Say("I have nothing to say to you!");
                }
            }