Core/Spells: Implemented SPELL_ATTR9_IGNORE_TOTEM_REQUIREMENTS_FOR_CASTING - fixes some totems requiring legacy items in inventory

Port From (https://github.com/TrinityCore/TrinityCore/commit/8142ab20b7495ca87a135e08e473f5a33a40e5a4)
This commit is contained in:
Hondacrx
2024-08-25 23:42:13 -04:00
parent bb26b47824
commit 6462b7baf4
2 changed files with 12 additions and 27 deletions
+11 -26
View File
@@ -6814,42 +6814,27 @@ namespace Game.Spells
}
}
// check totem-item requirements (items presence in inventory)
uint totems = 2;
for (int i = 0; i < 2; ++i)
if (!m_spellInfo.HasAttribute(SpellAttr9.IgnoreTotemRequirementsForCasting))
{
if (m_spellInfo.Totem[i] != 0)
// check totem-item requirements (items presence in inventory)
foreach (uint totem in m_spellInfo.Totem)
{
if (player.HasItemCount(m_spellInfo.Totem[i]))
if (totem != 0 && player.HasItemCount(totem))
{
totems -= 1;
continue;
param1 = (int)totem;
return SpellCastResult.Totems;
}
}
else
totems -= 1;
}
if (totems != 0)
return SpellCastResult.Totems;
// Check items for TotemCategory (items presence in inventory)
uint totemCategory = 2;
for (byte i = 0; i < 2; ++i)
{
if (m_spellInfo.TotemCategory[i] != 0)
// Check items for TotemCategory (items presence in inventory)
foreach (uint totemCategory in m_spellInfo.TotemCategory)
{
if (player.HasItemTotemCategory(m_spellInfo.TotemCategory[i]))
if (totemCategory != 0 && player.HasItemTotemCategory(totemCategory))
{
totemCategory -= 1;
continue;
param1 = (int)totemCategory;
return SpellCastResult.TotemCategory;
}
}
else
totemCategory -= 1;
}
if (totemCategory != 0)
return SpellCastResult.TotemCategory;
}
// special checks for spell effects