Auto Jailing: Spell Cast Disable, code clean up

Permanent silence casted on offender when using .anticheat jail or if auto jail is turned on, they will not be able to cast any spells to teleport out of there. Code Style Clean up review on the TC Side of the module thanks to @jackpoz that i was able to bring over to this module and remove magic number dealing with  resurrection sickness.
This commit is contained in:
MDIC
2022-04-18 10:11:37 -04:00
parent 63dec836a1
commit a112d5ea5b
2 changed files with 20 additions and 23 deletions

View File

@@ -30,7 +30,9 @@ enum Spells
{
SHACKLES = 38505,
LFG_SPELL_DUNGEON_DESERTER = 71041,
BG_SPELL_DESERTER = 26013
BG_SPELL_DESERTER = 26013,
SILENCED = 23207,
RESURRECTION_SICKNESS = 15007
};
AnticheatMgr::AnticheatMgr()
@@ -88,7 +90,7 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme
// Prevents the False Positive for water walking when you ressurrect.
// Aura 15007 (Resurrection sickness) is given while dead before returning back to life.
if (player->HasAuraType(SPELL_AURA_GHOST) && player->HasAura(15007))
if (player->HasAuraType(SPELL_AURA_GHOST) && player->HasAura(RESURRECTION_SICKNESS))
return;
if (m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING))
@@ -191,8 +193,7 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Control Hack Detected!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Control Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -259,8 +260,7 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -304,8 +304,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -437,8 +436,6 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
case 718: //Transport: The Mighty Wind (Icecrown Citadel Raid)
return;
break;
default:
break;// Should never happen
}
uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
@@ -622,8 +619,7 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!";
std::string 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);
@@ -641,8 +637,7 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString());
}
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Kicked for Reaching Cheat Threshhold!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Kicked for Reaching Cheat Threshhold!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -668,8 +663,7 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by banning player {} ({})", player->GetName(), player->GetGUID().ToString());
}
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Banned Account for Reaching Cheat Threshhold!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Banned Account for Reaching Cheat Threshhold!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -698,8 +692,7 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by jailing player {} ({})", player->GetName(), player->GetGUID().ToString());
}
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Jailed Account for Reaching Cheat Threshhold!";
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Auto Jailed Account for Reaching Cheat Threshhold!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
@@ -711,8 +704,10 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
player->CastSpell(player, SHACKLES); // Shackle him in place to ensure no exploit happens for jail break attempt
Aura* dungdesert = player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player);// LFG_SPELL_DUNGEON_DESERTER
Aura* bgdesert = player->AddAura(BG_SPELL_DESERTER, player);// BG_SPELL_DESERTER
Aura* silent = player->AddAura(SILENCED, player);// SILENCED
dungdesert->SetDuration(-1);
bgdesert->SetDuration(-1);
silent->SetDuration(-1);
if (sConfigMgr->GetOption<bool>("Anticheat.AnnounceJail", true))
{

View File

@@ -31,7 +31,8 @@ enum Spells
{
SHACKLES = 38505,
LFG_SPELL_DUNGEON_DESERTER = 71041,
BG_SPELL_DESERTER = 26013
BG_SPELL_DESERTER = 26013,
SILENCED = 23207
};
class anticheat_commandscript : public CommandScript
@@ -139,8 +140,10 @@ public:
pTarget->CastSpell(pTarget, SHACKLES); // Shackle him in place to ensure no exploit happens for jail break attempt
Aura* dungdesert = pTarget->AddAura(LFG_SPELL_DUNGEON_DESERTER, pTarget);// LFG_SPELL_DUNGEON_DESERTER
Aura* bgdesert = pTarget->AddAura(BG_SPELL_DESERTER, pTarget);// BG_SPELL_DESERTER
Aura* silent = pTarget->AddAura(SILENCED, pTarget);// SILENCED
dungdesert->SetDuration(-1);
bgdesert->SetDuration(-1);
silent->SetDuration(-1);
return true;
}
@@ -176,10 +179,8 @@ public:
if (pTarget == handler->GetSession()->GetPlayer())
return false;
WorldLocation Aloc;
WorldLocation Hloc;
Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind
Hloc = WorldLocation(1, 1569.59f, -4397.63f, 16.06f, 0.54f);// Orgrimmar
WorldLocation Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind
WorldLocation Hloc = WorldLocation(1, 1569.59f, -4397.63f, 16.06f, 0.54f);// Orgrimmar
if (pTarget->GetTeamId() == TEAM_ALLIANCE)
{
@@ -194,6 +195,7 @@ public:
pTarget->RemoveAura(SHACKLES);// remove shackles
pTarget->RemoveAura(LFG_SPELL_DUNGEON_DESERTER);// LFG_SPELL_DUNGEON_DESERTER
pTarget->RemoveAura(BG_SPELL_DESERTER);// BG_SPELL_DESERTER
pTarget->RemoveAura(SILENCED);// SILENCED
sAnticheatMgr->AnticheatDeleteCommand(pTarget->GetGUID());// deletes auto reports on player
return true;