mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Spells: Implemented SPELL_ATTR9_IGNORE_TOTEM_REQUIREMENTS_FOR_CASTING - fixes some totems requiring legacy items in inventory
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user