Пример #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;
                    }
                }
            }
        }
Пример #2
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);
        }
Пример #3
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;
            }
        }