mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
feat(Core/Unit): New helper IsClass and script hook OnPlayerIsClass (#18243)
* Class Comparison Logic Encapsulation - Parity * Add Context to IsClass * Add Unit IsClass script hook * Replace additional getClass with IsClass * Update CanUseItem to replace getClass with IsClass * Add separate context for pet vs ability * Change Create to Init since not all referenced contexts are creation * Align spacing in ClassContext * Drop context on LFGManager max power * Update IsClass context that wraps around Missle Barrage * Rename context for swapping weapons * Be more specific than CLASS_CONTEXT_TALENT * Remove duplicate context * Moved IsClass Hook to Player * Removed unused parameter in virtual base function * Added maybe_unused to IsClass virtual in order to compile To match the override signature, the virtual base needs to include the parameter in question, so using [maybe_unused] to signal to the compiler to allow it * Remove extra blank line * Add ABILITY_REACTIVE context * Add context for PET_CHARM * Remove explicit nullopt check per review * Code Readability - Change if to if else in pet Due to the return pattern, this doesn't change functionality in any way * Add OnPlayer to disambiguate --------- Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
This commit is contained in:
@@ -1029,7 +1029,7 @@ class spell_class_call_handler : public SpellScript
|
||||
targets.remove_if([spellInfo](WorldObject const* target) -> bool
|
||||
{
|
||||
Player const* player = target->ToPlayer();
|
||||
if (!player || player->getClass() == CLASS_DEATH_KNIGHT) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
|
||||
if (!player || player->IsClass(CLASS_DEATH_KNIGHT)) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -447,9 +447,9 @@ public:
|
||||
PlayerAbility_Timer = urand(8000, 10000);
|
||||
PlayerClass = target->getClass() - 1;
|
||||
|
||||
if (PlayerClass == CLASS_DRUID - 1)
|
||||
if (target->IsClass(CLASS_DRUID))
|
||||
PlayerClass = CLASS_DRUID;
|
||||
else if (PlayerClass == CLASS_PRIEST - 1 && target->HasSpell(15473))
|
||||
else if (target->IsClass(CLASS_PRIEST) && target->HasSpell(15473))
|
||||
PlayerClass = CLASS_PRIEST; // shadow priest
|
||||
|
||||
SiphonSoul_Timer = 99999; // buff lasts 30 sec
|
||||
|
||||
Reference in New Issue
Block a user