mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Streamline UCS
This commit is contained in:
parent
bfd0752c4d
commit
ccbbadc5ee
@ -154,7 +154,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
|
||||
|
||||
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);
|
||||
|
||||
@ -175,7 +175,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
||||
|
||||
void ChatChannelList::RemoveAllChannels() {
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "RemoveAllChannels");
|
||||
LogInfo("RemoveAllChannels");
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@ -233,7 +233,7 @@ void ChatChannel::AddClient(Client *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;
|
||||
}
|
||||
@ -242,7 +242,7 @@ void ChatChannel::AddClient(Client *c) {
|
||||
|
||||
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);
|
||||
|
||||
@ -267,7 +267,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
||||
|
||||
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();
|
||||
|
||||
@ -304,7 +304,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
||||
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
||||
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);
|
||||
}
|
||||
@ -505,7 +505,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client
|
||||
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);
|
||||
|
||||
@ -597,7 +597,7 @@ void ChatChannel::AddInvitee(const std::string &Invitee)
|
||||
if (!IsInvitee(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)) {
|
||||
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)) {
|
||||
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)) {
|
||||
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)) {
|
||||
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)) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -235,7 +235,7 @@ std::vector<std::string> ParseRecipients(std::string RecipientString) {
|
||||
|
||||
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;
|
||||
|
||||
@ -397,7 +397,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
||||
|
||||
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");
|
||||
|
||||
uint8 SubAction = 1;
|
||||
@ -426,7 +426,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) {
|
||||
|
||||
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");
|
||||
|
||||
uint8 SubAction = 0;
|
||||
@ -482,7 +482,7 @@ Clientlist::Clientlist(int ChatPort) {
|
||||
|
||||
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()))
|
||||
exit(1);
|
||||
|
||||
@ -567,7 +567,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
||||
if (((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName())
|
||||
&& (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;
|
||||
|
||||
@ -670,7 +670,7 @@ void Clientlist::Process()
|
||||
}
|
||||
|
||||
default: {
|
||||
Log(Logs::Detail, Logs::UCSServer, "Unhandled chat opcode %8X", opcode);
|
||||
LogInfo("Unhandled chat opcode %8X", opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -823,7 +823,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
|
||||
break;
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
@ -848,7 +848,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
|
||||
|
||||
default:
|
||||
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) {
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "Removing client %s", (*Iterator)->GetName().c_str());
|
||||
LogInfo("Removing client [{}]", (*Iterator)->GetName().c_str());
|
||||
|
||||
(*Iterator)->CloseConnection();
|
||||
}
|
||||
@ -868,7 +868,7 @@ void Clientlist::CloseAllConnections() {
|
||||
void Client::AddCharacter(int CharID, const char *CharacterName, int Level) {
|
||||
|
||||
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;
|
||||
NewCharacter.CharID = CharID;
|
||||
NewCharacter.Name = CharacterName;
|
||||
@ -933,7 +933,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) {
|
||||
for (int i = 0; i < MAX_JOINED_CHANNELS; i++)
|
||||
if (JoinedChannels[i] == nullptr) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
|
||||
@ -1073,7 +1073,7 @@ void Client::JoinChannels(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;
|
||||
|
||||
@ -1249,7 +1249,7 @@ void Client::SendChannelMessage(std::string Message)
|
||||
|
||||
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);
|
||||
|
||||
@ -1600,7 +1600,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
|
||||
else
|
||||
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);
|
||||
|
||||
@ -1655,7 +1655,7 @@ void Client::SetChannelOwner(std::string CommandString) {
|
||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
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);
|
||||
|
||||
@ -1743,7 +1743,7 @@ void Client::ChannelInvite(std::string CommandString) {
|
||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
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);
|
||||
|
||||
@ -1871,7 +1871,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
|
||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
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);
|
||||
|
||||
@ -1952,7 +1952,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
|
||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
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);
|
||||
|
||||
@ -2040,7 +2040,7 @@ void Client::ChannelKick(std::string CommandString) {
|
||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
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);
|
||||
|
||||
@ -2150,28 +2150,28 @@ void Client::SetConnectionType(char c) {
|
||||
{
|
||||
TypeOfConnection = ConnectionTypeChat;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Chat (Titanium)");
|
||||
LogInfo("Connection type is Chat (Titanium)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsTitaniumMail:
|
||||
{
|
||||
TypeOfConnection = ConnectionTypeMail;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Mail (Titanium)");
|
||||
LogInfo("Connection type is Mail (Titanium)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsSoFCombined:
|
||||
{
|
||||
TypeOfConnection = ConnectionTypeCombined;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::SoF;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoF)");
|
||||
LogInfo("Connection type is Combined (SoF)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsSoDCombined:
|
||||
{
|
||||
TypeOfConnection = ConnectionTypeCombined;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::SoD;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoD)");
|
||||
LogInfo("Connection type is Combined (SoD)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsUFCombined:
|
||||
@ -2179,7 +2179,7 @@ void Client::SetConnectionType(char c) {
|
||||
TypeOfConnection = ConnectionTypeCombined;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::UF;
|
||||
UnderfootOrLater = true;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (Underfoot)");
|
||||
LogInfo("Connection type is Combined (Underfoot)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsRoFCombined:
|
||||
@ -2187,7 +2187,7 @@ void Client::SetConnectionType(char c) {
|
||||
TypeOfConnection = ConnectionTypeCombined;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::RoF;
|
||||
UnderfootOrLater = true;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF)");
|
||||
LogInfo("Connection type is Combined (RoF)");
|
||||
break;
|
||||
}
|
||||
case EQEmu::versions::ucsRoF2Combined:
|
||||
@ -2195,14 +2195,14 @@ void Client::SetConnectionType(char c) {
|
||||
TypeOfConnection = ConnectionTypeCombined;
|
||||
ClientVersion_ = EQEmu::versions::ClientVersion::RoF2;
|
||||
UnderfootOrLater = true;
|
||||
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF2)");
|
||||
LogInfo("Connection type is Combined (RoF2)");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
TypeOfConnection = ConnectionTypeUnknown;
|
||||
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)
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCSServer, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox);
|
||||
LogInfo("[{}] Change to mailbox [{}]", MailBoxName().c_str(), NewMailBox);
|
||||
|
||||
SetMailBox(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);
|
||||
|
||||
|
||||
@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) {
|
||||
client->GetAccountID());
|
||||
auto results = QueryDatabase(query);
|
||||
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;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "GetAccountStatus Query: %s", query.c_str());
|
||||
LogInfo("GetAccountStatus Query: [{}]", query.c_str());
|
||||
|
||||
if(results.RowCount() != 1)
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCSServer, "Error in GetAccountStatus");
|
||||
LogInfo("Error in GetAccountStatus");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) {
|
||||
client->SetKarma(atoi(row[2]));
|
||||
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) {
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "FindAccount for character %s", characterName);
|
||||
LogInfo("FindAccount for character [{}]", characterName);
|
||||
|
||||
|
||||
client->ClearCharacters();
|
||||
@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
||||
characterName);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::Detail, Logs::UCSServer, "FindAccount query failed: %s", query.c_str());
|
||||
LogInfo("FindAccount query failed: [{}]", query.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (results.RowCount() != 1) {
|
||||
Log(Logs::Detail, Logs::UCSServer, "Bad result from query");
|
||||
LogInfo("Bad result from query");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
||||
|
||||
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` "
|
||||
"WHERE `account_id` = %i AND `name` != '%s'",
|
||||
@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
||||
characterName.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
||||
else
|
||||
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);
|
||||
}
|
||||
@ -245,7 +245,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_
|
||||
|
||||
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`";
|
||||
auto results = QueryDatabase(query);
|
||||
@ -266,7 +266,7 @@ bool Database::LoadChatChannels() {
|
||||
|
||||
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'",
|
||||
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) {
|
||||
|
||||
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'",
|
||||
owner.c_str(), channelName.c_str());
|
||||
@ -288,7 +288,7 @@ void Database::SendHeaders(Client *client) {
|
||||
int unknownField3 = 1;
|
||||
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)
|
||||
return;
|
||||
@ -373,7 +373,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
||||
|
||||
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)
|
||||
return;
|
||||
@ -390,7 +390,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
||||
|
||||
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]);
|
||||
|
||||
@ -435,7 +435,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
|
||||
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)
|
||||
return false;
|
||||
@ -460,7 +460,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
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);
|
||||
@ -477,7 +477,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
|
||||
void Database::SetMessageStatus(int messageNumber, int status) {
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "SetMessageStatus %i %i", messageNumber, status);
|
||||
LogInfo("SetMessageStatus [{}] [{}]", messageNumber, status);
|
||||
|
||||
if(status == 0) {
|
||||
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() {
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "Expiring mail...");
|
||||
LogInfo("Expiring mail");
|
||||
|
||||
std::string query = "SELECT COUNT(*) FROM `mail`";
|
||||
auto results = QueryDatabase(query);
|
||||
@ -501,7 +501,7 @@ void Database::ExpireMail() {
|
||||
|
||||
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
|
||||
if(RuleI(Mail, ExpireTrash) >= 0) {
|
||||
@ -509,7 +509,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireTrash));
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log(Logs::Detail, Logs::UCSServer, "Expired %i trash messages.", results.RowsAffected());
|
||||
LogInfo("Expired [{}] trash messages", results.RowsAffected());
|
||||
}
|
||||
|
||||
// Expire Read
|
||||
@ -518,7 +518,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireRead));
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log(Logs::Detail, Logs::UCSServer, "Expired %i read messages.", results.RowsAffected());
|
||||
LogInfo("Expired [{}] read messages", results.RowsAffected());
|
||||
}
|
||||
|
||||
// Expire Unread
|
||||
@ -527,7 +527,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireUnread));
|
||||
results = QueryDatabase(query);
|
||||
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());
|
||||
auto results = QueryDatabase(query);
|
||||
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());
|
||||
auto results = QueryDatabase(query);
|
||||
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 {
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
24
ucs/ucs.cpp
24
ucs/ucs.cpp
@ -73,10 +73,10 @@ int main() {
|
||||
|
||||
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()) {
|
||||
Log(Logs::General, Logs::UCSServer, "Loading server configuration failed.");
|
||||
LogInfo("Loading server configuration failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ int main() {
|
||||
|
||||
WorldShortName = Config->ShortName;
|
||||
|
||||
Log(Logs::General, Logs::UCSServer, "Connecting to MySQL...");
|
||||
LogInfo("Connecting to MySQL");
|
||||
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
@ -92,7 +92,7 @@ int main() {
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::UCSServer, "Cannot continue without a database connection.");
|
||||
LogInfo("Cannot continue without a database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -104,26 +104,26 @@ int main() {
|
||||
|
||||
// ucs has no 'reload rules' handler
|
||||
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)) {
|
||||
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 {
|
||||
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 {
|
||||
Log(Logs::General, Logs::UCSServer, "Loaded default rule set 'default'", tmp);
|
||||
LogInfo("Loaded default rule set 'default'", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::UCSServer, "Initialized dynamic dictionary entries");
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
|
||||
database.ExpireMail();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -134,11 +134,11 @@ int main() {
|
||||
database.LoadChatChannels();
|
||||
|
||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::UCSServer, "Could not set signal handler");
|
||||
LogInfo("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::UCSServer, "Could not set signal handler");
|
||||
LogInfo("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
ServerPacket tpack(opcode, p);
|
||||
ServerPacket *pack = &tpack;
|
||||
|
||||
Log(Logs::Detail, Logs::UCSServer, "Received Opcode: %4X", opcode);
|
||||
LogInfo("Received Opcode: {:#04x}", opcode);
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
@ -82,7 +82,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
|
||||
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);
|
||||
|
||||
@ -93,7 +93,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCSServer, "Client not found.");
|
||||
LogInfo("Client not found");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ int main(int argc, char** argv) {
|
||||
LogInfo("Server (TCP) listener started");
|
||||
|
||||
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());
|
||||
|
||||
numzones++;
|
||||
@ -435,7 +435,7 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
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());
|
||||
|
||||
numzones--;
|
||||
@ -443,35 +443,35 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
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());
|
||||
|
||||
launcher_list.Add(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());
|
||||
|
||||
launcher_list.Remove(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());
|
||||
|
||||
QSLink.AddConnection(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());
|
||||
|
||||
QSLink.RemoveConnection(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());
|
||||
|
||||
UCSLink.SetConnection(connection);
|
||||
@ -480,7 +480,7 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
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());
|
||||
|
||||
UCSLink.SetConnection(nullptr);
|
||||
@ -489,14 +489,14 @@ int main(int argc, char** argv) {
|
||||
});
|
||||
|
||||
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());
|
||||
|
||||
web_interface.AddConnection(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());
|
||||
|
||||
web_interface.RemoveConnection(connection);
|
||||
|
||||
@ -16,7 +16,7 @@ void UCSConnection::SetConnection(std::shared_ptr<EQ::Net::ServertalkServerConne
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
@ -46,12 +46,12 @@ void UCSConnection::ProcessPacket(uint16 opcode, EQ::Net::Packet &p)
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ void EntityList::MobProcess()
|
||||
#ifdef _WINDOWS
|
||||
struct in_addr in;
|
||||
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
|
||||
zone->StartShutdownTimer();
|
||||
Group *g = GetGroupByMob(mob);
|
||||
|
||||
38
zone/map.cpp
38
zone/map.cpp
@ -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;
|
||||
strip_map_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;
|
||||
}
|
||||
|
||||
FILE *f = fopen(mmf_file_name.c_str(), "rb");
|
||||
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;
|
||||
}
|
||||
|
||||
uint32 file_version;
|
||||
if (fread(&file_version, sizeof(uint32), 1, f) != 1) {
|
||||
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;
|
||||
}
|
||||
|
||||
uint32 rm_buffer_size;
|
||||
if (fread(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
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;
|
||||
}
|
||||
|
||||
uint32 rm_buffer_crc32;
|
||||
if (fread(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
|
||||
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;
|
||||
}
|
||||
if (rm_buffer_crc32 != /*crc32_check*/ 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
uint32 mmf_buffer_size;
|
||||
if (fread(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
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;
|
||||
}
|
||||
|
||||
std::vector<char> mmf_buffer(mmf_buffer_size);
|
||||
if (fread(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1016,7 +1016,7 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
if (!imp->rm) {
|
||||
delete imp;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
std::string mmf_file_name = map_file_name;
|
||||
strip_map_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;
|
||||
}
|
||||
|
||||
@ -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()
|
||||
serializeRaycastMesh(imp->rm, rm_buffer);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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());
|
||||
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;
|
||||
}
|
||||
|
||||
f = fopen(mmf_file_name.c_str(), "wb");
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
fclose(f);
|
||||
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;
|
||||
}
|
||||
|
||||
if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
fclose(f);
|
||||
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;
|
||||
}
|
||||
|
||||
if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
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;
|
||||
}
|
||||
|
||||
if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
|
||||
fclose(f);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -374,14 +374,14 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading bot commands");
|
||||
LogInfo("Loading bot commands");
|
||||
int botretval = bot_command_init();
|
||||
if (botretval<0)
|
||||
LogError("Bot command loading failed");
|
||||
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())
|
||||
LogError("Bot spell casting chances loading failed");
|
||||
#endif
|
||||
@ -614,7 +614,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
void CatchSignal(int sig_num) {
|
||||
#ifdef _WINDOWS
|
||||
Log(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num);
|
||||
LogInfo("Recieved signal: [{}]", sig_num);
|
||||
#endif
|
||||
RunLoops = false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user