Skip to content

Commit

Permalink
chore (passive_anticheat): clean up and build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acidmanifesto committed Feb 21, 2024
1 parent 9db6042 commit e69ec4c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sql/character.anticheat.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ALTER TABLE `daily_players_reports`
ADD COLUMN `no_fall_damage_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `antiknockback_reports`;
ADD COLUMN `op_ack_hack_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `no_fall_damage_reports`;
ADD COLUMN `counter_measures_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `op_ack_hack_reports`;

ALTER TABLE `players_reports_status`
ADD COLUMN `teleport_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `climb_reports`,
ADD COLUMN `ignorecontrol_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `teleport_reports`,
Expand Down
31 changes: 16 additions & 15 deletions src/server/game/Anticheat/AnticheatMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
timeDiff = 1;
BuildReport(player, COUNTER_MEASURES_REPORT);
Expand All @@ -335,7 +335,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
timeDiff = 1;
BuildReport(player, COUNTER_MEASURES_REPORT);
Expand Down Expand Up @@ -386,7 +386,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 SPEED HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
}
Expand Down Expand Up @@ -452,7 +452,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 FLY HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_WRITELOG))
{
Expand Down Expand Up @@ -517,7 +517,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
}
Expand Down Expand Up @@ -602,7 +602,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 ADVANCE JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
}
Expand Down Expand Up @@ -768,7 +768,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
uint32 latency2 = 0;
latency2 = opponent->GetSession()->GetLatency();
std::string goXYZ2 = ".go xyz " + std::to_string(opponent->GetPositionX()) + " " + std::to_string(opponent->GetPositionY()) + " " + std::to_string(opponent->GetPositionZ() + 1.0f) + " " + std::to_string(opponent->GetMap()->GetId()) + " " + std::to_string(opponent->GetOrientation());
sWorld->SendGMText(LANG_ANTICHEAT_DUEL, player->GetName(), latency, opponent->GetName(), latency2);
sWorld->SendGMText(LANG_ANTICHEAT_DUEL, player->GetName().c_str(), latency, opponent->GetName().c_str(), latency2);

if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_WRITELOG_ENABLE))
{
Expand Down Expand Up @@ -802,7 +802,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MIN) && m_Players[key].GetTotalReports() <= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MAX))
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName(), latency);
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str(), latency);
}
_counter = 0;
}
Expand Down Expand Up @@ -831,7 +831,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 TELEPORT COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
player->TeleportTo(player->GetMapId(), lastX, lastY, lastZ, player->GetOrientation());
BuildReport(player, COUNTER_MEASURES_REPORT);
Expand Down Expand Up @@ -891,7 +891,7 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MIN) && m_Players[key].GetTotalReports() <= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MAX))
{
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName(), latency);
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str(), latency);
}
_counter = 0;
}
Expand Down Expand Up @@ -1052,7 +1052,7 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MIN) && m_Players[key].GetTotalReports() <= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MAX))
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName(), player->GetName(), latency);
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str(), latency);
}
_counter = 0;
}
Expand Down Expand Up @@ -1088,7 +1088,7 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 IGNORE-Z HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
}
Expand Down Expand Up @@ -1258,7 +1258,7 @@ void AnticheatMgr::BGreport(Player* player)
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MIN) && m_Players[key].GetTotalReports() <= sWorld->getIntConfig(CONFIG_ANTICHEAT_REPORT_IN_CHAT_MAX))
{
sWorld->SendGMText(LANG_ANTICHEAT_BG_EXPLOIT, player->GetName(), player->GetName(), latency);
sWorld->SendGMText(LANG_ANTICHEAT_BG_EXPLOIT, player->GetName().c_str(), player->GetName().c_str(), latency);
}
_counter = 0;
}
Expand Down Expand Up @@ -1301,7 +1301,7 @@ void AnticheatMgr::CheckBGOriginPositions(Player* player)
if (sWorld->getBoolConfig(CONFIG_ANTICHEAT_CM_ALERTCHAT))
{
std::string str = "|cFFFFFC00 BG START SPOT COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName(), player->GetName());
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
}
player->TeleportTo(player->GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation());
}
Expand Down Expand Up @@ -1685,7 +1685,7 @@ void AnticheatMgr::BuildReport(Player* player, uint8 reportType)
{
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName(), player->GetName(), latency);
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str(), latency);
}
_counter = 0;
}
Expand Down Expand Up @@ -1775,6 +1775,7 @@ void AnticheatMgr::BuildReport(Player* player, uint8 reportType)

player->TeleportTo(loc);// we defined loc as the jail location so we tele them there
player->SetHomebind(loc, 876);// GM Jail Homebind location
TC_LOG_INFO("anticheat", "AnticheatMgr:: Jail Command used on player {} ({})", player->GetName().c_str(), player->GetGUID().ToString());
player->CastSpell(player, SHACKLES);// shackle him in place to ensure no exploit happens for jail break attempt

if (Aura* dungdesert = player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player))// LFG_SPELL_DUNGEON_DESERTER
Expand Down
2 changes: 2 additions & 0 deletions src/server/scripts/Commands/cs_anticheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "Language.h"
#include "Log.h"
#include "ScriptMgr.h"
#include "ObjectMgr.h"
#include "ObjectAccessor.h"
Expand Down Expand Up @@ -107,6 +108,7 @@ class anticheat_commandscript : public CommandScript
WorldLocation loc = WorldLocation(1, 16226.5f, 16403.6f, -64.5f, 3.2f);// GM Jail Location
pTarget->TeleportTo(loc);
pTarget->SetHomebind(loc, 876);// GM Jail Homebind location
TC_LOG_INFO("anticheat", "AnticheatMgr:: Jail Command used on player {} ({})", player->GetName().c_str(), player->GetGUID().ToString());
pTarget->CastSpell(pTarget, SHACKLES);// shackle him in place to ensure no exploit happens for jail break attempt
if (Aura* dungdesert = pTarget->AddAura(LFG_SPELL_DUNGEON_DESERTER, pTarget))// LFG_SPELL_DUNGEON_DESERTER
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3404,7 +3404,7 @@ Anticheat.StricterFlyHackCheck = 0
Anticheat.StricterDetectJumpHack = 0

# Anticheat.SpeedLimitTolerance
# Description: Speed Limit Tolerance allows a certain whole percentage of tolerance to speed
# Description: Speed Limit Tolerance allows a certain whole percentage of tolerance to speed
# hack logging and detection.
#
# Example: AnticheatMgr:: Speed-Hack (Speed Movement at 12% above allowed Server Set rate 8%.)
Expand Down

0 comments on commit e69ec4c

Please sign in to comment.