Esempio n. 1
0
        public void OnTarget(Mobile from, object obj)
        {
            if (Deleted || m_InUse)
            {
                return;
            }

            IPoint3D p3D = obj as IPoint3D;

            if (p3D == null)
            {
                return;
            }

            Map map = from.Map;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z

            if (!from.InLOS(obj))
            {
                from.SendLocalizedMessage(500979); // You cannot see that location.
            }
            else if (RequireDeepWater ? SpecialFishingNet.FullValidation(map, x, y) : (SpecialFishingNet.ValidateDeepWater(map, x, y) || SpecialFishingNet.ValidateUndeepWater(map, obj, ref z)))
            {
                Point3D p = new Point3D(x, y, z);

                if (GetType() == typeof(SpecialSalvageHook))
                {
                    for (int i = 1; i < Amount; ++i) // these were stackable before, doh
                    {
                        from.AddToBackpack(new SpecialSalvageHook());
                    }
                }

                _Tick = 0;

                m_InUse = true;
                Movable = false;
                MoveToWorld(p, map);

                SpellHelper.Turn(from, p);
                from.Animate(12, 5, 1, true, false, 0);

                Effects.SendLocationEffect(p, map, 0x352D, 16, 4);
                Effects.PlaySound(p, map, 0x364);

                _EffectTimer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), new TimerStateCallback(DoEffect), new object[] { p, from });
                _EffectTimer.Start();

                from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1154220); // *You cast the mighty hook into the sea!*
            }
            else
            {
                from.SendLocalizedMessage(1010485); // You can only use this in deep water!
            }
        }
Esempio n. 2
0
        public void Spawn(PlunderZone zone, int amount)
        {
            Map map = Map.Trammel;

            if (zone == PlunderZone.Fel)
            {
                map = Map.Felucca;
            }
            else if (zone > PlunderZone.Fel)
            {
                map = Map.Tokuno;
            }

            for (int i = 0; i < amount; i++)
            {
                var     rec = _Zones[(int)zone];
                Point3D p;

                while (true)
                {
                    p = map.GetRandomSpawnPoint(rec); //new Point3D(rec.X + Utility.Random(rec.Width), rec.Y + Utility.RandomMinMax(rec.Start.X, rec.Height), -5);

                    if (p.Z != -5)
                    {
                        p.Z = -5;
                    }

                    var bounds = new Rectangle2D(p.X - 7, p.Y - 7, 15, 15);

                    bool badSpot = false;

                    for (int x = bounds.Start.X; x <= bounds.Start.X + bounds.Width; x++)
                    {
                        for (int y = bounds.Start.Y; y <= bounds.Start.Y + bounds.Height; y++)
                        {
                            if (BaseBoat.FindBoatAt(new Point3D(x, y, -5), map) != null || !SpecialFishingNet.ValidateDeepWater(map, x, y))
                            {
                                badSpot = true;
                                break;
                            }
                        }

                        if (badSpot)
                        {
                            break;
                        }
                    }

                    if (!badSpot)
                    {
                        IPooledEnumerable eable = map.GetMobilesInBounds(bounds);

                        foreach (Mobile m in eable)
                        {
                            if (m.AccessLevel == AccessLevel.Player)
                            {
                                badSpot = true;
                                break;
                            }
                        }

                        eable.Free();

                        if (!badSpot)
                        {
                            var beacon = new PlunderBeaconAddon();
                            beacon.MoveToWorld(p, map);

                            PlunderBeacons[zone].Add(beacon);
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public static bool IsDeepWater(Point3D pnt, Map map, Region region)
 {
     return(SpecialFishingNet.FullValidation(map, pnt.X, pnt.Y) && !IsDungeon(pnt, map, region));
 }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
        public SunkenChest(int level, Mobile digger, int ancient) : base(0x455)
        {
            level = level + 4;
            if (level > 10)
            {
                level = 10;
            }

            ContainerFunctions.BuildContainer(this, 0, Utility.RandomList(1, 2), 0, 0);

            int xTraCash = Utility.RandomMinMax((level * 500), (level * 800));

            ContainerFunctions.AddGoldToContainer(xTraCash, this, 0, digger);

            if (level > 0)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 3)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 7)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (GetPlayerInfo.LuckyPlayer(digger.Luck))
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }

            ContainerOwner  = ContainerFunctions.GetOwner("Sunken");
            ContainerDigger = digger.Name;

            Name = "sunken chest";

            // = ARTIFACTS
            int artychance = GetPlayerInfo.LuckyPlayerArtifacts(digger.Luck) + 10;

            if (Utility.RandomMinMax(0, 100) < ((level * 10) + artychance))
            {
                Item arty = ArtifactBuilder.CreateArtifact("random");
                switch (Utility.RandomMinMax(1, 20))
                {
                case 1: arty = ArtifactBuilder.CreateArtifact("driftwood");   break;

                case 2: arty = ArtifactBuilder.CreateArtifact("kelp");                break;

                case 3: arty = ArtifactBuilder.CreateArtifact("barnacle");    break;

                case 4: arty = ArtifactBuilder.CreateArtifact("neptune");             break;

                case 5: arty = ArtifactBuilder.CreateArtifact("bronzed");             break;
                }
                DropItem(arty);
                BaseContainer.DropItemFix(arty, digger, ItemID, GumpID);
            }

            int  giveRelics = level;
            Item relic      = Loot.RandomRelic();

            while (giveRelics > 0)
            {
                relic = Loot.RandomRelic();
                ContainerFunctions.RelicValueIncrease(level, relic);
                DropItem(relic);
                BaseContainer.DropItemFix(relic, digger, ItemID, GumpID);
                giveRelics = giveRelics - 1;
            }

            if (ancient > 0)
            {
                Name = "ancient sunken chest";
                Hue  = Utility.RandomList(0xB8E, 0xB8F, 0xB90, 0xB91, 0xB92, 0xB89, 0xB8B);
                Item net = new FabledFishingNet();
                DropItem(net);
                BaseContainer.DropItemFix(net, digger, ItemID, GumpID);
            }
            else
            {
                Item net = new FishingNet();
                if (Utility.RandomMinMax(1, 3) == 1)
                {
                    net = new SpecialFishingNet();
                }
                DropItem(net);
                BaseContainer.DropItemFix(net, digger, ItemID, GumpID);
                ItemID = Utility.RandomList(0x52E2, 0x52E3, 0x507E, 0x507F, 0x4910, 0x4911, 0x3332, 0x3333, 0x4FF4, 0x4FF5);
                Hue    = 0;
            }
        }