Beispiel #1
0
 public static void RemoveCrate(ShipCrate crate)
 {
     if (m_Crates.Contains(crate))
     {
         m_Crates.Remove(crate);
     }
 }
Beispiel #2
0
        public void TryRetrieveHold(Mobile from, BaseBoat boat)
        {
            for (int i = 0; i < m_Crates.Count; i++)
            {
                if (m_Crates[i].Owner == from)
                {
                    from.SendLocalizedMessage(1116516); //Thou must return thy current shipping crate before I can retrieve another shipment for you.
                    return;
                }
            }

            Container pack = from.Backpack;
            Container hold;

            if (boat is BaseGalleon galleon)
            {
                hold = galleon.GalleonHold;
            }
            else
            {
                hold = boat.Hold;
            }

            if (hold == null || hold.Items.Count == 0)
            {
                from.SendMessage("Your hold is empty!");
                return;
            }

            ShipCrate crate = new ShipCrate(from, boat);

            m_Crates.Add(crate);

            if (!pack.ConsumeTotal(typeof(Gold), DryDockAmount))
            {
                Banker.Withdraw(from, DryDockAmount);
            }

            bool        cantMove = false;
            List <Item> items    = new List <Item>(hold.Items);

            foreach (Item item in items)
            {
                if (item.Movable)
                {
                    crate.DropItem(item);
                }
                else
                {
                    cantMove = true;
                }
            }

            Point3D pnt = Point3D.Zero;

            if (!CanDropCrate(ref pnt, Map))
            {
                SayTo(from, 1116517); //Arrrgh!  My dock has no more room.  Please come back later.
                from.BankBox.DropItem(crate);
                from.SendMessage("Your shipping crate has been placed in your bank box.");
                //from.SendMessage("You have 30 minutes to obtain the contents of your shipping crate.  You can find it in the wearhouse on the westernmost tip of the floating emproiam");
            }
            else
            {
                from.SendLocalizedMessage(1116542, ShipCrate.DT.ToString()); //Yer ship has been unloaded to a crate inside this here warehouse.  You have ~1_time~ minutes to get yer goods or it be gone.
                crate.MoveToWorld(pnt, Map);
            }

            if (cantMove)
            {
                from.SendMessage("We were unable to pack up one or more of the items in your cargo hold.");
            }
        }