mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -241,7 +241,7 @@ void MotionMaster::MoveRandom(float wanderDistance)
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Creature (%s) start moving random", _owner->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new RandomMovementGenerator<Creature>(wanderDistance), MOTION_SLOT_IDLE);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ void MotionMaster::MoveTargetedHome()
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT && !_owner->ToCreature()->GetCharmerOrOwnerGUID())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Creature (%s) targeted home", _owner->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
@@ -266,20 +266,20 @@ void MotionMaster::MoveTargetedHome()
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Pet or controlled creature (%s) targeting home", _owner->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Unit* target = _owner->ToCreature()->GetCharmerOrOwner();
|
||||
if (target)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Following %s (%s)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
|
||||
LOG_ERROR("server", "Player (%s) attempt targeted home", _owner->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,14 +292,14 @@ void MotionMaster::MoveConfused()
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) move confused", _owner->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Player (%s) move confused", _owner->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) move confused", _owner->GetEntry(), _owner->GetGUIDLow());
|
||||
LOG_DEBUG("server", "Creature (%s) move confused", _owner->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
@@ -316,20 +316,16 @@ void MotionMaster::MoveChase(Unit* target, std::optional<ChaseRange> dist, std:
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) chase to %s (GUID: %u)",
|
||||
_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Player (%s) chase to %s (%s)",
|
||||
_owner->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new ChaseMovementGenerator<Player>(target, dist, angle), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Creature (%s) chase to %s (%s)",
|
||||
_owner->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new ChaseMovementGenerator<Creature>(target, dist, angle), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
@@ -394,19 +390,16 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Player (%s) follow to %s (%s)",
|
||||
_owner->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new FollowMovementGenerator<Player>(target, dist, angle), slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Creature (%s) follow to %s (%s)",
|
||||
_owner->GetGUID().ToString().c_str(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new FollowMovementGenerator<Creature>(target, dist, angle), slot);
|
||||
}
|
||||
@@ -421,15 +414,14 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
|
||||
LOG_DEBUG("server", "Player (%s) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
|
||||
#endif
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
|
||||
LOG_DEBUG("server", "Creature (%s) targeted point (ID: %u X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z);
|
||||
#endif
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot);
|
||||
}
|
||||
@@ -558,7 +550,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
|
||||
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id, Unit const* target)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
|
||||
LOG_DEBUG("server", "Unit (%s) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
#endif
|
||||
|
||||
if (speedXY <= 0.1f)
|
||||
@@ -632,15 +624,14 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
|
||||
LOG_DEBUG("server", "Player (%s) charge point (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
#endif
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed, orientation, path, generatePath, generatePath), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
|
||||
LOG_DEBUG("server", "Creature (%s) charge point (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
#endif
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed, orientation, path, generatePath, generatePath), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
@@ -654,13 +645,12 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
||||
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
LOG_ERROR("server", "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
|
||||
LOG_ERROR("server", "Player (%s) attempt to seek assistance", _owner->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
|
||||
LOG_DEBUG("server", "Creature (%s) seek assistance (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
#endif
|
||||
_owner->AttackStop();
|
||||
_owner->CastStop(0, false);
|
||||
@@ -677,13 +667,12 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
|
||||
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
LOG_ERROR("server", "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
|
||||
LOG_ERROR("server", "Player (%s) attempt to call distract after assistance", _owner->GetGUID().ToString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), time);
|
||||
LOG_DEBUG("server", "Creature (%s) is distracted after assistance call (Time: %u)", _owner->GetGUID().ToString().c_str(), time);
|
||||
#endif
|
||||
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
@@ -701,20 +690,16 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("server", "Player (%s) flee from %s (%s)",
|
||||
_owner->GetGUID().ToString().c_str(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
|
||||
time ? " for a limited time" : "");
|
||||
LOG_DEBUG("server", "Creature (%s) flee from %s (%s) %s",
|
||||
_owner->GetGUID().ToString().c_str(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString().c_str(), time ? " for a limited time" : "");
|
||||
#endif
|
||||
if (time)
|
||||
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
|
||||
@@ -744,8 +729,7 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
|
||||
LOG_ERROR("server", "Creature (%s) attempt taxi to (Path %u node %u)", _owner->GetGUID().ToString().c_str(), path, pathnode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,15 +745,14 @@ void MotionMaster::MoveDistract(uint32 timer)
|
||||
/*if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
|
||||
LOG_DEBUG("server", "Player (%s) distracted (timer: %u)", _owner->GetGUID().ToString().c_str(), timer);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) (timer: %u)",
|
||||
LOG_DEBUG("server", "Creature (%s) (timer: %u)", _owner->GetGUID().ToString().c_str(), timer);
|
||||
#endif
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), timer);
|
||||
}*/
|
||||
|
||||
DistractMovementGenerator* mgen = new DistractMovementGenerator(timer);
|
||||
@@ -831,9 +814,8 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
|
||||
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
|
||||
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
|
||||
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
|
||||
LOG_DEBUG("server", "%s (%s) start moving over path(Id:%u, repeatable: %s)",
|
||||
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().ToString().c_str(), path_id, repeatable ? "YES" : "NO");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user