Esempio n. 1
0
        public override bool CheckResources(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed)
        {
            Container pack = from.Backpack;

            if (pack != null)
            {
                Item[] messages = pack.FindItemsByType(typeof(SOS));

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

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60))
                    {
                        return(true);
                    }
                }

                Item[] amessages = pack.FindItemsByType(typeof(AncientSOS));

                for (int i = 0; i < amessages.Length; ++i)
                {
                    AncientSOS asos = (AncientSOS)amessages[i];

                    if (from.Map == asos.TargetMap && from.InRange(asos.TargetLocation, 60))
                    {
                        return(true);
                    }
                }
            }

            return(base.CheckResources(from, tool, def, map, loc, timed));
        }
Esempio n. 2
0
        public override Item Construct(Type type, Mobile from)
        {
            if (type == typeof(TreasureMap))
            {
                int level;
                if (from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland(from))
                {
                    level = 0;
                }
                else
                {
                    level = 1;
                }

                return(new TreasureMap(level, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }
            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(SafeMap(from.Map)));
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                Item[] messages = pack.FindItemsByType(typeof(SOS));

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

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60))
                    {
                        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:                                 // Paintings and portraits
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10));
                            break;
                        }

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

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

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

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

                        if (preLoot != null)
                        {
                            return(preLoot);
                        }

                        LockableContainer chest;

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

                        sos.Delete();

                        TreasureMapChest.Fill(chest, Utility.RandomMinMax(1, 3));

                        // TODO: Are there chances on this? All MIB's I've done had nets..
                        chest.DropItem(new SpecialFishingNet());

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

                        return(chest);
                    }
                }

                Item[] amessages = pack.FindItemsByType(typeof(AncientSOS));

                for (int i = 0; i < amessages.Length; ++i)
                {
                    AncientSOS asos = (AncientSOS)amessages[i];

                    if (from.Map == asos.TargetMap && from.InRange(asos.TargetLocation, 60))
                    {
                        asos.Delete();

                        LockableContainer chest;

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

                        TreasureMapChest.Fill(chest, 4);

                        chest.DropItem(new FabledFishingNet());

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

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from));
        }