From 7ce75e84d6a9f62ec9a4fee18b92e7ca1724e665 Mon Sep 17 00:00:00 2001 From: ratkosrb Date: Fri, 17 Jan 2025 10:53:26 +0200 Subject: [PATCH] Fix confusing naming of unit states. --- src/game/AI/CreatureAI.cpp | 6 +- src/game/AI/CreatureEventAI.cpp | 2 +- src/game/AI/NullCreatureAI.cpp | 2 +- src/game/AI/PetAI.cpp | 10 +- src/game/AI/PetEventAI.cpp | 2 +- src/game/AI/PlayerAI.cpp | 2 +- src/game/AI/ScriptedEscortAI.cpp | 2 +- src/game/AI/ScriptedFollowerAI.cpp | 2 +- src/game/AI/ScriptedPetAI.cpp | 4 +- src/game/AI/TotemAI.cpp | 6 +- .../MovementAnticheat/MovementAnticheat.cpp | 2 +- src/game/Commands/DebugCommands.cpp | 4 +- src/game/Formulas.h | 2 +- src/game/Handlers/AuctionHouseHandler.cpp | 14 +- src/game/Handlers/CharacterHandler.cpp | 2 +- src/game/Handlers/GuildHandler.cpp | 2 +- src/game/Handlers/ItemHandler.cpp | 6 +- src/game/Handlers/LootHandler.cpp | 2 +- src/game/Handlers/MovementHandler.cpp | 12 +- src/game/Handlers/NPCHandler.cpp | 2 +- src/game/Handlers/PetHandler.cpp | 6 +- src/game/Handlers/PetitionsHandler.cpp | 4 +- src/game/Handlers/QuestHandler.cpp | 2 +- src/game/Handlers/SkillHandler.cpp | 2 +- src/game/Handlers/TaxiHandler.cpp | 4 +- src/game/Handlers/TradeHandler.cpp | 4 +- src/game/Maps/GridNotifiers.h | 2 +- src/game/Maps/GridNotifiersImpl.h | 2 +- src/game/Maps/PathFinder.cpp | 2 +- src/game/Maps/ScriptCommands.cpp | 2 +- .../Movement/ConfusedMovementGenerator.cpp | 10 +- src/game/Movement/CyclicMovementGenerator.cpp | 14 +- src/game/Movement/FearMovementGenerator.cpp | 24 +-- .../Movement/FleeingMovementGenerator.cpp | 24 +-- src/game/Movement/HomeMovementGenerator.cpp | 6 +- src/game/Movement/IdleMovementGenerator.cpp | 6 +- src/game/Movement/MotionMaster.cpp | 12 +- src/game/Movement/PointMovementGenerator.cpp | 66 ++++----- src/game/Movement/RandomMovementGenerator.cpp | 16 +- .../Movement/TargetedMovementGenerator.cpp | 32 ++-- src/game/Movement/TargetedMovementGenerator.h | 8 +- .../Movement/WaypointMovementGenerator.cpp | 48 +++--- src/game/Objects/Creature.cpp | 22 +-- src/game/Objects/Creature.h | 14 +- src/game/Objects/GameObject.cpp | 2 +- src/game/Objects/Object.cpp | 6 +- src/game/Objects/Player.cpp | 26 ++-- src/game/Objects/Unit.cpp | 66 ++++----- src/game/Objects/Unit.h | 10 +- src/game/Objects/UnitDefines.h | 138 +++++++++--------- src/game/PlayerBots/BattleBotAI.cpp | 32 ++-- src/game/PlayerBots/CombatBotBaseAI.cpp | 2 +- src/game/PlayerBots/PartyBotAI.cpp | 32 ++-- src/game/PlayerBots/PlayerBotAI.cpp | 2 +- src/game/PlayerBots/PlayerBotMgr.cpp | 2 +- src/game/Spells/Spell.cpp | 30 ++-- src/game/Spells/Spell.h | 2 +- src/game/Spells/SpellAuras.cpp | 40 ++--- src/game/Spells/SpellEffects.cpp | 12 +- src/game/Threat/ThreatManager.cpp | 6 +- src/game/UnitAuraProcHandler.cpp | 2 +- .../battlegrounds/battleground_alterac.cpp | 46 +++--- .../blackwing_lair/boss_nefarian.cpp | 2 +- .../blackwing_lair/boss_razorgore.cpp | 2 +- .../instance_blackwing_lair.cpp | 2 +- .../molten_core/boss_baron_geddon.cpp | 6 +- .../molten_core/boss_ragnaros.cpp | 2 +- .../eastern_plaguelands.cpp | 2 +- .../naxxramas/boss_four_horsemen.cpp | 2 +- .../naxxramas/boss_loatheb.cpp | 2 +- .../naxxramas/boss_patchwerk.cpp | 2 +- .../naxxramas/boss_sapphiron.cpp | 2 +- .../zulgurub/boss_jeklik.cpp | 2 +- .../zulgurub/boss_jindo.cpp | 4 +- .../zulgurub/zulgurub_trash.cpp | 4 +- .../scarlet_monastery/boss_herod.cpp | 6 +- .../eastern_kingdoms/wetlands/wetlands.cpp | 2 +- .../onyxias_lair/boss_onyxia.cpp | 2 +- .../ruins_of_ahnqiraj/boss_ayamiss.cpp | 4 +- .../temple_of_ahnqiraj/boss_bug_trio.cpp | 2 +- .../temple_of_ahnqiraj/boss_cthun.cpp | 6 +- .../silithus/temple_of_ahnqiraj/boss_ouro.cpp | 6 +- .../temple_of_ahnqiraj/boss_skeram.cpp | 2 +- .../temple_of_ahnqiraj/boss_twinemperors.cpp | 2 +- .../temple_of_ahnqiraj/boss_viscidus.cpp | 2 +- .../wailing_caverns/wailing_caverns.cpp | 4 +- src/scripts/world/npcs_special.cpp | 4 +- 87 files changed, 475 insertions(+), 475 deletions(-) diff --git a/src/game/AI/CreatureAI.cpp b/src/game/AI/CreatureAI.cpp index f05cd686662..649cc3dd57c 100644 --- a/src/game/AI/CreatureAI.cpp +++ b/src/game/AI/CreatureAI.cpp @@ -250,12 +250,12 @@ void CreatureAI::SetMeleeAttack(bool enabled) { if (enabled) { - m_creature->AddUnitState(UNIT_STAT_MELEE_ATTACKING); + m_creature->AddUnitState(UNIT_STATE_MELEE_ATTACKING); m_creature->SendMeleeAttackStart(pVictim); } else { - m_creature->ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + m_creature->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); m_creature->SendMeleeAttackStop(pVictim); } } @@ -347,7 +347,7 @@ void CreatureAI::OnMoveInStealth(Unit* who) bool CreatureAI::CanTriggerAlert(Unit const* who) { // If this unit isn't an NPC, is already distracted, is in combat, is confused, stunned or fleeing, do nothing - if (m_creature->GetTypeId() != TYPEID_UNIT || m_creature->IsInCombat() || m_creature->HasUnitState(UNIT_STAT_NO_FREE_MOVE)) + if (m_creature->GetTypeId() != TYPEID_UNIT || m_creature->IsInCombat() || m_creature->HasUnitState(UNIT_STATE_NO_FREE_MOVE)) return false; // Only alert for hostiles! diff --git a/src/game/AI/CreatureEventAI.cpp b/src/game/AI/CreatureEventAI.cpp index 07b78f58a8e..0510d9af52c 100644 --- a/src/game/AI/CreatureEventAI.cpp +++ b/src/game/AI/CreatureEventAI.cpp @@ -369,7 +369,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, SpellCaster* } case EVENT_T_VICTIM_ROOTED: { - if (!m_creature->GetVictim() || !m_creature->GetVictim()->HasUnitState(UNIT_STAT_ROOT)) + if (!m_creature->GetVictim() || !m_creature->GetVictim()->HasUnitState(UNIT_STATE_ROOT)) return false; pHolder.UpdateRepeatTimer(m_creature, event.victim_rooted.repeatMin, event.victim_rooted.repeatMax); diff --git a/src/game/AI/NullCreatureAI.cpp b/src/game/AI/NullCreatureAI.cpp index fdf74471d9f..3b866f614f8 100644 --- a/src/game/AI/NullCreatureAI.cpp +++ b/src/game/AI/NullCreatureAI.cpp @@ -24,7 +24,7 @@ NullCreatureAI::NullCreatureAI(Creature* c) : CreatureAI(c) { - c->AddUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS); + c->AddUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS); m_bMeleeAttack = false; m_bCombatMovement = false; } diff --git a/src/game/AI/PetAI.cpp b/src/game/AI/PetAI.cpp index 71b98cef0d7..364f154512d 100644 --- a/src/game/AI/PetAI.cpp +++ b/src/game/AI/PetAI.cpp @@ -141,7 +141,7 @@ void PetAI::MoveInLineOfSight(Unit* pWho) void PetAI::UpdateAI(uint32 const diff) { - if (!m_creature->IsAlive() || !m_creature->GetCharmInfo() || m_creature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!m_creature->IsAlive() || !m_creature->GetCharmInfo() || m_creature->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return; // part of it must run during eyes of the Beast to update melee hits @@ -184,7 +184,7 @@ void PetAI::UpdateAI(uint32 const diff) return; // Creature could have died upon attacking (thorns aura for example), and lost charm aura. Abort. - if (!m_creature->IsAlive() || !m_creature->GetCharmInfo() || m_creature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!m_creature->IsAlive() || !m_creature->GetCharmInfo() || m_creature->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return; // Autocast (casted only in combat or persistent spells in any state) @@ -459,7 +459,7 @@ void PetAI::OwnerAttackedBy(Unit* attacker) return; // In crowd control - if (m_creature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (m_creature->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return; // Prevent pet from disengaging from current target @@ -493,7 +493,7 @@ void PetAI::OwnerAttacked(Unit* target) return; // In crowd control - if (m_creature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (m_creature->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return; // Prevent pet from disengaging from current target @@ -649,7 +649,7 @@ void PetAI::DoAttack(Unit* target, bool chase) // Make sure creature owner enters combat too if (Creature* pOwner = ToCreature(m_creature->GetCharmerOrOwner())) { - if (pOwner->IsAlive() && !pOwner->HasUnitState(UNIT_STAT_CAN_NOT_REACT) && + if (pOwner->IsAlive() && !pOwner->HasUnitState(UNIT_STATE_CAN_NOT_REACT) && pOwner->IsValidAttackTarget(target, false)) pOwner->EnterCombatWithTarget(target); } diff --git a/src/game/AI/PetEventAI.cpp b/src/game/AI/PetEventAI.cpp index 4f4e83bf12a..5626f5775a9 100644 --- a/src/game/AI/PetEventAI.cpp +++ b/src/game/AI/PetEventAI.cpp @@ -189,7 +189,7 @@ void PetEventAI::UpdateAI(uint32 const uiDiff) if (m_creature->IsInCombat() && !(hasAliveOwner && pOwner->IsInCombat())) m_creature->OnLeaveCombat(); - if (hasAliveOwner && m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW) && !m_creature->HasUnitState(UNIT_STAT_FOLLOW)) + if (hasAliveOwner && m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW) && !m_creature->HasUnitState(UNIT_STATE_FOLLOW)) { m_creature->GetMotionMaster()->MoveFollow(m_creature->GetCharmerOrOwner(), PET_FOLLOW_DIST, m_creature->IsPet() ? static_cast(m_creature)->GetFollowAngle() : PET_FOLLOW_ANGLE); diff --git a/src/game/AI/PlayerAI.cpp b/src/game/AI/PlayerAI.cpp index cfcf5ba4eeb..8c2d578c6c9 100644 --- a/src/game/AI/PlayerAI.cpp +++ b/src/game/AI/PlayerAI.cpp @@ -44,7 +44,7 @@ bool PlayerAI::CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bool isTrig if (!isTriggered) { // State does not allow - if (me->HasUnitState(checkControlled ? UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL : UNIT_STAT_CAN_NOT_REACT)) + if (me->HasUnitState(checkControlled ? UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL : UNIT_STATE_CAN_NOT_REACT)) return false; if (pSpell->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) diff --git a/src/game/AI/ScriptedEscortAI.cpp b/src/game/AI/ScriptedEscortAI.cpp index 056037a044a..a51478231a1 100644 --- a/src/game/AI/ScriptedEscortAI.cpp +++ b/src/game/AI/ScriptedEscortAI.cpp @@ -93,7 +93,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) if (!m_creature->CanAssistPlayers()) return false; - if (m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FEIGN_DEATH)) + if (m_creature->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_FEIGN_DEATH)) return false; //not a player diff --git a/src/game/AI/ScriptedFollowerAI.cpp b/src/game/AI/ScriptedFollowerAI.cpp index a597aed749c..aef0188318d 100644 --- a/src/game/AI/ScriptedFollowerAI.cpp +++ b/src/game/AI/ScriptedFollowerAI.cpp @@ -42,7 +42,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) if (!m_creature->CanAssistPlayers()) return false; - if (m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FEIGN_DEATH)) + if (m_creature->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_FEIGN_DEATH)) return false; //not a player diff --git a/src/game/AI/ScriptedPetAI.cpp b/src/game/AI/ScriptedPetAI.cpp index dbca5bcbddc..7bf6b60ae2b 100644 --- a/src/game/AI/ScriptedPetAI.cpp +++ b/src/game/AI/ScriptedPetAI.cpp @@ -144,7 +144,7 @@ void ScriptedPetAI::UpdateAI(uint32 const uiDiff) } } // If we are out of the FOR it means no valid targets, so follow master. - if (!m_creature->HasUnitState(UNIT_STAT_FOLLOW)) + if (!m_creature->HasUnitState(UNIT_STATE_FOLLOW)) m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } } @@ -152,7 +152,7 @@ void ScriptedPetAI::UpdateAI(uint32 const uiDiff) else if (m_creature->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW)) { // not following, so start follow - if (!m_creature->HasUnitState(UNIT_STAT_FOLLOW)) + if (!m_creature->HasUnitState(UNIT_STATE_FOLLOW)) m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); // update when not in combat diff --git a/src/game/AI/TotemAI.cpp b/src/game/AI/TotemAI.cpp index c2af1421e0a..0b280d4ca3c 100644 --- a/src/game/AI/TotemAI.cpp +++ b/src/game/AI/TotemAI.cpp @@ -39,7 +39,7 @@ int TotemAI::Permissible(Creature const* creature) TotemAI::TotemAI(Creature* pCreature) : CreatureAI(pCreature) { - pCreature->AddUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS); + pCreature->AddUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS); if (Totem const* pTotem = pCreature->ToTotem()) { @@ -65,8 +65,8 @@ TotemAI::TotemAI(Creature* pCreature) : CreatureAI(pCreature) void TotemAI::UpdateAI(uint32 const /*diff*/) { - if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->AddUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->AddUnitState(UNIT_STATE_ROOT); if (m_totemType != TOTEM_ACTIVE) return; diff --git a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp index 648001a9af4..7f49490464c 100644 --- a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp +++ b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp @@ -737,7 +737,7 @@ uint32 MovementAnticheat::HandleFlagTests(Player* pPlayer, MovementInfo& movemen if ((currentMoveFlags & MOVEFLAG_ROOT) && !(GetLastMovementInfo().moveFlags & MOVEFLAG_ROOT) && !me->HasPendingMovementChange(ROOT) && - !me->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_ROOT_ON_LANDING) && + !me->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_ROOT_ON_LANDING) && (opcode != CMSG_FORCE_MOVE_ROOT_ACK)) { APPEND_CHEAT(CHEAT_TYPE_SELF_ROOT); diff --git a/src/game/Commands/DebugCommands.cpp b/src/game/Commands/DebugCommands.cpp index 8552c827e91..b5e32bc7c50 100644 --- a/src/game/Commands/DebugCommands.cpp +++ b/src/game/Commands/DebugCommands.cpp @@ -2339,13 +2339,13 @@ bool ChatHandler::HandleUnitStatCommand(char *args) if (!pTarget) return false; uint32 unitStat = 0x0; - for (int i = 1; i < UNIT_STAT_IGNORE_PATHFINDING; i *= 2) + for (int i = 1; i < UNIT_STATE_IGNORE_PATHFINDING; i *= 2) if (pTarget->HasUnitState(i)) unitStat |= i; PSendSysMessage("UnitState = 0x%x (%u)", unitStat, unitStat); if (ExtractUInt32(&args, unitStat)) { - pTarget->ClearUnitState(UNIT_STAT_ALL_STATE); + pTarget->ClearUnitState(UNIT_STATE_ALL_STATE); pTarget->AddUnitState(unitStat); PSendSysMessage("UnitState changed to 0x%x (%u)", unitStat, unitStat); } diff --git a/src/game/Formulas.h b/src/game/Formulas.h index 18fe89e9809..934f8b91e79 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -109,7 +109,7 @@ namespace MaNGOS (pCreature->GetCreatureInfo()->health_multiplier <= 0.1f))) return 0; - if (pCreature->HasUnitState(UNIT_STAT_NO_KILL_REWARD)) + if (pCreature->HasUnitState(UNIT_STATE_NO_KILL_REWARD)) return 0; if (pCreature->HasStaticFlag(CREATURE_STATIC_FLAG_NO_XP)) diff --git a/src/game/Handlers/AuctionHouseHandler.cpp b/src/game/Handlers/AuctionHouseHandler.cpp index dd529d6ae77..f093c39d429 100644 --- a/src/game/Handlers/AuctionHouseHandler.cpp +++ b/src/game/Handlers/AuctionHouseHandler.cpp @@ -50,7 +50,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); SendAuctionHello(unit); @@ -318,7 +318,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); if (!itemGuid) @@ -468,7 +468,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionEntry* auction = auctionHouse->GetAuction(auctionId); @@ -610,7 +610,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionEntry* auction = auctionHouse->GetAuction(auctionId); @@ -764,7 +764,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data) return; // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseClientQueryTask task(AUCTION_QUERY_LIST_BIDDER); @@ -800,7 +800,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recv_data) return; // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseClientQueryTask task(AUCTION_QUERY_LIST_OWNER); @@ -837,7 +837,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data) task.auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); //sLog.Out(LOG_BASIC, LOG_LVL_DEBUG, "Auctionhouse search %s list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index e6b6eee0e6f..d87358439a4 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -731,7 +731,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) sLog.Player(this, LOG_CHAR, "Login", LOG_LVL_DETAIL, alreadyOnline ? "Player was already online" : ""); - if (!alreadyOnline && !pCurrChar->IsStandingUp() && !pCurrChar->HasUnitState(UNIT_STAT_STUNNED)) + if (!alreadyOnline && !pCurrChar->IsStandingUp() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); m_playerLoading = false; diff --git a/src/game/Handlers/GuildHandler.cpp b/src/game/Handlers/GuildHandler.cpp index 1354adfa01a..1d65ff4404d 100644 --- a/src/game/Handlers/GuildHandler.cpp +++ b/src/game/Handlers/GuildHandler.cpp @@ -720,7 +720,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()); diff --git a/src/game/Handlers/ItemHandler.cpp b/src/game/Handlers/ItemHandler.cpp index 59224e51406..c3bdb192178 100644 --- a/src/game/Handlers/ItemHandler.cpp +++ b/src/game/Handlers/ItemHandler.cpp @@ -494,7 +494,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); Item *pItem = _player->GetItemByGuid(itemGuid); @@ -665,7 +665,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); Item *pItem = _player->GetItemFromBuyBackSlot(slot); @@ -765,7 +765,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid, uint8 menu_type) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving diff --git a/src/game/Handlers/LootHandler.cpp b/src/game/Handlers/LootHandler.cpp index bd1b98ebb35..b71c588b1f8 100644 --- a/src/game/Handlers/LootHandler.cpp +++ b/src/game/Handlers/LootHandler.cpp @@ -359,7 +359,7 @@ void WorldSession::HandleLootOpcode(WorldPacket& recv_data) return; } - if (_player->HasUnitState(UNIT_STAT_STUNNED)) + if (_player->HasUnitState(UNIT_STATE_STUNNED)) { _player->SendLootError(guid, LOOT_ERROR_STUNNED); return; diff --git a/src/game/Handlers/MovementHandler.cpp b/src/game/Handlers/MovementHandler.cpp index 04244aecebb..33a40b8a826 100644 --- a/src/game/Handlers/MovementHandler.cpp +++ b/src/game/Handlers/MovementHandler.cpp @@ -352,15 +352,15 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) // this is here to accommodate 1.14 client behavior // it does not interrupt falling when rooted // verify that root is applied after having landed - if (pMover->HasUnitState(UNIT_STAT_ROOT_ON_LANDING)) + if (pMover->HasUnitState(UNIT_STATE_ROOT_ON_LANDING)) { if (movementInfo.HasMovementFlag(MOVEFLAG_ROOT) || !pMover->ShouldBeRooted()) - pMover->ClearUnitState(UNIT_STAT_ROOT_ON_LANDING); + pMover->ClearUnitState(UNIT_STATE_ROOT_ON_LANDING); else if (!movementInfo.HasMovementFlag(MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR)) { sLog.Out(LOG_BASIC, LOG_LVL_MINIMAL, "WorldSession::HandleMovementOpcodes: Player %s from account id %u has pending root on landing, but sent movement packet with opcode %u not containing root or falling flags!", _player->GetName(), _player->GetSession()->GetAccountId(), opcode); - pMover->ClearUnitState(UNIT_STAT_ROOT_ON_LANDING); + pMover->ClearUnitState(UNIT_STATE_ROOT_ON_LANDING); pMover->SetRootedReal(true); KickPlayer(); return; @@ -746,14 +746,14 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData) { sLog.Out(LOG_BASIC, LOG_LVL_MINIMAL, "WorldSession::HandleMoveRootAck: Player %s from account id %u sent root apply ack, but continues falling. Using 1.14 client?", _player->GetName(), _player->GetSession()->GetAccountId()); - pMover->AddUnitState(UNIT_STAT_ROOT_ON_LANDING); + pMover->AddUnitState(UNIT_STATE_ROOT_ON_LANDING); return; } } // we need to always clear this on root packet for 1.14 - pMover->ClearUnitState(UNIT_STAT_ROOT_ON_LANDING); + pMover->ClearUnitState(UNIT_STATE_ROOT_ON_LANDING); #endif pMover->SetRootedReal(applyReceived); @@ -912,7 +912,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData) { if (Pet* pet = _player->GetPet()) { - pet->ClearUnitState(UNIT_STAT_POSSESSED); + pet->ClearUnitState(UNIT_STATE_POSSESSED); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); // out of range pet dismissed if (!pet->IsWithinDistInMap(_player, pet->GetMap()->GetGridActivationDistance())) diff --git a/src/game/Handlers/NPCHandler.cpp b/src/game/Handlers/NPCHandler.cpp index 6289dac58e6..835be2d3f32 100644 --- a/src/game/Handlers/NPCHandler.cpp +++ b/src/game/Handlers/NPCHandler.cpp @@ -80,7 +80,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recv_data) return; // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); SendShowBank(guid); diff --git a/src/game/Handlers/PetHandler.cpp b/src/game/Handlers/PetHandler.cpp index b904bc68178..a9102097e2d 100644 --- a/src/game/Handlers/PetHandler.cpp +++ b/src/game/Handlers/PetHandler.cpp @@ -157,7 +157,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) pUnitTarget = nullptr; // make sure pet is facing target - if (pUnitTarget && pUnitTarget != pCharmedUnit && !pCharmedUnit->HasUnitState(UNIT_STAT_CAN_NOT_REACT) && + if (pUnitTarget && pUnitTarget != pCharmedUnit && !pCharmedUnit->HasUnitState(UNIT_STATE_CAN_NOT_REACT) && spellInfo->IsNeedFaceTarget() && !pCharmedUnit->IsFacingTarget(pUnitTarget)) { float orientation = pCharmedUnit->GetAngle(pUnitTarget); @@ -165,7 +165,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) pCharmedUnit->SetOrientation(orientation); } - pCharmedUnit->ClearUnitState(UNIT_STAT_MOVING); + pCharmedUnit->ClearUnitState(UNIT_STATE_MOVING); SpellCastResult result = pCharmedUnit->CastSpell(pUnitTarget, spellInfo, false); if (result == SPELL_CAST_OK) @@ -553,7 +553,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) recvPacket >> targets.ReadForCaster(pet); - pet->ClearUnitState(UNIT_STAT_MOVING); + pet->ClearUnitState(UNIT_STATE_MOVING); Spell* spell = new Spell(pet, spellInfo, false); spell->m_targets = targets; diff --git a/src/game/Handlers/PetitionsHandler.cpp b/src/game/Handlers/PetitionsHandler.cpp index 4c18c25c5d4..a27d3cd2eab 100644 --- a/src/game/Handlers/PetitionsHandler.cpp +++ b/src/game/Handlers/PetitionsHandler.cpp @@ -82,7 +82,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // if tabard designer, then trying to buy a guild charter. @@ -552,7 +552,7 @@ void WorldSession::SendPetitionShowList(ObjectGuid& guid) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); uint8 count = 1; diff --git a/src/game/Handlers/QuestHandler.cpp b/src/game/Handlers/QuestHandler.cpp index 0c883618e83..cd3034d6f5f 100644 --- a/src/game/Handlers/QuestHandler.cpp +++ b/src/game/Handlers/QuestHandler.cpp @@ -92,7 +92,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving diff --git a/src/game/Handlers/SkillHandler.cpp b/src/game/Handlers/SkillHandler.cpp index fa010e63c7e..226477c353e 100644 --- a/src/game/Handlers/SkillHandler.cpp +++ b/src/game/Handlers/SkillHandler.cpp @@ -50,7 +50,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); if (!(_player->ResetTalents())) diff --git a/src/game/Handlers/TaxiHandler.cpp b/src/game/Handlers/TaxiHandler.cpp index 946f71d8249..cd1fb2477d4 100644 --- a/src/game/Handlers/TaxiHandler.cpp +++ b/src/game/Handlers/TaxiHandler.cpp @@ -73,7 +73,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // unknown taxi node case @@ -103,7 +103,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode) { // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (GetPlayer()->HasUnitState(UNIT_STATE_FEIGN_DEATH)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); while (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) diff --git a/src/game/Handlers/TradeHandler.cpp b/src/game/Handlers/TradeHandler.cpp index 1306d98a32f..a1195e0d308 100644 --- a/src/game/Handlers/TradeHandler.cpp +++ b/src/game/Handlers/TradeHandler.cpp @@ -596,7 +596,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (GetPlayer()->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) { SendTradeStatus(TRADE_STATUS_YOU_STUNNED); return; @@ -640,7 +640,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (pOther->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (pOther->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) { SendTradeStatus(TRADE_STATUS_TARGET_STUNNED); return; diff --git a/src/game/Maps/GridNotifiers.h b/src/game/Maps/GridNotifiers.h index 323bcb4c4f6..362a6957612 100644 --- a/src/game/Maps/GridNotifiers.h +++ b/src/game/Maps/GridNotifiers.h @@ -780,7 +780,7 @@ namespace MaNGOS bool operator()(Unit* u) { return u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && !u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && - i_obj->IsWithinDistInMap(u, i_range) && (u->IsCharmed() || u->IsFrozen() || u->HasUnitState(UNIT_STAT_CAN_NOT_REACT)); + i_obj->IsWithinDistInMap(u, i_range) && (u->IsCharmed() || u->IsFrozen() || u->HasUnitState(UNIT_STATE_CAN_NOT_REACT)); } private: SpellCaster const* i_obj; diff --git a/src/game/Maps/GridNotifiersImpl.h b/src/game/Maps/GridNotifiersImpl.h index 9cd51a14d46..c65821e92ca 100644 --- a/src/game/Maps/GridNotifiersImpl.h +++ b/src/game/Maps/GridNotifiersImpl.h @@ -59,7 +59,7 @@ inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType& m) inline void CallAIMoveLOS(Creature* c, Unit* moving) { // Creature AI reaction - if (!c->HasUnitState(UNIT_STAT_LOST_CONTROL | UNIT_STAT_NO_SEARCH_FOR_OTHERS) && !c->IsInEvadeMode() && c->AI()) + if (!c->HasUnitState(UNIT_STATE_LOST_CONTROL | UNIT_STATE_NO_SEARCH_FOR_OTHERS) && !c->IsInEvadeMode() && c->AI()) { bool alert = false; if (moving->IsVisibleForOrDetect(c, c, true, false, &alert)) diff --git a/src/game/Maps/PathFinder.cpp b/src/game/Maps/PathFinder.cpp index dddc37a9546..e2e88a4a29f 100644 --- a/src/game/Maps/PathFinder.cpp +++ b/src/game/Maps/PathFinder.cpp @@ -96,7 +96,7 @@ bool PathInfo::calculate(Vector3 const& start, Vector3 dest, bool forceDest, boo // make sure navMesh works - we can run on map w/o mmap // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) - if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STAT_IGNORE_PATHFINDING) || + if (!m_navMesh || !m_navMeshQuery || m_sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) || !HaveTiles(start) || !HaveTiles(dest)) { BuildShortcut(); diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index a0df8de009f..386e4da457d 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -200,7 +200,7 @@ bool Map::ScriptCommand_MoveTo(ScriptInfo const& script, WorldObject* source, Wo } // Only move if we can move. - if (pSource->HasUnitState(UNIT_STAT_NOT_MOVE) && !(script.moveTo.flags & SF_MOVETO_FORCED)) + if (pSource->HasUnitState(UNIT_STATE_NOT_MOVE) && !(script.moveTo.flags & SF_MOVETO_FORCED)) return ShouldAbortScript(script); float speed = script.moveTo.travelTime != 0 ? pSource->GetDistance(x, y, z) / ((float)script.moveTo.travelTime * 0.001f) : 0.0f; diff --git a/src/game/Movement/ConfusedMovementGenerator.cpp b/src/game/Movement/ConfusedMovementGenerator.cpp index 271f14e8405..9f57bde6b79 100644 --- a/src/game/Movement/ConfusedMovementGenerator.cpp +++ b/src/game/Movement/ConfusedMovementGenerator.cpp @@ -33,7 +33,7 @@ void ConfusedMovementGenerator::Initialize(T &unit) if (!unit.movespline->Finalized()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_CONFUSED); + unit.AddUnitState(UNIT_STATE_CONFUSED); unit.UpdateControl(); } @@ -46,7 +46,7 @@ template void ConfusedMovementGenerator::Reset(T &unit) { unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_CONFUSED); + unit.AddUnitState(UNIT_STATE_CONFUSED); unit.UpdateControl(); } @@ -54,7 +54,7 @@ template bool ConfusedMovementGenerator::Update(T &unit, uint32 const& diff) { // ignore in case other no reaction state - if (unit.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_CONFUSED)) + if (unit.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_CONFUSED)) return true; if (Player* pPlayer = unit.ToPlayer()) @@ -90,7 +90,7 @@ bool ConfusedMovementGenerator::Update(T &unit, uint32 const& diff) template<> void ConfusedMovementGenerator::Finalize(Player &unit) { - unit.ClearUnitState(UNIT_STAT_CONFUSED); + unit.ClearUnitState(UNIT_STATE_CONFUSED); unit.StopMoving(); unit.UpdateControl(); } @@ -98,7 +98,7 @@ void ConfusedMovementGenerator::Finalize(Player &unit) template<> void ConfusedMovementGenerator::Finalize(Creature &unit) { - unit.ClearUnitState(UNIT_STAT_CONFUSED); + unit.ClearUnitState(UNIT_STATE_CONFUSED); unit.UpdateControl(); } diff --git a/src/game/Movement/CyclicMovementGenerator.cpp b/src/game/Movement/CyclicMovementGenerator.cpp index 1479398c356..0f8b3e44e48 100644 --- a/src/game/Movement/CyclicMovementGenerator.cpp +++ b/src/game/Movement/CyclicMovementGenerator.cpp @@ -44,7 +44,7 @@ void CyclicMovementGenerator::LoadPath(uint32 guid, uint32 entry, Wayp void CyclicMovementGenerator::Initialize(Creature& creature) { - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } void CyclicMovementGenerator::InitializeWaypointPath(Creature& creature, WaypointPathOrigin wpSource, uint32 overwriteGuid, uint32 overwriteEntry) @@ -62,12 +62,12 @@ void CyclicMovementGenerator::InitializeWaypointPath(Creature& creatur void CyclicMovementGenerator::Reset(Creature& creature) { - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } void CyclicMovementGenerator::_setTargetLocation(Creature & owner) { - if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) return; WaypointNode const& firstNode = i_path->at(0); @@ -113,12 +113,12 @@ bool CyclicMovementGenerator::Update(Creature &owner, uint32 const& /* void CyclicMovementGenerator::Finalize(Creature& creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } void CyclicMovementGenerator::Interrupt(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } diff --git a/src/game/Movement/FearMovementGenerator.cpp b/src/game/Movement/FearMovementGenerator.cpp index 9f9beea9a43..168c6b74a7e 100644 --- a/src/game/Movement/FearMovementGenerator.cpp +++ b/src/game/Movement/FearMovementGenerator.cpp @@ -18,7 +18,7 @@ void FearMovementGenerator::_setTargetLocation(T &owner) return; // ignore in case other no reaction state - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) return; if (Player* pPlayer = owner.ToPlayer()) @@ -29,7 +29,7 @@ void FearMovementGenerator::_setTargetLocation(T &owner) if (!_getPoint(owner, x, y, z)) return; - owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING_MOVE); PathFinder path(&owner); path.SetTransport(owner.GetTransport()); @@ -112,7 +112,7 @@ bool FearMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) template void FearMovementGenerator::Initialize(T &owner) { - owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); // World of Warcraft Client Patch 1.7.0 (2005-09-13) // - Fear will now cause creatures to flee immediately, even if they are @@ -140,7 +140,7 @@ void FearMovementGenerator::Initialize(T &owner) template<> void FearMovementGenerator::Finalize(Player &owner) { - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); } @@ -148,8 +148,8 @@ void FearMovementGenerator::Finalize(Player &owner) template<> void FearMovementGenerator::Finalize(Creature &owner) { - owner.SetWalk(!owner.HasUnitState(UNIT_STAT_RUNNING), false); - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.SetWalk(!owner.HasUnitState(UNIT_STATE_RUNNING), false); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.UpdateControl(); } @@ -157,7 +157,7 @@ template void FearMovementGenerator::Interrupt(T &owner) { // flee state still applied while movegen disabled - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); } template @@ -172,9 +172,9 @@ bool FearMovementGenerator::Update(T &owner, uint32 const& time_diff) if (!&owner || !owner.IsAlive()) return false; - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } @@ -222,7 +222,7 @@ void TimedFearMovementGenerator::Initialize(Unit& owner) void TimedFearMovementGenerator::Finalize(Unit &owner) { - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.UpdateControl(); if (Unit* victim = owner.GetVictim()) @@ -245,9 +245,9 @@ bool TimedFearMovementGenerator::Update(Unit & owner, uint32 const& time_diff) if (!owner.IsAlive()) return false; - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } diff --git a/src/game/Movement/FleeingMovementGenerator.cpp b/src/game/Movement/FleeingMovementGenerator.cpp index 5e4dbdcd4ba..cb0fd1484be 100644 --- a/src/game/Movement/FleeingMovementGenerator.cpp +++ b/src/game/Movement/FleeingMovementGenerator.cpp @@ -36,7 +36,7 @@ void FleeingMovementGenerator::_setTargetLocation(T &owner) return; // ignore in case other no reaction state - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) return; if (Player* pPlayer = owner.ToPlayer()) @@ -47,7 +47,7 @@ void FleeingMovementGenerator::_setTargetLocation(T &owner) if (!_getPoint(owner, x, y, z)) return; - owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING_MOVE); PathFinder path(&owner); path.SetTransport(owner.GetTransport()); @@ -126,7 +126,7 @@ bool FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float template void FleeingMovementGenerator::Initialize(T &owner) { - owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); @@ -142,7 +142,7 @@ void FleeingMovementGenerator::Initialize(T &owner) template<> void FleeingMovementGenerator::Finalize(Player &owner) { - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); } @@ -150,8 +150,8 @@ void FleeingMovementGenerator::Finalize(Player &owner) template<> void FleeingMovementGenerator::Finalize(Creature &owner) { - owner.SetWalk(!owner.HasUnitState(UNIT_STAT_RUNNING), false); - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.SetWalk(!owner.HasUnitState(UNIT_STATE_RUNNING), false); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.UpdateControl(); } @@ -159,7 +159,7 @@ template void FleeingMovementGenerator::Interrupt(T &owner) { // flee state still applied while movegen disabled - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); } template @@ -175,9 +175,9 @@ bool FleeingMovementGenerator::Update(T &owner, uint32 const& time_diff) return false; // ignore in case other no reaction state - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } @@ -212,7 +212,7 @@ void TimedFleeingMovementGenerator::Initialize(Unit& owner) void TimedFleeingMovementGenerator::Finalize(Unit &owner) { - owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE); owner.UpdateControl(); if (owner.IsAlive() && !owner.HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_POSSESSED)) @@ -231,9 +231,9 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, uint32 const& time_dif return false; // ignore in case other no reaction state - if (owner.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) + if (owner.HasUnitState((UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED) & ~UNIT_STATE_FLEEING)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } diff --git a/src/game/Movement/HomeMovementGenerator.cpp b/src/game/Movement/HomeMovementGenerator.cpp index 4e972268960..524e16b304b 100644 --- a/src/game/Movement/HomeMovementGenerator.cpp +++ b/src/game/Movement/HomeMovementGenerator.cpp @@ -33,7 +33,7 @@ void HomeMovementGenerator::Reset(Creature &) void HomeMovementGenerator::_setTargetLocation(Creature & owner) { - if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) return; // Remove speed reductions from low hp @@ -71,7 +71,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) arrived = false; - owner.ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + owner.ClearUnitState(UNIT_STATE_ALL_DYN_STATES); } bool HomeMovementGenerator::Update(Creature &owner, uint32 const& /*time_diff*/) @@ -87,7 +87,7 @@ void HomeMovementGenerator::Finalize(Creature& owner) if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME) owner.ClearTemporaryFaction(); - owner.SetWalk(!owner.HasUnitState(UNIT_STAT_RUNNING) && !owner.IsLevitating(), false); + owner.SetWalk(!owner.HasUnitState(UNIT_STATE_RUNNING) && !owner.IsLevitating(), false); owner.LoadCreatureAddon(true); owner.AI()->JustReachedHome(); } diff --git a/src/game/Movement/IdleMovementGenerator.cpp b/src/game/Movement/IdleMovementGenerator.cpp index 440f22c76ec..1588f6e75ae 100644 --- a/src/game/Movement/IdleMovementGenerator.cpp +++ b/src/game/Movement/IdleMovementGenerator.cpp @@ -37,7 +37,7 @@ DistractMovementGenerator::Initialize(Unit& owner) if (!owner.IsStandingUp()) owner.SetStandState(UNIT_STAND_STATE_STAND); - owner.AddUnitState(UNIT_STAT_DISTRACTED); + owner.AddUnitState(UNIT_STATE_DISTRACTED); } void @@ -50,7 +50,7 @@ DistractMovementGenerator::Finalize(Unit& owner) owner.SetFacingTo(angle); } - owner.ClearUnitState(UNIT_STAT_DISTRACTED); + owner.ClearUnitState(UNIT_STATE_DISTRACTED); } void @@ -77,7 +77,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, uint32 const& time_diff) void AssistanceDistractMovementGenerator::Finalize(Unit &unit) { - unit.ClearUnitState(UNIT_STAT_DISTRACTED); + unit.ClearUnitState(UNIT_STATE_DISTRACTED); if (Unit* victim = unit.GetVictim()) { if (unit.IsAlive()) diff --git a/src/game/Movement/MotionMaster.cpp b/src/game/Movement/MotionMaster.cpp index 489aa5eae99..eb290e5117e 100644 --- a/src/game/Movement/MotionMaster.cpp +++ b/src/game/Movement/MotionMaster.cpp @@ -53,7 +53,7 @@ void MotionMaster::Initialize() Clear(false, true); // set new default movement generator - if (m_owner->IsCreature() && m_owner->IsAlive() && !m_owner->HasUnitState(UNIT_STAT_POSSESSED)) + if (m_owner->IsCreature() && m_owner->IsAlive() && !m_owner->HasUnitState(UNIT_STATE_POSSESSED)) { MovementGenerator* movement = FactorySelector::selectMovementGenerator(static_cast(m_owner)); push(movement == nullptr ? &si_idleMovement : movement); @@ -112,7 +112,7 @@ void MotionMaster::InitializeNewDefault(bool alwaysReplace) if (alwaysReplace || (curr->GetMovementGeneratorType() != new_default)) { // Set new default movement generator - if (!m_owner->HasUnitState(UNIT_STAT_POSSESSED)) + if (!m_owner->HasUnitState(UNIT_STATE_POSSESSED)) { MovementGenerator* movement = FactorySelector::selectMovementGenerator(pCreature); if (movement) @@ -175,7 +175,7 @@ MotionMaster::~MotionMaster() void MotionMaster::UpdateMotion(uint32 diff) { - if (m_owner->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (m_owner->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) return; MANGOS_ASSERT(!empty()); @@ -214,7 +214,7 @@ void MotionMaster::UpdateMotion(uint32 diff) void MotionMaster::UpdateMotionAsync(uint32 diff) { m_needsAsyncUpdate = false; - if (m_owner->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (m_owner->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) return; MANGOS_ASSERT(!empty()); @@ -371,7 +371,7 @@ void MotionMaster::MoveRandom(bool use_current_position, float wander_distance, void MotionMaster::MoveTargetedHome() { - if (m_owner->HasUnitState(UNIT_STAT_LOST_CONTROL)) + if (m_owner->HasUnitState(UNIT_STATE_LOST_CONTROL)) return; Clear(false); @@ -441,7 +441,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) void MotionMaster::MoveFollow(Unit* target, float dist, float angle) { - if (m_owner->HasUnitState(UNIT_STAT_LOST_CONTROL)) + if (m_owner->HasUnitState(UNIT_STATE_LOST_CONTROL)) return; Clear(); diff --git a/src/game/Movement/PointMovementGenerator.cpp b/src/game/Movement/PointMovementGenerator.cpp index 5289547d9e9..198e576dd75 100644 --- a/src/game/Movement/PointMovementGenerator.cpp +++ b/src/game/Movement/PointMovementGenerator.cpp @@ -34,7 +34,7 @@ void PointMovementGenerator::Initialize(T& unit) if (!unit.IsStopped()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(unit, "PointMovementGenerator::Initialize"); init.MoveTo(m_x, m_y, m_z, m_options); if (m_speed > 0.0f) @@ -57,14 +57,14 @@ void PointMovementGenerator::Initialize(T& unit) template void PointMovementGenerator::Finalize(T& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); MovementInform(unit); } template void PointMovementGenerator::Interrupt(T& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } template @@ -73,7 +73,7 @@ void PointMovementGenerator::Reset(T& unit) if (!unit.IsStopped()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } template @@ -82,13 +82,13 @@ bool PointMovementGenerator::Update(T& unit, uint32 const& /*diff*/) if (!&unit) return false; - if (unit.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { - unit.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } - unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING_MOVE); if (!unit.movespline->Finalized() && m_recalculateSpeed) { @@ -152,13 +152,13 @@ bool DistancingMovementGenerator::Update(T& unit, uint32 const& /*diff*/) if (!&unit) return false; - if (unit.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { - unit.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return false; } - unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING_MOVE); if (!unit.movespline->Finalized() && m_recalculateSpeed) { @@ -186,13 +186,13 @@ template bool DistancingMovementGenerator::Update(Creature&, uint32 co void AssistanceMovementGenerator::Initialize(Creature& unit) { - if (unit.HasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_CAN_NOT_MOVE)) return; if (!unit.IsStopped()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(unit, "AssistanceMovementGenerator::Initialize"); init.MoveTo(m_x, m_y, m_z, (m_options & (MOVE_PATHFINDING | MOVE_FORCE_DESTINATION))); init.SetWalk(true); @@ -202,7 +202,7 @@ void AssistanceMovementGenerator::Initialize(Creature& unit) void AssistanceMovementGenerator::Finalize(Creature& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); unit.SetNoCallAssistance(false); unit.CallAssistance(); @@ -234,7 +234,7 @@ void ChargeMovementGenerator::Initialize(T& unit) if (path.getPathType() & PATHFIND_NOPATH) return; - unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); unit.m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN); unit.m_movementInfo.ctime = 0; @@ -249,12 +249,12 @@ void ChargeMovementGenerator::Initialize(T& unit) template void ChargeMovementGenerator::Finalize(T& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - if (unit.HasUnitState(UNIT_STAT_PENDING_ROOT)) - unit.AddUnitState(UNIT_STAT_ROOT); - if (unit.HasUnitState(UNIT_STAT_PENDING_STUNNED)) - unit.AddUnitState(UNIT_STAT_STUNNED); - if (unit.HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT)) + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + if (unit.HasUnitState(UNIT_STATE_PENDING_ROOT)) + unit.AddUnitState(UNIT_STATE_ROOT); + if (unit.HasUnitState(UNIT_STATE_PENDING_STUNNED)) + unit.AddUnitState(UNIT_STATE_STUNNED); + if (unit.HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT)) unit.SetRooted(true); if (m_triggerAttack) if (!unit.IsPlayer() || m_victimGuid == unit.ToPlayer()->GetSelectionGuid()) @@ -319,24 +319,24 @@ void ChargeMovementGenerator::ComputePath(T& attacker, Unit& victim) template void ChargeMovementGenerator::Interrupt(T& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - if (unit.HasUnitState(UNIT_STAT_PENDING_ROOT)) - unit.AddUnitState(UNIT_STAT_ROOT); - if (unit.HasUnitState(UNIT_STAT_PENDING_STUNNED)) - unit.AddUnitState(UNIT_STAT_STUNNED); - if (unit.HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT)) + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + if (unit.HasUnitState(UNIT_STATE_PENDING_ROOT)) + unit.AddUnitState(UNIT_STATE_ROOT); + if (unit.HasUnitState(UNIT_STATE_PENDING_STUNNED)) + unit.AddUnitState(UNIT_STATE_STUNNED); + if (unit.HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT)) unit.SetRooted(true); } template void ChargeMovementGenerator::Reset(T& unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - if (unit.HasUnitState(UNIT_STAT_PENDING_ROOT)) - unit.AddUnitState(UNIT_STAT_ROOT); - if (unit.HasUnitState(UNIT_STAT_PENDING_STUNNED)) - unit.AddUnitState(UNIT_STAT_STUNNED); - if (unit.HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT)) + unit.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + if (unit.HasUnitState(UNIT_STATE_PENDING_ROOT)) + unit.AddUnitState(UNIT_STATE_ROOT); + if (unit.HasUnitState(UNIT_STATE_PENDING_STUNNED)) + unit.AddUnitState(UNIT_STATE_STUNNED); + if (unit.HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT)) unit.SetRooted(true); } @@ -352,7 +352,7 @@ bool ChargeMovementGenerator::Update(T& unit, uint32 const& diff) return false; } - unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING_MOVE); if (!unit.movespline->Finalized() && m_recalculateSpeed) { diff --git a/src/game/Movement/RandomMovementGenerator.cpp b/src/game/Movement/RandomMovementGenerator.cpp index 35d7ab77a8a..5dbe7d06c2d 100644 --- a/src/game/Movement/RandomMovementGenerator.cpp +++ b/src/game/Movement/RandomMovementGenerator.cpp @@ -46,7 +46,7 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) if (!creature.GetRandomPoint(i_startPosition.x, i_startPosition.y, i_startPosition.z, i_wanderDistance, destX, destY, destZ)) return; - creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(creature, "RandomMovementGenerator"); init.MoveTo(destX, destY, destZ, MOVE_PATHFINDING | MOVE_EXCLUDE_STEEP_SLOPES); init.SetWalk(!creature.HasExtraFlag(CREATURE_FLAG_EXTRA_ALWAYS_RUN)); @@ -70,7 +70,7 @@ void RandomMovementGenerator::Initialize(Creature &creature) if (!creature.IsAlive()) return; - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); i_nextMoveTime.Reset(1000); } @@ -81,14 +81,14 @@ void RandomMovementGenerator::Reset(Creature &creature) void RandomMovementGenerator::Interrupt(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } void RandomMovementGenerator::Finalize(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } bool RandomMovementGenerator::Update(Creature &creature, uint32 const& diff) @@ -109,10 +109,10 @@ void RandomMovementGenerator::UpdateAsync(Creature &creature, uint32 diff) { // Lock async updates for safety, see Unit::asyncMovesplineLock doc std::unique_lock guard(creature.asyncMovesplineLock); - if (creature.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) + if (creature.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_DISTRACTED)) { i_nextMoveTime.Reset(0); // Expire the timer - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); } else if (creature.IsNoMovementSpellCasted()) { diff --git a/src/game/Movement/TargetedMovementGenerator.cpp b/src/game/Movement/TargetedMovementGenerator.cpp index 380660d69c4..c6b3ba43b31 100644 --- a/src/game/Movement/TargetedMovementGenerator.cpp +++ b/src/game/Movement/TargetedMovementGenerator.cpp @@ -45,7 +45,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) if (!i_target.isValid() || !i_target->IsInWorld()) return; - if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) + if (owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_POSSESSED)) return; float x, y, z; @@ -138,7 +138,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) PathFinder path(&owner); // allow pets following their master to cheat while generating paths - bool petFollowing = (isPet && owner.HasUnitState(UNIT_STAT_FOLLOW)); + bool petFollowing = (isPet && owner.HasUnitState(UNIT_STATE_FOLLOW)); Movement::MoveSplineInit init(owner, "TargetedMovementGenerator"); path.SetTransport(transport); path.calculate(x, y, z, petFollowing); @@ -163,7 +163,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) } } - if (!m_bReachable && !!(pathType & PATHFIND_INCOMPLETE) && owner.HasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH)) + if (!m_bReachable && !!(pathType & PATHFIND_INCOMPLETE) && owner.HasUnitState(UNIT_STATE_ALLOW_INCOMPLETE_PATH)) m_bReachable = true; m_bRecalculateTravel = false; @@ -178,8 +178,8 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) // Prevent redundant moves if ((path.Length() < 4.0f && (i_target->GetPositionZ() - owner.GetPositionZ()) > 10.0f) || // He is flying too high for me. Moving a few meters wont change anything. (!petFollowing && pathType & PATHFIND_NOPATH) || - (!petFollowing && pathType & PATHFIND_INCOMPLETE && !owner.HasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH)) || - (!petFollowing && !m_bReachable && !(owner.IsPlayer() && owner.HasUnitState(UNIT_STAT_FOLLOW)))) + (!petFollowing && pathType & PATHFIND_INCOMPLETE && !owner.HasUnitState(UNIT_STATE_ALLOW_INCOMPLETE_PATH)) || + (!petFollowing && !m_bReachable && !(owner.IsPlayer() && owner.HasUnitState(UNIT_STATE_FOLLOW)))) { if (!losChecked) losResult = owner.IsWithinLOSInMap(i_target.getTarget()); @@ -273,7 +273,7 @@ void TargetedMovementGeneratorMedium::UpdateAsync(T &owner, uint32 /*diff* if (!m_bRecalculateTravel) return; // All these cases will be handled at next sync update - if (!i_target.isValid() || !i_target->IsInWorld() || !owner.IsAlive() || owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED) + if (!i_target.isValid() || !i_target->IsInWorld() || !owner.IsAlive() || owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_POSSESSED) || static_cast(this)->_lostTarget(owner) || owner.IsNoMovementSpellCasted()) return; @@ -295,7 +295,7 @@ bool ChaseMovementGenerator::Update(T &owner, uint32 const& time_diff) if (owner.movespline->IsUninterruptible() && !owner.movespline->Finalized()) return true; - if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) + if (owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_POSSESSED)) { _clearUnitStateMove(owner); return true; @@ -533,7 +533,7 @@ void ChaseMovementGenerator::_reachTarget(T &owner) template<> void ChaseMovementGenerator::Initialize(Player &owner) { - owner.AddUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STATE_CHASE | UNIT_STATE_CHASE_MOVE); m_bRecalculateTravel = true; owner.GetMotionMaster()->SetNeedAsyncUpdate(); } @@ -542,7 +542,7 @@ template<> void ChaseMovementGenerator::Initialize(Creature &owner) { owner.SetWalk(false, false); - owner.AddUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STATE_CHASE | UNIT_STATE_CHASE_MOVE); m_bRecalculateTravel = true; owner.GetMotionMaster()->SetNeedAsyncUpdate(); } @@ -550,14 +550,14 @@ void ChaseMovementGenerator::Initialize(Creature &owner) template void ChaseMovementGenerator::Finalize(T &owner) { - owner.ClearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.ClearUnitState(UNIT_STATE_CHASE | UNIT_STATE_CHASE_MOVE); //MovementInform(owner); } template void ChaseMovementGenerator::Interrupt(T &owner) { - owner.ClearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.ClearUnitState(UNIT_STATE_CHASE | UNIT_STATE_CHASE_MOVE); } template @@ -610,7 +610,7 @@ bool FollowMovementGenerator::Update(T &owner, uint32 const& time_diff) if (!owner.IsAlive()) return true; - if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) + if (owner.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_POSSESSED)) { _clearUnitStateMove(owner); return true; @@ -729,7 +729,7 @@ void FollowMovementGenerator::_updateSpeed(Creature &u) template<> void FollowMovementGenerator::Initialize(Player &owner) { - owner.AddUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -737,7 +737,7 @@ void FollowMovementGenerator::Initialize(Player &owner) template<> void FollowMovementGenerator::Initialize(Creature &owner) { - owner.AddUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -745,7 +745,7 @@ void FollowMovementGenerator::Initialize(Creature &owner) template void FollowMovementGenerator::Finalize(T &owner) { - owner.ClearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.ClearUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); //MovementInform(owner); } @@ -753,7 +753,7 @@ void FollowMovementGenerator::Finalize(T &owner) template void FollowMovementGenerator::Interrupt(T &owner) { - owner.ClearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.ClearUnitState(UNIT_STATE_FOLLOW | UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); } diff --git a/src/game/Movement/TargetedMovementGenerator.h b/src/game/Movement/TargetedMovementGenerator.h index baf9e7ac3ba..9b816a9979e 100644 --- a/src/game/Movement/TargetedMovementGenerator.h +++ b/src/game/Movement/TargetedMovementGenerator.h @@ -97,8 +97,8 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMediumGetTarget(); } void _reachTarget(T &); @@ -146,8 +146,8 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium::LoadPath(uint32 guid, uint32 entry, Wa void WaypointMovementGenerator::Initialize(Creature &creature) { - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } void WaypointMovementGenerator::InitializeWaypointPath(Creature& creature, uint32 startPoint, WaypointPathOrigin wpSource, uint32 initialDelay, uint32 overwriteGuid, uint32 overwriteEntry, bool repeat) @@ -95,19 +95,19 @@ void WaypointMovementGenerator::InitializeWaypointPath(Creature& creat void WaypointMovementGenerator::Finalize(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } void WaypointMovementGenerator::Interrupt(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } void WaypointMovementGenerator::Reset(Creature &creature) { - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); if (m_isWandering) { @@ -142,7 +142,7 @@ bool WaypointMovementGenerator::OnArrived(Creature& creature) if (m_isArrivalDone) return true; - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); @@ -214,7 +214,7 @@ void WaypointMovementGenerator::StartMove(Creature &creature) } m_isArrivalDone = false; - creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); WaypointNode const& nextNode = currPoint->second; Movement::MoveSplineInit init(creature, "WaypointMovementGenerator::StartMove"); @@ -237,7 +237,7 @@ void WaypointMovementGenerator::StartMove(Creature &creature) if (nextNode.orientation != 100 && nextNode.delay != 0) init.SetFacing(nextNode.orientation); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING) && !creature.IsLevitating(), false); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING) && !creature.IsLevitating(), false); init.Launch(); } @@ -246,13 +246,13 @@ bool WaypointMovementGenerator::Update(Creature &creature, uint32 cons // Waypoint movement can be switched on/off // This is quite handy for escort quests and other stuff bool shouldWait = false; - if (creature.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED) || !i_path || i_path->empty()) + if (creature.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_DISTRACTED) || !i_path || i_path->empty()) shouldWait = true; // prevent a crash at empty waypoint path. if (shouldWait) { - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } @@ -267,7 +267,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, uint32 cons m_isArrivalDone = false; } - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } @@ -356,7 +356,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) player.SetFallInformation(0); // remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack) - player.ClearUnitState(UNIT_STAT_TAXI_FLIGHT); + player.ClearUnitState(UNIT_STATE_TAXI_FLIGHT); player.RemoveUnitMovementFlag(MOVEFLAG_FLYING); player.Unmount(); @@ -383,7 +383,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) void FlightPathMovementGenerator::Interrupt(Player & player) { - player.ClearUnitState(UNIT_STAT_TAXI_FLIGHT); + player.ClearUnitState(UNIT_STATE_TAXI_FLIGHT); player.RemoveUnitMovementFlag(MOVEFLAG_FLYING); } @@ -392,7 +392,7 @@ void FlightPathMovementGenerator::Interrupt(Player & player) void FlightPathMovementGenerator::Reset(Player & player, float modSpeed) { player.GetHostileRefManager().setOnlineOfflineState(false); - player.AddUnitState(UNIT_STAT_TAXI_FLIGHT); + player.AddUnitState(UNIT_STATE_TAXI_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); Movement::MoveSplineInit init(player, "FlightPathMovementGenerator::Reset"); @@ -493,7 +493,7 @@ void PatrolMovementGenerator::Initialize(Creature &creature) if (!creature.IsAlive()) return; - creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); StartMove(creature); } @@ -504,21 +504,21 @@ void PatrolMovementGenerator::Reset(Creature &creature) void PatrolMovementGenerator::Interrupt(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } void PatrolMovementGenerator::Finalize(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); - creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); + creature.ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STATE_RUNNING), false); } bool PatrolMovementGenerator::Update(Creature &creature, uint32 const& diff) { - if (creature.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) + if (creature.HasUnitState(UNIT_STATE_CAN_NOT_MOVE | UNIT_STATE_DISTRACTED)) { - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } @@ -529,7 +529,7 @@ bool PatrolMovementGenerator::Update(Creature &creature, uint32 const& diff) if (!creature.IsStopped()) creature.StopMoving(); - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } @@ -597,7 +597,7 @@ void PatrolMovementGenerator::StartMove(Creature& creature) z = last.z; creature.UpdateGroundPositionZ(x, y, z); creature.GetMap()->GetWalkHitPosition(creature.GetTransport(), last.x, last.y, last.z, x, y, z); - creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); PathInfo p(&creature); p.calculate(x, y, z, true); diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 6be7bccd8dc..0d6322c4c8f 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -768,7 +768,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) SetDeathState(JUST_DIED); SetHealth(0); m_motionMaster.Clear(); - ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + ClearUnitState(UNIT_STATE_ALL_DYN_STATES); LoadCreatureAddon(true); } else @@ -903,7 +903,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) } // Prevent mobs from evading while under crowd control. - if (HasUnitState(UNIT_STAT_NO_FREE_MOVE)) + if (HasUnitState(UNIT_STATE_NO_FREE_MOVE)) UpdateLeashExtensionTime(); // Leash prevents mobs from chasing any further than specified range @@ -1097,7 +1097,7 @@ bool Creature::DoFlee() */ if (!GetVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || - HasUnitState(UNIT_STAT_FEIGN_DEATH | UNIT_STAT_POSSESSED | UNIT_STAT_DISTRACTED | UNIT_STAT_CONFUSED)) + HasUnitState(UNIT_STATE_FEIGN_DEATH | UNIT_STATE_POSSESSED | UNIT_STATE_DISTRACTED | UNIT_STATE_CONFUSED)) return false; float hpPercent = GetHealthPercent(); @@ -1117,7 +1117,7 @@ bool Creature::DoFlee() bool Creature::DoFleeToGetAssistance() { if (!GetVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || - HasUnitState(UNIT_STAT_FEIGN_DEATH | UNIT_STAT_POSSESSED | UNIT_STAT_DISTRACTED | UNIT_STAT_CONFUSED)) + HasUnitState(UNIT_STATE_FEIGN_DEATH | UNIT_STATE_POSSESSED | UNIT_STATE_DISTRACTED | UNIT_STATE_CONFUSED)) return false; float radius = sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); @@ -1203,7 +1203,7 @@ float Creature::GetBaseRunSpeedRate() const void Creature::MoveAwayFromTarget(Unit const* pTarget, float distance) { - if (HasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) + if (HasUnitState(UNIT_STATE_NOT_MOVE | UNIT_STATE_CONFUSED | UNIT_STATE_LOST_CONTROL)) return; if (GetMotionMaster()->MoveDistance(pTarget, distance)) @@ -2214,7 +2214,7 @@ void Creature::SetDeathState(DeathState s) if (s == JUST_ALIVED) { - ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + ClearUnitState(UNIT_STATE_ALL_DYN_STATES); CreatureInfo const* cinfo = GetCreatureInfo(); @@ -2500,7 +2500,7 @@ bool Creature::CanBeTargetedByCallForHelp(Unit const* pFriend, Unit const* pEnem if (IsInCombat()) return false; - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING | UNIT_FLAG_NOT_SELECTABLE)) @@ -2582,7 +2582,7 @@ bool Creature::CanInitiateAttack() const if (!IsAlive()) return false; - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_FEIGN_DEATH)) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_FEIGN_DEATH)) return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING | UNIT_FLAG_NOT_SELECTABLE)) @@ -3577,7 +3577,7 @@ void Creature::OnEnterCombat(Unit* pWho, bool notInCombat) if (!pWho) return; - if (m_AI && !HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) + if (m_AI && !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING)) m_AI->AttackedBy(pWho); if (m_creatureGroup) @@ -3940,14 +3940,14 @@ SpellCastResult Creature::TryToCast(Unit* pTarget, SpellEntry const* pSpellInfo, return SPELL_FAILED_TOO_CLOSE; // This spell should only be cast when we cannot get into melee range. - if ((uiCastFlags & CF_TARGET_UNREACHABLE) && (CanReachWithMeleeAutoAttack(pTarget) || (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) || !(HasUnitState(UNIT_STAT_ROOT) || !GetMotionMaster()->GetCurrent()->IsReachable()))) + if ((uiCastFlags & CF_TARGET_UNREACHABLE) && (CanReachWithMeleeAutoAttack(pTarget) || (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) || !(HasUnitState(UNIT_STATE_ROOT) || !GetMotionMaster()->GetCurrent()->IsReachable()))) return SPELL_FAILED_MOVING; // Custom checks if (!(uiCastFlags & CF_FORCE_CAST)) { // Motion Master is not updated when this state is active. - if (!HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (!HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { // Can't cast while fleeing. switch (GetMotionMaster()->GetCurrentMovementGeneratorType()) diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index 7f7bb359e34..8e0bd2336ea 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -480,15 +480,15 @@ class Creature : public Unit void SetSummonPoint(CreatureCreatePos const& pos) { m_summonPos = pos.m_pos; } void GetSummonPoint(float &fX, float &fY, float &fZ, float &fOrient) const { fX = m_summonPos.x; fY = m_summonPos.y; fZ = m_summonPos.z; fOrient = m_summonPos.o; } - void SetNoXP() { AddUnitState(UNIT_STAT_NO_KILL_REWARD); } + void SetNoXP() { AddUnitState(UNIT_STATE_NO_KILL_REWARD); } void EnableMoveInLosEvent() { - if (HasUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS)) - ClearUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS); - if (HasUnitState(UNIT_STAT_NO_BROADCAST_TO_OTHERS)) - ClearUnitState(UNIT_STAT_NO_BROADCAST_TO_OTHERS); - if (!HasUnitState(UNIT_STAT_AI_USES_MOVE_IN_LOS)) - AddUnitState(UNIT_STAT_AI_USES_MOVE_IN_LOS); + if (HasUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS)) + ClearUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS); + if (HasUnitState(UNIT_STATE_NO_BROADCAST_TO_OTHERS)) + ClearUnitState(UNIT_STATE_NO_BROADCAST_TO_OTHERS); + if (!HasUnitState(UNIT_STATE_AI_USES_MOVE_IN_LOS)) + AddUnitState(UNIT_STATE_AI_USES_MOVE_IN_LOS); } void SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags = TEMPFACTION_ALL); diff --git a/src/game/Objects/GameObject.cpp b/src/game/Objects/GameObject.cpp index 6bc9700f362..4518a6cbdf4 100644 --- a/src/game/Objects/GameObject.cpp +++ b/src/game/Objects/GameObject.cpp @@ -1477,7 +1477,7 @@ void GameObject::Use(Unit* user) Cell::VisitAllObjects(this, searcher, 10.0f); for (Unit* attacker : targets) { - if (!attacker->IsInCombat() && !attacker->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && + if (!attacker->IsInCombat() && !attacker->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL) && attacker->IsValidAttackTarget(user) && attacker->IsWithinLOSInMap(user) && attacker->AI()) attacker->AI()->AttackStart(user); } diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 2b481a1ff05..f8d2dd38ff0 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -281,7 +281,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData& data, Player* target) c if (target == this) // building packet for yourself updateFlags |= UPDATEFLAG_SELF; - if (IsUnit() && static_cast(this)->HasUnitState(UNIT_STAT_MELEE_ATTACKING) && static_cast(this)->GetVictim()) + if (IsUnit() && static_cast(this)->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && static_cast(this)->GetVictim()) updateFlags |= UPDATEFLAG_MELEE_ATTACKING; if (m_isNewObject) @@ -310,7 +310,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData& data, Player* target) c buf << uint32(0); // TimerId // VictimGuid - if (IsUnit() && static_cast(this)->HasUnitState(UNIT_STAT_MELEE_ATTACKING) && static_cast(this)->GetVictim()) + if (IsUnit() && static_cast(this)->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && static_cast(this)->GetVictim()) buf << uint64(static_cast(this)->GetVictim()->GetGUID()); else buf << uint64(0); @@ -2556,7 +2556,7 @@ class NearUsedPosDo float x, y, z; - if (!c->IsAlive() || c->HasUnitState(UNIT_STAT_NOT_MOVE) || + if (!c->IsAlive() || c->HasUnitState(UNIT_STATE_NOT_MOVE) || !c->GetMotionMaster()->GetDestination(x, y, z)) { x = c->GetPositionX(); diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 252673e3112..cd058c06f91 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -1588,7 +1588,7 @@ void Player::Update(uint32 update_diff, uint32 p_time) } } - if (HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (HasUnitState(UNIT_STATE_MELEE_ATTACKING)) UpdateMeleeAttackingState(); if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) @@ -1767,7 +1767,7 @@ void Player::OnDisconnected() SetSplineDonePending(false); if (IsInWorld() && FindMap()) { - if (!HasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) + if (!HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED | UNIT_STATE_TAXI_FLIGHT)) { // Delay because accessing map from WorldSession update can cause crashes. Player* pPlayer = this; @@ -1782,15 +1782,15 @@ void Player::OnDisconnected() }, 1); } - if (HasUnitState(UNIT_STAT_ROOT_ON_LANDING)) + if (HasUnitState(UNIT_STATE_ROOT_ON_LANDING)) { SetRootedReal(ShouldBeRooted()); - ClearUnitState(UNIT_STAT_ROOT_ON_LANDING); + ClearUnitState(UNIT_STATE_ROOT_ON_LANDING); } // Update position after bot takes over // And remove movement flags, so he doesn't run into the void - if (!GetMover()->HasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) + if (!GetMover()->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED | UNIT_STATE_TAXI_FLIGHT)) { GetMover()->RemoveUnitMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN); GetMover()->SendHeartBeat(GetMover() != this); @@ -2021,7 +2021,7 @@ void Player::AutoReSummonPet() pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->SetDeathState(ALIVE); - pet->ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + pet->ClearUnitState(UNIT_STATE_ALL_DYN_STATES); pet->SetHealth(pet->GetMaxHealth()); } @@ -2936,7 +2936,7 @@ bool Player::CanInteractWithNPC(Creature const* pCreature, uint32 npcflagmask) c return false; // not in interactive state - if (HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; // appropriate npc type @@ -3008,7 +3008,7 @@ bool Player::CanInteractWithGameObject(GameObject const* pGo, uint32 gameobject_ return false; // not in interactive state - if (HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; if (!IsAlive()) @@ -10165,7 +10165,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, ItemPrototype con { // May be here should be more stronger checks; STUNNED checked // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked. - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return EQUIP_ERR_YOU_ARE_STUNNED; // do not allow equipping gear except weapons, offhands, projectiles, relics in @@ -17965,7 +17965,7 @@ Creature* Player::SummonPossessedMinion(uint32 creatureId, uint32 spellId, float pCreature->SetPossessorGuid(GetObjectGuid()); pCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId); // set the spell id used to create this pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); // set flag for client that mean this unit is controlled by a player - pCreature->AddUnitState(UNIT_STAT_POSSESSED); // also set internal unit state flag + pCreature->AddUnitState(UNIT_STATE_POSSESSED); // also set internal unit state flag pCreature->SetLevel(GetLevel()); // set level to same level than summoner TODO:: not sure its always the case... pCreature->SetWalk(IsWalking(), true); // sync the walking state with the summoner SetCharmGuid(pCreature->GetObjectGuid()); // save guid of charmed creature @@ -18004,7 +18004,7 @@ void Player::UnsummonPossessedMinion() SetClientControl(pMinion, false); pMinion->SetCharmerGuid(ObjectGuid()); pMinion->SetPossessorGuid(ObjectGuid()); - pMinion->ClearUnitState(UNIT_STAT_POSSESSED); + pMinion->ClearUnitState(UNIT_STATE_POSSESSED); pMinion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pMinion->DoKillUnit(); } @@ -20287,7 +20287,7 @@ bool Player::IsHonorOrXPTarget(Unit const* pVictim) const if (((Creature const*)pVictim)->IsTotem() || ((Creature const*)pVictim)->IsPet() || ((Creature const*)pVictim)->GetCreatureInfo()->xp_multiplier==0 || - pVictim->HasUnitState(UNIT_STAT_NO_KILL_REWARD)) + pVictim->HasUnitState(UNIT_STATE_NO_KILL_REWARD)) return false; } return true; @@ -20790,7 +20790,7 @@ bool Player::CanUseBattleGroundObject() const //!HasStealthAura() && // not stealthed //!HasInvisibilityAura() && // not invisible IsAlive() && // live player - !HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) // Nostalrius : en cecite ou fear par exemple + !HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL) // Nostalrius : en cecite ou fear par exemple ); } diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index f093d7034f4..9e1485d58ac 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -258,7 +258,7 @@ void Unit::Update(uint32 update_diff, uint32 p_time) { // Pet in combat ? Pet* myPet = GetPet(); - if (HasUnitState(UNIT_STAT_FEIGN_DEATH) || !myPet || myPet->GetHostileRefManager().isEmpty()) + if (HasUnitState(UNIT_STATE_FEIGN_DEATH) || !myPet || myPet->GetHostileRefManager().isEmpty()) { if (m_hostileRefManager.isEmpty()) { @@ -358,7 +358,7 @@ bool Unit::UsesPvPCombatTimer() const AutoAttackCheckResult Unit::CanAutoAttackTarget(Unit const* pVictim) const { - if (HasUnitState(UNIT_STAT_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) + if (HasUnitState(UNIT_STATE_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) return ATTACK_RESULT_CANT_ATTACK; if (!pVictim->IsAlive() || !IsAlive()) @@ -2668,7 +2668,7 @@ float Unit::MeleeMissChanceCalc(Unit const* pVictim, WeaponAttackType attType) c float Unit::GetUnitDodgeChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return 0.0f; if (IsPlayer()) return GetFloatValue(PLAYER_DODGE_PERCENTAGE); @@ -2687,7 +2687,7 @@ float Unit::GetUnitDodgeChance() const float Unit::GetUnitParryChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return 0.0f; float chance = 0.0f; @@ -2713,7 +2713,7 @@ float Unit::GetUnitParryChance() const float Unit::GetUnitBlockChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return 0.0f; if (Player const* pPlayer = ToPlayer()) @@ -3015,7 +3015,7 @@ bool Unit::IsBehindTarget(Unit const* pTarget, bool strict) const // Mobs always face their currect victim, unless incapacitated. if (!pCreature->m_castingTargetGuid && (pCreature->GetVictim() == this) && !pTarget->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_POSSESSED) && - !pTarget->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + !pTarget->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; } } @@ -4704,9 +4704,9 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (m_attacking == victim) { // switch to melee attack from ranged/magic - if (meleeAttack && !HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (meleeAttack && !HasUnitState(UNIT_STATE_MELEE_ATTACKING)) { - AddUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STATE_MELEE_ATTACKING); SendMeleeAttackStart(victim); return true; } @@ -4721,7 +4721,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) SetTargetGuid(victim->GetObjectGuid()); if (meleeAttack) - AddUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STATE_MELEE_ATTACKING); m_attacking = victim; m_attacking->_addAttacker(this); @@ -4794,7 +4794,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/) // Clear our target SetTargetGuid(ObjectGuid()); - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); InterruptSpell(CURRENT_MELEE_SPELL); @@ -5096,7 +5096,7 @@ void Unit::SetFactionTemplateId(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); - if (!HasUnitState(UNIT_STAT_AI_USES_MOVE_IN_LOS)) + if (!HasUnitState(UNIT_STATE_AI_USES_MOVE_IN_LOS)) { if (FactionTemplateEntry const* pFaction = sObjectMgr.GetFactionTemplateEntry(faction)) { @@ -5104,9 +5104,9 @@ void Unit::SetFactionTemplateId(uint32 faction) pFaction->HasFactionFlag(FACTION_TEMPLATE_BROADCAST_TO_ENEMIES_LOW_PRIO | FACTION_TEMPLATE_BROADCAST_TO_ENEMIES_MED_PRIO | FACTION_TEMPLATE_BROADCAST_TO_ENEMIES_HIG_PRIO)) - ClearUnitState(UNIT_STAT_NO_BROADCAST_TO_OTHERS); + ClearUnitState(UNIT_STATE_NO_BROADCAST_TO_OTHERS); else - AddUnitState(UNIT_STAT_NO_BROADCAST_TO_OTHERS); + AddUnitState(UNIT_STATE_NO_BROADCAST_TO_OTHERS); if (pFaction->hostileMask || pFaction->HasFactionFlag(FACTION_TEMPLATE_SEARCH_FOR_ENEMIES_LOW_PRIO | @@ -5115,9 +5115,9 @@ void Unit::SetFactionTemplateId(uint32 faction) FACTION_TEMPLATE_SEARCH_FOR_FRIENDS_LOW_PRIO | FACTION_TEMPLATE_SEARCH_FOR_FRIENDS_MED_PRIO | FACTION_TEMPLATE_SEARCH_FOR_FRIENDS_HIG_PRIO)) - ClearUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS); + ClearUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS); else - AddUnitState(UNIT_STAT_NO_SEARCH_FOR_OTHERS); + AddUnitState(UNIT_STATE_NO_SEARCH_FOR_OTHERS); } } } @@ -6322,7 +6322,7 @@ bool Unit::IsTargetableBy(WorldObject const* pCaster, bool forAoE, bool checkAli if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) return false; - if (!forAoE && HasUnitState(UNIT_STAT_FEIGN_DEATH)) + if (!forAoE && HasUnitState(UNIT_STATE_FEIGN_DEATH)) return false; } @@ -6747,7 +6747,7 @@ bool Unit::CanDetectStealthOf(Unit const* target, float distance, bool* alert) c */ - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) return false; if (distance < 1.5f) // collision @@ -7096,7 +7096,7 @@ PlayerMovementPendingChange::PlayerMovementPendingChange() void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) { // not in combat pet have same speed as owner - if (IsCreature() && ((Creature*)this)->IsPet() && HasUnitState(UNIT_STAT_FOLLOW) && !IsInCombat()) + if (IsCreature() && ((Creature*)this)->IsPet() && HasUnitState(UNIT_STATE_FOLLOW) && !IsInCombat()) { if (Unit* owner = GetOwner()) { @@ -7324,7 +7324,7 @@ void Unit::SetSpeedRateReal(UnitMoveType mtype, float rate) void Unit::SetRooted(bool apply) { // do nothing if the unit is already in the required state - if (apply == (HasUnitMovementFlag(MOVEFLAG_ROOT) || HasUnitState(UNIT_STAT_ROOT_ON_LANDING)) && + if (apply == (HasUnitMovementFlag(MOVEFLAG_ROOT) || HasUnitState(UNIT_STATE_ROOT_ON_LANDING)) && !HasPendingMovementChange(ROOT)) return; @@ -7700,7 +7700,7 @@ bool Unit::SelectHostileTarget() if (target) { // Nostalrius : Correction bug sheep/fear - if (!HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_FEIGN_DEATH | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) && (!HasAuraType(SPELL_AURA_MOD_FEAR) || HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !HasAuraType(SPELL_AURA_MOD_CONFUSE)) + if (!HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_FEIGN_DEATH | UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING) && (!HasAuraType(SPELL_AURA_MOD_FEAR) || HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !HasAuraType(SPELL_AURA_MOD_CONFUSE)) { SetInFront(target); ((Creature*)this)->AI()->AttackStart(target); @@ -8833,7 +8833,7 @@ void Unit::HandlePetCommand(CommandStates command, Unit* pTarget) return; } - ClearUnitState(UNIT_STAT_FOLLOW); + ClearUnitState(UNIT_STATE_FOLLOW); // This is true if pet has no target or has target but targets differs. if (GetVictim() != pTarget || (GetVictim() == pTarget && !GetCharmInfo()->IsCommandAttack()) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) { @@ -9203,7 +9203,7 @@ void Unit::StopMoving(bool force) if (!IsMovedByPlayer() || !IsInWorld() || force) { - ClearUnitState(UNIT_STAT_MOVING); + ClearUnitState(UNIT_STATE_MOVING); RemoveUnitMovementFlag(MOVEFLAG_MASK_MOVING); } @@ -9368,7 +9368,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) { InterruptSpellsCastedOnMe(); - AddUnitState(UNIT_STAT_FEIGN_DEATH); + AddUnitState(UNIT_STATE_FEIGN_DEATH); CombatStop(); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_STEALTH_INVIS_CANCELS); @@ -9393,7 +9393,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) { RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - ClearUnitState(UNIT_STAT_FEIGN_DEATH); + ClearUnitState(UNIT_STATE_FEIGN_DEATH); RestoreMovement(); } @@ -10049,7 +10049,7 @@ void Unit::SetPvP(bool state) void Unit::KnockBackFrom(WorldObject const* target, float horizontalSpeed, float verticalSpeed) { - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT)) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT)) return; float angle = this == target ? GetOrientation() + M_PI_F : target->GetAngle(this); @@ -10063,7 +10063,7 @@ void Unit::KnockBackFrom(WorldObject const* target, float horizontalSpeed, float void Unit::KnockBack(float angle, float horizontalSpeed, float verticalSpeed) { - if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT) || !movespline->Finalized()) + if (HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT) || !movespline->Finalized()) return; InterruptNonMeleeSpells(false); @@ -10241,7 +10241,7 @@ class RelocationNotifyEvent : public BasicEvent void Unit::ScheduleAINotify(uint32 delay) { - if (HasUnitState(UNIT_STAT_NO_BROADCAST_TO_OTHERS)) + if (HasUnitState(UNIT_STATE_NO_BROADCAST_TO_OTHERS)) return; if (!delay) @@ -10807,9 +10807,9 @@ void Unit::SetWalk(bool enable, bool asDefault) if (asDefault) { if (enable) - ClearUnitState(UNIT_STAT_RUNNING); + ClearUnitState(UNIT_STATE_RUNNING); else - AddUnitState(UNIT_STAT_RUNNING); + AddUnitState(UNIT_STATE_RUNNING); } if (enable == m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE)) @@ -11025,7 +11025,7 @@ void Unit::UpdateControl() if (Unit* charmer = GetCharmer()) if (Player* charmerPlayer = charmer->ToPlayer()) if (charmerPlayer->GetCharmGuid() == GetObjectGuid()) - charmerPlayer->SetClientControl(this, !HasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED)); + charmerPlayer->SetClientControl(this, !HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED)); // Inform myself if (mePlayer) { @@ -11033,10 +11033,10 @@ void Unit::UpdateControl() if (Unit* possessed = GetCharm()) if (possessed->GetCharmerGuid() == GetObjectGuid()) { - mePlayer->SetClientControl(possessed, !possessed->HasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED)); + mePlayer->SetClientControl(possessed, !possessed->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED)); return; } - mePlayer->SetClientControl(mePlayer, !HasUnitState(UNIT_STAT_POSSESSED | UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED) && !GetCharmerGuid()); + mePlayer->SetClientControl(mePlayer, !HasUnitState(UNIT_STATE_POSSESSED | UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED) && !GetCharmerGuid()); } } @@ -11083,7 +11083,7 @@ void Unit::RestoreMovement() if (!IsCreature()) return; // Need restore previous movement since we have no proper states system - if (IsAlive() && !HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) + if (IsAlive() && !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING)) { Unit* victim = GetCharmInfo() && GetCharmInfo()->IsAtStay() ? nullptr : GetVictim(); if (victim) diff --git a/src/game/Objects/Unit.h b/src/game/Objects/Unit.h index 115182ec308..6e13e4827ef 100644 --- a/src/game/Objects/Unit.h +++ b/src/game/Objects/Unit.h @@ -538,7 +538,7 @@ class Unit : public SpellCaster ReactStates GetReactState() const; bool HasReactState(ReactStates state) const; void UpdateControl(); - bool CanFreeMove() const { return !HasUnitState(UNIT_STAT_NO_FREE_MOVE) && !GetOwnerGuid(); } + bool CanFreeMove() const { return !HasUnitState(UNIT_STATE_NO_FREE_MOVE) && !GetOwnerGuid(); } uint32 GetCreatureType() const; uint32 GetCreatureTypeMask() const { @@ -614,7 +614,7 @@ class Unit : public SpellCaster UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER); } bool IsSpiritService() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE); } - bool IsTaxiFlying() const { return HasUnitState(UNIT_STAT_TAXI_FLIGHT); } + bool IsTaxiFlying() const { return HasUnitState(UNIT_STATE_TAXI_FLIGHT); } bool IsCaster() const; CreatureAI* AI() const; @@ -849,7 +849,7 @@ class Unit : public SpellCaster bool IsImmuneToMechanic(Mechanics mechanic) const; bool IsFrozen() const { return HasAuraState(AURA_STATE_FROZEN); } bool IsFeigningDeath() const { return ((HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD) || IsFeigningDeathSuccessfully()) && IsAlive()); } - bool IsFeigningDeathSuccessfully() const { return HasUnitState(UNIT_STAT_FEIGN_DEATH); } + bool IsFeigningDeathSuccessfully() const { return HasUnitState(UNIT_STATE_FEIGN_DEATH); } bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = nullptr) const; bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const; @@ -1342,7 +1342,7 @@ class Unit : public SpellCaster void SetRooted(bool apply); void SetRootedReal(bool apply); bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_ROOT); } - bool ShouldBeRooted() const { return GetDeathState() == CORPSE || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); } + bool ShouldBeRooted() const { return GetDeathState() == CORPSE || HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT); } void SetWaterWalking(bool apply); void SetWaterWalkingReal(bool apply); @@ -1437,7 +1437,7 @@ class Unit : public SpellCaster void MonsterMove(float x, float y, float z); void MonsterMoveWithSpeed(float x, float y, float z, float o, float speed, uint32 options); - bool IsStopped() const { return !(HasUnitState(UNIT_STAT_MOVING)); } + bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); } void StopMoving(bool force = false); void DisableSpline(); diff --git a/src/game/Objects/UnitDefines.h b/src/game/Objects/UnitDefines.h index 71f5b05b9ef..0aab7ad1858 100644 --- a/src/game/Objects/UnitDefines.h +++ b/src/game/Objects/UnitDefines.h @@ -388,140 +388,140 @@ enum DeathState enum UnitState { // persistent state (applied by aura/etc until expire) - UNIT_STAT_MELEE_ATTACKING = 0x00000001, // unit is melee attacking someone Unit::Attack - UNIT_STAT_NO_KILL_REWARD = 0x00000002, // Unit should yield no reward (Honor/XP/Rep) on kill - UNIT_STAT_FEIGN_DEATH = 0x00000004, // Unit::SetFeignDeath - a successful feign death is currently active - UNIT_STAT_STUNNED = 0x00000008, // Aura::HandleAuraModStun - UNIT_STAT_ROOT = 0x00000010, // Aura::HandleAuraModRoot - UNIT_STAT_ISOLATED = 0x00000020, // area auras do not affect other players, Aura::HandleAuraModSchoolImmunity - UNIT_STAT_POSSESSED = 0x00000040, // Aura::HandleAuraModPossess + UNIT_STATE_MELEE_ATTACKING = 0x00000001, // unit is melee attacking someone Unit::Attack + UNIT_STATE_NO_KILL_REWARD = 0x00000002, // Unit should yield no reward (Honor/XP/Rep) on kill + UNIT_STATE_FEIGN_DEATH = 0x00000004, // Unit::SetFeignDeath - a successful feign death is currently active + UNIT_STATE_STUNNED = 0x00000008, // Aura::HandleAuraModStun + UNIT_STATE_ROOT = 0x00000010, // Aura::HandleAuraModRoot + UNIT_STATE_ISOLATED = 0x00000020, // area auras do not affect other players, Aura::HandleAuraModSchoolImmunity + UNIT_STATE_POSSESSED = 0x00000040, // Aura::HandleAuraModPossess // persistent movement generator state (all time while movement generator applied to unit (independent from top state of movegen) - UNIT_STAT_TAXI_FLIGHT = 0x00000080, // player is in flight mode (in fact interrupted at far teleport until next map telport landing) - UNIT_STAT_DISTRACTED = 0x00000100, // DistractedMovementGenerator active + UNIT_STATE_TAXI_FLIGHT = 0x00000080, // player is in flight mode (in fact interrupted at far teleport until next map telport landing) + UNIT_STATE_DISTRACTED = 0x00000100, // DistractedMovementGenerator active // persistent movement generator state with non-persistent mirror states for stop support // (can be removed temporary by stop command or another movement generator apply) // not use _MOVE versions for generic movegen state, it can be removed temporary for unit stop and etc - UNIT_STAT_CONFUSED = 0x00000200, // ConfusedMovementGenerator active/onstack + UNIT_STATE_CONFUSED = 0x00000200, // ConfusedMovementGenerator active/onstack //UNIT_STAT_CONFUSED_MOVE = 0x00000400, // No longer in use (Nostalrius) - UNIT_STAT_ROAMING = 0x00000800, // RandomMovementGenerator/PointMovementGenerator/WaypointMovementGenerator active (now always set) - UNIT_STAT_ROAMING_MOVE = 0x00001000, - UNIT_STAT_CHASE = 0x00002000, // ChaseMovementGenerator active - UNIT_STAT_CHASE_MOVE = 0x00004000, - UNIT_STAT_FOLLOW = 0x00008000, // FollowMovementGenerator active - UNIT_STAT_FOLLOW_MOVE = 0x00010000, - UNIT_STAT_FLEEING = 0x00020000, // FleeMovementGenerator/TimedFleeingMovementGenerator active/onstack - UNIT_STAT_FLEEING_MOVE = 0x00040000, + UNIT_STATE_ROAMING = 0x00000800, // RandomMovementGenerator/PointMovementGenerator/WaypointMovementGenerator active (now always set) + UNIT_STATE_ROAMING_MOVE = 0x00001000, + UNIT_STATE_CHASE = 0x00002000, // ChaseMovementGenerator active + UNIT_STATE_CHASE_MOVE = 0x00004000, + UNIT_STATE_FOLLOW = 0x00008000, // FollowMovementGenerator active + UNIT_STATE_FOLLOW_MOVE = 0x00010000, + UNIT_STATE_FLEEING = 0x00020000, // FleeMovementGenerator/TimedFleeingMovementGenerator active/onstack + UNIT_STATE_FLEEING_MOVE = 0x00040000, // MMAPS - UNIT_STAT_IGNORE_PATHFINDING = 0x00080000, // do not use pathfinding in any MovementGenerator + UNIT_STATE_IGNORE_PATHFINDING = 0x00080000, // do not use pathfinding in any MovementGenerator - UNIT_STAT_PENDING_ROOT = 0x00100000, // apply root on finishing charge - UNIT_STAT_PENDING_STUNNED = 0x00200000, // apply stun on finishing charge - UNIT_STAT_ROOT_ON_LANDING = 0x00400000, // used to verify modern client behavior on root while falling + UNIT_STATE_PENDING_ROOT = 0x00100000, // apply root on finishing charge + UNIT_STATE_PENDING_STUNNED = 0x00200000, // apply stun on finishing charge + UNIT_STATE_ROOT_ON_LANDING = 0x00400000, // used to verify modern client behavior on root while falling // High-level states - UNIT_STAT_RUNNING = 0x01000000, + UNIT_STATE_RUNNING = 0x01000000, - UNIT_STAT_ALLOW_INCOMPLETE_PATH = 0x02000000, // allow movement with incomplete or partial paths - UNIT_STAT_PENDING_CHANNEL_RESET = 0x04000000, // pending end of spell channeling animation + UNIT_STATE_ALLOW_INCOMPLETE_PATH = 0x02000000, // allow movement with incomplete or partial paths + UNIT_STATE_PENDING_CHANNEL_RESET = 0x04000000, // pending end of spell channeling animation - UNIT_STAT_NO_SEARCH_FOR_OTHERS = 0x08000000, // MoveInLineOfSight will not be called - UNIT_STAT_NO_BROADCAST_TO_OTHERS = 0x10000000, // ScheduleAINotify will not be called - UNIT_STAT_AI_USES_MOVE_IN_LOS = 0x20000000, // AI overrides MoveInLineOfSight so always search for others + UNIT_STATE_NO_SEARCH_FOR_OTHERS = 0x08000000, // MoveInLineOfSight will not be called + UNIT_STATE_NO_BROADCAST_TO_OTHERS = 0x10000000, // ScheduleAINotify will not be called + UNIT_STATE_AI_USES_MOVE_IN_LOS = 0x20000000, // AI overrides MoveInLineOfSight so always search for others // masks (only for check) // can't move currently - UNIT_STAT_CAN_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FEIGN_DEATH, + UNIT_STATE_CAN_NOT_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_FEIGN_DEATH, // stay by different reasons - UNIT_STAT_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FEIGN_DEATH | - UNIT_STAT_DISTRACTED, + UNIT_STATE_NOT_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_FEIGN_DEATH | + UNIT_STATE_DISTRACTED, // stay or scripted movement for effect( = in player case you can't move by client command) - UNIT_STAT_NO_FREE_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | - UNIT_STAT_TAXI_FLIGHT | - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, + UNIT_STATE_NO_FREE_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | + UNIT_STATE_TAXI_FLIGHT | + UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING, // not react at move in sight or other - UNIT_STAT_CAN_NOT_REACT = UNIT_STAT_STUNNED | UNIT_STAT_FEIGN_DEATH | - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, + UNIT_STATE_CAN_NOT_REACT = UNIT_STATE_STUNNED | UNIT_STATE_FEIGN_DEATH | + UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING, // AI disabled by some reason - UNIT_STAT_LOST_CONTROL = UNIT_STAT_FLEEING | UNIT_STAT_POSSESSED, + UNIT_STATE_LOST_CONTROL = UNIT_STATE_FLEEING | UNIT_STATE_POSSESSED, // above 2 state cases - UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL = UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_LOST_CONTROL, + UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL = UNIT_STATE_CAN_NOT_REACT | UNIT_STATE_LOST_CONTROL, // masks (for check or reset) // for real move using movegen check and stop (except unstoppable flight) - UNIT_STAT_MOVING = UNIT_STAT_ROAMING_MOVE | UNIT_STAT_CHASE_MOVE | UNIT_STAT_FOLLOW_MOVE | UNIT_STAT_FLEEING_MOVE, + UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE | UNIT_STATE_FLEEING_MOVE, - UNIT_STAT_ALL_STATE = 0xFFFFFFFF, - UNIT_STAT_ALL_DYN_STATES = UNIT_STAT_ALL_STATE & ~(UNIT_STAT_RUNNING | UNIT_STAT_IGNORE_PATHFINDING | UNIT_STAT_PENDING_CHANNEL_RESET | UNIT_STAT_NO_SEARCH_FOR_OTHERS | UNIT_STAT_NO_BROADCAST_TO_OTHERS | UNIT_STAT_AI_USES_MOVE_IN_LOS), + UNIT_STATE_ALL_STATE = 0xFFFFFFFF, + UNIT_STATE_ALL_DYN_STATES = UNIT_STATE_ALL_STATE & ~(UNIT_STATE_RUNNING | UNIT_STATE_IGNORE_PATHFINDING | UNIT_STATE_PENDING_CHANNEL_RESET | UNIT_STATE_NO_SEARCH_FOR_OTHERS | UNIT_STATE_NO_BROADCAST_TO_OTHERS | UNIT_STATE_AI_USES_MOVE_IN_LOS), }; static char const* UnitStateToString(uint32 state) { switch (state) { - case UNIT_STAT_MELEE_ATTACKING: + case UNIT_STATE_MELEE_ATTACKING: return "Melee Attacking"; - case UNIT_STAT_NO_KILL_REWARD: + case UNIT_STATE_NO_KILL_REWARD: return "No Kill Reward"; - case UNIT_STAT_FEIGN_DEATH: + case UNIT_STATE_FEIGN_DEATH: return "Feign Death"; - case UNIT_STAT_STUNNED: + case UNIT_STATE_STUNNED: return "Stunned"; - case UNIT_STAT_ROOT: + case UNIT_STATE_ROOT: return "Root"; - case UNIT_STAT_ISOLATED: + case UNIT_STATE_ISOLATED: return "Isolated"; - case UNIT_STAT_POSSESSED: + case UNIT_STATE_POSSESSED: return "Possessed"; - case UNIT_STAT_TAXI_FLIGHT: + case UNIT_STATE_TAXI_FLIGHT: return "Taxi Flight"; - case UNIT_STAT_DISTRACTED: + case UNIT_STATE_DISTRACTED: return "Distracted"; - case UNIT_STAT_CONFUSED: + case UNIT_STATE_CONFUSED: return "Confused"; - case UNIT_STAT_ROAMING: + case UNIT_STATE_ROAMING: return "Roaming"; - case UNIT_STAT_ROAMING_MOVE: + case UNIT_STATE_ROAMING_MOVE: return "Roaming Move"; - case UNIT_STAT_CHASE: + case UNIT_STATE_CHASE: return "Chase"; - case UNIT_STAT_CHASE_MOVE: + case UNIT_STATE_CHASE_MOVE: return "Chase Move"; - case UNIT_STAT_FOLLOW: + case UNIT_STATE_FOLLOW: return "Follow"; - case UNIT_STAT_FOLLOW_MOVE: + case UNIT_STATE_FOLLOW_MOVE: return "Follow Move"; - case UNIT_STAT_FLEEING: + case UNIT_STATE_FLEEING: return "Fleeing"; - case UNIT_STAT_FLEEING_MOVE: + case UNIT_STATE_FLEEING_MOVE: return "Fleeing Move"; - case UNIT_STAT_IGNORE_PATHFINDING: + case UNIT_STATE_IGNORE_PATHFINDING: return "Ignore Pathfinding"; - case UNIT_STAT_PENDING_ROOT: + case UNIT_STATE_PENDING_ROOT: return "Pending Root"; - case UNIT_STAT_PENDING_STUNNED: + case UNIT_STATE_PENDING_STUNNED: return "Pending Stunned"; - case UNIT_STAT_ROOT_ON_LANDING: + case UNIT_STATE_ROOT_ON_LANDING: return "Root on Landing"; - case UNIT_STAT_RUNNING: + case UNIT_STATE_RUNNING: return "Running"; - case UNIT_STAT_ALLOW_INCOMPLETE_PATH: + case UNIT_STATE_ALLOW_INCOMPLETE_PATH: return "Allow Incomplete Path"; - case UNIT_STAT_PENDING_CHANNEL_RESET: + case UNIT_STATE_PENDING_CHANNEL_RESET: return "Pending Channel Reset"; - case UNIT_STAT_NO_SEARCH_FOR_OTHERS: + case UNIT_STATE_NO_SEARCH_FOR_OTHERS: return "No Search for Others"; - case UNIT_STAT_NO_BROADCAST_TO_OTHERS: + case UNIT_STATE_NO_BROADCAST_TO_OTHERS: return "No Broadcast to Others"; - case UNIT_STAT_AI_USES_MOVE_IN_LOS: + case UNIT_STATE_AI_USES_MOVE_IN_LOS: return "AI Uses Move in LoS"; } return "UNKNOWN"; diff --git a/src/game/PlayerBots/BattleBotAI.cpp b/src/game/PlayerBots/BattleBotAI.cpp index 31415a1463c..4fc9a18838c 100644 --- a/src/game/PlayerBots/BattleBotAI.cpp +++ b/src/game/PlayerBots/BattleBotAI.cpp @@ -446,7 +446,7 @@ void BattleBotAI::DoGraveyardJump() timeOffset += point->timeDiff; me->m_Events.AddLambdaEventAtOffset([pBot, pAI, point, isLast] { - if (!pBot->HasUnitState(UNIT_STAT_NO_FREE_MOVE)) + if (!pBot->HasUnitState(UNIT_STATE_NO_FREE_MOVE)) { pBot->SetUnitMovementFlags(point->moveFlags); pBot->Relocate(point->position.x, point->position.y, point->position.z, point->position.o); @@ -516,7 +516,7 @@ void BattleBotAI::UpdateWaypointMovement() if (!me->IsStopped()) return; - if (me->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (me->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) return; switch (me->GetMotionMaster()->GetCurrentMovementGeneratorType()) @@ -812,7 +812,7 @@ void BattleBotAI::UpdateAI(uint32 const diff) } } - if (me->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (me->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL)) return; if (me->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)) @@ -938,7 +938,7 @@ void BattleBotAI::UpdateAI(uint32 const diff) me->SendMovementPacket(MSG_MOVE_SET_FACING, false); } - if (!me->HasUnitState(UNIT_STAT_MELEE_ATTACKING) && + if (!me->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && (m_role != ROLE_HEALER) && IsValidHostileTarget(pVictim) && AttackStart(pVictim)) @@ -1410,7 +1410,7 @@ void BattleBotAI::UpdateInCombatAI_Paladin() } if (m_spells.paladin.pBlessingOfFreedom && - (me->HasUnitState(UNIT_STAT_ROOT) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && + (me->HasUnitState(UNIT_STATE_ROOT) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && CanTryToCastSpell(me, m_spells.paladin.pBlessingOfFreedom)) { if (DoCastSpell(me, m_spells.paladin.pBlessingOfFreedom) == SPELL_CAST_OK) @@ -1687,7 +1687,7 @@ void BattleBotAI::UpdateInCombatAI_Hunter() if (pVictim->CanReachWithMeleeAutoAttack(me)) { - if (me->HasUnitState(UNIT_STAT_ROOT)) + if (me->HasUnitState(UNIT_STATE_ROOT)) { if (m_spells.hunter.pMongooseBite && CanTryToCastSpell(pVictim, m_spells.hunter.pMongooseBite)) @@ -1713,7 +1713,7 @@ void BattleBotAI::UpdateInCombatAI_Hunter() } } - if (!me->HasUnitState(UNIT_STAT_ROOT) && + if (!me->HasUnitState(UNIT_STATE_ROOT) && (me->GetCombatDistance(pVictim) < 8.0f) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != DISTANCING_MOTION_TYPE) { @@ -1825,7 +1825,7 @@ void BattleBotAI::UpdateInCombatAI_Mage() } if (m_spells.mage.pBlink && - (me->HasUnitState(UNIT_STAT_CAN_NOT_MOVE) || + (me->HasUnitState(UNIT_STATE_CAN_NOT_MOVE) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && CanTryToCastSpell(me, m_spells.mage.pBlink)) { @@ -1836,11 +1836,11 @@ void BattleBotAI::UpdateInCombatAI_Mage() return; } - if (!me->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (!me->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { if (m_spells.mage.pFrostNova && - !pVictim->HasUnitState(UNIT_STAT_ROOT) && - !pVictim->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && + !pVictim->HasUnitState(UNIT_STATE_ROOT) && + !pVictim->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL) && CanTryToCastSpell(me, m_spells.mage.pFrostNova)) { DoCastSpell(me, m_spells.mage.pFrostNova); @@ -2538,7 +2538,7 @@ void BattleBotAI::UpdateInCombatAI_Warrior() } if (pVictim->IsMoving() && - !pVictim->HasUnitState(UNIT_STAT_ROOT) && + !pVictim->HasUnitState(UNIT_STATE_ROOT) && !pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) { if (m_spells.warrior.pHamstring && @@ -2585,7 +2585,7 @@ void BattleBotAI::UpdateInCombatAI_Warrior() if ((me->GetHealthPercent() > 60.0f) && (pVictim->GetHealthPercent() > 40.0f) && (pVictim->GetClass() == CLASS_WARLOCK || pVictim->GetClass() == CLASS_PRIEST) && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && !me->IsImmuneToMechanic(MECHANIC_FEAR)) { if (m_spells.warrior.pRecklessness && @@ -2899,7 +2899,7 @@ void BattleBotAI::UpdateInCombatAI_Rogue() } if (m_spells.rogue.pSprint && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && !me->CanReachWithMeleeAutoAttack(pVictim) && CanTryToCastSpell(me, m_spells.rogue.pSprint)) { @@ -3145,7 +3145,7 @@ void BattleBotAI::UpdateInCombatAI_Druid() } else { - if (me->HasUnitState(UNIT_STAT_ROOT) && + if (me->HasUnitState(UNIT_STATE_ROOT) && me->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) me->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); } @@ -3331,7 +3331,7 @@ void BattleBotAI::UpdateInCombatAI_Druid() } else if (pVictim->CanReachWithMeleeAutoAttack(me) && (pVictim->GetVictim() == me) && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != DISTANCING_MOTION_TYPE)) { if (m_spells.druid.pEntanglingRoots && diff --git a/src/game/PlayerBots/CombatBotBaseAI.cpp b/src/game/PlayerBots/CombatBotBaseAI.cpp index d4cdb15a17a..f9f11772bc4 100644 --- a/src/game/PlayerBots/CombatBotBaseAI.cpp +++ b/src/game/PlayerBots/CombatBotBaseAI.cpp @@ -1859,7 +1859,7 @@ bool CombatBotBaseAI::AreOthersOnSameTarget(ObjectGuid guid, bool checkMelee, bo if (pMember->GetTargetGuid() == guid) { - if (checkMelee && pMember->HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (checkMelee && pMember->HasUnitState(UNIT_STATE_MELEE_ATTACKING)) return true; if (checkSpells && pMember->IsNonMeleeSpellCasted()) diff --git a/src/game/PlayerBots/PartyBotAI.cpp b/src/game/PlayerBots/PartyBotAI.cpp index b2306302ed1..7ad920ce6fb 100644 --- a/src/game/PlayerBots/PartyBotAI.cpp +++ b/src/game/PlayerBots/PartyBotAI.cpp @@ -501,14 +501,14 @@ bool PartyBotAI::CrowdControlMarkedTargets() { if (Unit* pTarget = GetMarkedTarget(mark)) { - if (!pTarget->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && + if (!pTarget->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL) && IsValidHostileTarget(pTarget) && !AreOthersOnSameTarget(pTarget->GetObjectGuid())) { if (CanTryToCastSpell(pTarget, pSpellEntry)) { if (DoCastSpell(pTarget, pSpellEntry) == SPELL_CAST_OK) { - me->ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + me->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); return true; } } @@ -693,12 +693,12 @@ void PartyBotAI::UpdateAI(uint32 const diff) return; } - if (me->HasUnitState(UNIT_STAT_FEIGN_DEATH) && me->HasAuraType(SPELL_AURA_FEIGN_DEATH) && + if (me->HasUnitState(UNIT_STATE_FEIGN_DEATH) && me->HasAuraType(SPELL_AURA_FEIGN_DEATH) && !me->IsInCombat() && (!me->GetPet() || !me->GetPet()->IsInCombat()) && !me->SelectRandomUnfriendlyTarget(nullptr, 20.0f, false, true)) me->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - if (me->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (me->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL)) return; if (me->IsDead()) @@ -858,7 +858,7 @@ void PartyBotAI::UpdateAI(uint32 const diff) } else { - if (!me->HasUnitState(UNIT_STAT_MELEE_ATTACKING) && + if (!me->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && (GetRole() == ROLE_MELEE_DPS || m_role == ROLE_TANK) && IsValidHostileTarget(pVictim) && AttackStart(pVictim)) @@ -1221,7 +1221,7 @@ void PartyBotAI::UpdateInCombatAI_Paladin() } if (m_spells.paladin.pBlessingOfFreedom && - (me->HasUnitState(UNIT_STAT_ROOT) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && + (me->HasUnitState(UNIT_STATE_ROOT) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && CanTryToCastSpell(me, m_spells.paladin.pBlessingOfFreedom)) { if (DoCastSpell(me, m_spells.paladin.pBlessingOfFreedom) == SPELL_CAST_OK) @@ -1545,7 +1545,7 @@ void PartyBotAI::UpdateInCombatAI_Hunter() } } - if (!me->HasUnitState(UNIT_STAT_ROOT) && + if (!me->HasUnitState(UNIT_STATE_ROOT) && (me->GetCombatDistance(pVictim) < 8.0f) && (GetRole() != ROLE_MELEE_DPS) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != DISTANCING_MOTION_TYPE) @@ -1669,7 +1669,7 @@ void PartyBotAI::UpdateInCombatAI_Mage() (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != DISTANCING_MOTION_TYPE)) { if (m_spells.mage.pBlink && - (me->HasUnitState(UNIT_STAT_CAN_NOT_MOVE) || + (me->HasUnitState(UNIT_STATE_CAN_NOT_MOVE) || me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) && CanTryToCastSpell(me, m_spells.mage.pBlink)) { @@ -1680,11 +1680,11 @@ void PartyBotAI::UpdateInCombatAI_Mage() return; } - if (!me->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (!me->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { if (m_spells.mage.pFrostNova && - !pVictim->HasUnitState(UNIT_STAT_ROOT) && - !pVictim->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) && + !pVictim->HasUnitState(UNIT_STATE_ROOT) && + !pVictim->HasUnitState(UNIT_STATE_CAN_NOT_REACT_OR_LOST_CONTROL) && CanTryToCastSpell(me, m_spells.mage.pFrostNova)) { DoCastSpell(me, m_spells.mage.pFrostNova); @@ -2480,7 +2480,7 @@ void PartyBotAI::UpdateInCombatAI_Warrior() if (m_spells.warrior.pHamstring && pVictim->IsMoving() && - !pVictim->HasUnitState(UNIT_STAT_ROOT) && + !pVictim->HasUnitState(UNIT_STATE_ROOT) && !pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) && CanTryToCastSpell(pVictim, m_spells.warrior.pHamstring)) { @@ -2522,7 +2522,7 @@ void PartyBotAI::UpdateInCombatAI_Warrior() if (m_role != ROLE_TANK && (me->GetHealthPercent() > 60.0f) && (pVictim->GetHealthPercent() > 40.0f) && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && !me->IsImmuneToMechanic(MECHANIC_FEAR)) { if (m_spells.warrior.pRecklessness && @@ -2898,7 +2898,7 @@ void PartyBotAI::UpdateInCombatAI_Rogue() } if (m_spells.rogue.pSprint && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && !me->CanReachWithMeleeAutoAttack(pVictim) && CanTryToCastSpell(me, m_spells.rogue.pSprint)) { @@ -3114,7 +3114,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() return; if (form != FORM_NONE && - me->HasUnitState(UNIT_STAT_ROOT) && + me->HasUnitState(UNIT_STATE_ROOT) && me->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT) && (m_role != ROLE_TANK || !me->CanReachWithMeleeAutoAttack(pVictim))) me->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); @@ -3304,7 +3304,7 @@ void PartyBotAI::UpdateInCombatAI_Druid() } else if (pVictim->CanReachWithMeleeAutoAttack(me) && (pVictim->GetVictim() == me) && - !me->HasUnitState(UNIT_STAT_ROOT) && + !me->HasUnitState(UNIT_STATE_ROOT) && (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != DISTANCING_MOTION_TYPE)) { if (m_spells.druid.pEntanglingRoots && diff --git a/src/game/PlayerBots/PlayerBotAI.cpp b/src/game/PlayerBots/PlayerBotAI.cpp index 25bcba70a1a..5e75896975a 100644 --- a/src/game/PlayerBots/PlayerBotAI.cpp +++ b/src/game/PlayerBots/PlayerBotAI.cpp @@ -183,7 +183,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(uint32 const diff) if (me->IsSpellReady(SPELL_FROST_NOVA) && me->GetPower(POWER_MANA) > 50) if (nearTarget) me->CastSpell(me, SPELL_FROST_NOVA, false); - if (nearTarget && target->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (nearTarget && target->HasUnitState(UNIT_STATE_CAN_NOT_MOVE)) { // already runing if (!me->movespline->Finalized()) diff --git a/src/game/PlayerBots/PlayerBotMgr.cpp b/src/game/PlayerBots/PlayerBotMgr.cpp index 3cb96d2f106..7399f2287e8 100644 --- a/src/game/PlayerBots/PlayerBotMgr.cpp +++ b/src/game/PlayerBots/PlayerBotMgr.cpp @@ -1406,7 +1406,7 @@ bool ChatHandler::HandlePartyBotClearMarksCommand(char* args) bool HandlePartyBotComeToMeHelper(Player* pBot, Player* pPlayer) { - if (pBot->AI() && pBot->IsAlive() && pBot->IsInMap(pPlayer) && !pBot->HasUnitState(UNIT_STAT_NO_FREE_MOVE)) + if (pBot->AI() && pBot->IsAlive() && pBot->IsInMap(pPlayer) && !pBot->HasUnitState(UNIT_STATE_NO_FREE_MOVE)) { if (PartyBotAI* pAI = dynamic_cast(pBot->AI())) { diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index bd0ffc60cf9..9f9379c6236 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -3797,9 +3797,9 @@ SpellCastResult Spell::prepare(Aura* triggeredByAura, uint32 chance) if (channeled && m_casterUnit) { // Prevent animation from disappearing if casting another channel too soon after previous ends - if (m_casterUnit->HasUnitState(UNIT_STAT_PENDING_CHANNEL_RESET)) + if (m_casterUnit->HasUnitState(UNIT_STATE_PENDING_CHANNEL_RESET)) { - m_casterUnit->ClearUnitState(UNIT_STAT_PENDING_CHANNEL_RESET); + m_casterUnit->ClearUnitState(UNIT_STATE_PENDING_CHANNEL_RESET); m_casterUnit->CancelSpellChannelingAnimationInstantly(); } @@ -3966,7 +3966,7 @@ void Spell::cast(bool skipCheck) if (m_casterUnit) { // Ivina : Added the case when caster is charmed and not controlled. - if ((!m_caster->IsPlayer()) || ((m_casterUnit->GetCharmerGuid()) && (!m_casterUnit->HasUnitState(UNIT_STAT_POSSESSED)))) + if ((!m_caster->IsPlayer()) || ((m_casterUnit->GetCharmerGuid()) && (!m_casterUnit->HasUnitState(UNIT_STATE_POSSESSED)))) { if (m_targets.getUnitTarget() && m_targets.getUnitTarget() != m_caster) m_casterUnit->SetInFront(m_targets.getUnitTarget()); @@ -4507,9 +4507,9 @@ void Spell::update(uint32 difftime) // check for incapacitating states if (m_casterUnit && m_casterUnit->IsPlayer()) { - uint32 interruptStates = (UNIT_STAT_FEIGN_DEATH | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING); + uint32 interruptStates = (UNIT_STATE_FEIGN_DEATH | UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING); if (m_spellInfo->HasSpellInterruptFlag(SPELL_INTERRUPT_FLAG_STUN)) - interruptStates |= UNIT_STAT_STUNNED; + interruptStates |= UNIT_STATE_STUNNED; if (m_casterUnit->HasUnitState(interruptStates)) cancel(); } @@ -4537,12 +4537,12 @@ void Spell::update(uint32 difftime) if (m_caster->IsPlayer() || m_caster->IsPet()) { // check for incapacitating player states - if (m_casterUnit->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (m_casterUnit->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) { - if (m_casterUnit->HasUnitState(UNIT_STAT_FEIGN_DEATH) || - (m_casterUnit->HasUnitState(UNIT_STAT_STUNNED) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_STUN))) || - (m_casterUnit->HasUnitState(UNIT_STAT_CONFUSED) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_CONFUSE))) || - (m_casterUnit->HasUnitState(UNIT_STAT_FLEEING) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_FEAR)))) + if (m_casterUnit->HasUnitState(UNIT_STATE_FEIGN_DEATH) || + (m_casterUnit->HasUnitState(UNIT_STATE_STUNNED) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_STUN))) || + (m_casterUnit->HasUnitState(UNIT_STATE_CONFUSED) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_CONFUSE))) || + (m_casterUnit->HasUnitState(UNIT_STATE_FLEEING) && !(m_channeled && m_spellInfo->HasAura(SPELL_AURA_MOD_FEAR)))) cancel(); } } @@ -5309,7 +5309,7 @@ void Spell::SendChannelUpdate(uint32 time, bool interrupted) if (possessed) { - possessed->ClearUnitState(UNIT_STAT_POSSESSED); + possessed->ClearUnitState(UNIT_STATE_POSSESSED); possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); possessed->SetCharmerGuid(ObjectGuid()); // TODO - Requires more specials for target? @@ -6313,7 +6313,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (castResult != SPELL_CAST_OK) return castResult; - if (m_casterUnit->HasUnitState(UNIT_STAT_POSSESSED)) + if (m_casterUnit->HasUnitState(UNIT_STATE_POSSESSED)) { if (m_spellInfo->Category == 21) // Enrage return SPELL_FAILED_NOT_READY; @@ -6572,7 +6572,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_casterUnit) return SPELL_FAILED_DONT_REPORT; - if (m_casterUnit->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT) || + if (m_casterUnit->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT) || m_casterUnit->IsPlayer() && static_cast(m_casterUnit)->IsBeingTeleported()) return SPELL_FAILED_ROOTED; @@ -9018,10 +9018,10 @@ bool ChannelResetEvent::Execute(uint64 e_time, uint32) void ChannelResetEvent::Abort(uint64 e_time) { - if (!m_caster->HasUnitState(UNIT_STAT_PENDING_CHANNEL_RESET)) + if (!m_caster->HasUnitState(UNIT_STATE_PENDING_CHANNEL_RESET)) return; - m_caster->ClearUnitState(UNIT_STAT_PENDING_CHANNEL_RESET); + m_caster->ClearUnitState(UNIT_STATE_PENDING_CHANNEL_RESET); Spell* currSpell = m_caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL); if (!currSpell || currSpell->getState() == SPELL_STATE_FINISHED) diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index c52da437275..f7be24ab40e 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -804,7 +804,7 @@ class ChannelResetEvent : public BasicEvent public: ChannelResetEvent(Unit* caster) : m_caster(caster) { - caster->AddUnitState(UNIT_STAT_PENDING_CHANNEL_RESET); + caster->AddUnitState(UNIT_STATE_PENDING_CHANNEL_RESET); } ~ChannelResetEvent() override {} diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 7417d796cfa..a3d7e6353ce 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -587,7 +587,7 @@ void AreaAura::Update(uint32 diff) { Unit* caster = GetTarget(); - if (!caster->HasUnitState(UNIT_STAT_ISOLATED)) + if (!caster->HasUnitState(UNIT_STATE_ISOLATED)) { Unit* owner = caster->GetCharmerOrOwner(); if (!owner) @@ -843,7 +843,7 @@ void AreaAura::Update(uint32 diff) // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType != AREA_AURA_ENEMY); if (!caster || - caster->HasUnitState(UNIT_STAT_ISOLATED) || + caster->HasUnitState(UNIT_STATE_ISOLATED) || !caster->HasAura(originalRankSpellId, GetEffIndex()) || !caster->IsWithinDistInMap(target, m_radius) || caster->IsFriendlyTo(target) != needFriendly @@ -1116,7 +1116,7 @@ void Aura::TriggerSpell() Unit* target = GetTarget(); // not in banished state - if (triggerTarget->HasUnitState(UNIT_STAT_ISOLATED)) + if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED)) return; // specific code for cases with no trigger spell provided in field @@ -1749,7 +1749,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - caster->AddUnitState(UNIT_STAT_ROOT); + caster->AddUnitState(UNIT_STATE_ROOT); } return; } @@ -1964,7 +1964,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { if (caster->GetTypeId() != TYPEID_UNIT) return; - caster->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT); + caster->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT); caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } return; @@ -3200,7 +3200,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode removeMode, Spel FactionTemplateEntry const* origFactionTemplate = pTarget->GetFactionTemplateEntry(); - pTarget->AddUnitState(UNIT_STAT_POSSESSED); + pTarget->AddUnitState(UNIT_STATE_POSSESSED); pTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pTarget->SetCharmerGuid(pCaster->GetObjectGuid()); pTarget->SetPossessorGuid(pCaster->GetObjectGuid()); @@ -3229,7 +3229,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode removeMode, Spel if (Creature* pCreature = pTarget->ToCreature()) { - if (!pCreature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!pCreature->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) if (pCreature->AI()->SwitchAiAtControl()) pCreature->AIM_Initialize(); } @@ -3244,7 +3244,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode removeMode, Spel pTarget->ScheduleAINotify(0); pTarget->UpdateControl(); - if (pTarget->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT)) + if (pTarget->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT)) pTarget->SetRooted(true); pTarget->StopMoving(); pTarget->SetWalk(pCaster->IsWalking()); @@ -3268,7 +3268,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode removeMode, Spel if (removeMode == AURA_REMOVE_BY_DELETE) return; - pTarget->ClearUnitState(UNIT_STAT_POSSESSED); + pTarget->ClearUnitState(UNIT_STATE_POSSESSED); pTarget->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pTarget->SetCharmerGuid(ObjectGuid()); pTarget->SetPossessorGuid(ObjectGuid()); @@ -3349,7 +3349,7 @@ void Player::ModPossessPet(Pet* pPet, bool apply, AuraRemoveMode m_removeMode) if (apply) { - pPet->AddUnitState(UNIT_STAT_POSSESSED); + pPet->AddUnitState(UNIT_STATE_POSSESSED); // Target should became visible at SetView call(if not visible before), // otherwise client will ignore packets from the target(SetClientControl for example). @@ -3390,7 +3390,7 @@ void Player::ModPossessPet(Pet* pPet, bool apply, AuraRemoveMode m_removeMode) pPet->SetCharmerGuid(ObjectGuid()); pPet->SetPossessorGuid(ObjectGuid()); - if (!pPet->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!pPet->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) pPet->StopMoving(true); // To avoid moving the wrong unit on server side between cancellation and mover swap @@ -3756,7 +3756,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if (GetSpellProto()->GetSpellSchoolMask() & SPELL_SCHOOL_MASK_FROST) target->ModifyAuraState(AURA_STATE_FROZEN, apply); - target->AddUnitState(inCharge ? UNIT_STAT_PENDING_STUNNED : UNIT_STAT_STUNNED); + target->AddUnitState(inCharge ? UNIT_STATE_PENDING_STUNNED : UNIT_STATE_STUNNED); target->SetTargetGuid(ObjectGuid()); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); @@ -3808,14 +3808,14 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if (target->HasAuraType(SPELL_AURA_MOD_STUN)) return; - target->ClearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED); + target->ClearUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); if (target->GetVictim() && target->IsAlive()) target->SetTargetGuid(target->GetVictim()->GetObjectGuid()); - if (!target->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT)) // prevent allow move if have also root effect + if (!target->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT)) // prevent allow move if have also root effect target->SetRooted(false); // Wyvern Sting @@ -4040,7 +4040,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if (GetSpellProto()->GetSpellSchoolMask() & SPELL_SCHOOL_MASK_FROST) target->ModifyAuraState(AURA_STATE_FROZEN, apply); - target->AddUnitState(inCharge ? UNIT_STAT_PENDING_ROOT : UNIT_STAT_ROOT); + target->AddUnitState(inCharge ? UNIT_STATE_PENDING_ROOT : UNIT_STATE_ROOT); //Save last orientation if (target->GetVictim()) @@ -4080,9 +4080,9 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if (target->HasAuraType(SPELL_AURA_MOD_ROOT)) return; - target->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT); + target->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_PENDING_ROOT); - if (!target->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) // prevent allow move if have also stun effect + if (!target->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) // prevent allow move if have also stun effect { target->SetRooted(false); //target->SetUnitMovementFlags(MOVEFLAG_NONE); @@ -4393,9 +4393,9 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) if (Real && GetSpellProto()->Mechanic == MECHANIC_BANISH) { if (apply) - target->AddUnitState(UNIT_STAT_ISOLATED); + target->AddUnitState(UNIT_STATE_ISOLATED); else - target->ClearUnitState(UNIT_STAT_ISOLATED); + target->ClearUnitState(UNIT_STATE_ISOLATED); } } @@ -6839,7 +6839,7 @@ void Aura::PeriodicDummyTick() // Judgement of Command if (spell->SpellIconID == 561) { - if (target && target->HasUnitState(UNIT_STAT_STUNNED)) + if (target && target->HasUnitState(UNIT_STATE_STUNNED)) { if (Unit* pCaster = GetCaster()) { diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 0b15a6fc24e..7d29ed4fce3 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -227,7 +227,7 @@ void Spell::EffectResurrectNew(SpellEffectIndex effIdx) pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->SetDeathState(ALIVE); - pet->ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + pet->ClearUnitState(UNIT_STATE_ALL_DYN_STATES); pet->SetHealth(pet->GetMaxHealth() > health ? health : pet->GetMaxHealth()); pet->AIM_Initialize(); @@ -520,7 +520,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) else if (m_spellInfo->SpellIconID == 561) { // base damage halved if target not stunned. - if (!unitTarget->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (!unitTarget->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED)) damage = damage * 0.5f; damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, effect_idx, damage, SPELL_DIRECT_DAMAGE); @@ -1473,7 +1473,7 @@ void Spell::EffectDummy(SpellEffectIndex effIdx) //m_casterUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FEING_DEATH); m_casterUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING); m_casterUnit->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - m_casterUnit->AddUnitState(UNIT_STAT_FEIGN_DEATH); + m_casterUnit->AddUnitState(UNIT_STATE_FEIGN_DEATH); // Summon globs m_casterUnit->CastSpell(m_casterUnit, 25885, true); @@ -3377,11 +3377,11 @@ void Spell::EffectDistract(SpellEffectIndex effIdx) return; // target must be OK to do this - if (unitTarget->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (unitTarget->HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return; unitTarget->SetFacingTo(unitTarget->GetAngle(m_targets.m_destX, m_targets.m_destY)); - unitTarget->ClearUnitState(UNIT_STAT_MOVING); + unitTarget->ClearUnitState(UNIT_STATE_MOVING); if (unitTarget->GetTypeId() == TYPEID_UNIT) unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); @@ -6553,7 +6553,7 @@ void Spell::EffectSummonDeadPet(SpellEffectIndex /*effIdx*/) pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->SetDeathState(ALIVE); - pet->ClearUnitState(UNIT_STAT_ALL_DYN_STATES); + pet->ClearUnitState(UNIT_STATE_ALL_DYN_STATES); pet->SetHealth(uint32(pet->GetMaxHealth() * (damage / 100))); pet->AIM_Initialize(); diff --git a/src/game/Threat/ThreatManager.cpp b/src/game/Threat/ThreatManager.cpp index 98dbecefb09..8ceb26642d0 100644 --- a/src/game/Threat/ThreatManager.cpp +++ b/src/game/Threat/ThreatManager.cpp @@ -291,7 +291,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile HostileReference* currentRef = nullptr; bool found = false; bool allowLowPriorityTargets = false; - bool attackerImmobilized = pAttacker->HasUnitState(UNIT_STAT_CAN_NOT_MOVE); + bool attackerImmobilized = pAttacker->HasUnitState(UNIT_STATE_CAN_NOT_MOVE); for (int attempt = 0; attempt < 2 && !found; ++attempt) { @@ -413,8 +413,8 @@ void ThreatManager::addThreat(Unit* pVictim, float threat, bool crit, SpellSchoo // check for fear, blind, freezing trap, reckless charge, banish, etc. if (isAssistThreat) { - if (getOwner()->HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ISOLATED) || - (getOwner()->HasUnitState(UNIT_STAT_STUNNED) && getOwner()->HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, 0))) + if (getOwner()->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_ISOLATED) || + (getOwner()->HasUnitState(UNIT_STATE_STUNNED) && getOwner()->HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, 0))) { threat = 0.0f; } diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 0afa09ce99e..19406733805 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -661,7 +661,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 amount, uint // 15 seconds.In addition, retaliatory strikes will not be possible // while stunned. #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1 - if (HasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (HasUnitState(UNIT_STATE_CAN_NOT_REACT)) return SPELL_AURA_PROC_FAILED; #endif diff --git a/src/scripts/battlegrounds/battleground_alterac.cpp b/src/scripts/battlegrounds/battleground_alterac.cpp index 17b7a2aaf63..53483318149 100644 --- a/src/scripts/battlegrounds/battleground_alterac.cpp +++ b/src/scripts/battlegrounds/battleground_alterac.cpp @@ -109,7 +109,7 @@ struct npc_VanndarAI : public ScriptedAI, public npc_alterac_bossHelper m_uiAvatar_Timer = urand(12000, 20000); m_uiStormbolt_Timer = 8000; m_uiThunderclap_Timer = 5000; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_bAggro = true; m_bLeashed = false; m_bCombat1 = true; @@ -155,7 +155,7 @@ struct npc_VanndarAI : public ScriptedAI, public npc_alterac_bossHelper { m_creature->CombatStop(); m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_bLeashed = true; EnterEvadeMode(); return; @@ -351,7 +351,7 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper m_uiIsInWhirlwind_Timer = 0; m_uiKnockDown_Timer = 18000; m_uiFrenzy_Timer = 1000; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_bAggro = true; m_bLeashed = false; m_bCombat1 = true; @@ -413,7 +413,7 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper { m_creature->CombatStop(); m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_bLeashed = true; EnterEvadeMode(); return; @@ -441,13 +441,13 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper if (m_uiIsInWhirlwind_Timer == 0) { - if (m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->ClearUnitState(UNIT_STAT_ROOT); + if (m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->ClearUnitState(UNIT_STATE_ROOT); } else { - if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->AddUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->AddUnitState(UNIT_STATE_ROOT); } // SPELL_WHIRLWIND @@ -589,7 +589,7 @@ struct npc_BalindaAI : public ScriptedAI m_uiConeOfCold_Timer = 1500; m_uiArcaneExplo_Timer = 2000; m_uiPolymorph_Timer = 1750; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); if (m_bReset) DoScriptText(SAY_BALINDA_RESET, m_creature); m_bReset = true; @@ -625,7 +625,7 @@ struct npc_BalindaAI : public ScriptedAI { m_creature->CombatStop(); m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); EnterEvadeMode(); return; } @@ -653,13 +653,13 @@ struct npc_BalindaAI : public ScriptedAI if (((m_creature->GetDistance(m_creature->GetVictim()) > 25.0f) || (m_creature->GetDistance(m_creature->GetVictim()) < 5.0f)) || (!m_creature->IsWithinLOSInMap(m_creature->GetVictim()))) { - if (m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->ClearUnitState(UNIT_STAT_ROOT); + if (m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->ClearUnitState(UNIT_STATE_ROOT); } else { - if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->AddUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->AddUnitState(UNIT_STATE_ROOT); } // ARCANE EXPLOSION @@ -838,7 +838,7 @@ struct npc_GalvangarAI : public ScriptedAI m_uiMortalStrike_Timer = 7000; m_uiCleave_Timer = 4000; m_uiFrighteningShout_Timer = m_uiWhirlwind_Timer + urand(1000, 5000); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); if (m_bReset) DoScriptText(SAY_GALVANGAR_RESET, m_creature); m_bReset = true; @@ -867,7 +867,7 @@ struct npc_GalvangarAI : public ScriptedAI { m_creature->CombatStop(); m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); EnterEvadeMode(); return; } @@ -901,13 +901,13 @@ struct npc_GalvangarAI : public ScriptedAI if (m_uiIsInWhirlwind_Timer == 0) { - if (m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->ClearUnitState(UNIT_STAT_ROOT); + if (m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->ClearUnitState(UNIT_STATE_ROOT); } else { - if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) - m_creature->AddUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STATE_ROOT)) + m_creature->AddUnitState(UNIT_STATE_ROOT); } // SPELL_WHIRLWIND_GAL @@ -1040,7 +1040,7 @@ struct npc_WarMasterAI : public ScriptedAI m_uiWhirlwind_Timer = 12000; m_uiEnrage_Timer = 0; m_uiIsInWhirlwind_Timer = 0; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); } void MoveInLineOfSight(Unit* pWho) override @@ -1093,9 +1093,9 @@ struct npc_WarMasterAI : public ScriptedAI } if (!m_uiIsInWhirlwind_Timer) - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); else - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); // SPELL_WHIRLWIND_WM if (m_uiWhirlwind_Timer < diff) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_nefarian.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_nefarian.cpp index 7d79e4be176..91260ff37c3 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_nefarian.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_nefarian.cpp @@ -478,7 +478,7 @@ struct npc_corrupted_totemAI : ScriptedAI void Reset() override { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); if (!m_creature->HasAura(SPELL_ROOT_SELF)) m_creature->AddAura(SPELL_ROOT_SELF); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp index 4bb14a89aa7..14a354b5756 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_razorgore.cpp @@ -266,7 +266,7 @@ struct boss_razorgoreAI : public ScriptedAI void UpdateAI(uint32 const uiDiff) override { - if (m_creature->HasUnitState(UNIT_STAT_POSSESSED)) + if (m_creature->HasUnitState(UNIT_STATE_POSSESSED)) { DoMeleeAttackIfReady(); return; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp index 8dc322b03c0..29987e439ae 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/instance_blackwing_lair.cpp @@ -907,7 +907,7 @@ bool GOHello_go_orbe_domination(Player* pPlayer, GameObject* pGo) if (Creature* pCreature = pGo->GetMap()->GetCreature(pInstance->GetData64(DATA_RAZORGORE_GUID))) { // Deja CM ? - if (pCreature->HasUnitState(UNIT_STAT_POSSESSED)) + if (pCreature->HasUnitState(UNIT_STATE_POSSESSED)) return true; if (pCreature->IsInCombat() && pInstance->GetData64(DATA_EGG) != DONE) { diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp index bb03d9a7717..649c82d53fc 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_baron_geddon.cpp @@ -63,7 +63,7 @@ struct boss_baron_geddonAI : public ScriptedAI if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_GEDDON, NOT_STARTED); - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); SetCombatMovement(true); } @@ -151,7 +151,7 @@ struct boss_baron_geddonAI : public ScriptedAI InfCount = 0; Tick = 1000; m_bInferno = true; - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); } } else @@ -183,7 +183,7 @@ struct boss_baron_geddonAI : public ScriptedAI case 7: Damage = 5000; m_bInferno = false; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); break; } m_creature->CastCustomSpell(m_creature, 19698, Damage, {}, {}, true); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_ragnaros.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_ragnaros.cpp index 3f927d3960d..2762981c9c0 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_ragnaros.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_ragnaros.cpp @@ -367,7 +367,7 @@ struct boss_ragnarosAI : ScriptedAI { if (itr->IsAlive()) { - if (!itr->HasUnitState(UNIT_STAT_ISOLATED)) // banished + if (!itr->HasUnitState(UNIT_STATE_ISOLATED)) // banished { Allbanished = false; break; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp index ae8dffc88f0..94c1883ae44 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp @@ -302,7 +302,7 @@ struct npc_eris_havenfireAI : public ScriptedAI m_archerGUIDs[j] = summoned->GetGUID(); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summoned->AddUnitState(UNIT_STAT_ROOT); + summoned->AddUnitState(UNIT_STATE_ROOT); break; case NPC_WARRIOR: SetAttackOnPeasantOrPlayer(summoned); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_four_horsemen.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_four_horsemen.cpp index eb7f6a37812..4b8c7546618 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_four_horsemen.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_four_horsemen.cpp @@ -237,7 +237,7 @@ struct boss_four_horsemen_shared : public ScriptedAI if (m_bIsSpirit) { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->SetInCombatWithZone(); } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp index 2039fd16039..3edb18e312b 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp @@ -147,7 +147,7 @@ struct mob_eyeStalkAI : public ScriptedAI void Reset() override { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); m_creature->SetNoCallAssistance(true); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp index 147d69c4da4..1d65a9efd6d 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp @@ -222,7 +222,7 @@ struct boss_patchwerkAI : public ScriptedAI if (target) { // Nostalrius : Correction bug sheep/fear - if (!m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_FEIGN_DEATH | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) + if (!m_creature->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_FEIGN_DEATH | UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING) && (!m_creature->HasAuraType(SPELL_AURA_MOD_FEAR) || m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !m_creature->HasAuraType(SPELL_AURA_MOD_CONFUSE)) { if (!m_creature->IsAttackReady(BASE_ATTACK) && m_creature->CanReachWithMeleeAutoAttack(target)) // he does not have offhand attack diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp index 5aee929fb4d..4a6bbd0d255 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp @@ -514,7 +514,7 @@ struct boss_sapphironAI : public ScriptedAI if (m_creature->GetHealthPercent() > 10.0f) { events.Reset(); - m_creature->ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + m_creature->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); m_creature->InterruptNonMeleeSpells(false); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp index c1c3b3481d0..51f90477e3e 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp @@ -116,7 +116,7 @@ struct boss_jeklikAI : public ScriptedAI void Aggro(Unit *who) override { - m_creature->AddUnitState(UNIT_STAT_IGNORE_PATHFINDING); + m_creature->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING); DoScriptText(SAY_AGGRO, m_creature); m_creature->AddAura(SPELL_BAT_FORM); m_creature->SetFly(true); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp index 69f3ec3b658..1b8c64030e7 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp @@ -368,7 +368,7 @@ struct mob_brain_wash_totemAI : public ScriptedAI CheckTimer = 0; m_creature->AddAura(23198, ADD_AURA_PERMANENT); // Avoidance : immunity to AoE - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); SetCombatMovement(false); } @@ -380,7 +380,7 @@ struct mob_brain_wash_totemAI : public ScriptedAI return; } - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); if (!m_creature->IsInCombat()) m_creature->SetInCombatWithZone(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp index 1f327bf1eac..fb1775e6662 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp @@ -360,7 +360,7 @@ struct go_pile_dechetsAI: public GameObjectAI { if (Creature* Guru = pUser->SummonCreature(15047, pUser->GetPositionX(), pUser->GetPositionY(), pUser->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) { - Guru->AddUnitState(UNIT_STAT_ROOT); + Guru->AddUnitState(UNIT_STATE_ROOT); Map::PlayerList const& players = Guru->GetMap()->GetPlayers(); bool OtherPlayerFound = false; @@ -424,7 +424,7 @@ struct go_pile_dechetsAI: public GameObjectAI Guru->AddThreat(itr); Guru->SetInCombatWith(itr); Guru->CastSpell(pUser, 24178, true); - Guru->AddUnitState(UNIT_STAT_ROOT); + Guru->AddUnitState(UNIT_STATE_ROOT); Guru->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Guru->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING); Guru->SetFactionTemplateId(14); // Troll Bloodscalp diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_herod.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_herod.cpp index bee1082105b..4d2024cd170 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_herod.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_herod.cpp @@ -148,7 +148,7 @@ struct boss_herodAI : ScriptedAI void EnterEvadeMode() override { - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); DespawnMyrmidons(); ScriptedAI::EnterEvadeMode(); } @@ -188,7 +188,7 @@ struct boss_herodAI : ScriptedAI { if (m_uiRootTimer < diff) { - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_bWhirlwind = false; } else @@ -237,7 +237,7 @@ struct boss_herodAI : ScriptedAI { if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WHIRLWIND) == CAST_OK) { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_bWhirlwind = true; m_uiRootTimer = 11000; DoScriptText(SAY_WHIRLWIND, m_creature); diff --git a/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp b/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp index fd66db840d1..26851e93c4f 100644 --- a/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp +++ b/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp @@ -149,7 +149,7 @@ class npc_slims_friendAI : public ScriptedAI else // not in combat { // if not following, start follow - if (!m_creature->HasUnitState(UNIT_STAT_FOLLOW)) + if (!m_creature->HasUnitState(UNIT_STATE_FOLLOW)) m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } } diff --git a/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp b/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp index d77ce38d00e..bf026475d7c 100644 --- a/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp +++ b/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp @@ -568,7 +568,7 @@ struct boss_onyxiaAI : public ScriptedAI void PhaseTransition(uint32 uiDiff, bool bDebut) { // m_creature->CombatStop(true); - m_creature->ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + m_creature->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); /** P2 Event to take off */ if (m_uiPhase == PHASE_TWO) diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp index dfebdff0e03..6f4f18208d9 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp @@ -197,7 +197,7 @@ struct boss_ayamissAI : public ScriptedAI SetCombatMovement(true); m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); m_creature->AttackerStateUpdate(m_creature->GetVictim()); - m_creature->AddUnitState(UNIT_STAT_IGNORE_PATHFINDING); //pathfinding desactivation + m_creature->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING); //pathfinding desactivation m_bIsInPhaseTwo = true; /** Aggro list reset */ @@ -234,7 +234,7 @@ struct boss_ayamissAI : public ScriptedAI std::list SwarmerList; GetCreatureListWithEntryInGrid(SwarmerList, m_creature, NPC_HIVEZARA_SWARMER, 300.0f); for (const auto& itr : SwarmerList) - itr->AddUnitState(UNIT_STAT_IGNORE_PATHFINDING); + itr->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING); m_uiSummonSwarmer_Timer = 60000; } diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp index ae9a246cfa9..52838d23e51 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_bug_trio.cpp @@ -415,7 +415,7 @@ struct boss_vemAI : public boss_bug_trioAI // Knock Away if (m_uiKnockBackTimer < uiDiff) { - if (m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim()) && !m_creature->GetVictim()->HasUnitState(UNIT_STAT_STUNNED)) + if (m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim()) && !m_creature->GetVictim()->HasUnitState(UNIT_STATE_STUNNED)) { if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKBACK) == CAST_OK) m_uiKnockBackTimer = urand(10000, 14000); diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp index c577faf8678..0bc6b7e23a1 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp @@ -380,7 +380,7 @@ struct cthunTentacle : public ScriptedAI void Reset() override { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); m_creature->SetInCombatWithZone(); @@ -414,7 +414,7 @@ struct cthunTentacle : public ScriptedAI // This makes the mob behave like frostnovaed mobs etc, that is, // retargetting another top-threat target if current leaves melee range - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); return true; @@ -493,7 +493,7 @@ struct cthunTentacle : public ScriptedAI if (target) { // Nostalrius : Correction bug sheep/fear - if (!m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_FEIGN_DEATH | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) + if (!m_creature->HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_PENDING_STUNNED | UNIT_STATE_FEIGN_DEATH | UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING) && (!m_creature->HasAuraType(SPELL_AURA_MOD_FEAR) || m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !m_creature->HasAuraType(SPELL_AURA_MOD_CONFUSE)) { m_creature->SetInFront(target); diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp index dc7f1c85464..6a0a37f91e9 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp @@ -111,7 +111,7 @@ struct boss_ouroAI : public ScriptedAI { // This makes the mob behave like rooted mobs etc, that is, // retargetting another top-threat target if current leaves melee range - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); @@ -229,12 +229,12 @@ struct boss_ouroAI : public ScriptedAI // This is to let Ouro reset when he enters evade mode. Because rooted mobs don't reset when they evade until their root is removed. if (m_creature->IsInEvadeMode()) { - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); m_creature->SetRooted(false); } else { - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); } diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp index e62ebc86223..828c16c4f52 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp @@ -101,7 +101,7 @@ struct boss_skeramAI : public ScriptedAI // an mmap system that let them add invisible ramps for creatures). However, we can // obtain partial paths next to it. Normally, these are ignored, but we can set a // flag to allow them. They may put us out of LoS so allow autos through them too. - //m_creature->AddUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH | UNIT_STAT_ALLOW_LOS_ATTACK); + //m_creature->AddUnitState(UNIT_STATE_ALLOW_INCOMPLETE_PATH | UNIT_STAT_ALLOW_LOS_ATTACK); m_creature->SetMeleeZReach(74.0f); } diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp index 7a78f4e722d..0b9a5002e20 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp @@ -238,7 +238,7 @@ struct boss_twinemperorsAI : public ScriptedAI justTeleported = false; didPullDialogue = false; killSayCooldown = 0; - m_creature->ClearUnitState(UNIT_STAT_STUNNED); + m_creature->ClearUnitState(UNIT_STATE_STUNNED); } void MoveInLineOfSight(Unit *who) override diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp index eee80c0f481..dd677f4d200 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp @@ -289,7 +289,7 @@ struct boss_viscidusAI : public ScriptedAI DoResetThreat(); m_creature->SetVisibility(VISIBILITY_ON); - m_creature->ClearUnitState(UNIT_STAT_FEIGN_DEATH); + m_creature->ClearUnitState(UNIT_STATE_FEIGN_DEATH); m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SPAWNING); m_uiPhase = PHASE_NORMAL; diff --git a/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp b/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp index 1c61aed7117..59149e39680 100644 --- a/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp +++ b/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp @@ -414,7 +414,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI break; case 1: m_creature->CastSpell(m_creature, SPELL_CLEANSING, false); - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); Subevent_Phase = 2; Event_Timer = 15000; break; @@ -427,7 +427,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI case 3: if (!m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)) { - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); Subevent_Phase = 4; } Event_Timer = 1000; diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 57c01b300ea..ba6a8d8a4fe 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -2238,7 +2238,7 @@ struct npc_oozeling_jubjubAI : public ScriptedPetAI if (type == POINT_MOTION_TYPE && id == 1) { m_creature->MonsterTextEmote(EMOTE_GUZZLE_ALE); - m_creature->AddUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STATE_ROOT); m_uiReturnTimer = 3000; } } @@ -2250,7 +2250,7 @@ struct npc_oozeling_jubjubAI : public ScriptedPetAI if (m_uiReturnTimer <= uiDiff) { m_uiReturnTimer = 0; - m_creature->ClearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STATE_ROOT); if (GameObject* pMug = m_creature->FindNearestGameObject(OBJECT_DARK_IRON_MUG, 1.0f)) {