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
-3
View File
@@ -1048,9 +1048,6 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
AddNotifier<Creature>(creature);
}
if (creature->IsVehicle())
creature->GetVehicleKit()->RelocatePassengers(x,y,z,ang);
assert(CheckGridIntegrity(creature,true));
}
+2 -16
View File
@@ -215,7 +215,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
WorldLocation const& dest = plMover->GetTeleportDest();
plMover->SetPosition(dest, true);
plMover->SetPosition(dest);
uint32 newzone, newarea;
plMover->GetZoneAndAreaId(newzone, newarea);
@@ -365,20 +365,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
plMover->UpdateFallInformationIfNeed(movementInfo, opcode);
// If on vehicle, update carried players
if (Vehicle *vehicle=plMover->GetVehicleKit())
{
if (plMover->IsVehicle())
{
for (int i=0; i < 8; ++i)
{
if (Unit *passenger = vehicle->GetPassenger(i))
if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER)
((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
}
}
}
if (movementInfo.z < -500.0f)
{
if (plMover->InBattleGround()
@@ -412,7 +398,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
else // creature charmed
{
mover->GetMap()->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
mover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
/*if(mover->canFly())
{
+2 -20
View File
@@ -5978,12 +5978,8 @@ void Player::removeActionButton(uint8 button)
bool Player::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,z,orientation))
{
sLog.outDebug("Player::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for player %d!",x,y,z,orientation,teleport,GetGUIDLow());
if (!Unit::SetPosition(x, y, z, orientation, teleport))
return false;
}
//if(movementInfo.flags & MOVEMENTFLAG_MOVING)
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
@@ -5991,22 +5987,10 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
//AURA_INTERRUPT_FLAG_JUMP not sure
bool turn = (GetOrientation() != orientation);
bool move2d = (teleport || GetPositionX() != x || GetPositionY() != y);
if (turn)
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
if (move2d || GetPositionZ() != z)
{
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE);
// move and update visible state if need
GetMap()->PlayerRelocation(this, x, y, z, orientation);
// reread after Map::Relocation
GetPosition(x, y, z);
// group update
if (move2d && GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
@@ -6014,13 +5998,11 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
// code block for underwater state update
UpdateUnderwaterState(GetMap(), x, y, z);
if(GetTrader() && !IsWithinDistInMap(GetTrader(), 5))
if(GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
GetSession()->SendCancelTrade();
CheckExploreSystem();
}
else if(turn)
SetOrientation(orientation);
return true;
}
+1 -1
View File
@@ -1790,8 +1790,8 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
void SendResetInstanceFailed(uint32 reason, uint32 MapId);
void SendResetFailedNotify(uint32 mapid);
virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
bool SetPosition(float x, float y, float z, float orientation, bool teleport = false);
void UpdateUnderwaterState( Map * m, float x, float y, float z );
void SendMessageToSet(WorldPacket *data, bool self);// overwrite Object::SendMessageToSet
+1 -1
View File
@@ -88,7 +88,7 @@ inline float Traveller<Creature>::Speed()
template<>
inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
{
i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation);
i_traveller.SetPosition(x, y, z, orientation);
}
template<>
+35 -1
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())
+2
View File
@@ -1425,6 +1425,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
virtual bool SetPosition(float x, float y, float z, float ang, bool teleport = false);
bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }
void KnockbackFrom(float x, float y, float speedXY, float speedZ);
void JumpTo(float speedXY, float speedZ, bool forward = true);
+8 -14
View File
@@ -321,8 +321,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if(((Creature*)me)->IsAIEnabled)
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
// move self = move all passengers
me->GetMap()->CreatureRelocation((Creature*)me, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
// update all passenger's positions
RelocatePassengers(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
}
}
@@ -385,18 +385,12 @@ void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
for (SeatMap::const_iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
if (Unit *passenger = itr->second.passenger)
{
if (passenger->GetTypeId() == TYPEID_PLAYER)
map->PlayerRelocation((Player*)passenger,
x + passenger->m_movementInfo.t_x,
y + passenger->m_movementInfo.t_y,
z + passenger->m_movementInfo.t_z,
ang + passenger->m_movementInfo.t_o);
else
map->CreatureRelocation((Creature*)passenger,
x + passenger->m_movementInfo.t_x,
y + passenger->m_movementInfo.t_y,
z + passenger->m_movementInfo.t_z,
ang + passenger->m_movementInfo.t_o);
float px = x + passenger->m_movementInfo.t_x;
float py = y + passenger->m_movementInfo.t_y;
float pz = z + passenger->m_movementInfo.t_z;
float po = ang + passenger->m_movementInfo.t_o;
passenger->SetPosition(px, py, pz, po);
}
}