Ejemplo n.º 1
0
        public override Item Construct(Type type, Mobile from, Item tool)
        {
            // Searing Weapon Support, handled elsewhere
            if (type == typeof(BaseWeapon))
            {
                return(null);
            }

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

            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 == Map.Felucca || from.Map == Map.Trammel) && from.InRange(sos.TargetLocation, 60))
                    {
                        Item preLoot = null;
                        bool dredge  = HasTypeHook(tool, HookType.Dredging);

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

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

                        case 2:     // Bone parts
                        case 3:
                        {
                            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), dredge);
                            break;
                        }

                        case 4:     // Paintings and portraits
                        case 5:
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10), dredge);
                            break;
                        }

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

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

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

                            break;
                        }

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

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

                            break;
                        }

                            #region High Seas
                        case 14:
                        {
                            int[] list = new int[]
                            {
                                0x1E19, 0x1E1A, 0x1E1B,         //Fish heads
                                0x1E2A, 0x1E2B,                 //Oars
                                0x1E71, 0x1E7A,                 //Unfinished drawers
                                0x1E75,                         //Unfinished legs
                            };

                            double ran = Utility.RandomDouble();

                            if (ran < 0.05)
                            {
                                preLoot = new YellowPolkaDotBikini();
                            }
                            else if (ran < 0.25)
                            {
                                preLoot = new ShipwreckedItem(list[Utility.RandomMinMax(3, 7)], dredge);
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(list[Utility.Random(3)], dredge);
                            }
                            break;
                        }
                            #endregion
                        }

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

                            return(preLoot);
                        }

                        LockableContainer chest;

                        if (0.01 > Utility.RandomDouble())
                        {
                            chest = new ShipsStrongbox(sos.Level);
                        }
                        else
                        {
                            switch (sos.Level)
                            {
                            case 0: chest = new SOSChest(Utility.RandomBool() ? 0xE43 : 0xE41); break;

                            case 1: chest = new SOSChest(0xA306); break;

                            case 2: chest = new SOSChest(Utility.RandomBool() ? 0xE43 : 0xE41); break;

                            case 3: chest = new SOSChest(0xA308); break;

                            default:
                                if (.33 > Utility.RandomDouble())
                                {
                                    chest = new SOSChest(0xA30A);
                                }
                                else
                                {
                                    chest     = new SOSChest(Utility.RandomBool() ? 0xE41 : 0xE43);
                                    chest.Hue = 0x481;
                                }
                                break;
                            }
                        }

                        TreasureMapChest.Fill(from, chest, Math.Max(1, Math.Min(4, sos.Level)), true);
                        sos.OnSOSComplete(chest);

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

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

                        chest.IsShipwreckedItem = true;

                        sos.Delete();

                        return(chest);
                    }
                }
            }

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