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

@@ -12759,6 +12759,8 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
if (Player* player = ToPlayer())
{
sScriptMgr->AnticheatSetUnderACKmount(player);
// mount as a vehicle
if (VehicleId)
{
@@ -12847,6 +12849,8 @@ void Unit::Dismount()
// (it could probably happen when logging in after a previous crash)
if (Player* player = ToPlayer())
{
sScriptMgr->AnticheatSetUnderACKmount(player);
if (Pet* pPet = player->GetPet())
{
if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
@@ -17292,6 +17296,11 @@ void Unit::SetControlled(bool apply, UnitState state)
default:
break;
}
if (GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
}
}
else
{
@@ -17383,7 +17392,10 @@ void Unit::SetStunned(bool apply)
if (GetTypeId() != TYPEID_PLAYER)
StopMoving();
else
{
SetStandState(UNIT_STAND_STATE_STAND);
sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
}
CastStop();
}
@@ -17447,6 +17459,8 @@ void Unit::SetRooted(bool apply)
data << GetPackGUID();
data << m_rootTimes;
SendMessageToSet(&data, true);
sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
}
else
{
@@ -17503,6 +17517,11 @@ void Unit::SetFeared(bool apply)
if (!caster)
caster = getAttackerForHelper();
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster == nullptr processed in MoveFleeing
if (GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
}
}
else
{
@@ -17535,6 +17554,11 @@ void Unit::SetConfused(bool apply)
{
SetTarget();
GetMotionMaster()->MoveConfused();
if (GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
}
}
else
{
@@ -17863,6 +17887,11 @@ void Unit::RemoveCharmedBy(Unit* charmer)
}
}
if (Player* player = ToPlayer())
{
sScriptMgr->AnticheatSetUnderACKmount(player);
}
// xinef: restore threat
for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
{
@@ -18362,6 +18391,8 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
if (player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_FLY))
player->SetCanFly(true, true);
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
}
}
@@ -18796,6 +18827,12 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
void Unit::EnterVehicle(Unit* base, int8 seatId)
{
CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId + 1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
if (Player* player = ToPlayer())
{
sScriptMgr->AnticheatSetUnderACKmount(player);
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
}
}
void Unit::EnterVehicleUnattackable(Unit* base, int8 seatId)
@@ -18840,6 +18877,9 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->IsInCombat())
return;
sScriptMgr->AnticheatSetUnderACKmount(player);
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
InterruptNonMeleeSpells(false);
player->StopCastingCharm();
player->StopCastingBindSight();
@@ -18903,6 +18943,12 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/)
//! init spline movement based on those coordinates in unapply handlers, and
//! relocate exiting passengers based on Unit::moveSpline data. Either way,
//! Coming Soon(TM)
if (Player* player = ToPlayer())
{
sScriptMgr->AnticheatSetUnderACKmount(player);
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
}
}
bool VehicleDespawnEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
@@ -18958,7 +19004,12 @@ void Unit::_ExitVehicle(Position const* exitPosition)
AddUnitState(UNIT_STATE_MOVE);
if (player)
{
player->SetFallInformation(time(nullptr), GetPositionZ());
sScriptMgr->AnticheatSetUnderACKmount(player);
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
}
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
{
WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8);