Core/Movement: Use SetWalk(true/false) instead of AddUnit/RemoveUnit.

This commit is contained in:
Venugh
2012-02-23 11:50:58 +01:00
parent 9219625243
commit 1cac01b3df
50 changed files with 131 additions and 122 deletions
@@ -492,7 +492,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
// Increment Enemy Count to be used in World States and instance script
++EnemyCount;
creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
creature->SetWalk(false);
creature->setActive(true);
switch (entry)
{
@@ -1014,7 +1014,7 @@ void hyjalAI::WaypointReached(uint32 i)
if ((*itr) && (*itr)->isAlive() && (*itr) != me && (*itr)->GetEntry() != JAINA)
{
if (!(*itr)->IsWithinDist(me, 60))
(*itr)->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
(*itr)->SetWalk(false);
float x, y, z;
(*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
(*itr)->GetMotionMaster()->Initialize();
@@ -591,11 +591,11 @@ public:
}
//After waypoint 0
case 1:
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
if (Unit* pUther = me->SummonCreature(NPC_UTHER, 1794.357f, 1272.183f, 140.558f, 1.37f, TEMPSUMMON_DEAD_DESPAWN, 180000))
{
uiUtherGUID = pUther->GetGUID();
pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
pUther->SetWalk(false);
pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f);
pUther->SetTarget(me->GetGUID());
me->SetTarget(uiUtherGUID);
@@ -680,7 +680,7 @@ public:
case 17:
if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
{
pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
pUther->SetWalk(true);
pUther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
}
JumpToNextStep(1000);
@@ -689,7 +689,7 @@ public:
if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
{
me->SetTarget(uiJainaGUID);
pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
pJaina->SetWalk(true);
pJaina->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
}
JumpToNextStep(1000);
@@ -755,7 +755,7 @@ public:
if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0]))
{
pCityman->SetTarget(me->GetGUID());
pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
pCityman->SetWalk(true);
pCityman->GetMotionMaster()->MovePoint(0, 2088.625f, 1279.191f, 140.743f);
}
JumpToNextStep(2000);
@@ -929,7 +929,7 @@ public:
if (Unit* pBoss = me->SummonCreature(uiBossID, 2232.19f, 1331.933f, 126.662f, 3.15f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000))
{
uiBossGUID = pBoss->GetGUID();
pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
pBoss->SetWalk(true);
pBoss->GetMotionMaster()->MovePoint(0, 2194.110f, 1332.00f, 130.00f);
}
}
@@ -401,7 +401,7 @@ public:
SetRun();
break;
case 91:
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
SetRun(false);
break;
case 93:
@@ -301,7 +301,7 @@ public:
{
if (npc->isAlive())
{
npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
npc->SetWalk(true);
npc->GetMotionMaster()->MovePoint(1, x, y, z);
npc->SetHomePosition(x, y, z, o);
}
@@ -204,7 +204,7 @@ void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y,
if (Creature* crew = instance->instance->GetCreature(instance->GetData64(entry)))
{
crew->SetReactState(REACT_AGGRESSIVE);
crew->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
crew->SetWalk(true);
crew->SetHomePosition(x, y, z, 0);
crew->GetMotionMaster()->MovePoint(1, x, y, z);
crew->setFaction(FACTION_FREED);
@@ -640,7 +640,7 @@ public:
case 37:
DoScriptText(SAY_QUEST_COMPLETE, me, player);
me->SetSpeed(MOVE_RUN, 1.2f, true);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H))
player->GroupEventHappens(QUEST_STINKYS_ESCAPE_H, me);
if (player && player->GetQuestStatus(QUEST_STINKYS_ESCAPE_A))