Core/Threat: Some corrections to 5709929d2b

Fixes HandleChannelDeathItem (spells such as Drain Soul), which got broken by moving m_deathState = s, thanks Shauren
This commit is contained in:
kaelima
2012-05-13 17:47:27 +02:00
parent e5268ba0b5
commit a1ff27a1c6
3 changed files with 53 additions and 64 deletions
+1 -4
View File
@@ -535,10 +535,7 @@ 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);
iOwner->SendRemoveFromThreatListOpcode(hostilRef);
iThreatContainer.remove(hostilRef);
iThreatOfflineContainer.addReference(hostilRef);
}
-5
View File
@@ -12833,9 +12833,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
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).
if (s != ALIVE && s != JUST_RESPAWNED)
{
CombatStop();
@@ -12880,9 +12877,7 @@ void Unit::setDeathState(DeathState s)
zoneScript->OnUnitDeath(this);
}
else if (s == JUST_RESPAWNED)
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
}
m_deathState = s;
}
@@ -5272,8 +5272,9 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
if (!apply)
{
if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
return;
Unit* caster = GetCaster();
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
@@ -5282,9 +5283,6 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
Player* plCaster = caster->ToPlayer();
Unit* target = aurApp->GetTarget();
if (target->getDeathState() != JUST_DIED)
return;
// Item amount
if (GetAmount() <= 0)
return;
@@ -5332,7 +5330,6 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
}
plCaster->SendNewItem(newitem, count, true, true);
}
}
void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
{