mirror of
https://github.com/azerothcore/mod-anticheat.git
synced 2026-02-02 10:23:49 +00:00
fix (commands): crash fix
crash fix when using select gm cmds from console
This commit is contained in:
@@ -155,39 +155,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleAntiCheatDeleteCommand(ChatHandler* handler, const char* args)
|
static bool HandleAntiCheatDeleteCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
||||||
{
|
|
||||||
if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string strCommand;
|
|
||||||
|
|
||||||
char* command = strtok((char*)args, " "); // get entered name
|
|
||||||
|
|
||||||
if (!command)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
strCommand = command;
|
|
||||||
|
|
||||||
if (strCommand.compare("deleteall") == 0)
|
|
||||||
sAnticheatMgr->AnticheatDeleteCommand(ObjectGuid::Empty);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
normalizePlayerName(strCommand);
|
|
||||||
Player* player = ObjectAccessor::FindPlayerByName(strCommand.c_str()); // get player by name
|
|
||||||
if (!player)
|
|
||||||
handler->PSendSysMessage("Player doesn't exist");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sAnticheatMgr->AnticheatDeleteCommand(player->GetGUID());
|
|
||||||
handler->PSendSysMessage("Anticheat Reports deleted for player {}", player->GetName().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool HandleAntiCheatPlayerCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
|
||||||
{
|
{
|
||||||
if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0))
|
if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0))
|
||||||
return false;
|
return false;
|
||||||
@@ -200,9 +168,28 @@ public:
|
|||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
sAnticheatMgr->AnticheatDeleteCommand(player->GetGUID());
|
||||||
|
handler->PSendSysMessage("Anticheat Reports deleted for player %s", player->GetName().c_str());
|
||||||
|
sAnticheatMgr->AnticheatDeleteCommand(player->GetGUID());// deletes auto reports on player
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleAntiCheatPlayerCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
||||||
|
{
|
||||||
|
if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0))
|
||||||
|
return false;
|
||||||
|
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
|
|
||||||
|
if (!player)
|
||||||
|
player = PlayerIdentifier::FromTarget(handler);
|
||||||
|
if (!player)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
float average = sAnticheatMgr->GetAverage(guid);
|
float average = sAnticheatMgr->GetAverage(guid);
|
||||||
uint32 total_reports = sAnticheatMgr->GetTotalReports(guid);
|
uint32 total_reports = sAnticheatMgr->GetTotalReports(guid);
|
||||||
uint32 speed_reports = sAnticheatMgr->GetTypeReports(guid, 0);
|
uint32 speed_reports = sAnticheatMgr->GetTypeReports(guid, 0);
|
||||||
@@ -214,14 +201,12 @@ public:
|
|||||||
uint32 teleport_reports = sAnticheatMgr->GetTypeReports(guid, 6);
|
uint32 teleport_reports = sAnticheatMgr->GetTypeReports(guid, 6);
|
||||||
uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, 7);
|
uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, 7);
|
||||||
uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, 8);
|
uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, 8);
|
||||||
|
handler->PSendSysMessage("Information about player %s", player->GetName().c_str());
|
||||||
handler->PSendSysMessage("Information about player {}", player->GetName().c_str());
|
handler->PSendSysMessage("Average: %f || Total Reports: %u ", average, total_reports);
|
||||||
handler->PSendSysMessage("Average: {} || Total Reports: {} ", average, total_reports);
|
handler->PSendSysMessage("Speed Reports: %u || Fly Reports: %u || Jump Reports: %u ", speed_reports, fly_reports, jump_reports);
|
||||||
handler->PSendSysMessage("Speed Reports: {} || Fly Reports: {} || Jump Reports: {} ", speed_reports, fly_reports, jump_reports);
|
handler->PSendSysMessage("Walk On Water Reports: %u || Teleport To Plane Reports: %u", waterwalk_reports, teleportplane_reports);
|
||||||
handler->PSendSysMessage("Walk On Water Reports: {} || Teleport To Plane Reports: {}", waterwalk_reports, teleportplane_reports);
|
handler->PSendSysMessage("Teleport Reports: %u || Climb Reports: %u", teleport_reports, climb_reports);
|
||||||
handler->PSendSysMessage("Teleport Reports: {} || Climb Reports: {}", teleport_reports, climb_reports);
|
handler->PSendSysMessage("Ignore Control Reports: %u || Ignore Z-Axis Reports: %u", ignorecontrol_reports, zaxis_reports);
|
||||||
handler->PSendSysMessage("Ignore Control Reports: {} || Ignore Z-Axis Reports: {}", ignorecontrol_reports, zaxis_reports);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user