diff --git a/bin/config_sample/config.ini b/bin/config_sample/config.ini index 4b30fca..49d33de 100644 --- a/bin/config_sample/config.ini +++ b/bin/config_sample/config.ini @@ -3,13 +3,9 @@ version=1 [Options] advertise=true -hostname=$H -language=en -max_message_size=256 max_players=100 ms_ip=master.aceattorneyonline.com ms_port=27016 -multiclient_limit=16 port=27016 server_description=This is a placeholder server description. Tell the world of AO who you are here! server_name=An Unnamed Server diff --git a/include/logger.h b/include/logger.h index c99384f..d86ab6c 100644 --- a/include/logger.h +++ b/include/logger.h @@ -34,6 +34,8 @@ public: Logger(int p_max_length); void logIC(AOClient* client, AOPacket* packet); + void logOOC(AOClient* client, AOPacket* packet); + void logModcall(AOClient* client, AOPacket* packet); void flush(); private: diff --git a/src/logger.cpp b/src/logger.cpp index 7a0f483..e9730e6 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -24,6 +24,7 @@ Logger::Logger(int p_max_length) void Logger::logIC(AOClient *client, AOPacket *packet) { + // TODO: copy pasted code QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss"); QString area_name = client->getServer()->area_names.value(client->current_area); QString char_name = client->current_char; @@ -39,6 +40,42 @@ void Logger::logIC(AOClient *client, AOPacket *packet) addEntry(log_entry); } +void Logger::logOOC(AOClient* client, AOPacket* packet) +{ + // TODO: copy pasted code + QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss"); + QString area_name = client->getServer()->area_names.value(client->current_area); + QString char_name = client->current_char; + QString ipid = client->getIpid(); + QString message = packet->contents[1]; + + QString log_entry = QStringLiteral("[%1][%2][OOC] %3(%4): %5\n") + .arg(time) + .arg(area_name) + .arg(char_name) + .arg(ipid) + .arg(message); + addEntry(log_entry); +} + +void Logger::logModcall(AOClient* client, AOPacket* packet) +{ + // TODO: copy pasted code + QString time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss"); + QString area_name = client->getServer()->area_names.value(client->current_area); + QString char_name = client->current_char; + QString ipid = client->getIpid(); + QString message = packet->contents[1]; + + QString log_entry = QStringLiteral("[%1][%2][MODCALL] %3(%4): %5\n") + .arg(time) + .arg(area_name) + .arg(char_name) + .arg(ipid) + .arg(message); + addEntry(log_entry); +} + void Logger::addEntry(QString entry) { if (buffer.length() < max_length) { diff --git a/src/packets.cpp b/src/packets.cpp index a921ca7..298a17a 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -153,6 +153,7 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet) { ooc_name = argv[0]; + area->logger->logOOC(this, &packet); if(argv[1].at(0) == '/') { QStringList cmd_argv = argv[1].split(" ", QString::SplitBehavior::SkipEmptyParts); QString command = cmd_argv[0].trimmed().toLower(); @@ -245,6 +246,7 @@ void AOClient::pktModCall(AreaData* area, int argc, QStringList argv, AOPacket p if (client->authenticated) client->sendPacket(packet); } + area->logger->logModcall(this, &packet); area->logger->flush(); }