mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[10385] Remove Unit::GetUnit and update it callers.
This commit is contained in:
parent
dcc9dc25ae
commit
77ae9a63b8
7 changed files with 40 additions and 50 deletions
|
|
@ -8643,11 +8643,6 @@ void Unit::ApplyDiminishingAura( DiminishingGroup group, bool apply )
|
|||
}
|
||||
}
|
||||
|
||||
Unit* Unit::GetUnit(WorldObject const& object, uint64 guid)
|
||||
{
|
||||
return ObjectAccessor::GetUnit(object,guid);
|
||||
}
|
||||
|
||||
bool Unit::isVisibleForInState( Player const* u, WorldObject const* viewPoint, bool inVisibleList ) const
|
||||
{
|
||||
return isVisibleForOrDetect(u, viewPoint, false, inVisibleList, false);
|
||||
|
|
@ -9664,7 +9659,7 @@ void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint3
|
|||
{
|
||||
if( apply )
|
||||
{
|
||||
if(HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
return;
|
||||
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||
|
|
@ -9672,7 +9667,7 @@ void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint3
|
|||
GetMotionMaster()->MovementExpired(false);
|
||||
CastStop(GetGUID() == casterGUID ? spellID : 0);
|
||||
|
||||
Unit* caster = ObjectAccessor::GetUnit(*this,casterGUID);
|
||||
Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGUID) : NULL;
|
||||
|
||||
GetMotionMaster()->MoveFleeing(caster, time); // caster==NULL processed in MoveFleeing
|
||||
}
|
||||
|
|
@ -9682,18 +9677,19 @@ void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint3
|
|||
|
||||
GetMotionMaster()->MovementExpired(false);
|
||||
|
||||
if( GetTypeId() != TYPEID_PLAYER && isAlive() )
|
||||
if (GetTypeId() != TYPEID_PLAYER && isAlive())
|
||||
{
|
||||
Creature* c = ((Creature*)this);
|
||||
// restore appropriate movement generator
|
||||
if(getVictim())
|
||||
if (getVictim())
|
||||
GetMotionMaster()->MoveChase(getVictim());
|
||||
else
|
||||
GetMotionMaster()->Initialize();
|
||||
|
||||
// attack caster if can
|
||||
Unit* caster = Unit::GetUnit(*this, casterGUID);
|
||||
if(caster && ((Creature*)this)->AI())
|
||||
((Creature*)this)->AI()->AttackedBy(caster);
|
||||
if (Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGUID) : NULL)
|
||||
if (c->AI())
|
||||
c->AI()->AttackedBy(caster);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue