mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8229] Improve stealth detection code for player case.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
c4ceafcf56
commit
fc7871f0a2
5 changed files with 44 additions and 45 deletions
|
|
@ -1274,8 +1274,8 @@ void Player::Update( uint32 p_time )
|
|||
{
|
||||
if (p_time >= m_DetectInvTimer)
|
||||
{
|
||||
m_DetectInvTimer = 3000;
|
||||
HandleStealthedUnitsDetection();
|
||||
m_DetectInvTimer = 3000;
|
||||
}
|
||||
else
|
||||
m_DetectInvTimer -= p_time;
|
||||
|
|
@ -16876,35 +16876,40 @@ void Player::HandleStealthedUnitsDetection()
|
|||
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap());
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap());
|
||||
|
||||
for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end();)
|
||||
for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i)
|
||||
{
|
||||
if((*i)==this)
|
||||
{
|
||||
i = stealthedUnits.erase(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((*i)->isVisibleForOrDetect(this,true))
|
||||
bool hasAtClient = HaveAtClient((*i));
|
||||
bool hasDetected = (*i)->isVisibleForOrDetect(this, true);
|
||||
|
||||
if (hasDetected)
|
||||
{
|
||||
if(!hasAtClient)
|
||||
{
|
||||
(*i)->SendUpdateToPlayer(this);
|
||||
m_clientGUIDs.insert((*i)->GetGUID());
|
||||
|
||||
(*i)->SendUpdateToPlayer(this);
|
||||
m_clientGUIDs.insert((*i)->GetGUID());
|
||||
#ifdef MANGOS_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
|
||||
sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
|
||||
#endif
|
||||
|
||||
#ifdef MANGOS_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
|
||||
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);
|
||||
|
||||
i = stealthedUnits.erase(i);
|
||||
continue;
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hasAtClient)
|
||||
{
|
||||
(*i)->DestroyForPlayer(this);
|
||||
m_clientGUIDs.erase((*i)->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue