diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 648c46d83..584f5515c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -215,7 +215,7 @@ void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/) { me->GetMotionMaster()->MoveTargetedHome(); if (HasImmuneToNPCFlags) - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); Reset(); } } @@ -497,10 +497,10 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false //disable npcflags me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); - if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC)) + if (me->IsImmuneToNPC()) { HasImmuneToNPCFlags = true; - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); } LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, Run = {}, PlayerGUID = {}", diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index dec39c8c3..f5163f17c 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1830,14 +1830,14 @@ bool Creature::CanStartAttack(Unit const* who) const return false; // This set of checks is should be done only for creatures - if ((HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters - (HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false + if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters + (IsImmuneToPC() && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false { return false; } if (Unit* owner = who->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) // immune to PC and target has player owner + if (owner->GetTypeId() == TYPEID_PLAYER && IsImmuneToPC()) // immune to PC and target has player owner return false; // Do not attack non-combat pets @@ -2368,7 +2368,7 @@ bool Creature::CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction / if (IsCivilian()) return false; - if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC)) + if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || IsImmuneToNPC()) return false; // skip fighting creature diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index fdf514c78..bde7bf453 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2088,7 +2088,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); // xinef: Remove Immunity flags - trigger->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + trigger->SetImmuneToNPC(false); // xinef: set proper orientation, fixes cast against stealthed targets if (target) trigger->SetInFront(target); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2dadc9023..065a21e78 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2643,12 +2643,13 @@ void Player::InitStatsForLevel(bool reapplyMods) // cleanup unit flags (will be re-applied if need at aura load). RemoveFlag(UNIT_FIELD_FLAGS, - UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 | - UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_LOOTING | - UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED | - UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED | - UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE | - UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT ); + UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 | + UNIT_FLAG_LOOTING | UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | + UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | + UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | + UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | + UNIT_FLAG_TAXI_FLIGHT); + SetImmuneToAll(false); SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); // must be set SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);// must be set diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d6c8c4747..f9ea720a8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13027,6 +13027,24 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration) SetInCombatState(false, enemy, duration); } +void Unit::SetImmuneToPC(bool apply, bool keepCombat) +{ + (void)keepCombat; + if (apply) + SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + else + RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); +} + +void Unit::SetImmuneToNPC(bool apply, bool keepCombat) +{ + (void)keepCombat; + if (apply) + SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + else + RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); +} + void Unit::CombatStart(Unit* victim, bool initialAggro) { // Xinef: Dont allow to start combat with triggers @@ -13140,8 +13158,8 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration) return; // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back - if (GetTypeId() == TYPEID_UNIT && enemy && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself()) - RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back + if (GetTypeId() == TYPEID_UNIT && enemy && IsImmuneToPC() && enemy->GetCharmerOrOwnerPlayerOrPlayerItself()) + SetImmuneToPC(true); // unit has engaged in combat, remove immunity so players can fight back if (IsInCombat()) return; @@ -13207,7 +13225,7 @@ void Unit::ClearInCombat() if (Creature* creature = ToCreature()) { if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC) - SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade + SetImmuneToPC(true); // set immunity state to the one from db on evade ClearUnitState(UNIT_STATE_ATTACK_PLAYER); if (HasDynamicFlag(UNIT_DYNFLAG_TAPPED)) @@ -13251,7 +13269,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return false; - if (HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (IsImmuneToPC() && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster()) @@ -13306,11 +13324,11 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo } // check flags if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2) - || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC)) - || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC)) - || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) + || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC()) + || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC()) + || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC()) // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly - || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))) + || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC())) return false; // CvC case - can attack each other only when one of them is hostile @@ -13425,12 +13443,12 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED)) { - if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) + if (target->IsImmuneToPC()) return false; } else { - if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC)) + if (target->IsImmuneToNPC()) return false; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 7229ef068..8bb7eeea4 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1647,6 +1647,13 @@ public: [[nodiscard]] bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); } + void SetImmuneToAll(bool apply, bool keepCombat = false) { SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); } + bool IsImmuneToAll() const { return IsImmuneToPC() && IsImmuneToNPC(); } + void SetImmuneToPC(bool apply, bool keepCombat = false); + bool IsImmuneToPC() const { return HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); } + void SetImmuneToNPC(bool apply, bool keepCombat = false); + bool IsImmuneToNPC() const { return HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); } + bool IsEngaged() const { return IsInCombat(); } bool IsEngagedBy(Unit const* who) const { return IsInCombatWith(who); } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index eba4476d7..3d5eff4b1 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1113,7 +1113,7 @@ namespace Acore {} bool operator()(Unit* u) { - if (!u->IsAlive() || u->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat())) + if (!u->IsAlive() || u->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->IsImmuneToPC() && !u->IsInCombat())) return false; if (u->GetGUID() == i_funit->GetGUID()) return false; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c329395ec..61efa82a1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2424,7 +2424,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) summon->SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp summon->ReplaceAllNpcFlags(NPCFlags(summon->GetCreatureTemplate()->npcflag)); - summon->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(true); summon->SetReactState(REACT_PASSIVE); // Xinef: Pet can have some auras in creature_addon or in scripts, do not remove them instantly diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index 329b36a9d..e80feaaba 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -179,7 +179,7 @@ public: me->SetFaction(FACTION_FRIENDLY); // was set before event start, so set again - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); if (instance->GetData(TYPE_TOMB_OF_SEVEN) == DONE) // what is this trying to do? Probably some kind of crash recovery { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 9b483673a..4470a091b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -752,7 +752,7 @@ public: { ++TombEventCounter; boss->SetFaction(FACTION_DARK_IRON_DWARVES); - boss->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + boss->SetImmuneToPC(false); // find suitable target here. Player* target = boss->SelectNearestPlayer(130); @@ -786,7 +786,7 @@ public: boss->SetLootRecipient(nullptr); } boss->SetFaction(FACTION_FRIENDLY); - boss->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // think this is useless + boss->SetImmuneToPC(true); // think this is useless if (i == 6) // doomrel needs explicit reset { boss->AI()->Reset(); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp index 174c6a510..766a19b7d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -79,7 +79,8 @@ public: void Reset() override { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); events.Reset(); // Apply auras on spawn and reset // DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible @@ -157,7 +158,8 @@ public: me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH); Talk(EMOTE_FREE_OF_BONDS); Talk(YELL_FREE_OF_BONDS); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); events.ScheduleEvent(EVENT_ENTER_COMBAT, 2000); } } @@ -338,7 +340,7 @@ public: void Reset() override { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true)) Emberseer->AI()->SetData(1, 3); @@ -364,7 +366,7 @@ public: { if (data == 1 && value == 1) { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->InterruptSpell(CURRENT_CHANNELED_SPELL); DoZoneInCombat(); _events.CancelEvent(EVENT_ENCAGED_EMBERSEER); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 1fa033d7f..b646571b0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -114,11 +114,13 @@ public: if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS) { - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PREPARATION); + me->SetImmuneToAll(false); return; } - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PREPARATION); + me->SetImmuneToAll(true); gythEvent = false; victorGUID.Clear(); waveDoorGUID.Clear(); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index f396a1b17..cfb502d59 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -358,6 +358,7 @@ public: DoCast(me, SPELL_NEFARIANS_BARRIER); SetCombatMovement(false); + me->SetImmuneToPC(false); AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 200.f, true)); events.ScheduleEvent(EVENT_SHADOWBLINK, 500); events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000); @@ -499,7 +500,8 @@ public: me->SetFaction(FACTION_DRAGONFLIGHT_BLACK); me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP); me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); } } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp index fd676fc5c..d7f840320 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp @@ -151,7 +151,8 @@ public: { summon->CastSpell(summon, SPELL_RAGNAROS_FADE); summon->CastSpell(summon, SPELL_RAGNAROS_SUBMERGE_EFFECT, true); - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + summon->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + summon->SetImmuneToAll(true); summon->SetReactState(REACT_PASSIVE); } } @@ -180,7 +181,7 @@ public: else { events.SetPhase(PHASE_NONE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP); me->SetFaction(FACTION_MAJORDOMO_FRIENDLY); } @@ -282,7 +283,7 @@ public: instance->SetBossState(DATA_MAJORDOMO_EXECUTUS, DONE); events.CancelEventGroup(PHASE_COMBAT); me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetFaction(FACTION_MAJORDOMO_FRIENDLY); EnterEvadeMode(); Talk(SAY_DEFEAT); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 3b4be5ae5..1dba8396c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -137,7 +137,8 @@ public: extraEvents.Reset(); extraEvents.SetPhase(PHASE_EMERGED); me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); } @@ -276,7 +277,8 @@ public: _isIntroDone = true; extraEvents.SetPhase(PHASE_EMERGED); me->RemoveAurasDueToSpell(SPELL_RAGNAROS_SUBMERGE_EFFECT); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(); break; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 194f67610..8de6e59ce 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -107,7 +107,7 @@ void SummonCroneIfReady(InstanceScript* instance, Creature* creature) if (creature->GetVictim()) pCrone->AI()->AttackStart(creature->GetVictim()); pCrone->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); - pCrone->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + pCrone->SetImmuneToPC(false); } } } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 530b77dd7..3434fc8e8 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -106,7 +106,7 @@ public: summons.DespawnAll(); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void JustSummoned(Creature* summon) override @@ -120,7 +120,7 @@ public: void InitializeAI() override { ScriptedAI::InitializeAI(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); } void JustDied(Unit*) override @@ -162,7 +162,8 @@ public: if (me->isRegeneratingHealth()) { me->SetRegeneratingHealth(false); - me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE); + me->SetImmuneToAll(true); me->CombatStop(); me->SetReactState(REACT_PASSIVE); LapseAction(ACTION_REMOVE_FLY); @@ -200,7 +201,7 @@ public: switch (events2.ExecuteEvent()) { case EVENT_INIT_COMBAT: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); if (Unit* target = SelectTargetFromPlayerList(50.0f)) AttackStart(target); return; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 95920a0d5..31e2b9749 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -219,7 +219,7 @@ public: if (creature->AI()->GetData(DATA_IN_PROGRESS)) return true; - creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + creature->SetImmuneToPC(false); creature->RemoveUnitFlag(UNIT_FLAG_SWIMMING); player->CastSpell(creature, SPELL_DUEL, false); @@ -584,7 +584,7 @@ public: { ScriptedAI::MoveInLineOfSight(who); - if (!who->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f)) + if (!who->IsImmuneToNPC() && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f)) if (Unit* owner = who->GetOwner()) if (Player* player = owner->ToPlayer()) { @@ -593,7 +593,7 @@ public: creature->CastSpell(owner, 52517, true); creature->AI()->SetGUID(me->GetGUID()); - creature->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + creature->SetImmuneToAll(true); } } @@ -743,7 +743,7 @@ public: phase = PHASE_CHAINED; events.Reset(); me->SetFaction(FACTION_CREATURE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); me->LoadEquipment(0, true); } @@ -844,7 +844,7 @@ public: else { me->SetFaction(FACTION_MONSTER); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); phase = PHASE_ATTACKING; if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID)) @@ -964,7 +964,7 @@ public: { npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature) { - me->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetFaction(FACTION_FRIENDLY); me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. } @@ -987,7 +987,8 @@ public: me->SetSpeed(MOVE_RUN, 1.25f); me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); - me->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->SetFaction(FACTION_FRIENDLY); } } @@ -1097,7 +1098,8 @@ public: { me->SetFacingToObject(car); // xinef: add some flags - car->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + car->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE); + car->SetImmuneToAll(true); car->SetFaction(FACTION_FRIENDLY); } Talk(SAY_SCARLET_MINER_0); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 9c15adbdc..dc6a899d0 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -255,7 +255,7 @@ public: else { me->GetMotionMaster()->MoveTargetedHome(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); Reset(); } } @@ -313,7 +313,7 @@ public: m_uiValrothGUID = summoned->GetGUID(); summoned->AddThreat(me, 0.0f); - summoned->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + summoned->SetImmuneToPC(false); summons.Summon(summoned); } @@ -666,7 +666,7 @@ public: ExecuteSpeech_Counter = 0; PlayerGUID.Clear(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); } bool MeetQuestCondition(Player* player) @@ -780,7 +780,7 @@ public: case 9: Talk(SAY_EXEC_TIME_6, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -826,7 +826,7 @@ public: case 9: Talk(SAY_EXEC_TIME_8, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -872,7 +872,7 @@ public: case 9: Talk(SAY_EXEC_TIME_3, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -918,7 +918,7 @@ public: case 9: Talk(SAY_EXEC_TIME_7, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -964,7 +964,7 @@ public: case 9: Talk(SAY_EXEC_TIME_4, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -1010,7 +1010,7 @@ public: case 9: Talk(SAY_EXEC_TIME_9, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -1056,7 +1056,7 @@ public: case 9: Talk(SAY_EXEC_TIME_5, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -1102,7 +1102,7 @@ public: case 9: Talk(SAY_EXEC_TIME_10, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -1146,7 +1146,7 @@ public: case 9: Talk(SAY_EXEC_TIME_1, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); @@ -1192,7 +1192,7 @@ public: case 9: Talk(SAY_EXEC_TIME_2, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 408aa1923..6289c5c00 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -465,7 +465,7 @@ public: if (battleStarted == ENCOUNTER_STATE_OUTRO && cr->GetEntry() == NPC_DEFENDER_OF_THE_LIGHT) { cr->SetReactState(REACT_PASSIVE); - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); cr->HandleEmoteCommand(EMOTE_STATE_READY1H); } @@ -546,7 +546,7 @@ public: events.Reset(); summons.DespawnAll(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); me->SetStandState(UNIT_STAND_STATE_STAND); me->SetVisible(true); @@ -670,7 +670,7 @@ public: break; } case EVENT_START_COUNTDOWN_14: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SummonCreatureGroup(5); return; case EVENT_FINISH_FIGHT_1: @@ -698,13 +698,13 @@ public: { summon->CombatStop(true); summon->GetThreatMgr().ClearAllThreat(); - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(true); summon->SetReactState(REACT_PASSIVE); summon->GetMotionMaster()->Clear(false); } me->CombatStop(true); me->GetThreatMgr().ClearAllThreat(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); me->GetMotionMaster()->Clear(false); @@ -1027,7 +1027,7 @@ public: { tirion->CastSpell(tirion, SPELL_TIRION_CHARGE, true); tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - tirion->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + tirion->SetImmuneToAll(true); } break; case EVENT_OUTRO_SCENE_44: diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 615545ab1..2e496097f 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -113,8 +113,7 @@ public: me->SetDisableGravity(true); me->SetReactState(REACT_PASSIVE); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // for some reason he aggroes if we don't have this. - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); // might not be needed, but guardians and stuff like that could mess up. + me->SetImmuneToAll(true); // for some reason he aggroes if we don't have this. } void MovementInform(uint32 type, uint32 id) override @@ -154,8 +153,7 @@ public: me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF)); me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); break; case INTRO_6: diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp index 07b19f003..547d06a8e 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp @@ -139,7 +139,7 @@ public: }) .Schedule(12s, [this](TaskContext context) { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); _phase = PHASE_COMBAT; DoZoneInCombat(); @@ -185,7 +185,7 @@ public: } }); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); summons.DoAction(ACTION_START_EVENT); } @@ -293,13 +293,13 @@ struct npc_apothecary_genericAI : public ScriptedAI { if (action == ACTION_START_EVENT) { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); me->GetMotionMaster()->MovePoint(1, _movePos); } else if (action == ACTION_START_FIGHT) { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); DoZoneInCombat(); } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_jarien_and_sothos.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_jarien_and_sothos.cpp index ded1208cc..8f0856421 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_jarien_and_sothos.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_jarien_and_sothos.cpp @@ -111,7 +111,8 @@ struct boss_jarien : public BossAI }); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToNPC(true); _talked = false; _phase = PHASE_TALK; } @@ -145,7 +146,8 @@ struct boss_jarien : public BossAI _talked = true; _phase = PHASE_FIGHT; me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToNPC(false); }); } @@ -234,7 +236,8 @@ struct boss_sothos : public BossAI }); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToNPC(true); _talked = false; _phase = PHASE_TALK; } @@ -261,7 +264,8 @@ struct boss_sothos : public BossAI _talked = true; _phase = PHASE_FIGHT; me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToNPC(false); }) .Schedule(3s, [this](TaskContext /*context*/) { diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 499e2f566..aec0b170e 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -201,14 +201,14 @@ public: { Creature* target = GetUnitOwner()->ToCreature(); target->SetReactState(REACT_PASSIVE); - target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->SetImmuneToAll(true); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Creature* target = GetUnitOwner()->ToCreature(); target->SetReactState(REACT_AGGRESSIVE); - target->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->SetImmuneToAll(false); } void Register() override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index bd02ff14a..8cd10ea96 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -724,13 +724,13 @@ public: if (ptarget->GetPositionX() > 120) { ptarget->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR)); - ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + ptarget->SetImmuneToPC(true); ptarget->SetReactState(REACT_PASSIVE); ptarget->AI()->SetData(0, 1); } else { - ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + ptarget->SetImmuneToPC(true); ptarget->SetReactState(REACT_PASSIVE); ptarget->AI()->SetData(0, 2); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 4f04748b8..42f0f1cc6 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -138,7 +138,7 @@ public: } } me->RemoveAurasDueToSpell(SPELL_FRENZY); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); instance->SetBossState(DATA_OHGAN, NOT_STARTED); me->Mount(MODEL_OHGAN_MOUNT); reviveGUID.Clear(); @@ -267,7 +267,7 @@ public: } break; case EVENT_STARTED: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); break; default: break; diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index 8f9e6cddc..1f051e491 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -372,7 +372,7 @@ public: continue; else c->AI()->Talk(SAY_MORLEN_4); - c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->SetImmuneToAll(false); c->AI()->AttackStart(me); } break; diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp index a4633e1dc..0f03cee66 100644 --- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp @@ -53,7 +53,7 @@ public: phase = 0; mockingBlowTimer = 5000; shieldBashTimer = 8000; - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); } void sQuestAccept(Player* player, Quest const* quest) override @@ -62,7 +62,7 @@ public: { Talk(SAY_CORPORAL_1, player); npc_escortAI::Start(true, false, player->GetGUID(), quest); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); } } diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index 4a6f92c0f..5ffe52770 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -53,7 +53,7 @@ public: if (quest->GetQuestId() == QUEST_590) { creature->SetFaction(FACTION_ENEMY); - creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + creature->SetImmuneToPC(false); CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player); } return true; @@ -80,8 +80,8 @@ public: me->RestoreFaction(); - if (!me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + if (!me->IsImmuneToPC()) + me->SetImmuneToPC(true); } void EnterCombat(Unit* /*who*/) override { } @@ -104,7 +104,7 @@ public: uiDamage = 0; me->RestoreFaction(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->CombatStop(true); m_uiPhase = 1; diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 0dd04316c..e50b63899 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -1420,8 +1420,7 @@ public: { thrallGUID = temp->GetGUID(); temp->SetReactState(REACT_PASSIVE); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->CastSpell(temp, SPELL_THRALL_BUFF); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); } @@ -1429,8 +1428,7 @@ public: { sylvanasGUID = temp->GetGUID(); temp->SetReactState(REACT_PASSIVE); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); } for (uint8 i = 0; i < HORDE_FORCE_MAXCOUNT; ++i) @@ -1439,8 +1437,7 @@ public: { hordeForcesGUID[i] = temp->GetGUID(); temp->SetReactState(REACT_PASSIVE); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); } } @@ -1451,8 +1448,7 @@ public: if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN)) { allianceForcesGUID[i] = temp->GetGUID(); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); } } @@ -1476,7 +1472,7 @@ public: if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) { jaina->GetMotionMaster()->Clear(); - jaina->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + jaina->SetImmuneToNPC(false); jaina->SetReactState(REACT_AGGRESSIVE); } SetHoldState(true); @@ -1820,8 +1816,7 @@ public: case 53: if (Creature* putress = ObjectAccessor::GetCreature(*me, putressGUID)) { - putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + putress->SetImmuneToAll(false); putress->AddThreat(me, 100.0f); me->AddThreat(putress, 100.0f); putress->RemoveAura(SPELL_PUTRESS_CASTING_STATE); @@ -1894,7 +1889,7 @@ public: case 66: if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) jaina->AI()->Talk(JAINA_SAY_THRONE_1); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); bStepping = false; JumpToNextStep(0); break; @@ -1907,8 +1902,7 @@ public: if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) { jaina->GetMotionMaster()->MovePoint(0, AllianceWP[8].x, AllianceWP[8].y, AllianceWP[8].z); - jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + jaina->SetImmuneToAll(true); } SetEscortPaused(false); bStepping = false; @@ -1933,12 +1927,12 @@ public: break; case 73: Talk(WRYNN_SAY_THRONE_9); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToAll(false); if (Creature* thrall = ObjectAccessor::GetCreature(*me, thrallGUID)) { thrall->SetReactState(REACT_AGGRESSIVE); - thrall->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - thrall->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + thrall->SetImmuneToNPC(false); + thrall->SetImmuneToPC(true); thrall->AddThreat(me, 100.0f); me->AddThreat(thrall, 100.0f); thrall->AI()->AttackStart(me); @@ -1946,8 +1940,8 @@ public: if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasGUID)) { sylvanas->SetReactState(REACT_AGGRESSIVE); - sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - sylvanas->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + sylvanas->SetImmuneToNPC(false); + sylvanas->SetImmuneToPC(true); sylvanas->AddThreat(me, 100.0f); sylvanas->AI()->AttackStart(me); me->AddThreat(sylvanas, 100.0f); @@ -1957,8 +1951,8 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, hordeForcesGUID[i])) { temp->SetReactState(REACT_AGGRESSIVE); - temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToNPC(false); + temp->SetImmuneToPC(true); } } for (uint8 i = 0; i < ALLIANCE_FORCE_MAXCOUNT; ++i) @@ -1969,8 +1963,8 @@ public: { temp->SetReactState(REACT_AGGRESSIVE); temp2->SetReactState(REACT_AGGRESSIVE); - temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); - temp2->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(false); + temp2->SetImmuneToAll(false); temp->AddThreat(temp2, 100.0f); temp->AI()->AttackStart(temp2); temp2->AddThreat(temp, 100.0f); @@ -2564,7 +2558,7 @@ public: if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID)) { sylvanas->GetMotionMaster()->Clear(); - sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + sylvanas->SetImmuneToAll(false); sylvanas->SetReactState(REACT_AGGRESSIVE); sylvanas->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); sylvanas->GetMotionMaster()->MoveFollow(me, 1, M_PI * 0.1f); @@ -2606,7 +2600,7 @@ public: if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[23].x, ThrallSpawn[23].y, ThrallSpawn[23].z, ThrallSpawn[23].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900 * IN_MILLISECONDS)) { ValimathrasGUID = temp->GetGUID(); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); } break; case 3: @@ -2729,7 +2723,7 @@ public: if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[63].x, ThrallSpawn[63].y, ThrallSpawn[63].z, ThrallSpawn[63].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300 * IN_MILLISECONDS)) { ValimathrasGUID = temp->GetGUID(); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); } break; case 13: @@ -2820,7 +2814,7 @@ public: if (Creature* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[73].x, ThrallSpawn[73].y, ThrallSpawn[73].z, ThrallSpawn[73].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1200 * IN_MILLISECONDS)) { ValimathrasGUID = temp->GetGUID(); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->CastSpell(me, SPELL_AURA_OF_VARIMATHRAS); temp->CastSpell(me, SPELL_OPENING_LEGION_PORTALS); temp->AI()->Talk(SAY_CLOSE_DOOR); @@ -3671,7 +3665,7 @@ public: case 137: if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID)) { - valimathras->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + valimathras->SetImmuneToAll(false); valimathras->RemoveAura(SPELL_AURA_OF_VARIMATHRAS); valimathras->RemoveAura(SPELL_OPENING_LEGION_PORTALS); valimathras->AI()->Talk(SAY_VALIMATHRAS_ATTACK); @@ -3740,8 +3734,7 @@ public: if (Creature* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN)) { allianceForcesGUID[i] = temp->GetGUID(); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(true); temp->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true); temp->SetReactState(REACT_PASSIVE); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); @@ -3750,8 +3743,7 @@ public: if (Creature* wrynn = me->SummonCreature(NPC_WRYNN, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN)) { WrynnGUID = wrynn->GetGUID(); - wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + wrynn->SetImmuneToAll(true); wrynn->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); wrynn->SetReactState(REACT_PASSIVE); wrynn->GetMotionMaster()->MovePoint(0, 1302.543f, 359.472f, -67.295f, true); @@ -3759,8 +3751,7 @@ public: if (Creature* jaina = me->SummonCreature(NPC_JAINA, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN)) { JainaGUID = jaina->GetGUID(); - jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + jaina->SetImmuneToAll(true); jaina->SetReactState(REACT_PASSIVE); } JumpToNextStep(6 * IN_MILLISECONDS); @@ -3788,11 +3779,11 @@ public: break; // Wrynn Fight case 152: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToAll(false); if (Creature* wrynn = ObjectAccessor::GetCreature(*me, WrynnGUID)) { - wrynn->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + wrynn->SetImmuneToNPC(false); + wrynn->SetImmuneToPC(true); wrynn->SetReactState(REACT_AGGRESSIVE); wrynn->AddThreat(me, 100.0f); me->AddThreat(wrynn, 100.0f); @@ -3803,7 +3794,7 @@ public: { if (Creature* temp = ObjectAccessor::GetCreature(*me, allianceForcesGUID[i])) { - temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + temp->SetImmuneToAll(false); temp->SetReactState(REACT_AGGRESSIVE); temp->AddThreat(me, 100.0f); temp->AI()->AttackStart(me); diff --git a/src/server/scripts/Events/brewfest.cpp b/src/server/scripts/Events/brewfest.cpp index 4b42847d5..1c62dd4ea 100644 --- a/src/server/scripts/Events/brewfest.cpp +++ b/src/server/scripts/Events/brewfest.cpp @@ -1557,7 +1557,7 @@ struct npc_coren_direbrew : public ScriptedAI { _events.Reset(); _summons.DespawnAll(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_FRIENDLY); _events.SetPhase(PHASE_ALL); @@ -1596,7 +1596,7 @@ struct npc_coren_direbrew : public ScriptedAI if (action == ACTION_START_FIGHT) { _events.SetPhase(PHASE_ONE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); DoZoneInCombat(); @@ -1830,7 +1830,7 @@ struct npc_direbrew_antagonist : public ScriptedAI Talk(SAY_ANTAGONIST_2); break; case ACTION_ANTAGONIST_HOSTILE: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); DoZoneInCombat(); break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 46f70d27c..ec401dd18 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -112,7 +112,7 @@ public: damage = 0; finished = true; me->SetRegeneratingHealth(false); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_PASSIVE); if (InstanceScript* pInstance = me->GetInstanceScript()) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index ac96a22ae..bfeb96aec 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -472,7 +472,7 @@ public: { summons.Despawn(cr); summons.Summon(cr); - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); } Talk(SAY_PHASE501); @@ -972,7 +972,7 @@ public: if (Creature* cr = GetEventNpc(NPC_CITY_MAN)) { cr->UpdateEntry(NPC_INFINITE_HUNTER, nullptr, false); - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->SetReactState(REACT_PASSIVE); } ScheduleNextEvent(currentEvent, 2000); @@ -981,7 +981,7 @@ public: if (Creature* cr = GetEventNpc(NPC_CITY_MAN4)) { cr->UpdateEntry(NPC_INFINITE_AGENT, nullptr, false); - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->SetReactState(REACT_PASSIVE); } ScheduleNextEvent(currentEvent, 2000); @@ -996,14 +996,14 @@ public: } if (Creature* cr = GetEventNpc(NPC_INFINITE_AGENT)) // it is infinite agent now :) { - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(false); cr->SetReactState(REACT_AGGRESSIVE); cr->SetInCombatWithZone(); cr->AddThreat(me, 0.0f); } if (Creature* cr = GetEventNpc(NPC_INFINITE_HUNTER)) // it is infinite hunter now :) { - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(false); cr->SetReactState(REACT_AGGRESSIVE); cr->SetInCombatWithZone(); cr->AddThreat(me, 0.0f); @@ -1076,7 +1076,7 @@ public: me->SummonCreature(NPC_TIME_RIFT, EventPos[EVENT_SRC_EPOCH], TEMPSUMMON_TIMED_DESPAWN, 20000); if (Creature* cr = me->SummonCreature(NPC_EPOCH, EventPos[EVENT_SRC_EPOCH])) { - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetTarget(cr->GetGUID()); cr->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_EPOCH]); @@ -1097,7 +1097,7 @@ public: case EVENT_ACTION_PHASE3+18: if (Creature* cr = GetEventNpc(NPC_EPOCH)) { - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(false); cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); cr->SetReactState(REACT_AGGRESSIVE); cr->AddThreat(me, 0.0f); @@ -1122,7 +1122,7 @@ public: case EVENT_ACTION_PHASE5: if (Creature* cr = GetEventNpc(NPC_MAL_GANIS)) { - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(false); cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); cr->SetInCombatWithZone(); cr->AddThreat(me, 0.0f); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index a62d37f5d..e994c7d5b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -82,7 +82,7 @@ public: summons.Summon(summon); if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetGuidData(DATA_THRALL_GUID))) thrall->AI()->JustSummoned(summon); - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(true); if (summon->GetEntry() == NPC_SKARLOC_MOUNT) return; @@ -103,7 +103,7 @@ public: path.push_back(G3D::Vector3(startPath[i].GetPositionX(), startPath[i].GetPositionY(), startPath[i].GetPositionZ())); me->GetMotionMaster()->MoveSplinePath(&path); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->Mount(SKARLOC_MOUNT_MODEL); } @@ -168,13 +168,13 @@ public: Talk(SAY_ENTER); break; case EVENT_START_FIGHT: - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetInCombatWithZone(); for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) if (summon->GetEntry() != NPC_SKARLOC_MOUNT) { - summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(false); summon->SetInCombatWithZone(); } break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index f56e34b1d..9a1a751c9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -620,7 +620,7 @@ public: case EVENT_SUMMON_CHRONO: if (Creature* epoch = me->SummonCreature(NPC_EPOCH_HUNTER, 2640.49f, 696.15f, 64.31f, 4.51f, TEMPSUMMON_MANUAL_DESPAWN)) { - epoch->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + epoch->SetImmuneToAll(true); epoch->AI()->Talk(SAY_EPOCH_ENTER1); } break; @@ -703,7 +703,7 @@ public: case EVENT_CALL_EPOCH: if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) { - epoch->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + epoch->SetImmuneToAll(false); epoch->GetMotionMaster()->MovePoint(0, *me, false, true); } break; @@ -759,7 +759,7 @@ public: Talk(SAY_EVENT_COMPLETE); break; case EVENT_THRALL_RUN_AWAY: - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); SetEscortPaused(false); break; diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 12aa9be60..4a84c2f28 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -258,14 +258,14 @@ public: { summon->SetFaction(faction); if (remove) - summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToNPC(false); else - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToNPC(true); } if (remove) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); else - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); me->SetFaction(faction); } diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index f2aa0a762..3f1e891b7 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -83,7 +83,7 @@ public: return; me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); SetCombatMovement(true); if (me->IsInCombat()) diff --git a/src/server/scripts/Kalimdor/zone_feralas.cpp b/src/server/scripts/Kalimdor/zone_feralas.cpp index 068fa4d30..1b5b2a56a 100644 --- a/src/server/scripts/Kalimdor/zone_feralas.cpp +++ b/src/server/scripts/Kalimdor/zone_feralas.cpp @@ -99,7 +99,7 @@ public: void InitializeAI() override { me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->RestoreFaction(); _events.Reset(); @@ -203,7 +203,7 @@ public: Talk(TALK_0, player); me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); me->GetMotionMaster()->MoveFollow(player, 3.f, M_PI); diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index dfff979e2..9601750dc 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -584,7 +584,7 @@ public: { npc_omenAI(Creature* creature) : ScriptedAI(creature) { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f); } @@ -598,7 +598,7 @@ public: if (pointId == 1) { me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); if (Player* player = me->SelectNearestPlayer(40.0f)) AttackStart(player); } diff --git a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp index 8d816209a..94fa002b9 100644 --- a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp @@ -153,7 +153,7 @@ public: creature->AI()->Talk(SAY_START); creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE); - creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + creature->SetImmuneToPC(false); } return true; } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 87a000950..c01e31247 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -165,7 +165,8 @@ struct boss_jedoga_shadowseeker : public BossAI void Reset() override { me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); me->SetDisableGravity(true); me->SetHover(true); @@ -254,7 +255,8 @@ struct boss_jedoga_shadowseeker : public BossAI { summon->GetMotionMaster()->MovePoint(POINT_INITIAL, VolunteerSpotPositions[i][1]); summon->SetReactState(REACT_PASSIVE); - summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC ); + summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + summon->SetImmuneToAll(true); summons.Summon(summon); } } @@ -357,6 +359,7 @@ struct boss_jedoga_shadowseeker : public BossAI me->ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); ReschedulleCombatEvents(); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); @@ -583,7 +586,8 @@ struct npc_twilight_volunteer : public ScriptedAI DoCastSelf(SPELL_ACTIVATE_INITIATE, true); me->RemoveAurasDueToSpell(SPELL_WHITE_SPHERE); me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); Talk(SAY_CHOSEN); me->SetStandState(UNIT_STAND_STATE_STAND); diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index 787b43c1b..f4bf7e5b4 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -214,7 +214,7 @@ struct boss_taldaram : public BossAI // Event not started if (instance->GetData(DATA_TELDRAM_SPHERE1) != DONE || instance->GetData(DATA_TELDRAM_SPHERE2) != DONE) { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetDisableGravity(true); me->SetHover(true); if (!me->HasAura(SPELL_BEAM_VISUAL)) @@ -260,7 +260,8 @@ struct boss_taldaram : public BossAI me->SetDisableGravity(false); me->SetHover(false); me->RemoveAllAuras(); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE| UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); me->UpdatePosition(me->GetHomePosition(), true); } summons.DespawnEntry(NPC_JEDOGA_CONTROLLER); @@ -274,7 +275,8 @@ struct boss_taldaram : public BossAI me->SetDisableGravity(false); me->SetHover(false); me->RemoveAllAuras(); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE| UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); } } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 9b592da53..ec1c23b89 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -310,7 +310,7 @@ public: continue; } - dragon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + dragon->SetImmuneToNPC(true); dragon->SetFullHealth(); ++dragonsCount; @@ -729,7 +729,7 @@ struct boss_sartharion_dragonAI : public BossAI events.Reset(); ClearInstance(); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); me->SetSpeed(MOVE_FLIGHT, 1.0f); me->SetCanFly(false); me->ResetLootMode(); @@ -790,7 +790,7 @@ struct boss_sartharion_dragonAI : public BossAI } } - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); me->SetInCombatWithZone(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index 61d9691a9..d1de208f2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -105,7 +105,10 @@ public: { BossAI::Reset(); if (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); + } } void EnterCombat(Unit* who) override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index e26c29eeb..43b161bbf 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -187,7 +187,10 @@ public: case DATA_BALTHARUS_THE_WARBORN: if (GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE && GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE) if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID)) - zarithrian->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + { + zarithrian->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + zarithrian->SetImmuneToPC(false); + } break; case DATA_GENERAL_ZARITHRIAN: if (state == DONE) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 2faee8558..89b0266e1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -158,7 +158,8 @@ public: me->GetThreatMgr().clearReferences(); me->SetRegeneratingHealth(false); _EnterEvadeMode(); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); if( pInstance ) pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); } @@ -305,7 +306,8 @@ public: me->GetThreatMgr().clearReferences(); me->SetRegeneratingHealth(false); _EnterEvadeMode(); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); if( pInstance ) { pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); @@ -404,7 +406,8 @@ public: events.Reset(); me->SetReactState(REACT_PASSIVE); me->SetObjectScale(0.01f); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); events.ScheduleEvent(EVENT_MEMORY_SCALE, 500); } @@ -440,7 +443,8 @@ public: break; case EVENT_MEMORY_START_ATTACK: - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); if( Unit* target = me->SelectNearestTarget(200.0f) ) { AttackStart(target); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index ffbd5a3d9..669b1f74a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -120,7 +120,8 @@ public: summons.DespawnAll(); Phase = 1; me->SetDisplayId(me->GetNativeDisplayId()); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); if( pInstance ) pInstance->SetData(BOSS_BLACK_KNIGHT, NOT_STARTED); @@ -193,7 +194,8 @@ public: { case SPELL_BLACK_KNIGHT_RES: me->SetHealth(me->GetMaxHealth()); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); me->SetControlled(false, UNIT_STATE_STUNNED); me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); @@ -342,7 +344,8 @@ public: { Start(false, true, ObjectGuid::Empty, nullptr); SetDespawnAtEnd(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); } void DoAction(int32 param) override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 096d8cf27..fa2c3f503 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -400,7 +400,8 @@ public: { DoAction(1); DoAction(2); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); me->SetReactState(REACT_AGGRESSIVE); } @@ -488,7 +489,8 @@ public: me->SetRegeneratingHealth(true); me->RemoveUnitFlag(UNIT_FLAG_PACIFIED); me->SetSpeed(MOVE_RUN, 1.0f, false); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); me->RemoveAllAuras(); AddCreatureAddonAuras(); @@ -556,7 +558,8 @@ public: me->StopMoving(); me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); me->SetRegeneratingHealth(false); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); if( pInstance ) { @@ -584,7 +587,8 @@ public: me->CombatStop(true); me->GetMotionMaster()->Clear(); me->SetRegeneratingHealth(false); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); if( pInstance ) pInstance->SetData(DATA_GRAND_CHAMPION_DIED, BossOrder); } @@ -627,7 +631,8 @@ public: events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000, 8000)); events.ScheduleEvent(EVENT_THRUST, urand(3000, 5000)); me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); if( Unit* target = me->SelectNearestTarget(200.0f) ) AttackStart(target); DoZoneInCombat(); @@ -720,7 +725,8 @@ public: { me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); NewMountGUID = mount->GetGUID(); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); me->GetMotionMaster()->MovePoint(7, *mount); events.RepeatEvent(200); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index bbbafa9df..9b6e057f0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -733,7 +733,8 @@ public: { NPC_GrandChampionGUID[BossOrder] = pBoss->GetGUID(); pBoss->ToCreature()->SetReactState(REACT_PASSIVE); - pBoss->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PACIFIED); + pBoss->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); + pBoss->SetImmuneToAll(true); pBoss->ToCreature()->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI / 2); pBoss->AI()->SetData(BossOrder, (shortver ? 1 : 0)); @@ -742,7 +743,8 @@ public: { NPC_GrandChampionMinionsGUID[BossOrder][i] = pAdd->GetGUID(); pAdd->SetReactState(REACT_PASSIVE); - pAdd->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + pAdd->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + pAdd->SetImmuneToAll(true); pAdd->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI / 2); pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, (i + 1)*M_PI / 2); } @@ -839,7 +841,8 @@ public: if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); if( Unit* target = c->SelectNearestTarget(200.0f) ) c->AI()->AttackStart(target); c->AI()->DoZoneInCombat(); @@ -865,7 +868,8 @@ public: if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); if( Unit* target = c->SelectNearestTarget(200.0f) ) c->AI()->AttackStart(target); c->AI()->DoZoneInCombat(); @@ -890,7 +894,8 @@ public: if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); if( Unit* target = c->SelectNearestTarget(200.0f) ) c->AI()->AttackStart(target); c->AI()->DoZoneInCombat(); @@ -915,7 +920,8 @@ public: if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); if( Unit* target = c->SelectNearestTarget(200.0f) ) c->AI()->AttackStart(target); c->AI()->DoZoneInCombat(); @@ -952,7 +958,8 @@ public: if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); if( Unit* target = c->SelectNearestTarget(200.0f) ) c->AI()->AttackStart(target); c->AI()->DoZoneInCombat(); @@ -1056,7 +1063,8 @@ public: if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) ) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToAll(false); //c->AI()->DoZoneInCombat(); } if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) @@ -1077,7 +1085,8 @@ public: if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) { boss->SetReactState(REACT_AGGRESSIVE); - boss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + boss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + boss->SetImmuneToAll(false); if( Unit* target = boss->SelectNearestTarget(200.0f) ) boss->AI()->AttackStart(target); boss->AI()->DoZoneInCombat(); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index f0777a114..e27d9f669 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -66,7 +66,7 @@ public: { startFightTimer = 0; uiHopelessnessCount = 0; - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetControlled(false, UNIT_STATE_ROOT); events.Reset(); if (pInstance) @@ -75,7 +75,7 @@ public: void EnterCombat(Unit* /*who*/) override { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000); events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 11000); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index 4379b6281..1b67e8cc3 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -63,7 +63,7 @@ public: void Reset() override { startFightTimer = 0; - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); events.Reset(); if (pInstance) pInstance->SetData(DATA_MARWYN, NOT_STARTED); @@ -71,7 +71,7 @@ public: void EnterCombat(Unit* /*who*/) override { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); events.ScheduleEvent(EVENT_OBLITERATE, 15000); events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1a9140ff1..024f1033f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -755,7 +755,10 @@ public: { ScriptedAI::EnterEvadeMode(why); if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); + } } }; }; @@ -851,7 +854,10 @@ public: { ScriptedAI::EnterEvadeMode(why); if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); + } } }; }; @@ -994,7 +1000,10 @@ public: { ScriptedAI::EnterEvadeMode(why); if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); + } } }; }; @@ -1077,7 +1086,10 @@ public: { ScriptedAI::EnterEvadeMode(why); if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); + } } }; }; @@ -1161,7 +1173,10 @@ public: { ScriptedAI::EnterEvadeMode(why); if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); + } } }; }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 6ccce9d1b..4b3be91d4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -68,7 +68,7 @@ public: break; case 8: _owner.SetReactState(REACT_AGGRESSIVE); - _owner.RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + _owner.SetImmuneToAll(false); if (InstanceScript* instance = _owner.GetInstanceScript()) instance->SetData(DATA_BATTERED_HILT, 8); break; @@ -96,7 +96,7 @@ public: { Position homePos = _owner.GetHomePosition(); _owner.SetReactState(REACT_PASSIVE); - _owner.SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + _owner.SetImmuneToAll(true); _owner.SetVisible(false); _owner.UpdatePosition(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation(), true); _owner.StopMovingOnCurrentPos(); @@ -629,7 +629,7 @@ public: if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) { c->SetReactState(REACT_AGGRESSIVE); - c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->SetImmuneToAll(false); c->RemoveAurasDueToSpell(70300); } break; @@ -889,7 +889,8 @@ public: if (c->GetEntry() == entry) { TrashActive[j] = true; - c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + c->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + c->SetImmuneToAll(false); c->AI()->DoAction(1); break; } @@ -918,7 +919,8 @@ public: c->GetThreatMgr().ClearAllThreat(); c->CombatStop(true); c->InterruptNonMeleeSpells(true); - c->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + c->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + c->SetImmuneToAll(true); c->Respawn(true); c->UpdatePosition(c->GetHomePosition(), true); c->StopMovingOnCurrentPos(); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 2ed4e607c..61ae383a9 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -418,7 +418,8 @@ public: c->CastSpell(c, 69753, false); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); + me->SetImmuneToAll(true); me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); me->SetDynamicFlag(UNIT_DYNFLAG_DEAD); me->AddUnitState(UNIT_STATE_DIED); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index fc8354713..4f7051cfa 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -930,7 +930,7 @@ public: if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_TYRANNUS_GUID))) { c->AI()->Talk(SAY_PREFIGHT_1); - c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + c->SetImmuneToPC(false); c->SetReactState(REACT_AGGRESSIVE); //c->ClearUnitState(UNIT_STATE_ONVEHICLE); if (Player* plr = c->SelectNearestPlayer(100.0f)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 785cb9386..508653c07 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -212,7 +212,7 @@ public: me->SetDynamicFlag(UNIT_DYNFLAG_DEAD); me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); } } @@ -367,7 +367,8 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); @@ -471,7 +472,7 @@ public: me->SetDynamicFlag(UNIT_DYNFLAG_DEAD); me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); } } @@ -636,7 +637,8 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); @@ -755,7 +757,7 @@ public: me->SetDynamicFlag(UNIT_DYNFLAG_DEAD); me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); } } @@ -929,7 +931,8 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index cd35da886..86bc01d41 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -251,7 +251,7 @@ public: void Reset() override { _Reset(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(true); me->SetReactState(REACT_DEFENSIVE); events.Reset(); _introDone = false; @@ -323,7 +323,7 @@ public: void AttackStart(Unit* victim) override { - if (!_introDone || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) + if (!_introDone || me->IsImmuneToPC()) return; ScriptedAI::AttackStart(victim); @@ -707,7 +707,7 @@ public: if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) { deathbringer->AI()->DoAction(ACTION_INTRO_DONE); - deathbringer->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + deathbringer->SetImmuneToPC(false); if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) deathbringer->AI()->AttackStart(target); } @@ -945,7 +945,7 @@ public: if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG))) { deathbringer->AI()->DoAction(ACTION_INTRO_DONE); - deathbringer->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + deathbringer->SetImmuneToPC(false); if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) deathbringer->AI()->AttackStart(target); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 2dc2feb74..e4c90d4f9 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1431,7 +1431,7 @@ public: return; me->setActive(true); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); me->SetDefaultMovementType(IDLE_MOTION_TYPE); @@ -1450,7 +1450,7 @@ public: me->SetDisableGravity(false); me->SetHomePosition(SpinestalkerLandPos); me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); } void UpdateAI(uint32 diff) override @@ -1562,7 +1562,7 @@ public: return; me->setActive(true); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); me->SetDefaultMovementType(IDLE_MOTION_TYPE); @@ -1583,7 +1583,7 @@ public: me->SetDisableGravity(false); me->SetHomePosition(RimefangLandPos); me->SetFacingTo(RimefangLandPos.GetOrientation()); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); } else if (point == POINT_LAND_GROUND) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 1b611d389..1da4926b8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -631,7 +631,7 @@ public: boss_the_lich_kingAI(Creature* creature) : BossAI(creature, DATA_THE_LICH_KING) { me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); } @@ -658,7 +658,7 @@ public: _Reset(); DoAction(ACTION_RESTORE_LIGHT); SetEquipmentSlots(true); - if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) + if (me->IsImmuneToPC()) me->SetStandState(UNIT_STAND_STATE_SIT); } @@ -704,7 +704,7 @@ public: Cell::VisitGridObjects(me, worker, 333.0f); me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); me->SetStandState(UNIT_STAND_STATE_SIT); } @@ -1207,7 +1207,7 @@ public: spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000)); - terenas->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic + terenas->SetImmuneToAll(true); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic } } break; @@ -1454,7 +1454,7 @@ public: if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { theLichKing->SetWalk(false); - theLichKing->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + theLichKing->SetImmuneToPC(false); theLichKing->SetReactState(REACT_AGGRESSIVE); theLichKing->SetInCombatWithZone(); if (!theLichKing->IsInCombat()) @@ -1587,7 +1587,7 @@ public: terenas->CastSpell((Unit*)nullptr, SPELL_MASS_RESURRECTION, false); if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { - lichKing->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + lichKing->SetImmuneToNPC(false); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->RemoveAllAuras(); SetEquipmentSlots(true); @@ -3708,7 +3708,8 @@ public: if (!target) return; - target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + target->SetImmuneToAll(false); target->ForceValuesUpdateAtIndex(UNIT_FIELD_FLAGS); VileSpiritActivateEvent(target).Execute(0, 0); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1d07f01e6..c3f478d12 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -743,7 +743,8 @@ public: return; me->setActive(true); - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); // Load Grid with Sister Svalna me->GetMap()->LoadGrid(4356.71f, 2484.33f); if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA))) @@ -930,7 +931,8 @@ public: Talk(SAY_CROK_INTRO_3); break; case EVENT_START_PATHING: - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); Start(true, true); break; case EVENT_SCOURGE_STRIKE: @@ -998,7 +1000,7 @@ public: void Reset() override { _Reset(); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); me->SetCanFly(true); me->SetDisableGravity(true); @@ -1007,7 +1009,7 @@ public: void AttackStart(Unit* victim) override { - if (me->HasReactState(REACT_PASSIVE) || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) + if (me->HasReactState(REACT_PASSIVE) || me->IsImmuneToAll()) return; BossAI::AttackStart(victim); } @@ -1037,10 +1039,10 @@ public: void EnterCombat(Unit* /*attacker*/) override { - if (me->HasReactState(REACT_PASSIVE) || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) + if (me->HasReactState(REACT_PASSIVE) || me->IsImmuneToAll()) { me->CombatStop(false); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); return; } @@ -1121,7 +1123,7 @@ public: if (type != EFFECT_MOTION_TYPE || id != POINT_LAND) return; - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetCanFly(false); me->SetDisableGravity(false); me->SetReactState(REACT_AGGRESSIVE); @@ -1915,7 +1917,8 @@ public: if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_PASSIVE); - target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + target->SetImmuneToPC(true); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02); } } @@ -1925,7 +1928,8 @@ public: if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_AGGRESSIVE); - target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + target->SetImmuneToPC(false); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 545461dab..65d745f89 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -225,7 +225,8 @@ public: BossAI::Reset(); events.Reset(); summons.DespawnAll(); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_DISABLE_MOVE); + me->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE); + me->SetImmuneToPC(false); me->SetReactState(REACT_PASSIVE); secondPhase = false; gateOpened = false; @@ -485,7 +486,8 @@ public: Talk(EMOTE_PHASE_TWO); me->CastSpell(me, SPELL_TELEPORT_LIVE, false); me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_DISABLE_MOVE); + me->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE); + me->SetImmuneToPC(false); me->RemoveAllAuras(); summons.DoZoneInCombat(); events.ScheduleEvent(EVENT_SHADOW_BOLT, 1000); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 678c2f69c..aace56577 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -168,7 +168,7 @@ public: cr->InterruptNonMeleeSpells(true); cr->CastSpell(cr, SPELL_FEUGEN_CHAIN, false); cr->SetDisableGravity(true); - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + cr->SetImmuneToPC(false); cr->SetControlled(true, UNIT_STATE_ROOT); } if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3487.04f, -2911.68f, 318.75f, 0.0f)) @@ -177,7 +177,7 @@ public: cr->InterruptNonMeleeSpells(true); cr->CastSpell(cr, SPELL_STALAGG_CHAIN, false); cr->SetDisableGravity(true); - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + cr->SetImmuneToPC(false); cr->SetControlled(true, UNIT_STATE_ROOT); } @@ -403,7 +403,7 @@ public: if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) { cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); - cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + cr->SetImmuneToPC(false); myCoil = cr->GetGUID(); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 776b948cd..c922d2c9b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -377,7 +377,7 @@ public: events.Reset(); summons.DespawnAll(); me->SetReactState(REACT_PASSIVE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetSheath(SHEATH_STATE_UNARMED); me->SetFaction(190); me->CastSpell(me, SPELL_DUAL_WIELD, true); @@ -403,7 +403,7 @@ public: { case ACTION_START_INTRO: { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetUnitFlag2(UNIT_FLAG2_DO_NOT_FADE_IN); me->SetDisableGravity(true); me->CastSpell(me, SPELL_ARRIVAL, true); @@ -446,7 +446,7 @@ public: case ACTION_INIT_ALGALON: _firstPull = false; _fedOnTears = false; - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case ACTION_ASCEND: summons.DespawnAll(); @@ -477,7 +477,8 @@ public: uint32 introDelay = 0; me->setActive(true); me->SetInCombatWithZone(); - me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToNPC(true); events.Reset(); events.SetPhase(PHASE_ROLE_PLAY); @@ -649,7 +650,7 @@ public: break; case EVENT_INTRO_FINISH: events.Reset(); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); if (Creature* brann = ObjectAccessor::GetCreature(*me, m_pInstance->GetGuidData(NPC_BRANN_BRONZBEARD_ALG))) brann->AI()->DoAction(ACTION_FINISH_INTRO); break; @@ -659,7 +660,8 @@ public: break; case EVENT_REMOVE_UNNATTACKABLE: me->SetSheath(SHEATH_STATE_MELEE); - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToNPC(false); break; case EVENT_INTRO_TIMER_DONE: events.SetPhase(PHASE_NORMAL); @@ -985,7 +987,8 @@ public: { case ACTION_ACTIVATE_STAR: me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); _isActive = true; if (Player* target = SelectTargetFromPlayerList(250.0f)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 376c1ec4d..3ce5ce7b9 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -770,7 +770,8 @@ public: } else { - turret->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + turret->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE); + turret->SetImmuneToAll(true); if (turret->GetTypeId() == TYPEID_UNIT) turret->ToCreature()->AI()->EnterEvadeMode(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index b6fa60fda..39054e7bf 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -185,7 +185,7 @@ public: else // if (m_algalonTimer = TIMER_ALGALON_TO_SUMMON) { m_algalonTimer = TIMER_ALGALON_SUMMONED; - algalon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + algalon->SetImmuneToPC(false); } } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index cae0e2e7f..0664944a8 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -142,7 +142,7 @@ public: me->SetCanFly(false); me->SetDisableGravity(false); me->SetFacingTo(0.25f); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index c8caac610..20b077405 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -133,10 +133,11 @@ public: events.Reset(); events2.Reset(); if (!Started) - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); else { - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); me->SetHover(true); } } @@ -152,7 +153,7 @@ public: if (data != 1 || param != 1 || Started || (instance && instance->GetData(DATA_SVALA_SORROWGRAVE) == DONE)) return; - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); Started = true; me->setActive(true); events2.ScheduleEvent(EVENT_SVALA_START, 5000); @@ -247,7 +248,7 @@ public: me->UpdateEntry(NPC_SVALA_SORROWGRAVE); me->SetCorpseDelay(sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE)); me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) Arthas->InterruptNonMeleeSpells(false); me->RemoveAllAuras(); @@ -283,7 +284,7 @@ public: break; case EVENT_SVALA_TALK9: me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->LoadEquipment(1, true); me->setActive(false); if (Player* target = SelectTargetFromPlayerList(100.0f)) diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 169729901..644718725 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -345,13 +345,15 @@ public: if (Creature* pGuard1 = instance->GetCreature(NPC_ErekemGuardGUID[0])) { pGuard1->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard1->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pGuard1->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + pGuard1->SetImmuneToNPC(false); pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); } if (Creature* pGuard2 = instance->GetCreature(NPC_ErekemGuardGUID[1])) { pGuard2->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard2->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pGuard2->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + pGuard2->SetImmuneToNPC(false); pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); } break; @@ -384,7 +386,8 @@ public: if (pBoss) { pBoss->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pBoss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pBoss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetImmuneToNPC(false); pBoss->SetReactState(REACT_AGGRESSIVE); if ((WaveCount == 6 && m_auiEncounter[0] == DONE) || (WaveCount == 12 && m_auiEncounter[1] == DONE)) pBoss->SetLootMode(0); @@ -497,7 +500,10 @@ public: break; case EVENT_CYANIGOSA_ATTACK: if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) - c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + { + c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + c->SetImmuneToNPC(false); + } break; } } @@ -594,15 +600,15 @@ public: HandleGameObject(GO_ZuramatCellGUID, false); // respawn bosses - if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } + if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); } if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) { c->DespawnOrUnsummon(); } } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 730c08429..2db5c1b4d 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -280,7 +280,7 @@ struct violet_hold_trashAI : public npc_escortAI if (!who->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE)) { me->InterruptNonMeleeSpells(false); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); } } @@ -372,7 +372,7 @@ struct violet_hold_trashAI : public npc_escortAI void CreatureStartAttackDoor() { RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); me->CastSpell((Unit*)nullptr, SPELL_DESTROY_DOOR_SEAL, true); } @@ -380,7 +380,7 @@ struct violet_hold_trashAI : public npc_escortAI { if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); me->SetHomePosition(1845.577759f + rand_norm() * 5 - 2.5f, 800.681152f + rand_norm() * 5 - 2.5f, 44.104248f, M_PI); } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index b40420795..94bec6016 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -80,7 +80,7 @@ public: owner->CastSpell(owner, SPELL_SUBDUED, true); GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true); owner->SetFaction(FACTION_FRIENDLY); - owner->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + owner->SetImmuneToAll(true); owner->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS); } @@ -1505,7 +1505,7 @@ public: void Reset() override { - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToAll(true); _events.ScheduleEvent(EVENT_THASSARIAN_CAST, 1000); } @@ -1673,7 +1673,7 @@ public: { _arlosGUID = arlos->GetGUID(); arlos->SetWalk(true); - arlos->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + arlos->SetImmuneToAll(true); arlos->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); arlos->GetMotionMaster()->MovePath(PATH_ARLOS, false); } @@ -1681,7 +1681,7 @@ public: { _leryssaGUID = leryssa->GetGUID(); leryssa->SetWalk(true); - leryssa->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + leryssa->SetImmuneToAll(true); leryssa->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); leryssa->GetMotionMaster()->MovePath(PATH_LERYSSA, false); } diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 5cc0f5707..e93fb93ef 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -416,7 +416,7 @@ public: if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f)) { me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->ReplaceAllDynamicFlags(UNIT_DYNFLAG_DEAD); } _phase = 0; @@ -743,7 +743,8 @@ public: { _playerGUID.Clear(); - me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); } @@ -793,7 +794,8 @@ public: { if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER) { - me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); me->CombatStop(false); _playerGUID = caster->GetGUID(); diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 5635b24da..bd7de0b76 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -489,7 +489,7 @@ public: events.RescheduleEvent(EVENT_START, 1000); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); me->SetWalk(true); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->setActive(true); me->SetReactState(REACT_PASSIVE); } @@ -750,7 +750,7 @@ public: else if (summon->GetEntry() != NPC_INVOKER_BASALEPH) { summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(true); summon->GetMotionMaster()->MovePoint(4, 6135.97f, 2753.84f, 573.92f); } } @@ -974,7 +974,7 @@ public: for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) { - summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(false); if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE) { if (summon->GetEntry() == NPC_TIRION_MOGRAINE) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index a5cf450a4..f90347a34 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -228,7 +228,7 @@ public: me->SetDisableGravity(false); me->CastSpell(me, SPELL_DUAL_WIELD, true); me->LoadEquipment(0, true); - me->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); beamPosId = urand(0, 3); } @@ -957,7 +957,7 @@ public: case EVENT_AKAMA_SCENE_29: if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_ILLIDAN_STORMRAGE))) { - illidan->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + illidan->SetImmuneToAll(false); illidan->SetInCombatWithZone(); AttackStart(illidan); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 413d7b1fa..55c3c83b1 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -131,7 +131,8 @@ public: { BossAI::Reset(); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(true); me->SetWalk(true); } @@ -249,7 +250,8 @@ public: DoResetThreat(); me->GetVictim()->InterruptNonMeleeSpells(false); me->AddThreat(me->GetVictim(), 1000000.0f); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToAll(false); summonsGenerator.DoAction(ACTION_STOP_SPAWNING); break; } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index a3a42b38c..0ba0e9668 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -58,7 +58,8 @@ public: events.Reset(); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); canAttack = false; if (instance) @@ -130,7 +131,8 @@ public: events.ScheduleEvent(EVENT_SPELL_BOLT, 7000); me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); canAttack = true; break; } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 9e0c853a4..e2191c837 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -93,7 +93,8 @@ public: ApplyImmunities(true); SummonChannelers(); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); if (instance) instance->SetData(DATA_KELIDAN, NOT_STARTED); } @@ -143,7 +144,8 @@ public: return; } me->SetReactState(REACT_AGGRESSIVE); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); if (Unit* target = me->SelectNearestPlayer(100.0f)) AttackStart(target); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index d09034f29..3fe7b4bb8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -240,7 +240,8 @@ public: { if (!prisoner->IsAlive()) prisoner->Respawn(true); - prisoner->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetImmuneToAll(true); } void StorePrisoner(Creature* creature) @@ -316,7 +317,8 @@ public: for (ObjectGuid const& guid : prisoners) if (Creature* prisoner = instance->GetCreature(guid)) { - prisoner->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + prisoner->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetImmuneToAll(false); prisoner->SetInCombatWithZone(); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index bf5660081..dd6f74a2d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -114,7 +114,8 @@ public: _Reset(); me->CastSpell(me, SPELL_SHADOW_CAGE, true); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); } void KilledUnit(Unit* /*victim*/) override @@ -184,7 +185,8 @@ public: Talk(SAY_FREE); break; case EVENT_ENTER_COMBAT: - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); events.ScheduleEvent(EVENT_CLEAVE, 9000); events.ScheduleEvent(EVENT_BLAST_NOVA, 60000); diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 82da67da2..e6331c8bf 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -92,7 +92,7 @@ public: ScriptedAI::InitializeAI(); me->SetReactState(REACT_PASSIVE); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); events2.Reset(); events2.ScheduleEvent(EVENT_TELEPORT_VISUAL, 0); events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO1, 3000); @@ -174,7 +174,7 @@ public: case EVENT_MILLHOUSE_INTRO9: me->SetFacingTo(M_PI * 1.5f); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI * 1.5f); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); break; @@ -365,7 +365,7 @@ public: { _Reset(); me->setActive(false); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); me->CastSpell((Unit*)nullptr, SPELL_TARGET_OMEGA, false); @@ -379,7 +379,7 @@ public: { me->setActive(true); me->InterruptNonMeleeSpells(false); - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); events.ScheduleEvent(EVENT_WARDEN_INTRO1, 1500); events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000); instance->SetBossState(DATA_WARDEN_MELLICHAR, IN_PROGRESS); @@ -535,7 +535,7 @@ public: case EVENT_WARDEN_INTRO25: if (Creature* cr = me->SummonCreature(NPC_HARBINGER_SKYRISS, 445.763f, -191.639f, 44.64f, 1.60f, TEMPSUMMON_MANUAL_DESPAWN)) { - cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetImmuneToAll(true); cr->CastSpell(cr, SPELL_TELEPORT_VISUAL, true); } events.ScheduleEvent(EVENT_WARDEN_INTRO26, 1000); @@ -562,7 +562,7 @@ public: me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) { - creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + creature->SetImmuneToAll(false); if (Player* player = SelectTargetFromPlayerList(50.0f)) AttackStart(player); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp index 96196b8de..92858c621 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp @@ -66,14 +66,14 @@ public: { _Reset(); events2.Reset(); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void InitializeAI() override { BossAI::InitializeAI(); if (instance->GetBossState(DATA_SOCCOTHRATES) != DONE) - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); } void JustDied(Unit* /*killer*/) override diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index f6ae5d8cd..d31658aa7 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -75,7 +75,7 @@ public: { events.Reset(); summons.DespawnAll(); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void EnterCombat(Unit* /*who*/) override diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp index 36e981912..47c695435 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -87,14 +87,14 @@ public: _Reset(); events2.Reset(); me->CastSpell(me, SPELL_FEL_IMMOLATION, true); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void InitializeAI() override { BossAI::InitializeAI(); if (!preFight) - me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); } void JustDied(Unit* /*killer*/) override @@ -185,9 +185,9 @@ public: if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH))) { dalliah->SetFacingToObject(me); - dalliah->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + dalliah->SetImmuneToAll(false); me->SetFacingToObject(dalliah); - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 4.725722f); } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index a78ef56a3..8859a7e36 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -255,7 +255,8 @@ public: { if (spell->Id == SPELL_SUMMON_INFERNAL) { - me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitFlag(UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetDisplayId(MODEL_INFERNAL); } } diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index 7b242d60a..1a28c1e34 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -69,7 +69,7 @@ public: } else { - creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + creature->SetImmuneToAll(false); Creature* cr; if ((cr = creature->SummonCreature(17957, -186, -790, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))) cr->AI()->AttackStart(creature); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 7daaa10d4..51d16c953 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1773,7 +1773,7 @@ class spell_gen_creature_permanent_feign_death : public AuraScript Unit* target = GetTarget(); target->SetDynamicFlag(UNIT_DYNFLAG_DEAD); target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->SetImmuneToAll(true); if (target->GetTypeId() == TYPEID_UNIT) target->ToCreature()->SetReactState(REACT_PASSIVE); @@ -1784,7 +1784,7 @@ class spell_gen_creature_permanent_feign_death : public AuraScript Unit* target = GetTarget(); target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); - target->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->SetImmuneToAll(false); if (target->GetTypeId() == TYPEID_UNIT) target->ToCreature()->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 77f2156fb..969e04e7e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1100,7 +1100,7 @@ class spell_item_draenic_pale_ale : public SpellScript summon->SetOwnerGUID(GetCaster()->GetGUID()); summon->SetFaction(GetCaster()->GetFaction()); - summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetImmuneToAll(true); summon->SetReactState(REACT_PASSIVE); summon->GetMotionMaster()->MoveFollow(GetCaster(), PET_FOLLOW_DIST, GetCaster()->GetAngle(summon), MOTION_SLOT_CONTROLLED); GetSpell()->ExecuteLogEffectSummonObject(effIndex, summon); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index e5359d424..140731a6d 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -717,7 +717,7 @@ class spell_q11198_take_down_tethyr : public SpellScript { PreventHitDefaultEffect(effIndex); if (Unit* unit = GetHitUnit()) - if (unit->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) + if (unit->IsImmuneToPC()) return; GetCaster()->CastCustomSpell(42576 /*SPELL_CANNON_BLAST*/, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetCaster(), true); } @@ -1002,13 +1002,13 @@ class spell_q11396_11399_force_shield_arcane_purple_x3 : public AuraScript void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + target->SetImmuneToPC(true); target->SetControlled(true, UNIT_STATE_STUNNED); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); + GetTarget()->SetImmuneToPC(false); } void Register() override diff --git a/src/server/scripts/World/npc_stave_of_ancients.cpp b/src/server/scripts/World/npc_stave_of_ancients.cpp index ee41456bf..e8d32856f 100644 --- a/src/server/scripts/World/npc_stave_of_ancients.cpp +++ b/src/server/scripts/World/npc_stave_of_ancients.cpp @@ -371,7 +371,8 @@ public: if (!ValidThreatlist()) { SetHomePosition(); - me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + me->SetImmuneToAll(true); me->DespawnOrUnsummon(5000); break; } @@ -751,8 +752,10 @@ public: SetHomePosition(); PreciousAI()->SetHomePosition(); - Precious()->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + Precious()->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + Precious()->SetImmuneToAll(true); + me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + me->SetImmuneToAll(true); Precious()->DespawnOrUnsummon(5000); @@ -962,7 +965,8 @@ public: { SetHomePosition(); me->RemoveAllMinionsByEntry(CREEPING_DOOM_ENTRY); - me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + me->SetImmuneToAll(true); me->CombatStop(true); me->Say(NELSON_DESPAWN_SAY); me->HandleEmoteCommand(EMOTE_ONESHOT_TALK); @@ -1136,7 +1140,8 @@ public: if (!ValidThreatlist()) { SetHomePosition(); - me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1); + me->SetImmuneToAll(true); me->CombatStop(true); me->Say(FRANKLIN_DESPAWN_SAY); me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);