feat(Unit/Misc): HasAnyAuras() HasAllAuras() HasAuras() (#21040)

This commit is contained in:
Kitzunu
2024-12-26 09:51:54 +01:00
committed by GitHub
parent aa24f50a03
commit bff594c4f5
19 changed files with 95 additions and 30 deletions

View File

@@ -5695,6 +5695,29 @@ uint32 Unit::GetAuraCount(uint32 spellId) const
return count;
}
bool Unit::HasAuras(SearchMethod sm, std::vector<uint32>& spellIds) const
{
if (sm == SearchMethod::MatchAll)
{
for (auto const& spellId : spellIds)
if (!HasAura(spellId))
return false;
return true;
}
else if (sm == SearchMethod::MatchAny)
{
for (auto const& spellId : spellIds)
if (HasAura(spellId))
return true;
return false;
}
else
{
LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm);
return false;
}
}
bool Unit::HasAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))