Auras with turn/move interrupt flags are now removed for creatures when they turn/move, cleanup

--HG--
branch : trunk
This commit is contained in:
silver1ce
2010-01-18 21:51:45 +02:00
parent f920a3c57b
commit cfca61b176
8 changed files with 51 additions and 56 deletions

View File

@@ -15902,7 +15902,7 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
// FIXME: this interrupts spell visual
DestroyForNearbyPlayers();
GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
SetPosition(x, y, z, orientation, true);
//ObjectAccessor::UpdateObjectVisibility(this);
//WorldPacket data;
@@ -15913,6 +15913,40 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
}
}
bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
{
// prevent crash when a bad coord is sent by the client
if (!Trinity::IsValidMapCoord(x,y))
{
sLog.outDebug("Unit::SetPosition(%f, %f, %f) .. bad coordinates!",x,y,z);
return false;
}
bool turn = (GetOrientation() != orientation);
bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
if (turn)
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
if (relocated)
{
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
// move and update visible state if need
if(GetTypeId() == TYPEID_PLAYER)
GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
else
GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
}
else if(turn)
SetOrientation(orientation);
if ((relocated || turn) && IsVehicle())
GetVehicleKit()->RelocatePassengers(x,y,z,orientation);
return true;
}
void Unit::SendThreatListUpdate()
{
if (uint32 count = getThreatManager().getThreatList().size())