public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if ( e.Handled || !from.Alive || from.GetDistanceToSqrt( this ) > 3 )
return;
if ( e.HasKeyword( 0x3C ) || (e.HasKeyword( 0x171 ) && WasNamed( e.Speech )) ) // vendor buy, *buy*
{
if ( IsOwner( from ) )
{
SayTo( from, 503212 ); // You own this shop, just take what you want.
}
else if ( House == null || !House.IsBanned( from ) )
{
from.SendLocalizedMessage( 503213 ); // Select the item you wish to buy.
from.Target = new PVBuyTarget();
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3D ) || (e.HasKeyword( 0x172 ) && WasNamed( e.Speech )) ) // vendor browse, *browse
{
if ( House != null && House.IsBanned( from ) && !IsOwner( from ) )
{
SayTo( from, 1062674 ); // You can't shop from this home as you have been banned from this establishment.
}
else
{
if ( WasNamed( e.Speech ) )
OpenBackpack( from );
else
{
IPooledEnumerable mobiles = e.Mobile.GetMobilesInRange( 2 );
foreach ( Mobile m in mobiles )
if ( m is PlayerVendor && m.CanSee( e.Mobile ) && m.InLOS( e.Mobile ) )
((PlayerVendor)m).OpenBackpack( from );
mobiles.Free();
}
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3E ) || (e.HasKeyword( 0x173 ) && WasNamed( e.Speech )) ) // vendor collect, *collect
{
if ( IsOwner( from ) )
{
CollectGold( from );
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3F ) || (e.HasKeyword( 0x174 ) && WasNamed( e.Speech )) ) // vendor status, *status
{
if ( IsOwner( from ) )
{
SendOwnerGump( from );
e.Handled = true;
}
else
{
SayTo( from, 503226 ); // What do you care? You don't run this shop.
}
}
else if ( e.HasKeyword( 0x40 ) || (e.HasKeyword( 0x175 ) && WasNamed( e.Speech )) ) // vendor dismiss, *dismiss
{
if ( IsOwner( from ) )
{
Dismiss( from );
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x41 ) || (e.HasKeyword( 0x176 ) && WasNamed( e.Speech )) ) // vendor cycle, *cycle
{
if ( IsOwner( from ) )
{
this.Direction = this.GetDirectionTo( from );
e.Handled = true;
}
}
}