Streamline UCS

This commit is contained in:
Akkadius 2019-09-02 01:39:52 -05:00
parent bfd0752c4d
commit ccbbadc5ee
10 changed files with 124 additions and 124 deletions

View File

@ -154,7 +154,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
Log(Logs::Detail, Logs::UCSServer, "RemoveChannel(%s)", Channel->GetName().c_str()); LogInfo("RemoveChannel([{}])", Channel->GetName().c_str());
LinkedListIterator<ChatChannel*> iterator(ChatChannels); LinkedListIterator<ChatChannel*> iterator(ChatChannels);
@ -175,7 +175,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
void ChatChannelList::RemoveAllChannels() { void ChatChannelList::RemoveAllChannels() {
Log(Logs::Detail, Logs::UCSServer, "RemoveAllChannels"); LogInfo("RemoveAllChannels");
LinkedListIterator<ChatChannel*> iterator(ChatChannels); LinkedListIterator<ChatChannel*> iterator(ChatChannels);
@ -233,7 +233,7 @@ void ChatChannel::AddClient(Client *c) {
if(IsClientInChannel(c)) { if(IsClientInChannel(c)) {
Log(Logs::Detail, Logs::UCSServer, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); LogInfo("Client [{}] already in channel [{}]", c->GetName().c_str(), GetName().c_str());
return; return;
} }
@ -242,7 +242,7 @@ void ChatChannel::AddClient(Client *c) {
int AccountStatus = c->GetAccountStatus(); int AccountStatus = c->GetAccountStatus();
Log(Logs::Detail, Logs::UCSServer, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LogInfo("Adding [{}] to channel [{}]", c->GetName().c_str(), Name.c_str());
LinkedListIterator<Client*> iterator(ClientsInChannel); LinkedListIterator<Client*> iterator(ClientsInChannel);
@ -267,7 +267,7 @@ bool ChatChannel::RemoveClient(Client *c) {
if(!c) return false; if(!c) return false;
Log(Logs::Detail, Logs::UCSServer, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); LogInfo("RemoveClient [{}] from channel [{}]", c->GetName().c_str(), GetName().c_str());
bool HideMe = c->GetHideMe(); bool HideMe = c->GetHideMe();
@ -304,7 +304,7 @@ bool ChatChannel::RemoveClient(Client *c) {
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
return false; return false;
Log(Logs::Detail, Logs::UCSServer, "Starting delete timer for empty password protected channel %s", Name.c_str()); LogInfo("Starting delete timer for empty password protected channel [{}]", Name.c_str());
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
} }
@ -505,7 +505,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client
return nullptr; return nullptr;
} }
Log(Logs::Detail, Logs::UCSServer, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); LogInfo("AddClient to channel [[{}]] with password [[{}]]", NormalisedName.c_str(), Password.c_str());
ChatChannel *RequiredChannel = FindChannel(NormalisedName); ChatChannel *RequiredChannel = FindChannel(NormalisedName);
@ -597,7 +597,7 @@ void ChatChannel::AddInvitee(const std::string &Invitee)
if (!IsInvitee(Invitee)) { if (!IsInvitee(Invitee)) {
Invitees.push_back(Invitee); Invitees.push_back(Invitee);
Log(Logs::Detail, Logs::UCSServer, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); LogInfo("Added [{}] as invitee to channel [{}]", Invitee.c_str(), Name.c_str());
} }
} }
@ -608,7 +608,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee)
if(it != std::end(Invitees)) { if(it != std::end(Invitees)) {
Invitees.erase(it); Invitees.erase(it);
Log(Logs::Detail, Logs::UCSServer, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); LogInfo("Removed [{}] as invitee to channel [{}]", Invitee.c_str(), Name.c_str());
} }
} }
@ -622,7 +622,7 @@ void ChatChannel::AddModerator(const std::string &Moderator)
if (!IsModerator(Moderator)) { if (!IsModerator(Moderator)) {
Moderators.push_back(Moderator); Moderators.push_back(Moderator);
Log(Logs::Detail, Logs::UCSServer, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); LogInfo("Added [{}] as moderator to channel [{}]", Moderator.c_str(), Name.c_str());
} }
} }
@ -633,7 +633,7 @@ void ChatChannel::RemoveModerator(const std::string &Moderator)
if (it != std::end(Moderators)) { if (it != std::end(Moderators)) {
Moderators.erase(it); Moderators.erase(it);
Log(Logs::Detail, Logs::UCSServer, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); LogInfo("Removed [{}] as moderator to channel [{}]", Moderator.c_str(), Name.c_str());
} }
} }
@ -647,7 +647,7 @@ void ChatChannel::AddVoice(const std::string &inVoiced)
if (!HasVoice(inVoiced)) { if (!HasVoice(inVoiced)) {
Voiced.push_back(inVoiced); Voiced.push_back(inVoiced);
Log(Logs::Detail, Logs::UCSServer, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); LogInfo("Added [{}] as voiced to channel [{}]", inVoiced.c_str(), Name.c_str());
} }
} }
@ -658,7 +658,7 @@ void ChatChannel::RemoveVoice(const std::string &inVoiced)
if (it != std::end(Voiced)) { if (it != std::end(Voiced)) {
Voiced.erase(it); Voiced.erase(it);
Log(Logs::Detail, Logs::UCSServer, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); LogInfo("Removed [{}] as voiced to channel [{}]", inVoiced.c_str(), Name.c_str());
} }
} }

