avoid send movement packet at death twice, cleanup

--HG--
branch : trunk
This commit is contained in:
silver1ce
2010-03-07 18:17:37 +02:00
parent 91b8ee104e
commit 9a8f10fa30
4 changed files with 15 additions and 17 deletions
-8
View File
@@ -1484,14 +1484,6 @@ void Creature::setDeathState(DeathState s)
if(m_formation && m_formation->getLeader() == this) if(m_formation && m_formation->getLeader() == this)
m_formation->FormationReset(true); m_formation->FormationReset(true);
SetHealth(0);
SetPower(getPowerType(),0);
// For some reason movement packet is always to be issued on death
// send if not going to fall down
if (!canFly() && !IsFlying())
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0);
if ((canFly() || IsFlying()) && FallGround()) if ((canFly() || IsFlying()) && FallGround())
return; return;
-5
View File
@@ -1448,11 +1448,6 @@ void Player::setDeathState(DeathState s)
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1);
// For some reason movement packet is always to be issued on death
// send if not going to fall down
if (!IsFlying() || GetTransport())
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0);
} }
Unit::setDeathState(s); Unit::setDeathState(s);
+13 -2
View File
@@ -311,14 +311,25 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
SendMonsterMove(x, y, z, transitTime, player); SendMonsterMove(x, y, z, transitTime, player);
} }
void Unit::SendMonsterStop() void Unit::SendMonsterStop(bool on_death)
{ {
WorldPacket data(SMSG_MONSTER_MOVE, (17 + GetPackGUID().size())); WorldPacket data(SMSG_MONSTER_MOVE, (17 + GetPackGUID().size()));
data.append(GetPackGUID()); data.append(GetPackGUID());
data << uint8(0); // new in 3.1 data << uint8(0); // new in 3.1
data << GetPositionX() << GetPositionY() << GetPositionZ(); data << GetPositionX() << GetPositionY() << GetPositionZ();
data << getMSTime(); data << getMSTime();
if (on_death == true)
{
data << uint8(1); data << uint8(1);
data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << uint32(0); // Time in between points
data << uint32(1); // 1 single waypoint
data << GetPositionX() << GetPositionY() << GetPositionZ();
}
else
data << uint8(0);
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
clearUnitState(UNIT_STAT_MOVE); clearUnitState(UNIT_STAT_MOVE);
@@ -12002,7 +12013,7 @@ void Unit::setDeathState(DeathState s)
GetMotionMaster()->MoveIdle(); GetMotionMaster()->MoveIdle();
if (m_vehicleKit) if (m_vehicleKit)
m_vehicleKit->Die(); m_vehicleKit->Die();
StopMoving(); SendMonsterStop(true);
//without this when removing IncreaseMaxHealth aura player may stuck with 1 hp //without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
//do not why since in IncreaseMaxHealth currenthealth is checked //do not why since in IncreaseMaxHealth currenthealth is checked
SetHealth(0); SetHealth(0);
+1 -1
View File
@@ -1432,7 +1432,7 @@ class Unit : public WorldObject
void JumpTo(float speedXY, float speedZ, bool forward = true); void JumpTo(float speedXY, float speedZ, bool forward = true);
void JumpTo(WorldObject *obj, float speedZ); void JumpTo(WorldObject *obj, float speedZ);
void SendMonsterStop(); void SendMonsterStop(bool on_death = false);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL); void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL); void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);