Skip to content

Commit

Permalink
[12225] Replace SMSG_FOCE_MOVE_[UN]ROOT with SetRoot wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Reamer authored and Schmoozerd committed Oct 22, 2012
1 parent d34266a commit ec67729
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 45 deletions.
10 changes: 2 additions & 8 deletions src/game/MiscHandler.cpp
Expand Up @@ -297,10 +297,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/)
if ((GetPlayer()->GetPositionZ() < height + 0.1f) && !(GetPlayer()->IsInWater()))
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);

WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8 + 4)); // guess size
data << GetPlayer()->GetPackGUID();
data << (uint32)2;
SendPacket(&data);
GetPlayer()->SetRoot(true);
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}

Expand Down Expand Up @@ -329,10 +326,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recv_data*/)
if (GetPlayer()->CanFreeMove())
{
//!we can move again
data.Initialize(SMSG_FORCE_MOVE_UNROOT, 8); // guess size
data << GetPlayer()->GetPackGUID();
data << uint32(0);
SendPacket(&data);
GetPlayer()->SetRoot(false);

//! Stand Up
GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND);
Expand Down
11 changes: 1 addition & 10 deletions src/game/Player.cpp
Expand Up @@ -20397,18 +20397,9 @@ void Player::SendInitialPacketsAfterAddToMap()
auraList.front()->ApplyModifier(true, true);
}

if (HasAuraType(SPELL_AURA_MOD_STUN))
if (HasAuraType(SPELL_AURA_MOD_STUN) || HasAuraType(SPELL_AURA_MOD_ROOT))
SetRoot(true);

// manual send package (have code in ApplyModifier(true,true); that don't must be re-applied.
if (HasAuraType(SPELL_AURA_MOD_ROOT))
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2 << GetPackGUID();
data2 << (uint32)2;
SendMessageToSet(&data2, true);
}

SendAurasForTarget(this);
SendEnchantmentDurations(); // must be after add to map
SendItemDurations(); // must be after add to map
Expand Down
31 changes: 5 additions & 26 deletions src/game/SpellAuras.cpp
Expand Up @@ -3276,14 +3276,7 @@ void Aura::HandleAuraWaterWalk(bool apply, bool Real)
if (!Real)
return;

WorldPacket data;
if (apply)
data.Initialize(SMSG_MOVE_WATER_WALK, 8 + 4);
else
data.Initialize(SMSG_MOVE_LAND_WALK, 8 + 4);
data << GetTarget()->GetPackGUID();
data << uint32(0);
GetTarget()->SendMessageToSet(&data, true);
GetTarget()->SetWaterWalk(apply);
}

void Aura::HandleAuraFeatherFall(bool apply, bool Real)
Expand Down Expand Up @@ -4450,10 +4443,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
target->SetStandState(UNIT_STAND_STATE_STAND);// in 1.5 client
}

WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8);
data << target->GetPackGUID();
data << uint32(0);
target->SendMessageToSet(&data, true);
target->SetRoot(true);

// Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine
if (GetId() == 39837)
Expand Down Expand Up @@ -4508,10 +4498,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
if (target->getVictim() && target->isAlive())
target->SetTargetGuid(target->getVictim()->GetObjectGuid());

WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8 + 4);
data << target->GetPackGUID();
data << uint32(0);
target->SendMessageToSet(&data, true);
target->SetRoot(false);
}

// Wyvern Sting
Expand Down Expand Up @@ -4739,10 +4726,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)

if (target->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10);
data << target->GetPackGUID();
data << (uint32)2;
target->SendMessageToSet(&data, true);
target->SetRoot(true);

// Clear unit movement flags
((Player*)target)->m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
Expand Down Expand Up @@ -4787,12 +4771,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
target->SetTargetGuid(target->getVictim()->GetObjectGuid());

if (target->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 10);
data << target->GetPackGUID();
data << (uint32)2;
target->SendMessageToSet(&data, true);
}
target->SetRoot(false);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12224"
#define REVISION_NR "12225"
#endif // __REVISION_NR_H__

0 comments on commit ec67729

Please sign in to comment.