More config options + stricter fly/waterwalk hack detects

This commit is contained in:
3ndos
2016-12-07 18:15:15 -05:00
parent 38bca106c9
commit 6ebd04b452
3 changed files with 306 additions and 277 deletions

View File

@@ -9,6 +9,8 @@
# 0 - (Disabled)
Anticheat.Enabled = 1
#Enable detection for GM accounts
Anticheat.EnabledOnGmAccounts = 0
# Anticheat.ReportsForIngameWarnings
# Description: How many reports the player must have to notify to GameMasters ingame when he generates a new report.
@@ -26,7 +28,13 @@ Anticheat.LoginMessage = 1
# Description: It represents which detections are enabled.
# Default 1 (climbhack = 0 by default)
Anticheat.DetectFlyHack = 1
Anticheat.DetectWaterWalk = 1
#Checks moveflag ascending (may give flase positives)
Anticheat.StricterFlyHackCheck = 0
#kick option for first detect on flyhack, if false positives disable(disabled by default)
Anticheat.KickPlayerFlyHack = 0
Anticheat.DetectWaterWalkHack = 1
#kick option for first detect on waterwalkhack, if false positives disable(disabled by default)
Anticheat.KickPlayerWaterWalkHack = 0
Anticheat.DetectJumpHack = 1
Anticheat.DetectTelePlaneHack = 1
Anticheat.DetectSpeedHack = 1

View File

@@ -38,17 +38,18 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo /* movementInf
if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP && opcode == MSG_MOVE_JUMP)
{
BuildReport(player, JUMP_HACK_REPORT);
sLog->outString( "AnticheatMgr:: Jump-Hack detected player GUID (low) %u",player->GetGUIDLow());
sLog->outString("AnticheatMgr:: Jump-Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
}
}
void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo /* movementInfo */)
void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetBoolDefault("Anticheat.DetectWaterWalk", true))
if (!sConfigMgr->GetBoolDefault("Anticheat.DetectWaterWalkHack", true))
return;
uint32 key = player->GetGUIDLow();
if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING))
/* Thanks to @LilleCarl */
if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING))
return;
// if we are a ghost we can walk on water
@@ -59,27 +60,42 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo /* move
player->HasAuraType(SPELL_AURA_SAFE_FALL) ||
player->HasAuraType(SPELL_AURA_WATER_WALK))
return;
sLog->outString( "AnticheatMgr:: Walk on Water - Hack detected player GUID (low) %u",player->GetGUIDLow());
if (sConfigMgr->GetBoolDefault("Anticheat.KickPlayerWaterWalkHack", false))
{
/* cheap hack for now, look at "applyfortargets" later*/
/*player->AddAura(SPELL_AURA_WATER_WALK, player);
player->RemoveAura(SPELL_AURA_WATER_WALK);*/
//cba to double check this, just adding a kick option
player->GetSession()->KickPlayer(true);
sLog->outString("AnticheatMgr:: Walk on Water - Hack detected and counteracted by kicking player %s (%u)", player->GetName(), player->GetGUIDLow());
}
else {
sLog->outString("AnticheatMgr:: Walk on Water - Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
}
BuildReport(player, WALK_WATER_HACK_REPORT);
}
void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo /* movementInfo */)
void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetBoolDefault("Anticheat.DetectFlyHack", true))
return;
uint32 key = player->GetGUIDLow();
if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FLYING))
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;
if (player->HasAuraType(SPELL_AURA_FLY) ||
player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) ||
player->HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED))
/*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;
sLog->outString( "AnticheatMgr:: Fly-Hack detected player GUID (low) %u",player->GetGUIDLow());
if (sConfigMgr->GetBoolDefault("Anticheat.KickPlayerFlyHack", false))
{
sLog->outString("AnticheatMgr:: Fly-Hack detected and counteracted by kicking player %s (%u)", player->GetName(), player->GetGUIDLow());
player->GetSession()->KickPlayer(true);
}else
sLog->outString( "AnticheatMgr:: Fly-Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
BuildReport(player,FLY_HACK_REPORT);
}
@@ -108,7 +124,7 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem
// we are not really walking there
if (z_diff > 1.0f)
{
sLog->outString( "AnticheatMgr:: Teleport To Plane - Hack detected player GUID (low) %u",player->GetGUIDLow());
sLog->outString("AnticheatMgr:: Teleport To Plane - Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
BuildReport(player, TELEPORT_PLANE_HACK_REPORT);
}
}
@@ -169,7 +185,7 @@ void AnticheatMgr::ClimbHackDetection(Player *player, MovementInfo movementInfo,
if (angle > CLIMB_ANGLE)
{
sLog->outString( "AnticheatMgr:: Climb-Hack detected player GUID (low) %u", player->GetGUIDLow());
sLog->outString("AnticheatMgr:: Climb-Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
BuildReport(player, CLIMB_HACK_REPORT);
}
}
@@ -217,7 +233,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player,MovementInfo movementInfo)
if (clientSpeedRate > speedRate)
{
BuildReport(player, SPEED_HACK_REPORT);
sLog->outString( "AnticheatMgr:: Speed-Hack detected player GUID (low) %u",player->GetGUIDLow());
sLog->outString("AnticheatMgr:: Speed-Hack detected player %s (%u)", player->GetName(), player->GetGUIDLow());
}
}
@@ -289,7 +305,8 @@ void AnticheatMgr::BuildReport(Player* player,uint8 reportType)
if (m_Players[key].GetTempReports(reportType) < 3)
return;
} else
}
else
{
m_Players[key].SetTempReportsTimer(actualTime, reportType);
m_Players[key].SetTempReports(1, reportType);
@@ -329,7 +346,7 @@ void AnticheatMgr::BuildReport(Player* player,uint8 reportType)
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[AC]|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -346,7 +363,8 @@ void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
{
handler->PSendSysMessage("No players found.");
return;
} else
}
else
{
handler->SendSysMessage("=============================");
handler->PSendSysMessage("Players with the lowest averages:");
@@ -371,7 +389,8 @@ void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
{
handler->PSendSysMessage("No players found.");
return;
} else
}
else
{
handler->PSendSysMessage("=============================");
handler->PSendSysMessage("Players with the more reports:");

View File

@@ -1,6 +1,7 @@
#include "Configuration/Config.h"
#include "AnticheatMgr.h"
#include "Object.h"
#include "AccountMgr.h"
int64 resetTime = 0;
int64 lastIterationPlayer = sWorld->GetUptime() + 30;//TODO: change 30 secs static to a configurable option
@@ -82,6 +83,7 @@ class AnticheatMovementHandlerScript : public MovementHandlerScript
}
void AnticheatMovementHandlerScript::OnPlayerMove(Player* player, MovementInfo mi, uint32 opcode) override
{
if (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || sConfigMgr->GetBoolDefault("Anticheat.EnabledOnGmAccounts", false))
sAnticheatMgr->StartHackDetection(player, mi, opcode);
}
};