コード例 #1
0
        public override void OnTalk(PlayerMobile player)
        {
            int      distance = 100;
            BaseBoat boat     = FishQuestHelper.GetBoat(player);

            if (boat == null)
            {
                SayTo(player, 1116514); //Bring yer ship around, I might have some work for ye!);
            }
            else
            {
                bool inRange = InRange(boat.Location, distance) && boat.Map == Map;

                if (!FishQuestHelper.HasFishQuest(player, this, inRange))
                {
                    FishMonger monger = FishQuestHelper.GetRandomMonger(player, this);

                    if (monger == null)
                    {
                        SayTo(player, "It seems my fellow fish mongers are on vacation.  Try again later, or perhaps another Facet.");
                    }
                    else
                    {
                        ProfessionalFisherQuest quest = new ProfessionalFisherQuest(player, monger, this, boat);

                        if (quest != null)
                        {
                            quest.Quester = this;
                            quest.Owner   = player;
                            player.CloseGump(typeof(MondainQuestGump));
                            player.SendGump(new MondainQuestGump(quest));

                            if (boat.IsClassicBoat)
                            {
                                SayTo(player, "Such a weak vessle can only catch a weak line.");
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        public ProfessionalFisherQuest(Mobile from, FishMonger monger, FishMonger quester, BaseBoat boat)
        {
            PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(from, true);

            int lines;

            if (boat.IsClassicBoat)
                lines = 1;
            else
                lines = entry.CalculateLines();

            m_TurnIn = monger;
            m_Boat = boat;

            int index = 0;
            int amount = 10;
            Type type = null;

            List<int> hasChosen = new List<int>();
            Dictionary<Type, int> types = new Dictionary<Type, int>();

            for (int i = 0; i < lines; i++)
            {
                entry.GetRandomFish(ref index, ref amount, hasChosen);
                hasChosen.Add(index);
                type = FishQuestHelper.GetTypeFromIndex(index);
                if (amount < 5) amount = 5;
                if (amount > 20) amount = 20;

                types[type] = amount;
            }

            AddObjective(new FishQuestObjective(types));
            AddReward(new BaseReward(1116510)); //A rare reward from the Order of the Dragonfish.

            hasChosen.Clear();

            m_Title = GetTitle(quester);
        }
コード例 #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_TurnIn = reader.ReadMobile() as FishMonger;
            m_Boat = reader.ReadItem() as BaseBoat;
            m_Crate = reader.ReadItem() as ShippingCrate;

            if (m_Crate != null)
                m_Crate.AddQuest(this);

            switch (reader.ReadInt())
            {
                case 0:
                    m_Title = reader.ReadString();
                    break;
                case 1:
                    m_Title = reader.ReadInt();
                    break;
            }

            AddReward(new BaseReward(1116510)); //A rare reward from the Order of the Dragonfish.
        }
コード例 #4
0
ファイル: FishQuestHelper.cs プロジェクト: Crome696/ServUO
        public static FishMonger GetRandomMonger(PlayerMobile player, FishMonger monger)
        {
            bool NOGO = true;
            FishMonger mob = null;
            Map map = player.Map;

            List<FishMonger> mongers = new List<FishMonger>(m_Mongers);

            //First, remove quester
            if (mongers.Contains(monger))
                mongers.Remove(monger);

            //Next, remove mongers from other facets in same region as quest giver
            foreach (FishMonger m in m_Mongers)
            {
                if (m.Region != null && monger.Region != null && m.Region.Name == monger.Region.Name)
                    mongers.Remove(m);
            }

            //Now, remove mongers from other quests
            if (player.Quests != null)
            {
                for (int i = 0; i < player.Quests.Count; i++)
                {
                    if (player.Quests[i] is ProfessionalFisherQuest)
                    {
                        ProfessionalFisherQuest q = (ProfessionalFisherQuest)player.Quests[i];

                        if (mongers.Contains(q.TurnIn))
                            mongers.Remove(q.TurnIn);
                    }
                }
            }

            if (mongers == null || mongers.Count < 1)
                return null;

            while (NOGO)
            {
                mob = mongers[Utility.Random(mongers.Count)];

                if (mob.Region != null && mob.Region.Name != null)
                    NOGO = false;
            }

            return mob;
        }