Exemple #1
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
				{
					foreach ( NetState state in this.GetClientsInRange( 2 ) )
						state.Send( p );
				}

				p.Release();

				return true;
			}
			else
			{
				return false;
			}
		}
		public static void PlaySound( IPoint3D p, Map map, int soundID )
		{
			if ( soundID == -1 )
				return;

			if ( map != null )
			{
				Packet playSound = null;

				IPooledEnumerable eable = map.GetClientsInRange( new Point3D( p ) );

				foreach ( NetState state in eable )
				{
					state.Mobile.ProcessDelta();

					if ( playSound == null )
						playSound = new PlaySound( soundID, p );

					state.Send( playSound );
				}

				eable.Free();
			}
		}
Exemple #3
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();
        }
        public static void SendBoltEffect( IEntity e, bool sound, int hue )
        {
            Map map = e.Map;

            if ( map == null )
                return;

            if ( e is Item )
                ((Item)e).ProcessDelta();
            else if ( e is Mobile )
                ((Mobile)e).ProcessDelta();

            Packet preEffect = null, boltEffect = null, playSound = null;

            IPooledEnumerable eable = map.GetClientsInRange( e.Location );

            foreach ( NetState state in eable )
            {
                if ( state.Mobile.CanSee( e ) )
                {
                    if ( SendParticlesTo( state ) )
                    {
                        if ( preEffect == null )
                            preEffect = new TargetParticleEffect( e, 0, 10, 5, 0, 0, 5031, 3, 0 );

                        state.Send( preEffect );
                    }

                    if ( boltEffect == null )
                        boltEffect = new BoltEffect( e, hue );

                    state.Send( boltEffect );

                    if ( sound )
                    {
                        if ( playSound == null )
                            playSound = new PlaySound( 0x29, e );

                        state.Send( playSound );
                    }
                }
            }

            eable.Free();
        }
		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;
			int snd;
			int[] g_Sounds = new int[10];

			for ( int i = 0;  i < 10; i++ )
			{
				TextRelay entry = info.GetTextEntry( i );

				if ( entry != null && entry.Text.Length > 0 )
					g_Sounds[i] = Utility.ToInt32( entry.Text );
				else
					g_Sounds[i] = -1;
			}

			switch( info.ButtonID )
			{
				case 0: // Cancel
					break;
				case 1: // Okay
				{
					m_Sounder.Sounds = g_Sounds;
					break;
				}
				case 2: // Show Properties Page
				{
					if ( from.AccessLevel >= AccessLevel.GameMaster )
						from.SendGump( new PropertiesGump( from, m_Sounder ) );

					break;
				}
				case 3: // Sort the Array
				{
					for ( int i = 0;  i < 10; i++ )
						if ( g_Sounds[i] < 0 ) g_Sounds[i] = Int32.MaxValue;

					Array.Sort( g_Sounds );

					for ( int i = 0;  i < 10; i++ )
						if ( g_Sounds[i] == Int32.MaxValue ) g_Sounds[i] = -1;

					from.SendGump( new SounderGump( m_Owner, m_Sounder, g_Sounds ) );
					break;
				}
				default:
				{
					int index = info.ButtonID;

					if ( index >= 20 ) // Play sound for Designer only
					{
						index -= 20;
						TextRelay entry = info.GetTextEntry( index );

						if ( entry != null && entry.Text.Length > 0 )
						{
							snd = g_Sounds[index];

							Packet p = new PlaySound( snd, m_Sounder.Location );
							m_Owner.Send( p );
						}
					}
					else // Delete an entry
					{
						index -= 10;
						g_Sounds[index] = -1;
					}

					from.SendGump( new SounderGump( m_Owner, m_Sounder, g_Sounds ) );
					break;
				}
			}
		}
Exemple #6
0
        public void PlaySound( int soundID )
        {
            if ( soundID == -1 )
                return;

            if ( m_Map != null )
            {
                Packet p = null;

                IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location );

                foreach ( NetState state in eable )
                {
                    if ( state.Mobile.CanSee( this ) )
                    {
                        if ( p == null )
                            p = new PlaySound( soundID, this );

                        state.Send( p );
                    }
                }

                eable.Free();
            }
        }
Exemple #7
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;
		}
		/// <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();
		}