diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 39 | ||||
-rw-r--r-- | src/game/Player.h | 3 | ||||
-rw-r--r-- | src/game/Unit.cpp | 1 | ||||
-rw-r--r-- | src/game/Unit.h | 1 |
4 files changed, 33 insertions, 11 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1535290af27..5659f14f28a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1329,8 +1329,8 @@ void Player::Update( uint32 p_time ) { if (p_time >= m_DetectInvTimer) { - m_DetectInvTimer = 3000; HandleStealthedUnitsDetection(); + m_DetectInvTimer = 3000; } else m_DetectInvTimer -= p_time; @@ -17552,19 +17552,38 @@ void Player::HandleStealthedUnitsDetection() Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(this, stealthedUnits, u_check); VisitNearbyObject(World::GetMaxVisibleDistance(), searcher); - for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) + for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) { - if (!HaveAtClient(*i) && canSeeOrDetect(*i, true)) + if((*i)==this) + continue; + + bool hasAtClient = HaveAtClient((*i)); + bool hasDetected = canSeeOrDetect(*i, true); + + if (hasDetected) { - (*i)->SendUpdateToPlayer(this); - m_clientGUIDs.insert((*i)->GetGUID()); + if(!hasAtClient) + { + (*i)->SendUpdateToPlayer(this); + m_clientGUIDs.insert((*i)->GetGUID()); - #ifdef TRINITY_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 - SendInitialVisiblePackets(*i); + // target aura duration for caster show only if target exist at caster client + // send data at target visibility change (adding to client) + SendInitialVisiblePackets(*i); + } + } + else + { + if(hasAtClient) + { + (*i)->DestroyForPlayer(this); + m_clientGUIDs.erase((*i)->GetGUID()); + } } } } diff --git a/src/game/Player.h b/src/game/Player.h index 744e4e0cc3c..85faad96407 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2051,7 +2051,6 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow); // Stealth detection system - uint32 m_DetectInvTimer; void HandleStealthedUnitsDetection(); uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; @@ -2404,6 +2403,8 @@ class TRINITY_DLL_SPEC Player : public Unit bool m_bCanDelayTeleport; bool m_bHasDelayedTeleport; + uint32 m_DetectInvTimer; + // Temporary removed pet cache uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 117dbe0e1da..111538040f8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10905,6 +10905,7 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const //-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia) //based on wowwiki every 5 mod we have 1 more level diff in calculation visibleDistance += (float)(GetTotalAuraModifier(SPELL_AURA_MOD_DETECT) - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL)) / 5.0f; + visibleDistance = visibleDistance > MAX_PLAYER_STEALTH_DETECT_RANGE ? MAX_PLAYER_STEALTH_DETECT_RANGE : visibleDistance; return distance < visibleDistance; } diff --git a/src/game/Unit.h b/src/game/Unit.h index 3488c9b8f14..85f2ed154dd 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1012,6 +1012,7 @@ enum ReactiveType // delay time next attack to prevent client attack animation problems #define ATTACK_DISPLAY_DELAY 200 +#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player struct SpellProcEventEntry; // used only privately |