Merge remote-tracking branch 'origin/master' into github-actions

This commit is contained in:
Helias
2020-11-15 10:36:23 +01:00
4 changed files with 42 additions and 26 deletions

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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

View File

@@ -18,6 +18,7 @@
#include "Chat.h"
#include "AnticheatMgr.h"
#include "Configuration/Config.h"
#include "Player.h"
class anticheat_commandscript : public CommandScript
{