diff options
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e5de0154ad4..99e4cf04b1c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17597,19 +17597,7 @@ void Player::HandleStealthedUnitsDetection() sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); #endif - // target aura duration for caster show only if target exist at caster client - // send data at target visibility change (adding to client) - if((*i)!=this && (*i)->isType(TYPEMASK_UNIT)) - { - SendAurasForTarget(*i); - //if(((Unit*)(*i))->isAlive()) //should be always alive - { - if((*i)->GetTypeId()==TYPEID_UNIT) - ((Creature*)(*i))->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)(*i))->getVictim()) - ((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim()); - } - } + SendInitialVisiblePackets(*i); } } } @@ -18710,21 +18698,24 @@ void Player::UpdateVisibilityOf(WorldObject* target) // target aura duration for caster show only if target exist at caster client // send data at target visibility change (adding to client) - if(target!=this && target->isType(TYPEMASK_UNIT)) - { - SendAurasForTarget((Unit*)target); - if(((Unit*)target)->isAlive()) - { - if(target->GetTypeId()==TYPEID_UNIT) - ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)target)->getVictim()) - ((Unit*)target)->SendAttackStart(((Unit*)target)->getVictim()); - } - } + if(target->isType(TYPEMASK_UNIT)) + SendInitialVisiblePackets((Unit*)target); } } } +void Player::SendInitialVisiblePackets(Unit* target) +{ + SendAurasForTarget(target); + if(target->isAlive()) + { + if(target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + target->SendMonsterMoveWithSpeedToCurrentDestination(this); + if(target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim()) + target->SendAttackStart(target->getVictim()); + } +} + template<class T> inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target) { |