aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp8
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.cpp3
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h6
-rw-r--r--src/server/game/Movement/MotionMaster.cpp214
-rw-r--r--src/server/game/Movement/MotionMaster.h7
-rw-r--r--src/server/game/Movement/MovementDefines.h2
-rw-r--r--src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp52
-rw-r--r--src/server/game/Movement/MovementGenerators/GenericMovementGenerator.h53
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp30
-rw-r--r--src/server/game/Movement/MovementGenerators/PointMovementGenerator.h20
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp2
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h2
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInitArgs.h1
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp22
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp4
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp2
-rw-r--r--src/server/worldserver/worldserver.conf.dist1
22 files changed, 228 insertions, 217 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index faa67714955..093fa4170ef 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -489,7 +489,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen
Movement::MoveSplineInit init(this);
init.MoveTo(x, y, z, generatePath, forceDestination);
init.SetVelocity(speed);
- init.Launch();
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
}
void Unit::UpdateSplineMovement(uint32 t_diff)
@@ -11940,7 +11940,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
init.SetFacing(GetOrientation());
init.SetTransportExit();
- init.Launch();
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_EXIT, MOTION_SLOT_CONTROLLED);
if (player)
player->ResummonPetTemporaryUnSummonedIfAny();
@@ -12300,7 +12300,7 @@ void Unit::SetFacingTo(float ori, bool force)
if (GetTransport())
init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
init.SetFacing(ori);
- init.Launch();
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_SLOT_CONTROLLED);
}
void Unit::SetFacingToObject(WorldObject const* object, bool force)
@@ -12313,7 +12313,7 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force)
Movement::MoveSplineInit init(this);
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
- init.Launch();
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_SLOT_CONTROLLED);
}
bool Unit::SetWalk(bool enable)
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 3b8b22c21c4..6025d5f8692 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -22,6 +22,7 @@
#include "DB2Stores.h"
#include "EventProcessor.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -846,7 +847,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
init.MoveTo(veSeat->AttachmentOffset.X, veSeat->AttachmentOffset.Y, veSeat->AttachmentOffset.Z, false, true);
init.SetFacing(0.0f);
init.SetTransportEnter();
- init.Launch();
+ Passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
if (Creature* creature = Target->GetBase()->ToCreature())
{
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index a49d54a7a0f..8a15659481c 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -5760,7 +5760,11 @@ enum EventId
/// Special charge event which is used for charge spells that have explicit targets
/// and had a path already generated - using it in PointMovementGenerator will not
/// create a new spline and launch it
- EVENT_CHARGE_PREPATH = 1005
+ EVENT_CHARGE_PREPATH = 1005,
+
+ EVENT_FACE = 1006,
+ EVENT_VEHICLE_BOARD = 1007,
+ EVENT_VEHICLE_EXIT = 1008
};
enum ResponseCodes
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 890d4d91bbe..c66f6f5a935 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -19,6 +19,7 @@
#include "Creature.h"
#include "CreatureAISelector.h"
#include "DB2Stores.h"
+#include "G3DPosition.hpp"
#include "Log.h"
#include "Map.h"
#include "MovementGenerator.h"
@@ -37,6 +38,7 @@
#include "FlightPathMovementGenerator.h"
#include "FollowMovementGenerator.h"
#include "FormationMovementGenerator.h"
+#include "GenericMovementGenerator.h"
#include "HomeMovementGenerator.h"
#include "IdleMovementGenerator.h"
#include "PointMovementGenerator.h"
@@ -219,26 +221,25 @@ void MotionMaster::MoveIdle()
void MotionMaster::MoveTargetedHome()
{
+ Creature* owner = _owner->ToCreature();
+ if (!owner)
+ {
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', attempted to move towards target home.", _owner->GetGUID().ToString().c_str());
+ return;
+ }
+
Clear(false);
- if (_owner->GetTypeId() == TYPEID_UNIT && !_owner->ToCreature()->GetCharmerOrOwnerGUID())
+ Unit* target = owner->GetCharmerOrOwner();
+ if (!target)
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) targeted home.", _owner->GetEntry(), _owner->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', targeted home.", _owner->GetGUID().ToString().c_str());
Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE);
}
- else if (_owner->GetTypeId() == TYPEID_UNIT && !_owner->ToCreature()->GetCharmerOrOwnerGUID().IsEmpty())
- {
- TC_LOG_DEBUG("misc", "Pet or controlled creature (Entry: %u %s) is targeting home", _owner->GetEntry(), _owner->GetGUID().ToString().c_str());
- Unit* target = _owner->ToCreature()->GetCharmerOrOwner();
- if (target)
- {
- TC_LOG_DEBUG("misc", "Following %s", target->GetGUID().ToString().c_str());
- Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE);
- }
- }
else
{
- TC_LOG_ERROR("misc", "Player (%s) attempted to move towards target home.", _owner->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', starts following '%s'", _owner->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str());
+ Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE);
}
}
@@ -246,7 +247,7 @@ void MotionMaster::MoveRandom(float spawndist)
{
if (_owner->GetTypeId() == TYPEID_UNIT)
{
- TC_LOG_DEBUG("misc", "Creature (%s) started random movement.", _owner->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRandom: '%s', started random movement (spawnDist: %f)", _owner->GetGUID().ToString().c_str(), spawndist);
Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE);
}
}
@@ -257,12 +258,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, ChaseAngle angle, Moveme
if (!target || target == _owner)
return;
- TC_LOG_DEBUG("misc", "%s (Entry: %u, %s) follows %s (Entry %u, %s).",
- _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(),
- target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
- target->GetEntry(), target->GetGUID().ToString().c_str());
-
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFollow: '%s', starts following '%s'", _owner->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str());
Mutate(new FollowMovementGenerator(target, dist, angle), slot);
}
@@ -272,11 +268,7 @@ void MotionMaster::MoveChase(Unit* target, Optional<ChaseRange> dist, Optional<C
if (!target || target == _owner)
return;
- TC_LOG_DEBUG("misc", "%s (Entry: %u, %s) chase to %s (Entry: %u, %s)",
- _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(),
- target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
- target->GetEntry(), target->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveChase: '%s', starts chasing '%s'", _owner->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str());
Mutate(new ChaseMovementGenerator(target, dist, angle), MOTION_SLOT_ACTIVE);
}
@@ -284,13 +276,12 @@ void MotionMaster::MoveConfused()
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- TC_LOG_DEBUG("misc", "Player (%s) move confused", _owner->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '%s', started confused movement.", _owner->GetGUID().ToString().c_str());
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
}
else
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) move confused",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '%s', started confused movement.", _owner->GetGUID().ToString().c_str());
Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED);
}
}
@@ -300,23 +291,16 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if (!enemy)
return;
- if (_owner->GetTypeId() == TYPEID_PLAYER)
- {
- TC_LOG_DEBUG("misc", "Player (%s) flees from (%s).", _owner->GetGUID().ToString().c_str(),
- enemy->GetGUID().ToString().c_str());
- Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
- }
- else
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFleeing: '%s', flees from '%s' (time: %u)", _owner->GetGUID().ToString().c_str(), enemy->GetGUID().ToString().c_str(), time);
+ if (_owner->GetTypeId() == TYPEID_UNIT)
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) flees from (%s)%s.",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(),
- enemy->GetGUID().ToString().c_str(),
- time ? " for a limited time" : "");
if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
else
Mutate(new FleeingMovementGenerator<Creature>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
+ else
+ Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MovePoint(uint32 id, Position const& pos, bool generatePath/* = true*/, Optional<float> finalOrient/* = {}*/)
@@ -328,13 +312,12 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- TC_LOG_DEBUG("misc", "Player (%s) targeted point (Id: %u X: %f Y: %f Z: %f).", _owner->GetGUID().ToString().c_str(), id, x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '%s', targeted point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, 0.0f, nullptr, nullptr, finalOrient), MOTION_SLOT_ACTIVE);
}
else
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) targeted point (ID: %u X: %f Y: %f Z: %f).",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), id, x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '%s', targeted point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, 0.0f, nullptr, nullptr, finalOrient), MOTION_SLOT_ACTIVE);
}
}
@@ -355,37 +338,28 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance)
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
init.SetFacing(target);
- init.Launch();
- Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE);
}
}
void MotionMaster::MoveLand(uint32 id, Position const& pos)
{
- float x, y, z;
- pos.GetPosition(x, y, z);
-
- TC_LOG_DEBUG("misc", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f).", _owner->GetEntry(), id, x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveLand: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
Movement::MoveSplineInit init(_owner);
- init.MoveTo(x, y, z);
+ init.MoveTo(PositionToVector3(pos));
init.SetAnimation(Movement::ToGround);
- init.Launch();
- Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos)
{
- float x, y, z;
- pos.GetPosition(x, y, z);
-
- TC_LOG_DEBUG("misc", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f).", _owner->GetEntry(), id, x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTakeoff: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
Movement::MoveSplineInit init(_owner);
- init.MoveTo(x, y, z);
+ init.MoveTo(PositionToVector3(pos));
init.SetAnimation(Movement::ToFly);
- init.Launch();
- Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_CHARGE*/, uint32 id /*= EVENT_CHARGE*/, bool generatePath /*= false*/,
@@ -396,13 +370,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_C
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- TC_LOG_DEBUG("misc", "Player (%s) charged point (X: %f Y: %f Z: %f).", _owner->GetGUID().ToString().c_str(), x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '%s', charging point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed, target, spellEffectExtraData), MOTION_SLOT_CONTROLLED);
}
else
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) charged point (X: %f Y: %f Z: %f).",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '%s', charging point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed, target, spellEffectExtraData), MOTION_SLOT_CONTROLLED);
}
}
@@ -427,7 +400,7 @@ void MotionMaster::MoveCharge(PathGenerator const& path, float speed /*= SPEED_C
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/)
{
- //this function may make players fall below map
+ // this function may make players fall below map
if (_owner->GetTypeId() == TYPEID_PLAYER)
return;
@@ -449,23 +422,23 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
if (spellEffectExtraData)
init.SetSpellEffectExtraData(*spellEffectExtraData);
- init.Launch();
- Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, 0), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
{
- //this function may make players fall below map
+ // this function may make players fall below map
if (_owner->GetTypeId() == TYPEID_PLAYER)
return;
- float x, y, z;
+ float x, y, z = _owner->GetPositionZ();
float moveTimeHalf = speedZ / Movement::gravity;
float dist = 2 * moveTimeHalf * speedXY;
+
_owner->GetNearPoint2D(nullptr, x, y, dist, _owner->GetOrientation() + angle);
- z = _owner->GetPositionZ();
_owner->UpdateAllowedPositionZ(x, y, z);
+
MoveJump(x, y, z, 0.0f, speedXY, speedZ);
}
@@ -478,7 +451,7 @@ void MotionMaster::MoveJump(Position const& pos, float speedXY, float speedZ, ui
void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint32 id /*= EVENT_JUMP*/, bool hasOrientation /* = false*/,
JumpArrivalCastArgs const* arrivalCast /*= nullptr*/, Movement::SpellEffectExtraData const* spellEffectExtraData /*= nullptr*/)
{
- TC_LOG_DEBUG("misc", "Unit (%s) jumps to point (X: %f Y: %f Z: %f).", _owner->GetGUID().ToString().c_str(), x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveJump: '%s', jumps to point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
if (speedXY < 0.01f)
return;
@@ -493,7 +466,6 @@ void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, f
init.SetFacing(o);
if (spellEffectExtraData)
init.SetSpellEffectExtraData(*spellEffectExtraData);
- init.Launch();
uint32 arrivalSpellId = 0;
ObjectGuid arrivalSpellTargetGuid;
@@ -503,7 +475,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, f
arrivalSpellTargetGuid = arrivalCast->Target;
}
- Mutate(new EffectMovementGenerator(id, arrivalSpellId, arrivalSpellTargetGuid), MOTION_SLOT_CONTROLLED);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id, arrivalSpellId, arrivalSpellTargetGuid), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount)
@@ -540,7 +512,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
init.SetCyclic();
}
- init.Launch();
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, 0), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk, bool fly)
@@ -561,14 +533,11 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, si
});
init.MovebyPath(path);
init.SetWalk(walk);
- init.Launch();
// This code is not correct
- // EffectMovementGenerator does not affect UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE
+ // GenericMovementGenerator does not affect UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE
// need to call PointMovementGenerator with various pointIds
- Mutate(new EffectMovementGenerator(pointId), MOTION_SLOT_ACTIVE);
- //Position pos(pathPoints[pathSize - 1].x, pathPoints[pathSize - 1].y, pathPoints[pathSize - 1].z);
- //MovePoint(EVENT_CHARGE_PREPATH, pos, false);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, pointId), MOTION_SLOT_ACTIVE);
}
void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk)
@@ -576,13 +545,13 @@ void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool w
Creature* owner = _owner->ToCreature();
if (!owner)
{
- TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: non-creature %s tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str());
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '%s', tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str());
return;
}
std::vector<SplineChainLink> const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId);
if (!chain)
{
- TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: creature with entry %u tried to walk along non-existing spline chain with DB id %u.", owner->GetEntry(), dbChainId);
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '%s', tried to walk along non-existing spline chain with DB Id: %u.", _owner->GetGUID().ToString().c_str(), dbChainId);
return;
}
MoveAlongSplineChain(pointId, *chain, walk);
@@ -597,20 +566,20 @@ void MotionMaster::ResumeSplineChain(SplineChainResumeInfo const& info)
{
if (info.Empty())
{
- TC_LOG_ERROR("misc", "MotionMaster::ResumeSplineChain: unit with entry %u tried to resume a spline chain from empty info.", _owner->GetEntry());
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::ResumeSplineChain: '%s', tried to resume a spline chain from empty info.", _owner->GetGUID().ToString().c_str());
return;
}
Mutate(new SplineChainMovementGenerator(info), MOTION_SLOT_ACTIVE);
}
-void MotionMaster::MoveFall(uint32 id /*=0*/)
+void MotionMaster::MoveFall(uint32 id/* = 0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMapHeight(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
- TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable to retrieve a proper height at map %u (x: %f, y: %f, z: %f).",
- _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ() + _owner->GetPositionZ());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFall: '%s', unable to retrieve a proper height at map Id: %u (X: %f, Y: %f, Z: %f)",
+ _owner->GetGUID().ToString().c_str(), _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
return;
}
@@ -630,39 +599,32 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz + _owner->GetHoverOffset(), false);
init.SetFall();
- init.Launch();
- Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
+ Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
- if (_owner->GetTypeId() == TYPEID_PLAYER)
- {
- TC_LOG_ERROR("misc", "Player (GUID: %s) attempted to seek assistance.", _owner->GetGUID().ToString().c_str());
- }
- else
+ if (_owner->GetTypeId() == TYPEID_UNIT)
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) seek assistance (X: %f Y: %f Z: %f)",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), x, y, z);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', seeks assistance (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
_owner->AttackStop();
_owner->CastStop();
_owner->ToCreature()->SetReactState(REACT_PASSIVE);
Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE);
}
+ else
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', attempted to seek assistance.", _owner->GetGUID().ToString().c_str());
}
void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
- if (_owner->GetTypeId() == TYPEID_PLAYER)
- {
- TC_LOG_ERROR("misc", "Player (%s) attempedt to call distract after assistance.", _owner->GetGUID().ToString().c_str());
- }
- else
+ if (_owner->GetTypeId() == TYPEID_UNIT)
{
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) is distracted after assistance call (Time: %u).",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), time);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '%s', is distracted after assistance call (Time: %u)", _owner->GetGUID().ToString().c_str(), time);
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
}
+ else
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '%s', attempted to call distract assistance.", _owner->GetGUID().ToString().c_str());
}
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
@@ -671,22 +633,16 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (path < sTaxiPathNodesByPath.size())
{
- TC_LOG_DEBUG("misc", "%s taxi to (Path %u node %u).", _owner->GetName().c_str(), path, pathnode);
- FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator();
- mgen->LoadPath(_owner->ToPlayer());
- Mutate(mgen, MOTION_SLOT_CONTROLLED);
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', taxi to path Id: %u (node %u)", _owner->GetGUID().ToString().c_str(), path, pathnode);
+ FlightPathMovementGenerator* movement = new FlightPathMovementGenerator();
+ movement->LoadPath(_owner->ToPlayer(), pathnode);
+ Mutate(movement, MOTION_SLOT_CONTROLLED);
}
else
- {
- TC_LOG_ERROR("misc", "%s attempted taxi to (non-existing Path %u node %u).",
- _owner->GetName().c_str(), path, pathnode);
- }
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', attempted taxi to non-existing path Id: %u (node: %u)", _owner->GetGUID().ToString().c_str(), path, pathnode);
}
else
- {
- TC_LOG_ERROR("misc", "Creature (Entry: %u %s) attempted taxi to (Path %u node %u).",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), path, pathnode);
- }
+ TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', attempted taxi to path Id: %u (node: %u)", _owner->GetGUID().ToString().c_str(), path, pathnode);
}
void MotionMaster::MoveDistract(uint32 timer)
@@ -695,17 +651,11 @@ void MotionMaster::MoveDistract(uint32 timer)
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
- {
- TC_LOG_DEBUG("misc", "Player (%s) distracted (timer: %u).", _owner->GetGUID().ToString().c_str(), timer);
- }
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveDistract: '%s', distracted (timer: %u)", _owner->GetGUID().ToString().c_str(), timer);
else
- {
- TC_LOG_DEBUG("misc", "Creature (Entry: %u %s) distracted (timer: %u)",
- _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), timer);
- }
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveDistract: '%s', distracted (timer: %u)", _owner->GetGUID().ToString().c_str(), timer);
- DistractMovementGenerator* mgen = new DistractMovementGenerator(timer);
- Mutate(mgen, MOTION_SLOT_CONTROLLED);
+ Mutate(new DistractMovementGenerator(timer), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MovePath(uint32 pathId, bool repeatable)
@@ -713,18 +663,14 @@ void MotionMaster::MovePath(uint32 pathId, bool repeatable)
if (!pathId)
return;
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '%s', starts moving over path Id: %u (repeatable: %s)", _owner->GetGUID().ToString().c_str(), pathId, repeatable ? "YES" : "NO");
Mutate(new WaypointMovementGenerator<Creature>(pathId, repeatable), MOTION_SLOT_IDLE);
-
- TC_LOG_DEBUG("misc", "%s starts moving over path (Id:%u, repeatable: %s).",
- _owner->GetGUID().ToString().c_str(), pathId, repeatable ? "YES" : "NO");
}
void MotionMaster::MovePath(WaypointPath& path, bool repeatable)
{
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '%s', starts moving over path Id: %u (repeatable: %s)", _owner->GetGUID().ToString().c_str(), path.id, repeatable ? "YES" : "NO");
Mutate(new WaypointMovementGenerator<Creature>(path, repeatable), MOTION_SLOT_IDLE);
-
- TC_LOG_DEBUG("misc", "%s start moving over path (repeatable: %s)",
- _owner->GetGUID().ToString().c_str(), repeatable ? "YES" : "NO");
}
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
@@ -732,6 +678,7 @@ void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
if (!time)
return;
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRotate: '%s', starts rotate (time: %u, direction: %u)", _owner->GetGUID().ToString().c_str(), time, direction);
Mutate(new RotateMovementGenerator(time, direction), MOTION_SLOT_ACTIVE);
}
@@ -739,11 +686,23 @@ void MotionMaster::MoveFormation(uint32 id, Position destination, uint32 moveTyp
{
if (_owner->GetTypeId() == TYPEID_UNIT)
{
- TC_LOG_DEBUG("misc", "MotionMaster::MoveFormation: Creature (Entry: %u %s) targeted point (Id: %u X: %f Y: %f Z: %f).", _owner->GetEntry(), _owner->GetGUID().ToString().c_str(), id, destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFormation: '%s', targeted point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ());
Mutate(new FormationMovementGenerator(id, destination, moveType, forceRun, forceOrientation), MOTION_SLOT_ACTIVE);
}
}
+void MotionMaster::LaunchMoveSpline(Movement::MoveSplineInit&& init, uint32 id/*= 0*/, MovementSlot slot/*= MOTION_SLOT_ACTIVE*/, MovementGeneratorType type/*= EFFECT_MOTION_TYPE*/)
+{
+ if (IsInvalidMovementGeneratorType(type))
+ {
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::LaunchMoveSpline: '%s', tried to launch a spline with an invalid MovementGeneratorType: %u (Id: %u, Slot: %u)", _owner->GetGUID().ToString().c_str(), type, id, slot);
+ return;
+ }
+
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::LaunchMoveSpline: '%s', initiates spline Id: %u (Type: %u, Slot: %u)", _owner->GetGUID().ToString().c_str(), id, type, slot);
+ Mutate(new GenericMovementGenerator(std::move(init), type, id), slot);
+}
+
/******************** Private methods ********************/
void MotionMaster::pop()
@@ -890,13 +849,14 @@ void MotionMaster::DirectDelete(MovementGenerator* curr)
{
if (IsStatic(curr))
return;
+
curr->Finalize(_owner);
delete curr;
}
void MotionMaster::DelayedDelete(MovementGenerator* curr)
{
- TC_LOG_DEBUG("misc", "MotionMaster::DelayedDelete: unit (%u) delayed deleting movement generator (type %u)", _owner->GetEntry(), curr->GetMovementGeneratorType());
+ TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::DelayedDelete: '%s', delayed deleting movement generator (type: %u)", _owner->GetGUID().ToString().c_str(), curr->GetMovementGeneratorType());
if (IsStatic(curr))
return;
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 92098b90d27..5d78c875c7f 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -34,6 +34,7 @@ struct WaypointPath;
namespace Movement
{
+ class MoveSplineInit;
struct SpellEffectExtraData;
}
@@ -81,17 +82,14 @@ class TC_GAME_API MotionMaster
void MoveFleeing(Unit* enemy, uint32 time = 0);
void MovePoint(uint32 id, Position const& pos, bool generatePath = true, Optional<float> finalOrient = {});
void MovePoint(uint32 id, float x, float y, float z, bool generatePath = true, Optional<float> finalOrient = {});
-
/* Makes the unit move toward the target until it is at a certain distance from it. The unit then stops.
Only works in 2D.
This method doesn't account for any movement done by the target. in other words, it only works if the target is stationary.
*/
void MoveCloserAndStop(uint32 id, Unit* target, float distance);
-
// These two movement types should only be used with creatures having landing/takeoff animations
void MoveLand(uint32 id, Position const& pos);
void MoveTakeoff(uint32 id, Position const& pos);
-
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE, bool generatePath = false, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE, Unit const* target = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
@@ -105,7 +103,6 @@ class TC_GAME_API MotionMaster
void MoveAlongSplineChain(uint32 pointId, std::vector<SplineChainLink> const& chain, bool walk);
void ResumeSplineChain(SplineChainResumeInfo const& info);
void MoveFall(uint32 id = 0);
-
void MoveSeekAssistance(float x, float y, float z);
void MoveSeekAssistanceDistract(uint32 timer);
void MoveTaxiFlight(uint32 path, uint32 pathnode);
@@ -113,9 +110,9 @@ class TC_GAME_API MotionMaster
void MovePath(uint32 pathId, bool repeatable);
void MovePath(WaypointPath& path, bool repeatable);
void MoveRotate(uint32 time, RotateDirection direction);
-
void MoveFormation(uint32 id, Position destination, uint32 moveType, bool forceRun = false, bool forceOrientation = false);
+ void LaunchMoveSpline(Movement::MoveSplineInit&& init, uint32 id = 0, MovementSlot slot = MOTION_SLOT_ACTIVE, MovementGeneratorType type = EFFECT_MOTION_TYPE);
private:
typedef std::vector<MovementGenerator*> MovementList;
diff --git a/src/server/game/Movement/MovementDefines.h b/src/server/game/Movement/MovementDefines.h
index dbacd9a469f..e414c6f92bd 100644
--- a/src/server/game/Movement/MovementDefines.h
+++ b/src/server/game/Movement/MovementDefines.h
@@ -99,4 +99,6 @@ struct JumpArrivalCastArgs
ObjectGuid Target;
};
+inline bool IsInvalidMovementGeneratorType(MovementGeneratorType const type) { return type == MAX_DB_MOTION_TYPE || type == MAX_MOTION_TYPE; }
+
#endif
diff --git a/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp
new file mode 100644
index 00000000000..254fcd34110
--- /dev/null
+++ b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.cpp
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "GenericMovementGenerator.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "MoveSpline.h"
+#include "ObjectAccessor.h"
+#include "Unit.h"
+
+void GenericMovementGenerator::Initialize(Unit* /*owner*/)
+{
+ _duration.Reset(_splineInit.Launch());
+}
+
+bool GenericMovementGenerator::Update(Unit* owner, uint32 diff)
+{
+ _duration.Update(diff);
+ if (_duration.Passed())
+ return false;
+
+ return !owner->movespline->Finalized();
+}
+
+void GenericMovementGenerator::Finalize(Unit* owner)
+{
+ MovementInform(owner);
+}
+
+void GenericMovementGenerator::MovementInform(Unit* owner)
+{
+ if (_arrivalSpellId)
+ owner->CastSpell(ObjectAccessor::GetUnit(*owner, _arrivalSpellTargetGuid), _arrivalSpellId, true);
+
+ if (Creature* creature = owner->ToCreature())
+ if (creature->AI())
+ creature->AI()->MovementInform(_type, _pointId);
+}
diff --git a/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.h b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.h
new file mode 100644
index 00000000000..6db8009b897
--- /dev/null
+++ b/src/server/game/Movement/MovementGenerators/GenericMovementGenerator.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_GENERICMOVEMENTGENERATOR_H
+#define TRINITY_GENERICMOVEMENTGENERATOR_H
+
+#include "MovementGenerator.h"
+#include "MoveSplineInit.h"
+#include "Timer.h"
+
+class Unit;
+
+enum MovementGeneratorType : uint8;
+
+class GenericMovementGenerator : public MovementGenerator
+{
+ public:
+ explicit GenericMovementGenerator(Movement::MoveSplineInit&& splineInit, MovementGeneratorType type, uint32 id, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty)
+ : _splineInit(std::move(splineInit)), _type(type), _pointId(id), _duration(0), _arrivalSpellId(arrivalSpellId), _arrivalSpellTargetGuid(arrivalSpellTargetGuid) { }
+
+ void Initialize(Unit*) override;
+ void Finalize(Unit*) override;
+ void Reset(Unit*) override { }
+ bool Update(Unit*, uint32) override;
+ MovementGeneratorType GetMovementGeneratorType() const override { return _type; }
+
+ private:
+ void MovementInform(Unit*);
+
+ Movement::MoveSplineInit _splineInit;
+ MovementGeneratorType _type;
+ uint32 _pointId;
+ TimeTrackerSmall _duration;
+
+ uint32 _arrivalSpellId;
+ ObjectGuid _arrivalSpellTargetGuid;
+};
+
+#endif
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index ad32681769e..bb78cc881e2 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -21,9 +21,8 @@
#include "Player.h"
#include "MotionMaster.h"
#include "MovementDefines.h"
-#include "MoveSplineInit.h"
#include "MoveSpline.h"
-#include "ObjectAccessor.h"
+#include "MoveSplineInit.h"
#include "World.h"
//----- Point Movement Generator
@@ -162,30 +161,3 @@ void AssistanceMovementGenerator::Finalize(Unit* owner)
if (owner->IsAlive())
owner->GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
}
-
-//---- EffectMovementGenerator
-
-bool EffectMovementGenerator::Update(Unit* owner, uint32 /*diff*/)
-{
- return !owner->movespline->Finalized();
-}
-
-MovementGeneratorType EffectMovementGenerator::GetMovementGeneratorType() const
-{
- return EFFECT_MOTION_TYPE;
-}
-
-void EffectMovementGenerator::Finalize(Unit* owner)
-{
- MovementInform(owner);
-}
-
-void EffectMovementGenerator::MovementInform(Unit* owner)
-{
- if (_arrivalSpellId)
- owner->CastSpell(ObjectAccessor::GetUnit(*owner, _arrivalSpellTargetGuid), _arrivalSpellId, true);
-
- if (Creature* creature = owner->ToCreature())
- if (creature->AI())
- creature->AI()->MovementInform(EFFECT_MOTION_TYPE, _pointId);
-}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
index 1fcfd494354..bd3c1ad3380 100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
@@ -19,7 +19,6 @@
#define TRINITY_POINTMOVEMENTGENERATOR_H
#include "MovementGenerator.h"
-#include "ObjectGuid.h"
#include "Optional.h"
#include "Position.h"
@@ -68,23 +67,4 @@ class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
void Finalize(Unit*) override;
};
-class EffectMovementGenerator : public MovementGenerator
-{
- public:
- explicit EffectMovementGenerator(uint32 id, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty) : _pointId(id), _arrivalSpellId(arrivalSpellId), _arrivalSpellTargetGuid(arrivalSpellTargetGuid) { }
-
- void Initialize(Unit*) override { }
- void Finalize(Unit*) override;
- void Reset(Unit*) override { }
- bool Update(Unit*, uint32) override;
- MovementGeneratorType GetMovementGeneratorType() const override;
-
- private:
- void MovementInform(Unit*);
-
- uint32 _pointId;
- uint32 _arrivalSpellId;
- ObjectGuid _arrivalSpellTargetGuid;
-};
-
#endif
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 7628a7cbac3..ee17801030b 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -262,6 +262,8 @@ walk(false), HasVelocity(false), TransformForTransport(true)
path.reserve(path_capacity);
}
+MoveSplineInitArgs::MoveSplineInitArgs(MoveSplineInitArgs && args) = default;
+
MoveSplineInitArgs::~MoveSplineInitArgs() = default;
/// ============================================================================================
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index fa33851475d..73c81c0ffdf 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -52,6 +52,8 @@ namespace Movement
public:
explicit MoveSplineInit(Unit* m);
+ MoveSplineInit(MoveSplineInit&& init) = default;
+
~MoveSplineInit();
MoveSplineInit(MoveSplineInit const&) = delete;
MoveSplineInit& operator=(MoveSplineInit const&) = delete;
diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
index 61d2b951c94..42db1df6224 100644
--- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h
+++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
@@ -59,6 +59,7 @@ namespace Movement
struct MoveSplineInitArgs
{
explicit MoveSplineInitArgs(size_t path_capacity = 16);
+ MoveSplineInitArgs(MoveSplineInitArgs&& args);
~MoveSplineInitArgs();
PointsArray path;
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index ef4f541d58b..5314fa4388b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -388,12 +388,10 @@ class npc_eye_of_acherus : public CreatureScript
me->SetReactState(REACT_PASSIVE);
- me->GetMotionMaster()->MovePoint(POINT_EYE_FALL, EyeOFAcherusFallPoint, false);
-
Movement::MoveSplineInit init(me);
init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false);
init.SetFall();
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_EYE_FALL, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
}
void OnCharmed(bool /*apply*/) override { }
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 092cd40bf29..6c7694feebb 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -473,12 +473,10 @@ public:
if (!_owner->IsAlive())
return true;
- _owner->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, *_owner, false);
-
Movement::MoveSplineInit init(_owner);
init.DisableTransportPathTransformations();
init.MoveTo(_dest.GetPositionX(), _dest.GetPositionY(), _dest.GetPositionZ(), false);
- init.Launch();
+ _owner->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
return true;
}
@@ -569,12 +567,10 @@ struct gunship_npc_AI : public ScriptedAI
me->GetTransport()->CalculatePassengerPosition(hx, hy, hz, &ho);
me->SetHomePosition(hx, hy, hz, ho);
- me->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, Slot->TargetPosition, false);
-
Movement::MoveSplineInit init(me);
init.DisableTransportPathTransformations();
init.MoveTo(x, y, z, false);
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_CHARGE_PREPATH, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
}
}
@@ -937,16 +933,11 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
}
else if (action == ACTION_EXIT_SHIP)
{
- Position pos;
- pos.Relocate(SaurfangExitPath[SaurfangExitPathSize - 1].x, SaurfangExitPath[SaurfangExitPathSize - 1].y, SaurfangExitPath[SaurfangExitPathSize - 1].z);
- me->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, pos, false);
-
Movement::PointsArray path(SaurfangExitPath, SaurfangExitPath + SaurfangExitPathSize);
-
Movement::MoveSplineInit init(me);
init.DisableTransportPathTransformations();
init.MovebyPath(path, 0);
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
me->DespawnOrUnsummon(18000);
}
@@ -1206,16 +1197,11 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
}
else if (action == ACTION_EXIT_SHIP)
{
- Position pos;
- pos.Relocate(MuradinExitPath[MuradinExitPathSize - 1].x, MuradinExitPath[MuradinExitPathSize - 1].y, MuradinExitPath[MuradinExitPathSize - 1].z);
- me->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, pos, false);
-
Movement::PointsArray path(MuradinExitPath, MuradinExitPath + MuradinExitPathSize);
-
Movement::MoveSplineInit init(me);
init.DisableTransportPathTransformations();
init.MovebyPath(path, 0);
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, 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 9533e993f11..00fd567bb2a 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -472,7 +472,7 @@ class npc_bone_spike : public CreatureScript
Movement::MoveSplineInit init(passenger);
init.DisableTransportPathTransformations();
init.MoveTo(-0.02206125f, -0.02132235f, 5.514783f, false);
- init.Launch();
+ passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
}
void UpdateAI(uint32 diff) override
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 dbdd70512e0..6e52598d11a 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
@@ -351,12 +351,14 @@ class boss_algalon_the_observer : public CreatureScript
me->SetDisableGravity(true);
DoCast(me, SPELL_ARRIVAL, true);
DoCast(me, SPELL_RIDE_THE_LIGHTNING, true);
- me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos);
+
me->SetHomePosition(AlgalonLandPos);
+
Movement::MoveSplineInit init(me);
init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ(), false);
init.SetOrientationFixed(true);
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_ALGALON_LAND, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
+
events.Reset();
events.SetPhase(PHASE_ROLE_PLAY);
events.ScheduleEvent(EVENT_INTRO_1, 5000, 0, PHASE_ROLE_PLAY);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index a8931b08c44..fc143e2727b 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();
- init.Launch();
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, 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 e72c83742e1..3e3b103f312 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -632,8 +632,6 @@ class boss_thorim : public CreatureScript
summon->SetReactState(REACT_PASSIVE);
summon->CastSpell(summon, SPELL_LIGHTNING_DESTRUCTION, true);
- summon->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, LightningOrbPath[LightningOrbPathSize - 1], false);
-
Movement::PointsArray path;
path.reserve(LightningOrbPathSize);
std::transform(std::begin(LightningOrbPath), std::end(LightningOrbPath), std::back_inserter(path), [](Position const& pos)
@@ -643,7 +641,7 @@ class boss_thorim : public CreatureScript
Movement::MoveSplineInit init(summon);
init.MovebyPath(path);
- init.Launch();
+ summon->GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
break;
}
case NPC_DARK_RUNE_CHAMPION:
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 0bd61287f1d..511bfde03d0 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);
- init.Launch();
+ who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
me->setActive(true);
me->SetFarVisible(true);
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 738c2710a8f..4b76c2db170 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);
- init.Launch();
+ who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED);
who->m_Events.AddEvent(new CastFoodSpell(who, _chairSpells.at(who->GetEntry())), who->m_Events.CalculateTime(1000));
if (Creature* creature = who->ToCreature())
creature->SetDisplayFromModel(0);
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 165121838ec..cb6e515885e 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -4035,6 +4035,7 @@ Logger.mmaps=3,Server
#Logger.maps.script=3,Console Server
#Logger.maps=3,Console Server
#Logger.misc=3,Console Server
+#Logger.movement.motionmaster=3,Console Server
#Logger.network=3,Console Server
#Logger.network.opcode=3,Console Server
#Logger.network.soap=3,Console Server