diff options
Diffstat (limited to 'src/server/scripts')
42 files changed, 204 insertions, 285 deletions
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index a9771331b8c..a3d4c6f13c9 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 "Player.h" #include "RBAC.h" @@ -147,13 +146,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; @@ -192,13 +187,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->map_id, gy->x, gy->y, gy->z, player->GetOrientation()); return true; @@ -234,13 +225,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 const* map = sMapMgr->CreateBaseMap(mapId); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); @@ -284,13 +271,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; @@ -329,13 +312,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->map_id, node->x, node->y, node->z, player->GetOrientation()); return true; @@ -374,13 +353,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->mapid, at->x, at->y, at->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 float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); @@ -506,13 +477,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; @@ -539,13 +506,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; @@ -583,13 +549,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 75f3e222497..b6ed2a60a7b 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 "Player.h" #include "RBAC.h" @@ -142,13 +141,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 5565c89e630..36a7a00c2da 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -20,11 +20,9 @@ #include "ArenaTeamMgr.h" #include "CellImpl.h" #include "CharacterCache.h" -#include "ChaseMovementGenerator.h" #include "Chat.h" #include "DatabaseEnv.h" #include "DisableMgr.h" -#include "FollowMovementGenerator.h" #include "GridNotifiers.h" #include "Group.h" #include "GroupMgr.h" @@ -37,7 +35,6 @@ #include "MMapFactory.h" #include "MotionMaster.h" #include "MovementDefines.h" -#include "MovementGenerator.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" @@ -449,13 +446,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; @@ -483,13 +476,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()); } @@ -579,14 +568,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; @@ -885,12 +870,7 @@ public: return false; } - // stop flight if need - if (target->IsInFlight()) - { - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - } + target->FinishTaxiFlight(); target->Recall(); return true; @@ -2138,20 +2118,19 @@ public: handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().GetCounter()); - 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); @@ -2166,45 +2145,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().GetCounter()); + else if (info.TargetGUID.IsPlayer()) + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, info.TargetName.c_str(), info.TargetGUID.GetCounter()); else - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, info.TargetName.c_str(), info.TargetGUID.GetCounter()); 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().GetCounter()); + else if (info.TargetGUID.IsPlayer()) + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, info.TargetName.c_str(), info.TargetGUID.GetCounter()); else - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUID().GetCounter()); + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, info.TargetName.c_str(), info.TargetGUID.GetCounter()); 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; @@ -2215,7 +2182,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 ee4d0024450..50fe639eb3f 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1289,7 +1289,7 @@ public: return true; } - //npc unfollow handling + // npc unfollow handling static bool HandleNpcUnFollowCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); @@ -1302,26 +1302,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 3a9c0331cb2..7afeff82163 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 "Player.h" #include "RBAC.h" @@ -185,13 +184,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); } @@ -283,13 +278,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); } @@ -302,7 +293,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); @@ -313,7 +304,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); @@ -321,7 +312,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); @@ -329,16 +320,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/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index ffaff3ba47c..81a547ea16f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1022,7 +1022,7 @@ void PretendToDie(Creature* creature) creature->RemoveAllAuras(); creature->SetHealth(0); creature->SetFlag(UNIT_FIELD_FLAGS, 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 edbfe09a76d..f4facc19d0e 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -385,7 +385,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 1f70792779c..023782021ae 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 780dd473288..ebbc56e3bee 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -324,7 +324,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()); } } @@ -339,7 +339,7 @@ public: wait = 1000; if (!me->GetVictim()) return; - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveFleeing(me->GetVictim()); } else wait -= diff; @@ -604,7 +604,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))); } } @@ -679,7 +679,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 11bc1401431..d1bfe7c220d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -129,19 +129,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 7a2e7cf09ca..135bb109f51 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/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 3c225099ca6..039ad2525cf 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -311,7 +311,7 @@ class boss_nalorakk : public CreatureScript { if (waitTimer <= diff) { - me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL); me->GetMotionMaster()->MovePoint(MovePhase, NalorakkWay[MovePhase][0], NalorakkWay[MovePhase][1], NalorakkWay[MovePhase][2]); waitTimer = 0; } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index a4ccef587d9..54cac735a1e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -377,7 +377,7 @@ class npc_zulian_prowler : public CreatureScript void JustEngagedWith(Unit* /*who*/) override { - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->RemoveAura(SPELL_SNEAK_RANK_1_1); me->RemoveAura(SPELL_SNEAK_RANK_1_2); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 1fe47520fee..6efe482eac9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -409,7 +409,7 @@ public: if (!HasProtected) { - me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); // All members of raid must get this buff @@ -496,7 +496,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/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp index cb607486e74..5cfcb2355f5 100644 --- a/src/server/scripts/Kalimdor/zone_azshara.cpp +++ b/src/server/scripts/Kalimdor/zone_azshara.cpp @@ -195,7 +195,9 @@ public: { me->DespawnOrUnsummon(); return; - } else MustDieTimer -= diff; + } + else + MustDieTimer -= diff; } if (!Escape) @@ -207,7 +209,9 @@ public: { DoCast(me, SPELL_RIZZLE_ESCAPE, false); SpellEscapeTimer = 10000; - } else SpellEscapeTimer -= diff; + } + else + SpellEscapeTimer -= diff; if (TeleportTimer <= diff) { @@ -224,10 +228,12 @@ public: me->SetHover(true); me->SetSwim(true); me->SetSpeedRate(MOVE_RUN, 0.85f); - me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL); me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]); Escape = true; - } else TeleportTimer -= diff; + } + else + TeleportTimer -= diff; return; } @@ -246,7 +252,9 @@ public: DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true); } GrenadeTimer = 30000; - } else GrenadeTimer -= diff; + } + else + GrenadeTimer -= diff; if (CheckTimer <= diff) { @@ -268,7 +276,9 @@ public: } CheckTimer = 1000; - } else CheckTimer -= diff; + } + else + CheckTimer -= diff; } bool GossipHello(Player* player) override 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 6ee613636ed..da6c486ab48 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -826,7 +826,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 0f0047ef819..3a5c2764551 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 4303bc5fa5d..1104c92fcb6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -19,19 +19,18 @@ #define HALLS_OF_REFLECTION_H_ #include "CreatureAIImpl.h" -#include "EventProcessor.h" -#include "ObjectGuid.h" #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 { @@ -196,29 +195,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 60b3c43a970..e80d238d7c9 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); } } @@ -943,7 +943,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); } @@ -1207,7 +1207,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 d974533d9ef..1d107a720fc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -23,6 +23,7 @@ #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" +#include "PointMovementGenerator.h" #include "ScriptedCreature.h" #include "SpellAuras.h" #include "SpellScript.h" @@ -242,8 +243,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); @@ -473,7 +482,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 ff0dd695971..6a3c459916a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -245,8 +245,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 bf9035604a3..2d190659d1d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -393,8 +393,7 @@ class boss_sindragosa : public CreatureScript me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); 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 7353486e186..0878b5645f5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -441,10 +441,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) { } @@ -737,7 +737,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: { @@ -1690,7 +1690,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 d9c1c8e1128..21d6dfa30ee 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 61faa846a85..2c5456229e5 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -502,7 +502,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 997ff31527e..c916d93fefc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -419,21 +419,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 671b781f86b..0da39233faa 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 f26ddedd8f3..303cdd85a0e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -1133,7 +1133,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 ae3d1b6eb01..fd96955add0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -337,7 +337,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 0f47cd67419..141c005e5d6 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -660,7 +660,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 c1f8dae9145..2a392030b0f 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 0bb6b26baff..a90cdbd42c5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -362,7 +362,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 6af5ea78700..e7aa7ab9fde 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -721,7 +721,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 d414a82bcd7..c85840a0e80 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -900,7 +900,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 0b4c45472d6..c93a47b243b 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 0e9583202ae..3535c5b4ea1 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 897f759ea88..ced2e6c624f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -250,7 +250,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; @@ -268,7 +268,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 72c0442e617..68c4cae48c5 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -288,9 +288,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(); @@ -329,7 +326,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 dddd00c0c4e..57caaa93cf9 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 b71efa9a8bc..fe1f9fb4841 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 5da91c1e850..c7ee26287c1 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -200,13 +200,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 7abc1acbbda..e27fa9ab280 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2925,7 +2925,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 (who->GetTypeId() == TYPEID_UNIT) who->SetDisplayId(who->ToCreature()->GetCreatureTemplate()->Modelid1); |
