Core/Unit: Renamed addUnitState/hasUnitState/clearUnitState to AddUnitState/HasUnitState/ClearUnitState
Core/Vehicles: Allow the vehicle to always damage the passenger (removed unneded dbc hacks from scripts) --HG-- branch : trunk
This commit is contained in:
@@ -109,10 +109,10 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
|
||||
GetLocationNowNoMicroMovement(x, y, z);
|
||||
else
|
||||
{
|
||||
if (!traveller.GetTraveller().hasUnitState(UNIT_STAT_MOVING | UNIT_STAT_IN_FLIGHT))
|
||||
if (!traveller.GetTraveller().HasUnitState(UNIT_STAT_MOVING | UNIT_STAT_IN_FLIGHT))
|
||||
return true;
|
||||
|
||||
if (traveller.GetTraveller().hasUnitState(UNIT_STAT_IN_FLIGHT))
|
||||
if (traveller.GetTraveller().HasUnitState(UNIT_STAT_IN_FLIGHT))
|
||||
GetLocationNow(traveller.GetTraveller().GetBaseMap() ,x, y, z, true); // Should reposition Object with right Coord, so I can bypass some Grid Relocation
|
||||
else
|
||||
GetLocationNow(traveller.GetTraveller().GetBaseMap(), x, y, z, false);
|
||||
|
||||
@@ -79,7 +79,7 @@ MotionMaster::~MotionMaster()
|
||||
void
|
||||
MotionMaster::UpdateMotion(uint32 diff)
|
||||
{
|
||||
if (i_owner->hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) // what about UNIT_STAT_DISTRACTED? Why is this not included?
|
||||
if (i_owner->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) // what about UNIT_STAT_DISTRACTED? Why is this not included?
|
||||
return;
|
||||
ASSERT(!empty());
|
||||
m_cleanFlag |= MMCF_UPDATE;
|
||||
@@ -197,7 +197,7 @@ MotionMaster::MoveRandom(float spawndist)
|
||||
void
|
||||
MotionMaster::MoveTargetedHome()
|
||||
{
|
||||
//if (i_owner->hasUnitState(UNIT_STAT_FLEEING))
|
||||
//if (i_owner->HasUnitState(UNIT_STAT_FLEEING))
|
||||
// return;
|
||||
|
||||
Clear(false);
|
||||
@@ -236,7 +236,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
return;
|
||||
|
||||
i_owner->clearUnitState(UNIT_STAT_FOLLOW);
|
||||
i_owner->ClearUnitState(UNIT_STAT_FOLLOW);
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)",
|
||||
@@ -262,7 +262,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
|
||||
if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
return;
|
||||
|
||||
i_owner->addUnitState(UNIT_STAT_FOLLOW);
|
||||
i_owner->AddUnitState(UNIT_STAT_FOLLOW);
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||
@@ -329,7 +329,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
|
||||
if (i_owner->IsNonMeleeSpellCasted(true))
|
||||
i_owner->InterruptNonMeleeSpells(true);
|
||||
|
||||
i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
|
||||
i_owner->AddUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
|
||||
i_owner->m_TempSpeed = speedXY;
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
|
||||
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
i_owner->addUnitState(UNIT_STAT_CHARGING);
|
||||
i_owner->AddUnitState(UNIT_STAT_CHARGING);
|
||||
i_owner->m_TempSpeed = speed;
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
|
||||
unit.CastStop();
|
||||
unit.StopMoving();
|
||||
unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
unit.addUnitState(UNIT_STAT_CONFUSED);
|
||||
unit.AddUnitState(UNIT_STAT_CONFUSED);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -126,7 +126,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
if (!&unit)
|
||||
return true;
|
||||
|
||||
if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
if (unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
return true;
|
||||
|
||||
if (i_nextMoveTime.Passed())
|
||||
@@ -138,7 +138,7 @@ ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
if (i_destinationHolder.HasArrived())
|
||||
{
|
||||
// arrived, stop and wait a bit
|
||||
unit.clearUnitState(UNIT_STAT_MOVE);
|
||||
unit.ClearUnitState(UNIT_STAT_MOVE);
|
||||
|
||||
i_nextMove = urand(1,MAX_CONF_WAYPOINTS);
|
||||
i_nextMoveTime.Reset(urand(0, 1500-1)); // TODO: check the minimum reset time, should be probably higher
|
||||
@@ -168,7 +168,7 @@ void
|
||||
ConfusedMovementGenerator<T>::Finalize(T &unit)
|
||||
{
|
||||
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||
unit.clearUnitState(UNIT_STAT_CONFUSED);
|
||||
unit.ClearUnitState(UNIT_STAT_CONFUSED);
|
||||
if (unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
|
||||
unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
if (!&owner)
|
||||
return;
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
return;
|
||||
|
||||
if (!_setMoveData(owner))
|
||||
@@ -43,7 +43,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
if (!_getPoint(owner, x, y, z))
|
||||
return;
|
||||
|
||||
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
Traveller<T> traveller(owner);
|
||||
i_destinationHolder.SetDestination(traveller, x, y, z);
|
||||
}
|
||||
@@ -302,7 +302,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||
|
||||
_Init(owner);
|
||||
owner.CastStop();
|
||||
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
@@ -351,7 +351,7 @@ void
|
||||
FleeingMovementGenerator<T>::Finalize(T &owner)
|
||||
{
|
||||
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
if (owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
|
||||
owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID());
|
||||
}
|
||||
@@ -369,7 +369,7 @@ FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
{
|
||||
if (!&owner || !owner.isAlive())
|
||||
return false;
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
return true;
|
||||
|
||||
Traveller<T> traveller(owner);
|
||||
@@ -412,7 +412,7 @@ template bool FleeingMovementGenerator<Creature>::Update(Creature &, const uint3
|
||||
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
|
||||
{
|
||||
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
|
||||
if (Unit* victim = owner.getVictim())
|
||||
{
|
||||
if (owner.isAlive())
|
||||
@@ -428,7 +428,7 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_dif
|
||||
if (!owner.isAlive())
|
||||
return false;
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
return true;
|
||||
|
||||
i_totalFleeTime.Update(time_diff);
|
||||
|
||||
@@ -29,7 +29,7 @@ HomeMovementGenerator<Creature>::Initialize(Creature & owner)
|
||||
float x, y, z;
|
||||
owner.GetHomePosition(x, y, z, ori);
|
||||
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
owner.addUnitState(UNIT_STAT_EVADE);
|
||||
owner.AddUnitState(UNIT_STAT_EVADE);
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
|
||||
if (!&owner)
|
||||
return;
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
@@ -54,7 +54,7 @@ HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
|
||||
|
||||
uint32 travel_time = i_destinationHolder.SetDestination(traveller, x, y, z);
|
||||
modifyTravelTime(travel_time);
|
||||
owner.clearUnitState(UNIT_STAT_ALL_STATE & ~UNIT_STAT_EVADE);
|
||||
owner.ClearUnitState(UNIT_STAT_ALL_STATE & ~UNIT_STAT_EVADE);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -77,7 +77,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
|
||||
owner.SendMessageToSet(&packet, false);
|
||||
}
|
||||
|
||||
owner.clearUnitState(UNIT_STAT_EVADE);
|
||||
owner.ClearUnitState(UNIT_STAT_EVADE);
|
||||
owner.LoadCreaturesAddon(true);
|
||||
owner.AI()->JustReachedHome();
|
||||
return false;
|
||||
|
||||
@@ -32,19 +32,19 @@ void IdleMovementGenerator::Initialize(Unit &owner)
|
||||
void
|
||||
IdleMovementGenerator::Reset(Unit& owner)
|
||||
{
|
||||
if (owner.hasUnitState(UNIT_STAT_MOVE))
|
||||
if (owner.HasUnitState(UNIT_STAT_MOVE))
|
||||
owner.StopMoving();
|
||||
}
|
||||
|
||||
void RotateMovementGenerator::Initialize(Unit& owner)
|
||||
{
|
||||
if (owner.hasUnitState(UNIT_STAT_MOVE))
|
||||
if (owner.HasUnitState(UNIT_STAT_MOVE))
|
||||
owner.StopMoving();
|
||||
|
||||
if (owner.getVictim())
|
||||
owner.SetInFront(owner.getVictim());
|
||||
|
||||
owner.addUnitState(UNIT_STAT_ROTATING);
|
||||
owner.AddUnitState(UNIT_STAT_ROTATING);
|
||||
|
||||
owner.AttackStop();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
|
||||
|
||||
void RotateMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROTATING);
|
||||
unit.ClearUnitState(UNIT_STAT_ROTATING);
|
||||
if (unit.GetTypeId() == TYPEID_UNIT)
|
||||
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
|
||||
}
|
||||
@@ -83,13 +83,13 @@ void RotateMovementGenerator::Finalize(Unit &unit)
|
||||
void
|
||||
DistractMovementGenerator::Initialize(Unit& owner)
|
||||
{
|
||||
owner.addUnitState(UNIT_STAT_DISTRACTED);
|
||||
owner.AddUnitState(UNIT_STAT_DISTRACTED);
|
||||
}
|
||||
|
||||
void
|
||||
DistractMovementGenerator::Finalize(Unit& owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_DISTRACTED);
|
||||
owner.ClearUnitState(UNIT_STAT_DISTRACTED);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -105,7 +105,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
|
||||
void
|
||||
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_DISTRACTED);
|
||||
unit.ClearUnitState(UNIT_STAT_DISTRACTED);
|
||||
unit.ToCreature()->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ void PointMovementGenerator<T>::Initialize(T &unit)
|
||||
unit.StopMoving();
|
||||
Traveller<T> traveller(unit);
|
||||
// knockback effect has UNIT_STAT_JUMPING set,so if here we disable sentmonstermove there will be creature position sync problem between client and server
|
||||
i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z, true /* !unit.hasUnitState(UNIT_STAT_JUMPING)*/);
|
||||
i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z, true /* !unit.HasUnitState(UNIT_STAT_JUMPING)*/);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -39,9 +39,9 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
if (!&unit)
|
||||
return false;
|
||||
|
||||
if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
if (unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED))
|
||||
{
|
||||
if (unit.hasUnitState(UNIT_STAT_CHARGING))
|
||||
if (unit.HasUnitState(UNIT_STAT_CHARGING))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
@@ -53,7 +53,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
|
||||
if (i_destinationHolder.HasArrived())
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_MOVE);
|
||||
unit.ClearUnitState(UNIT_STAT_MOVE);
|
||||
arrived = true;
|
||||
return false;
|
||||
}
|
||||
@@ -64,8 +64,8 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
template<class T>
|
||||
void PointMovementGenerator<T>:: Finalize(T &unit)
|
||||
{
|
||||
if (unit.hasUnitState(UNIT_STAT_CHARGING))
|
||||
unit.clearUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
|
||||
if (unit.HasUnitState(UNIT_STAT_CHARGING))
|
||||
unit.ClearUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
|
||||
if (arrived) // without this crash!
|
||||
MovementInform(unit);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
|
||||
Traveller<Creature> traveller(creature);
|
||||
creature.SetOrientation(creature.GetAngle(nx,ny));
|
||||
i_destinationHolder.SetDestination(traveller, nx, ny, nz);
|
||||
creature.addUnitState(UNIT_STAT_ROAMING);
|
||||
creature.AddUnitState(UNIT_STAT_ROAMING);
|
||||
if (is_air_ok)
|
||||
{
|
||||
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
|
||||
@@ -164,20 +164,20 @@ template<>
|
||||
bool
|
||||
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
|
||||
{
|
||||
if (creature.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
if (creature.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
{
|
||||
i_nextMoveTime.Update(i_nextMoveTime.GetExpiry()); // Expire the timer
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING);
|
||||
creature.ClearUnitState(UNIT_STAT_ROAMING);
|
||||
return true;
|
||||
}
|
||||
|
||||
i_nextMoveTime.Update(diff);
|
||||
|
||||
if (i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly())
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_MOVE);
|
||||
creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_MOVE);
|
||||
|
||||
if (!i_destinationHolder.HasArrived() && creature.IsStopped())
|
||||
creature.addUnitState(UNIT_STAT_ROAMING);
|
||||
creature.AddUnitState(UNIT_STAT_ROAMING);
|
||||
|
||||
CreatureTraveller traveller(creature);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
if (!i_target.isValid() || !i_target->IsInWorld())
|
||||
return false;
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
return false;
|
||||
|
||||
float x, y, z;
|
||||
@@ -70,7 +70,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
if (i_target->IsWithinMeleeRange(&owner))
|
||||
return false;
|
||||
}
|
||||
else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
|
||||
else if (!i_angle && !owner.HasUnitState(UNIT_STAT_FOLLOW))
|
||||
{
|
||||
if (i_target->IsWithinDistInMap(&owner, i_offset))
|
||||
return false;
|
||||
@@ -89,7 +89,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
if (i_target->IsWithinMeleeRange(&owner, 0))
|
||||
stop = true;
|
||||
}
|
||||
else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
|
||||
else if (!i_angle && !owner.HasUnitState(UNIT_STAT_FOLLOW))
|
||||
{
|
||||
if (i_target->IsWithinDist(&owner, i_offset * 0.8f))
|
||||
stop = true;
|
||||
@@ -114,7 +114,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
// to nearest random contact position
|
||||
i_target->GetRandomContactPoint(&owner, x, y, z, 0, MELEE_RANGE - 0.5f);
|
||||
}
|
||||
else if (!i_angle && !owner.hasUnitState(UNIT_STAT_FOLLOW))
|
||||
else if (!i_angle && !owner.HasUnitState(UNIT_STAT_FOLLOW))
|
||||
{
|
||||
// caster chase
|
||||
i_target->GetContactPoint(&owner, x, y, z, i_offset * urand(80, 95) * 0.01f);
|
||||
@@ -142,7 +142,7 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
return;
|
||||
*/
|
||||
i_destinationHolder.SetDestination(traveller, x, y, z);
|
||||
owner.addUnitState(UNIT_STAT_CHASE);
|
||||
owner.AddUnitState(UNIT_STAT_CHASE);
|
||||
i_destinationHolder.StartTravel(traveller);
|
||||
return true;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ template<class T>
|
||||
void
|
||||
TargetedMovementGenerator<T>::Finalize(T &owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_CHASE);
|
||||
owner.ClearUnitState(UNIT_STAT_CHASE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -181,11 +181,11 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
if (!&owner || !owner.isAlive())
|
||||
return true;
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED))
|
||||
if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED))
|
||||
return true;
|
||||
|
||||
// prevent movement while casting spells with cast time or channel time
|
||||
if (owner.hasUnitState(UNIT_STAT_CASTING))
|
||||
if (owner.HasUnitState(UNIT_STAT_CASTING))
|
||||
{
|
||||
if (!owner.IsStopped())
|
||||
owner.StopMoving();
|
||||
@@ -193,7 +193,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
}
|
||||
|
||||
// prevent crash after creature killed pet
|
||||
if (!owner.hasUnitState(UNIT_STAT_FOLLOW) && owner.getVictim() != i_target.getTarget())
|
||||
if (!owner.HasUnitState(UNIT_STAT_FOLLOW) && owner.getVictim() != i_target.getTarget())
|
||||
return true;
|
||||
|
||||
Traveller<T> traveller(owner);
|
||||
@@ -202,7 +202,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
_setTargetLocation(owner);
|
||||
else if (owner.IsStopped() && !i_destinationHolder.HasArrived())
|
||||
{
|
||||
owner.addUnitState(UNIT_STAT_CHASE);
|
||||
owner.AddUnitState(UNIT_STAT_CHASE);
|
||||
i_destinationHolder.StartTravel(traveller);
|
||||
return true;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
if (i_targetX != i_target->GetPositionX() || i_targetY != i_target->GetPositionY()
|
||||
|| i_targetZ != i_target->GetPositionZ())
|
||||
{
|
||||
if (_setTargetLocation(owner) || !owner.hasUnitState(UNIT_STAT_FOLLOW))
|
||||
if (_setTargetLocation(owner) || !owner.HasUnitState(UNIT_STAT_FOLLOW))
|
||||
owner.SetInFront(i_target.getTarget());
|
||||
i_target->GetPosition(i_targetX, i_targetY, i_targetZ);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
owner.SetInFront(i_target.getTarget());
|
||||
|
||||
owner.StopMoving();
|
||||
if (owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
|
||||
if (owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.HasUnitState(UNIT_STAT_FOLLOW))
|
||||
owner.Attack(i_target.getTarget(),true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void WaypointMovementGenerator<Creature>::InitTraveller(Creature &unit, const Wa
|
||||
if (unit.canFly())
|
||||
unit.SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x02);
|
||||
|
||||
unit.addUnitState(UNIT_STAT_ROAMING);
|
||||
unit.AddUnitState(UNIT_STAT_ROAMING);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -143,7 +143,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
|
||||
|
||||
// Waypoint movement can be switched on/off
|
||||
// This is quite handy for escort quests and other stuff
|
||||
if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
if (unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
|
||||
return true;
|
||||
|
||||
// Clear the generator if the path doesn't exist
|
||||
@@ -205,7 +205,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
|
||||
i_destinationHolder.ResetTravelTime();
|
||||
MovementInform(unit);
|
||||
unit.UpdateWaypointID(i_currentNode);
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING);
|
||||
unit.ClearUnitState(UNIT_STAT_ROAMING);
|
||||
unit.Relocate(node->x, node->y, node->z);
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
|
||||
void FlightPathMovementGenerator::Initialize(Player &player)
|
||||
{
|
||||
player.getHostileRefManager().setOnlineOfflineState(false);
|
||||
player.addUnitState(UNIT_STAT_IN_FLIGHT);
|
||||
player.AddUnitState(UNIT_STAT_IN_FLIGHT);
|
||||
player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
Traveller<Player> traveller(player);
|
||||
// do not send movement, it was sent already
|
||||
@@ -260,7 +260,7 @@ void FlightPathMovementGenerator::Initialize(Player &player)
|
||||
|
||||
void FlightPathMovementGenerator::Finalize(Player & player)
|
||||
{
|
||||
player.clearUnitState(UNIT_STAT_IN_FLIGHT);
|
||||
player.ClearUnitState(UNIT_STAT_IN_FLIGHT);
|
||||
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
|
||||
@@ -73,7 +73,7 @@ inline uint32 Traveller<T>::GetTotalTrevelTimeTo(float x, float y, float z)
|
||||
template<>
|
||||
inline float Traveller<Creature>::Speed()
|
||||
{
|
||||
if (i_traveller.hasUnitState(UNIT_STAT_CHARGING))
|
||||
if (i_traveller.HasUnitState(UNIT_STAT_CHARGING))
|
||||
return i_traveller.m_TempSpeed;
|
||||
else if (i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
|
||||
return i_traveller.GetSpeed(MOVE_WALK);
|
||||
@@ -113,7 +113,7 @@ inline void Traveller<Creature>::MoveTo(float x, float y, float z, uint32 t)
|
||||
template<>
|
||||
inline float Traveller<Player>::Speed()
|
||||
{
|
||||
if (i_traveller.hasUnitState(UNIT_STAT_CHARGING))
|
||||
if (i_traveller.HasUnitState(UNIT_STAT_CHARGING))
|
||||
return i_traveller.m_TempSpeed;
|
||||
else if (i_traveller.isInFlight())
|
||||
return PLAYER_FLIGHT_SPEED;
|
||||
|
||||
Reference in New Issue
Block a user