public virtual bool DoOrderTransfer()
{
if (m_Mobile.IsDeadPet)
return true;
Mobile from = m_Mobile.ControlMaster;
Mobile to = m_Mobile.ControlTarget;
if (from != to && from != null && !from.Deleted && to != null && !to.Deleted && to.Player)
{
m_Mobile.DebugSay("Begin transfer with {0}", to.Name);
if (!m_Mobile.CanBeControlledBy(to))
{
string args = String.Format("{0}\t{1}\t ", to.Name, from.Name);
from.SendLocalizedMessage(1043248, args); // The pet refuses to be transferred because it will not obey ~1_NAME~.~3_BLANK~
to.SendLocalizedMessage(1043249, args); // The pet will not accept you as a master because it does not trust you.~3_BLANK~
}
else if (!m_Mobile.CanBeControlledBy(from))
{
string args = String.Format("{0}\t{1}\t ", to.Name, from.Name);
from.SendLocalizedMessage(1043250, args); // The pet refuses to be transferred because it will not obey you sufficiently.~3_BLANK~
to.SendLocalizedMessage(1043251, args); // The pet will not accept you as a master because it does not trust ~2_NAME~.~3_BLANK~
}
else if (TransferItem.IsInCombat(m_Mobile))
{
from.SendMessage("You may not transfer a pet that has recently been in combat.");
to.SendMessage("The pet may not be transfered to you because it has recently been in combat.");
}
else
{
NetState fromState = from.NetState, toState = to.NetState;
if (fromState != null && toState != null)
{
if (from.HasTrade)
{
from.SendLocalizedMessage(1010507); // You cannot transfer a pet with a trade pending
}
else if (to.HasTrade)
{
to.SendLocalizedMessage(1010507); // You cannot transfer a pet with a trade pending
}
else
{
Container c = fromState.AddTrade(toState);
c.DropItem(new TransferItem(m_Mobile));
}
}
}
}
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stay;
return true;
}