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
+13 -28
View File
@@ -6814,43 +6814,28 @@ namespace Game.Spells
} }
} }
if (!m_spellInfo.HasAttribute(SpellAttr9.IgnoreTotemRequirementsForCasting))
{
// check totem-item requirements (items presence in inventory) // check totem-item requirements (items presence in inventory)
uint totems = 2; foreach (uint totem in m_spellInfo.Totem)
for (int i = 0; i < 2; ++i)
{ {
if (m_spellInfo.Totem[i] != 0) if (totem != 0 && player.HasItemCount(totem))
{ {
if (player.HasItemCount(m_spellInfo.Totem[i])) param1 = (int)totem;
{
totems -= 1;
continue;
}
}
else
totems -= 1;
}
if (totems != 0)
return SpellCastResult.Totems; return SpellCastResult.Totems;
}
}
// Check items for TotemCategory (items presence in inventory) // Check items for TotemCategory (items presence in inventory)
uint totemCategory = 2; foreach (uint totemCategory in m_spellInfo.TotemCategory)
for (byte i = 0; i < 2; ++i)
{ {
if (m_spellInfo.TotemCategory[i] != 0) if (totemCategory != 0 && player.HasItemTotemCategory(totemCategory))
{ {
if (player.HasItemTotemCategory(m_spellInfo.TotemCategory[i])) param1 = (int)totemCategory;
{
totemCategory -= 1;
continue;
}
}
else
totemCategory -= 1;
}
if (totemCategory != 0)
return SpellCastResult.TotemCategory; return SpellCastResult.TotemCategory;
} }
}
}
}
// special checks for spell effects // special checks for spell effects
foreach (var spellEffectInfo in m_spellInfo.GetEffects()) foreach (var spellEffectInfo in m_spellInfo.GetEffects())