mirror of
https://github.com/azerothcore/mod-anticheat.git
synced 2026-01-13 00:58:35 +00:00
Merge pull request #142 from Takenbacon/worldsessionmgr-fix
Update to support WorldSessionMgr PR
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "Configuration/Config.h"
|
#include "Configuration/Config.h"
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
|
#include "WorldSessionMgr.h"
|
||||||
|
|
||||||
std::string modulestring = "anticheat";
|
std::string modulestring = "anticheat";
|
||||||
constexpr auto LANG_ANTICHEAT_ALERT = 1;
|
constexpr auto LANG_ANTICHEAT_ALERT = 1;
|
||||||
@@ -93,8 +94,8 @@ AnticheatMgr::~AnticheatMgr()
|
|||||||
|
|
||||||
void AnticheatMgr::DoToAllGMs(std::function<void(Player*)> exec)
|
void AnticheatMgr::DoToAllGMs(std::function<void(Player*)> exec)
|
||||||
{
|
{
|
||||||
SessionMap::const_iterator itr;
|
WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
|
||||||
for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
|
||||||
if (Player* player = itr->second->GetPlayer())
|
if (Player* player = itr->second->GetPlayer())
|
||||||
if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->IsInWorld())
|
if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->IsInWorld())
|
||||||
exec(player);
|
exec(player);
|
||||||
@@ -152,7 +153,7 @@ void AnticheatMgr::SendMiddleScreenGMMessage(std::string str)
|
|||||||
{
|
{
|
||||||
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
|
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
|
||||||
data << str;
|
data << str;
|
||||||
sWorld->SendGlobalGMMessage(&data);
|
sWorldSessionMgr->SendGlobalGMMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* AnticheatMgr::GetReportNameFromReportType(ReportTypes reportType)
|
const char* AnticheatMgr::GetReportNameFromReportType(ReportTypes reportType)
|
||||||
@@ -1730,7 +1731,7 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType, Optional<
|
|||||||
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
||||||
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
||||||
" has been kicked by the Anticheat Module.|r";
|
" has been kicked by the Anticheat Module.|r";
|
||||||
sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1756,7 +1757,7 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType, Optional<
|
|||||||
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
||||||
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
||||||
" has been Banned by the Anticheat Module.|r";
|
" has been Banned by the Anticheat Module.|r";
|
||||||
sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1801,7 +1802,7 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType, Optional<
|
|||||||
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour <<
|
||||||
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
" Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour <<
|
||||||
" has been Jailed by the Anticheat Module.|r";
|
" has been Jailed by the Anticheat Module.|r";
|
||||||
sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1810,8 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType, Optional<
|
|||||||
void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
|
void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
// save All Anticheat Player Data before displaying global stats
|
// save All Anticheat Player Data before displaying global stats
|
||||||
for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
|
||||||
|
for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* plr = itr->second->GetPlayer())
|
if (Player* plr = itr->second->GetPlayer())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
|
#include "WorldSessionMgr.h"
|
||||||
|
|
||||||
Seconds resetTime = 0s;
|
Seconds resetTime = 0s;
|
||||||
Seconds lastIterationPlayer = GameTime::GetUptime() + 30s; //TODO: change 30 secs static to a configurable option
|
Seconds lastIterationPlayer = GameTime::GetUptime() + 30s; //TODO: change 30 secs static to a configurable option
|
||||||
@@ -78,9 +79,10 @@ public:
|
|||||||
{
|
{
|
||||||
lastIterationPlayer = GameTime::GetUptime() + Seconds(sConfigMgr->GetOption<uint32>("Anticheat.SaveReportsTime", 60));
|
lastIterationPlayer = GameTime::GetUptime() + Seconds(sConfigMgr->GetOption<uint32>("Anticheat.SaveReportsTime", 60));
|
||||||
|
|
||||||
LOG_INFO("module", "Saving reports for {} players.", sWorld->GetPlayerCount());
|
LOG_INFO("module", "Saving reports for {} players.", sWorldSessionMgr->GetPlayerCount());
|
||||||
|
|
||||||
for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
|
||||||
|
for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
|
||||||
if (Player* plr = itr->second->GetPlayer())
|
if (Player* plr = itr->second->GetPlayer())
|
||||||
sAnticheatMgr->SavePlayerData(plr);
|
sAnticheatMgr->SavePlayerData(plr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user