mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
@@ -5478,23 +5478,24 @@ void Spell::TakeCastItem()
|
||||
|
||||
for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
|
||||
{
|
||||
if (itemEffect->LegacySlotIndex >= m_CastItem->m_itemData->SpellCharges.size())
|
||||
continue;
|
||||
|
||||
// item has limited charges
|
||||
if (itemEffect->Charges)
|
||||
{
|
||||
if (itemEffect->Charges < 0)
|
||||
expendable = true;
|
||||
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect->LegacySlotIndex);
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect);
|
||||
|
||||
// item has charges left for this slot
|
||||
if (charges && itemEffect->SpellID == int32(m_spellInfo->Id))
|
||||
{
|
||||
(charges > 0) ? --charges : ++charges; // abs(charges) less at 1 after use
|
||||
if (charges > 0)
|
||||
--charges;
|
||||
else
|
||||
++charges;
|
||||
|
||||
if (proto->GetMaxStackSize() == 1)
|
||||
m_CastItem->SetSpellCharges(itemEffect->LegacySlotIndex, charges);
|
||||
m_CastItem->SetSpellCharges(itemEffect, charges);
|
||||
m_CastItem->SetState(ITEM_CHANGED, player);
|
||||
}
|
||||
|
||||
@@ -5712,11 +5713,8 @@ void Spell::TakeReagents()
|
||||
{
|
||||
for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
|
||||
{
|
||||
if (itemEffect->LegacySlotIndex >= m_CastItem->m_itemData->SpellCharges.size())
|
||||
continue;
|
||||
|
||||
// CastItem will be used up and does not count as reagent
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect->LegacySlotIndex);
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect);
|
||||
if (itemEffect->Charges < 0 && abs(charges) < 2)
|
||||
{
|
||||
++itemcount;
|
||||
@@ -7527,9 +7525,8 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*=
|
||||
return SPELL_FAILED_ITEM_NOT_READY;
|
||||
|
||||
for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
|
||||
if (itemEffect->LegacySlotIndex < m_CastItem->m_itemData->SpellCharges.size() && itemEffect->Charges)
|
||||
if (m_CastItem->GetSpellCharges(itemEffect->LegacySlotIndex) == 0)
|
||||
return SPELL_FAILED_NO_CHARGES_REMAIN;
|
||||
if (itemEffect->Charges && m_CastItem->GetSpellCharges(itemEffect) == 0)
|
||||
return SPELL_FAILED_NO_CHARGES_REMAIN;
|
||||
|
||||
// consumable cast item checks
|
||||
if (proto->GetClass() == ITEM_CLASS_CONSUMABLE && m_targets.GetUnitTarget())
|
||||
@@ -7631,11 +7628,8 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*=
|
||||
|
||||
for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
|
||||
{
|
||||
if (itemEffect->LegacySlotIndex >= m_CastItem->m_itemData->SpellCharges.size())
|
||||
continue;
|
||||
|
||||
// CastItem will be used up and does not count as reagent
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect->LegacySlotIndex);
|
||||
int32 charges = m_CastItem->GetSpellCharges(itemEffect);
|
||||
if (itemEffect->Charges < 0 && abs(charges) < 2)
|
||||
{
|
||||
++itemcount;
|
||||
@@ -7991,9 +7985,7 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*=
|
||||
|
||||
if (Item* item = player->GetItemByEntry(itemId))
|
||||
for (ItemEffectEntry const* itemEffect : item->GetEffects())
|
||||
if (itemEffect->LegacySlotIndex <= item->m_itemData->SpellCharges.size()
|
||||
&& itemEffect->Charges != 0
|
||||
&& item->GetSpellCharges(itemEffect->LegacySlotIndex) == itemEffect->Charges)
|
||||
if (itemEffect->Charges != 0 && item->GetSpellCharges(itemEffect) == itemEffect->Charges)
|
||||
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user