コード例 #1
0
        public void OnTick()
        {
            m_Bobs++;

            PublicOverheadMessage(MessageType.Regular, 0, 1116364); //**bob**

            if (m_Owner != null && (!SpecialFishingNet.ValidateDeepWater(Map, X, Y) || m_Owner.Skills[SkillName.Fishing].Base >= 75.0))
            {
                m_Owner.CheckSkill(SkillName.Fishing, 0, m_Owner.Skills[SkillName.Fishing].Cap);
            }

            if (!m_InUse)
            {
                EndTimer(null);
                return;
            }

            if (m_Bobs * 5 > Utility.Random(100))
            {
                OnTrapLost();
                return;
            }

            bool   rare = true;
            double bump = m_Bobs / 100.0;

            Type type = FishInfo.GetSpecialItem(m_Owner, this, Location, bump, this is LavaLobsterTrap);

            if (type != null)
            {
                Item item = Loot.Construct(type);
                DropItem(item);

                if (item is RareCrabAndLobster && rare)
                {
                    RareCrabAndLobster fish = (RareCrabAndLobster)item;

                    fish.Fisher     = m_Owner;
                    fish.DateCaught = DateTime.UtcNow;
                    fish.Weight     = Utility.RandomMinMax(10, 200);
                    fish.Stackable  = false;
                }

                if (m_Owner != null)
                {
                    m_Owner.SendMessage("It looks like you caught something!");
                }

                CheckBait();
            }
            else if (Utility.RandomBool())
            {
                Item item;

                if (Utility.RandomBool())
                {
                    item = new Crab();
                }
                else
                {
                    item = new Lobster();
                }

                if (m_Owner != null)
                {
                    m_Owner.SendMessage("It looks like you caught something!");
                }

                DropItem(item);
                CheckBait();
            }
        }
コード例 #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Kit.Deleted)
                {
                    return;
                }

                if (!(targeted is Corpse) && !(targeted is BigFish) && !(targeted is BaseHighseasFish) && !(targeted is HuntingPermit))
                {
                    from.SendLocalizedMessage(1042600);                       // That is not a corpse!
                }
                else if (targeted is Corpse && ((Corpse)targeted).VisitedByTaxidermist)
                {
                    from.SendLocalizedMessage(1042596);                       // That corpse seems to have been visited by a taxidermist already.
                }
                else if (!m_Kit.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
                else if (from.Skills[SkillName.Carpentry].Base < 90.0)
                {
                    from.SendLocalizedMessage(1042603);                       // You would not understand how to use the kit.
                }
                #region Huntmasters Challenge
                else if (targeted is HuntingPermit)
                {
                    HuntingPermit lic = targeted as HuntingPermit;

                    if (from.Backpack == null || !lic.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                    else if (!lic.CanUseTaxidermyOn)
                    {
                        //TODO: Message?
                    }
                    else if (from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Board), 10))
                    {
                        Server.Engines.HuntsmasterChallenge.HuntingTrophyInfo info = Server.Engines.HuntsmasterChallenge.HuntingTrophyInfo.Infos[lic.KillEntry.KillIndex];

                        if (info != null)
                        {
                            if (info.Complex)
                            {
                                from.AddToBackpack(new HuntTrophyAddonDeed(from.Name, info.MeasuredBy, lic.KillEntry.Measurement, info.SouthID, lic.KillEntry.DateKilled.ToShortDateString(), lic.KillEntry.Location, info.Species));
                            }
                            else
                            {
                                from.AddToBackpack(new HuntTrophyDeed(from.Name, info.MeasuredBy, lic.KillEntry.Measurement, info.SouthID, lic.KillEntry.DateKilled.ToShortDateString(), lic.KillEntry.Location, info.Species));
                            }

                            lic.ProducedTrophy = true;
                            m_Kit.Delete();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042598); // You do not have enough boards.
                        return;
                    }
                }
                #endregion
                else
                {
                    object obj = targeted;

                    if (obj is Corpse)
                    {
                        obj = ((Corpse)obj).Owner;
                    }

                    if (obj != null)
                    {
                        for (int i = 0; i < m_Table.Length; i++)
                        {
                            if (m_Table[i].CreatureType == obj.GetType())
                            {
                                Container pack = from.Backpack;

                                if (pack != null && pack.ConsumeTotal(typeof(Board), 10))
                                {
                                    from.SendLocalizedMessage(1042278);   // You review the corpse and find it worthy of a trophy.
                                    from.SendLocalizedMessage(1042602);   // You use your kit up making the trophy.

                                    Mobile hunter = null;
                                    int    weight = 0;

                                    if (targeted is BigFish)
                                    {
                                        BigFish fish = targeted as BigFish;

                                        hunter = fish.Fisher;
                                        weight = (int)fish.Weight;

                                        fish.Consume();
                                    }
                                    #region High Seas
                                    else if (targeted is RareFish)
                                    {
                                        RareFish fish = targeted as RareFish;

                                        hunter = fish.Fisher;
                                        weight = (int)fish.Weight;
                                        DateTime dateCaught = fish.DateCaught;

                                        from.AddToBackpack(new FishTrophyDeed(weight, hunter, dateCaught, m_Table[i].DeedNumber, m_Table[i].AddonNumber, m_Table[i].NorthID));

                                        fish.Delete();
                                        m_Kit.Delete();
                                        return;
                                    }

                                    else if (targeted is RareCrabAndLobster)
                                    {
                                        RareCrabAndLobster fish = targeted as RareCrabAndLobster;

                                        hunter = fish.Fisher;
                                        weight = (int)fish.Weight;
                                        DateTime dateCaught = fish.DateCaught;

                                        from.AddToBackpack(new FishTrophyDeed(weight, hunter, dateCaught, m_Table[i].DeedNumber, m_Table[i].AddonNumber, m_Table[i].NorthID));

                                        fish.Delete();
                                        m_Kit.Delete();
                                        return;
                                    }
                                    #endregion

                                    from.AddToBackpack(new TrophyDeed(m_Table[i], hunter, weight));

                                    if (targeted is Corpse)
                                    {
                                        ((Corpse)targeted).VisitedByTaxidermist = true;
                                    }

                                    m_Kit.Delete();
                                    return;
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042598);   // You do not have enough boards.
                                    return;
                                }
                            }
                        }
                    }

                    from.SendLocalizedMessage(1042599);                       // That does not look like something you want hanging on a wall.
                }
            }