public override void StartTeleport(Mobile m) { if (T2AAccess.HasAccess(m)) { base.StartTeleport(m); } else { m.SendMessage("T2A Access is disabled at this time."); } }
public override void OnSpeech( SpeechEventArgs e ) { Mobile from = e.Mobile; if ( !e.Handled && from.InRange( this, 10 ) && e.Speech.ToLower() == this.Word ) { BaseShip ship = BaseShip.FindShipAt( from, from.Map ); if ( ship == null ) return; if ( !this.Active ) { if ( ship.TillerMan != null ) ship.TillerMan.Say( 502507 ); // Ar, Legend has it that these pillars are inactive! No man knows how it might be undone! return; } if (T2AAccess.IsT2A(m_Destination.Start, from.Map)) { if (ship.Map != null && ship.Map != Map.Internal) { MultiComponentList mcl = ship.Components; IPooledEnumerable eable = ship.Map.GetClientsInBounds(new Rectangle2D(ship.X + mcl.Min.X, ship.Y + mcl.Min.Y, mcl.Width, mcl.Height)); foreach (NetState ns in eable) if (ns != null && ns.Mobile != null && ship.Contains((Mobile)ns.Mobile) && !T2AAccess.HasAccess(ns.Mobile)) { eable.Free(); from.SendMessage("One or more players on board does not have access to T2A at this time."); return; } eable.Free(); } } Map map = from.Map; for ( int i = 0; i < 5; i++ ) // Try 5 times { int x = Utility.Random( Destination.X, Destination.Width ); int y = Utility.Random( Destination.Y, Destination.Height ); int z = map.GetAverageZ( x, y ); Point3D dest = new Point3D( x, y, z ); if ( ship.CanFit( dest, map, ship.ItemID ) ) { int xOffset = x - ship.X; int yOffset = y - ship.Y; int zOffset = z - ship.Z; ship.Teleport( xOffset, yOffset, zOffset ); return; } } if ( ship.TillerMan != null ) ship.TillerMan.Say( 502508 ); // Ar, I refuse to take that matey through here! } }