private void SendServerToServerTell(uint SenderObjectId, GamePlayer SenderPlayer, GamePlayer RecipientPlayer, string Message)
{
GameServer DestinationServer = RecipientPlayer.GetOnlineServer();
Database.ACR_IncrementStatistic("SERVER_TELLS");
SetLastTellToPlayerId(SenderObjectId, RecipientPlayer.PlayerId);
if (!RecipientPlayer.IsOnline() || DestinationServer == null)
{
SendFeedbackError(SenderObjectId, "That player is not logged on.");
return;
}
#if DEBUG_MODE
//
// Debug mode always sends through the IPC queue for better
// testing.
//
#else
//
// If this is a local server tell, dispatch it locally.
//
if (DestinationServer.ServerId == Database.ACR_GetServerID())
{
foreach (uint PlayerObject in GetPlayers(true))
{
if (Database.ACR_GetPlayerID(PlayerObject) != SenderPlayer.PlayerId)
continue;
//
// Note, we call the chat callback for the first event for
// two reasons:
//
// 1) Let the RP XP script notice the activity.
// 2) Set the last tell to/from player ids.
//
SendChatMessage(SenderObjectId, PlayerObject, CHAT_MODE_TELL, Message, TRUE);
return;
}
SendFeedbackError(SenderObjectId, "Internal error - attempted to re-route tell to local player, but player wasn't actually on this server.");
return;
}
#endif
if (Database.ACR_GetIsPCQuarantined(SenderObjectId))
{
//
// Since a player in quarantine is not marked as online, a
// remote server may choose to discard a tell initiated while
// in quarantine. Warn the player of this.
//
SendFeedbackError(SenderObjectId, "Warning: Cross-server tells may not be delivered when in quarantine.");
}
//
// Otherwise, enqueue it, breaking large tells up into multiple
// smaller tells if need be.
//
while (!String.IsNullOrEmpty(Message))
{
string MessagePart;
if (Message.Length > ACR_SERVER_IPC_MAX_EVENT_LENGTH)
{
MessagePart = Message.Substring(0, ACR_SERVER_IPC_MAX_EVENT_LENGTH);
Message = Message.Substring(ACR_SERVER_IPC_MAX_EVENT_LENGTH);
}
else
{
MessagePart = Message;
Message = null;
}
SignalIPCEvent(
SenderPlayer.PlayerId,
Database.ACR_GetServerID(),
RecipientPlayer.PlayerId,
DestinationServer.ServerId,
GameWorldManager.ACR_SERVER_IPC_EVENT_CHAT_TELL,
MessagePart);
SendChatMessage(
OBJECT_INVALID,
SenderObjectId,
CHAT_MODE_SERVER,
String.Format("<c=#FFCC99>{0}: </c><c=#30DDCC>[ServerTell] {1}</c>", GetName(SenderObjectId), MessagePart),
FALSE);
}
SetLocalInt(SenderObjectId, "ACR_XP_RPXP_ACTIVE", TRUE);
}