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
@@ -1971,7 +1971,7 @@ namespace Framework.Constants
OnlyWhenIllegallyMounted = 0x04, // Only When Illegally Mounted OnlyWhenIllegallyMounted = 0x04, // Only When Illegally Mounted
DoNotLogAuraRefresh = 0x08, // Do Not Log Aura Refresh (client only) DoNotLogAuraRefresh = 0x08, // Do Not Log Aura Refresh (client only)
MissileSpeedIsDelayInSec = 0x10, // Missile Speed is Delay (in sec) MissileSpeedIsDelayInSec = 0x10, // Missile Speed is Delay (in sec)
SummonPlayerTotem = 0x20, // 5 IgnoreTotemRequirementsForCasting = 0x20, // Ignore Totem Requirements for Casting
Unk6 = 0x40, // 6 Unk6 = 0x40, // 6
Unk7 = 0x80, // 7 Unk7 = 0x80, // 7
AimedShot = 0x100, // 8 AimedShot = 0x100, // 8
+11 -26
View File
@@ -6814,42 +6814,27 @@ namespace Game.Spells
} }
} }
// check totem-item requirements (items presence in inventory) if (!m_spellInfo.HasAttribute(SpellAttr9.IgnoreTotemRequirementsForCasting))
uint totems = 2;
for (int i = 0; i < 2; ++i)
{ {
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; param1 = (int)totem;
continue; return SpellCastResult.Totems;
} }
} }
else // Check items for TotemCategory (items presence in inventory)
totems -= 1; foreach (uint totemCategory in m_spellInfo.TotemCategory)
}
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)
{ {
if (player.HasItemTotemCategory(m_spellInfo.TotemCategory[i])) if (totemCategory != 0 && player.HasItemTotemCategory(totemCategory))
{ {
totemCategory -= 1; param1 = (int)totemCategory;
continue; return SpellCastResult.TotemCategory;
} }
} }
else
totemCategory -= 1;
} }
if (totemCategory != 0)
return SpellCastResult.TotemCategory;
} }
// special checks for spell effects // special checks for spell effects