Core/Spells: Fixed applying glyphs without exclusive category

This commit is contained in:
Shauren
2025-06-06 00:22:25 +02:00
parent 1e23aed35d
commit 20ac55ffef

View File

@@ -6284,7 +6284,7 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
if (!glyphBindableSpells)
return SPELL_FAILED_INVALID_GLYPH;
if (std::find(glyphBindableSpells->begin(), glyphBindableSpells->end(), m_misc.SpellId) == glyphBindableSpells->end())
if (!advstd::ranges::contains(*glyphBindableSpells, m_misc.SpellId))
return SPELL_FAILED_INVALID_GLYPH;
if (std::vector<ChrSpecialization> const* glyphRequiredSpecs = sDB2Manager.GetGlyphRequiredSpecs(glyphId))
@@ -6292,7 +6292,7 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
if (caster->GetPrimarySpecialization() == ChrSpecialization::None)
return SPELL_FAILED_GLYPH_NO_SPEC;
if (std::find(glyphRequiredSpecs->begin(), glyphRequiredSpecs->end(), caster->GetPrimarySpecialization()) == glyphRequiredSpecs->end())
if (!advstd::ranges::contains(*glyphRequiredSpecs, caster->GetPrimarySpecialization()))
return SPELL_FAILED_GLYPH_INVALID_SPEC;
}
@@ -6301,7 +6301,7 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
{
if (std::vector<uint32> const* activeGlyphBindableSpells = sDB2Manager.GetGlyphBindableSpells(activeGlyphId))
{
if (std::find(activeGlyphBindableSpells->begin(), activeGlyphBindableSpells->end(), m_misc.SpellId) != activeGlyphBindableSpells->end())
if (advstd::ranges::contains(*activeGlyphBindableSpells, m_misc.SpellId))
{
replacedGlyph = activeGlyphId;
break;
@@ -6317,8 +6317,12 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
if (activeGlyphId == glyphId)
return SPELL_FAILED_UNIQUE_GLYPH;
if (sGlyphPropertiesStore.AssertEntry(activeGlyphId)->GlyphExclusiveCategoryID == glyphProperties->GlyphExclusiveCategoryID)
if (glyphProperties->GlyphExclusiveCategoryID && sGlyphPropertiesStore.AssertEntry(activeGlyphId)->GlyphExclusiveCategoryID == glyphProperties->GlyphExclusiveCategoryID)
{
if (param1)
*param1 = glyphProperties->GlyphExclusiveCategoryID;
return SPELL_FAILED_GLYPH_EXCLUSIVE_CATEGORY;
}
}
}
break;