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:
@@ -535,10 +535,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
|||||||
setCurrentVictim(NULL);
|
setCurrentVictim(NULL);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
if (getOwner() && getOwner()->IsInWorld())
|
iOwner->SendRemoveFromThreatListOpcode(hostilRef);
|
||||||
if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid()))
|
|
||||||
if (getOwner()->IsInMap(target))
|
|
||||||
getOwner()->SendRemoveFromThreatListOpcode(hostilRef);
|
|
||||||
iThreatContainer.remove(hostilRef);
|
iThreatContainer.remove(hostilRef);
|
||||||
iThreatOfflineContainer.addReference(hostilRef);
|
iThreatOfflineContainer.addReference(hostilRef);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12833,9 +12833,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
|
|||||||
|
|
||||||
void Unit::setDeathState(DeathState s)
|
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)
|
if (s != ALIVE && s != JUST_RESPAWNED)
|
||||||
{
|
{
|
||||||
CombatStop();
|
CombatStop();
|
||||||
@@ -12880,9 +12877,7 @@ void Unit::setDeathState(DeathState s)
|
|||||||
zoneScript->OnUnitDeath(this);
|
zoneScript->OnUnitDeath(this);
|
||||||
}
|
}
|
||||||
else if (s == JUST_RESPAWNED)
|
else if (s == JUST_RESPAWNED)
|
||||||
{
|
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
|
||||||
}
|
|
||||||
|
|
||||||
m_deathState = s;
|
m_deathState = s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5272,66 +5272,63 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
|
|||||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!apply)
|
if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
|
||||||
|
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player* plCaster = caster->ToPlayer();
|
||||||
|
Unit* target = aurApp->GetTarget();
|
||||||
|
|
||||||
|
// Item amount
|
||||||
|
if (GetAmount() <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Soul Shard
|
||||||
|
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
// Soul Shard only from units that grant XP or honor
|
||||||
|
if (!plCaster->isHonorOrXPTarget(target) ||
|
||||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
(target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* plCaster = caster->ToPlayer();
|
// If this is Drain Soul, check for Glyph of Drain Soul
|
||||||
Unit* target = aurApp->GetTarget();
|
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
|
||||||
|
|
||||||
if (target->getDeathState() != JUST_DIED)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Item amount
|
|
||||||
if (GetAmount() <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Soul Shard
|
|
||||||
if (GetSpellInfo()->Effects[m_effIndex].ItemType == 6265)
|
|
||||||
{
|
{
|
||||||
// Soul Shard only from units that grant XP or honor
|
// Glyph of Drain Soul - chance to create an additional Soul Shard
|
||||||
if (!plCaster->isHonorOrXPTarget(target) ||
|
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
|
||||||
(target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
|
if (roll_chance_i(aur->GetMiscValue()))
|
||||||
return;
|
caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
|
||||||
|
|
||||||
// If this is Drain Soul, check for Glyph of Drain Soul
|
|
||||||
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
|
|
||||||
{
|
|
||||||
// Glyph of Drain Soul - chance to create an additional Soul Shard
|
|
||||||
if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
|
|
||||||
if (roll_chance_i(aur->GetMiscValue()))
|
|
||||||
caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Adding items
|
|
||||||
uint32 noSpaceForCount = 0;
|
|
||||||
uint32 count = m_amount;
|
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
|
||||||
InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
|
|
||||||
if (msg != EQUIP_ERR_OK)
|
|
||||||
{
|
|
||||||
count-=noSpaceForCount;
|
|
||||||
plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType);
|
|
||||||
if (count == 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
|
|
||||||
if (!newitem)
|
|
||||||
{
|
|
||||||
plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
plCaster->SendNewItem(newitem, count, true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Adding items
|
||||||
|
uint32 noSpaceForCount = 0;
|
||||||
|
uint32 count = m_amount;
|
||||||
|
|
||||||
|
ItemPosCountVec dest;
|
||||||
|
InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellInfo()->Effects[m_effIndex].ItemType, count, &noSpaceForCount);
|
||||||
|
if (msg != EQUIP_ERR_OK)
|
||||||
|
{
|
||||||
|
count-=noSpaceForCount;
|
||||||
|
plCaster->SendEquipError(msg, NULL, NULL, GetSpellInfo()->Effects[m_effIndex].ItemType);
|
||||||
|
if (count == 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item* newitem = plCaster->StoreNewItem(dest, GetSpellInfo()->Effects[m_effIndex].ItemType, true);
|
||||||
|
if (!newitem)
|
||||||
|
{
|
||||||
|
plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plCaster->SendNewItem(newitem, count, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||||
|
|||||||
Reference in New Issue
Block a user