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:
@@ -5272,66 +5272,63 @@ 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)
|
||||
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();
|
||||
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
// Soul Shard only from units that grant XP or honor
|
||||
if (!plCaster->isHonorOrXPTarget(target) ||
|
||||
(target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
|
||||
return;
|
||||
|
||||
Player* plCaster = caster->ToPlayer();
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
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)
|
||||
// If this is Drain Soul, check for Glyph of Drain Soul
|
||||
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
|
||||
{
|
||||
// Soul Shard only from units that grant XP or honor
|
||||
if (!plCaster->isHonorOrXPTarget(target) ||
|
||||
(target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
|
||||
return;
|
||||
|
||||
// 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 :)
|
||||
}
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user