diff options
| author | ccrs <ccrs@users.noreply.github.com> | 2018-06-03 10:06:57 -0700 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-09-28 00:15:13 +0200 |
| commit | 426f9f2f92b26fbb68e7cda9290ccbd586c6af4e (patch) | |
| tree | ede70b7865c2edb58964c7aa668eb1250a5816ab /src/server/scripts | |
| parent | 3e0af19b7767d6e71a7467874fdad566cea5ee87 (diff) | |
Core/Movement: MotionMaster reimplementation (#21888)
Internal structure and handling changes, nothing behavioural (or thats the intention at least).
(cherry picked from commit 982643cd96790ffc54e7a3e507469649f3b074d2)
Diffstat (limited to 'src/server/scripts')
42 files changed, 191 insertions, 286 deletions
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 7e0c3624cd5..3be61113c6d 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -27,7 +27,6 @@ EndScriptData */ #include "DatabaseEnv.h" #include "Language.h" #include "MapManager.h" -#include "MotionMaster.h" #include "ObjectMgr.h" #include "PhasingHandler.h" #include "Player.h" @@ -152,13 +151,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(mapId, x, y, z, o); return true; @@ -197,13 +192,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(gy->Loc); return true; @@ -239,13 +230,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case Map* map = sMapMgr->CreateBaseMap(mapId); float z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y)); @@ -289,13 +276,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(goData->spawnPoint); return true; @@ -352,13 +335,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case Map* map = sMapMgr->CreateBaseMap(mapId); z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y)); @@ -400,13 +379,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(node->ContinentID, node->Pos.X, node->Pos.Y, node->Pos.Z, player->GetOrientation()); return true; @@ -445,13 +420,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(at->ContinentID, at->Pos.X, at->Pos.Y, at->Pos.Z, player->GetOrientation()); return true; @@ -519,13 +490,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case float z = std::max(map->GetStaticHeight(PhasingHandler::GetEmptyPhaseShift(), x, y, MAX_HEIGHT), map->GetWaterLevel(PhasingHandler::GetEmptyPhaseShift(), x, y)); @@ -580,13 +547,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(mapId, x, y, z, ort); return true; @@ -614,13 +577,12 @@ public: } Player* player = handler->GetSession()->GetPlayer(); + + // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case ticket->TeleportTo(player); return true; @@ -658,13 +620,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(player->GetMapId(), x, y, z, o); return true; diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 67358c03243..2f5c92a0082 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -24,7 +24,6 @@ #include "Language.h" #include "LFG.h" #include "Map.h" -#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "PhasingHandler.h" @@ -144,13 +143,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case // before GM float x, y, z; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index ffc895f159a..db5c9be254a 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -20,12 +20,10 @@ #include "ArenaTeamMgr.h" #include "CellImpl.h" #include "CharacterCache.h" -#include "ChaseMovementGenerator.h" #include "Chat.h" #include "DatabaseEnv.h" #include "DB2Stores.h" #include "DisableMgr.h" -#include "FollowMovementGenerator.h" #include "GridNotifiers.h" #include "Group.h" #include "GroupMgr.h" @@ -41,7 +39,6 @@ #include "MMapFactory.h" #include "MotionMaster.h" #include "MovementDefines.h" -#include "MovementGenerator.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" @@ -459,13 +456,9 @@ public: // stop flight if need if (_player->IsInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + _player->FinishTaxiFlight(); else - _player->SaveRecallPosition(); + _player->SaveRecallPosition(); // save only in non-flight case // to point to see at target with same orientation float x, y, z; @@ -494,13 +487,9 @@ public: // stop flight if need if (_player->IsInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + _player->FinishTaxiFlight(); else - _player->SaveRecallPosition(); + _player->SaveRecallPosition(); // save only in non-flight case _player->TeleportTo(map, x, y, z, _player->GetOrientation()); } @@ -590,14 +579,10 @@ public: ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); // stop flight if need - if (target->IsInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + if (_player->IsInFlight()) + _player->FinishTaxiFlight(); else - target->SaveRecallPosition(); + _player->SaveRecallPosition(); // save only in non-flight case // before GM float x, y, z; @@ -899,12 +884,7 @@ public: return false; } - // stop flight if need - if (target->IsInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } + target->FinishTaxiFlight(); target->Recall(); return true; @@ -2210,20 +2190,19 @@ public: handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString().c_str()); - MotionMaster* motionMaster = unit->GetMotionMaster(); + if (unit->GetMotionMaster()->Empty()) + { + handler->SendSysMessage("Empty"); + return true; + } + float x, y, z; - motionMaster->GetDestination(x, y, z); + unit->GetMotionMaster()->GetDestination(x, y, z); - for (uint8 itr = 0; itr < MAX_MOTION_SLOT; ++itr) + std::vector<MovementGeneratorInformation> list = unit->GetMotionMaster()->GetMovementGeneratorsInformation(); + for (MovementGeneratorInformation info : list) { - MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(MovementSlot(itr)); - if (!movementGenerator) - { - handler->SendSysMessage("Empty"); - continue; - } - - switch (movementGenerator->GetMovementGeneratorType()) + switch (info.Type) { case IDLE_MOTION_TYPE: handler->SendSysMessage(LANG_MOVEGENS_IDLE); @@ -2238,45 +2217,33 @@ public: handler->SendSysMessage(LANG_MOVEGENS_CONFUSED); break; case CHASE_MOTION_TYPE: - { - Unit* target = static_cast<ChaseMovementGenerator const*>(movementGenerator)->GetTarget(); - - if (!target) + if (info.TargetGUID.IsEmpty()) handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUID().ToString().c_str()); + else if (info.TargetGUID.IsPlayer()) + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, info.TargetName.c_str(), info.TargetGUID.ToString().c_str()); else - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUID().ToString().c_str()); + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, info.TargetName.c_str(), info.TargetGUID.ToString().c_str()); break; - } case FOLLOW_MOTION_TYPE: - { - Unit* target = static_cast<FollowMovementGenerator const*>(movementGenerator)->GetTarget(); - - if (!target) + if (info.TargetGUID.IsEmpty()) handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); - else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUID().ToString().c_str()); + else if (info.TargetGUID.IsPlayer()) + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, info.TargetName.c_str(), info.TargetGUID.ToString().c_str()); else - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUID().ToString().c_str()); + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, info.TargetName.c_str(), info.TargetGUID.ToString().c_str()); break; - } case HOME_MOTION_TYPE: - { if (unit->GetTypeId() == TYPEID_UNIT) handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z); else handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); break; - } case FLIGHT_MOTION_TYPE: handler->SendSysMessage(LANG_MOVEGENS_FLIGHT); break; case POINT_MOTION_TYPE: - { handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z); break; - } case FLEEING_MOTION_TYPE: handler->SendSysMessage(LANG_MOVEGENS_FEAR); break; @@ -2287,7 +2254,7 @@ public: handler->SendSysMessage(LANG_MOVEGENS_EFFECT); break; default: - handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType()); + handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, info.Type); break; } } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index c5ec5bd5f75..c6b0805de0f 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1370,7 +1370,7 @@ public: return true; } - //npc unfollow handling + // npc unfollow handling static bool HandleNpcUnFollowCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); @@ -1383,26 +1383,24 @@ public: return false; } - if (/*creature->GetMotionMaster()->empty() ||*/ - creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE) + MovementGenerator* movement = creature->GetMotionMaster()->GetMovementGenerator([player](MovementGenerator const* a) -> bool { - handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str()); - handler->SetSentErrorMessage(true); + if (a->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE) + { + FollowMovementGenerator const* followMovement = dynamic_cast<FollowMovementGenerator const*>(a); + return followMovement && followMovement->GetTarget() == player; + } return false; - } - - FollowMovementGenerator const* mgen = static_cast<FollowMovementGenerator const*>((creature->GetMotionMaster()->top())); + }); - if (mgen->GetTarget() != player) + if (!movement) { handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str()); handler->SetSentErrorMessage(true); return false; } - // reset movement - creature->GetMotionMaster()->MovementExpired(true); - + creature->GetMotionMaster()->Remove(movement); handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName().c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 93b55b5d1ef..dc1ac20ac86 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -29,7 +29,6 @@ EndScriptData */ #include "Group.h" #include "Language.h" #include "MapManager.h" -#include "MotionMaster.h" #include "ObjectMgr.h" #include "PhasingHandler.h" #include "Player.h" @@ -186,13 +185,9 @@ public: // stop flight if need if (target->IsInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + target->FinishTaxiFlight(); else - target->SaveRecallPosition(); + target->SaveRecallPosition(); // save only in non-flight case target->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); } @@ -284,13 +279,9 @@ public: // stop flight if need if (player->IsInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + player->FinishTaxiFlight(); else - player->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); } @@ -303,7 +294,7 @@ public: if (!*args) return false; - Player* me = handler->GetSession()->GetPlayer(); + Player* player = handler->GetSession()->GetPlayer(); // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r GameTele const* tele = handler->extractGameTeleFromLink((char*)args); @@ -314,7 +305,7 @@ public: return false; } - if (me->IsInCombat() && !handler->GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_TELE_NAME)) + if (player->IsInCombat() && !handler->GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_TELE_NAME)) { handler->SendSysMessage(LANG_YOU_IN_COMBAT); handler->SetSentErrorMessage(true); @@ -322,7 +313,7 @@ public: } MapEntry const* map = sMapStore.LookupEntry(tele->mapId); - if (!map || (map->IsBattlegroundOrArena() && (me->GetMapId() != tele->mapId || !me->IsGameMaster()))) + if (!map || (map->IsBattlegroundOrArena() && (player->GetMapId() != tele->mapId || !player->IsGameMaster()))) { handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG); handler->SetSentErrorMessage(true); @@ -330,16 +321,12 @@ public: } // stop flight if need - if (me->IsInFlight()) - { - me->GetMotionMaster()->MovementExpired(); - me->CleanupAfterTaxiFlight(); - } - // save only in non-flight case + if (player->IsInFlight()) + player->FinishTaxiFlight(); else - me->SaveRecallPosition(); + player->SaveRecallPosition(); // save only in non-flight case - me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); + player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); return true; } }; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 73b2583c5da..0a21c2da912 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -538,7 +538,7 @@ public: Talk(SAY_ATIESH); me->SetFacingTo(me->GetAbsoluteAngle(player)); me->ClearUnitState(UNIT_STATE_MOVING); - me->GetMotionMaster()->MoveDistract(7 * IN_MILLISECONDS); + me->GetMotionMaster()->MoveDistract(7 * IN_MILLISECONDS, me->GetAbsoluteAngle(who)); break; } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 04e7e60d7c5..6f8157e3306 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1021,7 +1021,7 @@ void PretendToDie(Creature* creature) creature->RemoveAllAuras(); creature->SetHealth(0); creature->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE); - creature->GetMotionMaster()->MovementExpired(false); + creature->GetMotionMaster()->Clear(); creature->GetMotionMaster()->MoveIdle(); creature->SetStandState(UNIT_STAND_STATE_DEAD); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 5314fa4388b..d94bf9c3ce5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -391,7 +391,7 @@ class npc_eye_of_acherus : public CreatureScript Movement::MoveSplineInit init(me); init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false); init.SetFall(); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_EYE_FALL, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_EYE_FALL, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); } void OnCharmed(bool /*apply*/) override { } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index eebd0736f39..a92a344c6fb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -78,7 +78,7 @@ public: z += 4.0f; x -= 3.5f; y -= 5.0f; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->UpdatePosition(x, y, z, 0.0f); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 50687a89ac9..f3812ae24b2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -322,7 +322,7 @@ public: DoCast(me, SPELL_HEAD_LANDS, true); DoCast(me, SPELL_HEAD, false); SaySound(SAY_LOST_HEAD); - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveFleeing(caster->GetVictim()); } } @@ -337,7 +337,7 @@ public: wait = 1000; if (!me->GetVictim()) return; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveFleeing(me->GetVictim()); } else wait -= diff; @@ -602,7 +602,7 @@ public: me->SetFullHealth(); SaySound(SAY_REJOINED); DoCast(me, SPELL_HEAD); - caster->GetMotionMaster()->Clear(false); + caster->GetMotionMaster()->Clear(); caster->GetMotionMaster()->MoveFollow(me, 6, float(urand(0, 5))); } } @@ -677,7 +677,7 @@ public: if (wp_reached) { wp_reached = false; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(id, FlightPoint[id]); } } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 935b5b21515..684a98927ee 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -128,19 +128,19 @@ public: Talk(SAY_MO_KILL); } - void DamageTaken(Unit* /*doneBy*/, uint32 &damage) override + void DamageTaken(Unit* /*doneBy*/, uint32& damage) override { - if (damage < me->GetHealth() || _bHasDied || _bFakeDeath) + if (damage <= me->GetHealth() || _bHasDied || _bFakeDeath) return; - //On first death, fake death and open door, as well as initiate whitemane if exist + // On first death, fake death and open door, as well as initiate whitemane if exist if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE))) { instance->SetBossState(DATA_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); Whitemane->GetMotionMaster()->MovePoint(1, 1163.113370f, 1398.856812f, 32.527786f); - me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetHealth(0); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 37040fde6d7..fd73ccfbb46 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -277,7 +277,7 @@ public: { case 0: //me->AttackStop(); - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->StopMoving(); Talk(YELL_TAKEOFF); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 87e7d87458d..c959dd6a251 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -407,7 +407,7 @@ public: if (!HasProtected) { - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); // All members of raid must get this buff @@ -494,7 +494,7 @@ public: switch (actionId) { case ACTION_ENRAGE: - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); Enraged = true; Talk(SAY_ENRAGE); diff --git a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp index e0198304477..9af59225fdb 100644 --- a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp +++ b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp @@ -367,7 +367,7 @@ class npc_molten_barrage : public CreatureScript void AttackStart(Unit* target) override { if (target) - me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, MOTION_SLOT_IDLE); + me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, MOTION_SLOT_DEFAULT); } void IsSummonedBy(Unit* /*summoner*/) override diff --git a/src/server/scripts/Kalimdor/Firelands/firelands.cpp b/src/server/scripts/Kalimdor/Firelands/firelands.cpp index 6367bc88611..aaf01b371f2 100644 --- a/src/server/scripts/Kalimdor/Firelands/firelands.cpp +++ b/src/server/scripts/Kalimdor/Firelands/firelands.cpp @@ -79,7 +79,7 @@ void firelands_bossAI::EnterEvadeMode(EvadeReason why) { if (Unit* owner = me->GetCharmerOrOwner()) { - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); } else diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 10df5692fa5..b07d285b8e8 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -824,7 +824,7 @@ class npc_anubarak_spike : public CreatureScript me->GetThreatManager().ResetAllThreat(); DoZoneInCombat(); AddThreat(who, 1000000.0f); - me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(who); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 6fa26569833..c2bea8f0443 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -15,20 +15,24 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" #include "halls_of_reflection.h" +#include "Creature.h" +#include "EventProcessor.h" #include "InstanceScript.h" #include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" +#include "ObjectGuid.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellInfo.h" #include "SpellScript.h" #include "TemporarySummon.h" #include "Transport.h" +#include "Unit.h" enum Text { @@ -344,12 +348,6 @@ Position const IceWallTargetPosition[] = { 5318.289f, 1749.184f, 771.9423f, 0.8726646f } // 4th Icewall }; -void GameObjectDeleteDelayEvent::DeleteGameObject() -{ - if (GameObject* go = ObjectAccessor::GetGameObject(*_owner, _gameObjectGUID)) - go->Delete(); -} - class npc_jaina_or_sylvanas_intro_hor : public CreatureScript { public: @@ -797,6 +795,33 @@ class npc_jaina_or_sylvanas_intro_hor : public CreatureScript } }; +class HoRGameObjectDeleteDelayEvent : public BasicEvent +{ + public: + explicit HoRGameObjectDeleteDelayEvent(Unit* owner, ObjectGuid gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { } + + void DeleteGameObject() + { + if (GameObject* go = ObjectAccessor::GetGameObject(*_owner, _gameObjectGUID)) + go->Delete(); + } + + bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override + { + DeleteGameObject(); + return true; + } + + void Abort(uint64 /*execTime*/) override + { + DeleteGameObject(); + } + + private: + Unit* _owner; + ObjectGuid _gameObjectGUID; +}; + class npc_jaina_or_sylvanas_escape_hor : public CreatureScript { public: @@ -894,7 +919,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL); _instance->HandleGameObject(_instance->GetGuidData(DATA_ICEWALL), true); - me->m_Events.AddEvent(new GameObjectDeleteDelayEvent(me, _instance->GetGuidData(DATA_ICEWALL)), me->m_Events.CalculateTime(5000)); + me->m_Events.AddEvent(new HoRGameObjectDeleteDelayEvent(me, _instance->GetGuidData(DATA_ICEWALL)), me->m_Events.CalculateTime(5000)); if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ICEWALL_TARGET))) wallTarget->DespawnOrUnsummon(); @@ -2123,13 +2148,10 @@ enum EscapeEvents EVENT_LUMBERING_ABOMINATION_CLEAVE }; -namespace hor -{ - -class StartMovementEvent : public BasicEvent +class HoRStartMovementEvent : public BasicEvent { public: - StartMovementEvent(Creature* owner) : _owner(owner) { } + explicit HoRStartMovementEvent(Creature* owner) : _owner(owner) { } bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override { @@ -2143,8 +2165,6 @@ class StartMovementEvent : public BasicEvent Creature* _owner; }; -} // namespace hor - struct npc_escape_event_trash : public ScriptedAI { npc_escape_event_trash(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } @@ -2197,7 +2217,7 @@ class npc_raging_ghoul : public CreatureScript me->CastSpell(me, SPELL_RAGING_GHOUL_SPAWN, true); me->SetReactState(REACT_PASSIVE); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - me->m_Events.AddEvent(new hor::StartMovementEvent(me), me->m_Events.CalculateTime(5000)); + me->m_Events.AddEvent(new HoRStartMovementEvent(me), me->m_Events.CalculateTime(5000)); npc_escape_event_trash::IsSummonedBy(summoner); } @@ -2263,7 +2283,7 @@ class npc_risen_witch_doctor : public CreatureScript me->CastSpell(me, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); me->SetReactState(REACT_PASSIVE); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - me->m_Events.AddEvent(new hor::StartMovementEvent(me), me->m_Events.CalculateTime(5000)); + me->m_Events.AddEvent(new HoRStartMovementEvent(me), me->m_Events.CalculateTime(5000)); npc_escape_event_trash::IsSummonedBy(summoner); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index acfe6234da1..a9f82a9fb46 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -19,21 +19,20 @@ #define HALLS_OF_REFLECTION_H_ #include "CreatureAIImpl.h" -#include "EventProcessor.h" -#include "ObjectGuid.h" class Unit; #define HoRScriptName "instance_halls_of_reflection" -#define DataHeader "HOR" +#define DataHeader "HOR" uint32 const EncounterCount = 3; -/* Halls of Reflection encounters: - 0 - Falric - 1 - Marwyn - 2 - The Lich King -*/ +/* + * Halls of Reflection encounters: + * 0 - Falric + * 1 - Marwyn + * 2 - The Lich King + */ enum HORDataTypes { @@ -198,29 +197,6 @@ enum HORInstanceYells SAY_CAPTAIN_FINAL = 1 }; -class GameObjectDeleteDelayEvent : public BasicEvent -{ - public: - GameObjectDeleteDelayEvent(Unit* owner, ObjectGuid gameObjectGUID) : _owner(owner), _gameObjectGUID(gameObjectGUID) { } - - void DeleteGameObject(); - - bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override - { - DeleteGameObject(); - return true; - } - - void Abort(uint64 /*execTime*/) override - { - DeleteGameObject(); - } - - private: - Unit* _owner; - ObjectGuid _gameObjectGUID; -}; - template <class AI, class T> inline AI* GetHallsOfReflectionAI(T* obj) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 6c7694feebb..7609c5c6992 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -476,7 +476,7 @@ public: Movement::MoveSplineInit init(_owner); init.DisableTransportPathTransformations(); init.MoveTo(_dest.GetPositionX(), _dest.GetPositionY(), _dest.GetPositionZ(), false); - _owner->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + _owner->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); return true; } @@ -570,7 +570,7 @@ struct gunship_npc_AI : public ScriptedAI Movement::MoveSplineInit init(me); init.DisableTransportPathTransformations(); init.MoveTo(x, y, z, false); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); } } @@ -937,7 +937,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript Movement::MoveSplineInit init(me); init.DisableTransportPathTransformations(); init.MovebyPath(path, 0); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); me->DespawnOrUnsummon(18000); } @@ -1201,7 +1201,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript Movement::MoveSplineInit init(me); init.DisableTransportPathTransformations(); init.MovebyPath(path, 0); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); me->DespawnOrUnsummon(18000); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 00fd567bb2a..0ec4ace8d67 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -22,6 +22,7 @@ #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" +#include "PointMovementGenerator.h" #include "ScriptedCreature.h" #include "SpellAuras.h" #include "SpellScript.h" @@ -241,8 +242,16 @@ class boss_lord_marrowgar : public CreatureScript break; } case EVENT_BONE_STORM_END: - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + if (MovementGenerator* movement = me->GetMotionMaster()->GetMovementGenerator([](MovementGenerator const* a) -> bool + { + if (a->GetMovementGeneratorType() == POINT_MOTION_TYPE) + { + PointMovementGenerator<Creature> const* pointMovement = dynamic_cast<PointMovementGenerator<Creature> const*>(a); + return pointMovement && pointMovement->GetId() == POINT_TARGET_BONESTORM_PLAYER; + } + return false; + })) + me->GetMotionMaster()->Remove(movement); me->GetMotionMaster()->MoveChase(me->GetVictim()); me->SetSpeedRate(MOVE_RUN, _baseSpeed); events.CancelEvent(EVENT_BONE_STORM_MOVE); @@ -472,7 +481,7 @@ class npc_bone_spike : public CreatureScript Movement::MoveSplineInit init(passenger); init.DisableTransportPathTransformations(); init.MoveTo(-0.02206125f, -0.02132235f, 5.514783f, false); - passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED); + passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_PRIORITY_HIGHEST); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index d09530233f7..7343575dade 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -242,8 +242,6 @@ class boss_professor_putricide : public CreatureScript _experimentState = EXPERIMENT_STATE_OOZE; me->SetReactState(REACT_DEFENSIVE); me->SetWalk(false); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 6d249e6ce16..a1844f131c5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -394,8 +394,7 @@ class boss_sindragosa : public CreatureScript me->SetDisableGravity(false); me->SetAnimTier(UNIT_BYTE1_FLAG_NONE, false); me->SetReactState(REACT_DEFENSIVE); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + _isInAirPhase = false; // trigger Asphyxiation EntryCheckPredicate pred(NPC_ICE_TOMB); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 607c0952c34..9ab10f8d876 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -418,10 +418,10 @@ class FrozenThroneResetWorker } }; -class StartMovementEvent : public BasicEvent +class LichKingStartMovementEvent : public BasicEvent { public: - StartMovementEvent(Creature* summoner, Creature* owner) + LichKingStartMovementEvent(Creature* summoner, Creature* owner) : _summonerGuid(summoner->GetGUID()), _owner(owner) { } @@ -714,7 +714,7 @@ class boss_the_lich_king : public CreatureScript summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); summon->SetReactState(REACT_PASSIVE); summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - summon->m_Events.AddEvent(new StartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000)); + summon->m_Events.AddEvent(new LichKingStartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000)); break; case NPC_ICE_SPHERE: { @@ -1667,7 +1667,7 @@ class npc_strangulate_vehicle : public CreatureScript switch (eventId) { case EVENT_TELEPORT: - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); if (TempSummon* summ = me->ToTempSummon()) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index c521d04512d..422fd57eb0b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1292,7 +1292,7 @@ struct npc_argent_captainAI : public ScriptedAI me->SetReactState(REACT_DEFENSIVE); FollowAngle = me->GetAbsoluteAngle(crok) + me->GetOrientation(); FollowDist = me->GetDistance2d(crok); - me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); + me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_DEFAULT); } me->setActive(true); @@ -1320,7 +1320,7 @@ struct npc_argent_captainAI : public ScriptedAI void EnterEvadeMode(EvadeReason why) override { // not yet following - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_IDLE) != CHASE_MOTION_TYPE || IsUndead) + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType(MOTION_SLOT_DEFAULT) != FOLLOW_MOTION_TYPE || IsUndead) { ScriptedAI::EnterEvadeMode(why); return; @@ -1331,9 +1331,9 @@ struct npc_argent_captainAI : public ScriptedAI if (!me->GetVehicle()) { - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) - me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); + me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_DEFAULT); } Reset(); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 66915182e6b..b3ed1c677c1 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -500,7 +500,7 @@ public: DummyEntryCheckPredicate pred; summons.DoAction(ACTION_DELAYED_DESPAWN, pred); Talk(SAY_END_P_TWO); - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->StopMoving(); if (me->GetPositionZ() > 300.0f) events.ScheduleEvent(EVENT_DELAY_MOVE_TO_DESTROY_P, 5*IN_MILLISECONDS, 0, PHASE_TWO); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 318daa780f1..10a669be163 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -417,21 +417,21 @@ public: } } - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) override + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - if (uiDamage > me->GetHealth()) + if (damage >= me->GetHealth()) { me->UpdateEntry(NPC_BRITTLE_GOLEM); me->SetHealth(1); - uiDamage = 0; + damage = 0; me->RemoveAllAuras(); me->AttackStop(); - // me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); //Set in DB - // me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //Set in DB + // me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // Set in DB + // me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // Set in DB if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(false); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + + me->GetMotionMaster()->Clear(); m_bIsFrozen = true; } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 6e52598d11a..706bf99204a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -357,7 +357,7 @@ class boss_algalon_the_observer : public CreatureScript Movement::MoveSplineInit init(me); init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ(), false); init.SetOrientationFixed(true); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_ALGALON_LAND, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_ALGALON_LAND, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); events.Reset(); events.SetPhase(PHASE_ROLE_PLAY); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 2bf2ae3b58f..e1ac92ff165 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -1134,7 +1134,7 @@ class boss_aerial_command_unit : public CreatureScript if (events.IsInPhase(PHASE_AERIAL_COMMAND_UNIT)) { - me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(WP_AERIAL_P4_POS, VehicleRelocation[WP_AERIAL_P4_POS]); } else if (events.IsInPhase(PHASE_VOL7RON)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index fc143e2727b..b78f7289f1e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -335,7 +335,7 @@ struct boss_razorscale : public BossAI init.MovebyPath(path, 0); init.SetCyclic(); init.SetFly(); - me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); } bool CanAIAttack(Unit const* target) const override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 3e3b103f312..01c7f92d576 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -641,7 +641,7 @@ class boss_thorim : public CreatureScript Movement::MoveSplineInit init(summon); init.MovebyPath(path); - summon->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE); + summon->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE); break; } case NPC_DARK_RUNE_CHAMPION: diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index a8e9c27b93a..6b4b3a1aa1f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -256,7 +256,7 @@ class npc_vrykul_skeleton : public CreatureScript events.ScheduleEvent(EVENT_DECREPIFY, urand(4, 6) * IN_MILLISECONDS); } - void DamageTaken(Unit* /*doneBy*/, uint32& damage) override + void DamageTaken(Unit* /*attacker*/, uint32& damage) override { if (damage >= me->GetHealth()) { @@ -273,7 +273,7 @@ class npc_vrykul_skeleton : public CreatureScript events.Reset(); events.ScheduleEvent(EVENT_RESURRECT, urand(18, 22) * IN_MILLISECONDS); - me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 511bfde03d0..1505be8eca0 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -363,7 +363,7 @@ public: Movement::MoveSplineInit init(who); init.DisableTransportPathTransformations(); init.MoveTo(0.3320355f, 0.05355075f, 5.196949f, false); - who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED); + who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_PRIORITY_HIGHEST); me->setActive(true); me->SetFarVisible(true); diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 68ad8bfacd0..da00bc6e3f5 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -718,7 +718,7 @@ public: owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY); owner->CombatStop(true); owner->GetThreatManager().ClearAllThreat(); - owner->GetMotionMaster()->Clear(false); + owner->GetMotionMaster()->Clear(); owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, 0.0f); owner->CastSpell(owner, SPELL_SUBDUED, true); GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true); diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 021fb8e7701..3dff0fff0ba 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -898,7 +898,7 @@ public: { _finished = false; me->SetVisible(true); - me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->Clear(); } void DoAction(int32 /*action*/) override diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index 4807a0fbcb5..bd0ff4a4ad2 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -151,8 +151,7 @@ class boss_nexusprince_shaffar : public CreatureScript // expire movement, will prevent from running right back to victim after cast // (but should MoveChase be used again at a certain time or should he not move?) - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL); DoCast(me, SPELL_BLINK); break; diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 36d04389514..76d31bd203e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -724,7 +724,7 @@ struct npc_ashtongue_sorcerer : public ScriptedAI { _inBanish = true; me->StopMoving(); - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, me->GetPositionX() + frand(-8.0f, 8.0f), me->GetPositionY() + frand(-8.0f, 8.0f), me->GetPositionZ()); _scheduler.Schedule(Seconds(1) + Milliseconds(500), [this](TaskContext sorcer_channel) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 1a84c014d0f..1034a1f8039 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -248,7 +248,7 @@ public: { Talk(EMOTE_SPOUT); me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); + me->GetMotionMaster()->MoveRotate(0, 20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); SpoutTimer = 45000; WhirlTimer = 20000; // whirl directly after spout RotTimer = 20000; @@ -266,7 +266,7 @@ public: else WhirlTimer -= diff; - if (CheckTimer <= diff)//check if there are players in melee range + if (CheckTimer <= diff) // check if there are players in melee range { InRange = false; Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 8bacf1d283d..7d9a3956fd4 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -287,9 +287,6 @@ public: { if (GameObject* go = unit->FindNearestGameObject(GO_CARCASS, 10)) { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); me->StopMoving(); @@ -328,7 +325,9 @@ public: { DoCastVictim(SPELL_NETHER_BREATH); CastTimer = 5000; - } else CastTimer -= diff; + } + else + CastTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 1dbdf9aabcc..547b97df956 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -96,7 +96,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation()); float y = me->GetPositionY() + 20 * std::sin(me->GetOrientation()); float z = me->GetPositionZ() + 40; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, x, y, z); // Despawn as soon as possible diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 213c578aae7..f626159a650 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -190,8 +190,8 @@ class npc_pet_mage_mirror_image : public CreatureScript me->CombatStop(true); if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); } } diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 39b16715a71..10e814dc1e9 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -198,13 +198,13 @@ class npc_dream_fog : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { _roamTimer = urand(15000, 30000); - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(target, 0.2f); } else { _roamTimer = 2500; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveRandom(25.0f); } // Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 55801cdc7b2..83feb183d5c 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2821,7 +2821,7 @@ public: init.DisableTransportPathTransformations(); init.MoveTo(x, y, z, false); init.SetFacing(o); - who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED); + who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_PRIORITY_HIGHEST); who->m_Events.AddEvent(new CastFoodSpell(who, _chairSpells.at(who->GetEntry())), who->m_Events.CalculateTime(1000)); if (Creature* creature = who->ToCreature()) creature->SetDisplayFromModel(0); |
