public override void OnResponse( Mobile from, string text )
{
object toSet;
bool shouldSet;
try
{
int serial = Utility.ToInt32( text );
toSet = World.FindEntity( serial );
if ( toSet == null )
{
shouldSet = false;
m_Mobile.SendMessage( "No object with that serial was found." );
}
else if ( !m_Type.IsAssignableFrom( toSet.GetType() ) )
{
toSet = null;
shouldSet = false;
m_Mobile.SendMessage( "The object with that serial could not be assigned to a property of type : {0}", m_Type.Name );
}
else
{
shouldSet = true;
}
}
catch
{
toSet = null;
shouldSet = false;
m_Mobile.SendMessage( "Bad format" );
}
if ( shouldSet )
{
try
{
CommandLogging.LogChangeProperty( m_Mobile, m_Object, m_Property.Name, toSet==null?"(null)":toSet.ToString() );
m_Property.SetValue( m_Object, toSet, null );
PropertiesGump.OnValueChanged( m_Object, m_Property, m_Stack );
}
catch
{
m_Mobile.SendMessage( "An exception was caught. The property may not have changed." );
}
}
m_Mobile.SendGump( new SetObjectGump( m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List ) );
}
}