diff --git a/README.md b/README.md index 8f1a08e..cf32f22 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Anticheat Module +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore +## Anticheat Module +- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-anticheat/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-anticheat) This is a port of the PassiveAnticheat Script from lordpsyan's repo to [AzerothCore](http://www.azerothcore.org) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 1a25def..27f2bcd 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -88,39 +88,50 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) { if (!sConfigMgr->GetBoolDefault("Anticheat.DetectFlyHack", true)) + { return; + } if (player->HasAuraType(SPELL_AURA_FLY) || player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED))//overkill but wth + { return; + } - /*Thanks to @LilleCarl for info to check extra flag*/ - bool stricterChecks = true; - if (sConfigMgr->GetBoolDefault("Anticheat.StricterFlyHackCheck", false)) - stricterChecks = !(movementInfo.HasMovementFlag(MOVEMENTFLAG_ASCENDING) && !player->IsInWater()); + /*Thanks to @LilleCarl for info to check extra flag*/ + bool stricterChecks = true; + if (sConfigMgr->GetBoolDefault("Anticheat.StricterFlyHackCheck", false)) + { + stricterChecks = !(movementInfo.HasMovementFlag(MOVEMENTFLAG_ASCENDING) && !player->IsInWater()); + } - if (!movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING) && stricterChecks) - return; + if (!movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING) && stricterChecks) + { + return; + } - if (sConfigMgr->GetBoolDefault("Anticheat.KickPlayerFlyHack", false)) - { - if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) - sLog->outString("AnticheatMgr:: Fly-Hack detected and counteracted by kicking player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); + if (sConfigMgr->GetBoolDefault("Anticheat.KickPlayerFlyHack", false)) + { + if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) + { + sLog->outString("AnticheatMgr:: Fly-Hack detected and counteracted by kicking player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); + } - player->GetSession()->KickPlayer(true); - if(sConfigMgr->GetBoolDefault("Anticheat.AnnounceKick", true)) - { - std::string plr = player->GetName(); - std::string tag_colour = "7bbef7"; - std::string plr_colour = "ff0000"; - std::ostringstream stream; - stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour << - " Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour << - " has been kicked.|r"; - sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); - } - } else if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) { - sLog->outString( "AnticheatMgr:: Fly-Hack detected player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); - } + player->GetSession()->KickPlayer(true); + if(sConfigMgr->GetBoolDefault("Anticheat.AnnounceKick", true)) + { + std::string plr = player->GetName(); + std::string tag_colour = "7bbef7"; + std::string plr_colour = "ff0000"; + std::ostringstream stream; + stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour << + " Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour << + " has been kicked.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } + } else if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) + { + sLog->outString( "AnticheatMgr:: Fly-Hack detected player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); + } BuildReport(player,FLY_HACK_REPORT); } diff --git a/src/AnticheatScripts.cpp b/src/AnticheatScripts.cpp index beeda5a..f54bb15 100644 --- a/src/AnticheatScripts.cpp +++ b/src/AnticheatScripts.cpp @@ -2,6 +2,8 @@ #include "AnticheatMgr.h" #include "Object.h" #include "AccountMgr.h" +#include "Chat.h" +#include "Player.h" int64 resetTime = 0; int64 lastIterationPlayer = sWorld->GetUptime() + 30;//TODO: change 30 secs static to a configurable option diff --git a/src/cs_anticheat.cpp b/src/cs_anticheat.cpp index f0cd5a6..52fd7c9 100644 --- a/src/cs_anticheat.cpp +++ b/src/cs_anticheat.cpp @@ -18,6 +18,7 @@ #include "Chat.h" #include "AnticheatMgr.h" #include "Configuration/Config.h" +#include "Player.h" class anticheat_commandscript : public CommandScript {