Beispiel #1
1
		public override bool OnDragDropInto( Mobile from, Item dropped, Point3D point )
		{
			BasePiece piece = dropped as BasePiece;

			if ( piece != null && piece.Board == this && base.OnDragDropInto( from, dropped, point ) )
			{
				Packet p = new PlaySound( 0x127, GetWorldLocation() );

				p.Acquire();

				if ( RootParent == from )
				{
					from.Send( p );
				}
				else
				{
					foreach ( NetState state in this.GetClientsInRange( 2 ) )
						state.Send( p );
				}

				p.Release();

				return true;
			}
			else
			{
				return false;
			}
		}
Beispiel #2
0
        private static void PlaySound( Mobile m, int index, bool toAll )
        {
            Map map = m.Map;

            if ( map == null )
                return;

            CommandLogging.WriteLine( m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format( m ), index, toAll );

            Packet p = new PlaySound( index, m.Location );

            p.Acquire();

            foreach ( NetState state in m.GetClientsInRange( 12 ) )
            {
                if ( toAll || state.Mobile.CanSee( m ) )
                    state.Send( p );
            }

            p.Release();
        }
Beispiel #3
0
		public override bool OnDragDropInto( Mobile from, Item dropped, Point3D point )
		{
			BasePiece piece = dropped as BasePiece;

			if ( piece != null && piece.Board == this && base.OnDragDropInto( from, dropped, point ) )
			{
				Packet p = new PlaySound( 0x127, GetWorldLocation() );

                p.Acquire();

				if ( RootParent == from )
				{
					from.Send( p );
				}
				else
				{
					IPooledEnumerable eable = this.GetClientsInRange( 2 );
					foreach ( NetState state in eable)
						state.Send( p );
					eable.Free();
				}

                p.Release();
                
                return true;
			}
			/*
			else
			{
				// Adam: anything other than a scroll will get dropped into your backpack
				// (so your best sword doesn't get dropped on the ground.)
				from.AddToBackpack( dropped );
				//	For richness, we add the drop sound of the item dropped.
				from.PlaySound( dropped.GetDropSound() );
				return true;
			}
			*/
			
			return false;
		}
Beispiel #4
0
		/// <summary>
		/// Plays a sound to all mobiles within 20 tiles of the NPC emitting it
		/// </summary>
		/// <param name="m">The NPC producing the sound</param>
		/// <param name="sound">The sound to play</param>
		public void PlaySound( ChessMobile m, int sound )
		{
			if ( m == null )
				return;

			Packet p = new PlaySound( sound, m.Location );

			p.Acquire();

			foreach( NetState state in m.GetClientsInRange( 12 ) )
				if ( state.Mobile.CanSee( m ) )
					state.Send( p );

			p.Release();
		}