feat(Core/Anticheat): Preparation to implement new passive anticheat … (#5516)

This commit is contained in:
UltraNix
2021-05-07 18:10:44 +02:00
committed by GitHub
parent 0e8e21b812
commit 2189ac0b08
13 changed files with 406 additions and 64 deletions

View File

@@ -1549,6 +1549,11 @@ void ScriptMgr::OnBeforePlayerUpdate(Player* player, uint32 p_time)
FOREACH_SCRIPT(PlayerScript)->OnBeforeUpdate(player, p_time);
}
void ScriptMgr::OnPlayerUpdate(Player* player, uint32 p_time)
{
FOREACH_SCRIPT(PlayerScript)->OnUpdate(player, p_time);
}
void ScriptMgr::OnPlayerLogin(Player* player)
{
#ifdef ELUNA
@@ -2632,6 +2637,58 @@ void ScriptMgr::OnSetServerSideVisibilityDetect(Player* player, ServerSideVisibi
FOREACH_SCRIPT(PlayerScript)->OnSetServerSideVisibilityDetect(player, type, sec);
}
void ScriptMgr::AnticheatSetSkipOnePacketForASH(Player* player, bool apply)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatSetSkipOnePacketForASH(player, apply);
}
void ScriptMgr::AnticheatSetCanFlybyServer(Player* player, bool apply)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatSetCanFlybyServer(player, apply);
}
void ScriptMgr::AnticheatSetUnderACKmount(Player* player)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatSetUnderACKmount(player);
}
void ScriptMgr::AnticheatSetRootACKUpd(Player* player)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatSetRootACKUpd(player);
}
void ScriptMgr::AnticheatSetJumpingbyOpcode(Player* player, bool jump)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatSetJumpingbyOpcode(player, jump);
}
void ScriptMgr::AnticheatUpdateMovementInfo(Player* player, MovementInfo const& movementInfo)
{
FOREACH_SCRIPT(PlayerScript)->AnticheatUpdateMovementInfo(player, movementInfo);
}
bool ScriptMgr::AnticheatHandleDoubleJump(Player* player, Unit* mover)
{
bool ret = true;
FOR_SCRIPTS_RET(PlayerScript, itr, end, ret) // return true by default if not scripts
if (!itr->second->AnticheatHandleDoubleJump(player, mover))
ret = false; // we change ret value only when scripts return true
return ret;
}
bool ScriptMgr::AnticheatCheckMovementInfo(Player* player, MovementInfo const& movementInfo, Unit* mover, bool jump)
{
bool ret = true;
FOR_SCRIPTS_RET(PlayerScript, itr, end, ret) // return true by default if not scripts
if (!itr->second->AnticheatCheckMovementInfo(player, movementInfo, mover, jump))
ret = false; // we change ret value only when scripts return true
return ret;
}
bool ScriptMgr::CanGuildSendBankList(Guild const* guild, WorldSession* session, uint8 tabId, bool sendAllSlots)
{
bool ret = true;

View File

@@ -732,6 +732,7 @@ public:
// Called for player::update
virtual void OnBeforeUpdate(Player* /*player*/, uint32 /*p_time*/) { }
virtual void OnUpdate(Player* /*player*/, uint32 /*p_time*/) { }
// Called when a player's money is modified (before the modification is done)
virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { }
@@ -1014,6 +1015,16 @@ public:
virtual void OnSetServerSideVisibility(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
virtual void OnSetServerSideVisibilityDetect(Player* /*player*/, ServerSideVisibilityType& /*type*/, AccountTypes& /*sec*/) { }
// Passive Anticheat System
virtual void AnticheatSetSkipOnePacketForASH(Player* /*player*/, bool /*apply*/) { }
virtual void AnticheatSetCanFlybyServer(Player* /*player*/, bool /*apply*/) { }
virtual void AnticheatSetUnderACKmount(Player* /*player*/) { }
virtual void AnticheatSetRootACKUpd(Player* /*player*/) { }
virtual void AnticheatSetJumpingbyOpcode(Player* /*player*/, bool /*jump*/) { }
virtual void AnticheatUpdateMovementInfo(Player* /*player*/, MovementInfo const& /*movementInfo*/) { }
[[nodiscard]] virtual bool AnticheatHandleDoubleJump(Player* /*player*/, Unit* /*mover*/) { return true; }
[[nodiscard]] virtual bool AnticheatCheckMovementInfo(Player* /*player*/, MovementInfo const& /*movementInfo*/, Unit* /*mover*/, bool /*jump*/) { return true; }
};
class AccountScript : public ScriptObject
@@ -1542,6 +1553,7 @@ public: /* AchievementCriteriaScript */
public: /* PlayerScript */
void OnBeforePlayerUpdate(Player* player, uint32 p_time);
void OnPlayerUpdate(Player* player, uint32 p_time);
void OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data);
void OnPlayerReleasedGhost(Player* player);
void OnPVPKill(Player* killer, Player* killed);
@@ -1667,6 +1679,14 @@ public: /* PlayerScript */
bool CanInitTrade(Player* player, Player* target);
void OnSetServerSideVisibility(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
void OnSetServerSideVisibilityDetect(Player* player, ServerSideVisibilityType& type, AccountTypes& sec);
void AnticheatSetSkipOnePacketForASH(Player* player, bool apply);
void AnticheatSetCanFlybyServer(Player* player, bool apply);
void AnticheatSetUnderACKmount(Player* player);
void AnticheatSetRootACKUpd(Player* player);
void AnticheatUpdateMovementInfo(Player* player, MovementInfo const& movementInfo);
void AnticheatSetJumpingbyOpcode(Player* player, bool jump);
bool AnticheatHandleDoubleJump(Player* player, Unit* mover);
bool AnticheatCheckMovementInfo(Player* player, MovementInfo const& movementInfo, Unit* mover, bool jump);
public: /* AccountScript */
void OnAccountLogin(uint32 accountId);