[11044] Make EffectDistract implementation less hacky

This commit is contained in:
zergtmn 2011-01-19 23:13:12 +05:00
parent 0f70e9a79c
commit 9bc37afa28
3 changed files with 8 additions and 18 deletions

View file

@ -4583,26 +4583,17 @@ void Spell::EffectDistract(SpellEffectIndex /*eff_idx*/)
return;
// target must be OK to do this
if( unitTarget->hasUnitState(UNIT_STAT_CAN_NOT_REACT) )
if (unitTarget->hasUnitState(UNIT_STAT_CAN_NOT_REACT))
return;
float angle = unitTarget->GetAngle(m_targets.m_destX, m_targets.m_destY);
if ( unitTarget->GetTypeId() == TYPEID_PLAYER )
{
// For players just turn them
WorldPacket data;
((Player*)unitTarget)->BuildTeleportAckMsg(&data, unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle);
((Player*)unitTarget)->GetSession()->SendPacket( &data );
((Player*)unitTarget)->SetPosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
}
else
{
// Set creature Distracted, Stop it, And turn it
unitTarget->SetOrientation(angle);
unitTarget->StopMoving();
unitTarget->clearUnitState(UNIT_STAT_MOVING);
unitTarget->SetOrientation(angle);
unitTarget->SendMonsterMove(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), SPLINETYPE_FACINGANGLE, SPLINEFLAG_WALKMODE, 0, NULL, angle);
if (unitTarget->GetTypeId() == TYPEID_UNIT)
unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS);
}
}
void Spell::EffectPickPocket(SpellEffectIndex /*eff_idx*/)

View file

@ -364,7 +364,6 @@ bool Unit::haveOffhandWeapon() const
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineType type, SplineFlags flags, uint32 Time, Player* player, ...)
{
va_list vargs;
va_start(vargs,player);
@ -395,7 +394,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
case SPLINETYPE_FACINGTARGET:
data << uint64(va_arg(vargs,uint64));
break;
case SPLINETYPE_FACINGANGLE: // not used currently
case SPLINETYPE_FACINGANGLE:
data << float(va_arg(vargs,double)); // facing angle
break;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11043"
#define REVISION_NR "11044"
#endif // __REVISION_NR_H__