feat(Misc): update to new API (#41)

This commit is contained in:
Kargatum
2022-01-19 12:02:24 +07:00
committed by GitHub
parent 0467ed0f51
commit 2319489102
5 changed files with 48 additions and 24 deletions

View File

@@ -1,12 +1,31 @@
#include "Configuration/Config.h"
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Config.h"
#include "AnticheatMgr.h"
#include "Object.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "Player.h"
#include "Timer.h"
int64 resetTime = 0;
int64 lastIterationPlayer = sWorld->GetUptime() + 30;//TODO: change 30 secs static to a configurable option
class AnticheatPlayerScript : public PlayerScript
{
public:
@@ -43,7 +62,8 @@ public:
UpdateReportResetTime();
sLog->outString( "Anticheat: Next daily report reset: %ld", resetTime);
}
if (sWorld->GetUptime() > lastIterationPlayer)
if (sWorld->GetUptime() > lastIterationPlayer)
{
lastIterationPlayer = sWorld->GetUptime() + sConfigMgr->GetOption<uint32>("Anticheat.SaveReportsTime", 60);
sLog->outString( "Saving reports for %u players.", sWorld->GetPlayerCount());
@@ -53,13 +73,15 @@ public:
sAnticheatMgr->SavePlayerData(plr);
}
}
void OnAfterConfigLoad(bool /* reload */) override // unusued parameter
void OnAfterConfigLoad(bool /* reload */) override // unusued parameter
{
sLog->outString("AnticheatModule Loaded.");
}
void UpdateReportResetTime()
void UpdateReportResetTime()
{
resetTime = sWorld->GetNextTimeWithDayAndHour(-1, 6);
resetTime = Acore::Time::GetNextTimeWithDayAndHour(-1, 6);
}
};
class AnticheatMovementHandlerScript : public MovementHandlerScript