View File

@ -235,7 +235,7 @@ std::vector<std::string> ParseRecipients(std::string RecipientString) {
static void ProcessMailTo(Client *c, std::string MailMessage) { static void ProcessMailTo(Client *c, std::string MailMessage) {
Log(Logs::Detail, Logs::UCSServer, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); LogInfo("MAILTO: From [{}], [{}]", c->MailBoxName().c_str(), MailMessage.c_str());
std::vector<std::string> Recipients; std::vector<std::string> Recipients;
@ -397,7 +397,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandBuddy(Client *c, std::string Buddy) {
Log(Logs::Detail, Logs::UCSServer, "Received buddy command with parameters %s", Buddy.c_str()); LogInfo("Received buddy command with parameters [{}]", Buddy.c_str());
c->GeneralChannelMessage("Buddy list modified"); c->GeneralChannelMessage("Buddy list modified");
uint8 SubAction = 1; uint8 SubAction = 1;
@ -426,7 +426,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) {
static void ProcessCommandIgnore(Client *c, std::string Ignoree) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
Log(Logs::Detail, Logs::UCSServer, "Received ignore command with parameters %s", Ignoree.c_str()); LogInfo("Received ignore command with parameters [{}]", Ignoree.c_str());
c->GeneralChannelMessage("Ignore list modified"); c->GeneralChannelMessage("Ignore list modified");
uint8 SubAction = 0; uint8 SubAction = 0;
@ -482,7 +482,7 @@ Clientlist::Clientlist(int ChatPort) {
const ucsconfig *Config = ucsconfig::get(); const ucsconfig *Config = ucsconfig::get();
Log(Logs::General, Logs::UCSServer, "Loading '%s'", Config->MailOpCodesFile.c_str()); LogInfo("Loading [{}]", Config->MailOpCodesFile.c_str());
if (!ChatOpMgr->LoadOpcodes(Config->MailOpCodesFile.c_str())) if (!ChatOpMgr->LoadOpcodes(Config->MailOpCodesFile.c_str()))
exit(1); exit(1);
@ -567,7 +567,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
if (((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) if (((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName())
&& (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) {
Log(Logs::Detail, Logs::UCSServer, "Removing old connection for %s", c->GetName().c_str()); LogInfo("Removing old connection for [{}]", c->GetName().c_str());
struct in_addr in; struct in_addr in;
@ -670,7 +670,7 @@ void Clientlist::Process()
} }
default: { default: {
Log(Logs::Detail, Logs::UCSServer, "Unhandled chat opcode %8X", opcode); LogInfo("Unhandled chat opcode %8X", opcode);
break; break;
} }
} }
@ -823,7 +823,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
break; break;
case CommandSetMessageStatus: case CommandSetMessageStatus:
Log(Logs::Detail, Logs::UCSServer, "Set Message Status, Params: %s", Parameters.c_str()); LogInfo("Set Message Status, Params: [{}]", Parameters.c_str());
ProcessSetMessageStatus(Parameters); ProcessSetMessageStatus(Parameters);
break; break;
@ -848,7 +848,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
default: default:
c->SendHelp(); c->SendHelp();
Log(Logs::Detail, Logs::UCSServer, "Unhandled OP_Mail command: %s", CommandString.c_str()); LogInfo("Unhandled OP_Mail command: [{}]", CommandString.c_str());
} }
} }
@ -859,7 +859,7 @@ void Clientlist::CloseAllConnections() {
for (Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { for (Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) {
Log(Logs::Detail, Logs::UCSServer, "Removing client %s", (*Iterator)->GetName().c_str()); LogInfo("Removing client [{}]", (*Iterator)->GetName().c_str());
(*Iterator)->CloseConnection(); (*Iterator)->CloseConnection();
} }
@ -868,7 +868,7 @@ void Clientlist::CloseAllConnections() {
void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) {
if (!CharacterName) return; if (!CharacterName) return;
Log(Logs::Detail, Logs::UCSServer, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); LogInfo("Adding character [{}] with ID [{}] for [{}]", CharacterName, CharID, GetName().c_str());
CharacterEntry NewCharacter; CharacterEntry NewCharacter;
NewCharacter.CharID = CharID; NewCharacter.CharID = CharID;
NewCharacter.Name = CharacterName; NewCharacter.Name = CharacterName;
@ -933,7 +933,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) {
for (int i = 0; i < MAX_JOINED_CHANNELS; i++) for (int i = 0; i < MAX_JOINED_CHANNELS; i++)
if (JoinedChannels[i] == nullptr) { if (JoinedChannels[i] == nullptr) {
JoinedChannels[i] = JoinedChannel; JoinedChannels[i] = JoinedChannel;
Log(Logs::Detail, Logs::UCSServer, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); LogInfo("Added Channel [{}] to slot [{}] for [{}]", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
return; return;
} }
} }
@ -974,7 +974,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
} }
} }
Log(Logs::Detail, Logs::UCSServer, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); LogInfo("Client: [{}] joining channels [{}]", GetName().c_str(), ChannelNameList.c_str());
int NumberOfChannels = ChannelCount(); int NumberOfChannels = ChannelCount();
@ -1073,7 +1073,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
void Client::LeaveChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) {
Log(Logs::Detail, Logs::UCSServer, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); LogInfo("Client: [{}] leaving channels [{}]", GetName().c_str(), ChannelNameList.c_str());
std::string::size_type CurrentPos = 0; std::string::size_type CurrentPos = 0;
@ -1249,7 +1249,7 @@ void Client::SendChannelMessage(std::string Message)
std::string ChannelName = Message.substr(1, MessageStart - 1); std::string ChannelName = Message.substr(1, MessageStart - 1);
Log(Logs::Detail, Logs::UCSServer, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); LogInfo("[{}] tells [{}], [[{}]]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@ -1600,7 +1600,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
else else
Message = "Password change on channel " + ChannelName; Message = "Password change on channel " + ChannelName;
Log(Logs::Detail, Logs::UCSServer, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); LogInfo("Set password of channel [[{}]] to [[{}]] by [{}]", ChannelName.c_str(), Password.c_str(), GetName().c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@ -1655,7 +1655,7 @@ void Client::SetChannelOwner(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@ -1743,7 +1743,7 @@ void Client::ChannelInvite(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Invitee); Client *RequiredClient = g_Clientlist->FindCharacter(Invitee);
@ -1871,7 +1871,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Moderator); Client *RequiredClient = g_Clientlist->FindCharacter(Moderator);
@ -1952,7 +1952,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Voicee); Client *RequiredClient = g_Clientlist->FindCharacter(Voicee);
@ -2040,7 +2040,7 @@ void Client::ChannelKick(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Kickee); Client *RequiredClient = g_Clientlist->FindCharacter(Kickee);
@ -2150,28 +2150,28 @@ void Client::SetConnectionType(char c) {
{ {
TypeOfConnection = ConnectionTypeChat; TypeOfConnection = ConnectionTypeChat;
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium; ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Chat (Titanium)"); LogInfo("Connection type is Chat (Titanium)");
break; break;
} }
case EQEmu::versions::ucsTitaniumMail: case EQEmu::versions::ucsTitaniumMail:
{ {
TypeOfConnection = ConnectionTypeMail; TypeOfConnection = ConnectionTypeMail;
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium; ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Mail (Titanium)"); LogInfo("Connection type is Mail (Titanium)");
break; break;
} }
case EQEmu::versions::ucsSoFCombined: case EQEmu::versions::ucsSoFCombined:
{ {
TypeOfConnection = ConnectionTypeCombined; TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::SoF; ClientVersion_ = EQEmu::versions::ClientVersion::SoF;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoF)"); LogInfo("Connection type is Combined (SoF)");
break; break;
} }
case EQEmu::versions::ucsSoDCombined: case EQEmu::versions::ucsSoDCombined:
{ {
TypeOfConnection = ConnectionTypeCombined; TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::SoD; ClientVersion_ = EQEmu::versions::ClientVersion::SoD;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoD)"); LogInfo("Connection type is Combined (SoD)");
break; break;
} }
case EQEmu::versions::ucsUFCombined: case EQEmu::versions::ucsUFCombined:
@ -2179,7 +2179,7 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined; TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::UF; ClientVersion_ = EQEmu::versions::ClientVersion::UF;
UnderfootOrLater = true; UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (Underfoot)"); LogInfo("Connection type is Combined (Underfoot)");
break; break;
} }
case EQEmu::versions::ucsRoFCombined: case EQEmu::versions::ucsRoFCombined:
@ -2187,7 +2187,7 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined; TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::RoF; ClientVersion_ = EQEmu::versions::ClientVersion::RoF;
UnderfootOrLater = true; UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF)"); LogInfo("Connection type is Combined (RoF)");
break; break;
} }
case EQEmu::versions::ucsRoF2Combined: case EQEmu::versions::ucsRoF2Combined:
@ -2195,14 +2195,14 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined; TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::RoF2; ClientVersion_ = EQEmu::versions::ClientVersion::RoF2;
UnderfootOrLater = true; UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF2)"); LogInfo("Connection type is Combined (RoF2)");
break; break;
} }
default: default:
{ {
TypeOfConnection = ConnectionTypeUnknown; TypeOfConnection = ConnectionTypeUnknown;
ClientVersion_ = EQEmu::versions::ClientVersion::Unknown; ClientVersion_ = EQEmu::versions::ClientVersion::Unknown;
Log(Logs::Detail, Logs::UCSServer, "Connection type is unknown."); LogInfo("Connection type is unknown");
} }
} }
} }
@ -2279,12 +2279,12 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin
void Client::ChangeMailBox(int NewMailBox) void Client::ChangeMailBox(int NewMailBox)
{ {
Log(Logs::Detail, Logs::UCSServer, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); LogInfo("[{}] Change to mailbox [{}]", MailBoxName().c_str(), NewMailBox);
SetMailBox(NewMailBox); SetMailBox(NewMailBox);
auto id = std::to_string(NewMailBox); auto id = std::to_string(NewMailBox);
Log(Logs::Detail, Logs::UCSServer, "New mailbox is %s", MailBoxName().c_str()); LogInfo("New mailbox is [{}]", MailBoxName().c_str());
auto outapp = new EQApplicationPacket(OP_MailboxChange, id.length() + 1); auto outapp = new EQApplicationPacket(OP_MailboxChange, id.length() + 1);

View File

@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) {
client->GetAccountID()); client->GetAccountID());
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::Detail, Logs::UCSServer, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); LogInfo("Unable to get account status for character [{}], error [{}]", client->GetName().c_str(), results.ErrorMessage().c_str());
return; return;
} }
Log(Logs::Detail, Logs::UCSServer, "GetAccountStatus Query: %s", query.c_str()); LogInfo("GetAccountStatus Query: [{}]", query.c_str());
if(results.RowCount() != 1) if(results.RowCount() != 1)
{ {
Log(Logs::Detail, Logs::UCSServer, "Error in GetAccountStatus"); LogInfo("Error in GetAccountStatus");
return; return;
} }
@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) {
client->SetKarma(atoi(row[2])); client->SetKarma(atoi(row[2]));
client->SetRevoked((atoi(row[3])==1?true:false)); client->SetRevoked((atoi(row[3])==1?true:false));
Log(Logs::Detail, Logs::UCSServer, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); LogInfo("Set account status to [{}], hideme to [{}] and karma to [{}] for [{}]", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str());
} }
int Database::FindAccount(const char *characterName, Client *client) { int Database::FindAccount(const char *characterName, Client *client) {
Log(Logs::Detail, Logs::UCSServer, "FindAccount for character %s", characterName); LogInfo("FindAccount for character [{}]", characterName);
client->ClearCharacters(); client->ClearCharacters();
@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) {
characterName); characterName);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::Detail, Logs::UCSServer, "FindAccount query failed: %s", query.c_str()); LogInfo("FindAccount query failed: [{}]", query.c_str());
return -1; return -1;
} }
if (results.RowCount() != 1) { if (results.RowCount() != 1) {
Log(Logs::Detail, Logs::UCSServer, "Bad result from query"); LogInfo("Bad result from query");
return -1; return -1;
} }
@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) {
int accountID = atoi(row[1]); int accountID = atoi(row[1]);
Log(Logs::Detail, Logs::UCSServer, "Account ID for %s is %i", characterName, accountID); LogInfo("Account ID for [{}] is [{}]", characterName, accountID);
query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` "
"WHERE `account_id` = %i AND `name` != '%s'", "WHERE `account_id` = %i AND `name` != '%s'",
@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
characterName.c_str()); characterName.c_str());
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::Detail, Logs::UCSServer, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); LogInfo("Error retrieving mailkey from database: [{}]", results.ErrorMessage().c_str());
return false; return false;
} }
@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
else else
sprintf(combinedKey, "%s", MailKey.c_str()); sprintf(combinedKey, "%s", MailKey.c_str());
Log(Logs::Detail, Logs::UCSServer, "DB key is [%s], Client key is [%s]", (row[0] ? row[0] : ""), combinedKey); LogInfo("DB key is [[{}]], Client key is [[{}]]", (row[0] ? row[0] : ""), combinedKey);
return !strcmp(row[0], combinedKey); return !strcmp(row[0], combinedKey);
} }
@ -245,7 +245,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_
bool Database::LoadChatChannels() { bool Database::LoadChatChannels() {
Log(Logs::Detail, Logs::UCSServer, "Loading chat channels from the database."); LogInfo("Loading chat channels from the database");
const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`";
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@ -266,7 +266,7 @@ bool Database::LoadChatChannels() {
void Database::SetChannelPassword(std::string channelName, std::string password) { void Database::SetChannelPassword(std::string channelName, std::string password) {
Log(Logs::Detail, Logs::UCSServer, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); LogInfo("Database::SetChannelPassword([{}], [{}])", channelName.c_str(), password.c_str());
std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'",
password.c_str(), channelName.c_str()); password.c_str(), channelName.c_str());
@ -275,7 +275,7 @@ void Database::SetChannelPassword(std::string channelName, std::string password)
void Database::SetChannelOwner(std::string channelName, std::string owner) { void Database::SetChannelOwner(std::string channelName, std::string owner) {
Log(Logs::Detail, Logs::UCSServer, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); LogInfo("Database::SetChannelOwner([{}], [{}])", channelName.c_str(), owner.c_str());
std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'",
owner.c_str(), channelName.c_str()); owner.c_str(), channelName.c_str());
@ -288,7 +288,7 @@ void Database::SendHeaders(Client *client) {
int unknownField3 = 1; int unknownField3 = 1;
int characterID = FindCharacter(client->MailBoxName().c_str()); int characterID = FindCharacter(client->MailBoxName().c_str());
Log(Logs::Detail, Logs::UCSServer, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); LogInfo("Sendheaders for [{}], CharID is [{}]", client->MailBoxName().c_str(), characterID);
if(characterID <= 0) if(characterID <= 0)
return; return;
@ -373,7 +373,7 @@ void Database::SendBody(Client *client, int messageNumber) {
int characterID = FindCharacter(client->MailBoxName().c_str()); int characterID = FindCharacter(client->MailBoxName().c_str());
Log(Logs::Detail, Logs::UCSServer, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); LogInfo("SendBody: MsgID [{}], to [{}], CharID is [{}]", messageNumber, client->MailBoxName().c_str(), characterID);
if(characterID <= 0) if(characterID <= 0)
return; return;
@ -390,7 +390,7 @@ void Database::SendBody(Client *client, int messageNumber) {
auto row = results.begin(); auto row = results.begin();
Log(Logs::Detail, Logs::UCSServer, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); LogInfo("Message: [{}] body ([{}] bytes)", messageNumber, strlen(row[1]));
int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]);
@ -435,7 +435,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
characterID = FindCharacter(characterName.c_str()); characterID = FindCharacter(characterName.c_str());
Log(Logs::Detail, Logs::UCSServer, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); LogInfo("SendMail: CharacterID for recipient [{}] is [{}]", characterName.c_str(), characterID);
if(characterID <= 0) if(characterID <= 0)
return false; return false;
@ -460,7 +460,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
return false; return false;
} }
Log(Logs::Detail, Logs::UCSServer, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); LogInfo("MessageID [{}] generated, from [{}], to [{}]", results.LastInsertedID(), from.c_str(), recipient.c_str());
Client *client = g_Clientlist->IsCharacterOnline(characterName); Client *client = g_Clientlist->IsCharacterOnline(characterName);
@ -477,7 +477,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
void Database::SetMessageStatus(int messageNumber, int status) { void Database::SetMessageStatus(int messageNumber, int status) {
Log(Logs::Detail, Logs::UCSServer, "SetMessageStatus %i %i", messageNumber, status); LogInfo("SetMessageStatus [{}] [{}]", messageNumber, status);
if(status == 0) { if(status == 0) {
std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber);
@ -491,7 +491,7 @@ void Database::SetMessageStatus(int messageNumber, int status) {
void Database::ExpireMail() { void Database::ExpireMail() {
Log(Logs::Detail, Logs::UCSServer, "Expiring mail..."); LogInfo("Expiring mail");
std::string query = "SELECT COUNT(*) FROM `mail`"; std::string query = "SELECT COUNT(*) FROM `mail`";
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@ -501,7 +501,7 @@ void Database::ExpireMail() {
auto row = results.begin(); auto row = results.begin();
Log(Logs::Detail, Logs::UCSServer, "There are %s messages in the database.", row[0]); LogInfo("There are [{}] messages in the database", row[0]);
// Expire Trash // Expire Trash
if(RuleI(Mail, ExpireTrash) >= 0) { if(RuleI(Mail, ExpireTrash) >= 0) {
@ -509,7 +509,7 @@ void Database::ExpireMail() {
time(nullptr) - RuleI(Mail, ExpireTrash)); time(nullptr) - RuleI(Mail, ExpireTrash));
results = QueryDatabase(query); results = QueryDatabase(query);
if(results.Success()) if(results.Success())
Log(Logs::Detail, Logs::UCSServer, "Expired %i trash messages.", results.RowsAffected()); LogInfo("Expired [{}] trash messages", results.RowsAffected());
} }
// Expire Read // Expire Read
@ -518,7 +518,7 @@ void Database::ExpireMail() {
time(nullptr) - RuleI(Mail, ExpireRead)); time(nullptr) - RuleI(Mail, ExpireRead));
results = QueryDatabase(query); results = QueryDatabase(query);
if(results.Success()) if(results.Success())
Log(Logs::Detail, Logs::UCSServer, "Expired %i read messages.", results.RowsAffected()); LogInfo("Expired [{}] read messages", results.RowsAffected());
} }
// Expire Unread // Expire Unread
@ -527,7 +527,7 @@ void Database::ExpireMail() {
time(nullptr) - RuleI(Mail, ExpireUnread)); time(nullptr) - RuleI(Mail, ExpireUnread));
results = QueryDatabase(query); results = QueryDatabase(query);
if(results.Success()) if(results.Success())
Log(Logs::Detail, Logs::UCSServer, "Expired %i unread messages.", results.RowsAffected()); LogInfo("Expired [{}] unread messages", results.RowsAffected());
} }
} }
@ -538,7 +538,7 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) {
charID, type, CapitaliseName(name).c_str()); charID, type, CapitaliseName(name).c_str());
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if(results.Success()) if(results.Success())
Log(Logs::Detail, Logs::UCSServer, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); LogInfo("Wrote Friend/Ignore entry for charid [{}], type [{}], name [{}] to database", charID, type, name.c_str());
} }
@ -549,10 +549,10 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) {
charID, type, CapitaliseName(name).c_str()); charID, type, CapitaliseName(name).c_str());
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::Detail, Logs::UCSServer, "Error removing friend/ignore, query was %s", query.c_str()); LogInfo("Error removing friend/ignore, query was [{}]", query.c_str());
} }
else { else {
Log(Logs::Detail, Logs::UCSServer, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); LogInfo("Removed Friend/Ignore entry for charid [{}], type [{}], name [{}] from database", charID, type, name.c_str());
} }
} }
@ -571,12 +571,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends
if(atoi(row[0]) == 0) if(atoi(row[0]) == 0)
{ {
ignorees.push_back(name); ignorees.push_back(name);
Log(Logs::Detail, Logs::UCSServer, "Added Ignoree from DB %s", name.c_str()); LogInfo("Added Ignoree from DB [{}]", name.c_str());
continue; continue;
} }
friends.push_back(name); friends.push_back(name);
Log(Logs::Detail, Logs::UCSServer, "Added Friend from DB %s", name.c_str()); LogInfo("Added Friend from DB [{}]", name.c_str());
} }
} }

