Пример #1
0
        public void TakeDamage(Mobile from, int damage)
        {
            if (from == null)
            {
                return;
            }

            if (damage < 1)
            {
                damage = 1;
            }

            //Break
            if (damage >= m_HitPoints)
            {
                Effects.PlaySound(Location, Map, 0x11B);

                m_HitPoints = 0;

                PlayerMobile player     = from as PlayerMobile;
                BaseBoat     playerBoat = BaseBoat.FindBoatAt(player.Location, player.Map);

                int doubloonValue = 10;

                switch (m_CrateType)
                {
                case CrateType.Bronze: doubloonValue = Utility.RandomMinMax(10, 25); break;

                case CrateType.Silver: doubloonValue = Utility.RandomMinMax(25, 100); break;

                case CrateType.Gold: doubloonValue = Utility.RandomMinMax(100, 250); break;
                }

                if (player != null && playerBoat != null)
                {
                    if (!playerBoat.Deleted)
                    {
                        if (playerBoat.DepositDoubloons(doubloonValue))
                        {
                            Doubloon doubloonPile = new Doubloon(doubloonValue);
                            player.SendSound(doubloonPile.GetDropSound());
                            doubloonPile.Delete();

                            //playerBoat.doubloonsEarned += doubloonValue;

                            player.SendMessage("You have recovered " + doubloonValue.ToString() + " doubloons worth of materials in the cargo! The coins have been placed in your ship's hold.");
                        }

                        else
                        {
                            player.SendMessage("You have earned doubloons, but alas there was not enough room in your ship's hold to place them all!");
                        }
                    }
                }

                Point3D startLocation       = Location;
                IEntity effectStartLocation = new Entity(Serial.Zero, Location, Map);

                Effects.SendLocationParticles(effectStartLocation, Utility.RandomList(0x36BD, 0x36BF, 0x36CB, 0x36BC), 30, 7, 0, 0, 5044, 0);

                int debrisCount = Utility.RandomMinMax(6, 8);

                for (int a = 0; a < debrisCount; a++)
                {
                    int itemId;

                    Point3D endLocation;
                    IEntity effectEndLocation;

                    if (Utility.RandomDouble() <= .80)
                    {
                        itemId      = Utility.RandomList(7041, 7044, 7053, 7067, 7068, 7069, 7070, 7604, 7605);
                        endLocation = new Point3D(X + Utility.RandomMinMax(-3, 3), Y + Utility.RandomMinMax(-3, 3), Z + 5);

                        effectEndLocation = new Entity(Serial.Zero, endLocation, Map);
                    }

                    else
                    {
                        itemId      = Utility.RandomList(3117, 3118, 3119, 3120);
                        endLocation = new Point3D(X + Utility.RandomMinMax(-2, 2), Y + Utility.RandomMinMax(-2, 2), Z);

                        effectEndLocation = new Entity(Serial.Zero, endLocation, Map);
                    }

                    Effects.SendMovingEffect(effectStartLocation, effectEndLocation, itemId, 5, 0, false, false, 0, 0);

                    double distance = Utility.GetDistanceToSqrt(startLocation, endLocation);

                    double destinationDelay = (double)distance * .16;
                    double explosionDelay   = ((double)distance * .16) + 1;

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        if (this == null)
                        {
                            return;
                        }

                        Blood debris  = new Blood();
                        debris.Name   = "debris";
                        debris.ItemID = itemId;

                        debris.MoveToWorld(endLocation, Map);
                        Effects.PlaySound(endLocation, Map, 0x027);
                    });
                }

                Delete();
            }

            //Damage
            else
            {
                int debrisCount = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < debrisCount; a++)
                {
                    int itemId = Utility.RandomList(7041, 7044, 7053, 7067, 7068, 7069, 7070, 7604, 7605);

                    Blood debris = new Blood();
                    debris.Name   = "debris";
                    debris.ItemID = itemId;

                    Point3D endLocation = new Point3D(X + Utility.RandomMinMax(-2, 2), Y + Utility.RandomMinMax(-2, 2), Z + 5);

                    debris.MoveToWorld(endLocation, Map);
                    Effects.PlaySound(endLocation, Map, 0x027);
                }

                //Wood Breaking Sound
                Effects.PlaySound(Location, Map, Utility.RandomList(0x11D)); //0x3B7, 0x3B5, 0x3B1

                m_HitPoints -= damage;
            }
        }
