Beispiel #1
0
        public static Type GetSpecialItem(Mobile from, Item harvestItem, Point3D pnt, double bump, bool rareOnly)
        {
            InvalidateLocations();

            Map     map     = from.Map;
            Point3D fromLoc = from.Location;

            Region reg = from.Region;

            if (reg.Parent != null)
            {
                reg = reg.Parent;
            }

            double skill   = from.Skills[SkillName.Fishing].Value;
            bool   fishing = harvestItem is FishingPole;

            Type bait     = null;
            Type item     = null;
            bool enhanced = false;

            if (harvestItem is FishingPole)
            {
                bait     = ((FishingPole)harvestItem).BaitType;
                enhanced = ((FishingPole)harvestItem).EnhancedBait;
            }
            else if (harvestItem is LobsterTrap)
            {
                bait     = ((LobsterTrap)harvestItem).BaitType;
                enhanced = ((LobsterTrap)harvestItem).EnhancedBait;
            }

            //insertion of baited type first to increase chances of fishing it up!
            List <FishInfo> infos = new List <FishInfo>(m_FishInfos);

            if (bait != null)
            {
                for (int i = 0; i < infos.Count; i++)
                {
                    FishInfo info = infos[i];
                    if (info.Type == bait)
                    {
                        infos.Remove(info);
                        infos.Insert(0, info);
                    }
                }
            }

            for (int i = 0; i < infos.Count; i++)
            {
                FishInfo info = infos[i];

                double baitStr = info.GetBaitStrength(bait, from, enhanced);

                if ((info.RequiresDeepWater && !IsDeepWater(pnt, map, reg)) || skill < info.MinSkill)
                {
                    continue;
                }

                if (fishing && info.Type.IsSubclassOf(typeof(BaseCrabAndLobster)))
                {
                    continue;
                }

                if (!fishing && !info.Type.IsSubclassOf(typeof(BaseCrabAndLobster)))
                {
                    continue;
                }

                if (info.Location is string)
                {
                    string loc = (string)info.Location;

                    if (loc.ToLower() == "cannotfishup")
                    {
                        continue;
                    }

                    if (loc.ToLower() == "t2a" && Server.Spells.SpellHelper.IsAnyT2A(map, fromLoc) && info.Roll(from, baitStr, bump))
                    {
                        item = info.Type;
                    }

                    if (loc.ToLower() == "trammelandfelucca" && (map == Map.Trammel || map == Map.Felucca) && !Server.Spells.SpellHelper.IsAnyT2A(map, fromLoc) && info.Roll(from, baitStr, bump))
                    {
                        item = info.Type;
                    }

                    if (loc.ToLower() == "fire island" && (map == Map.Felucca || map == Map.Trammel) && (from.X > 4559 && from.X < 4636 && from.Y > 3548 && from.Y < 3627 ||
                                                                                                         from.X > 4465 && from.X < 4493 && from.Y > 4479 && from.Y < 3746) && info.Roll(from, baitStr, bump))
                    {
                        item = info.Type;
                    }

                    if (from.Region != null && from.Region.IsPartOf(loc) && info.Roll(from, baitStr, bump))
                    {
                        item = info.Type;
                    }
                }
                else if (info.Location is Map)
                {
                    Map locMap = (Map)info.Location;

                    if (map == locMap && info.Roll(from, baitStr, bump))
                    {
                        item = info.Type;
                    }
                }
            }

            ColUtility.Free(infos);

            if (!rareOnly && item == null && from is PlayerMobile)
            {
                double chance = skill / 121.5;

                bool dungeon = IsDungeon(pnt, map, reg);
                bool shore   = IsShore(pnt, map, reg);
                bool deep    = IsDeepWater(pnt, map, reg);

                if (fishing && chance >= Utility.RandomDouble())
                {
                    if (dungeon && skill >= 106.0)
                    {
                        item = BaseHighseasFish.DungeonFish[Utility.Random(BaseHighseasFish.DungeonFish.Length)];
                    }
                    else if (deep && skill >= 80.0)
                    {
                        item = BaseHighseasFish.DeepWaterFish[Utility.Random(BaseHighseasFish.DeepWaterFish.Length)];
                    }
                    else if (shore && skill >= 50.0)
                    {
                        item = BaseHighseasFish.ShoreFish[Utility.Random(BaseHighseasFish.ShoreFish.Length)];
                    }
                }
                else if (skill >= 50.0 && !fishing && chance >= Utility.RandomDouble())
                {
                    item = BaseHighseasFish.LobstersAndCrabs[Utility.Random(BaseHighseasFish.LobstersAndCrabs.Length)];
                }
            }

            return(item);
        }