View File

@ -73,10 +73,10 @@ int main() {
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
Log(Logs::General, Logs::UCSServer, "Starting EQEmu Universal Chat Server."); LogInfo("Starting EQEmu Universal Chat Server");
if (!ucsconfig::LoadConfig()) { if (!ucsconfig::LoadConfig()) {
Log(Logs::General, Logs::UCSServer, "Loading server configuration failed."); LogInfo("Loading server configuration failed");
return 1; return 1;
} }
@ -84,7 +84,7 @@ int main() {
WorldShortName = Config->ShortName; WorldShortName = Config->ShortName;
Log(Logs::General, Logs::UCSServer, "Connecting to MySQL..."); LogInfo("Connecting to MySQL");
if (!database.Connect( if (!database.Connect(
Config->DatabaseHost.c_str(), Config->DatabaseHost.c_str(),
@ -92,7 +92,7 @@ int main() {
Config->DatabasePassword.c_str(), Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(), Config->DatabaseDB.c_str(),
Config->DatabasePort)) { Config->DatabasePort)) {
Log(Logs::General, Logs::UCSServer, "Cannot continue without a database connection."); LogInfo("Cannot continue without a database connection");
return 1; return 1;
} }
@ -104,26 +104,26 @@ int main() {
// ucs has no 'reload rules' handler // ucs has no 'reload rules' handler
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
Log(Logs::General, Logs::UCSServer, "Loading rule set '%s'", tmp); LogInfo("Loading rule set [{}]", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp, false)) { if(!RuleManager::Instance()->LoadRules(&database, tmp, false)) {
Log(Logs::General, Logs::UCSServer, "Failed to load ruleset '%s', falling back to defaults.", tmp); LogInfo("Failed to load ruleset [{}], falling back to defaults", tmp);
} }
} else { } else {
if(!RuleManager::Instance()->LoadRules(&database, "default", false)) { if(!RuleManager::Instance()->LoadRules(&database, "default", false)) {
Log(Logs::General, Logs::UCSServer, "No rule set configured, using default rules"); LogInfo("No rule set configured, using default rules");
} else { } else {
Log(Logs::General, Logs::UCSServer, "Loaded default rule set 'default'", tmp); LogInfo("Loaded default rule set 'default'", tmp);
} }
} }
EQEmu::InitializeDynamicLookups(); EQEmu::InitializeDynamicLookups();
Log(Logs::General, Logs::UCSServer, "Initialized dynamic dictionary entries"); LogInfo("Initialized dynamic dictionary entries");
database.ExpireMail(); database.ExpireMail();
if(Config->ChatPort != Config->MailPort) if(Config->ChatPort != Config->MailPort)
{ {
Log(Logs::General, Logs::UCSServer, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); LogInfo("MailPort and CharPort must be the same in eqemu_config.json for UCS");
exit(1); exit(1);
} }
@ -134,11 +134,11 @@ int main() {
database.LoadChatChannels(); database.LoadChatChannels();
if (signal(SIGINT, CatchSignal) == SIG_ERR) { if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::UCSServer, "Could not set signal handler"); LogInfo("Could not set signal handler");
return 1; return 1;
} }
if (signal(SIGTERM, CatchSignal) == SIG_ERR) { if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::UCSServer, "Could not set signal handler"); LogInfo("Could not set signal handler");
return 1; return 1;
} }

