mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
feat(Core/Unit): New helper HasActivePowerType and script hook OnPlayerHasActivePowerType (#18293)
* Create HasActivePower for script intercept * Replace relevant player-related getPowerType() comparators with HasActivePowerType * Change OnPlayerHasActivePowerType to regular bool instead of optional --------- Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
This commit is contained in:
@@ -1472,6 +1472,7 @@ public:
|
||||
|
||||
[[nodiscard]] Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
|
||||
void setPowerType(Powers power);
|
||||
[[nodiscard]] virtual bool HasActivePowerType(Powers power) { return getPowerType() == power; }
|
||||
[[nodiscard]] uint32 GetPower(Powers power) const { return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
|
||||
[[nodiscard]] uint32 GetMaxPower(Powers power) const { return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
|
||||
void SetPower(Powers power, uint32 val, bool withPowerUpdate = true, bool fromRegenerate = false);
|
||||
|
||||
Reference in New Issue
Block a user