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

@@ -1113,6 +1113,11 @@ void Spell::EffectJump(SpellEffIndex effIndex)
float speedXY, speedZ;
CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(unitTarget), speedXY, speedZ);
m_caster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
}
void Spell::EffectJumpDest(SpellEffIndex effIndex)
@@ -1142,6 +1147,12 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
{
speedXY = pow(speedZ * 10, 8);
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, 0, ObjectAccessor::GetUnit(*m_caster, m_caster->GetGuidValue(UNIT_FIELD_TARGET)));
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
return;
}
@@ -1156,6 +1167,11 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
speedXY = 1.0f;
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
}
void Spell::CalculateJumpSpeeds(uint8 i, float dist, float& speedXY, float& speedZ)
@@ -1177,6 +1193,11 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->IsInFlight())
return;
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
}
// Pre effects
switch (m_spellInfo->Id)
{
@@ -5056,6 +5077,11 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true);
}
// charge changes fall time
if( m_caster->GetTypeId() == TYPEID_PLAYER )
m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ());
@@ -5063,6 +5089,13 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (m_pathFinder)
{
m_caster->GetMotionMaster()->MoveCharge(m_pathFinder->GetEndPosition().x, m_pathFinder->GetEndPosition().y, m_pathFinder->GetEndPosition().z, 42.0f, EVENT_CHARGE, &m_pathFinder->GetPath());
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
m_caster->AddUnitState(UNIT_STATE_CHARGING);
}
else
{
@@ -5077,6 +5110,13 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
}
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ + Z_OFFSET_FIND_HEIGHT);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
m_caster->AddUnitState(UNIT_STATE_CHARGING);
}
}
@@ -5085,6 +5125,13 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
m_caster->ClearUnitState(UNIT_STATE_CHARGING);
if (m_caster->ToPlayer())
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true);
}
// not all charge effects used in negative spells
if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->Attack(unitTarget, true);
@@ -5096,6 +5143,11 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH)
return;
if (m_caster->ToPlayer())
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true);
}
if (m_targets.HasDst())
{
Position pos;
@@ -5109,6 +5161,11 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
}
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
}
}
@@ -5162,6 +5219,11 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
}
unitTarget->KnockbackFrom(x, y, speedxy, speedz);
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
}
}
void Spell::EffectLeapBack(SpellEffIndex effIndex)
@@ -5177,6 +5239,11 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
//1891: Disengage
m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
// xinef: changes fall time
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ());
@@ -5262,6 +5329,12 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex)
float speedZ = unitTarget->GetDistance(pos) / speedXY * 0.5f * Movement::gravity;
unitTarget->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ);
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(unitTarget->ToPlayer(), true);
sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer());
}
}
void Spell::EffectDispelMechanic(SpellEffIndex effIndex)