Core/Threat: Fix by faq.
Turning gm on, now drops threat. Dead mobs no longer holds threat on player. Also fixed some Engrish.
This commit is contained in:
@@ -535,6 +535,10 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||
setCurrentVictim(NULL);
|
||||
setDirty(true);
|
||||
}
|
||||
if (getOwner() && getOwner()->IsInWorld())
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid()))
|
||||
if (getOwner()->IsInMap(target))
|
||||
getOwner()->SendRemoveFromThreatListOpcode(hostilRef);
|
||||
iThreatContainer.remove(hostilRef);
|
||||
iThreatOfflineContainer.addReference(hostilRef);
|
||||
}
|
||||
|
||||
@@ -468,9 +468,9 @@ void Creature::Update(uint32 diff)
|
||||
|
||||
switch (m_deathState)
|
||||
{
|
||||
case JUST_ALIVED:
|
||||
// Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
|
||||
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry());
|
||||
case JUST_RESPAWNED:
|
||||
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
|
||||
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
|
||||
break;
|
||||
case JUST_DIED:
|
||||
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
|
||||
@@ -1555,7 +1555,7 @@ void Creature::setDeathState(DeathState s)
|
||||
|
||||
Unit::setDeathState(CORPSE);
|
||||
}
|
||||
else if (s == JUST_ALIVED)
|
||||
else if (s == JUST_RESPAWNED)
|
||||
{
|
||||
//if (isPet())
|
||||
// setActive(true);
|
||||
@@ -1611,7 +1611,7 @@ void Creature::Respawn(bool force)
|
||||
CreatureTemplate const* cinfo = GetCreatureTemplate();
|
||||
SelectLevel(cinfo);
|
||||
|
||||
setDeathState(JUST_ALIVED);
|
||||
setDeathState(JUST_RESPAWNED);
|
||||
|
||||
uint32 displayID = GetNativeDisplayId();
|
||||
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
|
||||
|
||||
@@ -12823,9 +12823,8 @@ void Unit::setDeathState(DeathState s)
|
||||
{
|
||||
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
|
||||
// it can be used to check creation of death items (such as soul shards).
|
||||
m_deathState = s;
|
||||
|
||||
if (s != ALIVE && s != JUST_ALIVED)
|
||||
if (s != ALIVE && s != JUST_RESPAWNED)
|
||||
{
|
||||
CombatStop();
|
||||
DeleteThreatList();
|
||||
@@ -12868,8 +12867,12 @@ void Unit::setDeathState(DeathState s)
|
||||
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
|
||||
zoneScript->OnUnitDeath(this);
|
||||
}
|
||||
else if (s == JUST_ALIVED)
|
||||
else if (s == JUST_RESPAWNED)
|
||||
{
|
||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||
}
|
||||
|
||||
m_deathState = s;
|
||||
}
|
||||
|
||||
/*########################################
|
||||
|
||||
@@ -465,7 +465,7 @@ enum DeathState
|
||||
JUST_DIED = 1,
|
||||
CORPSE = 2,
|
||||
DEAD = 3,
|
||||
JUST_ALIVED = 4,
|
||||
JUST_RESPAWNED = 4,
|
||||
};
|
||||
|
||||
enum UnitState
|
||||
|
||||
Reference in New Issue
Block a user