From bfd37bc42439f07ffe194efd52da22679a2a95d1 Mon Sep 17 00:00:00 2001 From: MDIC Date: Thu, 3 Mar 2022 09:55:18 -0500 Subject: [PATCH] Fix: Correct console logging Ensure your conf Anticheat.WriteLog is set to 1 if you want it to write to the console server.log file. still trying to figure out why we cant do a appender and logger setting for this one --- src/AnticheatMgr.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 3e8e926..28a631e 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -14,6 +14,7 @@ */ #include "AnticheatMgr.h" +#include "Log.h" #include "MapMgr.h" #include "Player.h" #include "Configuration/Config.h" @@ -79,8 +80,10 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme if (sConfigMgr->GetOption("Anticheat.KickPlayerWaterWalkHack", false)) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Walk on Water - Hack detected and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString()); + } player->GetSession()->KickPlayer(true); if (sConfigMgr->GetOption("Anticheat.AnnounceKick", true)) @@ -95,7 +98,7 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); } } - else if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + else if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) { LOG_INFO("module", "AnticheatMgr:: Walk on Water - Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); } @@ -128,7 +131,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) if (sConfigMgr->GetOption("Anticheat.KickPlayerFlyHack", false)) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) { LOG_INFO("module", "AnticheatMgr:: Fly-Hack detected and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString()); } @@ -146,7 +149,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); } } - else if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + else if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) { LOG_INFO("module", "AnticheatMgr:: Fly-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); } @@ -179,8 +182,10 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem // we are not really walking there if (z_diff > 1.0f) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Teleport To Plane - Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } BuildReport(player, TELEPORT_PLANE_HACK_REPORT); } @@ -213,8 +218,10 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str()); } } - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Ignore Control - Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } BuildReport(player, IGNORE_CONTROL_REPORT); } @@ -257,8 +264,10 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str()); } } - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Teleport-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } BuildReport(player, TELEPORT_HACK_REPORT); } @@ -322,8 +331,10 @@ void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, if (angle > CLIMB_ANGLE) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Climb-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } BuildReport(player, CLIMB_HACK_REPORT); } @@ -411,8 +422,10 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo) // we did the (uint32) cast to accept a margin of tolerance if (clientSpeedRate > speedRate * 1.25f) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { LOG_INFO("module", "AnticheatMgr:: Speed-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } BuildReport(player, SPEED_HACK_REPORT); }