public InternalTimer( TimeSpan delay, MovingBox box, Mobile from ) : base( delay ) { Priority = TimerPriority.FiveSeconds; BOX = box; m_Expire = DateTime.Now + delay; m_owner = from; }
public static void SummonBox( Mobile from, bool exist ) { BaseHouse house = BaseHouse.FindHouseAt( from ); bool found = false; if ( house == null ) from.SendMessage( "You must be in your house to do this!" ); else if ( !house.IsOwner( from ) ) from.SendMessage( "You may only do this in your own house!" ); else if ( !exist ) { Account acct = (Account)from.Account; Point3D targ = new Point3D( from.X + 1,from.Y + 1, from.Z ); Effects.SendLocationEffect( targ, from.Map, 0x376A, 50 ); from.PlaySound( 0x5C3 ); MovingBox box = new MovingBox( from ); box.Map = from.Map; box.Location = targ; box.Owner = from; box.InWorld = true; box.End = DateTime.Now + TimeSpan.FromDays( 2.0 ); acct.SetTag( "Crate", box.Serial.ToString() ); from.SendMessage( "You have summoned a moving chest, you must complete your move within 2 days!" ); } else { ArrayList list = new ArrayList( World.Items.Values ); foreach ( Item item in list ) { if ( item is MovingBox ) { MovingBox box = (MovingBox)item; if ( !box.InWorld && box.Map == Map.Internal && box.Owner == from ) { Point3D targ = new Point3D( from.X + 1,from.Y + 1, from.Z ); Effects.SendLocationEffect( targ, from.Map, 0x376A, 50 ); from.PlaySound( 0x5C3 ); box.Map = from.Map; box.Location = targ; box.InWorld = true; found = true; TimeSpan time = box.End - DateTime.Now; from.SendMessage( "You have summoned your moving chest, time left {0} Days, {1} Hours, {2} Minutes, {3} Seconds", time.Days, time.Hours, time.Minutes, time.Seconds ); break; } } } if ( !found ) from.SendMessage( "You either have no moving chest or it has decayed!" ); } }