View File

@ -61,7 +61,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
ServerPacket tpack(opcode, p); ServerPacket tpack(opcode, p);
ServerPacket *pack = &tpack; ServerPacket *pack = &tpack;
Log(Logs::Detail, Logs::UCSServer, "Received Opcode: %4X", opcode); LogInfo("Received Opcode: {:#04x}", opcode);
switch (opcode) switch (opcode)
{ {
@ -82,7 +82,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
std::string Message = Buffer; std::string Message = Buffer;
Log(Logs::Detail, Logs::UCSServer, "Player: %s, Sent Message: %s", From, Message.c_str()); LogInfo("Player: [{}], Sent Message: [{}]", From, Message.c_str());
Client *c = g_Clientlist->FindCharacter(From); Client *c = g_Clientlist->FindCharacter(From);
@ -93,7 +93,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
if (!c) if (!c)
{ {
Log(Logs::Detail, Logs::UCSServer, "Client not found."); LogInfo("Client not found");
break; break;
} }

View File

@ -427,7 +427,7 @@ int main(int argc, char** argv) {
LogInfo("Server (TCP) listener started"); LogInfo("Server (TCP) listener started");
server_connection->OnConnectionIdentified("Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionIdentified("Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("New Zone Server connection from {2} at {0}:{1}", LogInfo("New Zone Server connection from [{2}] at [{0}:{1}]",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
numzones++; numzones++;
@ -435,7 +435,7 @@ int main(int argc, char** argv) {
}); });
server_connection->OnConnectionRemoved("Zone", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionRemoved("Zone", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("Removed Zone Server connection from {0}", LogInfo("Removed Zone Server connection from [{0}]",
connection->GetUUID()); connection->GetUUID());
numzones--; numzones--;
@ -443,35 +443,35 @@ int main(int argc, char** argv) {
}); });
server_connection->OnConnectionIdentified("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionIdentified("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("New Launcher connection from {2} at {0}:{1}", LogInfo("New Launcher connection from [{2}] at [{0}:{1}]",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
launcher_list.Add(connection); launcher_list.Add(connection);
}); });
server_connection->OnConnectionRemoved("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionRemoved("Launcher", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("Removed Launcher connection from {0}", LogInfo("Removed Launcher connection from [{0}]",
connection->GetUUID()); connection->GetUUID());
launcher_list.Remove(connection); launcher_list.Remove(connection);
}); });
server_connection->OnConnectionIdentified("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionIdentified("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("New Query Server connection from {2} at {0}:{1}", LogInfo("New Query Server connection from [{2}] at [{0}:{1}]",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
QSLink.AddConnection(connection); QSLink.AddConnection(connection);
}); });
server_connection->OnConnectionRemoved("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionRemoved("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("Removed Query Server connection from {0}", LogInfo("Removed Query Server connection from [{0}]",
connection->GetUUID()); connection->GetUUID());
QSLink.RemoveConnection(connection); QSLink.RemoveConnection(connection);
}); });
server_connection->OnConnectionIdentified("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionIdentified("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("New UCS Server connection from {2} at {0}:{1}", LogInfo("New UCS Server connection from [{2}] at [{0}:{1}]",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
UCSLink.SetConnection(connection); UCSLink.SetConnection(connection);
@ -480,7 +480,7 @@ int main(int argc, char** argv) {
}); });
server_connection->OnConnectionRemoved("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionRemoved("UCS", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("Removed Query Server connection from {0}", LogInfo("Removed Query Server connection from [{0}]",
connection->GetUUID()); connection->GetUUID());
UCSLink.SetConnection(nullptr); UCSLink.SetConnection(nullptr);
@ -489,14 +489,14 @@ int main(int argc, char** argv) {
}); });
server_connection->OnConnectionIdentified("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionIdentified("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("New WebInterface Server connection from {2} at {0}:{1}", LogInfo("New WebInterface Server connection from [{2}] at [{0}:{1}]",
connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID()); connection->Handle()->RemoteIP(), connection->Handle()->RemotePort(), connection->GetUUID());
web_interface.AddConnection(connection); web_interface.AddConnection(connection);
}); });
server_connection->OnConnectionRemoved("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) { server_connection->OnConnectionRemoved("WebInterface", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
LogInfo("Removed WebInterface Server connection from {0}", LogInfo("Removed WebInterface Server connection from [{0}]",
connection->GetUUID()); connection->GetUUID());
web_interface.RemoveConnection(connection); web_interface.RemoveConnection(connection);

View File

@ -16,7 +16,7 @@ void UCSConnection::SetConnection(std::shared_ptr<EQ::Net::ServertalkServerConne
{ {
if (Stream && Stream->Handle()) if (Stream && Stream->Handle())
{ {
Log(Logs::Detail, Logs::UCSServer, "Incoming UCS Connection while we were already connected to a UCS."); LogInfo("Incoming UCS Connection while we were already connected to a UCS");
Stream->Handle()->Disconnect(); Stream->Handle()->Disconnect();
} }
@ -46,12 +46,12 @@ void UCSConnection::ProcessPacket(uint16 opcode, EQ::Net::Packet &p)
} }
case ServerOP_ZAAuth: case ServerOP_ZAAuth:
{ {
Log(Logs::Detail, Logs::UCSServer, "Got authentication from UCS when they are already authenticated."); LogInfo("Got authentication from UCS when they are already authenticated");
break; break;
} }
default: default:
{ {
Log(Logs::Detail, Logs::UCSServer, "Unknown ServerOPcode from UCS 0x%04x, size %d", opcode, pack->size); LogInfo("Unknown ServerOPcode from UCS {:#04x}, size [{}]", opcode, pack->size);
DumpPacket(pack->pBuffer, pack->size); DumpPacket(pack->pBuffer, pack->size);
break; break;
} }

View File

@ -535,7 +535,7 @@ void EntityList::MobProcess()
#ifdef _WINDOWS #ifdef _WINDOWS
struct in_addr in; struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP(); in.s_addr = mob->CastToClient()->GetIP();
Log(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort()); LogInfo("Dropping client: Process=false, ip=[{}] port=[{}]", inet_ntoa(in), mob->CastToClient()->GetPort());
#endif #endif
zone->StartShutdownTimer(); zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob); Group *g = GetGroupByMob(mob);

View File

@ -943,53 +943,53 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
std::string mmf_file_name = map_file_name; std::string mmf_file_name = map_file_name;
strip_map_extension(mmf_file_name); strip_map_extension(mmf_file_name);
if (!add_mmf_extension(mmf_file_name)) { if (!add_mmf_extension(mmf_file_name)) {
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s'", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}]", mmf_file_name.c_str());
return false; return false;
} }
FILE *f = fopen(mmf_file_name.c_str(), "rb"); FILE *f = fopen(mmf_file_name.c_str(), "rb");
if (!f) { if (!f) {
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - could not open file", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
return false; return false;
} }
uint32 file_version; uint32 file_version;
if (fread(&file_version, sizeof(uint32), 1, f) != 1) { if (fread(&file_version, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@file_version", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
return false; return false;
} }
uint32 rm_buffer_size; uint32 rm_buffer_size;
if (fread(&rm_buffer_size, sizeof(uint32), 1, f) != 1) { if (fread(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
return false; return false;
} }
uint32 rm_buffer_crc32; uint32 rm_buffer_crc32;
if (fread(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) { if (fread(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
return false; return false;
} }
if (rm_buffer_crc32 != /*crc32_check*/ 0) { if (rm_buffer_crc32 != /*crc32_check*/ 0) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - bad rm_buffer checksum", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - bad rm_buffer checksum", mmf_file_name.c_str());
return false; return false;
} }
uint32 mmf_buffer_size; uint32 mmf_buffer_size;
if (fread(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) { if (fread(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
return false; return false;
} }
std::vector<char> mmf_buffer(mmf_buffer_size); std::vector<char> mmf_buffer(mmf_buffer_size);
if (fread(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) { if (fread(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
fclose(f); fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
return false; return false;
} }
@ -1016,7 +1016,7 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (!imp->rm) { if (!imp->rm) {
delete imp; delete imp;
imp = nullptr; imp = nullptr;
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - null RaycastMesh", mmf_file_name.c_str()); LogInfo("Failed to load Map MMF file: [{}] - null RaycastMesh", mmf_file_name.c_str());
return false; return false;
} }
@ -1026,14 +1026,14 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite) bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
{ {
if (!imp || !imp->rm) { if (!imp || !imp->rm) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file - No implementation (map_file_name: '%s')", map_file_name.c_str()); LogInfo("Failed to save Map MMF file - No implementation (map_file_name: [{}])", map_file_name.c_str());
return false; return false;
} }
std::string mmf_file_name = map_file_name; std::string mmf_file_name = map_file_name;
strip_map_extension(mmf_file_name); strip_map_extension(mmf_file_name);
if (!add_mmf_extension(mmf_file_name)) { if (!add_mmf_extension(mmf_file_name)) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s'", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}]", mmf_file_name.c_str());
return false; return false;
} }
@ -1047,7 +1047,7 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
std::vector<char> rm_buffer; // size set in MyRaycastMesh::serialize() std::vector<char> rm_buffer; // size set in MyRaycastMesh::serialize()
serializeRaycastMesh(imp->rm, rm_buffer); serializeRaycastMesh(imp->rm, rm_buffer);
if (rm_buffer.empty()) { if (rm_buffer.empty()) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - empty RaycastMesh buffer", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - empty RaycastMesh buffer", mmf_file_name.c_str());
return false; return false;
} }
@ -1058,13 +1058,13 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
mmf_buffer_size = DeflateData(rm_buffer.data(), rm_buffer.size(), mmf_buffer.data(), mmf_buffer.size()); mmf_buffer_size = DeflateData(rm_buffer.data(), rm_buffer.size(), mmf_buffer.data(), mmf_buffer.size());
if (!mmf_buffer_size) { if (!mmf_buffer_size) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - null MMF buffer size", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - null MMF buffer size", mmf_file_name.c_str());
return false; return false;
} }
f = fopen(mmf_file_name.c_str(), "wb"); f = fopen(mmf_file_name.c_str(), "wb");
if (!f) { if (!f) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - could not open file", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
return false; return false;
} }
@ -1072,14 +1072,14 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (fwrite(&file_version, sizeof(uint32), 1, f) != 1) { if (fwrite(&file_version, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
std::remove(mmf_file_name.c_str()); std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@file_version", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
return false; return false;
} }
if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) { if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
std::remove(mmf_file_name.c_str()); std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
return false; return false;
} }
@ -1087,21 +1087,21 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (fwrite(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) { if (fwrite(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
std::remove(mmf_file_name.c_str()); std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
return false; return false;
} }
if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) { if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f); fclose(f);
std::remove(mmf_file_name.c_str()); std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
return false; return false;
} }
if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) { if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
fclose(f); fclose(f);
std::remove(mmf_file_name.c_str()); std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str()); LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
return false; return false;
} }

View File

@ -374,14 +374,14 @@ int main(int argc, char** argv) {
} }
#ifdef BOTS #ifdef BOTS
Log(Logs::General, Logs::Zone_Server, "Loading bot commands"); LogInfo("Loading bot commands");
int botretval = bot_command_init(); int botretval = bot_command_init();
if (botretval<0) if (botretval<0)
LogError("Bot command loading failed"); LogError("Bot command loading failed");
else else
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval); LogInfo("[{}] bot commands loaded", botretval);
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances"); LogInfo("Loading bot spell casting chances");
if (!database.botdb.LoadBotSpellCastingChances()) if (!database.botdb.LoadBotSpellCastingChances())
LogError("Bot spell casting chances loading failed"); LogError("Bot spell casting chances loading failed");
#endif #endif
@ -614,7 +614,7 @@ int main(int argc, char** argv) {
void CatchSignal(int sig_num) { void CatchSignal(int sig_num) {
#ifdef _WINDOWS #ifdef _WINDOWS
Log(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num); LogInfo("Recieved signal: [{}]", sig_num);
#endif #endif
RunLoops = false; RunLoops = false;
} }