mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 22:06:46 +00:00
[UCS] Auto Client Reconnection (#2154)
This commit is contained in:
@@ -10971,3 +10971,80 @@ uint16 Client::GetClassTrackingDistanceMultiplier(uint16 class_) {
|
||||
bool Client::CanThisClassTrack() {
|
||||
return (GetClassTrackingDistanceMultiplier(GetClass()) > 0) ? true : false;
|
||||
}
|
||||
|
||||
void Client::ReconnectUCS()
|
||||
{
|
||||
EQApplicationPacket *outapp = nullptr;
|
||||
std::string buffer;
|
||||
std::string mail_key = database.GetMailKey(CharacterID(), true);
|
||||
EQ::versions::UCSVersion connection_type = EQ::versions::ucsUnknown;
|
||||
|
||||
// chat server packet
|
||||
switch (ClientVersion()) {
|
||||
case EQ::versions::ClientVersion::Titanium:
|
||||
connection_type = EQ::versions::ucsTitaniumChat;
|
||||
break;
|
||||
case EQ::versions::ClientVersion::SoF:
|
||||
connection_type = EQ::versions::ucsSoFCombined;
|
||||
break;
|
||||
case EQ::versions::ClientVersion::SoD:
|
||||
connection_type = EQ::versions::ucsSoDCombined;
|
||||
break;
|
||||
case EQ::versions::ClientVersion::UF:
|
||||
connection_type = EQ::versions::ucsUFCombined;
|
||||
break;
|
||||
case EQ::versions::ClientVersion::RoF:
|
||||
connection_type = EQ::versions::ucsRoFCombined;
|
||||
break;
|
||||
case EQ::versions::ClientVersion::RoF2:
|
||||
connection_type = EQ::versions::ucsRoF2Combined;
|
||||
break;
|
||||
default:
|
||||
connection_type = EQ::versions::ucsUnknown;
|
||||
break;
|
||||
}
|
||||
|
||||
buffer = StringFormat(
|
||||
"%s,%i,%s.%s,%c%s",
|
||||
Config->ChatHost.c_str(),
|
||||
Config->ChatPort,
|
||||
Config->ShortName.c_str(),
|
||||
GetName(),
|
||||
connection_type,
|
||||
mail_key.c_str()
|
||||
);
|
||||
|
||||
outapp = new EQApplicationPacket(OP_SetChatServer, (buffer.length() + 1));
|
||||
memcpy(outapp->pBuffer, buffer.c_str(), buffer.length());
|
||||
outapp->pBuffer[buffer.length()] = '\0';
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
// mail server packet
|
||||
switch (ClientVersion()) {
|
||||
case EQ::versions::ClientVersion::Titanium:
|
||||
connection_type = EQ::versions::ucsTitaniumMail;
|
||||
break;
|
||||
default:
|
||||
// retain value from previous switch
|
||||
break;
|
||||
}
|
||||
|
||||
buffer = StringFormat(
|
||||
"%s,%i,%s.%s,%c%s",
|
||||
Config->MailHost.c_str(),
|
||||
Config->MailPort,
|
||||
Config->ShortName.c_str(),
|
||||
GetName(),
|
||||
connection_type,
|
||||
mail_key.c_str()
|
||||
);
|
||||
|
||||
outapp = new EQApplicationPacket(OP_SetChatServer2, (buffer.length() + 1));
|
||||
memcpy(outapp->pBuffer, buffer.c_str(), buffer.length());
|
||||
outapp->pBuffer[buffer.length()] = '\0';
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user