mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Merge pull request #3143 from megamage/master
Threat manager. Fix crashes #2396 and #2992.
This commit is contained in:
@@ -74,6 +74,10 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
|
||||
if (!hatedUnit->isAlive() || !hatingUnit->isAlive())
|
||||
return false;
|
||||
|
||||
// not in same map or phase
|
||||
if (!hatedUnit->IsInMap(hatingUnit))
|
||||
return false;
|
||||
|
||||
// spell not causing threat
|
||||
if (threatSpell && threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT)
|
||||
return false;
|
||||
@@ -174,11 +178,13 @@ void HostileReference::updateOnlineStatus()
|
||||
// ref is valid
|
||||
// target is no player or not gamemaster
|
||||
// target is not in flight
|
||||
if (isValid() &&
|
||||
((getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) ||
|
||||
!getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT)))
|
||||
if (isValid()
|
||||
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
|
||||
&& !getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT)
|
||||
&& getTarget()->IsInMap(getSourceUnit())
|
||||
)
|
||||
{
|
||||
Creature* creature = getSourceUnit()->ToCreature();
|
||||
Creature* creature = getSourceUnit()->ToCreature();
|
||||
online = getTarget()->isInAccessiblePlaceFor(creature);
|
||||
if (!online)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user