*Fix the bug that knockback cause client crash.
--HG-- branch : trunk
This commit is contained in:
@@ -5935,7 +5935,7 @@ void Spell::EffectKnockBack(uint32 i)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float x, y;
|
float x, y;
|
||||||
if(m_targets.HasDest())
|
if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||||
{
|
{
|
||||||
x = m_targets.m_destX;
|
x = m_targets.m_destX;
|
||||||
y = m_targets.m_destY;
|
y = m_targets.m_destY;
|
||||||
@@ -5948,10 +5948,19 @@ void Spell::EffectKnockBack(uint32 i)
|
|||||||
|
|
||||||
float dx = unitTarget->GetPositionX() - x;
|
float dx = unitTarget->GetPositionX() - x;
|
||||||
float dy = unitTarget->GetPositionY() - y;
|
float dy = unitTarget->GetPositionY() - y;
|
||||||
|
float vcos, vsin;
|
||||||
|
if(dx < 0.001f && dy < 0.001f)
|
||||||
|
{
|
||||||
|
float angle = rand_norm()*2*M_PI;
|
||||||
|
vcos = cos(angle);
|
||||||
|
vsin = sin(angle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
float dist = sqrt((dx*dx) + (dy*dy));
|
float dist = sqrt((dx*dx) + (dy*dy));
|
||||||
|
vcos = dx / dist;
|
||||||
float vcos = dx / dist;
|
vsin = dy / dist;
|
||||||
float vsin = dy / dist;
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
|
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
|
||||||
data.append(unitTarget->GetPackGUID());
|
data.append(unitTarget->GetPackGUID());
|
||||||
|
|||||||
Reference in New Issue
Block a user