aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-06-11 20:12:24 +0200
committerOvahlord <dreadkiller@gmx.de>2024-06-20 01:19:51 +0200
commitd0c37cba22667c6a2d5f9753216b94f2f50e5e23 (patch)
treeecb9922c096557608ea92f93c4bdcee448e6b5ab /src/server/game/Spells/Spell.cpp
parentf7992964c3d60e6a8e159b1c151a2ac3367b861f (diff)
Core/Spells: Implemented SPELL_ATTR9_IGNORE_TOTEM_REQUIREMENTS_FOR_CASTING - fixes some totems requiring legacy items in inventory
(cherry picked from commit 8142ab20b7495ca87a135e08e473f5a33a40e5a4)
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 32693cef662..b0a5b3c7cdd 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -7446,43 +7446,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