Пример #2
0
        public override Item Construct(Type type, Mobile from, Item _i, HarvestDefinition _d, HarvestBank _b, HarvestResource _r)
        {
            if (type == typeof(TreasureMap))
            {
                int level = 1;

                return(new TreasureMap(level, Map.Felucca));
            }

            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(Map.Felucca));
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                List <SOS> messages = pack.FindItemsByType <SOS>();

                for (int i = 0; i < messages.Count; ++i)
                {
                    SOS sos = messages[i];

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60) && !sos.Completed)
                    {
                        Item preLoot = null;

                        switch (Utility.Random(7))
                        {
                        case 0:     // Body parts
                        {
                            int[] list = new int[]
                            {
                                0x1CDD, 0x1CE5,                                        // arm
                                0x1CE0, 0x1CE8,                                        // torso
                                0x1CE1, 0x1CE9,                                        // head
                                0x1CE2, 0x1CEC                                         // leg
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 1:     // Bone parts
                        {
                            int[] list = new int[]
                            {
                                0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4,                         // skulls
                                0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
                                0x1B15, 0x1B16                                                  // pelvis bones
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 2:     // Pillows
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11));
                            break;
                        }

                        case 3:     // Shells
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9));
                            break;
                        }

                        case 4:         //Hats
                        {
                            if (Utility.RandomBool())
                            {
                                preLoot = new SkullCap();
                            }
                            else
                            {
                                preLoot = new TricorneHat();
                            }

                            break;
                        }

                        case 5:     // Misc
                        {
                            int[] list = new int[]
                            {
                                0x1EB5,                                        // unfinished barrel
                                0xA2A,                                         // stool
                                0xC1F,                                         // broken clock
                                0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4                 // barrel staves
                            };

                            if (Utility.Random(list.Length + 1) == 0)
                            {
                                preLoot = new Candelabra();
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            }

                            break;
                        }
                        }

                        if (preLoot != null)
                        {
                            if (preLoot is IShipwreckedItem)
                            {
                                ((IShipwreckedItem)preLoot).IsShipwreckedItem = true;
                            }

                            return(preLoot);
                        }

                        LockableContainer chest;

                        if (Utility.RandomBool())
                        {
                            chest = new MetalGoldenChest();
                        }
                        else
                        {
                            chest = new WoodenChest();
                        }

                        if (sos.IsAncient)
                        {
                            chest.Hue = 0x481;
                        }

                        TreasureMapChest.Fill(chest, Math.Max(1, Math.Min(3, (sos.Level + 1))));

                        if (sos.IsAncient)
                        {
                            chest.DropItem(new FabledFishingNet());
                        }
                        else
                        {
                            chest.DropItem(new SpecialFishingNet());
                        }

                        if (Utility.Random(500) == 0)
                        {
                            Item mask = new HornedTribalMask();
                            mask.Hue  = 2715;
                            mask.Name = "Mask of Cthulu";

                            chest.DropItem(mask);
                        }

                        switch (Utility.Random(300))
                        {
                        case 0:
                        {
                            Item rustedchest = new PlateChest();
                            rustedchest.Hue  = 2718;
                            rustedchest.Name = "a rusted platemail chest recovered from a shipwreck";

                            chest.DropItem(rustedchest);
                            break;
                        }

                        case 1:
                        {
                            Item rustedarms = new PlateArms();
                            rustedarms.Hue  = 2718;
                            rustedarms.Name = "rusted platemail arms recovered from a shipwreck";

                            chest.DropItem(rustedarms);
                            break;
                        }

                        case 2:
                        {
                            Item rustedlegs = new PlateLegs();
                            rustedlegs.Hue  = 2718;
                            rustedlegs.Name = "rusted platemail legguards recovered from a shipwreck";

                            chest.DropItem(rustedlegs);
                            break;
                        }

                        case 3:
                        {
                            Item rustedgloves = new PlateGloves();
                            rustedgloves.Hue  = 2718;
                            rustedgloves.Name = "rusted platemail gloves recovered from a shipwreck";

                            chest.DropItem(rustedgloves);
                            break;
                        }

                        case 4:
                        {
                            Item rustedgorget = new PlateGorget();
                            rustedgorget.Hue  = 2718;
                            rustedgorget.Name = "rusted platemail gorget recovered from a shipwreck";

                            chest.DropItem(rustedgorget);
                            break;
                        }

                        case 5:
                        {
                            Item rustedhelm = new PlateHelm();
                            rustedhelm.Hue  = 2718;
                            rustedhelm.Name = "a rusted platemail helmet recovered from a shipwreck";

                            chest.DropItem(rustedhelm);
                            break;
                        }
                        }

                        switch (Utility.Random(400))
                        {
                        case 0:
                        {
                            Item lamp = new LampPost1();
                            lamp.Name = "Britannia Head Light";
                            lamp.Hue  = 2601;

                            chest.DropItem(lamp);
                            break;
                        }

                        case 1:
                        {
                            Item lantern = new HangingLantern();
                            lantern.Name    = "Fog Lamp";
                            lantern.Hue     = 2601;
                            lantern.Movable = true;

                            chest.DropItem(lantern);
                            break;
                        }
                        }

                        chest.Movable   = true;
                        chest.Locked    = false;
                        chest.TrapType  = TrapType.None;
                        chest.TrapPower = 0;
                        chest.TrapLevel = 0;

                        sos.Completed = true;

                        BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map);

                        PlayerMobile player = from as PlayerMobile;

                        if (ownerBoat != null && player != null)
                        {
                            if (ownerBoat.IsFriend(player) || ownerBoat.IsOwner(player) || ownerBoat.IsCoOwner(player))
                            {
                                double doubloonValue = Utility.RandomMinMax(25, 50);

                                int finalDoubloonAmount = (int)doubloonValue;

                                bool shipOwner          = ownerBoat.IsOwner(player);
                                bool bankDoubloonsValid = false;
                                bool holdPlacementValid = false;

                                //Deposit Half In Player's Bank
                                if (Banker.DepositUniqueCurrency(player, typeof(Doubloon), finalDoubloonAmount))
                                {
                                    Doubloon doubloonPile = new Doubloon(finalDoubloonAmount);
                                    player.SendSound(doubloonPile.GetDropSound());
                                    doubloonPile.Delete();

                                    bankDoubloonsValid = true;
                                }

                                //Deposit Other Half in Ship
                                if (ownerBoat.DepositDoubloons(finalDoubloonAmount))
                                {
                                    Doubloon doubloonPile = new Doubloon(finalDoubloonAmount);
                                    player.SendSound(doubloonPile.GetDropSound());
                                    doubloonPile.Delete();

                                    holdPlacementValid = true;
                                }

                                if (shipOwner)
                                {
                                    player.PirateScore += finalDoubloonAmount;
                                    //ownerBoat.doubloonsEarned += finalDoubloonAmount * 2;

                                    if (bankDoubloonsValid && holdPlacementValid)
                                    {
                                        player.SendMessage("You've received " + (finalDoubloonAmount * 2).ToString() + " doubloons for completing a message in a bottle! They have been evenly split between your bank box and your ship's hold.");
                                    }

                                    else if (bankDoubloonsValid && !holdPlacementValid)
                                    {
                                        player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your ship's hold.");
                                    }

                                    else if (!bankDoubloonsValid && holdPlacementValid)
                                    {
                                        player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your bank box.");
                                    }
                                }

                                else
                                {
                                    //ownerBoat.doubloonsEarned += finalDoubloonAmount;
                                    player.PirateScore += finalDoubloonAmount;

                                    if (bankDoubloonsValid)
                                    {
                                        player.SendMessage("You've earned " + finalDoubloonAmount.ToString() + " doubloons for completing a message in a bottle! They have been placed in your bank box.");
                                    }

                                    else
                                    {
                                        player.SendMessage("You've earned doubloons, but there was not enough room to place all of them in your bank box.");
                                    }
                                }
                            }
                        }

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from, _i, _d, _b, _r));
        }
