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); } }
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); } } }
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(); } }
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 ); } }
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(); }