예제 #1
0
        public static void PickInstrument(Mobile from, InstrumentPickedCallback callback)
        {
            BaseInstrument instrument = GetInstrument(from);

            if (instrument != null)
            {
                if (callback != null)
                {
                    callback(from, instrument);
                }
            }
            else
            {
                from.SendLocalizedMessage(500617); // What instrument shall you play?
                from.BeginTarget(1, false, TargetFlags.None, new TargetStateCallback(OnPickedInstrument), callback);
            }
        }
예제 #2
0
        public static void OnPickedInstrument(Mobile from, object targeted, object state)
        {
            BaseInstrument instrument = targeted as BaseInstrument;

            if (instrument == null)
            {
                from.SendLocalizedMessage(500619); // That is not a musical instrument.
            }
            else
            {
                SetInstrument(from, instrument);

                InstrumentPickedCallback callback = state as InstrumentPickedCallback;

                if (callback != null)
                {
                    callback(from, instrument);
                }
            }
        }
예제 #3
0
        public static void PickInstrument(Mobile from, InstrumentPickedCallback callback)
        {
            bool           releaseLock = true;
            BaseInstrument instrument  = GetInstrument(from);

            if (instrument != null)
            {
                if (callback != null)
                {
                    callback(from, instrument);
                }
            }
            else
            {
                from.SendLocalizedMessage(500617);                   // What instrument shall you play?
                from.BeginTarget(1, false, TargetFlags.None, OnPickedInstrument, callback);
            }

            if (releaseLock && from is PlayerMobile)
            {
                ((PlayerMobile)from).EndPlayerAction();
            }
        }
예제 #4
0
		public static void PickInstrument( Mobile from, InstrumentPickedCallback callback )
		{
			BaseInstrument instrument = GetInstrument( from );

			if ( instrument != null )
			{
				if ( callback != null )
					callback( from, instrument );
			}
			else
			{
				from.SendLocalizedMessage( 500617 ); // What instrument shall you play?
				from.BeginTarget( 1, false, TargetFlags.None, new TargetStateCallback( OnPickedInstrument ), callback );
			}
		}
예제 #5
0
		public static void PickInstrument( Mobile from, InstrumentPickedCallback callback )
		{
            bool releaseLock = true;
			BaseInstrument instrument = GetInstrument( from );

			if ( instrument != null )
			{
				if ( callback != null )
					callback( from, instrument );
			}
			else
			{
				from.SendLocalizedMessage( 500617 ); // What instrument shall you play?
				from.BeginTarget( 1, false, TargetFlags.None, OnPickedInstrument, callback );
			}

            if (releaseLock && from is PlayerMobile)
                ((PlayerMobile)from).EndPlayerAction();
		}