Пример #3
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.InRange(p3D, 6))
            {
                from.SendLocalizedMessage(500976); // You need to be closer to the water to fish!
            }
            else if (!from.InLOS(obj))
            {
                from.SendLocalizedMessage(500979); // You cannot see that location.
            }
            else if (RequireDeepWater ? FullValidation(map, x, y) : (ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z)))
            {
                Point3D p = new Point3D(x, y, z);

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

                BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map);

                PlayerMobile player = from as PlayerMobile;

                if (ownerBoat != null && player != null)
                {
                    if (ownerBoat.IsFriend(player) || ownerBoat.IsOwner(player) || ownerBoat.IsCoOwner(player))
                    {
                        double doubloonValue = Utility.RandomMinMax(5, 10);

                        int finalDoubloonAmount = (int)doubloonValue;

                        bool shipOwner          = ownerBoat.IsOwner(player);
                        bool bankDoubloonsValid = false;
                        bool holdPlacementValid = false;

                        //Deposit Half In Player's Bank
                        if (Banker.DepositUniqueCurrency(player, typeof(Doubloon), finalDoubloonAmount))
                        {
                            Doubloon doubloonPile = new Doubloon(finalDoubloonAmount);
                            player.SendSound(doubloonPile.GetDropSound());
                            doubloonPile.Delete();

                            bankDoubloonsValid = true;
                        }

                        //Deposit Other Half in Ship
                        if (ownerBoat.DepositDoubloons(finalDoubloonAmount))
                        {
                            Doubloon doubloonPile = new Doubloon(finalDoubloonAmount);
                            player.SendSound(doubloonPile.GetDropSound());
                            doubloonPile.Delete();

                            holdPlacementValid = true;
                        }

                        if (shipOwner)
                        {
                            player.PirateScore += finalDoubloonAmount;
                            //ownerBoat.doubloonsEarned += finalDoubloonAmount * 2;

                            if (bankDoubloonsValid && holdPlacementValid)
                            {
                                player.SendMessage("You've received " + (finalDoubloonAmount * 2).ToString() + " doubloons for using a net! They have been evenly split between your bank box and your ship's hold.");
                            }

                            else if (bankDoubloonsValid && !holdPlacementValid)
                            {
                                player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your ship's hold.");
                            }

                            else if (!bankDoubloonsValid && holdPlacementValid)
                            {
                                player.SendMessage("You've earned " + (finalDoubloonAmount * 2).ToString() + " doubloons, however there was not enough room to place all of them in your bank box.");
                            }
                        }

                        else
                        {
                            player.PirateScore += finalDoubloonAmount;
                            //ownerBoat.doubloonsEarned += finalDoubloonAmount;

                            if (bankDoubloonsValid)
                            {
                                player.SendMessage("You've earned " + finalDoubloonAmount.ToString() + " doubloons for using a net! They have been placed in your bank box.");
                            }
                            else
                            {
                                player.SendMessage("You've earned doubloons, but there was not enough room to place all of them in your bank box.");
                            }
                        }
                    }
                }

                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);

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

                from.SendLocalizedMessage(RequireDeepWater ? 1010487 : 1074492); // You plunge the net into the sea... / You plunge the net into the water...
            }
            else
            {
                from.SendLocalizedMessage(RequireDeepWater ? 1010485 : 1074491); // You can only use this net in deep water! / You can only use this net in water!
            }
        }