mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
feat(Core/Unit): New helpers for UnitFlag and UnitFlag2 (#11227)
This commit is contained in:
@@ -94,7 +94,7 @@ void ConfusedMovementGenerator<T>::DoInitialize(T* unit)
|
||||
i_nextMove = urand(1, MAX_CONF_WAYPOINTS);
|
||||
DoUpdate(unit, 1);
|
||||
|
||||
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||
unit->SetUnitFlag(UNIT_FLAG_CONFUSED);
|
||||
unit->AddUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ bool ConfusedMovementGenerator<T>::DoUpdate(T* unit, uint32 diff)
|
||||
template<>
|
||||
void ConfusedMovementGenerator<Player>::DoFinalize(Player* unit)
|
||||
{
|
||||
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||
unit->RemoveUnitFlag(UNIT_FLAG_CONFUSED);
|
||||
unit->ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
|
||||
unit->StopMoving();
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void ConfusedMovementGenerator<Player>::DoFinalize(Player* unit)
|
||||
template<>
|
||||
void ConfusedMovementGenerator<Creature>::DoFinalize(Creature* unit)
|
||||
{
|
||||
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||
unit->RemoveUnitFlag(UNIT_FLAG_CONFUSED);
|
||||
unit->ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
|
||||
if (unit->GetVictim())
|
||||
unit->SetTarget(unit->GetVictim()->GetGUID());
|
||||
|
||||
@@ -277,7 +277,7 @@ void FleeingMovementGenerator<T>::DoInitialize(T* owner)
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner->SetUnitFlag(UNIT_FLAG_FLEEING);
|
||||
owner->AddUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
|
||||
|
||||
_Init(owner);
|
||||
@@ -323,14 +323,14 @@ void FleeingMovementGenerator<Player>::_Init(Player* )
|
||||
template<>
|
||||
void FleeingMovementGenerator<Player>::DoFinalize(Player* owner)
|
||||
{
|
||||
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
|
||||
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
|
||||
}
|
||||
|
||||
template<>
|
||||
void FleeingMovementGenerator<Creature>::DoFinalize(Creature* owner)
|
||||
{
|
||||
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
|
||||
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
|
||||
if (owner->GetVictim())
|
||||
owner->SetTarget(owner->GetVictim()->GetGUID());
|
||||
@@ -376,7 +376,7 @@ template bool FleeingMovementGenerator<Creature>::DoUpdate(Creature*, uint32);
|
||||
|
||||
void TimedFleeingMovementGenerator::Finalize(Unit* owner)
|
||||
{
|
||||
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
|
||||
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
|
||||
if (owner->GetVictim())
|
||||
owner->SetTarget(owner->GetVictim()->GetGUID());
|
||||
|
||||
@@ -39,7 +39,7 @@ void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner)
|
||||
}
|
||||
|
||||
if (!owner->HasSwimmingFlagOutOfCombat())
|
||||
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
|
||||
owner->RemoveUnitFlag(UNIT_FLAG_SWIMMING);
|
||||
}
|
||||
|
||||
void HomeMovementGenerator<Creature>::DoReset(Creature*)
|
||||
|
||||
@@ -280,7 +280,7 @@ bool RandomMovementGenerator<Creature>::DoUpdate(Creature* creature, const uint3
|
||||
}
|
||||
|
||||
// xinef: if we got disable move flag, do not remove default generator - just prevent movement
|
||||
if (creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (creature->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
{
|
||||
_nextMoveTime.Reset(0); // Expire the timer
|
||||
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||
|
||||
@@ -264,7 +264,7 @@ void ChaseMovementGenerator<T>::MovementInform(T* owner)
|
||||
static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const& dest, bool playerPet)
|
||||
{
|
||||
Optional<float> speed = {};
|
||||
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) &&
|
||||
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasUnitFlag(UNIT_FLAG_POSSESSED) &&
|
||||
(owner->IsPet() || owner->IsGuardian() || owner->GetGUID() == target->GetCritterGUID() || owner->GetCharmerOrOwnerGUID() == target->GetGUID()))
|
||||
{
|
||||
UnitMoveType moveType = Movement::SelectSpeedType(target->GetUnitMovementFlags());
|
||||
|
||||
@@ -316,7 +316,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
|
||||
|
||||
// xinef: this should be cleaned by CleanupAfterTaxiFlight(); function!
|
||||
player->Dismount();
|
||||
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
player->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
|
||||
if (player->m_taxi.empty())
|
||||
{
|
||||
@@ -337,7 +337,7 @@ void FlightPathMovementGenerator::DoReset(Player* player)
|
||||
{
|
||||
player->getHostileRefMgr().setOnlineOfflineState(false);
|
||||
player->AddUnitState(UNIT_STATE_IN_FLIGHT);
|
||||
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
player->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
|
||||
Movement::MoveSplineInit init(player);
|
||||
uint32 end = GetPathAtMapEnd();
|
||||
|
||||
Reference in New Issue
Block a user