Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-12-31 17:18:40 +08:00
102 changed files with 2247 additions and 409 deletions

View File

@@ -558,6 +558,12 @@ enum CommandStates : uint8
COMMAND_ABANDON = 3
};
enum class SearchMethod
{
MatchAll,
MatchAny
};
typedef std::list<Player*> SharedVisionList;
struct AttackPosition {
@@ -1367,6 +1373,50 @@ public:
[[nodiscard]] bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const;
[[nodiscard]] uint32 GetAuraCount(uint32 spellId) const;
/**
* @brief Check if unit has ANY or ALL specified auras.
*
* @param sm The search method to use
* - SearchMethod::MatchAll : The function checks for all of the spell id's on the unit.
* - SearchMethod::MatchAny : The function checks for any of the spell id's on the unit.
*
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the search method condition is met. Otherwise false.
*/
bool HasAuras(SearchMethod sm, std::vector<uint32>& spellIds) const;
/**
* @brief Checks if the unit has ANY specified auras.
*
* @tparam Auras Can be any type convertible to uint32.
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the unit has ANY of the specified auras. Otherwise false.
*/
template <typename... Auras>
bool HasAnyAuras(Auras... spellIds) const
{
std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
return HasAuras(SearchMethod::MatchAny, spellList);
}
/**
* @brief Checks if the unit has ALL specified auras.
*
* @tparam Auras Can be any type convertible to uint32.
* @param spellIds List of spell id's to check for on the unit.
*
* @return Returns true if the unit has ALL of the specified auras. Otherwise false.
*/
template <typename... Auras>
bool HasAllAuras(Auras... spellIds) const
{
std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
return HasAuras(SearchMethod::MatchAll, spellList);
}
[[nodiscard]] bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0) const;
[[nodiscard]] bool HasAuraType(AuraType auraType) const;
[[nodiscard]] bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const;