protected override void OnTarget( Mobile from, object targeted )
{
if ( !m_Crystal.IsAccessibleTo( from ) )
return;
if ( from.Map != m_Crystal.Map || !from.InRange( m_Crystal.GetWorldLocation(), 2 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
if ( targeted == m_Crystal )
{
if ( m_Crystal.Active )
{
m_Crystal.Active = false;
from.SendLocalizedMessage( 500672 ); // You turn the crystal off.
}
else
{
m_Crystal.Active = true;
from.SendLocalizedMessage( 500673 ); // You turn the crystal on.
}
}
else if ( targeted == from )
{
if ( m_Crystal.Sender != null )
{
m_Crystal.Sender = null;
from.SendLocalizedMessage( 1010044 ); // You unlink the receiver crystal.
}
else
{
from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked.
}
}
else
{
Item targItem = targeted as Item;
if ( targItem != null && targItem.VerifyMove( from ) )
{
CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() );
if ( info != null )
{
from.SendLocalizedMessage( 500677 ); // This crystal cannot be recharged.
return;
}
}
from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked.
}
}
}