aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index b2bcf65ab10..5f74831c43a 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -7663,43 +7663,30 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*=
}
}
- // check totem-item requirements (items presence in inventory)
- uint32 totems = 2;
- for (uint8 i = 0; i < 2; ++i)
+ if (!m_spellInfo->HasAttribute(SPELL_ATTR9_IGNORE_TOTEM_REQUIREMENTS_FOR_CASTING))
{
- if (m_spellInfo->Totem[i] != 0)
+ // check totem-item requirements (items presence in inventory)
+ for (int32 totem : m_spellInfo->Totem)
{
- if (player->HasItemCount(m_spellInfo->Totem[i]))
+ if (totem && !player->HasItemCount(totem))
{
- totems -= 1;
- continue;
+ if (param1)
+ *param1 = totem;
+ return SPELL_FAILED_TOTEMS;
}
}
- else
- totems -= 1;
- }
-
- if (totems != 0)
- return SPELL_FAILED_TOTEMS;
- // Check items for TotemCategory (items presence in inventory)
- uint32 totemCategory = 2;
- for (uint8 i = 0; i < 2; ++i)
- {
- if (m_spellInfo->TotemCategory[i] != 0)
+ // Check items for TotemCategory (items presence in inventory)
+ for (int32 totemCategory : m_spellInfo->TotemCategory)
{
- if (player->HasItemTotemCategory(m_spellInfo->TotemCategory[i]))
+ if (totemCategory && !player->HasItemTotemCategory(totemCategory))
{
- totemCategory -= 1;
- continue;
+ if (param1)
+ *param1 = totemCategory;
+ return SPELL_FAILED_TOTEM_CATEGORY;
}
}
- else
- totemCategory -= 1;
}
-
- if (totemCategory != 0)
- return SPELL_FAILED_TOTEM_CATEGORY;
}
// special checks for spell effects