diff --git a/src/game/AI/AggressorAI.cpp b/src/game/AI/AggressorAI.cpp index 3fb27c8fb..b5a44b5d4 100644 --- a/src/game/AI/AggressorAI.cpp +++ b/src/game/AI/AggressorAI.cpp @@ -33,16 +33,16 @@ int AggressorAI::Permissible(const Creature *creature) void AggressorAI::MoveInLineOfSight(Unit *u) { - // Check this now to prevent calling expensive functions (isInAccessablePlaceFor / IsWithinLOSInMap) - if (m_creature->getVictim() && !m_creature->GetMap()->IsDungeon()) + // Check this now to prevent calling expensive functions (IsInAccessablePlaceFor / IsWithinLOSInMap) + if (m_creature->GetVictim() && !m_creature->GetMap()->IsDungeon()) return; if (!m_creature->IsWithinDistInMap(u, m_creature->GetAttackDistance(u))) return; - if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() && m_creature->IsHostileTo(u) && - m_creature->IsWithinLOSInMap(u) && u->isInAccessablePlaceFor(m_creature)) + if (m_creature->CanInitiateAttack() && u->IsTargetableForAttack() && m_creature->IsHostileTo(u) && + m_creature->IsWithinLOSInMap(u) && u->IsInAccessablePlaceFor(m_creature)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(u); else if (m_creature->GetMap()->IsDungeon()) { @@ -55,7 +55,7 @@ void AggressorAI::MoveInLineOfSight(Unit *u) void AggressorAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_CreatureSpells.empty()) diff --git a/src/game/AI/CreatureAI.cpp b/src/game/AI/CreatureAI.cpp index fc6dfc68d..6ca090cc5 100644 --- a/src/game/AI/CreatureAI.cpp +++ b/src/game/AI/CreatureAI.cpp @@ -20,9 +20,9 @@ */ #include "CreatureAI.h" +#include "Spell.h" #include "Creature.h" #include "DBCStores.h" -#include "Spell.h" #include "Totem.h" #include "GridSearchers.h" @@ -42,7 +42,7 @@ void CreatureAI::JustRespawned() void CreatureAI::AttackedBy(Unit* attacker) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(attacker); } @@ -54,7 +54,7 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell, if (!isTriggered) { // State does not allow - if (m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (m_creature->HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) return CAST_FAIL_STATE; if (pSpell->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || m_creature->IsSpellProhibited(pSpell))) @@ -72,11 +72,11 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell, return CAST_FAIL_OTHER; // If the spell requires the target having a specific power type - if (!pSpell->IsAreaOfEffectSpell() && !pSpell->IsTargetPowerTypeValid(pTarget->getPowerType())) + if (!pSpell->IsAreaOfEffectSpell() && !pSpell->IsTargetPowerTypeValid(pTarget->GetPowerType())) return CAST_FAIL_OTHER; // Mind control abilities can't be used with just 1 attacker or mob will reset. - if ((m_creature->getThreatManager().getThreatList().size() == 1) && pSpell->IsCharmSpell()) + if ((m_creature->GetThreatManager().getThreatList().size() == 1) && pSpell->IsCharmSpell()) return CAST_FAIL_OTHER; // If the unit is disarmed and the skill requires a weapon, it cannot be cast @@ -305,7 +305,7 @@ void CreatureAI::ClearTargetIcon() void CreatureAI::SetGazeOn(Unit *target) { - if (m_creature->canAttack(target)) + if (m_creature->CanAttack(target)) { AttackStart(target); m_creature->SetReactState(REACT_PASSIVE); @@ -314,36 +314,36 @@ void CreatureAI::SetGazeOn(Unit *target) bool CreatureAI::UpdateVictimWithGaze() { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; if (m_creature->HasReactState(REACT_PASSIVE)) { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return true; m_creature->SetReactState(REACT_AGGRESSIVE); } if (m_creature->SelectHostileTarget()) - if (Unit *victim = m_creature->getVictim()) + if (Unit *victim = m_creature->GetVictim()) AttackStart(victim); - return m_creature->getVictim(); + return m_creature->GetVictim(); } bool CreatureAI::UpdateVictim() { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; if (!m_creature->HasReactState(REACT_PASSIVE)) { if (m_creature->SelectHostileTarget()) - if (Unit *victim = m_creature->getVictim()) + if (Unit *victim = m_creature->GetVictim()) AttackStart(victim); - return m_creature->getVictim(); + return m_creature->GetVictim(); } - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) { EnterEvadeMode(); return false; @@ -400,7 +400,7 @@ void CreatureAI::SetMeleeAttack(bool enabled) m_bMeleeAttack = enabled; - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) { if (enabled) m_creature->SendMeleeAttackStart(pVictim); @@ -416,7 +416,7 @@ void CreatureAI::SetCombatMovement(bool enabled) m_bCombatMovement = enabled; - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) { if (!enabled && (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)) m_creature->GetMotionMaster()->MoveIdle(); @@ -437,14 +437,14 @@ void CreatureAI::OnCombatStop() void CreatureAI::EnterEvadeMode() { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) { m_creature->CombatStop(true); m_creature->DeleteThreatList(); return; } - if (!m_creature->isCharmed()) + if (!m_creature->IsCharmed()) { m_creature->RemoveAurasAtReset(); @@ -467,7 +467,7 @@ void CreatureAI::TriggerAlert(Unit const* who) return; // 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_STAT_NO_FREE_MOVE)) return; // Only alert for hostiles! diff --git a/src/game/AI/CreatureAISelector.cpp b/src/game/AI/CreatureAISelector.cpp index def94638a..25da70e88 100644 --- a/src/game/AI/CreatureAISelector.cpp +++ b/src/game/AI/CreatureAISelector.cpp @@ -37,11 +37,11 @@ namespace FactorySelector CreatureAI* selectAI(Creature *creature) { // Vide: un joueur CM un mob. - if (!creature->IsPet() && creature->GetCharmGuid().IsPlayer() && creature->hasUnitState(UNIT_FLAG_POSSESSED)) + if (!creature->IsPet() && creature->GetCharmGuid().IsPlayer() && creature->HasUnitState(UNIT_FLAG_POSSESSED)) return new NullCreatureAI(creature); // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets) - if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed()) + if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->IsCharmed()) if (CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature)) return scriptedAI; @@ -55,7 +55,7 @@ CreatureAI* selectAI(Creature *creature) // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI Unit *owner = nullptr; if ((creature->IsPet() && ((Pet*)creature)->isControlled() && - ((owner = creature->GetOwner()) && owner->GetTypeId() == TYPEID_PLAYER)) || creature->isCharmed()) + ((owner = creature->GetOwner()) && owner->GetTypeId() == TYPEID_PLAYER)) || creature->IsCharmed()) ai_factory = ai_registry.GetRegistryItem("PetAI"); else if (creature->IsTotem()) ai_factory = ai_registry.GetRegistryItem("TotemAI"); diff --git a/src/game/AI/CreatureEventAI.cpp b/src/game/AI/CreatureEventAI.cpp index afb9b1861..52b67d632 100644 --- a/src/game/AI/CreatureEventAI.cpp +++ b/src/game/AI/CreatureEventAI.cpp @@ -132,7 +132,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (pHolder.Event.event_inverse_phase_mask & (1 << m_Phase)) return false; - if (pHolder.Event.condition_id && !sObjectMgr.IsConditionSatisfied(pHolder.Event.condition_id, pActionInvoker ? pActionInvoker : m_creature->getVictim(), m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI)) + if (pHolder.Event.condition_id && !sObjectMgr.IsConditionSatisfied(pHolder.Event.condition_id, pActionInvoker ? pActionInvoker : m_creature->GetVictim(), m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI)) return false; CreatureEventAI_Event const& event = pHolder.Event; @@ -141,14 +141,14 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction switch (event.event_type) { case EVENT_T_TIMER: - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; //Repeat Timers pHolder.UpdateRepeatTimer(m_creature, event.timer.repeatMin, event.timer.repeatMax); break; case EVENT_T_TIMER_OOC: - if (m_creature->isInCombat() || m_creature->IsInEvadeMode()) + if (m_creature->IsInCombat() || m_creature->IsInEvadeMode()) return false; //Repeat Timers @@ -156,7 +156,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_HP: { - if (!m_creature->isInCombat() || !m_creature->GetMaxHealth()) + if (!m_creature->IsInCombat() || !m_creature->GetMaxHealth()) return false; uint32 perc = (m_creature->GetHealth() * 100) / m_creature->GetMaxHealth(); @@ -170,7 +170,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_MANA: { - if (!m_creature->isInCombat() || !m_creature->GetMaxPower(POWER_MANA)) + if (!m_creature->IsInCombat() || !m_creature->GetMaxPower(POWER_MANA)) return false; uint32 perc = (m_creature->GetPower(POWER_MANA) * 100) / m_creature->GetMaxPower(POWER_MANA); @@ -215,10 +215,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_TARGET_HP: { - if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth()) + if (!m_creature->IsInCombat() || !m_creature->GetVictim() || !m_creature->GetVictim()->GetMaxHealth()) return false; - uint32 perc = (m_creature->getVictim()->GetHealth() * 100) / m_creature->getVictim()->GetMaxHealth(); + uint32 perc = (m_creature->GetVictim()->GetHealth() * 100) / m_creature->GetVictim()->GetMaxHealth(); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; @@ -228,7 +228,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; } case EVENT_T_TARGET_CASTING: - if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true)) + if (!m_creature->IsInCombat() || !m_creature->GetVictim() || !m_creature->GetVictim()->IsNonMeleeSpellCasted(false, false, true)) return false; //Repeat Timers @@ -236,7 +236,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; case EVENT_T_FRIENDLY_HP: { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; Unit* pUnit = m_creature->FindLowestHpFriendlyUnit((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit); @@ -252,7 +252,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_FRIENDLY_IS_CC: { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) return false; Unit* pUnit = m_creature->FindFriendlyUnitCC((float)event.friendly_is_cc.radius); @@ -297,10 +297,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_TARGET_MANA: { - if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA)) + if (!m_creature->IsInCombat() || !m_creature->GetVictim() || !m_creature->GetVictim()->GetMaxPower(POWER_MANA)) return false; - uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA) * 100) / m_creature->getVictim()->GetMaxPower(POWER_MANA); + uint32 perc = (m_creature->GetVictim()->GetPower(POWER_MANA) * 100) / m_creature->GetVictim()->GetMaxPower(POWER_MANA); if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) return false; @@ -324,10 +324,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_TARGET_AURA: { - if (!m_creature->isInCombat() || !m_creature->getVictim()) + if (!m_creature->IsInCombat() || !m_creature->GetVictim()) return false; - SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); + SpellAuraHolder* holder = m_creature->GetVictim()->GetSpellAuraHolder(event.buffed.spellId); if (!holder || holder->GetStackAmount() < event.buffed.amount) return false; @@ -347,10 +347,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction } case EVENT_T_TARGET_MISSING_AURA: { - if (!m_creature->isInCombat() || !m_creature->getVictim()) + if (!m_creature->IsInCombat() || !m_creature->GetVictim()) return false; - SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId); + SpellAuraHolder* holder = m_creature->GetVictim()->GetSpellAuraHolder(event.buffed.spellId); if (holder && holder->GetStackAmount() >= event.buffed.amount) return false; @@ -369,7 +369,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction break; 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_STAT_ROOT)) return false; pHolder.UpdateRepeatTimer(m_creature, event.victim_rooted.repeatMin, event.victim_rooted.repeatMax); @@ -438,7 +438,7 @@ void CreatureEventAI::ProcessAction(ScriptMap* action, uint32 EventId, Unit* pAc if (!action) return; - WorldObject* target = pActionInvoker ? pActionInvoker : m_creature->getVictim(); + WorldObject* target = pActionInvoker ? pActionInvoker : m_creature->GetVictim(); Map* map = m_creature->GetMap(); for (const auto& x : *action) @@ -653,13 +653,13 @@ void CreatureEventAI::MoveInLineOfSight(Unit *pWho) return; //Check for OOC LOS Event - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { if (!m_bEmptyList) UpdateEventsOn_MoveInLineOfSight(pWho); if (m_bCanSummonGuards && pWho->IsPlayer() && m_creature->IsWithinDistInMap(pWho, m_creature->GetDetectionRange()) && - m_creature->IsHostileTo(pWho) && pWho->isTargetableForAttack() && m_creature->IsWithinLOSInMap(pWho)) + m_creature->IsHostileTo(pWho) && pWho->IsTargetableForAttack() && m_creature->IsWithinLOSInMap(pWho)) { m_bCanSummonGuards = !sGuardMgr.SummonGuard(m_creature, static_cast(pWho)); } @@ -668,26 +668,26 @@ void CreatureEventAI::MoveInLineOfSight(Unit *pWho) if (m_creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_AGGRO || m_creature->IsNeutralToAll()) return; - // Check this now to prevent calling expensive functions (isInAccessablePlaceFor / IsWithinLOSInMap) - if (m_creature->getVictim() && !m_creature->GetMap()->IsDungeon()) + // Check this now to prevent calling expensive functions (IsInAccessablePlaceFor / IsWithinLOSInMap) + if (m_creature->GetVictim() && !m_creature->GetMap()->IsDungeon()) return; if (!m_creature->CanFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack()) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack()) { float attackRadius = m_creature->GetAttackDistance(pWho); if (m_creature->IsWithinDistInMap(pWho, attackRadius) && m_creature->IsHostileTo(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { - if (m_creature->IsWithinLOSInMap(pWho) && pWho->isInAccessablePlaceFor(m_creature)) + if (m_creature->IsWithinLOSInMap(pWho) && pWho->IsInAccessablePlaceFor(m_creature)) AttackStart(pWho); } else if (m_creature->GetMap()->IsDungeon()) { - if (m_creature->IsWithinLOSInMap(pWho) && pWho->isInAccessablePlaceFor(m_creature)) + if (m_creature->IsWithinLOSInMap(pWho) && pWho->IsInAccessablePlaceFor(m_creature)) { m_creature->AddThreat(pWho); pWho->SetInCombatWith(m_creature); @@ -761,10 +761,10 @@ void CreatureEventAI::UpdateAI(const uint32 diff) { //Check if we are in combat (also updates calls threat update code) m_creature->SelectHostileTarget(); - bool Combat = m_creature->getVictim(); + bool Combat = m_creature->GetVictim(); //Must return if creature isn't alive. Normally select hostil target and get victim prevent this - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return; if (!m_bEmptyList) @@ -827,8 +827,8 @@ void CreatureEventAI::UpdateEventsOn_UpdateAI(const uint32 diff, bool Combat) case EVENT_T_RANGE: if (Combat) { - if (m_creature->getVictim() && m_creature->IsInMap(m_creature->getVictim())) - if (m_creature->IsInRange(m_creature->getVictim(), (float)i.Event.range.minDist, (float)i.Event.range.maxDist)) + if (m_creature->GetVictim() && m_creature->IsInMap(m_creature->GetVictim())) + if (m_creature->IsInRange(m_creature->GetVictim(), (float)i.Event.range.minDist, (float)i.Event.range.maxDist)) ProcessEvent(i); } break; diff --git a/src/game/AI/CreatureEventAI.h b/src/game/AI/CreatureEventAI.h index 52ab8431c..7e1b4ef25 100644 --- a/src/game/AI/CreatureEventAI.h +++ b/src/game/AI/CreatureEventAI.h @@ -23,11 +23,10 @@ #define MANGOS_CREATURE_EAI_H #include "Common.h" -#include "Creature.h" #include "CreatureAI.h" -#include "Unit.h" -#include "ScriptMgr.h" +class Unit; +class Creature; class Player; class WorldObject; diff --git a/src/game/AI/GenericSpellAI.cpp b/src/game/AI/GenericSpellAI.cpp index 168993697..016f710de 100644 --- a/src/game/AI/GenericSpellAI.cpp +++ b/src/game/AI/GenericSpellAI.cpp @@ -155,7 +155,7 @@ struct MANGOS_DLL_DECL GenericSpellMob : public ScriptedAI void UpdateAI(const uint32 uiDiff) { m_creature->SelectHostileTarget(); - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) return; /*if(isDistanceCaster) { // Check du CoolDown global @@ -192,7 +192,7 @@ struct MANGOS_DLL_DECL GenericSpellMob : public ScriptedAI target = m_creature; break; case GENERIC_TARGET_VICTIM: - target = m_creature->getVictim(); + target = m_creature->GetVictim(); break; case GENERIC_TARGET_HOSTILE_RAND: target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); @@ -265,7 +265,7 @@ struct MANGOS_DLL_DECL GenericSpellMob : public ScriptedAI // Test CM if (cast && it->spellFlags & SPELL_FLAG_CM) { - uint32 targetCounts = m_creature->getThreatManager().getThreatList().size(); + uint32 targetCounts = m_creature->GetThreatManager().getThreatList().size(); // On ne CM pas si il n'y a personne d'autre. if (targetCounts <= 1) cast = false; @@ -282,13 +282,13 @@ struct MANGOS_DLL_DECL GenericSpellMob : public ScriptedAI { DoCastSpellIfCan(target, it->spellId); it->timer = urand(it->minCD, it->maxCD); - if (it->spellFlags & SPELL_FLAG_STOP_ATTACK_TARGET && target != m_creature->getVictim()) // Change de cible + if (it->spellFlags & SPELL_FLAG_STOP_ATTACK_TARGET && target != m_creature->GetVictim()) // Change de cible { if (Unit* pSecondAggro = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1)) { if (pSecondAggro != target) { - m_creature->getThreatManager().modifyThreatPercent(target, -100); + m_creature->GetThreatManager().modifyThreatPercent(target, -100); AttackStart(pSecondAggro); } } diff --git a/src/game/AI/GuardAI.cpp b/src/game/AI/GuardAI.cpp index 0044caf12..beaa31d04 100644 --- a/src/game/AI/GuardAI.cpp +++ b/src/game/AI/GuardAI.cpp @@ -41,9 +41,9 @@ bool GuardAI::IsAttackingPlayerOrFriendly(const Unit* pWho) const if (pWho->IsPvPContested()) return true; - if (Unit* pVictim = pWho->getVictim()) + if (Unit* pVictim = pWho->GetVictim()) { - if (m_creature->IsFriendlyTo(pVictim) || pVictim->isTaxi()) + if (m_creature->IsFriendlyTo(pVictim) || pVictim->IsTaxi()) return true; } @@ -52,7 +52,7 @@ bool GuardAI::IsAttackingPlayerOrFriendly(const Unit* pWho) const void GuardAI::MoveInLineOfSight(Unit *pWho) { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; // Ignore Z for flying creatures @@ -74,9 +74,9 @@ void GuardAI::MoveInLineOfSight(Unit *pWho) if (!m_creature->IsWithinDistInMap(pWho, attackRadius)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && (pWho->IsHostileToPlayers() || m_creature->IsHostileTo(pWho) || isAttackingFriend) && - pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { AttackStart(pWho); } @@ -89,7 +89,7 @@ void GuardAI::EnterCombat(Unit *) void GuardAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_CreatureSpells.empty()) diff --git a/src/game/AI/GuardEventAI.cpp b/src/game/AI/GuardEventAI.cpp index efd17ffcd..8818d5201 100644 --- a/src/game/AI/GuardEventAI.cpp +++ b/src/game/AI/GuardEventAI.cpp @@ -35,9 +35,9 @@ bool GuardEventAI::IsAttackingPlayerOrFriendly(const Unit* pWho) const if (pWho->IsPvPContested()) return true; - if (Unit* pVictim = pWho->getVictim()) + if (Unit* pVictim = pWho->GetVictim()) { - if (m_creature->IsFriendlyTo(pVictim) || pVictim->isTaxi()) + if (m_creature->IsFriendlyTo(pVictim) || pVictim->IsTaxi()) return true; } @@ -49,7 +49,7 @@ void GuardEventAI::MoveInLineOfSight(Unit *pWho) if (!pWho) return; - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; // Check for OOC LOS Event @@ -75,9 +75,9 @@ void GuardEventAI::MoveInLineOfSight(Unit *pWho) if (!m_creature->IsWithinDistInMap(pWho, attackRadius)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && (pWho->IsHostileToPlayers() || m_creature->IsHostileTo(pWho) || isAttackingFriend) && - pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { AttackStart(pWho); } diff --git a/src/game/AI/NullCreatureAI.h b/src/game/AI/NullCreatureAI.h index e0e1ce2c8..d91c0058c 100644 --- a/src/game/AI/NullCreatureAI.h +++ b/src/game/AI/NullCreatureAI.h @@ -30,7 +30,7 @@ class MANGOS_DLL_DECL NullCreatureAI : public CreatureAI public: explicit NullCreatureAI(Creature* c) : CreatureAI(c) { - c->addUnitState(UNIT_STAT_IGNORE_MOVE_LOS); + c->AddUnitState(UNIT_STAT_IGNORE_MOVE_LOS); } ~NullCreatureAI() override; diff --git a/src/game/AI/PetAI.cpp b/src/game/AI/PetAI.cpp index 3bbef5d97..6f56f61a0 100644 --- a/src/game/AI/PetAI.cpp +++ b/src/game/AI/PetAI.cpp @@ -51,7 +51,7 @@ PetAI::PetAI(Creature *c) : CreatureAI(c) bool PetAI::_needToStop() const { // This is needed for charmed creatures, as once their target was reset other effects can trigger threat - if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer()) + if (m_creature->IsCharmed() && m_creature->GetVictim() == m_creature->GetCharmer()) return true; // Stop attacking when player is mounted @@ -61,20 +61,20 @@ bool PetAI::_needToStop() const Unit* pOwner = m_creature->GetCharmerOrOwnerOrSelf(); // Prevent creature pets from chasing forever - if (pOwner->IsCreature() && !pOwner->isInCombat() && m_creature->IsOutOfThreatArea(m_creature->getVictim())) + if (pOwner->IsCreature() && !pOwner->IsInCombat() && m_creature->IsOutOfThreatArea(m_creature->GetVictim())) return true; - return !m_creature->getVictim()->isTargetableForAttack(false, pOwner->IsPlayer()); + return !m_creature->GetVictim()->IsTargetableForAttack(false, pOwner->IsPlayer()); } void PetAI::_stopAttack() { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->CombatStop(); - m_creature->getHostileRefManager().deleteReferences(); + m_creature->GetHostileRefManager().deleteReferences(); return; } @@ -88,7 +88,7 @@ void PetAI::_stopAttack() void PetAI::UpdateAI(const uint32 diff) { - if (!m_creature->isAlive() || !m_creature->GetCharmInfo()) + if (!m_creature->IsAlive() || !m_creature->GetCharmInfo()) return; // part of it must run during eyes of the Beast to update melee hits @@ -107,7 +107,7 @@ void PetAI::UpdateAI(const uint32 diff) if (tauntTarget) DoAttack(tauntTarget, true); - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) { if (_needToStop()) { @@ -121,10 +121,10 @@ void PetAI::UpdateAI(const uint32 diff) bool attacked = false; if (m_creature->GetCharmInfo()->HasCommandState(COMMAND_STAY)) { - if (m_creature->GetCharmInfo()->IsCommandAttack() || (m_creature->GetCharmInfo()->IsAtStay() && m_creature->CanReachWithMeleeAutoAttack(m_creature->getVictim()))) + if (m_creature->GetCharmInfo()->IsCommandAttack() || (m_creature->GetCharmInfo()->IsAtStay() && m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim()))) { - if (!m_creature->HasInArc(M_PI_F, m_creature->getVictim())) - m_creature->SetInFront(m_creature->getVictim()); + if (!m_creature->HasInArc(M_PI_F, m_creature->GetVictim())) + m_creature->SetInFront(m_creature->GetVictim()); attacked = DoMeleeAttackIfReady(); } } @@ -132,7 +132,7 @@ void PetAI::UpdateAI(const uint32 diff) attacked = DoMeleeAttackIfReady(); if (attacked && owner) - if (Unit* v = m_creature->getVictim()) // Victim may have died between + if (Unit* v = m_creature->GetVictim()) // Victim may have died between owner->SetInCombatWith(v); } } @@ -151,7 +151,7 @@ void PetAI::UpdateAI(const uint32 diff) AttackStart(nextTarget); else if (!m_creature->HasReactState(REACT_PASSIVE)) { - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) m_creature->CombatStop(); HandleReturnMovement(); } @@ -219,7 +219,7 @@ void PetAI::UpdateAI(const uint32 diff) // Furious Howl: in combat only if (spellInfo->HasAura(SPELL_AURA_MOD_DAMAGE_DONE)) castOnlyInCombat = true; - if (castOnlyInCombat && !m_creature->getVictim()) + if (castOnlyInCombat && !m_creature->GetVictim()) continue; } @@ -228,9 +228,9 @@ void PetAI::UpdateAI(const uint32 diff) // Some spells can target enemy or friendly (DK Ghoul's Leap) // Check for enemy first (pet then owner) - Unit* target = m_creature->getAttackerForHelper(); + Unit* target = m_creature->GetAttackerForHelper(); if (!target && owner) - target = owner->getAttackerForHelper(); + target = owner->GetAttackerForHelper(); if (target) { @@ -265,11 +265,11 @@ void PetAI::UpdateAI(const uint32 diff) if (!spellUsed) spell->Delete(); } - else if (m_creature->getVictim() && CanAttack(m_creature->getVictim()) && !spellInfo->IsNonCombatSpell()) + else if (m_creature->GetVictim() && CanAttack(m_creature->GetVictim()) && !spellInfo->IsNonCombatSpell()) { Spell *spell = new Spell(m_creature, spellInfo, false); - if (spell->CanAutoCast(m_creature->getVictim())) - targetSpellStore.push_back(std::make_pair(m_creature->getVictim(), spell)); + if (spell->CanAutoCast(m_creature->GetVictim())) + targetSpellStore.push_back(std::make_pair(m_creature->GetVictim(), spell)); else spell->Delete(); } @@ -365,7 +365,7 @@ void PetAI::KilledUnit(Unit* victim) { // Called from Unit::Kill() in case where pet or owner kills something // if owner killed this victim, pet may still be attacking something else - if (m_creature->getVictim() && m_creature->getVictim() != victim) + if (m_creature->GetVictim() && m_creature->GetVictim() != victim) return; // Clear target just in case. May help problem where health / focus / mana @@ -381,7 +381,7 @@ void PetAI::KilledUnit(Unit* victim) AttackStart(nextTarget); else { - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) m_creature->CombatStop(); HandleReturnMovement(); // Return } @@ -419,7 +419,7 @@ void PetAI::OwnerAttackedBy(Unit* attacker) return; // Prevent pet from disengaging from current target - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) return; // Continue to evaluate and attack if necessary @@ -447,7 +447,7 @@ void PetAI::OwnerAttacked(Unit* target) return; // Prevent pet from disengaging from current target - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) return; // Continue to evaluate and attack if necessary @@ -475,13 +475,13 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const return nullptr; // Check owner attackers - if (Unit* ownerAttacker = owner->getAttackerForHelper()) - if (!ownerAttacker->HasAuraPetShouldAvoidBreaking() && owner->isInCombat()) + if (Unit* ownerAttacker = owner->GetAttackerForHelper()) + if (!ownerAttacker->HasAuraPetShouldAvoidBreaking() && owner->IsInCombat()) return ownerAttacker; // Check owner victim // 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does - //if (Unit* ownerVictim = m_creature->GetCharmerOrOwner()->getVictim()) + //if (Unit* ownerVictim = m_creature->GetCharmerOrOwner()->GetVictim()) // return ownerVictim; // Neither pet or owner had a target and aggressive pets can pick any target @@ -622,7 +622,7 @@ bool PetAI::CanAttack(Unit* target) if (!m_creature->IsValidAttackTarget(target)) return false; - if (!target->isAlive()) + if (!target->IsAlive()) { // Clear target to prevent getting stuck on dead targets m_creature->AttackStop(); @@ -652,7 +652,7 @@ bool PetAI::CanAttack(Unit* target) return (m_creature->IsWithinMeleeRange(target) || m_creature->GetCharmInfo()->IsCommandAttack()); // Pets attacking something (or chasing) should only switch targets if owner tells them to - if (m_creature->getVictim() && m_creature->getVictim() != target) + if (m_creature->GetVictim() && m_creature->GetVictim() != target) { // Check if our owner selected this target and clicked "attack" Unit* owner = m_creature->GetCharmerOrOwner(); @@ -662,7 +662,7 @@ bool PetAI::CanAttack(Unit* target) if (Player* playerOwner = owner->ToPlayer()) ownerTarget = playerOwner->GetSelectedUnit(); else - ownerTarget = owner->getVictim(); + ownerTarget = owner->GetVictim(); } if (ownerTarget && m_creature->GetCharmInfo()->IsCommandAttack()) @@ -713,7 +713,7 @@ void PetAI::AttackedBy(Unit* attacker) return; // Prevent pet from disengaging from current target - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) return; // Continue to evaluate and attack if necessary diff --git a/src/game/AI/PetEventAI.cpp b/src/game/AI/PetEventAI.cpp index c389c8131..ab9ea18c2 100644 --- a/src/game/AI/PetEventAI.cpp +++ b/src/game/AI/PetEventAI.cpp @@ -36,7 +36,7 @@ void PetEventAI::MoveInLineOfSight(Unit *pWho) if (!pWho) return; - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; //Check for OOC LOS Event @@ -59,10 +59,10 @@ void PetEventAI::MoveInLineOfSight(Unit *pWho) return; #endif - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack()) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack()) { float attackRadius = m_creature->GetAttackDistance(pWho); - if (m_creature->IsWithinDistInMap(pWho, attackRadius) && m_creature->IsHostileTo(pWho) && pWho->isInAccessablePlaceFor(m_creature)) + if (m_creature->IsWithinDistInMap(pWho, attackRadius) && m_creature->IsHostileTo(pWho) && pWho->IsInAccessablePlaceFor(m_creature)) AttackStart(pWho); } } @@ -81,7 +81,7 @@ void PetEventAI::AttackStart(Unit* pWho) if (m_creature->HasReactState(REACT_PASSIVE) && m_creature->GetCharmInfo() && !m_creature->GetCharmInfo()->IsCommandAttack()) return; - if (pWho->HasAuraPetShouldAvoidBreaking() && m_creature->GetCharmerOrOwner() && m_creature->GetCharmerOrOwner()->isAlive()) + if (pWho->HasAuraPetShouldAvoidBreaking() && m_creature->GetCharmerOrOwner() && m_creature->GetCharmerOrOwner()->IsAlive()) return; if (m_creature->Attack(pWho, m_bMeleeAttack)) @@ -92,7 +92,7 @@ void PetEventAI::AttackStart(Unit* pWho) if (Player* pOwner = ToPlayer(m_creature->GetCharmerOrOwner())) { - if (!pOwner->isInCombat()) + if (!pOwner->IsInCombat()) { if (m_creature->HasReactState(REACT_AGGRESSIVE)) m_creature->SendPetAIReaction(); @@ -116,7 +116,7 @@ void PetEventAI::AttackStart(Unit* pWho) void PetEventAI::AttackedBy(Unit* pAttacker) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pAttacker); if (Creature* pOwner = ToCreature(m_creature->GetCharmerOrOwner())) @@ -135,10 +135,10 @@ bool PetEventAI::FindTargetForAttack() } // Check if any of the Pet's attackers are valid targets. - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr) { - if ((*itr)->IsInMap(m_creature) && (*itr)->isTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) + if ((*itr)->IsInMap(m_creature) && (*itr)->IsTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) { AttackStart((*itr)); return true; @@ -151,7 +151,7 @@ bool PetEventAI::FindTargetForAttack() return false; // Pet has no attackers, check for anyone attacking Owner. - if (Unit * const pTarget = pOwner->getAttackerForHelper()) + if (Unit * const pTarget = pOwner->GetAttackerForHelper()) { // Prevent pets from breaking CC effects if (!pTarget->HasAuraPetShouldAvoidBreaking()) @@ -162,10 +162,10 @@ bool PetEventAI::FindTargetForAttack() else { // Main target is CC-ed, so pick another attacker. - Unit::AttackerSet owner_attackers = pOwner->getAttackers(); + Unit::AttackerSet owner_attackers = pOwner->GetAttackers(); for (Unit::AttackerSet::const_iterator itr = owner_attackers.begin(); itr != owner_attackers.end(); ++itr) { - if ((*itr)->IsInMap(m_creature) && (*itr)->isTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) + if ((*itr)->IsInMap(m_creature) && (*itr)->IsTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) { AttackStart((*itr)); return true; @@ -178,19 +178,19 @@ bool PetEventAI::FindTargetForAttack() void PetEventAI::UpdateAI(const uint32 uiDiff) { - bool bHasVictim = m_creature->getVictim(); + bool bHasVictim = m_creature->GetVictim(); //Must return if creature isn't alive. Normally select hostile target and get victim prevent this - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return; Unit* pOwner = m_creature->GetCharmerOrOwner(); - bool hasAliveOwner = pOwner && pOwner->isAlive() && m_creature->GetCharmInfo(); + bool hasAliveOwner = pOwner && pOwner->IsAlive() && m_creature->GetCharmInfo(); - if (!bHasVictim && (m_creature->isInCombat() || (hasAliveOwner && pOwner->isInCombat()))) + if (!bHasVictim && (m_creature->IsInCombat() || (hasAliveOwner && pOwner->IsInCombat()))) { if (FindTargetForAttack()) - bHasVictim = m_creature->getVictim(); + bHasVictim = m_creature->GetVictim(); } if (!m_bEmptyList) @@ -205,10 +205,10 @@ void PetEventAI::UpdateAI(const uint32 uiDiff) } else { - if (m_creature->isInCombat() && !(hasAliveOwner && pOwner->isInCombat())) + 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_STAT_FOLLOW)) { m_creature->GetMotionMaster()->MoveFollow(m_creature->GetCharmerOrOwner(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); if (m_creature->GetCharmInfo()) @@ -225,7 +225,7 @@ void PetEventAI::OwnerAttackedBy(Unit* pAttacker) return; // Prevent pet from disengaging from current target - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) return; // If owner attacked by fire, attacker=owner. Don't attack our owner ! @@ -246,7 +246,7 @@ void PetEventAI::OwnerAttacked(Unit* pTarget) return; // Prevent pet from disengaging from current target - if (m_creature->getVictim() && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && m_creature->GetVictim()->IsAlive()) return; if (!m_creature->IsValidAttackTarget(pTarget)) diff --git a/src/game/AI/PlayerAI.cpp b/src/game/AI/PlayerAI.cpp index 3e62911a9..2c78affb8 100644 --- a/src/game/AI/PlayerAI.cpp +++ b/src/game/AI/PlayerAI.cpp @@ -56,7 +56,7 @@ CanCastResult PlayerAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell, bo 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_STAT_CAN_NOT_REACT_OR_LOST_CONTROL : UNIT_STAT_CAN_NOT_REACT)) return CAST_FAIL_STATE; if (pSpell->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) @@ -98,7 +98,7 @@ void PlayerAI::UpdateAI(const uint32 /*diff*/) PlayerControlledAI::PlayerControlledAI(Player* pPlayer, Unit* caster) : PlayerAI(pPlayer), controllerGuid(caster ? caster->GetObjectGuid() : ObjectGuid()), uiGlobalCD(0) { ASSERT(pPlayer); - switch (pPlayer->getClass()) + switch (pPlayer->GetClass()) { case CLASS_WARRIOR: case CLASS_ROGUE: @@ -137,7 +137,7 @@ PlayerControlledAI::PlayerControlledAI(Player* pPlayer, Unit* caster) : PlayerAI continue; if (Spells::IsPositiveSpell(itr->first) && !enablePositiveSpells) continue; - switch (pPlayer->getClass()) + switch (pPlayer->GetClass()) { case CLASS_WARRIOR: case CLASS_ROGUE: @@ -200,7 +200,7 @@ Unit* PlayerControlledAI::FindController() void PlayerControlledAI::UpdateTarget(Unit* victim) { - if ((victim->isCharmed() && victim->GetCharmerGuid() == me->GetCharmerGuid()) || me->isFeared() || me->IsPolymorphed()) + if ((victim->IsCharmed() && victim->GetCharmerGuid() == me->GetCharmerGuid()) || me->IsFeared() || me->IsPolymorphed()) { me->AttackStop(); me->CastStop(); @@ -209,7 +209,7 @@ void PlayerControlledAI::UpdateTarget(Unit* victim) Unit* controller = FindController(); - bool isNewVictim = me->getVictim() != victim; + bool isNewVictim = me->GetVictim() != victim; if (isNewVictim) me->Attack(victim, true); @@ -262,7 +262,7 @@ void PlayerControlledAI::UpdateTarget(Unit* victim) else { // melee not in melee range or nonmoving caster not in caster range - if (!me->isInRoots() && !me->IsMoving()) + if (!me->IsInRoots() && !me->IsMoving()) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(victim); @@ -278,7 +278,7 @@ PlayerControlledAI::~PlayerControlledAI() void PlayerControlledAI::UpdateAI(const uint32 uiDiff) { - if (me->IsDeleted() || !me->IsInWorld() || !me->isAlive()) + if (me->IsDeleted() || !me->IsInWorld() || !me->IsAlive()) { me->RemoveAI(); return; @@ -293,7 +293,7 @@ void PlayerControlledAI::UpdateAI(const uint32 uiDiff) { Player* Pcontroller = ((Player*)controller); - if (!Pcontroller->isAlive()) + if (!Pcontroller->IsAlive()) { me->RemoveCharmAuras(); // Note that we CANNOT continue after this point since this object has been deleted @@ -305,19 +305,19 @@ void PlayerControlledAI::UpdateAI(const uint32 uiDiff) if (charmInfo) { if (charmInfo->HasReactState(REACT_PASSIVE)) - victim = me->getVictim(); + victim = me->GetVictim(); else if (charmInfo->HasReactState(REACT_DEFENSIVE) || charmInfo->HasReactState(REACT_AGGRESSIVE)) { - victim = me->getVictim(); + victim = me->GetVictim(); if (!victim || (victim == Pcontroller)) - victim = Pcontroller->getVictim(); + victim = Pcontroller->GetVictim(); } } else { - victim = me->getVictim(); + victim = me->GetVictim(); if (!victim || (victim == Pcontroller)) - victim = Pcontroller->getVictim(); + victim = Pcontroller->GetVictim(); } if (!victim || (victim == me)) @@ -332,11 +332,11 @@ void PlayerControlledAI::UpdateAI(const uint32 uiDiff) // Unit * victim = controller-> getVictim (); // Ivina : chooses the target randomly and not always the target of the controller. victim = Ccontroller ? Ccontroller->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0) : me->SelectNearestTarget(50.0f); - if (Unit* v2 = me->getVictim()) - if (me->canAttack(v2, false)) + if (Unit* v2 = me->GetVictim()) + if (me->CanAttack(v2, false)) victim = v2; - if (Ccontroller && (!Ccontroller->isAlive() || !Ccontroller->isInCombat())) + if (Ccontroller && (!Ccontroller->IsAlive() || !Ccontroller->IsInCombat())) { me->RemoveCharmAuras(); // Note that we CANNOT continue after this point since this object has been deleted @@ -357,7 +357,7 @@ void PlayerControlledAI::UpdateAI(const uint32 uiDiff) if (uiGlobalCD < uiDiff) { - if (me->getClass() == CLASS_HUNTER) + if (me->GetClass() == CLASS_HUNTER) { float dist = me->GetDistance(victim); if (dist > 10.0f) diff --git a/src/game/AI/ReactorAI.cpp b/src/game/AI/ReactorAI.cpp index 55fb380a9..9ede02dba 100644 --- a/src/game/AI/ReactorAI.cpp +++ b/src/game/AI/ReactorAI.cpp @@ -38,7 +38,7 @@ void ReactorAI::JustRespawned() void ReactorAI::MoveInLineOfSight(Unit* pWho) { - if (!CanSummonGuards() || m_creature->isInCombat()) + if (!CanSummonGuards() || m_creature->IsInCombat()) return; if (!pWho->IsPlayer()) @@ -47,7 +47,7 @@ void ReactorAI::MoveInLineOfSight(Unit* pWho) if (!m_creature->IsWithinDistInMap(pWho, m_creature->GetDetectionRange())) return; - if (m_creature->IsHostileTo(pWho) && pWho->isTargetableForAttack() && m_creature->IsWithinLOSInMap(pWho)) + if (m_creature->IsHostileTo(pWho) && pWho->IsTargetableForAttack() && m_creature->IsWithinLOSInMap(pWho)) m_bCanSummonGuards = !sGuardMgr.SummonGuard(m_creature, static_cast(pWho)); } @@ -72,7 +72,7 @@ void ReactorAI::AttackStart(Unit *p) void ReactorAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_CreatureSpells.empty()) diff --git a/src/game/AI/ScriptedAI.cpp b/src/game/AI/ScriptedAI.cpp index 049ceac00..3fd554fdb 100644 --- a/src/game/AI/ScriptedAI.cpp +++ b/src/game/AI/ScriptedAI.cpp @@ -29,11 +29,11 @@ void ScriptedAI::MoveInLineOfSight(Unit* pWho) if (!m_creature->IsWithinDistInMap(pWho, m_creature->GetAttackDistance(pWho))) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -79,7 +79,7 @@ void ScriptedAI::UpdateAI(const uint32 uiDiff) //Check if we have a current target m_creature->SelectHostileTarget(); - if (!m_CreatureSpells.empty() && m_creature->isInCombat()) + if (!m_CreatureSpells.empty() && m_creature->IsInCombat()) UpdateSpellsList(uiDiff); DoMeleeAttackIfReady(); @@ -92,11 +92,11 @@ void ScriptedAI::EnterEvadeMode() m_creature->CombatStop(true); m_creature->LoadCreatureAddon(true); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); // Prevent raid loot loss on grid unload - if (!m_creature->IsWorldBoss() || !m_creature->isDead()) + if (!m_creature->IsWorldBoss() || !m_creature->IsDead()) m_creature->SetLootRecipient(nullptr); // Reset back to default spells template. This also resets timers. @@ -128,7 +128,7 @@ void ScriptedAI::DoStartNoMovement(Unit* pVictim) void ScriptedAI::DoStopAttack() { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) m_creature->AttackStop(); } @@ -169,19 +169,19 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 id, float dist, uint32 type, uint32 void ScriptedAI::DoResetThreat() { - if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty()) + if (!m_creature->CanHaveThreatList() || m_creature->GetThreatManager().isThreatListEmpty()) { sLog.outError("DoResetThreat called for creature that either cannot have threat list or has empty threat list (m_creature entry = %d)", m_creature->GetEntry()); return; } - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { Unit* pUnit = m_creature->GetMap()->GetUnit( (*itr)->getUnitGuid()); - if (pUnit && m_creature->getThreatManager().getThreat(pUnit)) - m_creature->getThreatManager().modifyThreatPercent(pUnit, -100); + if (pUnit && m_creature->GetThreatManager().getThreat(pUnit)) + m_creature->GetThreatManager().modifyThreatPercent(pUnit, -100); } } @@ -280,7 +280,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) return false; } - if (m_creature->IsInEvadeMode() || !m_creature->getVictim()) + if (m_creature->IsInEvadeMode() || !m_creature->GetVictim()) return false; float fX = m_creature->GetPositionX(); @@ -343,7 +343,7 @@ void Scripted_NoMovementAI::AttackStart(Unit* pWho) void ScriptedAI::DoGoHome() { - if (!m_creature->getVictim() && m_creature->isAlive()) + if (!m_creature->GetVictim() && m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); } @@ -352,13 +352,13 @@ void ScriptedAI::DoGoHome() float ScriptedAI::DoGetThreat(Unit* pUnit) { if (!pUnit) return 0.0f; - return me->getThreatManager().getThreat(pUnit); + return me->GetThreatManager().getThreat(pUnit); } void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct) { if (!pUnit) return; - me->getThreatManager().modifyThreatPercent(pUnit, pct); + me->GetThreatManager().modifyThreatPercent(pUnit, pct); } void ScriptedAI::DoTeleportTo(float fX, float fY, float fZ) @@ -380,7 +380,7 @@ void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO) Map::PlayerList const &PlayerList = map->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->getSource()) - if (i_pl->isAlive()) + if (i_pl->IsAlive()) i_pl->TeleportTo(me->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT); } @@ -393,16 +393,16 @@ void ScriptedAI::EnterVanish() m_creature->AttackStop(); m_creature->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); // DoResetThreat : - if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty()) + if (!m_creature->CanHaveThreatList() || m_creature->GetThreatManager().isThreatListEmpty()) return; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()); - if (pUnit && m_creature->getThreatManager().getThreat(pUnit)) - m_creature->getThreatManager().modifyThreatPercent(pUnit, -100); + if (pUnit && m_creature->GetThreatManager().getThreat(pUnit)) + m_creature->GetThreatManager().modifyThreatPercent(pUnit, -100); } } diff --git a/src/game/AI/ScriptedEscortAI.cpp b/src/game/AI/ScriptedEscortAI.cpp index f32cfeb58..9d1a54a65 100644 --- a/src/game/AI/ScriptedEscortAI.cpp +++ b/src/game/AI/ScriptedEscortAI.cpp @@ -97,18 +97,18 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) if (!m_uiPlayerGUID) return false; - if (!pWho->getVictim()) + if (!pWho->GetVictim()) return false; //experimental (unknown) flag not present if (!m_creature->CanAssistPlayers()) return false; - if (m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED)) + if (m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED)) return false; //not a player - if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (!pWho->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; //never attack friendly @@ -119,7 +119,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) if (m_creature->IsWithinDistInMap(pWho, m_MaxAssistDistance) && m_creature->IsWithinLOSInMap(pWho)) { //already fighting someone? - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { AttackStart(pWho); return true; @@ -135,7 +135,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) void npc_escortAI::MoveInLineOfSight(Unit* pWho) { - if (pWho->isTargetableForAttack() && pWho->isInAccessablePlaceFor(m_creature)) + if (pWho->IsTargetableForAttack() && pWho->IsInAccessablePlaceFor(m_creature)) { if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho)) return; @@ -150,7 +150,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho) float fAttackRadius = m_creature->GetAttackDistance(pWho); if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { //pWho->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); AttackStart(pWho); @@ -187,8 +187,8 @@ void npc_escortAI::JustRespawned() //add a small delay before going to first waypoint. m_uiWPWaitTimer = m_uiDelayBeforeTheFirstWaypoint; - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction) - m_creature->setFaction(m_creature->GetCreatureInfo()->faction); + if (m_creature->GetFactionTemplateId() != m_creature->GetCreatureInfo()->faction) + m_creature->SetFactionTemplateId(m_creature->GetCreatureInfo()->faction); Reset(); ResetCreature(); @@ -238,7 +238,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange() const void npc_escortAI::UpdateAI(const uint32 uiDiff) { //Waypoint Updating - if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->isInCombat() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING)) + if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->IsInCombat() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING)) { if (m_uiWPWaitTimer <= uiDiff) { @@ -298,7 +298,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } //Check if player or any member of his group is within range - if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && m_MaxPlayerDistance && !m_creature->isInCombat() && !HasEscortState(STATE_ESCORT_RETURNING)) + if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && m_MaxPlayerDistance && !m_creature->IsInCombat() && !HasEscortState(STATE_ESCORT_RETURNING)) { if (m_uiPlayerCheckTimer < uiDiff) { @@ -335,15 +335,15 @@ void npc_escortAI::ResetEscort() void npc_escortAI::UpdateEscortAI(const uint32 uiDiff) { // Make nearby enemies aggro passive escort npcs - if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->isInCombat()) + if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->IsInCombat()) { if (Unit* pTarget = m_creature->SelectNearestHostileUnitInAggroRange(true)) - if ((pTarget->GetTypeId() == TYPEID_UNIT) && !pTarget->GetCharmInfo() && !pTarget->isInCombat()) + if ((pTarget->GetTypeId() == TYPEID_UNIT) && !pTarget->GetCharmInfo() && !pTarget->IsInCombat()) pTarget->AI()->AttackStart(m_creature); } // Check if we have a current target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_CreatureSpells.empty()) @@ -458,7 +458,7 @@ void npc_escortAI::SetRun(bool bRun) void npc_escortAI::Start(bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath) { - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) { sLog.outError("EscortAI attempt to Start while in combat."); return; diff --git a/src/game/AI/ScriptedFollowerAI.cpp b/src/game/AI/ScriptedFollowerAI.cpp index 1a029daea..f23883007 100644 --- a/src/game/AI/ScriptedFollowerAI.cpp +++ b/src/game/AI/ScriptedFollowerAI.cpp @@ -48,18 +48,18 @@ void FollowerAI::AttackStart(Unit* pWho) //The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate. bool FollowerAI::AssistPlayerInCombat(Unit* pWho) { - if (!pWho->getVictim()) + if (!pWho->GetVictim()) return false; //experimental (unknown) flag not present if (m_creature->CanAssistPlayers()) return false; - if (m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED)) + if (m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED)) return false; //not a player - if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (!pWho->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; //never attack friendly @@ -70,7 +70,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) if (m_creature->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && m_creature->IsWithinLOSInMap(pWho)) { //already fighting someone? - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { AttackStart(pWho); return true; @@ -88,7 +88,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho) void FollowerAI::MoveInLineOfSight(Unit* pWho) { - if (pWho->isTargetableForAttack() && pWho->isInAccessablePlaceFor(m_creature)) + if (pWho->IsTargetableForAttack() && pWho->IsInAccessablePlaceFor(m_creature)) { // AssistPlayerInCombat can start, so return if true if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho)) @@ -105,7 +105,7 @@ void FollowerAI::MoveInLineOfSight(Unit* pWho) float fAttackRadius = m_creature->GetAttackDistance(pWho); if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { pWho->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); AttackStart(pWho); @@ -154,8 +154,8 @@ void FollowerAI::JustRespawned() if (!IsCombatMovementEnabled()) SetCombatMovement(true); - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction) - m_creature->setFaction(m_creature->GetCreatureInfo()->faction); + if (m_creature->GetFactionTemplateId() != m_creature->GetCreatureInfo()->faction) + m_creature->SetFactionTemplateId(m_creature->GetCreatureInfo()->faction); Reset(); } @@ -211,7 +211,7 @@ void FollowerAI::EnterEvadeMode() void FollowerAI::UpdateAI(const uint32 uiDiff) { - if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim()) + if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->GetVictim()) { if (m_uiUpdateFollowTimer < uiDiff) { @@ -281,7 +281,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff) void FollowerAI::UpdateFollowerAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_CreatureSpells.empty()) @@ -320,7 +320,7 @@ void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId) void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest, float followDist) { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) { sLog.outDebug("FollowerAI attempt to StartFollow while in combat."); return; @@ -337,7 +337,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const m_uiFollowDistance = followDist; if (uiFactionForFollower) - m_creature->setFaction(uiFactionForFollower); + m_creature->SetFactionTemplateId(uiFactionForFollower); m_pQuestForFollow = pQuest; @@ -361,7 +361,7 @@ Player* FollowerAI::GetLeaderForFollower() { if (Player* pLeader = m_creature->GetMap()->GetPlayer(m_uiLeaderGUID)) { - if (pLeader->isAlive()) + if (pLeader->IsAlive()) return pLeader; if (Group* pGroup = pLeader->GetGroup()) @@ -370,7 +370,7 @@ Player* FollowerAI::GetLeaderForFollower() { Player* pMember = pRef->getSource(); - if (pMember && pMember->isAlive() && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) + if (pMember && pMember->IsAlive() && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) { sLog.outDebug("FollowerAI GetLeader changed and returned new leader."); m_uiLeaderGUID = pMember->GetGUID(); diff --git a/src/game/AI/ScriptedInstance.cpp b/src/game/AI/ScriptedInstance.cpp index 6232c2a21..cc594d417 100644 --- a/src/game/AI/ScriptedInstance.cpp +++ b/src/game/AI/ScriptedInstance.cpp @@ -132,7 +132,7 @@ Player* ScriptedInstance::GetPlayerInMap(bool bOnlyAlive /*=false*/, bool bCanBe for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && (!bOnlyAlive || pPlayer->isAlive()) && (bCanBeGamemaster || !pPlayer->IsGameMaster())) + if (pPlayer && (!bOnlyAlive || pPlayer->IsAlive()) && (bCanBeGamemaster || !pPlayer->IsGameMaster())) return pPlayer; } @@ -190,7 +190,7 @@ void ScriptedInstance_PTR::Update(uint32 diff) if (GetMap()) if (Creature* c = GetMap()->GetCreature(it->first)) { - if (!c->isAlive()) + if (!c->IsAlive()) c->DoKillUnit(); c->SaveRespawnTime(); c->AddObjectToRemoveList(); diff --git a/src/game/AI/ScriptedPetAI.cpp b/src/game/AI/ScriptedPetAI.cpp index b15125006..b6a5b029d 100644 --- a/src/game/AI/ScriptedPetAI.cpp +++ b/src/game/AI/ScriptedPetAI.cpp @@ -18,14 +18,14 @@ ScriptedPetAI::ScriptedPetAI(Creature* pCreature) : CreatureAI(pCreature) void ScriptedPetAI::MoveInLineOfSight(Unit* pWho) { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (!m_creature->GetCharmInfo() || !m_creature->GetCharmInfo()->HasReactState(REACT_AGGRESSIVE)) return; - if (!pWho || !m_creature->IsValidAttackTarget(pWho) || !pWho->isVisibleForOrDetect(m_creature, m_creature, true) || - !m_creature->CanInitiateAttack() || !pWho->isInAccessablePlaceFor(m_creature) || !m_creature->canAttack(pWho, true)) + if (!pWho || !m_creature->IsValidAttackTarget(pWho) || !pWho->IsVisibleForOrDetect(m_creature, m_creature, true) || + !m_creature->CanInitiateAttack() || !pWho->IsInAccessablePlaceFor(m_creature) || !m_creature->CanAttack(pWho, true)) return; if (!m_creature->CanFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) @@ -46,7 +46,7 @@ void ScriptedPetAI::AttackStart(Unit* pWho) void ScriptedPetAI::AttackedBy(Unit* pAttacker) { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (m_creature->GetCharmInfo() && !m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE) && @@ -90,15 +90,15 @@ void ScriptedPetAI::JustRespawned() void ScriptedPetAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->isAlive()) // should not be needed, isAlive is checked in mangos before calling UpdateAI + if (!m_creature->IsAlive()) // should not be needed, isAlive is checked in mangos before calling UpdateAI return; // UpdateAllies() is done in the generic PetAI in Mangos, but we can't do this from script side. // Unclear what side effects this has, but is something to be resolved from Mangos. - if (Unit * const pTarget = m_creature->getVictim()) // in combat + if (Unit * const pTarget = m_creature->GetVictim()) // in combat { - if (!pTarget->isTargetableForAttack()) + if (!pTarget->IsTargetableForAttack()) { // target no longer valid for pet, so either attack stops or new target are selected // doesn't normally reach this, because of how petAi is designed in Mangos. CombatStop @@ -123,11 +123,11 @@ void ScriptedPetAI::UpdateAI(const uint32 uiDiff) if (!pOwner) return; - if (pOwner->isInCombat() && !m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE)) + if (pOwner->IsInCombat() && !m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE)) { // Not correct in all cases. // When mob initiate attack by spell, pet should not start attack before spell landed. - if (Unit * const pTarget = pOwner->getAttackerForHelper()) + if (Unit * const pTarget = pOwner->GetAttackerForHelper()) { // Prevent scripted pets from breaking CC effects if (!pTarget->HasAuraPetShouldAvoidBreaking()) @@ -135,17 +135,17 @@ void ScriptedPetAI::UpdateAI(const uint32 uiDiff) else { // Main target is CC-ed, so pick another attacker. - Unit::AttackerSet attackers = pOwner->getAttackers(); + Unit::AttackerSet attackers = pOwner->GetAttackers(); for (Unit::AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr) { - if ((*itr)->IsInMap(m_creature) && (*itr)->isTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) + if ((*itr)->IsInMap(m_creature) && (*itr)->IsTargetableForAttack() && !(*itr)->HasAuraPetShouldAvoidBreaking()) { AttackStart((*itr)); return; } } // 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_STAT_FOLLOW)) m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } } @@ -153,7 +153,7 @@ void ScriptedPetAI::UpdateAI(const uint32 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_STAT_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 3ae5f919a..1f5865dd8 100644 --- a/src/game/AI/TotemAI.cpp +++ b/src/game/AI/TotemAI.cpp @@ -39,7 +39,7 @@ int TotemAI::Permissible(const Creature *creature) TotemAI::TotemAI(Creature *pCreature) : CreatureAI(pCreature) { - pCreature->addUnitState(UNIT_STAT_IGNORE_MOVE_LOS); + pCreature->AddUnitState(UNIT_STAT_IGNORE_MOVE_LOS); if (Totem const* pTotem = pCreature->ToTotem()) { @@ -68,7 +68,7 @@ void TotemAI::UpdateAI(const uint32 /*diff*/) if (m_totemType != TOTEM_ACTIVE) return; - if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false)) + if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false)) return; SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(m_spellId); @@ -83,11 +83,11 @@ void TotemAI::UpdateAI(const uint32 /*diff*/) // Check owner's attackers for targets. if (!victim && owner) - victim = owner->getAttackerForHelper(); + victim = owner->GetAttackerForHelper(); // Search for another target if current is invalid. if (!victim || !m_creature->IsWithinDistInMap(victim, max_range) || - !m_creature->IsValidAttackTarget(victim) || !victim->isVisibleForOrDetect(m_creature, m_creature, false)) + !m_creature->IsValidAttackTarget(victim) || !victim->IsVisibleForOrDetect(m_creature, m_creature, false)) { victim = nullptr; diff --git a/src/game/AdvancedPlayerBotAI.cpp b/src/game/AdvancedPlayerBotAI.cpp index 3af98a9ff..68b16a66b 100644 --- a/src/game/AdvancedPlayerBotAI.cpp +++ b/src/game/AdvancedPlayerBotAI.cpp @@ -39,7 +39,7 @@ void AdvancedPlayerBotAI::CommonAI(const uint32 delta) { if (Conditions.IsResurrectRequested) { - WorldPacket ResurrectAnswer(CMSG_RESURRECT_RESPONSE); + //WorldPacket ResurrectAnswer(CMSG_RESURRECT_RESPONSE); me->ResurectUsingRequestData(); } return; @@ -101,7 +101,7 @@ void AdvancedPlayerBotAI::WarriorAI(const uint32 delta) else { //Search - if (me->getVictim() == nullptr) + if (me->GetVictim() == nullptr) { if (Unit* NewTarget = me->SelectNearestTarget(50.0f)) { @@ -111,7 +111,7 @@ void AdvancedPlayerBotAI::WarriorAI(const uint32 delta) } else { - WarriorAttackTarget(me->getVictim()); + WarriorAttackTarget(me->GetVictim()); } } } @@ -218,7 +218,7 @@ void AdvancedPlayerBotAI::WarlockAI(const uint32 delta) else { //Search - if (me->getVictim() == nullptr) + if (me->GetVictim() == nullptr) { if (Unit* NewTarget = me->SelectNearestTarget(50.0f)) { @@ -227,7 +227,7 @@ void AdvancedPlayerBotAI::WarlockAI(const uint32 delta) } else { - WarlockBattleAI(me->getVictim()); + WarlockBattleAI(me->GetVictim()); } } @@ -299,12 +299,12 @@ void AdvancedPlayerBotAI::MageAI(const uint32 delta) //if we already cast something - no need to update if (me->IsNonMeleeSpellCasted(false)) return; - float range = me->isInCombat() ? 30.0f : frand(15, 30); + float range = me->IsInCombat() ? 30.0f : frand(15, 30); Unit* target = me->SelectNearestTarget(range); if (target && !me->IsWithinLOSInMap(target)) target = nullptr; // OOM ? - if (me->GetPower(POWER_MANA) < 40 && target && me->isInCombat()) + if (me->GetPower(POWER_MANA) < 40 && target && me->IsInCombat()) { if (me->Attack(target, true)) me->GetMotionMaster()->MoveChase(target); @@ -317,7 +317,7 @@ void AdvancedPlayerBotAI::MageAI(const uint32 delta) if (!me->HasSpellCooldown(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_STAT_CAN_NOT_MOVE)) { // already runing if (!me->movespline->Finalized()) @@ -352,7 +352,7 @@ void AdvancedPlayerBotAI::MageAI(const uint32 delta) return; } /// OUT OF COMBAT REGEN - if (!me->isInCombat() && me->GetPower(POWER_MANA) < 150) + if (!me->IsInCombat() && me->GetPower(POWER_MANA) < 150) { if (!me->movespline->Finalized()) me->StopMoving(); @@ -365,7 +365,7 @@ void AdvancedPlayerBotAI::GatherConditions() { SeenCreature = nullptr; - Conditions.IsDead = me->isDead(); + Conditions.IsDead = me->IsDead(); if (Conditions.IsDead) { Conditions.IsResurrectRequested = me->IsRessurectRequested(); @@ -393,11 +393,11 @@ void AdvancedPlayerBotAI::GatherConditions() } //Is attacked? - Conditions.IsAttacked = me->isInCombat(); + Conditions.IsAttacked = me->IsInCombat(); if (Conditions.IsAttacked) { - Unit::AttackerSet AttackerTable = me->getAttackers(); + Unit::AttackerSet AttackerTable = me->GetAttackers(); if (AttackerTable.size() == 0) { Conditions.IsAttacked = false; @@ -409,7 +409,7 @@ void AdvancedPlayerBotAI::GatherConditions() Unit* AdvancedPlayerBotAI::PickNearestAttacker() { - Unit::AttackerSet AttackerTable = me->getAttackers(); + Unit::AttackerSet AttackerTable = me->GetAttackers(); if (AttackerTable.size() > 0) { //pick nearest diff --git a/src/game/Anticheat/Anticheat.h b/src/game/Anticheat/Anticheat.h index 6e734972c..962a272b2 100644 --- a/src/game/Anticheat/Anticheat.h +++ b/src/game/Anticheat/Anticheat.h @@ -6,7 +6,8 @@ #define ANTICHEAT_H #include "Common.h" -#include "Unit.h" +#include "AbstractPlayer.h" +#include "UnitDefines.h" enum WardenActions { @@ -29,6 +30,11 @@ enum CheatAction CHEAT_MAX_ACTIONS, }; +class Unit; +class Player; +class MovementInfo; +class BigNumber; +class WorldPacket; class WorldSession; class ChatHandler; class WardenInterface; diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 25c07404b..22202fe05 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -613,7 +613,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit) // FIXME: found way for proper auctionhouse selection by another way // AuctionHouse.dbc have faction field with _player_ factions associated with auction house races. // but no easy way convert creature faction to player race faction for specific city - houseid = GetAuctionHouseId(unit->getFaction()); + houseid = GetAuctionHouseId(unit->GetFactionTemplateId()); } else { diff --git a/src/game/AuraRemovalMgr.cpp b/src/game/AuraRemovalMgr.cpp index 2eaccaebd..66580de17 100644 --- a/src/game/AuraRemovalMgr.cpp +++ b/src/game/AuraRemovalMgr.cpp @@ -21,7 +21,6 @@ #include "Database/DatabaseEnv.h" #include "Policies/SingletonImp.h" #include "Player.h" -#include "SpellEntry.h" #include "ProgressBar.h" INSTANTIATE_SINGLETON_1(AuraRemovalManager); diff --git a/src/game/AutoTesting/AutoTestingMgr.cpp b/src/game/AutoTesting/AutoTestingMgr.cpp index a50ed60fd..29c874a99 100644 --- a/src/game/AutoTesting/AutoTestingMgr.cpp +++ b/src/game/AutoTesting/AutoTestingMgr.cpp @@ -130,7 +130,7 @@ Player* SingleTest::GetTestPlayer(uint32 num, uint32 options) if (options & TESTPLAYER_MAXLEVEL) { p->GiveLevel(60); - p->SetPower(p->getPowerType(), p->GetMaxPower(p->getPowerType())); + p->SetPower(p->GetPowerType(), p->GetMaxPower(p->GetPowerType())); p->SetFullHealth(); } return p; diff --git a/src/game/AutoTesting/Tests/ChanneledSpells.cpp b/src/game/AutoTesting/Tests/ChanneledSpells.cpp index 94b4c0269..8c2fb5dd2 100644 --- a/src/game/AutoTesting/Tests/ChanneledSpells.cpp +++ b/src/game/AutoTesting/Tests/ChanneledSpells.cpp @@ -61,7 +61,7 @@ public: { Player* paladin = GetTestPlayer(0); Creature* necromancer = GetTestCreature(1); - TEST_ASSERT(paladin->isInCombat() && necromancer->isInCombat()); + TEST_ASSERT(paladin->IsInCombat() && necromancer->IsInCombat()); TEST_ASSERT(necromancer->HasAura(_spellId)); TEST_ASSERT(!paladin->HasAura(SPELL_SOUL_TAP)); Finish(); diff --git a/src/game/AutoTesting/Tests/Cinematics.cpp b/src/game/AutoTesting/Tests/Cinematics.cpp index 702bfcb88..b5f924671 100644 --- a/src/game/AutoTesting/Tests/Cinematics.cpp +++ b/src/game/AutoTesting/Tests/Cinematics.cpp @@ -23,7 +23,7 @@ public: static void AddSpells(Player* player) { uint32 familyName = 0; - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_MAGE: familyName = SPELLFAMILY_MAGE; @@ -56,7 +56,7 @@ public: for (uint32 id = 0; id < sSpellMgr.GetMaxSpellId(); id++) { SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(id); - if (spellInfo && spellInfo->SpellFamilyName == familyName && spellInfo->spellLevel <= player->getLevel()) + if (spellInfo && spellInfo->SpellFamilyName == familyName && spellInfo->spellLevel <= player->GetLevel()) player->LearnSpell(id, false); } } @@ -96,7 +96,7 @@ public: static void StuffLevel60(Player* p) { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARLOCK: AddStuff(p, 16931); @@ -169,7 +169,7 @@ public: static void AutoMountPlayer(Player* p, bool mount60 = false) { uint32 mount = 0; - switch (p->getRace()) + switch (p->GetRace()) { case RACE_HUMAN: mount = 18776; @@ -398,7 +398,7 @@ public: for (int i = step % 6; i < TARREN_CHARGE_NUM_PLAYERS; i += 6) { Player* p = GetTestPlayer(i); - if (p->getLevel() >= 40) + if (p->GetLevel() >= 40) AutoMountPlayer(p, true); } TEST_DELAY(40000)*/ @@ -656,26 +656,26 @@ public: static void SearchAndDestroy(Player* p) { - if (!p->isAlive()) return; + if (!p->IsAlive()) return; - Unit* target = p->getVictim(); + Unit* target = p->GetVictim(); if (target == nullptr) { - if (!p->isInCombat()) + if (!p->IsInCombat()) target = p->SelectRandomUnfriendlyTarget(nullptr, DEFAULT_VISIBILITY_DISTANCE); else { - target = p->getVictim(); + target = p->GetVictim(); if (target == nullptr) { - const std::set attackers = p->getAttackers(); + const std::set attackers = p->GetAttackers(); if (attackers.size() > 0) target = *attackers.begin(); } } } - if (target != nullptr && target->isAlive()) + if (target != nullptr && target->IsAlive()) { p->GetMotionMaster()->MoveChase(target); p->SetFacingToObject(target); @@ -825,26 +825,26 @@ public: static void SearchAndDestroy(Player* p) { - if (!p->isAlive()) return; + if (!p->IsAlive()) return; - Unit* target = p->getVictim(); + Unit* target = p->GetVictim(); if (target == nullptr) { - if (!p->isInCombat()) + if (!p->IsInCombat()) target = p->SelectRandomUnfriendlyTarget(nullptr, DEFAULT_VISIBILITY_DISTANCE); else { - target = p->getVictim(); + target = p->GetVictim(); if (target == nullptr) { - const std::set attackers = p->getAttackers(); + const std::set attackers = p->GetAttackers(); if (attackers.size() > 0) target = *attackers.begin(); } } } - if (target != nullptr && target->isAlive()) + if (target != nullptr && target->IsAlive()) { p->GetMotionMaster()->MoveChase(target); p->SetFacingToObject(target); @@ -1042,7 +1042,7 @@ public: static void SearchAndDestroy(Player* p) { - if (!p->isAlive()) return; + if (!p->IsAlive()) return; float x = p->GetPositionX(); float y = p->GetPositionY(); @@ -1058,7 +1058,7 @@ public: static void AddSkillsPlayer(Player* player) { - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_WARRIOR: player->LearnSpell(12294, false); @@ -1104,7 +1104,7 @@ public: { if (p->GetTeamId() == TEAM_ALLIANCE) { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); @@ -1159,7 +1159,7 @@ public: } else { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); @@ -1299,7 +1299,7 @@ public: static void SearchAndDestroy(Player* p) { - if (!p->isAlive()) return; + if (!p->IsAlive()) return; float x = p->GetPositionX(); float y = p->GetPositionY(); @@ -1315,7 +1315,7 @@ public: static void AddSkillsPlayer(Player* player) { - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_WARRIOR: player->LearnSpell(12294, false); @@ -1361,7 +1361,7 @@ public: { if (p->GetTeamId() == TEAM_ALLIANCE) { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); @@ -1416,7 +1416,7 @@ public: } else { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); @@ -1556,26 +1556,26 @@ public: static void SearchAndDestroy(Player* p) { - if (!p->isAlive()) return; + if (!p->IsAlive()) return; - Unit* target = p->getVictim(); + Unit* target = p->GetVictim(); if (target == nullptr) { - if (!p->isInCombat()) + if (!p->IsInCombat()) target = p->SelectRandomUnfriendlyTarget(nullptr, DEFAULT_VISIBILITY_DISTANCE); else { - target = p->getVictim(); + target = p->GetVictim(); if (target == nullptr) { - const std::set attackers = p->getAttackers(); + const std::set attackers = p->GetAttackers(); if (attackers.size() > 0) target = *attackers.begin(); } } } - if (target != nullptr && target->isAlive()) + if (target != nullptr && target->IsAlive()) { p->GetMotionMaster()->MoveChase(target); p->SetFacingToObject(target); @@ -1600,7 +1600,7 @@ public: static void AddSkillsPlayer(Player* player) { - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_WARRIOR: player->LearnSpell(12294, false); @@ -1646,7 +1646,7 @@ public: { if (p->GetTeamId() == TEAM_ALLIANCE) { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); @@ -1701,7 +1701,7 @@ public: } else { - switch (p->getClass()) + switch (p->GetClass()) { case CLASS_WARRIOR: AddStuff(p, 16865); diff --git a/src/game/AutoTesting/Tests/ControlSpells.cpp b/src/game/AutoTesting/Tests/ControlSpells.cpp index e525e241c..993af96b4 100644 --- a/src/game/AutoTesting/Tests/ControlSpells.cpp +++ b/src/game/AutoTesting/Tests/ControlSpells.cpp @@ -81,7 +81,7 @@ public: break; case 2: TEST_ASSERT(necromancer->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE); - TEST_ASSERT(necromancer->getVictim() == hunt); + TEST_ASSERT(necromancer->GetVictim() == hunt); DoPlayerCast(0, 2, spellId); Wait(4000); break; @@ -147,7 +147,7 @@ public: Player* warlock = GetTestPlayer(0); Player* mage = GetTestPlayer(1); Creature* necromancer = GetTestCreature(2); - TEST_ASSERT(mage->isInCombat() && warlock->isInCombat() && necromancer->isInCombat()); + TEST_ASSERT(mage->IsInCombat() && warlock->IsInCombat() && necromancer->IsInCombat()); TEST_ASSERT(necromancer->HasAura(SHEEP_R4)); TEST_ASSERT(necromancer->HasAura(FEAR_R1)); necromancer->RemoveAllAuras(); diff --git a/src/game/AutoTesting/Tests/Generic.cpp b/src/game/AutoTesting/Tests/Generic.cpp index 6c1907f48..582f94e2d 100644 --- a/src/game/AutoTesting/Tests/Generic.cpp +++ b/src/game/AutoTesting/Tests/Generic.cpp @@ -83,8 +83,8 @@ public: TEST_ASSERT(!player2->duel); TEST_ASSERT(player1->GetPet()); TEST_ASSERT(player2->GetPet()); - TEST_ASSERT(!player1->GetPet()->isInCombat()); - TEST_ASSERT(!player2->GetPet()->isInCombat()); + TEST_ASSERT(!player1->GetPet()->IsInCombat()); + TEST_ASSERT(!player2->GetPet()->IsInCombat()); Finish(); break; } diff --git a/src/game/AutoTesting/Tests/Test.cpp b/src/game/AutoTesting/Tests/Test.cpp index 0e389f8bc..435d04872 100644 --- a/src/game/AutoTesting/Tests/Test.cpp +++ b/src/game/AutoTesting/Tests/Test.cpp @@ -69,7 +69,7 @@ public: Player* p = GetTestPlayer(0); if (!p) Fail("Unable to summon a player"); - else if (p->getClass() != CLASS_WARLOCK && p->getRace() != RACE_GNOME) + else if (p->GetClass() != CLASS_WARLOCK && p->GetRace() != RACE_GNOME) Fail("Bad class or race"); else if (p->FindMap() != GetMap()) Fail("Bad map"); @@ -119,7 +119,7 @@ public: Player* p = GetTestPlayer(0); if (!p) Fail("Unable to summon a player"); - else if (p->getClass() != CLASS_WARLOCK && p->getRace() != RACE_GNOME) + else if (p->GetClass() != CLASS_WARLOCK && p->GetRace() != RACE_GNOME) Fail("Bad player class or race"); else if (p->FindMap() != GetMap()) Fail("Bad player map"); diff --git a/src/game/AutoTesting/Tests/TestPCH.h b/src/game/AutoTesting/Tests/TestPCH.h index 02dc99afc..e94a8decf 100644 --- a/src/game/AutoTesting/Tests/TestPCH.h +++ b/src/game/AutoTesting/Tests/TestPCH.h @@ -17,7 +17,6 @@ #include "Player.h" #include "Spell.h" #include "SpellAuras.h" -#include "Unit.h" #include "VMapFactory.h" #include "World.h" diff --git a/src/game/AutoTesting/Tests/Warlock.cpp b/src/game/AutoTesting/Tests/Warlock.cpp index 14c0bfddd..c9605a39d 100644 --- a/src/game/AutoTesting/Tests/Warlock.cpp +++ b/src/game/AutoTesting/Tests/Warlock.cpp @@ -251,7 +251,7 @@ public: Player* p = GetTestPlayer(0); TEST_ASSERT(p->IsNonMeleeSpellCasted()); TEST_ASSERT(p->GetPet()); - TEST_ASSERT(p->GetPet()->hasUnitState(UNIT_STAT_STUNNED)); + TEST_ASSERT(p->GetPet()->HasUnitState(UNIT_STAT_STUNNED)); Finish(); break; } @@ -344,7 +344,7 @@ public: { Player* warlock = GetTestPlayer(0); Player* victim = GetTestPlayer(1); - TEST_ASSERT(!victim->isAlive()); + TEST_ASSERT(!victim->IsAlive()); TEST_ASSERT(warlock->HasItemCount(ITEM_SOULSHARD, 1)); Finish(); break; diff --git a/src/game/Battlegrounds/BattleGround.cpp b/src/game/Battlegrounds/BattleGround.cpp index ee5c8faed..25064fc4d 100644 --- a/src/game/Battlegrounds/BattleGround.cpp +++ b/src/game/Battlegrounds/BattleGround.cpp @@ -624,7 +624,7 @@ void BattleGround::EndBattleGround(Team winner) if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); - if (!plr->isAlive()) + if (!plr->IsAlive()) { plr->ResurrectPlayer(1.0f); plr->SpawnCorpseBones(); @@ -633,7 +633,7 @@ void BattleGround::EndBattleGround(Team winner) { //needed cause else in av some creatures will kill the players at the end plr->CombatStop(); - plr->getHostileRefManager().deleteReferences(); + plr->GetHostileRefManager().deleteReferences(); } if (team == winner) @@ -850,7 +850,7 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); - if (plr && !plr->isAlive()) // resurrect on exit + if (plr && !plr->IsAlive()) // resurrect on exit { plr->ResurrectPlayer(1.0f); plr->SpawnCorpseBones(); @@ -1601,7 +1601,7 @@ void BattleGround::HandleKillPlayer(Player *player, Player *killer) // - Apres la fin du buff - a ce moment la killer=nullptr // add +1 kills to group and +1 killing_blows to killer - if (killer && player->getFaction() != killer->getFaction()) + if (killer && player->GetFactionTemplateId() != killer->GetFactionTemplateId()) { UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1); UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1); @@ -1669,7 +1669,7 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const if (itr->second.PlayerTeam == team) { Player * pl = sObjectMgr.GetPlayer(itr->first); - if (pl && pl->isAlive()) + if (pl && pl->IsAlive()) ++count; } } diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index b9a40048f..21183b633 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -394,6 +394,7 @@ set (game_SRCS Objects/TemporarySummon.h Objects/Totem.h Objects/Unit.h + Objects/UnitDefines.h Objects/UpdateData.h Objects/UpdateFields.h Objects/UpdateMask.h @@ -410,6 +411,7 @@ set (game_SRCS Spells/SpellAuraDefines.h Spells/SpellAuras.h Spells/SpellClassMask.h + Spells/SpellDefines.h Spells/SpellEntry.h Spells/SpellMgr.h Spells/SpellModMgr.h diff --git a/src/game/Chat/AsyncCommandHandlers.cpp b/src/game/Chat/AsyncCommandHandlers.cpp index 80605dff5..ab2cb7cd8 100644 --- a/src/game/Chat/AsyncCommandHandlers.cpp +++ b/src/game/Chat/AsyncCommandHandlers.cpp @@ -28,7 +28,6 @@ #include "Chat.h" #include "GameEventMgr.h" #include "ScriptMgr.h" -#include "SpellMgr.h" #include "AccountMgr.h" #include "DBCStores.h" #include "Util.h" @@ -48,11 +47,11 @@ void PInfoHandler::HandlePInfoCommand(WorldSession *session, Player *target, Obj data->accId = target->GetSession()->GetAccountId(); data->money = target->GetMoney(); data->total_player_time = target->GetTotalPlayedTime(); - data->level = target->getLevel(); + data->level = target->GetLevel(); data->latency = target->GetSession()->GetLatency(); data->loc = target->GetSession()->GetSessionDbcLocale(); - data->race = target->getRace(); - data->class_ = target->getClass(); + data->race = target->GetRace(); + data->class_ = target->GetClass(); data->target_guid = target->GetObjectGuid(); data->online = true; diff --git a/src/game/CinematicStuff/CinematicStuff.cpp b/src/game/CinematicStuff/CinematicStuff.cpp index 40428cbc0..c7f9a762a 100644 --- a/src/game/CinematicStuff/CinematicStuff.cpp +++ b/src/game/CinematicStuff/CinematicStuff.cpp @@ -3,7 +3,7 @@ #include "Player.h" #include "ObjectMgr.h" #include "MoveMapSharedDefines.h" - +#include "WorldPacket.h" void CinematicStuff::AddStuff(Player* player, uint32 itemID) { @@ -25,7 +25,7 @@ void CinematicStuff::AddStuff(Player* player, uint32 itemID) void CinematicStuff::AddSpells(Player* player) { uint32 familyName = 0; - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_MAGE: familyName = SPELLFAMILY_MAGE; @@ -58,7 +58,7 @@ void CinematicStuff::AddSpells(Player* player) for (uint32 id = 0; id < sSpellMgr.GetMaxSpellId(); id++) { SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(id); - if (spellInfo && spellInfo->SpellFamilyName == familyName && spellInfo->spellLevel <= player->getLevel()) + if (spellInfo && spellInfo->SpellFamilyName == familyName && spellInfo->spellLevel <= player->GetLevel()) player->LearnSpell(id, false); } } @@ -83,7 +83,7 @@ void CinematicStuff::Mount(Player* p, uint32 mountItem) void CinematicStuff::StuffLevel60(Player* player) { - switch (player->getClass()) + switch (player->GetClass()) { case CLASS_WARLOCK: AddStuff(player, 16931); @@ -149,7 +149,7 @@ void CinematicStuff::StuffLevel60(Player* player) void CinematicStuff::AutoMountPlayer(Player* player, bool mount60 /*= false*/) { uint32 mount = 0; - switch (player->getRace()) + switch (player->GetRace()) { case RACE_HUMAN: mount = 18776; @@ -213,26 +213,26 @@ void CinematicStuff::JumpPlayer(Player* player) void CinematicStuff::SearchAndDestroy(Player* player) { - if (!player->isAlive()) return; + if (!player->IsAlive()) return; - Unit* target = player->getVictim(); + Unit* target = player->GetVictim(); if (target == nullptr) { - if (!player->isInCombat()) + if (!player->IsInCombat()) target = player->SelectRandomUnfriendlyTarget(nullptr, DEFAULT_VISIBILITY_DISTANCE); else { - target = player->getVictim(); + target = player->GetVictim(); if (target == nullptr) { - const std::set attackers = player->getAttackers(); + const std::set attackers = player->GetAttackers(); if (attackers.size() > 0) target = *attackers.begin(); } } } - if (target != nullptr && target->isAlive()) + if (target != nullptr && target->IsAlive()) { player->GetMotionMaster()->MoveChase(target); player->SetFacingToObject(target); diff --git a/src/game/Commands/CharacterCommands.cpp b/src/game/Commands/CharacterCommands.cpp index 277a50177..3818c69f7 100644 --- a/src/game/Commands/CharacterCommands.cpp +++ b/src/game/Commands/CharacterCommands.cpp @@ -194,7 +194,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args) if (Creature* pCreature = GetSelectedCreature()) { - int32 newlevel = pCreature->getLevel() + addlevel; + int32 newlevel = pCreature->GetLevel() + addlevel; if (newlevel < 1) newlevel = 1; @@ -217,7 +217,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args) if (!ExtractPlayerTarget(&nameStr, &target, &target_guid, &target_name)) return false; - int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 oldlevel = target ? target->GetLevel() : Player::GetLevelFromDB(target_guid); int32 newlevel = oldlevel + addlevel; if (newlevel < 1) @@ -1354,7 +1354,7 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args) if (!ExtractPlayerTarget(&nameStr, &target, &target_guid, &target_name)) return false; - int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 oldlevel = target ? target->GetLevel() : Player::GetLevelFromDB(target_guid); if (nolevel) newlevel = oldlevel; @@ -2460,7 +2460,7 @@ bool ChatHandler::HandleLearnAllMyClassCommand(char* /*args*/) bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) { Player* pPlayer = m_session->GetPlayer(); - ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(pPlayer->getClass()); + ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(pPlayer->GetClass()); if (!clsEntry) return true; uint32 family = clsEntry->spellfamily; @@ -2506,7 +2506,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) bool ChatHandler::HandleLearnAllMyTalentsCommand(char* /*args*/) { Player* pPlayer = m_session->GetPlayer(); - uint32 classMask = pPlayer->getClassMask(); + uint32 classMask = pPlayer->GetClassMask(); for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { @@ -2600,7 +2600,7 @@ bool ChatHandler::HandleLearnAllDefaultCommand(char* args) void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) { - uint32 classmask = player->getClassMask(); + uint32 classmask = player->GetClassMask(); for (uint32 j = 0; j < sObjectMgr.GetMaxSkillLineAbilityId(); ++j) { @@ -3344,10 +3344,10 @@ bool ChatHandler::HandleResetHonorCommand(char* args) static bool HandleResetStatsOrLevelHelper(Player* player) { - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass()); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->GetClass()); if (!cEntry) { - sLog.outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + sLog.outError("Class %u not found in DBC (Wrong DBC files?)", player->GetClass()); return false; } @@ -3360,7 +3360,7 @@ static bool HandleResetStatsOrLevelHelper(Player* player) player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); player->SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f); - player->SetFactionForRace(player->getRace()); + player->SetFactionForRace(player->GetRace()); player->SetByteValue(UNIT_FIELD_BYTES_0, 3, powertype); @@ -3745,7 +3745,7 @@ bool ChatHandler::HandleModifyGenderCommand(char *args) return false; } - PlayerInfo const* info = sObjectMgr.GetPlayerInfo(player->getRace(), player->getClass()); + PlayerInfo const* info = sObjectMgr.GetPlayerInfo(player->GetRace(), player->GetClass()); if (!info) return false; @@ -3756,14 +3756,14 @@ bool ChatHandler::HandleModifyGenderCommand(char *args) if (!strncmp(gender_str, "male", gender_len)) // MALE { - if (player->getGender() == GENDER_MALE) + if (player->GetGender() == GENDER_MALE) return true; gender = GENDER_MALE; } else if (!strncmp(gender_str, "female", gender_len)) // FEMALE { - if (player->getGender() == GENDER_FEMALE) + if (player->GetGender() == GENDER_FEMALE) return true; gender = GENDER_FEMALE; @@ -5138,6 +5138,6 @@ bool ChatHandler::HandleCombatStopCommand(char* args) return false; target->CombatStop(); - target->getHostileRefManager().deleteReferences(); + target->GetHostileRefManager().deleteReferences(); return true; } \ No newline at end of file diff --git a/src/game/Commands/CreatureCommands.cpp b/src/game/Commands/CreatureCommands.cpp index 06eaf4486..29d4b1f39 100644 --- a/src/game/Commands/CreatureCommands.cpp +++ b/src/game/Commands/CreatureCommands.cpp @@ -49,7 +49,7 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) return false; } - uint32 faction = target->getFaction(); + uint32 faction = target->GetFactionTemplateId(); uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS); uint32 displayid = target->GetDisplayId(); uint32 nativeid = target->GetNativeDisplayId(); @@ -63,13 +63,13 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true); PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid); - PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); + PSendSysMessage(LANG_NPCINFO_LEVEL, target->GetLevel()); PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId()); PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); - if (target->getPowerType() == POWER_MANA) + if (target->GetPowerType() == POWER_MANA) PSendSysMessage(LANG_NPCINFO_MANA, target->GetCreateMana(), target->GetMaxPower(POWER_MANA), target->GetPower(POWER_MANA)); PSendSysMessage(LANG_NPCINFO_INHABIT_TYPE, cInfo->inhabit_type); - PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); + PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->GetFactionTemplateId()); PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str()); PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->loot_id, cInfo->pickpocket_loot_id, cInfo->skinning_loot_id); PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor()); @@ -225,7 +225,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(char* args) return false; } - pCreature->setFaction(factionId); + pCreature->SetFactionTemplateId(factionId); // faction is set in creature_template - not inside creature @@ -351,7 +351,7 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/) return false; } - if (target->isDead()) + if (target->IsDead()) ((Creature*)target)->Respawn(); return true; } @@ -389,7 +389,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args) pCreature->SetRespawnRadius((float)option); pCreature->SetDefaultMovementType(mtype); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -819,7 +819,7 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(char* args) return false; Creature* vendor = GetSelectedCreature(); - if (!vendor || !vendor->isVendor()) + if (!vendor || !vendor->IsVendor()) { SendSysMessage(LANG_COMMAND_VENDORSELECTION); SetSentErrorMessage(true); @@ -888,7 +888,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) if (pCreature) { pCreature->SetHomePosition(x, y, z, o); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -982,7 +982,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args) { pCreature->SetDefaultMovementType(move_type); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->IsAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -1668,7 +1668,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) { wpOwner->SetDefaultMovementType(RANDOM_MOTION_TYPE); wpOwner->GetMotionMaster()->Initialize(); - if (wpOwner->isAlive()) // Dead creature will reset movement generator at respawn + if (wpOwner->IsAlive()) // Dead creature will reset movement generator at respawn { wpOwner->SetDeathState(JUST_DIED); wpOwner->Respawn(); diff --git a/src/game/Commands/DebugCommands.cpp b/src/game/Commands/DebugCommands.cpp index 638426322..f774d5a1d 100644 --- a/src/game/Commands/DebugCommands.cpp +++ b/src/game/Commands/DebugCommands.cpp @@ -27,7 +27,6 @@ #include "Opcodes.h" #include "Chat.h" #include "Log.h" -#include "Unit.h" #include "GossipDef.h" #include "Language.h" #include "BattleGroundMgr.h" @@ -2092,13 +2091,13 @@ bool ChatHandler::HandleUnitStatCommand(char *args) return false; uint32 unitStat = 0x0; for (int i = 1; i < UNIT_STAT_IGNORE_PATHFINDING; i *= 2) - if (pTarget->hasUnitState(i)) + if (pTarget->HasUnitState(i)) unitStat |= i; PSendSysMessage("UnitState = 0x%x (%u)", unitStat, unitStat); if (ExtractUInt32(&args, unitStat)) { - pTarget->clearUnitState(UNIT_STAT_ALL_STATE); - pTarget->addUnitState(unitStat); + pTarget->ClearUnitState(UNIT_STAT_ALL_STATE); + pTarget->AddUnitState(unitStat); PSendSysMessage("UnitState changed to 0x%x (%u)", unitStat, unitStat); } return true; diff --git a/src/game/Commands/TeleportCommands.cpp b/src/game/Commands/TeleportCommands.cpp index 16bab1e08..ea0d2d3c5 100644 --- a/src/game/Commands/TeleportCommands.cpp +++ b/src/game/Commands/TeleportCommands.cpp @@ -1052,7 +1052,7 @@ bool ChatHandler::HandleStartCommand(char* /*args*/) return false; } - if (chr->isInCombat()) + if (chr->IsInCombat()) { SendSysMessage(LANG_YOU_IN_COMBAT); SetSentErrorMessage(true); @@ -1071,13 +1071,13 @@ bool ChatHandler::HandleUnstuckCommand(char* /*args*/) if (!pPlayer) return false; - if (pPlayer->isInCombat() || pPlayer->InBattleGround() || pPlayer->IsTaxiFlying() || pPlayer->HasSpellCooldown(20939) || (pPlayer->getDeathState() == CORPSE) || (pPlayer->getLevel() < 10)) + if (pPlayer->IsInCombat() || pPlayer->InBattleGround() || pPlayer->IsTaxiFlying() || pPlayer->HasSpellCooldown(20939) || (pPlayer->GetDeathState() == CORPSE) || (pPlayer->GetLevel() < 10)) { SendSysMessage(LANG_UNSTUCK_UNAVAILABLE); return false; } - if (pPlayer->isAlive()) + if (pPlayer->IsAlive()) { pPlayer->CastSpell(pPlayer, 20939, false); SendSysMessage(LANG_UNSTUCK_ALIVE); diff --git a/src/game/Commands/UnitCommands.cpp b/src/game/Commands/UnitCommands.cpp index 62c73ac0d..563f8cf00 100644 --- a/src/game/Commands/UnitCommands.cpp +++ b/src/game/Commands/UnitCommands.cpp @@ -536,7 +536,7 @@ bool ChatHandler::HandleCastTargetCommand(char* args) return false; } - if (!caster->getVictim()) + if (!caster->GetVictim()) { SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM); SetSentErrorMessage(true); @@ -554,7 +554,7 @@ bool ChatHandler::HandleCastTargetCommand(char* args) caster->SetFacingToObject(m_session->GetPlayer()); - caster->CastSpell(caster->getVictim(), spell, triggered); + caster->CastSpell(caster->GetVictim(), spell, triggered); return true; } @@ -698,7 +698,7 @@ bool ChatHandler::HandleModifyStaminaCommand(char *args) pTarget->SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE, (float)amount); pTarget->UpdateAllStats(); - if (pTarget->isAlive()) + if (pTarget->IsAlive()) pTarget->SetHealth(pTarget->GetMaxHealth()); PSendSysMessage(LANG_YOU_CHANGE_STA, pTarget->GetName(), amount); @@ -1340,7 +1340,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) { if (chr) { - uint32 factionid = chr->getFaction(); + uint32 factionid = chr->GetFactionTemplateId(); uint32 flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS); uint32 npcflag = chr->GetUInt32Value(UNIT_NPC_FLAGS); uint32 dyflag = chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS); @@ -1381,7 +1381,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) PSendSysMessage(LANG_YOU_CHANGE_FACTION, chr->GetGUIDLow(), factionid, flag, npcflag, dyflag); - chr->setFaction(factionid); + chr->SetFactionTemplateId(factionid); chr->SetUInt32Value(UNIT_FIELD_FLAGS, flag); chr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag); chr->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag); @@ -1556,7 +1556,7 @@ bool ChatHandler::HandleModifyManaCommand(char* args) bool ChatHandler::HandleReplenishCommand(char* args) { Unit *pUnit = GetSelectedUnit(); - if (!pUnit || !pUnit->isAlive()) + if (!pUnit || !pUnit->IsAlive()) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -1565,7 +1565,7 @@ bool ChatHandler::HandleReplenishCommand(char* args) pUnit->SetHealth(pUnit->GetMaxHealth()); - if (pUnit->getPowerType() == POWER_MANA) + if (pUnit->GetPowerType() == POWER_MANA) pUnit->SetPower(POWER_MANA, pUnit->GetMaxPower(POWER_MANA)); return true; @@ -1585,7 +1585,7 @@ bool ChatHandler::HandleDamageCommand(char* args) return false; } - if (!target->isAlive()) + if (!target->IsAlive()) return true; int32 damage_int; @@ -1847,7 +1847,7 @@ bool ChatHandler::HandleDieHelper(Unit* target) return false; } - if (target->isAlive()) + if (target->IsAlive()) { if (sWorld.getConfig(CONFIG_BOOL_DIE_COMMAND_CREDIT)) m_session->GetPlayer()->DealDamage(target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); diff --git a/src/game/Conditions.cpp b/src/game/Conditions.cpp index d65b36730..d126e7c7e 100644 --- a/src/game/Conditions.cpp +++ b/src/game/Conditions.cpp @@ -221,7 +221,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, case CONDITION_RACE_CLASS: { Player const* pPlayer = target->ToPlayer(); - if ((!m_value1 || (pPlayer->getRaceMask() & m_value1)) && (!m_value2 || (pPlayer->getClassMask() & m_value2))) + if ((!m_value1 || (pPlayer->GetRaceMask() & m_value1)) && (!m_value2 || (pPlayer->GetClassMask() & m_value2))) return true; return false; } @@ -231,11 +231,11 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, switch (m_value2) { case 0: - return pTarget->getLevel() == m_value1; + return pTarget->GetLevel() == m_value1; case 1: - return pTarget->getLevel() >= m_value1; + return pTarget->GetLevel() >= m_value1; case 2: - return pTarget->getLevel() <= m_value1; + return pTarget->GetLevel() <= m_value1; } return false; } @@ -307,11 +307,11 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, const Player* pTarget = ToPlayer(target); if (m_value1 & CF_ESCORT_SOURCE_DEAD) - if (!pSource || pSource->isDead()) + if (!pSource || pSource->IsDead()) return true; if (m_value1 & CF_ESCORT_TARGET_DEAD) - if (!pTarget || pTarget->isDead() || !pTarget->IsInWorld()) + if (!pTarget || pTarget->IsDead() || !pTarget->IsInWorld()) return true; if (m_value2) @@ -326,7 +326,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } case CONDITION_GENDER: { - return target->getGender() == m_value1; + return target->GetGender() == m_value1; } case CONDITION_SKILL_BELOW: { @@ -475,7 +475,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } case CONDITION_IS_IN_COMBAT: { - return target->ToUnit()->isInCombat(); + return target->ToUnit()->IsInCombat(); } case CONDITION_IS_HOSTILE_TO: { @@ -487,7 +487,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } case CONDITION_IS_ALIVE: { - return target->ToUnit()->isAlive(); + return target->ToUnit()->IsAlive(); } case CONDITION_MAP_EVENT_TARGETS: { diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index f3cb2223c..c2e3c58d4 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -57,7 +57,7 @@ void CreatureGroup::OnMemberDied(Creature* member) { if (member->GetObjectGuid() != GetLeaderGuid()) if (Creature* groupLeader = member->GetMap()->GetCreature(GetLeaderGuid())) - if (groupLeader->IsInWorld() && groupLeader->isAlive() && groupLeader->AI()) + if (groupLeader->IsInWorld() && groupLeader->IsAlive() && groupLeader->AI()) groupLeader->AI()->GroupMemberJustDied(member, false); } if (_options & OPTION_INFORM_MEMBERS_ON_ANY_DIED) @@ -65,7 +65,7 @@ void CreatureGroup::OnMemberDied(Creature* member) for (const auto& itr : _members) if (itr.first != member->GetObjectGuid()) if (Creature* otherMember = member->GetMap()->GetCreature(itr.first)) - if (otherMember->IsInWorld() && otherMember->isAlive() && otherMember->AI()) + if (otherMember->IsInWorld() && otherMember->IsAlive() && otherMember->AI()) otherMember->AI()->GroupMemberJustDied(member, member->GetObjectGuid() == GetLeaderGuid()); } } @@ -78,12 +78,12 @@ void CreatureGroup::OnLeaveCombat(Creature* member) for (const auto& itr : _members) if (itr.first != member->GetObjectGuid()) if (Creature* otherMember = member->GetMap()->GetCreature(itr.first)) - if (otherMember->IsInWorld() && otherMember->isAlive() && otherMember->AI()) + if (otherMember->IsInWorld() && otherMember->IsAlive() && otherMember->AI()) otherMember->AI()->EnterEvadeMode(); if (member->GetObjectGuid() != GetLeaderGuid()) if (Creature* otherMember = member->GetMap()->GetCreature(GetLeaderGuid())) - if (otherMember->IsInWorld() && otherMember->isAlive() && otherMember->AI()) + if (otherMember->IsInWorld() && otherMember->IsAlive() && otherMember->AI()) { masterEvade = true; otherMember->AI()->EnterEvadeMode(); @@ -128,7 +128,7 @@ void CreatureGroup::Respawn(Creature* member, CreatureGroupMember const* memberE if (Unit* leader = member->GetMap()->GetUnit(GetLeaderGuid())) { float x, y, z; - if (leader->isAlive() || leader->GetTypeId() != TYPEID_UNIT) + if (leader->IsAlive() || leader->GetTypeId() != TYPEID_UNIT) leader->GetPosition(x, y, z); else leader->ToCreature()->GetRespawnCoord(x, y, z); @@ -147,10 +147,10 @@ void CreatureGroup::MemberAssist(Creature* member, Unit *target) if (!member || !member->IsInWorld()) return; - if (!member->isAlive()) + if (!member->IsAlive()) return; - if (member->getVictim()) + if (member->GetVictim()) return; if (member->AI()) @@ -180,7 +180,7 @@ void CreatureGroup::DisbandGroup(Creature* pMember) if (Creature* pOtherMember = pMember->GetMap()->GetCreature(it.first)) { pOtherMember->SetCreatureGroup(nullptr); - if (IsFormation() && pOtherMember->isAlive()) + if (IsFormation() && pOtherMember->IsAlive()) pOtherMember->GetMotionMaster()->Initialize(); } diff --git a/src/game/Formulas.h b/src/game/Formulas.h index cd31fad25..f914d71c1 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -114,10 +114,10 @@ namespace MaNGOS if (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) return 0; - if (pCreature->hasUnitState(UNIT_STAT_NO_KILL_REWARD)) + if (pCreature->HasUnitState(UNIT_STAT_NO_KILL_REWARD)) return 0; - uint32 xp_gain = BaseGain(pPlayer->getLevel(), pUnit->getLevel()); + uint32 xp_gain = BaseGain(pPlayer->GetLevel(), pUnit->GetLevel()); if (!xp_gain) return 0; @@ -161,10 +161,10 @@ namespace MaNGOS if(pUnit->GetTypeId()==TYPEID_UNIT && ( (pUnit->GetUInt32Value(UNIT_CREATED_BY_SPELL) && !isPet) || (((Creature*)pUnit)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) || - pUnit->hasUnitState(UNIT_STAT_NO_KILL_REWARD))) + pUnit->HasUnitState(UNIT_STAT_NO_KILL_REWARD))) return 0; - uint32 xp_gain= BaseGain(pPet->getLevel(), pUnit->getLevel()); + uint32 xp_gain= BaseGain(pPet->GetLevel(), pUnit->GetLevel()); if( xp_gain == 0 ) return 0; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 964f87d70..a3dec6765 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -85,8 +85,8 @@ void GossipMenu::AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32 { uint32 loc_idx = m_session->GetSessionDbLocaleIndex(); - char const* item_text = itemText ? (itemText > 0 ? sObjectMgr.GetBroadcastText(itemText, loc_idx, GetMenuSession()->GetPlayer()->getGender()) : sObjectMgr.GetMangosString(itemText, loc_idx)) : ""; - char const* box_text = boxText ? (boxText > 0 ? sObjectMgr.GetBroadcastText(boxText, loc_idx, GetMenuSession()->GetPlayer()->getGender()) : sObjectMgr.GetMangosString(boxText, loc_idx)) : ""; + char const* item_text = itemText ? (itemText > 0 ? sObjectMgr.GetBroadcastText(itemText, loc_idx, GetMenuSession()->GetPlayer()->GetGender()) : sObjectMgr.GetMangosString(itemText, loc_idx)) : ""; + char const* box_text = boxText ? (boxText > 0 ? sObjectMgr.GetBroadcastText(boxText, loc_idx, GetMenuSession()->GetPlayer()->GetGender()) : sObjectMgr.GetMangosString(boxText, loc_idx)) : ""; AddMenuItem(Icon, std::string(item_text), dtSender, dtAction, std::string(box_text), Coded); } diff --git a/src/game/Group/CreatureLinkingMgr.cpp b/src/game/Group/CreatureLinkingMgr.cpp index e31785562..7a74a989b 100644 --- a/src/game/Group/CreatureLinkingMgr.cpp +++ b/src/game/Group/CreatureLinkingMgr.cpp @@ -468,17 +468,17 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp if (pMaster->IsControlledByPlayer()) return; - if (pMaster->isInCombat()) + if (pMaster->IsInCombat()) pMaster->SetInCombatWith(pEnemy); else pMaster->AI()->AttackStart(pEnemy); break; case LINKING_EVENT_EVADE: - if (!pMaster->isAlive()) + if (!pMaster->IsAlive()) pMaster->Respawn(); break; case LINKING_EVENT_RESPAWN: - if (pMaster->isAlive()) + if (pMaster->IsAlive()) SetFollowing(pSource, pMaster); break; case LINKING_EVENT_DIE: // Nothing linked for this case @@ -529,7 +529,7 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur if (pSlave->IsControlledByPlayer()) return; - if (pSlave->isInCombat()) + if (pSlave->IsInCombat()) { if (pSource->GetMap()->IsDungeon() && (pSource->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_AGGRO_ZONE)) pSlave->SetInCombatWithZone(); @@ -544,30 +544,30 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur } break; case LINKING_EVENT_EVADE: - if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->isAlive()) + if (flag & FLAG_DESPAWN_ON_EVADE && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->isAlive()) + if (flag & FLAG_RESPAWN_ON_EVADE && !pSlave->IsAlive()) pSlave->Respawn(); break; case LINKING_EVENT_DIE: - if (flag & FLAG_SELFKILL_ON_DEATH && pSlave->isAlive()) + if (flag & FLAG_SELFKILL_ON_DEATH && pSlave->IsAlive()) pSlave->DealDamage(pSlave, pSlave->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); - if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->isAlive()) + if (flag & FLAG_DESPAWN_ON_DEATH && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->isAlive()) + if (flag & FLAG_RESPAWN_ON_DEATH && !pSlave->IsAlive()) pSlave->Respawn(); break; case LINKING_EVENT_RESPAWN: if (flag & FLAG_RESPAWN_ON_RESPAWN) { // Additional check to prevent endless loops (in case whole group respawns on first respawn) - if (!pSlave->isAlive() && pSlave->GetRespawnTime() > time(nullptr)) + if (!pSlave->IsAlive() && pSlave->GetRespawnTime() > time(nullptr)) pSlave->Respawn(); } - else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->isAlive()) + else if (flag & FLAG_DESPAWN_ON_RESPAWN && pSlave->IsAlive()) pSlave->ForcedDespawn(); - if (flag & FLAG_FOLLOW && pSlave->isAlive() && !pSlave->isInCombat()) + if (flag & FLAG_FOLLOW && pSlave->IsAlive() && !pSlave->IsInCombat()) SetFollowing(pSlave, pSource); break; @@ -696,9 +696,9 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI if (pMaster && IsSlaveInRangeOfBoss(pMaster, sx, sy, pInfo->searchRange)) { if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD) - return pMaster->isAlive(); + return pMaster->IsAlive(); else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE) - return !pMaster->isAlive(); + return !pMaster->IsAlive(); else return true; } @@ -732,7 +732,7 @@ bool CreatureLinkingHolder::TryFollowMaster(Creature* pCreature) pMaster = pCreature->GetMap()->GetCreature(ObjectGuid(cInfo->GetHighGuid(), cInfo->entry, pInfo->masterDBGuid)); } - if (pMaster && pMaster->isAlive()) + if (pMaster && pMaster->IsAlive()) { SetFollowing(pCreature, pMaster); return true; diff --git a/src/game/Group/Group.cpp b/src/game/Group/Group.cpp index 62dd82303..c3c35403a 100644 --- a/src/game/Group/Group.cpp +++ b/src/game/Group/Group.cpp @@ -35,7 +35,6 @@ #include "MapPersistentStateMgr.h" #include "Util.h" #include "LootMgr.h" -#include "SpellMgr.h" #include "LFGMgr.h" #include "LFGHandler.h" @@ -49,7 +48,7 @@ GroupMemberStatus GetGroupMemberStatus(const Player *member = nullptr) flags |= MEMBER_STATUS_ONLINE; if (member->IsPvP()) flags |= MEMBER_STATUS_PVP; - if (member->isDead()) + if (member->IsDead()) flags |= MEMBER_STATUS_DEAD; if (member->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) flags |= MEMBER_STATUS_GHOST; @@ -1160,13 +1159,13 @@ void Group::ClearTargetIcon(ObjectGuid targetGuid) static void GetDataForXPAtKill_helper(Player* player, Unit const* victim, uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level) { - sum_level += player->getLevel(); - if (!member_with_max_level || member_with_max_level->getLevel() < player->getLevel()) + sum_level += player->GetLevel(); + if (!member_with_max_level || member_with_max_level->GetLevel() < player->GetLevel()) member_with_max_level = player; - uint32 gray_level = MaNGOS::XP::GetGrayLevel(player->getLevel()); - if (victim->getLevel() > gray_level && (!not_gray_member_with_max_level - || not_gray_member_with_max_level->getLevel() < player->getLevel())) + uint32 gray_level = MaNGOS::XP::GetGrayLevel(player->GetLevel()); + if (victim->GetLevel() > gray_level && (!not_gray_member_with_max_level + || not_gray_member_with_max_level->GetLevel() < player->GetLevel())) not_gray_member_with_max_level = player; } @@ -1175,7 +1174,7 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count, uint32& sum_le for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* member = itr->getSource(); - if (!member || !member->isAlive() || !member->IsInWorld()) // only for alive + if (!member || !member->IsAlive() || !member->IsInWorld()) // only for alive continue; // will proccesed later @@ -1916,7 +1915,7 @@ bool Group::InCombatToInstance(uint32 instanceId) for (GroupReference *itr = GetFirstMember(); itr != nullptr; itr = itr->next()) { Player *pPlayer = itr->getSource(); - if (pPlayer->isInCombat() && pPlayer->GetInstanceId() == instanceId) + if (pPlayer->IsInCombat() && pPlayer->GetInstanceId() == instanceId) return true; } return false; @@ -2085,7 +2084,7 @@ void Group::_homebindIfInstance(Player *player) static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp) { // honor can be in PvP and !PvP (racial leader) cases (for alive) - if (pGroupGuy->isAlive()) + if (pGroupGuy->IsAlive()) { pGroupGuy->RewardHonor(pVictim, count); @@ -2115,15 +2114,15 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co // xp and reputation only in !PvP case if (!PvP) { - float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; + float rate = group_rate * float(pGroupGuy->GetLevel()) / sum_level; // if is in dungeon then all receive full reputation at kill // rewarded any alive/dead/near_corpse group member pGroupGuy->RewardReputation(pVictim, 1.0f); // XP updated only for alive group member - if (pGroupGuy->isAlive() && not_gray_member_with_max_level && - pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) + if (pGroupGuy->IsAlive() && not_gray_member_with_max_level && + pGroupGuy->GetLevel() <= not_gray_member_with_max_level->GetLevel()) { uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp * rate) : uint32((xp * rate / 2) + 1); @@ -2133,7 +2132,7 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co } // quest objectives updated only for alive group member or dead but with not released body - if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { // normal creature (not pet/etc) can be only in !PvP case if (pVictim->GetTypeId() == TYPEID_UNIT) @@ -2151,7 +2150,7 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co */ void Group::RewardGroupAtKill(Unit* pVictim, Player* pPlayerTap) { - bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); + bool PvP = pVictim->IsCharmedOwnedByPlayerOrPlayer(); // prepare data for near group iteration (PvP and !PvP cases) uint32 xp = 0; diff --git a/src/game/GuardMgr.cpp b/src/game/GuardMgr.cpp index 1b5990f2a..7e5025bb9 100644 --- a/src/game/GuardMgr.cpp +++ b/src/game/GuardMgr.cpp @@ -444,7 +444,7 @@ bool GuardMgr::SummonGuard(Creature* pCivilian, Player* pEnemy) guardInfo.charges--; guardInfo.cooldown = GUARD_POST_USE_COOLDOWN; - if (uint32 textId = GetTextId(pCivilian->getFaction(), areaId, pCivilian->GetDisplayId())) + if (uint32 textId = GetTextId(pCivilian->GetFactionTemplateId(), areaId, pCivilian->GetDisplayId())) DoScriptText(textId, pCivilian, pEnemy, CHAT_TYPE_SAY); if (uint32 creatureId = pEnemy->GetTeamId() == TEAM_ALLIANCE ? guardInfo.creatureIdHorde : guardInfo.creatureIdAlliance) diff --git a/src/game/Guild/Guild.cpp b/src/game/Guild/Guild.cpp index 8e2af0b39..268cd9c08 100644 --- a/src/game/Guild/Guild.cpp +++ b/src/game/Guild/Guild.cpp @@ -38,8 +38,8 @@ void MemberSlot::SetMemberStats(Player* player) { Name = player->GetName(); - Level = player->getLevel(); - Class = player->getClass(); + Level = player->GetLevel(); + Class = player->GetClass(); ZoneId = player->GetCachedZoneId(); } @@ -227,8 +227,8 @@ GuildAddStatus Guild::AddMember(ObjectGuid plGuid, uint32 plRank) { newmember.accountId = pl->GetSession()->GetAccountId(); newmember.Name = pl->GetName(); - newmember.Level = pl->getLevel(); - newmember.Class = pl->getClass(); + newmember.Level = pl->GetLevel(); + newmember.Class = pl->GetClass(); newmember.ZoneId = pl->GetCachedZoneId(); } else @@ -773,8 +773,8 @@ void Guild::Roster(WorldSession *session /*= nullptr*/) data << uint8(1); data << pl->GetName(); data << uint32(itr->second.RankId); - data << uint8(pl->getLevel()); - data << uint8(pl->getClass()); + data << uint8(pl->GetLevel()); + data << uint8(pl->GetClass()); data << uint32(pl->GetCachedZoneId()); data << itr->second.Pnote; data << itr->second.OFFnote; diff --git a/src/game/Handlers/AuctionHouseHandler.cpp b/src/game/Handlers/AuctionHouseHandler.cpp index a300bb7a3..802285f2d 100644 --- a/src/game/Handlers/AuctionHouseHandler.cpp +++ b/src/game/Handlers/AuctionHouseHandler.cpp @@ -51,7 +51,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); SendAuctionHello(unit); @@ -306,7 +306,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); if (!itemGuid) @@ -439,7 +439,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionEntry *auction = auctionHouse->GetAuction(auctionId); @@ -581,7 +581,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionEntry *auction = auctionHouse->GetAuction(auctionId); @@ -736,7 +736,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) return; // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseClientQueryTask* task = new AuctionHouseClientQueryTask(AUCTION_QUERY_LIST_BIDDER); @@ -773,7 +773,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data) return; // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); AuctionHouseClientQueryTask* task = new AuctionHouseClientQueryTask(AUCTION_QUERY_LIST_OWNER); @@ -814,7 +814,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) task->auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); //DEBUG_LOG("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/BattleGroundHandler.cpp b/src/game/Handlers/BattleGroundHandler.cpp index 6c6df775b..8f434eaa4 100644 --- a/src/game/Handlers/BattleGroundHandler.cpp +++ b/src/game/Handlers/BattleGroundHandler.cpp @@ -48,7 +48,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data) if (!pCreature) return; - if (!pCreature->isBattleMaster()) // it's not battlemaster + if (!pCreature->IsBattleMaster()) // it's not battlemaster return; // Stop the npc if moving @@ -441,10 +441,10 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) DEBUG_LOG("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); } //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue - if (_player->getLevel() > bg->GetMaxLevel()) + if (_player->GetLevel() > bg->GetMaxLevel()) { sLog.outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!", - _player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID()); + _player->GetName(), _player->GetGUIDLow(), _player->GetLevel(), bg->GetMaxLevel(), bg->GetTypeID()); action = 0; } } @@ -460,7 +460,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) } // resurrect the player - if (!_player->isAlive()) + if (!_player->IsAlive()) { _player->ResurrectPlayer(1.0f); _player->SpawnCorpseBones(); @@ -528,7 +528,7 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data) #endif // not allow leave battleground in combat - if (_player->isInCombat()) + if (_player->IsInCombat()) if (BattleGround* bg = _player->GetBattleGround()) if (bg->GetStatus() != STATUS_WAIT_LEAVE) return; @@ -608,7 +608,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) if (!unit) return; - if (!unit->isSpiritService()) // it's not spirit service + if (!unit->IsSpiritService()) // it's not spirit service return; unit->SendAreaSpiritHealerQueryOpcode(GetPlayer()); @@ -629,7 +629,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) if (!unit) return; - if (!unit->isSpiritService()) // it's not spirit service + if (!unit->IsSpiritService()) // it's not spirit service return; sScriptMgr.OnGossipHello(GetPlayer(), unit); diff --git a/src/game/Handlers/ChannelHandler.cpp b/src/game/Handlers/ChannelHandler.cpp index 31bcbf432..f6535cc08 100644 --- a/src/game/Handlers/ChannelHandler.cpp +++ b/src/game/Handlers/ChannelHandler.cpp @@ -260,7 +260,7 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket) return; PlayerPointer player = GetPlayerPointer(); - if (player->getLevel() < sWorld.getConfig(CONFIG_UINT32_CHANNEL_INVITE_MIN_LEVEL)) + if (player->GetLevel() < sWorld.getConfig(CONFIG_UINT32_CHANNEL_INVITE_MIN_LEVEL)) return; if (ChannelMgr* cMgr = channelMgr(player->GetTeam())) diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index d500c2dbb..2be1d11df 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -599,7 +599,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) guild->BroadcastEvent(GE_SIGNED_ON, pCurrChar->GetObjectGuid(), pCurrChar->GetName()); } - if (!pCurrChar->isAlive()) + if (!pCurrChar->IsAlive()) pCurrChar->SendCorpseReclaimDelay(true); pCurrChar->SendInitialPacketsBeforeAddToMap(); @@ -610,7 +610,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) { pCurrChar->SetCinematic(1); - if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) + if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->GetRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); } @@ -674,7 +674,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) if (pCurrChar->m_deathState != ALIVE) { // not blizz like, we must correctly save and load player instead... - if (pCurrChar->getRace() == RACE_NIGHTELF) + if (pCurrChar->GetRace() == RACE_NIGHTELF) pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) @@ -732,7 +732,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) sLog.out(LOG_CHAR, "Account: %d (IP: %s) Login Character:[%s] (guid: %u)%s", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), alreadyOnline ? " Player was already online" : ""); sWorld.LogCharacter(pCurrChar, "Login"); - if (!alreadyOnline && !pCurrChar->IsStandingUp() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED)) + if (!alreadyOnline && !pCurrChar->IsStandingUp() && !pCurrChar->HasUnitState(UNIT_STAT_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); m_playerLoading = false; @@ -742,7 +742,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) { pCurrChar->UpdateControl(); // Send "Release spirit" timer, etc ... - if (pCurrChar->getDeathState() == CORPSE) + if (pCurrChar->GetDeathState() == CORPSE) pCurrChar->KillPlayer(); } pCurrChar->RestorePendingTeleport(); diff --git a/src/game/Handlers/ChatHandler.cpp b/src/game/Handlers/ChatHandler.cpp index 31544a9e1..5ed7211ac 100644 --- a/src/game/Handlers/ChatHandler.cpp +++ b/src/game/Handlers/ChatHandler.cpp @@ -111,7 +111,7 @@ uint32_t WorldSession::ChatCooldown() const auto cooldownMaxLvl = sWorld.getConfig(CONFIG_UINT32_WORLD_CHAN_CD_MAX_LEVEL); const auto cooldownScaling = sWorld.getConfig(CONFIG_UINT32_WORLD_CHAN_CD_SCALING); const auto cooldownUseAcctLvl = sWorld.getConfig(CONFIG_UINT32_WORLD_CHAN_CD_USE_ACCOUNT_MAX_LEVEL); - const auto playerLevel = cooldownUseAcctLvl? GetAccountMaxLevel() : GetPlayer()->getLevel(); + const auto playerLevel = cooldownUseAcctLvl? GetAccountMaxLevel() : GetPlayer()->GetLevel(); if (cooldown && cooldownMaxLvl > playerLevel) { @@ -293,7 +293,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (Channel *chn = cMgr->GetChannel(channel, playerPointer, IsMaster())) { // Level channels restrictions - if (chn->IsLevelRestricted() && playerPointer->getLevel() < sWorld.getConfig(CONFIG_UINT32_WORLD_CHAN_MIN_LEVEL) + if (chn->IsLevelRestricted() && playerPointer->GetLevel() < sWorld.getConfig(CONFIG_UINT32_WORLD_CHAN_MIN_LEVEL) && GetAccountMaxLevel() < sWorld.getConfig(CONFIG_UINT32_PUB_CHANS_MUTE_VANISH_LEVEL)) { ChatHandler(this).SendSysMessage("You cannot use this channel yet."); @@ -358,14 +358,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) break; case CHAT_MSG_SAY: - if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_UINT32_SAY_MIN_LEVEL) + if (GetPlayer()->GetLevel() < sWorld.getConfig(CONFIG_UINT32_SAY_MIN_LEVEL) && GetAccountMaxLevel() < sWorld.getConfig(CONFIG_UINT32_PUB_CHANS_MUTE_VANISH_LEVEL)) { ChatHandler(this).SendSysMessage("You cannot speak yet (too low level)."); return; } - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; GetPlayer()->Say(msg, lang); @@ -380,14 +380,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) break; case CHAT_MSG_EMOTE: - if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_UINT32_SAY_EMOTE_MIN_LEVEL) + if (GetPlayer()->GetLevel() < sWorld.getConfig(CONFIG_UINT32_SAY_EMOTE_MIN_LEVEL) && GetAccountMaxLevel() < sWorld.getConfig(CONFIG_UINT32_PUB_CHANS_MUTE_VANISH_LEVEL)) { ChatHandler(this).SendSysMessage("You cannot use emotes yet (too low level)."); return; } - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; GetPlayer()->TextEmote(msg); @@ -403,14 +403,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) break; case CHAT_MSG_YELL: { - if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_UINT32_YELL_MIN_LEVEL) + if (GetPlayer()->GetLevel() < sWorld.getConfig(CONFIG_UINT32_YELL_MIN_LEVEL) && GetAccountMaxLevel() < sWorld.getConfig(CONFIG_UINT32_PUB_CHANS_MUTE_VANISH_LEVEL)) { ChatHandler(this).SendSysMessage("You cannot yell yet (too low level)."); return; } - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; GetPlayer()->Yell(msg, lang); @@ -465,7 +465,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) SendWrongFactionNotice(); return; } - if (/*player->GetZoneId() != masterPlr->GetZoneId() && */masterPlr->getLevel() < sWorld.getConfig(CONFIG_UINT32_WHISP_DIFF_ZONE_MIN_LEVEL)) + if (/*player->GetZoneId() != masterPlr->GetZoneId() && */masterPlr->GetLevel() < sWorld.getConfig(CONFIG_UINT32_WHISP_DIFF_ZONE_MIN_LEVEL)) { ChatHandler(this).SendSysMessage("You cannot whisper yet."); return; @@ -627,7 +627,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { ForwardPacketToNode(); - if(_player && _player->isInCombat()) + if(_player && _player->IsInCombat()) break; if(!msg.empty() || !_player->IsAFK()) @@ -670,7 +670,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data) { - if (!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (!GetPlayer()->IsAlive() || GetPlayer()->HasUnitState(UNIT_STAT_DIED)) return; if (!GetPlayer()->CanSpeak()) @@ -724,7 +724,7 @@ private: void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) { - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; if (!GetPlayer()->CanSpeak()) @@ -757,7 +757,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) default: { // in feign death state allowed only text emotes. - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) break; GetPlayer()->HandleEmoteCommand(emote_id); diff --git a/src/game/Handlers/CombatHandler.cpp b/src/game/Handlers/CombatHandler.cpp index cca533995..e68cf4ccb 100644 --- a/src/game/Handlers/CombatHandler.cpp +++ b/src/game/Handlers/CombatHandler.cpp @@ -53,7 +53,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data) return; } - if (!pEnemy->isAlive()) + if (!pEnemy->IsAlive()) { // client can generate swing to known dead target if autoswitch between autoshot and autohit is enabled in client options // stop attack state at client diff --git a/src/game/Handlers/GMTicketHandler.cpp b/src/game/Handlers/GMTicketHandler.cpp index 743b30af0..36f1ebfaf 100644 --- a/src/game/Handlers/GMTicketHandler.cpp +++ b/src/game/Handlers/GMTicketHandler.cpp @@ -118,7 +118,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) recvData >> ticketText; recvData >> reservedForFutureUse; - if (GetPlayer()->getLevel() < sWorld.getConfig(CONFIG_UINT32_GMTICKETS_MINLEVEL)) + if (GetPlayer()->GetLevel() < sWorld.getConfig(CONFIG_UINT32_GMTICKETS_MINLEVEL)) { ChatHandler(this).PSendSysMessage("You can't use the ticket system before level %u", sWorld.getConfig(CONFIG_UINT32_GMTICKETS_MINLEVEL)); return; diff --git a/src/game/Handlers/GroupHandler.cpp b/src/game/Handlers/GroupHandler.cpp index 0b6375f43..5762a6ba8 100644 --- a/src/game/Handlers/GroupHandler.cpp +++ b/src/game/Handlers/GroupHandler.cpp @@ -646,7 +646,7 @@ void WorldSession::BuildPartyMemberStatsPacket(Player* player, WorldPacket* data if (mask & GROUP_UPDATE_FLAG_MAX_HP) *data << uint16(player->GetMaxHealth()); - Powers powerType = player->getPowerType(); + Powers powerType = player->GetPowerType(); if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) *data << uint8(powerType); @@ -657,7 +657,7 @@ void WorldSession::BuildPartyMemberStatsPacket(Player* player, WorldPacket* data *data << uint16(player->GetMaxPower(powerType)); if (mask & GROUP_UPDATE_FLAG_LEVEL) - *data << uint16(player->getLevel()); + *data << uint16(player->GetLevel()); if (mask & GROUP_UPDATE_FLAG_ZONE) *data << uint16(player->GetCachedZoneId()); @@ -723,7 +723,7 @@ void WorldSession::BuildPartyMemberStatsPacket(Player* player, WorldPacket* data if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) { if (pet) - *data << uint8(pet->getPowerType()); + *data << uint8(pet->GetPowerType()); else *data << uint8(0); } @@ -731,7 +731,7 @@ void WorldSession::BuildPartyMemberStatsPacket(Player* player, WorldPacket* data if (mask & GROUP_UPDATE_FLAG_PET_CUR_POWER) { if (pet) - *data << uint16(pet->GetPower(pet->getPowerType())); + *data << uint16(pet->GetPower(pet->GetPowerType())); else *data << uint16(0); } @@ -739,7 +739,7 @@ void WorldSession::BuildPartyMemberStatsPacket(Player* player, WorldPacket* data if (mask & GROUP_UPDATE_FLAG_PET_MAX_POWER) { if (pet) - *data << uint16(pet->GetMaxPower(pet->getPowerType())); + *data << uint16(pet->GetMaxPower(pet->GetPowerType())); else *data << uint16(0); } diff --git a/src/game/Handlers/GuildHandler.cpp b/src/game/Handlers/GuildHandler.cpp index ff04675f2..521399d47 100644 --- a/src/game/Handlers/GuildHandler.cpp +++ b/src/game/Handlers/GuildHandler.cpp @@ -737,7 +737,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) 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 2da26d73c..ffaae4dac 100644 --- a/src/game/Handlers/ItemHandler.cpp +++ b/src/game/Handlers/ItemHandler.cpp @@ -524,7 +524,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); Item *pItem = _player->GetItemByGuid(itemGuid); @@ -658,7 +658,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); Item *pItem = _player->GetItemFromBuyBackSlot(slot); @@ -743,7 +743,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket & recv_data) recv_data >> guid; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) return; DEBUG_LOG("WORLD: Recvd CMSG_LIST_INVENTORY"); @@ -765,7 +765,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid, uint8 menu_type) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving @@ -809,11 +809,11 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid, uint8 menu_type) if (!_player->IsGameMaster()) { // class wrong item skip only for bindable case - if ((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP) + if ((pProto->AllowableClass & _player->GetClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP) continue; // race wrong item skip always - if ((pProto->AllowableRace & _player->getRaceMask()) == 0) + if ((pProto->AllowableRace & _player->GetRaceMask()) == 0) continue; // when no faction required but rank > 0 will be used faction id from the vendor faction template to compare the rank @@ -1060,7 +1060,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) { - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, nullptr, nullptr); return; diff --git a/src/game/Handlers/LootHandler.cpp b/src/game/Handlers/LootHandler.cpp index 343e9f1c1..153b848f5 100644 --- a/src/game/Handlers/LootHandler.cpp +++ b/src/game/Handlers/LootHandler.cpp @@ -91,7 +91,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) { Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); + bool ok_loot = pCreature && pCreature->IsAlive() == (player->GetClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) { @@ -237,9 +237,9 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) { Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid); - if (player->getClass() == CLASS_ROGUE && pCreature && pCreature->lootForPickPocketed) + if (player->GetClass() == CLASS_ROGUE && pCreature && pCreature->lootForPickPocketed) shareMoneyWithGroup = false; - bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); + bool ok_loot = pCreature && pCreature->IsAlive() == (player->GetClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); if (ok_loot && pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) pLoot = &pCreature->loot ; @@ -304,7 +304,7 @@ void WorldSession::HandleLootOpcode(WorldPacket & recv_data) } // Check possible cheat - if (!_player->isAlive()) + if (!_player->IsAlive()) return; if (!_player->IsInWorld()) @@ -482,7 +482,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) { Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); + bool ok_loot = creature && creature->IsAlive() == (player->GetClass() == CLASS_ROGUE && creature->lootForPickPocketed); if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; @@ -491,7 +491,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) if (loot->isLooted()) { // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact - if (!creature->isAlive()) + if (!creature->IsAlive()) creature->AllLootRemovedFromCorpse(); creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); diff --git a/src/game/Handlers/MailHandler.cpp b/src/game/Handlers/MailHandler.cpp index 556801726..d864167e3 100644 --- a/src/game/Handlers/MailHandler.cpp +++ b/src/game/Handlers/MailHandler.cpp @@ -293,7 +293,7 @@ void WorldSession::HandleSendMailCallback(WorldSession::AsyncMailSendRequest* re } // Antispam checks - if (loadedPlayer->getLevel() < sWorld.getConfig(CONFIG_UINT32_MAILSPAM_LEVEL) && + if (loadedPlayer->GetLevel() < sWorld.getConfig(CONFIG_UINT32_MAILSPAM_LEVEL) && req->money < sWorld.getConfig(CONFIG_UINT32_MAILSPAM_MONEY) && (sWorld.getConfig(CONFIG_BOOL_MAILSPAM_ITEM) && !req->itemGuid)) { diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp index 0581f6d91..a4a9f8efb 100644 --- a/src/game/Handlers/MiscHandler.cpp +++ b/src/game/Handlers/MiscHandler.cpp @@ -58,7 +58,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & /*recv_data*/) auto player = GetPlayer(); - if (player->isAlive() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (player->IsAlive() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; // the world update order is sessions, players, creatures @@ -66,7 +66,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & /*recv_data*/) // creatures can kill players // so if the server is lagging enough the player can // release spirit after he's killed but before he is updated - if (player->getDeathState() == JUST_DIED) + if (player->GetDeathState() == JUST_DIED) { DEBUG_LOG("HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", player->GetName(), player->GetGUIDLow()); player->KillPlayer(); @@ -127,7 +127,7 @@ public: continue; // check if target's level is in level range - uint32 lvl = pl->getLevel(); + uint32 lvl = pl->GetLevel(); if (lvl < level_min || lvl > level_max) continue; @@ -136,12 +136,12 @@ public: continue; // check if class matches classmask - uint32 class_ = pl->getClass(); + uint32 class_ = pl->GetClass(); if (!(classmask & (1 << class_))) continue; // check if race matches racemask - uint32 race = pl->getRace(); + uint32 race = pl->GetRace(); if (!(racemask & (1 << race))) continue; @@ -322,7 +322,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) uint8 reason = 0; - if (GetPlayer()->isInCombat()) + if (GetPlayer()->IsInCombat()) reason = 1; else if (GetPlayer()->m_movementInfo.HasMovementFlag(MovementFlags(MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR))) reason = 3; // is jumping or falling @@ -355,7 +355,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) if (GetPlayer()->CanFreeMove()) { float height = GetPlayer()->GetMap()->GetHeight(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY(), GetPlayer()->GetPositionZ()); - if ((GetPlayer()->GetPositionZ() < height + 0.1f) && !(GetPlayer()->IsInWater()) && GetPlayer()->getStandState() == UNIT_STAND_STATE_STAND) + if ((GetPlayer()->GetPositionZ() < height + 0.1f) && !(GetPlayer()->IsInWater()) && GetPlayer()->GetStandState() == UNIT_STAND_STATE_STAND) GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); GetPlayer()->SetRooted(true); @@ -435,7 +435,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) if (_clientOS == CLIENT_OS_MAC && GetPlayer()->m_movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT)) { WorldPacket data(SMSG_STANDSTATE_UPDATE, 1); - data << GetPlayer()->getStandState(); + data << GetPlayer()->GetStandState(); GetPlayer()->GetSession()->SendPacket(&data); } } @@ -453,7 +453,7 @@ void WorldSession::HandleSetTargetOpcode(WorldPacket & recv_data) if (!unit) return; - if (FactionTemplateEntry const* factionTemplateEntry = sObjectMgr.GetFactionTemplateEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sObjectMgr.GetFactionTemplateEntry(unit->GetFactionTemplateId())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } @@ -468,12 +468,12 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); // can select group members at diff maps if (unit) - if (FactionTemplateEntry const* factionTemplateEntry = sObjectMgr.GetFactionTemplateEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sObjectMgr.GetFactionTemplateEntry(unit->GetFactionTemplateId())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); // Drop combo points only for rogues and druids // Warriors use combo points internally, do no reset for everyone - if ((_player->getClass() == CLASS_ROGUE || _player->getClass() == CLASS_DRUID) && unit && guid != _player->GetComboTargetGuid()) + if ((_player->GetClass() == CLASS_ROGUE || _player->GetClass() == CLASS_DRUID) && unit && guid != _player->GetComboTargetGuid()) _player->ClearComboPoints(); // Update autoshot if need @@ -682,7 +682,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) ObjectGuid guid; recv_data >> guid; - if (GetPlayer()->isAlive()) + if (GetPlayer()->IsAlive()) return; // body not released yet @@ -727,7 +727,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) return; } - if (GetPlayer()->isAlive()) + if (GetPlayer()->IsAlive()) return; if (status == 0) @@ -779,7 +779,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) return; uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(Trigger_ID); - if (quest_id && pl->isAlive() && pl->IsActiveQuest(quest_id)) + if (quest_id && pl->IsAlive() && pl->IsActiveQuest(quest_id)) { Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); if (pQuest) @@ -866,7 +866,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } // ghost resurrected at enter attempt to dungeon with corpse (including fail enter cases) - if (!pl->isAlive() && targetMapEntry->IsDungeon()) + if (!pl->IsAlive() && targetMapEntry->IsDungeon()) { int32 corpseMapId = 0; if (Corpse *corpse = pl->GetCorpse()) @@ -915,7 +915,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) } uint32 missingLevel = 0; - if (GetPlayer()->getLevel() < at->requiredLevel && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_LEVEL)) + if (GetPlayer()->GetLevel() < at->requiredLevel && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_LEVEL)) missingLevel = at->requiredLevel; // must have one or the other, report the first one that's missing diff --git a/src/game/Handlers/MovementHandler.cpp b/src/game/Handlers/MovementHandler.cpp index ad0067311..c69e08544 100644 --- a/src/game/Handlers/MovementHandler.cpp +++ b/src/game/Handlers/MovementHandler.cpp @@ -271,7 +271,7 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recvData) pPlayerMover->ProcessDelayedOperations(); // Si le joueur est stun, il ne pourra pas envoyer sa position -> Fix desynchro ici. - if (pPlayerMover->hasUnitState(UNIT_STAT_NO_FREE_MOVE)) + if (pPlayerMover->HasUnitState(UNIT_STAT_NO_FREE_MOVE)) { pPlayerMover->m_movementInfo.moveFlags &= ~MOVEFLAG_MASK_MOVING_OR_TURN; pPlayerMover->SendHeartBeat(false); @@ -839,7 +839,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData) { if (Pet* pet = _player->GetPet()) { - pet->clearUnitState(UNIT_STAT_POSSESSED); + pet->ClearUnitState(UNIT_STAT_POSSESSED); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); // out of range pet dismissed if (!pet->IsWithinDistInMap(_player, pet->GetMap()->GetGridActivationDistance())) @@ -903,7 +903,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/) void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) { - if (!_player->isAlive() || _player->isInCombat()) + if (!_player->IsAlive() || _player->IsInCombat()) return; ObjectGuid summonerGuid; @@ -1081,7 +1081,7 @@ void WorldSession::HandleMoverRelocation(Unit* pMover, MovementInfo& movementInf // NOTE: this is actually called many times while falling // even after the player has been teleported away // TODO: discard movement packets after the player is rooted - if (pPlayerMover->isAlive()) + if (pPlayerMover->IsAlive()) { if (pPlayerMover->InBattleGround()) pPlayerMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, pPlayerMover->GetHealth()); @@ -1089,7 +1089,7 @@ void WorldSession::HandleMoverRelocation(Unit* pMover, MovementInfo& movementInf pPlayerMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, pPlayerMover->GetHealth() / 2); // player can be alive if GM and God - if (!pPlayerMover->isAlive()) + if (!pPlayerMover->IsAlive()) { // change the death state to CORPSE to prevent the death timer from // starting in the next player update diff --git a/src/game/Handlers/NPCHandler.cpp b/src/game/Handlers/NPCHandler.cpp index 3598adaf0..8a7d19a83 100644 --- a/src/game/Handlers/NPCHandler.cpp +++ b/src/game/Handlers/NPCHandler.cpp @@ -85,7 +85,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket & recv_data) return; // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); SendShowBank(guid); @@ -378,7 +378,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) if (!pCreature->IsStopped()) pCreature->StopMoving(); - if (pCreature->isSpiritGuide()) + if (pCreature->IsSpiritGuide()) pCreature->SendAreaSpiritHealerQueryOpcode(_player); if (!sScriptMgr.OnGossipHello(_player, pCreature)) @@ -508,7 +508,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket & recv_data) ObjectGuid npcGuid; recv_data >> npcGuid; - if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) + if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) return; Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_INNKEEPER); @@ -570,11 +570,11 @@ void WorldSession::SendStablePet(ObjectGuid guid) uint8 num = 0; // counter for place holder // not let move dead pet in slot - if (pet && pet->isAlive() && pet->getPetType() == HUNTER_PET) + if (pet && pet->IsAlive() && pet->getPetType() == HUNTER_PET) { data << uint32(pet->GetCharmInfo()->GetPetNumber()); data << uint32(pet->GetEntry()); - data << uint32(pet->getLevel()); + data << uint32(pet->GetLevel()); data << pet->GetName(); // petname data << uint32(pet->GetLoyaltyLevel()); // loyalty data << uint8(0x01); // client slot 1 == current pet (0) @@ -649,7 +649,7 @@ void WorldSession::HandleStablePet(WorldPacket & recv_data) recv_data >> npcGUID; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; @@ -667,7 +667,7 @@ void WorldSession::HandleStablePet(WorldPacket & recv_data) Pet *pet = _player->GetPet(); // can't place in stable dead pet - if (!pet || !pet->isAlive() || pet->getPetType() != HUNTER_PET) + if (!pet || !pet->IsAlive() || pet->getPetType() != HUNTER_PET) { SendStableResult(STABLE_ERR_STABLE); return; @@ -804,7 +804,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket & recv_data) Pet* pet = _player->GetPet(); - if (!pet || !pet->isAlive() || pet->getPetType() != HUNTER_PET) + if (!pet || !pet->IsAlive() || pet->getPetType() != HUNTER_PET) { SendStableResult(STABLE_ERR_STABLE); return; diff --git a/src/game/Handlers/PetHandler.cpp b/src/game/Handlers/PetHandler.cpp index 2259b7f2a..272be3388 100644 --- a/src/game/Handlers/PetHandler.cpp +++ b/src/game/Handlers/PetHandler.cpp @@ -60,7 +60,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) return; } - if (!pCharmedUnit->isAlive()) + if (!pCharmedUnit->IsAlive()) return; Creature* pCharmedCreature = pCharmedUnit->ToCreature(); @@ -138,11 +138,11 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) if (!GetPlayer()->IsValidAttackTarget(TargetUnit)) return; - pCharmedUnit->clearUnitState(UNIT_STAT_FOLLOW); + pCharmedUnit->ClearUnitState(UNIT_STAT_FOLLOW); // This is true if pet has no target or has target but targets differs. - if (pCharmedUnit->getVictim() != TargetUnit || (pCharmedUnit->getVictim() == TargetUnit && !pCharmedUnit->GetCharmInfo()->IsCommandAttack()) || pCharmedUnit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) + if (pCharmedUnit->GetVictim() != TargetUnit || (pCharmedUnit->GetVictim() == TargetUnit && !pCharmedUnit->GetCharmInfo()->IsCommandAttack()) || pCharmedUnit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) { - if (pCharmedUnit->getVictim()) + if (pCharmedUnit->GetVictim()) pCharmedUnit->AttackStop(); if (pCharmedCreature) @@ -166,7 +166,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) } else // charmed player { - if (pCharmedUnit->getVictim() && pCharmedUnit->getVictim() != TargetUnit) + if (pCharmedUnit->GetVictim() && pCharmedUnit->GetVictim() != TargetUnit) pCharmedUnit->AttackStop(); charmInfo->SetIsCommandAttack(true); @@ -241,7 +241,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) if (!pCharmedUnit->HasSpell(spellid) || spellInfo->IsPassiveSpell()) return; - pCharmedUnit->clearUnitState(UNIT_STAT_MOVING); + pCharmedUnit->ClearUnitState(UNIT_STAT_MOVING); Spell* spell = new Spell(pCharmedUnit, spellInfo, false); @@ -285,9 +285,9 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) if (unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pCharmedUnit->HasAuraType(SPELL_AURA_MOD_POSSESS)) { // This is true if pet has no target or has target but targets differs. - if (pCharmedUnit->getVictim() != unit_target) + if (pCharmedUnit->GetVictim() != unit_target) { - if (pCharmedUnit->getVictim()) + if (pCharmedUnit->GetVictim()) pCharmedUnit->AttackStop(); pCharmedUnit->GetMotionMaster()->Clear(); if (((Creature*)pCharmedUnit)->AI()) @@ -337,7 +337,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recv_data) return; } - if (!pet->isAlive()) + if (!pet->IsAlive()) return; pet->AttackStop(); @@ -466,7 +466,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data) // sign for autocast if (act_state == ACT_ENABLED && spell_id) { - if (pet->isCharmed()) + if (pet->IsCharmed()) charmInfo->ToggleCreatureAutocast(spell_id, true); else ((Pet*)pet)->ToggleAutocast(spell_id, true); @@ -474,7 +474,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data) // sign for no/turn off autocast else if (act_state == ACT_DISABLED && spell_id) { - if (pet->isCharmed()) + if (pet->IsCharmed()) charmInfo->ToggleCreatureAutocast(spell_id, false); else ((Pet*)pet)->ToggleAutocast(spell_id, false); @@ -605,7 +605,7 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket) pet->unlearnSpell(spell_id, false); } - pet->SetTP(pet->getLevel() * (pet->GetLoyaltyLevel() - 1)); + pet->SetTP(pet->GetLevel() * (pet->GetLoyaltyLevel() - 1)); for (int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) if (UnitActionBarEntry const* ab = charmInfo->GetActionBarEntry(i)) @@ -649,7 +649,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) return; } - if (pet->isCharmed()) + if (pet->IsCharmed()) // state can be used as boolean pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state); else @@ -695,7 +695,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) recvPacket >> targets.ReadForCaster(pet); - pet->clearUnitState(UNIT_STAT_MOVING); + pet->ClearUnitState(UNIT_STAT_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 88e040391..f52e36b6a 100644 --- a/src/game/Handlers/PetitionsHandler.cpp +++ b/src/game/Handlers/PetitionsHandler.cpp @@ -76,11 +76,11 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) return; } - if (!pCreature->isTabardDesigner()) + if (!pCreature->IsTabardDesigner()) return; // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // if tabard designer, then trying to buy a guild charter. @@ -561,7 +561,7 @@ void WorldSession::SendPetitionShowList(ObjectGuid& guid) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); uint8 count = 1; diff --git a/src/game/Handlers/QueryHandler.cpp b/src/game/Handlers/QueryHandler.cpp index 680b4d063..50c07b709 100644 --- a/src/game/Handlers/QueryHandler.cpp +++ b/src/game/Handlers/QueryHandler.cpp @@ -52,9 +52,9 @@ void WorldSession::SendNameQueryOpcode(Player *p) data << ObjectGuid(p->GetObjectGuid()); data << p->GetName(); // CString(48): played name #endif - data << uint32(p->getRace()); - data << uint32(p->getGender()); - data << uint32(p->getClass()); + data << uint32(p->GetRace()); + data << uint32(p->GetGender()); + data << uint32(p->GetClass()); SendPacket(&data); } diff --git a/src/game/Handlers/QuestHandler.cpp b/src/game/Handlers/QuestHandler.cpp index 187a8bb5a..a00935448 100644 --- a/src/game/Handlers/QuestHandler.cpp +++ b/src/game/Handlers/QuestHandler.cpp @@ -96,7 +96,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving @@ -250,12 +250,12 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) if (!pObject->HasInvolvedQuest(quest)) return; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { // Some quest can be rewarded while dead (cf q3912 [Meet at the Grave]) if (Creature* crea = pObject->ToCreature()) { - if (!crea->isVisibleForDead()) + if (!crea->IsVisibleForDead()) return; } else @@ -292,12 +292,12 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data) if (!pObject || !pObject->HasInvolvedQuest(quest)) return; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { // Some quest can be rewarded while dead (cf q3912 [Meet at the Grave]) if (Creature* crea = pObject->ToCreature()) { - if (!crea->isInvisibleForAlive()) + if (!crea->IsInvisibleForAlive()) return; } else @@ -580,7 +580,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 int32 lowLevelDiff = sWorld.getConfig(CONFIG_INT32_QUEST_LOW_LEVEL_HIDE_DIFF); if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && !pQuest->HasQuestFlag(QUEST_FLAGS_UNK2) && pPlayer->getQuestStatusMap()[quest_id].m_rewarded)) dialogStatusNew = DIALOG_STATUS_REWARD_REP; - else if (lowLevelDiff < 0 || pPlayer->getLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + uint32(lowLevelDiff)) + else if (lowLevelDiff < 0 || pPlayer->GetLevel() <= pPlayer->GetQuestLevelForPlayer(pQuest) + uint32(lowLevelDiff)) dialogStatusNew = DIALOG_STATUS_AVAILABLE; else dialogStatusNew = DIALOG_STATUS_CHAT; diff --git a/src/game/Handlers/SkillHandler.cpp b/src/game/Handlers/SkillHandler.cpp index 3ff2d88bd..b3807c52b 100644 --- a/src/game/Handlers/SkillHandler.cpp +++ b/src/game/Handlers/SkillHandler.cpp @@ -51,7 +51,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); if (!(_player->ResetTalents())) @@ -70,7 +70,7 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data) { uint32 skill_id; recv_data >> skill_id; - SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill_id, GetPlayer()->getRace(), GetPlayer()->getClass()); + SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill_id, GetPlayer()->GetRace(), GetPlayer()->GetClass()); if (!rcEntry || !(rcEntry->flags & SKILL_FLAG_UNLEARNABLE)) { std::stringstream reason; diff --git a/src/game/Handlers/SpellHandler.cpp b/src/game/Handlers/SpellHandler.cpp index 90e17092d..76b326109 100644 --- a/src/game/Handlers/SpellHandler.cpp +++ b/src/game/Handlers/SpellHandler.cpp @@ -93,7 +93,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - if (pUser->isInCombat()) + if (pUser->IsInCombat()) { for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { @@ -337,7 +337,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message - if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) + if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->GetLevel())) spellInfo = actualSpellInfo; } @@ -479,7 +479,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (guid != GetPlayer()->GetPetGuid() && guid != GetPlayer()->GetCharmGuid()) return; - if (!pet->isAlive()) + if (!pet->IsAlive()) { pet->SendPetActionFeedback(FEEDBACK_PET_DEAD); return; diff --git a/src/game/Handlers/TaxiHandler.cpp b/src/game/Handlers/TaxiHandler.cpp index 19fb0cbd1..73c40eee2 100644 --- a/src/game/Handlers/TaxiHandler.cpp +++ b/src/game/Handlers/TaxiHandler.cpp @@ -83,7 +83,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); // unknown taxi node case @@ -117,7 +117,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode) { // remove fake death - if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) 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 078b06aab..ccff2a4e8 100644 --- a/src/game/Handlers/TradeHandler.cpp +++ b/src/game/Handlers/TradeHandler.cpp @@ -555,13 +555,13 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) if (GetPlayer()->m_trade) return; - if (!GetPlayer()->isAlive()) + if (!GetPlayer()->IsAlive()) { SendTradeStatus(TRADE_STATUS_YOU_DEAD); return; } - if (GetPlayer()->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (GetPlayer()->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) { SendTradeStatus(TRADE_STATUS_YOU_STUNNED); return; @@ -593,7 +593,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (!pOther->isAlive()) + if (!pOther->IsAlive()) { SendTradeStatus(TRADE_STATUS_TARGET_DEAD); return; @@ -605,7 +605,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (pOther->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (pOther->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) { SendTradeStatus(TRADE_STATUS_TARGET_STUNNED); return; diff --git a/src/game/HardcodedEvents.cpp b/src/game/HardcodedEvents.cpp index 2249856b2..62e5e5aa8 100644 --- a/src/game/HardcodedEvents.cpp +++ b/src/game/HardcodedEvents.cpp @@ -364,7 +364,7 @@ void DragonsOfNightmare::GetAliveCountAndUpdateRespawnTime(std::vectorisDead()) + if (pCreature->IsDead()) map->GetPersistentState()->SaveCreatureRespawnTime(guid.GetCounter(), respawnTime); else ++alive; @@ -618,7 +618,7 @@ void SilithusWarEffortBattle::Disable() for (Creature* cr : SummonedMobs) { - if (cr->isDead()) + if (cr->IsDead()) { DeadCreatures.push_back(cr); } diff --git a/src/game/HonorMgr.cpp b/src/game/HonorMgr.cpp index b70998420..dcb581dbb 100644 --- a/src/game/HonorMgr.cpp +++ b/src/game/HonorMgr.cpp @@ -6,7 +6,6 @@ #include "HonorMgr.h" #include "Language.h" #include "World.h" -#include "Unit.h" #include "Creature.h" #include "Player.h" #include "Database/DatabaseEnv.h" @@ -957,8 +956,8 @@ float HonorMgr::HonorableKillPoints(Player* killer, Player* victim, uint32 group uint32 totalKills = killer->GetHonorMgr().CalculateTotalKills(victim); uint32 victimRank = victim->GetHonorMgr().GetRank().visualRank; - uint8 killerLevel = killer->getLevel(); - uint8 victimLevel = victim->getLevel(); + uint8 killerLevel = killer->GetLevel(); + uint8 victimLevel = victim->GetLevel(); return MaNGOS::Honor::GetHonorGain(killerLevel, victimLevel, victimRank, totalKills, groupSize); } diff --git a/src/game/LFG/LFGMgr.cpp b/src/game/LFG/LFGMgr.cpp index 7658377df..8a3c63d80 100644 --- a/src/game/LFG/LFGMgr.cpp +++ b/src/game/LFG/LFGMgr.cpp @@ -109,7 +109,7 @@ void LFGQueue::AddToQueue(Player* leader, uint32 queueAreaID) i_Player.team = leader->GetTeam(); i_Player.areaId = queueAreaID; i_Player.hasQueuePriority = false; - i_Player.CalculateRoles(static_cast(leader->getClass())); + i_Player.CalculateRoles(static_cast(leader->GetClass())); i_Player.name = leader->GetName(); leader->GetSession()->SendMeetingstoneSetqueue(queueAreaID, MEETINGSTONE_STATUS_JOINED_QUEUE); diff --git a/src/game/Mail/Mail.cpp b/src/game/Mail/Mail.cpp index 2682f00c4..422968391 100644 --- a/src/game/Mail/Mail.cpp +++ b/src/game/Mail/Mail.cpp @@ -38,7 +38,6 @@ #include "ObjectGuid.h" #include "Player.h" #include "UpdateMask.h" -#include "Unit.h" #include "Language.h" #include "DBCStores.h" #include "BattleGroundMgr.h" diff --git a/src/game/MapNodes/AbstractPlayer.cpp b/src/game/MapNodes/AbstractPlayer.cpp index c3bb495dc..d2531dd0a 100644 --- a/src/game/MapNodes/AbstractPlayer.cpp +++ b/src/game/MapNodes/AbstractPlayer.cpp @@ -13,11 +13,11 @@ uint32 PlayerWrapper::GetZoneId() const { return player.GetZoneId(); } template uint32 PlayerWrapper::GetAreaId() const { return player.GetAreaId(); } template -uint8 PlayerWrapper::getClass() const { return player.getClass(); } +uint8 PlayerWrapper::GetClass() const { return player.GetClass(); } template -uint8 PlayerWrapper::getRace() const { return player.getRace(); } +uint8 PlayerWrapper::GetRace() const { return player.GetRace(); } template -uint32 PlayerWrapper::getLevel() const { return player.getLevel(); } +uint32 PlayerWrapper::GetLevel() const { return player.GetLevel(); } template bool PlayerWrapper::IsAFK() const { return player.IsAFK(); } template diff --git a/src/game/MapNodes/AbstractPlayer.h b/src/game/MapNodes/AbstractPlayer.h index 6feed5793..48dd536e6 100644 --- a/src/game/MapNodes/AbstractPlayer.h +++ b/src/game/MapNodes/AbstractPlayer.h @@ -38,9 +38,9 @@ public: virtual const char* GetName() const = 0; virtual uint32 GetZoneId() const = 0; virtual uint32 GetAreaId() const = 0; - virtual uint8 getClass() const = 0; - virtual uint8 getRace() const = 0; - virtual uint32 getLevel() const = 0; + virtual uint8 GetClass() const = 0; + virtual uint8 GetRace() const = 0; + virtual uint32 GetLevel() const = 0; virtual uint32 GetGuildId() const = 0; virtual bool IsAFK() const = 0; virtual bool IsDND() const = 0; @@ -71,9 +71,9 @@ public: const char* GetName() const override; uint32 GetZoneId() const override; uint32 GetAreaId() const override; - uint8 getClass() const override; - uint8 getRace() const override; - uint32 getLevel() const override; + uint8 GetClass() const override; + uint8 GetRace() const override; + uint32 GetLevel() const override; uint32 GetGuildId() const override; bool IsAFK() const override; bool IsDND() const override; diff --git a/src/game/MapNodes/MasterPlayer.cpp b/src/game/MapNodes/MasterPlayer.cpp index 894a53012..c1b2706d5 100644 --- a/src/game/MapNodes/MasterPlayer.cpp +++ b/src/game/MapNodes/MasterPlayer.cpp @@ -5,6 +5,7 @@ #include "Item.h" #include "Mail.h" #include "ObjectAccessor.h" +#include "WorldPacket.h" MasterPlayer::MasterPlayer(WorldSession* s): m_speakTime(0), m_speakCount(0), m_social(nullptr), @@ -28,7 +29,7 @@ MasterPlayer::~MasterPlayer() void MasterPlayer::Create(Player* player) { guid = player->GetObjectGuid(); - PlayerInfo const* info = sObjectMgr.GetPlayerInfo(player->getRace(), player->getClass()); + PlayerInfo const* info = sObjectMgr.GetPlayerInfo(player->GetRace(), player->GetClass()); ASSERT(info); // original action bar @@ -42,9 +43,9 @@ void MasterPlayer::LoadPlayer(Player* player) name = player->GetName(); zoneId = player->GetCachedZoneId(); areaId = player->GetCachedAreaId(); - raceId = player->getRace(); - classId = player->getClass(); - level = player->getLevel(); + raceId = player->GetRace(); + classId = player->GetClass(); + level = player->GetLevel(); guildId = player->GetGuildId(); m_team = player->GetTeam(); m_chatTag = player->GetChatTag(); diff --git a/src/game/MapNodes/MasterPlayer.h b/src/game/MapNodes/MasterPlayer.h index f2783b110..3e30f5e11 100644 --- a/src/game/MapNodes/MasterPlayer.h +++ b/src/game/MapNodes/MasterPlayer.h @@ -112,9 +112,9 @@ public: const char* GetName() const { return name.c_str(); } uint32 GetZoneId() const { return zoneId; } uint32 GetAreaId() const { return areaId; } - uint8 getClass() const { return classId; } - uint8 getRace() const { return raceId; } - uint32 getLevel() const { return level; } + uint8 GetClass() const { return classId; } + uint8 GetRace() const { return raceId; } + uint32 GetLevel() const { return level; } bool IsAFK() const { return GetChatTag() == 1; } bool IsDND() const { return GetChatTag() == 2; } uint8 GetChatTag() const { return m_chatTag; } diff --git a/src/game/MapNodes/Serializers/PlayerSerializer.h b/src/game/MapNodes/Serializers/PlayerSerializer.h index 0e6e7a8c2..ea89664ee 100644 --- a/src/game/MapNodes/Serializers/PlayerSerializer.h +++ b/src/game/MapNodes/Serializers/PlayerSerializer.h @@ -144,7 +144,7 @@ void Player::Serialize(OP& buf) if (buf.IsRead()) { InitPlayerDisplayIds(); - SetFactionForRace(getRace()); + SetFactionForRace(GetRace()); SetCharm(nullptr); } @@ -158,7 +158,7 @@ void Player::Serialize(OP& buf) SerializeSkills(buf); SerializeAuras(buf); - if (buf.IsRead() && !isAlive()) + if (buf.IsRead() && !IsAlive()) RemoveAllAurasOnDeath(); SerializeSpells(buf); SerializeSpellCooldowns(buf); @@ -296,7 +296,7 @@ void Player::SerializeInventory(MaNGOS::Serializer::ReadSerializer& buf) ASSERT(item->PrepareWakeUp(item_guid_low, proto, this)); item->Serialize(buf); bool isValid = item->WakeUp(); - if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) + if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) isValid = false; if (isValid) diff --git a/src/game/Maps/GridNotifiers.cpp b/src/game/Maps/GridNotifiers.cpp index 9fed7df58..b1575ffbf 100644 --- a/src/game/Maps/GridNotifiers.cpp +++ b/src/game/Maps/GridNotifiers.cpp @@ -118,8 +118,8 @@ VisibleNotifier::Notify() // for every new visible unit send attack stance if needed for (Object const* obj : i_visibleNow) if (Unit const* unit = obj->ToUnit()) - if (unit->hasUnitState(UNIT_STAT_MELEE_ATTACKING)) - if (Unit const* victim = unit->getVictim()) + if (unit->HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (Unit const* victim = unit->GetVictim()) { WorldPacket data(SMSG_ATTACKSTART, 8 + 8); data << unit->GetObjectGuid(); diff --git a/src/game/Maps/GridNotifiers.h b/src/game/Maps/GridNotifiers.h index a520e8a7e..4577cee44 100644 --- a/src/game/Maps/GridNotifiers.h +++ b/src/game/Maps/GridNotifiers.h @@ -32,7 +32,6 @@ #include "DynamicObject.h" #include "GameObject.h" #include "Player.h" -#include "Unit.h" #include "CreatureAI.h" #include "Conditions.h" @@ -548,7 +547,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_fobj; } bool operator()(Player* u) { - if( i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying() || !i_fobj->CanSeeInWorld(u)) + if( i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying() || !i_fobj->CanSeeInWorld(u)) return false; return i_fobj->IsWithinDistInMap(u, i_range); @@ -556,7 +555,7 @@ namespace MaNGOS bool operator()(Corpse* u); bool operator()(Creature* u) { - if (i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying() || + if (i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying() || (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD)==0 || !i_fobj->CanSeeInWorld(u)) return false; @@ -752,7 +751,7 @@ namespace MaNGOS //WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) const { - if (u->isAlive() && u->isInCombat() && i_obj->IsFriendlyTo(u) && i_obj->IsWithinDistInMap(u, i_range)) + if (u->IsAlive() && u->IsInCombat() && i_obj->IsFriendlyTo(u) && i_obj->IsWithinDistInMap(u, i_range)) { if (i_percent) return 100 - u->GetHealthPercent() > i_hp; @@ -776,8 +775,8 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && - (u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_CAN_NOT_REACT))) + if(u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && + (u->IsCharmed() || u->IsFrozen() || u->HasUnitState(UNIT_STAT_CAN_NOT_REACT))) { return true; } @@ -795,7 +794,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && + if(u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && !(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2)) ) { return true; @@ -817,7 +816,7 @@ namespace MaNGOS { if(!i_funit->CanSeeInWorld(u)) return false; - if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u)) + if(u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u)) return true; return false; } @@ -835,10 +834,10 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - return u->isAlive() + return u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) - && u->isVisibleForOrDetect(i_funit,i_funit,false); + && u->IsVisibleForOrDetect(i_funit,i_funit,false); } private: WorldObject const* i_obj; @@ -853,7 +852,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u) && u->CanSeeInWorld(i_obj)) + if(u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u) && u->CanSeeInWorld(i_obj)) return true; return false; } @@ -869,7 +868,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Unit* u) { - if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && u->CanSeeInWorld(i_obj)) + if(u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && u->CanSeeInWorld(i_obj)) return true; return false; @@ -891,7 +890,7 @@ namespace MaNGOS return false; if (i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsValidAttackTarget(u) && - u->isVisibleForOrDetect(i_funit, i_funit, false) && i_funit->IsHostileTo(u)) + u->IsVisibleForOrDetect(i_funit, i_funit, false) && i_funit->IsHostileTo(u)) { i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check return true; @@ -921,7 +920,7 @@ namespace MaNGOS bool operator()(Unit* u) { // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems - if (!u->isTargetableForAttack(false, i_originalCaster->IsPlayer())) + if (!u->IsTargetableForAttack(false, i_originalCaster->IsPlayer())) return false; // ignore totems as AoE targets @@ -929,7 +928,7 @@ namespace MaNGOS return false; // check visibility only for unit-like original casters - if (i_targetForUnit && !u->isVisibleForOrDetect((Unit const*)i_originalCaster, i_originalCaster, false)) + if (i_targetForUnit && !u->IsVisibleForOrDetect((Unit const*)i_originalCaster, i_originalCaster, false)) return false; if (!u->CanSeeInWorld(i_obj)) @@ -962,7 +961,7 @@ namespace MaNGOS bool operator()(Unit* u) { // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems - if (!u->isTargetableForAttack(false, i_originalCaster->IsPlayer())) + if (!u->IsTargetableForAttack(false, i_originalCaster->IsPlayer())) return false; // ignore totems as AoE targets @@ -1025,7 +1024,7 @@ namespace MaNGOS public: explicit AnyDeadUnitCheck(WorldObject const* fobj) : i_fobj(fobj) {} WorldObject const& GetFocusObject() const { return *i_fobj; } - bool operator()(Unit* u) { return !u->isAlive(); } + bool operator()(Unit* u) { return !u->IsAlive(); } private: WorldObject const* i_fobj; }; @@ -1052,7 +1051,7 @@ namespace MaNGOS if(!u->CanSeeInWorld(i_funit)) return false; - if(u->isAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit))) + if(u->IsAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit))) return true; return false; @@ -1136,10 +1135,10 @@ namespace MaNGOS if (u == i_obj) return false; - if (!u->isAlive()) + if (!u->IsAlive()) return false; - if (u->isInCombat()) + if (u->IsInCombat()) return false; if (!u->IsGuard()) @@ -1175,7 +1174,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return i_obj; } bool operator()(Creature* u) { - if (u->GetEntry() == i_entry && ((i_alive && u->isAlive()) || (!i_alive && u->IsCorpse())) && i_obj.IsWithinDistInMap(u, i_range)) + if (u->GetEntry() == i_entry && ((i_alive && u->IsAlive()) || (!i_alive && u->IsCorpse())) && i_obj.IsWithinDistInMap(u, i_range)) { i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check return true; @@ -1201,7 +1200,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return i_obj; } bool operator()(Creature* u) { - if (u->GetEntry() == i_entry && ((i_alive && u->isAlive()) || (!i_alive && u->IsCorpse())) && i_obj.IsWithinCombatDistInMap(u, i_range)) + if (u->GetEntry() == i_entry && ((i_alive && u->IsAlive()) || (!i_alive && u->IsCorpse())) && i_obj.IsWithinCombatDistInMap(u, i_range)) { if (i_conditionId && !IsConditionSatisfied(i_conditionId, u, u->GetMap(), &i_obj, CONDITION_FROM_SPELL_AREA)) return false; @@ -1232,7 +1231,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Player* u) { - if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range, b_3dDist)) + if(u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range, b_3dDist)) return true; return false; @@ -1251,7 +1250,7 @@ namespace MaNGOS WorldObject const& GetFocusObject() const { return *i_obj; } bool operator()(Player* u) { - return u->isAlive() + return u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && u->HasAura(i_spellId); } @@ -1303,7 +1302,7 @@ namespace MaNGOS AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {} bool operator() (Unit* u) { - if (u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit)) + if (u->IsAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit)) return true; return false; @@ -1377,7 +1376,7 @@ namespace MaNGOS bool operator() (Player* pPlayer) { //No threat list check, must be done explicit if expected to be in combat with creature - if (!pPlayer->IsGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false)) + if (!pPlayer->IsGameMaster() && pPlayer->IsAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false)) return true; return false; @@ -1457,7 +1456,7 @@ namespace MaNGOS if (!me->IsWithinDistInMap(u, m_range)) return false; - if (!me->canAttack(u)) + if (!me->CanAttack(u)) return false; m_range = me->GetDistance(u); // use found unit range as new range limit for next check @@ -1482,13 +1481,13 @@ namespace MaNGOS if (!m_me->IsHostileTo(u)) return false; - if (!u->isVisibleForOrDetect(m_me, m_me, false)) + if (!u->IsVisibleForOrDetect(m_me, m_me, false)) return false; if (!u->IsWithinDistInMap(m_me, std::min(m_me->GetAttackDistance(u), m_dist))) return false; - if (!u->isTargetableForAttack()) + if (!u->IsTargetableForAttack()) return false; if (m_ignoreCivilians && u->IsCreature() && static_cast(u)->IsCivilian()) @@ -1524,7 +1523,7 @@ namespace MaNGOS if (m_force) { - if (!me->canAttack(u)) + if (!me->CanAttack(u)) return false; } else diff --git a/src/game/Maps/GridNotifiersImpl.h b/src/game/Maps/GridNotifiersImpl.h index 5eaff3498..67d60abef 100644 --- a/src/game/Maps/GridNotifiersImpl.h +++ b/src/game/Maps/GridNotifiersImpl.h @@ -59,10 +59,10 @@ 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_IGNORE_MOVE_LOS) && !c->IsInEvadeMode() && c->AI()) + if (!c->HasUnitState(UNIT_STAT_LOST_CONTROL | UNIT_STAT_IGNORE_MOVE_LOS) && !c->IsInEvadeMode() && c->AI()) { bool alert = false; - if (moving->isVisibleForOrDetect(c, c, true, false, &alert)) + if (moving->IsVisibleForOrDetect(c, c, true, false, &alert)) c->AI()->MoveInLineOfSight(moving); else if (moving->GetTypeId() == TYPEID_PLAYER && moving->HasStealthAura() && alert) @@ -83,13 +83,13 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) { - if (!i_player.isAlive() || i_player.IsTaxiFlying()) + if (!i_player.IsAlive() || i_player.IsTaxiFlying()) return; for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->getSource(); - if (c->isAlive()) + if (c->IsAlive()) PlayerCreatureRelocationWorker(&i_player, c); } } @@ -97,13 +97,13 @@ inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) template<> inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) { - if (!i_creature.isAlive()) + if (!i_creature.IsAlive()) return; for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { Player* player = iter->getSource(); - if (player->isAlive() && !player->IsTaxiFlying()) + if (player->IsAlive() && !player->IsTaxiFlying()) PlayerCreatureRelocationWorker(player, &i_creature); } } @@ -111,13 +111,13 @@ inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) template<> inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m) { - if (!i_creature.isAlive()) + if (!i_creature.IsAlive()) return; for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->getSource(); - if (c != &i_creature && c->isAlive()) + if (c != &i_creature && c->IsAlive()) CreatureCreatureRelocationWorker(c, &i_creature); } } @@ -127,7 +127,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) if (!target->CanSeeInWorld(i_check)) return; - if (!target->isAlive() || target->IsTaxiFlying() ) + if (!target->IsAlive() || target->IsTaxiFlying() ) return; if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsImmuneToAoe()) diff --git a/src/game/Maps/GridSearchers.h b/src/game/Maps/GridSearchers.h index 20ed7886f..7e6d6c086 100644 --- a/src/game/Maps/GridSearchers.h +++ b/src/game/Maps/GridSearchers.h @@ -53,7 +53,7 @@ class AllFriendlyCreaturesInGrid AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {} bool operator() (Unit* u) { - if (u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit)) + if (u->IsAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit)) return true; return false; @@ -106,7 +106,7 @@ class PlayerAtMinimumRangeAway bool operator() (Player* pPlayer) { //No threat list check, must be done explicit if expected to be in combat with creature - if (!pPlayer->IsGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false)) + if (!pPlayer->IsGameMaster() && pPlayer->IsAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false)) return true; return false; diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index a745ce9ac..3546d754b 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -838,7 +838,7 @@ void Map::UpdatePlayers() Player* plr = m_mapRefIter->getSource(); if (!plr || !plr->IsInWorld()) continue; - if (!updateInactivePlayers && (!plr->isInCombat() && !plr->GetSession()->HasRecentPacket(PACKET_PROCESS_SPELLS) && !plr->HasScheduledEvent())) + if (!updateInactivePlayers && (!plr->IsInCombat() && !plr->GetSession()->HasRecentPacket(PACKET_PROCESS_SPELLS) && !plr->HasScheduledEvent())) { plr->AddSkippedUpdateTime(diff); continue; @@ -1993,7 +1993,7 @@ bool DungeonMap::CanEnter(Player *player) #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 Group *pGroup = player->GetGroup(); if (IsRaid() && GetInstanceData() && GetInstanceData()->IsEncounterInProgress() && - pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && !player->IsGameMaster()) + pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->IsAlive() && !player->IsGameMaster()) { player->SendTransferAborted(TRANSFER_ABORT_ZONE_IN_COMBAT); return false; diff --git a/src/game/Maps/PathFinder.cpp b/src/game/Maps/PathFinder.cpp index d339dcdfb..9697442b2 100644 --- a/src/game/Maps/PathFinder.cpp +++ b/src/game/Maps/PathFinder.cpp @@ -87,7 +87,7 @@ bool PathInfo::calculate(float destX, float destY, float destZ, bool forceDest, // 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_STAT_IGNORE_PATHFINDING) || !HaveTiles(start) || !HaveTiles(dest)) { BuildShortcut(); diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index ec4269ca8..7753305fa 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -123,7 +123,7 @@ bool Map::ScriptCommand_MoveTo(const ScriptInfo& script, WorldObject* source, Wo return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); float x = script.x; @@ -162,7 +162,7 @@ bool Map::ScriptCommand_MoveTo(const ScriptInfo& 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_STAT_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; @@ -644,7 +644,7 @@ bool Map::ScriptCommand_DespawnCreature(const ScriptInfo& script, WorldObject* s } // Fix possible crash due to double aura deletion when creature is despawned on death. - uint32 const despawnDelay = !pSource->isAlive() && (script.despawn.despawnDelay == 0) ? 1 : script.despawn.despawnDelay; + uint32 const despawnDelay = !pSource->IsAlive() && (script.despawn.despawnDelay == 0) ? 1 : script.despawn.despawnDelay; pSource->DespawnOrUnsummon(despawnDelay); @@ -699,7 +699,7 @@ bool Map::ScriptCommand_SetMovementType(const ScriptInfo& script, WorldObject* s return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); switch (script.movement.movementType) @@ -727,7 +727,7 @@ bool Map::ScriptCommand_SetMovementType(const ScriptInfo& script, WorldObject* s case CHASE_MOTION_TYPE: if (script.movement.boolParam) // chase victim { - if (Unit* pVictim = pSource->getVictim()) + if (Unit* pVictim = pSource->GetVictim()) pSource->GetMotionMaster()->MoveChase(pVictim, script.x, script.o); break; } @@ -740,7 +740,7 @@ bool Map::ScriptCommand_SetMovementType(const ScriptInfo& script, WorldObject* s case FLEEING_MOTION_TYPE: if (script.movement.boolParam) // flee from victim { - if (Unit* pVictim = pSource->getVictim()) + if (Unit* pVictim = pSource->GetVictim()) pSource->GetMotionMaster()->MoveFleeing(pVictim, script.movement.intParam); break; } @@ -816,7 +816,7 @@ bool Map::ScriptCommand_Morph(const ScriptInfo& script, WorldObject* source, Wor return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); if (!script.morph.creatureOrModelEntry) @@ -847,7 +847,7 @@ bool Map::ScriptCommand_Mount(const ScriptInfo& script, WorldObject* source, Wor uint32 displayId = script.mount.isDisplayId || !script.mount.creatureOrModelEntry ? script.mount.creatureOrModelEntry : Creature::ChooseDisplayId(ObjectMgr::GetCreatureTemplate(script.mount.creatureOrModelEntry)); - if (pSource->isAlive()) + if (pSource->IsAlive()) { if (displayId) pSource->Mount(displayId); @@ -889,10 +889,10 @@ bool Map::ScriptCommand_AttackStart(const ScriptInfo& script, WorldObject* sourc return ShouldAbortScript(script); } - if (!pAttacker->isAlive()) + if (!pAttacker->IsAlive()) return ShouldAbortScript(script); - if (pAttacker->IsFriendlyTo(pTarget) || !pTarget->isTargetableForAttack() || !pAttacker->IsInMap(pTarget)) + if (pAttacker->IsFriendlyTo(pTarget) || !pTarget->IsTargetableForAttack() || !pAttacker->IsInMap(pTarget)) { sLog.outError("SCRIPT_COMMAND_ATTACK_START (script id %u) for an invalid attack target, skipping.", script.id); return ShouldAbortScript(script); @@ -932,7 +932,7 @@ bool Map::ScriptCommand_SetStandState(const ScriptInfo& script, WorldObject* sou return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); pSource->SetStandState(script.standState.standState); @@ -953,15 +953,15 @@ bool Map::ScriptCommand_ModifyThreat(const ScriptInfo& script, WorldObject* sour if (script.modThreat.target == SO_MODIFYTHREAT_ALL_ATTACKERS) { - ThreatList const& threatList = pSource->getThreatManager().getThreatList(); + ThreatList const& threatList = pSource->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) if (Unit* Temp = pSource->GetMap()->GetUnit((*i)->getUnitGuid())) - pSource->getThreatManager().modifyThreatPercent(Temp, script.x); + pSource->GetThreatManager().modifyThreatPercent(Temp, script.x); } else { if (Unit* pTarget = ToUnit(GetTargetByType(pSource, target, script.modThreat.target))) - pSource->getThreatManager().modifyThreatPercent(pTarget, script.x); + pSource->GetThreatManager().modifyThreatPercent(pTarget, script.x); } return false; @@ -978,7 +978,7 @@ bool Map::ScriptCommand_SendTaxiPath(const ScriptInfo& script, WorldObject* sour return ShouldAbortScript(script); } - if (!pPlayer->isAlive()) + if (!pPlayer->IsAlive()) return ShouldAbortScript(script); pPlayer->ActivateTaxiPathTo(script.sendTaxiPath.taxiPathId, 0, true); @@ -1047,7 +1047,7 @@ bool Map::ScriptCommand_Evade(const ScriptInfo& script, WorldObject* source, Wor return ShouldAbortScript(script); } - if (pSource->AI() && pSource->isAlive()) + if (pSource->AI() && pSource->IsAlive()) pSource->AI()->EnterEvadeMode(); return false; @@ -1097,7 +1097,7 @@ bool Map::ScriptCommand_TurnTo(const ScriptInfo& script, WorldObject* source, Wo return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); switch (script.turnTo.facingLogic) @@ -1411,7 +1411,7 @@ bool Map::ScriptCommand_Flee(const ScriptInfo& script, WorldObject* source, Worl return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); if (script.flee.seekAssistance) @@ -1441,7 +1441,7 @@ bool Map::ScriptCommand_DealDamage(const ScriptInfo& script, WorldObject* source return ShouldAbortScript(script); } - if (!pTarget->isAlive()) + if (!pTarget->IsAlive()) return ShouldAbortScript(script); uint32 damage = script.dealDamage.isPercent ? pTarget->GetMaxHealth()*(script.dealDamage.damage / 100.0f) : script.dealDamage.damage; @@ -1461,7 +1461,7 @@ bool Map::ScriptCommand_ZoneCombatPulse(const ScriptInfo& script, WorldObject* s return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); pSource->SetInCombatWithZone(script.combatPulse.initialPulse); @@ -1480,7 +1480,7 @@ bool Map::ScriptCommand_CallForHelp(const ScriptInfo& script, WorldObject* sourc return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); pSource->CallForHelp(script.x); @@ -1669,7 +1669,7 @@ bool Map::ScriptCommand_StartWaypoints(const ScriptInfo& script, WorldObject* so return ShouldAbortScript(script); } - if (!pSource->isAlive()) + if (!pSource->IsAlive()) return ShouldAbortScript(script); pSource->GetMotionMaster()->Clear(false, true); @@ -1870,7 +1870,7 @@ bool Map::ScriptCommand_SetDefaultMovement(const ScriptInfo& script, WorldObject else if (script.setDefaultMovement.movementType == WAYPOINT_MOTION_TYPE) pSource->m_startwaypoint = script.setDefaultMovement.param1; - if (pSource->isAlive()) + if (pSource->IsAlive()) pSource->GetMotionMaster()->InitializeNewDefault(script.setDefaultMovement.alwaysReplace); return false; @@ -1986,7 +1986,7 @@ bool Map::ScriptCommand_RespawnCreature(const ScriptInfo& script, WorldObject* s return ShouldAbortScript(script); } - if (pSource->isAlive()) + if (pSource->IsAlive()) { if (script.respawnCreature.evenAlive) pSource->SetDeathState(JUST_DIED); @@ -2021,22 +2021,22 @@ bool Map::ScriptCommand_AssistUnit(const ScriptInfo& script, WorldObject* source if (!pSource->IsInMap(pTarget)) return ShouldAbortScript(script); - Unit* pAttacker = pTarget->getAttackerForHelper(); + Unit* pAttacker = pTarget->GetAttackerForHelper(); if (!pAttacker) return false; - if (Unit* pVictim = pSource->getVictim()) + if (Unit* pVictim = pSource->GetVictim()) { if (pVictim == pAttacker) return false; - if (!pSource->IsFriendlyTo(pAttacker) && pAttacker->isTargetableForAttack() && pSource->IsWithinDistInMap(pAttacker, 40.0f)) + if (!pSource->IsFriendlyTo(pAttacker) && pAttacker->IsTargetableForAttack() && pSource->IsWithinDistInMap(pAttacker, 40.0f)) pSource->AddThreat(pAttacker); } else { - if (pSource->AI() && !pSource->IsFriendlyTo(pAttacker) && pAttacker->isTargetableForAttack() && pSource->IsWithinDistInMap(pAttacker, 40.0f)) + if (pSource->AI() && !pSource->IsFriendlyTo(pAttacker) && pAttacker->IsTargetableForAttack() && pSource->IsWithinDistInMap(pAttacker, 40.0f)) pSource->AI()->AttackStart(pAttacker); } @@ -2054,7 +2054,7 @@ bool Map::ScriptCommand_CombatStop(const ScriptInfo& script, WorldObject* source return ShouldAbortScript(script); } - if (pSource->isInCombat()) + if (pSource->IsInCombat()) { pSource->CombatStop(true); pSource->DeleteThreatList(); @@ -2090,7 +2090,7 @@ bool Map::ScriptCommand_AddThreat(const ScriptInfo& script, WorldObject* source, return ShouldAbortScript(script); } - if (!pSource->isInCombat() || !pSource->isAlive()) + if (!pSource->IsInCombat() || !pSource->IsAlive()) return false; Unit* pTarget = ToUnit(target); @@ -2101,7 +2101,7 @@ bool Map::ScriptCommand_AddThreat(const ScriptInfo& script, WorldObject* source, return ShouldAbortScript(script); } - if (pTarget->isTargetableForAttack() && pSource->IsInMap(pTarget) && !pSource->IsFriendlyTo(pTarget)) + if (pTarget->IsTargetableForAttack() && pSource->IsInMap(pTarget) && !pSource->IsFriendlyTo(pTarget)) pSource->AddThreat(pTarget); return false; diff --git a/src/game/Movement/ConfusedMovementGenerator.cpp b/src/game/Movement/ConfusedMovementGenerator.cpp index 47eade6f5..0f0dc00f1 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_STAT_CONFUSED); unit.UpdateControl(); } @@ -46,7 +46,7 @@ template void ConfusedMovementGenerator::Reset(T &unit) { unit.StopMoving(); - unit.addUnitState(UNIT_STAT_CONFUSED); + unit.AddUnitState(UNIT_STAT_CONFUSED); unit.UpdateControl(); } @@ -54,7 +54,7 @@ template bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) { // ignore in case other no reaction state - if (unit.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE) & ~UNIT_STAT_CONFUSED)) + if (unit.HasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE) & ~UNIT_STAT_CONFUSED)) return true; if (!unit.movespline->Finalized()) @@ -86,7 +86,7 @@ bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) template<> void ConfusedMovementGenerator::Finalize(Player &unit) { - unit.clearUnitState(UNIT_STAT_CONFUSED); + unit.ClearUnitState(UNIT_STAT_CONFUSED); unit.StopMoving(); unit.UpdateControl(); } @@ -94,7 +94,7 @@ void ConfusedMovementGenerator::Finalize(Player &unit) template<> void ConfusedMovementGenerator::Finalize(Creature &unit) { - unit.clearUnitState(UNIT_STAT_CONFUSED); + unit.ClearUnitState(UNIT_STAT_CONFUSED); unit.UpdateControl(); } diff --git a/src/game/Movement/FearMovementGenerator.cpp b/src/game/Movement/FearMovementGenerator.cpp index a35033c52..4b8e00639 100644 --- a/src/game/Movement/FearMovementGenerator.cpp +++ b/src/game/Movement/FearMovementGenerator.cpp @@ -19,7 +19,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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) return; if (owner.IsRooted()) return; @@ -28,7 +28,7 @@ void FearMovementGenerator::_setTargetLocation(T &owner) if (!_getPoint(owner, x, y, z)) return; - owner.addUnitState(UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); PathFinder path(&owner); path.SetTransport(owner.GetTransport()); @@ -111,7 +111,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_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); @@ -127,7 +127,7 @@ void FearMovementGenerator::Initialize(T &owner) template<> void FearMovementGenerator::Finalize(Player &owner) { - owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); } @@ -135,8 +135,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_STAT_RUNNING), false); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.UpdateControl(); } @@ -144,7 +144,7 @@ template void FearMovementGenerator::Interrupt(T &owner) { // flee state still applied while movegen disabled - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); } template @@ -156,12 +156,12 @@ void FearMovementGenerator::Reset(T &owner) template bool FearMovementGenerator::Update(T &owner, const uint32 & time_diff) { - if (!&owner || !owner.isAlive()) + 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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) { - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); return true; } @@ -209,12 +209,12 @@ void TimedFearMovementGenerator::Initialize(Unit& owner) void TimedFearMovementGenerator::Finalize(Unit &owner) { - owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.UpdateControl(); - if (Unit* victim = owner.getVictim()) + if (Unit* victim = owner.GetVictim()) { - if (owner.isAlive()) + if (owner.IsAlive()) { owner.AttackStop(true); ((Creature*)&owner)->AI()->AttackStart(victim); @@ -229,12 +229,12 @@ TimedFearMovementGenerator::TimedFearMovementGenerator(ObjectGuid fright, uint32 bool TimedFearMovementGenerator::Update(Unit & owner, const uint32 & time_diff) { - if (!owner.isAlive()) + 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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) { - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); return true; } diff --git a/src/game/Movement/FleeingMovementGenerator.cpp b/src/game/Movement/FleeingMovementGenerator.cpp index a5aadccb6..3bb88df5e 100644 --- a/src/game/Movement/FleeingMovementGenerator.cpp +++ b/src/game/Movement/FleeingMovementGenerator.cpp @@ -37,14 +37,14 @@ 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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; - owner.addUnitState(UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); PathFinder path(&owner); path.SetTransport(owner.GetTransport()); @@ -123,7 +123,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_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); @@ -139,7 +139,7 @@ void FleeingMovementGenerator::Initialize(T &owner) template<> void FleeingMovementGenerator::Finalize(Player &owner) { - owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.StopMoving(); owner.UpdateControl(); } @@ -147,8 +147,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_STAT_RUNNING), false); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.UpdateControl(); } @@ -156,7 +156,7 @@ template void FleeingMovementGenerator::Interrupt(T &owner) { // flee state still applied while movegen disabled - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); } template @@ -168,13 +168,13 @@ void FleeingMovementGenerator::Reset(T &owner) template bool FleeingMovementGenerator::Update(T &owner, const uint32 & time_diff) { - if (!&owner || !owner.isAlive()) + if (!&owner || !owner.IsAlive()) 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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) { - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); return true; } @@ -209,11 +209,11 @@ void TimedFleeingMovementGenerator::Initialize(Unit& owner) void TimedFleeingMovementGenerator::Finalize(Unit &owner) { - owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_FLEEING_MOVE); owner.UpdateControl(); - if (Unit* victim = owner.getVictim()) + if (Unit* victim = owner.GetVictim()) { - if (owner.isAlive()) + if (owner.IsAlive()) { owner.AttackStop(true); ((Creature*)&owner)->AI()->AttackStart(victim); @@ -223,13 +223,13 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner) bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff) { - if (!owner.isAlive()) + if (!owner.IsAlive()) 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_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED) & ~UNIT_STAT_FLEEING)) { - owner.clearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); return true; } diff --git a/src/game/Movement/FollowerReference.cpp b/src/game/Movement/FollowerReference.cpp index 2af0e0da7..c383b0da2 100644 --- a/src/game/Movement/FollowerReference.cpp +++ b/src/game/Movement/FollowerReference.cpp @@ -25,12 +25,12 @@ void FollowerReference::targetObjectBuildLink() { - getTarget()->addFollower(this); + getTarget()->AddFollower(this); } void FollowerReference::targetObjectDestroyLink() { - getTarget()->removeFollower(this); + getTarget()->RemoveFollower(this); } void FollowerReference::sourceObjectDestroyLink() diff --git a/src/game/Movement/HomeMovementGenerator.cpp b/src/game/Movement/HomeMovementGenerator.cpp index 7c58435d6..785331dae 100644 --- a/src/game/Movement/HomeMovementGenerator.cpp +++ b/src/game/Movement/HomeMovementGenerator.cpp @@ -35,7 +35,7 @@ void HomeMovementGenerator::Reset(Creature &) void HomeMovementGenerator::_setTargetLocation(Creature & owner) { - if (owner.hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) return; // Remove speed reductions from low hp @@ -57,7 +57,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) init.Launch(); arrived = false; - owner.clearUnitState(UNIT_STAT_ALL_DYN_STATES); + owner.ClearUnitState(UNIT_STAT_ALL_DYN_STATES); } bool HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff) @@ -73,7 +73,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_STAT_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 793eb3048..6dfb22626 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_STAT_DISTRACTED); } void @@ -50,7 +50,7 @@ DistractMovementGenerator::Finalize(Unit& owner) owner.SetFacingTo(angle); } - owner.clearUnitState(UNIT_STAT_DISTRACTED); + owner.ClearUnitState(UNIT_STAT_DISTRACTED); } void @@ -77,10 +77,10 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff) void AssistanceDistractMovementGenerator::Finalize(Unit &unit) { - unit.clearUnitState(UNIT_STAT_DISTRACTED); - if (Unit* victim = unit.getVictim()) + unit.ClearUnitState(UNIT_STAT_DISTRACTED); + if (Unit* victim = unit.GetVictim()) { - if (unit.isAlive()) + if (unit.IsAlive()) { unit.AttackStop(true); ((Creature*)&unit)->AI()->AttackStart(victim); diff --git a/src/game/Movement/MotionMaster.cpp b/src/game/Movement/MotionMaster.cpp index afa8549b1..52db65097 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->GetTypeId() == TYPEID_UNIT && !m_owner->hasUnitState(UNIT_STAT_POSSESSED)) + if (m_owner->GetTypeId() == TYPEID_UNIT && !m_owner->HasUnitState(UNIT_STAT_POSSESSED)) { MovementGenerator* movement = FactorySelector::selectMovementGenerator(static_cast(m_owner)); push(movement == nullptr ? &si_idleMovement : movement); @@ -104,7 +104,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_STAT_POSSESSED)) { MovementGenerator* movement = FactorySelector::selectMovementGenerator(pCreature); push(movement == nullptr ? &si_idleMovement : movement); @@ -158,7 +158,7 @@ MotionMaster::~MotionMaster() void MotionMaster::UpdateMotion(uint32 diff) { - if (m_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (m_owner->HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) return; MANGOS_ASSERT(!empty()); @@ -198,7 +198,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_STAT_CAN_NOT_MOVE)) return; MANGOS_ASSERT(!empty()); @@ -359,7 +359,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_STAT_LOST_CONTROL)) return; Clear(false); @@ -421,7 +421,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_STAT_LOST_CONTROL)) return; Clear(); @@ -621,7 +621,7 @@ void MotionMaster::Mutate(MovementGenerator *m) push(m); } -void MotionMaster::propagateSpeedChange() +void MotionMaster::PropagateSpeedChange() { Impl::container_type::iterator it = Impl::c.begin(); for (; it != end(); ++it) diff --git a/src/game/Movement/MotionMaster.h b/src/game/Movement/MotionMaster.h index 5d515e9b8..ebcb96528 100644 --- a/src/game/Movement/MotionMaster.h +++ b/src/game/Movement/MotionMaster.h @@ -148,7 +148,7 @@ class MANGOS_DLL_SPEC MotionMaster : std::stack MovementGeneratorType GetCurrentMovementGeneratorType() const; - void propagateSpeedChange(); + void PropagateSpeedChange(); bool SetNextWaypoint(uint32 pointId); uint32 getLastReachedWaypoint() const; diff --git a/src/game/Movement/MovementPacketSender.h b/src/game/Movement/MovementPacketSender.h index 21286ac27..8987533f0 100644 --- a/src/game/Movement/MovementPacketSender.h +++ b/src/game/Movement/MovementPacketSender.h @@ -18,11 +18,13 @@ #ifndef MOVEMENT_SENDER_H #define MOVEMENT_SENDER_H -#include "Unit.h" +#include "Object.h" +#include "UnitDefines.h" class Player; class Unit; class MovementInfo; +struct PlayerMovementPendingChange; //! //! movement flag changes for player controlled units: diff --git a/src/game/Movement/PointMovementGenerator.cpp b/src/game/Movement/PointMovementGenerator.cpp index f9380c487..236085d6c 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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); Movement::MoveSplineInit init(unit, "PointMovementGenerator::Initialize"); init.MoveTo(i_x, i_y, i_z, _options); if (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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); MovementInform(unit); } template void PointMovementGenerator::Interrupt(T &unit) { - unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); } template @@ -82,13 +82,13 @@ bool PointMovementGenerator::Update(T &unit, const uint32 &diff) if (!&unit) return false; - if (unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) { - unit.clearUnitState(UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STAT_ROAMING_MOVE); return true; } - unit.addUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); if (!unit.movespline->Finalized() && _recalculateSpeed) { @@ -106,7 +106,7 @@ void PointMovementGenerator::MovementInform(Player&) template <> void PointMovementGenerator::MovementInform(Creature &unit) { - if (!unit.isAlive()) + if (!unit.IsAlive()) return; if (unit.AI()) @@ -146,13 +146,13 @@ bool DistancingMovementGenerator::Update(Creature &unit, const uint32 &diff) if (!&unit) return false; - if (unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STAT_CAN_NOT_MOVE)) { - unit.clearUnitState(UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STAT_ROAMING_MOVE); return false; } - unit.addUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); if (!unit.movespline->Finalized() && _recalculateSpeed) { @@ -170,13 +170,13 @@ void DistancingMovementGenerator::MovementInform(Creature &unit) void AssistanceMovementGenerator::Initialize(Creature& unit) { - if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE)) + if (unit.HasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_CAN_NOT_MOVE)) return; if (!unit.IsStopped()) unit.StopMoving(); - unit.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); Movement::MoveSplineInit init(unit, "AssistanceMovementGenerator::Initialize"); init.MoveTo(i_x, i_y, i_z, (_options & (MOVE_PATHFINDING | MOVE_FORCE_DESTINATION))); init.SetWalk(true); @@ -186,11 +186,11 @@ void AssistanceMovementGenerator::Initialize(Creature& unit) void AssistanceMovementGenerator::Finalize(Creature &unit) { - unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); unit.SetNoCallAssistance(false); unit.CallAssistance(); - if (unit.isAlive()) + if (unit.IsAlive()) unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY)); } @@ -217,7 +217,7 @@ void ChargeMovementGenerator::Initialize(T &unit) unit.StopMoving(); if (path.getPathType() & PATHFIND_NOPATH) return; - unit.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); unit.m_movementInfo.moveFlags = unit.m_movementInfo.moveFlags & ~MOVEFLAG_MASK_MOVING_OR_TURN; Movement::MoveSplineInit init(unit, "ChargeMovementGenerator::Initialize"); init.Move(&path); @@ -230,12 +230,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_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.SetRooted(true); if (_triggerAttack) if (!unit.IsPlayer() || victimGuid == unit.ToPlayer()->GetSelectionGuid()) @@ -317,24 +317,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_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.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_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.SetRooted(true); } @@ -350,7 +350,7 @@ bool ChargeMovementGenerator::Update(T &unit, const uint32 &diff) return false; } - unit.addUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); if (!unit.movespline->Finalized() && _recalculateSpeed) { diff --git a/src/game/Movement/RandomMovementGenerator.cpp b/src/game/Movement/RandomMovementGenerator.cpp index 28f58b728..3ac3aead3 100644 --- a/src/game/Movement/RandomMovementGenerator.cpp +++ b/src/game/Movement/RandomMovementGenerator.cpp @@ -52,7 +52,7 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) if (!creature.GetRandomPoint(i_positionX, i_positionY, i_positionZ, i_wanderDistance, destX, destY, destZ)) return; - creature.addUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); Movement::MoveSplineInit init(creature, "RandomMovementGenerator"); init.MoveTo(destX, destY, destZ, MOVE_PATHFINDING | MOVE_EXCLUDE_STEEP_SLOPES); init.SetWalk(true); @@ -66,10 +66,10 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) void RandomMovementGenerator::Initialize(Creature &creature) { - if (!creature.isAlive()) + if (!creature.IsAlive()) return; - creature.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); i_nextMoveTime.Reset(50); } @@ -80,14 +80,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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); } bool RandomMovementGenerator::Update(Creature &creature, const uint32 &diff) @@ -108,10 +108,10 @@ void RandomMovementGenerator::UpdateAsync(Creature &creature, uint32 diff) { // Lock async updates for safety, see Unit::asyncMovesplineLock doc ACE_Guard guard(creature.asyncMovesplineLock); - if (creature.hasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) + if (creature.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) { i_nextMoveTime.Reset(0); // Expire the timer - creature.clearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); } else if (creature.IsNoMovementSpellCasted()) { diff --git a/src/game/Movement/TargetedMovementGenerator.cpp b/src/game/Movement/TargetedMovementGenerator.cpp index c7188a8ed..01d67861e 100644 --- a/src/game/Movement/TargetedMovementGenerator.cpp +++ b/src/game/Movement/TargetedMovementGenerator.cpp @@ -39,7 +39,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_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) return; float x, y, z; @@ -100,14 +100,14 @@ 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_STAT_FOLLOW)); Movement::MoveSplineInit init(owner, "TargetedMovementGenerator"); path.SetTransport(transport); path.calculate(x, y, z, petFollowing); PathType pathType = path.getPathType(); m_bReachable = pathType & PATHFIND_NORMAL; - if (!m_bReachable && !!(pathType & PATHFIND_INCOMPLETE) && owner.hasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH)) + if (!m_bReachable && !!(pathType & PATHFIND_INCOMPLETE) && owner.HasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH)) { m_bReachable = true; } @@ -135,7 +135,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) if (pathLength < 0.4f || (pathLength < 4.0f && (i_target->GetPositionZ() - owner.GetPositionZ()) > 10.0f) || // He is flying too high for me. Moving a few meters wont change anything. (pathType & PATHFIND_NOPATH && !petFollowing) || - (pathType & PATHFIND_INCOMPLETE && !owner.hasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH) && !petFollowing) || + (pathType & PATHFIND_INCOMPLETE && !owner.HasUnitState(UNIT_STAT_ALLOW_INCOMPLETE_PATH) && !petFollowing) || (!petFollowing && !m_bReachable)) { if (!losChecked) @@ -159,7 +159,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) if (dist > 15.0f) { Unit* pOwner = owner.GetCharmerOrOwner(); - if (pOwner && !pOwner->isInCombat() && !owner.isInCombat()) + if (pOwner && !pOwner->IsInCombat() && !owner.IsInCombat()) { float distFactor = 1.0f; if (pOwner->IsMounted()) @@ -224,8 +224,8 @@ 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) - || (this->GetMovementGeneratorType() == CHASE_MOTION_TYPE && owner.hasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT)) + if (!i_target.isValid() || !i_target->IsInWorld() || !owner.IsAlive() || owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED) + || (this->GetMovementGeneratorType() == CHASE_MOTION_TYPE && owner.HasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT)) || static_cast(this)->_lostTarget(owner) || owner.IsNoMovementSpellCasted()) return; @@ -241,16 +241,16 @@ bool ChaseMovementGenerator::Update(T &owner, const uint32 & time_diff) if (!i_target.isValid() || !i_target->IsInWorld()) return false; - if (!owner.isAlive()) + if (!owner.IsAlive()) return true; - if (owner.hasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) + if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) { _clearUnitStateMove(owner); return true; } - if (owner.hasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT)) + if (owner.HasUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT)) { _clearUnitStateMove(owner); return true; @@ -420,7 +420,7 @@ void ChaseMovementGenerator::DoSpreadIfNeeded(T &owner, Unit* target) // there's enough of them. Unit* pSpreadingTarget = nullptr; - for (auto& attacker : target->getAttackers()) + for (auto& attacker : target->GetAttackers()) { if (attacker->IsCreature() && (attacker != &owner) && (owner.GetObjectBoundingRadius() - 2.0f < attacker->GetObjectBoundingRadius()) && @@ -443,7 +443,7 @@ void ChaseMovementGenerator::DoSpreadIfNeeded(T &owner, Unit* target) float const new_angle = (his_angle > my_angle) ? my_angle - frand(0.4f, 1.0f) : my_angle + frand(0.4f, 1.0f); float x, y, z; - target->GetNearPoint(&owner, x, y, z, owner.GetObjectBoundingRadius(), frand(0.8f, (target->getAttackers().size() > 5 ? 4.0f : 2.0f)), new_angle); + target->GetNearPoint(&owner, x, y, z, owner.GetObjectBoundingRadius(), frand(0.8f, (target->GetAttackers().size() > 5 ? 4.0f : 2.0f)), new_angle); // Don't move beyond attack range. if (!owner.CanReachWithMeleeAutoAttackAtPosition(target, x, y, z, 0.0f)) @@ -473,7 +473,7 @@ void ChaseMovementGenerator::_reachTarget(T &owner) template<> void ChaseMovementGenerator::Initialize(Player &owner) { - owner.addUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); m_bRecalculateTravel = true; owner.GetMotionMaster()->SetNeedAsyncUpdate(); } @@ -482,7 +482,7 @@ template<> void ChaseMovementGenerator::Initialize(Creature &owner) { owner.SetWalk(false, false); - owner.addUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); m_bRecalculateTravel = true; owner.GetMotionMaster()->SetNeedAsyncUpdate(); } @@ -490,14 +490,14 @@ void ChaseMovementGenerator::Initialize(Creature &owner) template void ChaseMovementGenerator::Finalize(T &owner) { - owner.clearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.ClearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); //MovementInform(owner); } template void ChaseMovementGenerator::Interrupt(T &owner) { - owner.clearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); + owner.ClearUnitState(UNIT_STAT_CHASE | UNIT_STAT_CHASE_MOVE); } template @@ -514,7 +514,7 @@ void ChaseMovementGenerator::MovementInform(T& /*unit*/) template<> void ChaseMovementGenerator::MovementInform(Creature& unit) { - if (!unit.isAlive()) + if (!unit.IsAlive()) return; // Pass back the GUIDLow of the target. If it is pet's owner then PetAI will handle @@ -547,10 +547,10 @@ bool FollowMovementGenerator::Update(T &owner, const uint32 & time_diff) if (!i_target.isValid() || !i_target->IsInWorld()) return false; - if (!owner.isAlive()) + if (!owner.IsAlive()) return true; - if (owner.hasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) + if (owner.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_POSSESSED)) { _clearUnitStateMove(owner); return true; @@ -665,7 +665,7 @@ void FollowMovementGenerator::_updateSpeed(Creature &u) template<> void FollowMovementGenerator::Initialize(Player &owner) { - owner.addUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -673,7 +673,7 @@ void FollowMovementGenerator::Initialize(Player &owner) template<> void FollowMovementGenerator::Initialize(Creature &owner) { - owner.addUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -681,7 +681,7 @@ void FollowMovementGenerator::Initialize(Creature &owner) template void FollowMovementGenerator::Finalize(T &owner) { - owner.clearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.ClearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); _updateSpeed(owner); //MovementInform(owner); } @@ -689,7 +689,7 @@ void FollowMovementGenerator::Finalize(T &owner) template void FollowMovementGenerator::Interrupt(T &owner) { - owner.clearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); + owner.ClearUnitState(UNIT_STAT_FOLLOW | UNIT_STAT_FOLLOW_MOVE); _updateSpeed(owner); } @@ -707,7 +707,7 @@ void FollowMovementGenerator::MovementInform(T& /*unit*/) template<> void FollowMovementGenerator::MovementInform(Creature& unit) { - if (!unit.isAlive()) + if (!unit.IsAlive()) return; // Pass back the GUIDLow of the target. If it is pet's owner then PetAI will handle diff --git a/src/game/Movement/TargetedMovementGenerator.h b/src/game/Movement/TargetedMovementGenerator.h index d55c888fc..5487ece63 100644 --- a/src/game/Movement/TargetedMovementGenerator.h +++ b/src/game/Movement/TargetedMovementGenerator.h @@ -96,10 +96,10 @@ class MANGOS_DLL_SPEC ChaseMovementGenerator : public TargetedMovementGeneratorM void Reset(T &); void MovementInform(T &); - static void _clearUnitStateMove(T &u) { u.clearUnitState(UNIT_STAT_CHASE_MOVE); } - static void _addUnitStateMove(T &u) { u.addUnitState(UNIT_STAT_CHASE_MOVE); } + static void _clearUnitStateMove(T &u) { u.ClearUnitState(UNIT_STAT_CHASE_MOVE); } + static void _addUnitStateMove(T &u) { u.AddUnitState(UNIT_STAT_CHASE_MOVE); } bool EnableWalking() const { return false;} - bool _lostTarget(T &u) const { return u.getVictim() != this->GetTarget(); } + bool _lostTarget(T &u) const { return u.GetVictim() != this->GetTarget(); } void _reachTarget(T &); private: ShortTimeTracker m_spreadTimer{ 0 }; @@ -144,8 +144,8 @@ class MANGOS_DLL_SPEC FollowMovementGenerator : public TargetedMovementGenerator void Reset(T &); void MovementInform(T &); - static void _clearUnitStateMove(T &u) { u.clearUnitState(UNIT_STAT_FOLLOW_MOVE); } - static void _addUnitStateMove(T &u) { u.addUnitState(UNIT_STAT_FOLLOW_MOVE); } + static void _clearUnitStateMove(T &u) { u.ClearUnitState(UNIT_STAT_FOLLOW_MOVE); } + static void _addUnitStateMove(T &u) { u.AddUnitState(UNIT_STAT_FOLLOW_MOVE); } bool EnableWalking() const; bool _lostTarget(T &) const { return false; } void _reachTarget(T &) {} diff --git a/src/game/Movement/WaypointMovementGenerator.cpp b/src/game/Movement/WaypointMovementGenerator.cpp index 97dd98f7e..361dd84e2 100644 --- a/src/game/Movement/WaypointMovementGenerator.cpp +++ b/src/game/Movement/WaypointMovementGenerator.cpp @@ -66,7 +66,7 @@ void WaypointMovementGenerator::LoadPath(Creature &creature, int32 pat void WaypointMovementGenerator::Initialize(Creature &creature) { - creature.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); } void WaypointMovementGenerator::InitializeWaypointPath(Creature& u, int32 id, uint32 startPoint, WaypointPathOrigin wpSource, uint32 initialDelay, uint32 overwriteEntry, bool repeat) @@ -93,19 +93,19 @@ void WaypointMovementGenerator::InitializeWaypointPath(Creature& u, in 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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); } void WaypointMovementGenerator::Reset(Creature &creature) { - creature.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); if (m_isWandering) { @@ -140,7 +140,7 @@ bool WaypointMovementGenerator::OnArrived(Creature& creature) if (m_isArrivalDone) return true; - creature.clearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); m_isArrivalDone = true; WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); @@ -256,7 +256,7 @@ void WaypointMovementGenerator::StartMove(Creature &creature) else creature.AI()->MovementInform(WAYPOINT_SPECIAL_FINISHED_LAST + m_pathId, currPoint->first); - if (creature.isDead() || !creature.IsInWorld()) // Might have happened with above calls + if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls return; } @@ -265,10 +265,10 @@ void WaypointMovementGenerator::StartMove(Creature &creature) m_isArrivalDone = false; - creature.addUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); WaypointNode const& nextNode = currPoint->second; - creature.SetWalk(!creature.hasUnitState(UNIT_STAT_RUNNING) && !creature.IsLevitating(), false); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING) && !creature.IsLevitating(), false); Movement::MoveSplineInit init(creature, "WaypointMovementGenerator::StartMove"); init.MoveTo(nextNode.x, nextNode.y, nextNode.z, (m_PathOrigin == PATH_FROM_SPECIAL) ? MOVE_STRAIGHT_PATH : MOVE_PATHFINDING); @@ -282,13 +282,13 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 // 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_STAT_CAN_NOT_MOVE | UNIT_STAT_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_STAT_ROAMING_MOVE); return true; } @@ -387,7 +387,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) player.SetFallInformation(0, player.GetPositionZ()); // 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_STAT_TAXI_FLIGHT); player.RemoveUnitMovementFlag(MOVEFLAG_FLYING); player.Unmount(); @@ -396,7 +396,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) if (player.GetTaxi().empty()) { - player.getHostileRefManager().setOnlineOfflineState(true); + player.GetHostileRefManager().setOnlineOfflineState(true); if (player.pvpInfo.inPvPEnforcedArea) { player.CastSpell(&player, 2479, true); @@ -414,7 +414,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) void FlightPathMovementGenerator::Interrupt(Player & player) { - player.clearUnitState(UNIT_STAT_TAXI_FLIGHT); + player.ClearUnitState(UNIT_STAT_TAXI_FLIGHT); player.RemoveUnitMovementFlag(MOVEFLAG_FLYING); } @@ -422,8 +422,8 @@ void FlightPathMovementGenerator::Interrupt(Player & player) void FlightPathMovementGenerator::Reset(Player & player, float modSpeed) { - player.getHostileRefManager().setOnlineOfflineState(false); - player.addUnitState(UNIT_STAT_TAXI_FLIGHT); + player.GetHostileRefManager().setOnlineOfflineState(false); + player.AddUnitState(UNIT_STAT_TAXI_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); Movement::MoveSplineInit init(player, "FlightPathMovementGenerator::Reset"); @@ -521,10 +521,10 @@ bool PatrolMovementGenerator::InitPatrol(Creature& creature) void PatrolMovementGenerator::Initialize(Creature &creature) { - if (!creature.isAlive()) + if (!creature.IsAlive()) return; - creature.addUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); StartMove(creature); } @@ -535,21 +535,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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_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_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE); + creature.SetWalk(!creature.HasUnitState(UNIT_STAT_RUNNING), false); } bool PatrolMovementGenerator::Update(Creature &creature, const uint32 &diff) { - if (creature.hasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) + if (creature.HasUnitState(UNIT_STAT_CAN_NOT_MOVE | UNIT_STAT_DISTRACTED)) { - creature.clearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); return true; } @@ -603,7 +603,7 @@ void PatrolMovementGenerator::StartMove(Creature& creature) 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_STAT_ROAMING_MOVE); PathInfo p(&creature); p.calculate(x, y, z, true); diff --git a/src/game/Movement/spline/MoveSplineInit.cpp b/src/game/Movement/spline/MoveSplineInit.cpp index d47798ad8..ccbadba50 100644 --- a/src/game/Movement/spline/MoveSplineInit.cpp +++ b/src/game/Movement/spline/MoveSplineInit.cpp @@ -23,6 +23,7 @@ #include "Transport.h" #include "ObjectAccessor.h" #include "Anticheat.h" +#include "WorldPacket.h" namespace Movement { diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 848d8f1c7..716b144d2 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -99,11 +99,11 @@ public: uint32 i_corpses; }; -template void addUnitState(T* /*obj*/, CellPair const& /*cell_pair*/) +template void AddUnitState(T* /*obj*/, CellPair const& /*cell_pair*/) { } -template<> void addUnitState(Creature *obj, CellPair const& cell_pair) +template<> void AddUnitState(Creature *obj, CellPair const& cell_pair) { Cell cell(cell_pair); @@ -158,7 +158,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager & grid.AddGridObject(obj); - addUnitState(obj, cell); + AddUnitState(obj, cell); obj->SetMap(map); obj->AddToWorld(); if (obj->isActiveObject() && !map->IsUnloading()) @@ -191,7 +191,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType grid.AddWorldObject(obj); - addUnitState(obj, cell); + AddUnitState(obj, cell); obj->SetMap(map); obj->AddToWorld(); if (obj->isActiveObject() && !map->IsUnloading()) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index d32c4df7f..cfc64d2f1 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -719,7 +719,7 @@ bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid guid, std::string &name) const Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const { if (auto player = GetPlayer(guid)) - return Player::TeamForRace(player->getRace()); + return Player::TeamForRace(player->GetRace()); if (auto pData = sObjectMgr.GetPlayerDataByGUID(guid.GetCounter())) return Player::TeamForRace(pData->uiRace); @@ -732,7 +732,7 @@ uint8 ObjectMgr::GetPlayerClassByGUID(ObjectGuid guid) const // Prevent DB access for online player. if (Player* player = GetPlayer(guid)) { - return player->getClass(); + return player->GetClass(); } uint32 lowguid = guid.GetCounter(); @@ -779,7 +779,7 @@ PlayerCacheData* ObjectMgr::InsertPlayerInCache(Player *pPlayer) return nullptr; auto accountId = pSession->GetAccountId(); - return InsertPlayerInCache(pPlayer->GetGUIDLow(), pPlayer->getRace(), pPlayer->getClass(), pPlayer->getGender(), accountId, pPlayer->GetName(), pPlayer->getLevel(), pPlayer->GetCachedZoneId()); + return InsertPlayerInCache(pPlayer->GetGUIDLow(), pPlayer->GetRace(), pPlayer->GetClass(), pPlayer->GetGender(), accountId, pPlayer->GetName(), pPlayer->GetLevel(), pPlayer->GetCachedZoneId()); } void ObjectMgr::UpdatePlayerCachedPosition(Player *pPlayer) @@ -829,7 +829,7 @@ void ObjectMgr::UpdatePlayerCache(Player* pPlayer) if (!data) return; if (pPlayer->GetSession()) - UpdatePlayerCache(data, pPlayer->getRace(), pPlayer->getClass(), pPlayer->getGender(), pPlayer->GetSession()->GetAccountId(), pPlayer->GetName(), pPlayer->getLevel(), pPlayer->GetCachedZoneId()); + UpdatePlayerCache(data, pPlayer->GetRace(), pPlayer->GetClass(), pPlayer->GetGender(), pPlayer->GetSession()->GetAccountId(), pPlayer->GetName(), pPlayer->GetLevel(), pPlayer->GetCachedZoneId()); UpdatePlayerCachedPosition(data, pPlayer->GetMapId(), pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), pPlayer->IsTaxiFlying()); } diff --git a/src/game/Objects/Corpse.cpp b/src/game/Objects/Corpse.cpp index 3b7b131cc..59d0e7fb3 100644 --- a/src/game/Objects/Corpse.cpp +++ b/src/game/Objects/Corpse.cpp @@ -255,7 +255,7 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields) return true; } -bool Corpse::isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const +bool Corpse::IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const { return IsInWorld() && pDetector->IsInWorld() && IsWithinDist(viewPoint, pDetector->GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f) + GetVisibilityModifier(), false); } @@ -290,9 +290,14 @@ bool Corpse::IsExpired(time_t t) const return m_time < t - 3 * DAY; } -uint32 Corpse::getLevel() const +uint32 Corpse::GetFactionTemplateId() const +{ + return m_faction->ID; +} + +uint32 Corpse::GetLevel() const { if (Unit* pOwner = ObjectAccessor::GetUnit(*this, GetOwnerGuid())) - return pOwner->getLevel(); + return pOwner->GetLevel(); return DEFAULT_MAX_LEVEL; } \ No newline at end of file diff --git a/src/game/Objects/Corpse.h b/src/game/Objects/Corpse.h index d9f7b5106..72aaad7da 100644 --- a/src/game/Objects/Corpse.h +++ b/src/game/Objects/Corpse.h @@ -81,7 +81,7 @@ class Corpse : public WorldObject GridPair const& GetGrid() const { return m_grid; } void SetGrid(GridPair const& grid) { m_grid = grid; } - bool isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; + bool IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; Loot loot; // remove insignia ONLY at BG Player* lootRecipient; @@ -92,8 +92,8 @@ class Corpse : public WorldObject bool IsExpired(time_t t) const; void SetFactionTemplate(FactionTemplateEntry const* entry) { m_faction = entry; } FactionTemplateEntry const* GetFactionTemplate() { return m_faction; } - uint32 getFaction() const final { return m_faction->ID; } - uint32 getLevel() const final ; + uint32 GetFactionTemplateId() const final; + uint32 GetLevel() const final ; private: GridReference m_gridRef; FactionTemplateEntry const* m_faction; diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 9e365399a..d353bfb5b 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -235,7 +235,7 @@ void Creature::RemoveFromWorld() void Creature::RemoveCorpse() { - if ((getDeathState() != CORPSE && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault)) + if ((GetDeathState() != CORPSE && !m_isDeadByDefault) || (GetDeathState() != ALIVE && m_isDeadByDefault)) return; m_corpseDecayTimer = 0; @@ -484,7 +484,7 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData *data /*= SelectLevel(GetCreatureInfo(), preserveHPAndPower ? GetHealthPercent() : 100.0f, preserveHPAndPower ? GetPowerPercent(POWER_MANA) : 100.0f); - setFaction(GetCreatureInfo()->faction); + SetFactionTemplateId(GetCreatureInfo()->faction); SetUInt32Value(UNIT_NPC_FLAGS, GetCreatureInfo()->npc_flags); @@ -636,7 +636,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) SetDeathState(JUST_DIED); SetHealth(0); i_motionMaster.Clear(); - clearUnitState(UNIT_STAT_ALL_DYN_STATES); + ClearUnitState(UNIT_STAT_ALL_DYN_STATES); LoadCreatureAddon(true); } else @@ -746,7 +746,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) _lastDamageTakenForEvade += update_diff; Unit::Update(update_diff, diff); - if (getVictim()) + if (GetVictim()) { float x, y, z; GetRespawnCoord(x, y, z, nullptr, nullptr); @@ -756,7 +756,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) // creature can be dead after Unit::Update call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) - if (!isAlive()) + if (!IsAlive()) break; float hpPercent = GetHealthPercent(); @@ -765,24 +765,24 @@ void Creature::Update(uint32 update_diff, uint32 diff) ModifyAuraState(AURA_STATE_HEALTHLESS_5_PERCENT, hpPercent < 6.0f); bool unreachableTarget = !i_motionMaster.empty() && - getVictim() && + GetVictim() && GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE && !HasDistanceCasterMovement() && - (!CanReachWithMeleeAutoAttack(getVictim()) || !IsWithinLOSInMap(getVictim())) && + (!CanReachWithMeleeAutoAttack(GetVictim()) || !IsWithinLOSInMap(GetVictim())) && !GetMotionMaster()->GetCurrent()->IsReachable(); // No evade mode for pets. if (unreachableTarget && GetCharmerOrOwnerGuid().IsPlayer()) unreachableTarget = false; if (unreachableTarget) - if (getVictim()) - if (Player* victimPlayer = getVictim()->ToPlayer()) + if (GetVictim()) + if (Player* victimPlayer = GetVictim()->ToPlayer()) if (victimPlayer->GetCheatData() && victimPlayer->GetCheatData()->IsInKnockBack()) unreachableTarget = false; if (unreachableTarget) { m_TargetNotReachableTimer += update_diff; if (GetMapId() == 30 && CanHaveThreatList() && m_TargetNotReachableTimer > 1000) // Alterac Valley exploit fix - getThreatManager().modifyThreatPercent(getVictim(), -101); + GetThreatManager().modifyThreatPercent(GetVictim(), -101); } else m_TargetNotReachableTimer = 0; @@ -829,7 +829,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) // creature can be dead after UpdateAI call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) - if (!isAlive()) + if (!IsAlive()) break; RegenerateAll(update_diff, IsEvadeBecauseTargetNotReachable()); @@ -869,7 +869,7 @@ void Creature::RegenerateAll(uint32 update_diff, bool skipCombatCheck) if (m_regenTimer > 0) return; - if (!isInCombat() || IsPolymorphed() || skipCombatCheck) + if (!IsInCombat() || IsPolymorphed() || skipCombatCheck) RegenerateHealth(); RegenerateMana(); @@ -891,7 +891,7 @@ void Creature::RegenerateMana() uint32 addvalue = 0; // Combat and any controlled creature - if (isInCombat() || GetCharmerOrOwnerGuid()) + if (IsInCombat() || GetCharmerOrOwnerGuid()) { if (!IsUnderLastManaUseEffect()) addvalue = m_manaRegen; @@ -943,7 +943,7 @@ void Creature::RegenerateHealth() void Creature::DoFlee() { - if (!getVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || hasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) + if (!GetVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || HasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) return; float hpPercent = GetHealthPercent(); @@ -953,15 +953,15 @@ void Creature::DoFlee() SetNoSearchAssistance(true); - SetFleeing(true, getVictim()->GetObjectGuid(), 0, sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); - MonsterTextEmote(CREATURE_FLEE_TEXT, getVictim()); + SetFleeing(true, GetVictim()->GetObjectGuid(), 0, sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); + MonsterTextEmote(CREATURE_FLEE_TEXT, GetVictim()); UpdateSpeed(MOVE_RUN, false); InterruptSpellsWithInterruptFlags(SPELL_INTERRUPT_FLAG_MOVEMENT); } void Creature::DoFleeToGetAssistance() { - if (!getVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || hasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) + if (!GetVictim() || HasAuraType(SPELL_AURA_PREVENTS_FLEEING) || HasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) return; float radius = sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); @@ -970,20 +970,20 @@ void Creature::DoFleeToGetAssistance() { Creature* pCreature = nullptr; - MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius); + MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this, GetVictim(), radius); MaNGOS::CreatureLastSearcher searcher(pCreature, u_check); Cell::VisitGridObjects(this, searcher, radius); SetNoSearchAssistance(true); if (!pCreature) - SetFleeing(true, getVictim()->GetObjectGuid(), 0, sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); + SetFleeing(true, GetVictim()->GetObjectGuid(), 0, sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_FLEE_DELAY)); else { GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ()); SetTargetGuid(ObjectGuid()); } - MonsterTextEmote(CREATURE_FLEE_TEXT, getVictim()); + MonsterTextEmote(CREATURE_FLEE_TEXT, GetVictim()); UpdateSpeed(MOVE_RUN, false); InterruptSpellsWithInterruptFlags(SPELL_INTERRUPT_FLAG_MOVEMENT); } @@ -998,7 +998,7 @@ float Creature::GetFleeingSpeed() const void Creature::MoveAwayFromTarget(Unit* pTarget, float distance) { - if (hasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) + if (HasUnitState(UNIT_STAT_NOT_MOVE | UNIT_STAT_CONFUSED | UNIT_STAT_LOST_CONTROL)) return; GetMotionMaster()->MoveDistance(pTarget, distance); @@ -1080,7 +1080,7 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const { - if (!isTrainer()) + if (!IsTrainer()) return false; TrainerSpellData const* cSpells = GetTrainerSpells(); @@ -1097,7 +1097,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const switch (GetCreatureInfo()->trainer_type) { case TRAINER_TYPE_CLASS: - if (pPlayer->getClass() != GetCreatureInfo()->trainer_class) + if (pPlayer->GetClass() != GetCreatureInfo()->trainer_class) { if (msg) { @@ -1137,7 +1137,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const } break; case TRAINER_TYPE_PETS: - if (pPlayer->getClass() != CLASS_HUNTER) + if (pPlayer->GetClass() != CLASS_HUNTER) { if (msg) { @@ -1148,7 +1148,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const } break; case TRAINER_TYPE_MOUNTS: - if (GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race) + if (GetCreatureInfo()->trainer_race && pPlayer->GetRace() != GetCreatureInfo()->trainer_race) { // Allowed to train if exalted if (FactionTemplateEntry const* faction_template = getFactionTemplateEntry()) @@ -1210,7 +1210,7 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const { - if (!isBattleMaster()) + if (!IsBattleMaster()) return false; BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); @@ -1244,9 +1244,9 @@ bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const bool Creature::CanTrainAndResetTalentsOf(Player* pPlayer) const { - return pPlayer->getLevel() >= 10 + return pPlayer->GetLevel() >= 10 && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS - && pPlayer->getClass() == GetCreatureInfo()->trainer_class; + && pPlayer->GetClass() == GetCreatureInfo()->trainer_class; } /** @@ -1673,7 +1673,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map) m_defaultMovementType = MovementGeneratorType(data->movementType); // Creature Linking, Initial load is handled like respawn - if (m_isCreatureLinkingTrigger && isAlive()) + if (m_isCreatureLinkingTrigger && IsAlive()) GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, this); if (data->spawnFlags & SPAWN_FLAG_NOT_VISIBLE) @@ -1801,7 +1801,7 @@ float Creature::GetAttackDistance(Unit const* pl) const // SPELL_AURA_MOD_DETECT_RANGE: Par exemple [2908 - Apaiser les animaux]. Affecte uniquement si niveau < 70 par exemple (rang 3). AuraList const& nModDetectRange = GetAurasByType(SPELL_AURA_MOD_DETECT_RANGE); for (AuraList::const_iterator i = nModDetectRange.begin(); i != nModDetectRange.end(); ++i) - if ((*i)->GetSpellProto()->MaxTargetLevel >= getLevel()) + if ((*i)->GetSpellProto()->MaxTargetLevel >= GetLevel()) finalDistance += (*i)->GetModifier()->m_amount; // detected range auras @@ -1866,7 +1866,7 @@ void Creature::SetDeathState(DeathState s) if (s == JUST_ALIVED) { - clearUnitState(UNIT_STAT_ALL_STATE); + ClearUnitState(UNIT_STAT_ALL_STATE); CreatureInfo const *cinfo = GetCreatureInfo(); @@ -1898,7 +1898,7 @@ void Creature::SetDeathState(DeathState s) bool Creature::FallGround() { // Only if state is JUST_DIED. CORPSE_FALLING is set below and promoted to CORPSE later - if (getDeathState() != JUST_DIED) + if (GetDeathState() != JUST_DIED) return false; // use larger distance for vmap height search than in most other cases @@ -1963,14 +1963,14 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn) return; } - if (isAlive()) + if (IsAlive()) SetDeathState(JUST_DIED); RemoveCorpse(); SetHealth(0); // just for nice GM-mode view } -bool Creature::IsImmuneToSpell(SpellEntry const *spellInfo, bool castOnSelf) +bool Creature::IsImmuneToSpell(SpellEntry const *spellInfo, bool castOnSelf) const { if (!spellInfo) return false; @@ -2004,7 +2004,7 @@ bool Creature::IsImmuneToSpell(SpellEntry const *spellInfo, bool castOnSelf) return Unit::IsImmuneToSpell(spellInfo, castOnSelf); } -bool Creature::IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo) +bool Creature::IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo) const { if (GetCreatureInfo()->school_immune_mask & meleeSchoolMask) return true; @@ -2070,11 +2070,11 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const return false; // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 - if (pl->isAlive() || pl->GetDeathTimer() > 0) - return (isAlive() || m_corpseDecayTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE)); + if (pl->IsAlive() || pl->GetDeathTimer() > 0) + return (IsAlive() || m_corpseDecayTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE)); // Dead player see live creatures near own corpse - if (isAlive()) + if (IsAlive()) { Corpse *corpse = pl->GetCorpse(); if (corpse) @@ -2107,7 +2107,7 @@ void Creature::SendAIReaction(AiReaction reactionType) void Creature::CallAssistance() { - if (!m_AlreadyCallAssistance && getVictim() && !IsPet() && !isCharmed()) + if (!m_AlreadyCallAssistance && GetVictim() && !IsPet() && !IsCharmed()) { SetNoCallAssistance(true); @@ -2116,16 +2116,16 @@ void Creature::CallAssistance() { std::list assistList; - MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); + MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, GetVictim(), radius); MaNGOS::CreatureListSearcher searcher(assistList, u_check); Cell::VisitGridObjects(this, searcher, radius); - if (!getVictim()) // May be invalidated by AI at grid activation ... + if (!GetVictim()) // May be invalidated by AI at grid activation ... return; if (!assistList.empty()) { - AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetObjectGuid(), *this, assistList); + AssistDelayEvent *e = new AssistDelayEvent(GetVictim()->GetObjectGuid(), *this, assistList); m_Events.AddEvent(e, m_Events.CalculateTime(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY))); } } @@ -2134,17 +2134,17 @@ void Creature::CallAssistance() void Creature::CallForHelp(float fRadius) { - if (fRadius <= 0.0f || !getVictim() || IsPet() || isCharmed()) + if (fRadius <= 0.0f || !GetVictim() || IsPet() || IsCharmed()) return; - MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); + MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, GetVictim(), fRadius); MaNGOS::CreatureWorker worker(this, u_do); Cell::VisitGridObjects(this, worker, fRadius); } bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const { - if (!isAlive()) + if (!IsAlive()) return false; if (GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_ASSIST) @@ -2157,7 +2157,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / return false; // skip fighting creature - if (isInCombat()) + if (IsInCombat()) return false; // only free creature @@ -2174,7 +2174,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / // only from same creature faction if (checkfaction) { - if (getFaction() != u->getFaction()) + if (GetFactionTemplateId() != u->GetFactionTemplateId()) return false; } else @@ -2192,13 +2192,13 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / bool Creature::CanInitiateAttack() { - if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED)) + if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED)) return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return false; - if (isPassiveToHostile()) + if (IsPassiveToHostile()) return false; if (IsTempPacified()) @@ -2212,7 +2212,7 @@ class DynamicRespawnRatesChecker public: DynamicRespawnRatesChecker(Creature* crea) : _count(0), _hasNearbyEscort(false) { - _myLevel = crea->getLevel(); + _myLevel = crea->GetLevel(); _maxLevelDiff = sWorld.getConfig(CONFIG_UINT32_DYN_RESPAWN_PLAYERS_LEVELDIFF); } void operator()(Player* player) @@ -2223,7 +2223,7 @@ public: return; } - if (uint32(abs(int32(player->getLevel()) - (int32)_myLevel)) > _maxLevelDiff) + if (uint32(abs(int32(player->GetLevel()) - (int32)_myLevel)) > _maxLevelDiff) return; ++_count; @@ -2250,7 +2250,7 @@ void Creature::ApplyDynamicRespawnDelay(uint32& delay, CreatureData const* data) if (!data || !(data->spawnFlags & SPAWN_FLAG_FORCE_DYNAMIC_ELITE)) return; - if (getLevel() > sWorld.getConfig(CONFIG_UINT32_DYN_RESPAWN_AFFECT_LEVEL_BELOW)) + if (GetLevel() > sWorld.getConfig(CONFIG_UINT32_DYN_RESPAWN_AFFECT_LEVEL_BELOW)) return; float checkRange = sWorld.getConfig(CONFIG_FLOAT_DYN_RESPAWN_CHECK_RANGE); if (checkRange <= 0) @@ -2472,10 +2472,10 @@ void Creature::SetInCombatWithZone(bool initialPulse) if (pPlayer->IsGameMaster()) continue; - if (!initialPulse && pPlayer->isInCombat()) + if (!initialPulse && pPlayer->IsInCombat()) continue; - if (pPlayer->isAlive() && !IsFriendlyTo(pPlayer)) + if (pPlayer->IsAlive() && !IsFriendlyTo(pPlayer)) { pPlayer->SetInCombatWith(this); AddThreat(pPlayer); @@ -2493,13 +2493,13 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* if (selectFlags & SELECT_FLAG_NO_TOTEM && pTarget->ToCreature() && pTarget->ToCreature()->IsTotem()) return false; - if (selectFlags & SELECT_FLAG_POWER_MANA && pTarget->getPowerType() != POWER_MANA) + if (selectFlags & SELECT_FLAG_POWER_MANA && pTarget->GetPowerType() != POWER_MANA) return false; - if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->getPowerType() != POWER_RAGE) + if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE) return false; - if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->getPowerType() != POWER_ENERGY) + if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY) return false; if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !IsWithinMeleeRange(pTarget)) @@ -2685,7 +2685,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S return nullptr; // ThreatList m_threatlist; - ThreatList const& threatlist = getThreatManager().getThreatList(); + ThreatList const& threatlist = GetThreatManager().getThreatList(); ThreatList::const_iterator itr = threatlist.begin(); ThreatList::const_reverse_iterator ritr = threatlist.rbegin(); @@ -3031,7 +3031,7 @@ const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const void Creature::SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags) { m_temporaryFactionFlags = tempFactionFlags; - setFaction(factionId); + SetFactionTemplateId(factionId); } void Creature::ClearTemporaryFaction() @@ -3039,11 +3039,11 @@ void Creature::ClearTemporaryFaction() // No restore if creature is charmed/possessed. // For later we may consider extend to restore to charmer faction where charmer is creature. // This can also be done by update any pet/charmed of creature at any faction change to charmer. - if (isCharmed()) + if (IsCharmed()) return; m_temporaryFactionFlags = TEMPFACTION_NONE; - setFaction(GetCreatureInfo()->faction); + SetFactionTemplateId(GetCreatureInfo()->faction); } void Creature::SendAreaSpiritHealerQueryOpcode(Player *pl) @@ -3068,7 +3068,7 @@ void Creature::DisappearAndDie() if (IsCreature() && ToCreature()->IsPet()) ((Pet*)this)->Unsummon(PET_SAVE_AS_DELETED); DestroyForNearbyPlayers(); - if (isAlive()) + if (IsAlive()) SetDeathState(JUST_DIED); RemoveCorpse(); } @@ -3123,7 +3123,7 @@ void Creature::OnEnterCombat(Unit* pWho, bool notInCombat) if (!pWho) return; - if (i_AI && !hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) + if (i_AI && !HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) i_AI->AttackedBy(pWho); if (_creatureGroup) @@ -3178,7 +3178,7 @@ Unit* Creature::GetNearestVictimInRange(float min, float max) float bestRange = max; Unit* pUnit = nullptr; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3203,7 +3203,7 @@ Unit* Creature::GetFarthestVictimInRange(float min, float max) float bestRange = min; Unit* pUnit = nullptr; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3225,7 +3225,7 @@ Unit* Creature::GetVictimInRange(float min, float max) if (!CanHaveThreatList()) return nullptr; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3241,7 +3241,7 @@ Unit* Creature::GetHostileCasterInRange(float min, float max) if (!CanHaveThreatList()) return nullptr; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3257,7 +3257,7 @@ Unit* Creature::GetHostileCaster() if (!CanHaveThreatList()) return nullptr; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3273,7 +3273,7 @@ void Creature::ProcessThreatList(ThreatListProcesser* f) if (!CanHaveThreatList()) return; - ThreatList const& tList = getThreatManager().getThreatList(); + ThreatList const& tList = GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* target = GetMap()->GetUnit((*i)->getUnitGuid()); @@ -3304,16 +3304,6 @@ bool Creature::CastSpellOnNearestVictim(uint32 spellId, float min, float max, bo return false; } -bool Creature::CastSpellOnHostileCaster(uint32 spellId, bool triggered) -{ - if (Unit* pTarget = GetHostileCaster()) - { - CastSpell(pTarget, spellId, triggered); - return true; - } - return false; -} - bool Creature::CastSpellOnHostileCasterInRange(uint32 spellId, float min, float max, bool triggered) { if (Unit* pTarget = GetHostileCasterInRange(min, max)) @@ -3324,23 +3314,14 @@ bool Creature::CastSpellOnHostileCasterInRange(uint32 spellId, float min, float return false; } -bool Creature::CastSpellOnAllInRange(uint32 spellId, float min, float max, bool triggered) -{ - if (Unit* pTarget = GetHostileCasterInRange(min, max)) - { - CastSpell(pTarget, spellId, triggered); - return true; - } - return false; -} void Creature::AddThreatsOf(Creature const* pOther) { - ThreatList const& tList = pOther->getThreatManager().getThreatList(); + ThreatList const& tList = pOther->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pTarget = GetMap()->GetUnit((*i)->getUnitGuid()); - if (pTarget && pTarget->isAlive() && !IsFriendlyTo(pTarget)) + if (pTarget && pTarget->IsAlive() && !IsFriendlyTo(pTarget)) { pTarget->SetInCombatWith(this); AddThreat(pTarget); @@ -3450,14 +3431,14 @@ SpellCastResult Creature::TryToCast(Unit* pTarget, const SpellEntry* 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_STAT_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_STAT_CAN_NOT_MOVE)) { // Can't cast while fleeing. switch (GetMotionMaster()->GetCurrentMovementGeneratorType()) @@ -3475,7 +3456,7 @@ SpellCastResult Creature::TryToCast(Unit* pTarget, const SpellEntry* pSpellInfo, if (!pSpellInfo->IsAreaOfEffectSpell()) { // If the spell requires the target having a specific power type. - if (!pSpellInfo->IsTargetPowerTypeValid(pTarget->getPowerType())) + if (!pSpellInfo->IsTargetPowerTypeValid(pTarget->GetPowerType())) return SPELL_FAILED_UNKNOWN; // No point in casting if target is immune. @@ -3484,7 +3465,7 @@ SpellCastResult Creature::TryToCast(Unit* pTarget, const SpellEntry* pSpellInfo, } // Mind control abilities can't be used with just 1 attacker or mob will reset. - if ((getThreatManager().getThreatList().size() == 1) && pSpellInfo->IsCharmSpell()) + if ((GetThreatManager().getThreatList().size() == 1) && pSpellInfo->IsCharmSpell()) return SPELL_FAILED_UNKNOWN; // Do not use dismounting spells when target is not mounted (there are 4 such spells). @@ -3517,7 +3498,7 @@ SpellCastResult Creature::TryToCast(Unit* pTarget, const SpellEntry* pSpellInfo, bool Creature::CantPathToVictim() const { - if (!getVictim()) + if (!GetVictim()) return false; if (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) @@ -3534,12 +3515,12 @@ bool Creature::_IsTargetAcceptable(Unit const *target) const // if the target cannot be attacked, the target is not acceptable if (IsFriendlyTo(target) - || !target->isAttackableByAOE() - || target->hasUnitState(UNIT_STAT_DIED)) + || !target->IsAttackableByAOE() + || target->HasUnitState(UNIT_STAT_DIED)) return false; - Unit *myVictim = getAttackerForHelper(); - Unit *targetVictim = target->getAttackerForHelper(); + Unit *myVictim = GetAttackerForHelper(); + Unit *targetVictim = target->GetAttackerForHelper(); // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable if (myVictim == target || targetVictim == this || IsHostileTo(target)) @@ -3559,7 +3540,7 @@ bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const if (!pVictim->IsInMap(this)) return false; - if (!canAttack(pVictim, force)) + if (!CanAttack(pVictim, force)) return false; if (GetMap()->IsDungeon()) @@ -3576,7 +3557,7 @@ bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const else if (!pVictim->IsWithinDist3d(m_HomeX, m_HomeY, m_HomeZ, dist)) return false; - if (!pVictim->isInAccessablePlaceFor(this)) + if (!pVictim->IsInAccessablePlaceFor(this)) return false; return true; } @@ -3614,8 +3595,8 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if (!_IsTargetAcceptable(who)) return false; - if (who->isInCombat()) - if (Unit *victim = who->getAttackerForHelper()) + if (who->IsInCombat()) + if (Unit *victim = who->GetAttackerForHelper()) if (IsWithinDistInMap(victim, 10.0f)) force = true; @@ -3648,7 +3629,7 @@ void Creature::FillGuidsListFromThreatList(std::vector& guids, uint3 if (!CanHaveThreatList()) return; - ThreatList const& threats = getThreatManager().getThreatList(); + ThreatList const& threats = GetThreatManager().getThreatList(); maxamount = maxamount > 0 ? std::min(maxamount, uint32(threats.size())) : threats.size(); diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index b7ac405d3..2e67467c0 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -544,8 +544,8 @@ class MANGOS_DLL_SPEC Creature : public Unit Totem const* ToTotem() const { return IsTotem() ? reinterpret_cast(this) : nullptr; } Totem* ToTotem() { return IsTotem() ? reinterpret_cast(this) : nullptr; } bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; } - bool IsCorpse() const { return getDeathState() == CORPSE; } - bool IsDespawned() const { return getDeathState() == DEAD; } + bool IsCorpse() const { return GetDeathState() == CORPSE; } + bool IsDespawned() const { return GetDeathState() == DEAD; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } bool IsRacialLeader() const { return GetCreatureInfo()->racial_leader; } bool IsCivilian() const { return GetCreatureInfo()->civilian; } @@ -584,8 +584,8 @@ class MANGOS_DLL_SPEC Creature : public Unit bool IsOutOfThreatArea(Unit* pVictim) const; void FillGuidsListFromThreatList(std::vector& guids, uint32 maxamount = 0); - bool IsImmuneToSpell(SpellEntry const *spellInfo, bool castOnSelf) override; - bool IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo = nullptr) override; + bool IsImmuneToSpell(SpellEntry const *spellInfo, bool castOnSelf) const override; + bool IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo = nullptr) const override; bool IsImmuneToSpellEffect(SpellEntry const *spellInfo, SpellEffectIndex index, bool castOnSelf) const override; bool IsElite() const @@ -616,7 +616,7 @@ class MANGOS_DLL_SPEC Creature : public Unit uint32 GetShieldBlockValue() const override { - return getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20); // dunno mob block value + return GetLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20); // dunno mob block value } SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; } @@ -784,7 +784,7 @@ class MANGOS_DLL_SPEC Creature : public Unit // We send this guid instead when its set, to avoid overwriting the unit field. void SetCastingTarget(Unit const* pTarget) { - if (pTarget != getVictim()) + if (pTarget != GetVictim()) { m_castingTargetGuid = pTarget->GetGUID(); ForceValuesUpdateAtIndex(UNIT_FIELD_TARGET); @@ -816,9 +816,7 @@ class MANGOS_DLL_SPEC Creature : public Unit // Return true if target found. bool CastSpellOnFarthestVictim (uint32 spellId, float min = 0.0f, float max = 100.0f, bool triggered = false); bool CastSpellOnNearestVictim(uint32 spellId, float min = 0.0f, float max = 100.0f, bool triggered = false); - bool CastSpellOnHostileCaster(uint32 spellId, bool triggered = false); bool CastSpellOnHostileCasterInRange(uint32 spellId, float min = 0.0f, float max = 100.0f, bool triggered = false); - bool CastSpellOnAllInRange(uint32 spellId, float min = 0.0f, float max = 100.0f, bool triggered = false); // Set in combat with units on the threatlist of 'pOther' void AddThreatsOf(Creature const* pOther); @@ -847,7 +845,7 @@ class MANGOS_DLL_SPEC Creature : public Unit void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; } - void SetNoXP() { addUnitState(UNIT_STAT_NO_KILL_REWARD); } + void SetNoXP() { AddUnitState(UNIT_STAT_NO_KILL_REWARD); } void SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags = TEMPFACTION_ALL); void ClearTemporaryFaction(); diff --git a/src/game/Objects/DynamicObject.cpp b/src/game/Objects/DynamicObject.cpp index 31effdfad..2f02c8f05 100644 --- a/src/game/Objects/DynamicObject.cpp +++ b/src/game/Objects/DynamicObject.cpp @@ -157,14 +157,14 @@ Unit* DynamicObject::GetUnitCaster() const return nullptr; } -uint32 DynamicObject::getFaction() const +uint32 DynamicObject::GetFactionTemplateId() const { - return GetCaster()->getFaction(); + return GetCaster()->GetFactionTemplateId(); } -uint32 DynamicObject::getLevel() const +uint32 DynamicObject::GetLevel() const { - return GetCaster()->getLevel(); + return GetCaster()->GetLevel(); } void DynamicObject::Update(uint32 update_diff, uint32 p_time) @@ -228,6 +228,16 @@ void DynamicObject::Delete() AddObjectToRemoveList(); } +void DynamicObject::AddAffected(Unit* unit) +{ + m_affected[unit->GetObjectGuid()] = 0; +} + +void DynamicObject::RemoveAffected(Unit* unit) +{ + m_affected.erase(unit->GetObjectGuid()); +} + void DynamicObject::Delay(int32 delaytime) { m_aliveDuration -= delaytime; @@ -267,7 +277,7 @@ void DynamicObject::Delay(int32 delaytime) } } -bool DynamicObject::isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const +bool DynamicObject::IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const { if (!IsInWorld() || !pDetector->IsInWorld()) return false; diff --git a/src/game/Objects/DynamicObject.h b/src/game/Objects/DynamicObject.h index e30c4702e..4c7fcd6d6 100644 --- a/src/game/Objects/DynamicObject.h +++ b/src/game/Objects/DynamicObject.h @@ -24,7 +24,6 @@ #include "Object.h" #include "DBCEnums.h" -#include "Unit.h" enum DynamicObjectType { @@ -57,21 +56,21 @@ class DynamicObject : public WorldObject DynamicObjectType GetType() const { return (DynamicObjectType)GetByteValue(DYNAMICOBJECT_BYTES,0); } bool NeedsRefresh(Unit *unit) const; bool IsChanneled() const { return m_channeled; } - void AddAffected(Unit *unit) { m_affected[unit->GetObjectGuid()] = 0; } - void RemoveAffected(Unit *unit) { m_affected.erase(unit->GetObjectGuid()); } + void AddAffected(Unit* unit); + void RemoveAffected(Unit* unit); void Delay(int32 delaytime); bool IsHostileTo(WorldObject const* target) const override; bool IsFriendlyTo(WorldObject const* target) const override; - uint32 getFaction() const final ; - uint32 getLevel() const final ; + uint32 GetFactionTemplateId() const final ; + uint32 GetLevel() const final ; float GetObjectBoundingRadius() const override // overwrite WorldObject version { return 0.0f; // dynamic object not have real interact size } - bool isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; + bool IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; GridReference &GetGridRef() { return m_gridRef; } diff --git a/src/game/Objects/GameObject.cpp b/src/game/Objects/GameObject.cpp index 836fa834f..055b2b1c2 100644 --- a/src/game/Objects/GameObject.cpp +++ b/src/game/Objects/GameObject.cpp @@ -236,8 +236,8 @@ public: return false; bool _isTotem = u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem(); - if (u->isAlive() && i_trap->IsWithinDistInMap(u, _isTotem ? i_range / 3.0f : i_range) && i_trapOwner->IsValidAttackTarget(u) && - (u->isInCombat() || i_trapOwner->IsHostileTo(u))) + if (u->IsAlive() && i_trap->IsWithinDistInMap(u, _isTotem ? i_range / 3.0f : i_range) && i_trapOwner->IsValidAttackTarget(u) && + (u->IsInCombat() || i_trapOwner->IsHostileTo(u))) { i_range = i_trap->GetDistance(u); return true; @@ -286,7 +286,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) // Arming Time for GAMEOBJECT_TYPE_TRAP (6) /* Ivina < Nostalrius > : toujours appliquer le startDelay. Retirer le delai de la DB si jamais un piege n'en a pas. */ // Unit* owner = GetOwner(); - // if (owner && ((Player*)owner)->isInCombat()) + // if (owner && ((Player*)owner)->IsInCombat()) if (GetGOInfo()->trap.startDelay) m_cooldownTime = time(nullptr) + GetGOInfo()->trap.startDelay; m_lootState = GO_READY; @@ -1023,7 +1023,7 @@ void GameObject::SetVisible(bool b) UpdateObjectVisibility(); } -bool GameObject::isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const +bool GameObject::IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const { // Not in world if (!IsInWorld() || !pDetector->IsInWorld()) @@ -2127,7 +2127,7 @@ bool GameObject::IsUseRequirementMet() const { case GameObjectUseRequirement::GOBJ_REQUIRE_DEAD_CREATURE: if (Creature* crea = GetMap()->GetCreature(req->guid)) - if (crea->isAlive()) + if (crea->IsAlive()) return false; break; case GameObjectUseRequirement::GOBJ_REQUIRE_ACTIVE_OBJECT: @@ -2367,7 +2367,7 @@ void GameObject::Despawn() AddObjectToRemoveList(); } -uint32 GameObject::getLevel() const +uint32 GameObject::GetLevel() const { uint32 level = 0; diff --git a/src/game/Objects/GameObject.h b/src/game/Objects/GameObject.h index 5f77b7992..a7d9b0355 100644 --- a/src/game/Objects/GameObject.h +++ b/src/game/Objects/GameObject.h @@ -760,10 +760,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject bool IsVisible() const { return m_visible; } void SetVisible(bool b); - bool isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; + bool IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; - uint32 getFaction() const final { return GetGOInfo()->faction; } - uint32 getLevel() const final ; + uint32 GetFactionTemplateId() const final { return GetGOInfo()->faction; } + uint32 GetLevel() const final ; bool IsValidAttackTarget(Unit const* target) const final ; protected: bool m_visible; diff --git a/src/game/Objects/Item.cpp b/src/game/Objects/Item.cpp index 8dd70d075..dc93414f1 100644 --- a/src/game/Objects/Item.cpp +++ b/src/game/Objects/Item.cpp @@ -1095,9 +1095,9 @@ bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const switch (m_uiType) { case ITEM_TARGET_TYPE_CREATURE: - return pUnitTarget->isAlive(); + return pUnitTarget->IsAlive(); case ITEM_TARGET_TYPE_DEAD: - return !pUnitTarget->isAlive(); + return !pUnitTarget->IsAlive(); default: return false; } diff --git a/src/game/Objects/Item.h b/src/game/Objects/Item.h index 387a4dd3f..22f2720e1 100644 --- a/src/game/Objects/Item.h +++ b/src/game/Objects/Item.h @@ -32,6 +32,7 @@ class Bag; class Field; class QueryResult; class Unit; +struct ItemRandomPropertiesEntry; struct ItemSetEffect { diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index ad807b4aa..07fee0c6d 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -494,7 +494,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint8 updateFlags) const { if (Unit const* me = ToUnit()) { - if (Unit const* victim = me->getVictim()) + if (Unit const* victim = me->GetVictim()) * data << victim->GetPackGUID(); else *data << uint8(0); // Empty pack guid @@ -645,7 +645,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * if (appendValue & UNIT_NPC_FLAG_STABLEMASTER) { - if (target->getClass() != CLASS_HUNTER) + if (target->GetClass() != CLASS_HUNTER) appendValue &= ~UNIT_NPC_FLAG_STABLEMASTER; } @@ -751,7 +751,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask * } uint32 faction = m_uint32Values[index]; if (forceFriendly) - faction = target->getFaction(); + faction = target->GetFactionTemplateId(); *data << uint32(faction); } @@ -2225,7 +2225,7 @@ public: float x, y, z; - if (!c->isAlive() || c->hasUnitState(UNIT_STAT_NOT_MOVE) || + if (!c->IsAlive() || c->HasUnitState(UNIT_STAT_NOT_MOVE) || !c->GetMotionMaster()->GetDestination(x, y, z)) { x = c->GetPositionX(); @@ -2836,7 +2836,7 @@ namespace MaNGOS : i_source(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target), i_vaList(vaList) {} void operator()(WorldPacket& data, int32 loc_idx) { - char const* text = i_textId > 0 ? sObjectMgr.GetBroadcastText(i_textId, loc_idx, i_source.getGender()) : sObjectMgr.GetMangosString(i_textId, loc_idx); + char const* text = i_textId > 0 ? sObjectMgr.GetBroadcastText(i_textId, loc_idx, i_source.GetGender()) : sObjectMgr.GetMangosString(i_textId, loc_idx); char textFinal[2048]; va_list argsCpy; va_copy(argsCpy, *i_vaList); @@ -2865,7 +2865,7 @@ namespace MaNGOS : i_source(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_target(target) {} void operator()(WorldPacket& data, int32 loc_idx) const { - char const* text = i_textId > 0 ? sObjectMgr.GetBroadcastText(i_textId, loc_idx, i_source.getGender()) : sObjectMgr.GetMangosString(i_textId, loc_idx); + char const* text = i_textId > 0 ? sObjectMgr.GetBroadcastText(i_textId, loc_idx, i_source.GetGender()) : sObjectMgr.GetMangosString(i_textId, loc_idx); ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_source.GetObjectGuid(), i_source.GetNameForLocaleIdx(loc_idx), i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); @@ -3019,7 +3019,7 @@ void WorldObject::MonsterWhisper(int32 textId, Unit const* target, bool IsBossWh return; uint32 loc_idx = ((Player*)target)->GetSession()->GetSessionDbLocaleIndex(); - char const* text = textId > 0 ? sObjectMgr.GetBroadcastText(textId, loc_idx, getGender()) : sObjectMgr.GetMangosString(textId, loc_idx); + char const* text = textId > 0 ? sObjectMgr.GetBroadcastText(textId, loc_idx, GetGender()) : sObjectMgr.GetMangosString(textId, loc_idx); WorldPacket data; ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(), @@ -3102,7 +3102,7 @@ Unit* WorldObject::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectInd { if (Unit* magnet = (*itr)->GetCaster()) { - if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) + if (magnet->IsAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) { if (SpellAuraHolder *holder = (*itr)->GetHolder()) if (holder->DropAuraCharge()) @@ -3121,14 +3121,14 @@ Unit* WorldObject::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectInd FactionTemplateEntry const* WorldObject::getFactionTemplateEntry() const { - FactionTemplateEntry const* entry = sObjectMgr.GetFactionTemplateEntry(getFaction()); + FactionTemplateEntry const* entry = sObjectMgr.GetFactionTemplateEntry(GetFactionTemplateId()); if (!entry) { static ObjectGuid guid; // prevent repeating spam same faction problem if (GetObjectGuid() != guid) { - sLog.outError("%s have invalid faction (faction template id) #%u", GetGuidStr().c_str(), getFaction()); + sLog.outError("%s have invalid faction (faction template id) #%u", GetGuidStr().c_str(), GetFactionTemplateId()); guid = GetObjectGuid(); } } @@ -3284,9 +3284,9 @@ uint32 WorldObject::GetLevelForTarget(WorldObject const* target) const if (Creature const* pCreature = ToCreature()) { if (!pCreature->IsWorldBoss() || !target || !target->IsUnit()) - return pCreature->getLevel(); + return pCreature->GetLevel(); - uint32 level = static_cast(target)->getLevel() + sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF); + uint32 level = static_cast(target)->GetLevel() + sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF); if (level < 1) return 1; if (level > 255) @@ -3295,7 +3295,7 @@ uint32 WorldObject::GetLevelForTarget(WorldObject const* target) const } if (Unit const* pUnit = ToUnit()) - return pUnit->getLevel(); + return pUnit->GetLevel(); if (GameObject const* pGo = ToGameObject()) { @@ -3319,7 +3319,7 @@ uint32 WorldObject::GetLevelForTarget(WorldObject const* target) const } if (Unit const* pUnit = ::ToUnit(target)) - return pUnit->getLevel(); + return pUnit->GetLevel(); return DEFAULT_MAX_LEVEL; } @@ -3441,7 +3441,7 @@ void WorldObject::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 // Now go on with a victim's events'n'auras // Not much to do if no flags are set or there is no victim - if (pVictim && pVictim->isAlive() && procVictim) + if (pVictim && pVictim->IsAlive() && procVictim) // http://blue.cardplace.com/cache/wow-paladin/1069149.htm // "Charges will not generate off auto attacks or npc attacks by trying" @@ -3478,8 +3478,8 @@ float WorldObject::MeleeSpellMissChance(Unit* pVictim, WeaponAttackType attType, missChance = 5.0f - skillDiff * 0.1f; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - missChance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + missChance *= pVictim->GetLevel() / 10.0f; if (Unit* pUnit = ToUnit()) { @@ -3599,8 +3599,8 @@ SpellMissInfo WorldObject::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* dodgeChance = 0; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - dodgeChance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + dodgeChance *= pVictim->GetLevel() / 10.0f; tmp += dodgeChance; if (roll < tmp) @@ -3618,8 +3618,8 @@ SpellMissInfo WorldObject::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* parryChance = 0; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - parryChance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + parryChance *= pVictim->GetLevel() / 10.0f; tmp += parryChance; if (roll < tmp) @@ -3632,7 +3632,7 @@ SpellMissInfo WorldObject::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* SpellMissInfo WorldObject::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell, Spell* spellPtr) { // Can`t miss on dead target (on skinning for example) - if (!pVictim->isAlive()) + if (!pVictim->IsAlive()) return SPELL_MISS_NONE; // Spell cannot be resisted (not exist on dbc, custom flag) @@ -3750,7 +3750,7 @@ float WorldObject::GetSpellResistChance(Unit const* victim, uint32 schoolMask, b return (resistModHitChance * 0.01f); } - uint32 const uiLevel = getLevel(); + uint32 const uiLevel = GetLevel(); // Computing innate resists, resistance bonus when attacking a creature higher level. Not affected by modifiers. if (innateResists && victim->GetTypeId() == TYPEID_UNIT) @@ -3966,7 +3966,7 @@ uint32 WorldObject::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage) c if (armor < 0.0f) armor = 0.0f; - float tmpvalue = 0.1f * armor / (8.5f * float(getLevel()) + 40.0f); + float tmpvalue = 0.1f * armor / (8.5f * float(GetLevel()) + 40.0f); tmpvalue = tmpvalue / (1.0f + tmpvalue); if (tmpvalue < 0.0f) @@ -3986,7 +3986,7 @@ int32 WorldObject::CalculateSpellDamage(Unit const* target, SpellEntry const* sp uint8 comboPoints = pPlayer ? pPlayer->GetComboPoints() : 0; - int32 level = getLevel(); + int32 level = GetLevel(); if (level > (int32)spellProto->maxLevel && spellProto->maxLevel > 0) level = (int32)spellProto->maxLevel; @@ -4039,7 +4039,7 @@ int32 WorldObject::CalculateSpellDamage(Unit const* target, SpellEntry const* sp spellProto->Effect[effect_index] != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE && spellProto->Effect[effect_index] != SPELL_EFFECT_KNOCK_BACK && (spellProto->Effect[effect_index] != SPELL_EFFECT_APPLY_AURA || spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_DECREASE_SPEED)) - value = int32(value * 0.25f * exp(getLevel() * (70 - spellProto->spellLevel) / 1000.0f)); + value = int32(value * 0.25f * exp(GetLevel() * (70 - spellProto->spellLevel) / 1000.0f)); return value; } @@ -4054,7 +4054,7 @@ void WorldObject::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 da if (damage < 0) return; - if (!pVictim->isAlive()) + if (!pVictim->IsAlive()) return; // Check spell crit chance @@ -4536,7 +4536,7 @@ int32 WorldObject::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) return DoneAdvertisedBenefit; } -int32 WorldObject::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, WorldObject* pCaster, Spell* spell) +int32 WorldObject::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, WorldObject* pCaster, Spell* spell) const { // Distribute Damage over multiple effects, reduce by AoE float coeff = 0.0f; @@ -4554,7 +4554,7 @@ int32 WorldObject::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 tota if (donePart && (bonus->ap_bonus || bonus->ap_dot_bonus)) { float const ap_bonus = damagetype == DOT ? bonus->ap_dot_bonus : bonus->ap_bonus; - float const total_ap = IsUnit() ? static_cast(this)->GetTotalAttackPowerValue(spellProto->IsSpellRequiresRangedAP() ? RANGED_ATTACK : BASE_ATTACK) : 0; + float const total_ap = IsUnit() ? static_cast(this)->GetTotalAttackPowerValue(spellProto->IsSpellRequiresRangedAP() ? RANGED_ATTACK : BASE_ATTACK) : 0; total += int32(ap_bonus * (total_ap + ap_benefit)); } } @@ -4571,7 +4571,7 @@ int32 WorldObject::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 tota coeff = spellProto->CalculateCustomCoefficient(pCaster, damagetype, coeff, spell, donePart); // Spellmod SpellDamage - if (Unit* pUnit = ToUnit()) + if (Unit const* pUnit = ToUnit()) { if (Player* modOwner = pUnit->GetSpellModOwner()) { @@ -4587,7 +4587,7 @@ int32 WorldObject::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 tota if (spellProto->Id == 19993) { bUsePenalty = false; - if (Unit* pUnit = ToUnit()) + if (Unit const* pUnit = ToUnit()) { if (pUnit->HasAura(28853)) total += 53.0f; // Libram of Divinity if (pUnit->HasAura(28851)) total += 83.0f; // Libram of Light @@ -4612,10 +4612,10 @@ void WorldObject::DealDamageMods(Unit *victim, uint32 &damage, uint32* absorb) { Unit* pUnit = ToUnit(); // [Nostalrius] Pas de degats sous esprit de redemption - if (!victim->isAlive() || + if (!victim->IsAlive() || victim->IsTaxiFlying() || (victim->IsCreature() && static_cast(victim)->IsInEvadeMode()) || - (pUnit && pUnit->getClass() == CLASS_PRIEST && pUnit->HasAura(27827))) + (pUnit && pUnit->GetClass() == CLASS_PRIEST && pUnit->HasAura(27827))) { if (absorb) *absorb += damage; @@ -4652,7 +4652,7 @@ float WorldObject::CalculateLevelPenalty(SpellEntry const* spellProto) if(spellLevel < 20) LvlPenalty = 20.0f - spellLevel * 3.75f; - float LvlFactor = (float(spellLevel) + 6.0f) / float(getLevel()); + float LvlFactor = (float(spellLevel) + 6.0f) / float(GetLevel()); if(LvlFactor > 1.0f) LvlFactor = 1.0f; @@ -4699,7 +4699,7 @@ void WorldObject::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabili if (!pVictim) return; - if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) + if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) return; SpellEntry const *spellProto = sSpellMgr.GetSpellEntry(damageInfo->SpellID); @@ -5198,5 +5198,5 @@ void WorldObject::CastSpell(float x, float y, float z, SpellEntry const *spellIn bool WorldObject::isVisibleFor(Player const* u, WorldObject const* viewPoint) const { - return isVisibleForInState(u, viewPoint, false); + return IsVisibleForInState(u, viewPoint, false); } \ No newline at end of file diff --git a/src/game/Objects/Object.h b/src/game/Objects/Object.h index 8de1f3899..0972ff599 100644 --- a/src/game/Objects/Object.h +++ b/src/game/Objects/Object.h @@ -28,11 +28,14 @@ #include "UpdateData.h" #include "ObjectGuid.h" #include "Camera.h" -#include "SpellEntry.h" +#include "SharedDefines.h" +#include "SpellDefines.h" +#include "DBCEnums.h" #include "Utilities/EventProcessor.h" #include #include +#include #define CONTACT_DISTANCE 0.5f #define INTERACTION_DISTANCE 5.0f @@ -89,6 +92,10 @@ class InstanceData; class TerrainInfo; class ZoneScript; class Transport; +class SpellEntry; +class Spell; + +struct FactionTemplateEntry; typedef std::unordered_map UpdateDataMapType; @@ -791,7 +798,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object void SetName(std::string const& newname) { m_name=newname; } virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); } - virtual uint8 getGender() const { return 0; } // used in chat builder + virtual uint8 GetGender() const { return 0; } // used in chat builder virtual uint32 GetDefaultGossipMenuId() const { return 0; } @@ -913,12 +920,12 @@ class MANGOS_DLL_SPEC WorldObject : public Object virtual bool IsHostileTo(WorldObject const* target) const =0; virtual bool IsFriendlyTo(WorldObject const* target) const =0; - virtual uint32 getFaction() const = 0; + virtual uint32 GetFactionTemplateId() const = 0; FactionTemplateEntry const* getFactionTemplateEntry() const; virtual ReputationRank GetReactionTo(WorldObject const* target) const; ReputationRank static GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, WorldObject const* target); virtual bool IsValidAttackTarget(Unit const* target) const { return false; } - virtual bool isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool* alert = nullptr) const { return isVisibleForInState(pDetector, viewPoint, inVisibleList); } + virtual bool IsVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool* alert = nullptr) const { return IsVisibleForInState(pDetector, viewPoint, inVisibleList); } bool IsControlledByPlayer() const; bool IsLikePlayer() const; @@ -936,7 +943,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object bool isVisibleFor(Player const* u, WorldObject const* viewPoint) const; // low level function for visibility change code, must be define in all main world object subclasses - virtual bool isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const = 0; + virtual bool IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const = 0; void SetMap(Map * map); Map * GetMap() const; @@ -1001,7 +1008,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object uint32 GetCreatureSummonLimit() const { return m_creatureSummonLimit; } void SetCreatureSummonLimit(uint32 limit); - virtual uint32 getLevel() const = 0; + virtual uint32 GetLevel() const = 0; uint32 GetLevelForTarget(WorldObject const* target = nullptr) const; uint16 GetSkillMaxForLevel(WorldObject const* target = nullptr) const { return GetLevelForTarget(target) * 5; }; uint32 GetWeaponSkillValue(WeaponAttackType attType, WorldObject const* target = nullptr) const; @@ -1051,7 +1058,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = nullptr, Spell* spell = nullptr); void CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, Spell* spell = nullptr); int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* basePoints = nullptr, Spell* spell = nullptr); - int32 SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, WorldObject *pCaster, Spell* spell = nullptr); + int32 SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart, WorldObject *pCaster, Spell* spell = nullptr) const; static float CalculateLevelPenalty(SpellEntry const* spellProto); uint32 SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1, Spell* spell = nullptr); int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask); diff --git a/src/game/Objects/Pet.cpp b/src/game/Objects/Pet.cpp index 306c7def3..884c109d7 100644 --- a/src/game/Objects/Pet.cpp +++ b/src/game/Objects/Pet.cpp @@ -28,7 +28,6 @@ #include "Formulas.h" #include "SpellAuras.h" #include "CreatureAI.h" -#include "Unit.h" #include "Util.h" #include "CharacterDatabaseCache.h" @@ -245,7 +244,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c } setPetType(pet_type); - setFaction(owner->getFaction()); + SetFactionTemplateId(owner->GetFactionTemplateId()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id); // reget for sure use real creature info selected for Pet at load/creating @@ -278,7 +277,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c SetName(m_pTmpCache->name); if (getPetType() == SUMMON_PET) - petlevel = owner->getLevel(); + petlevel = owner->GetLevel(); if (owner->IsPvP()) SetPvP(true); @@ -407,7 +406,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS)); SetPower(POWER_HAPPINESS, m_pTmpCache->curhappiness); - setPowerType(POWER_FOCUS); + SetPowerType(POWER_FOCUS); } if (getPetType() != MINI_PET) @@ -465,7 +464,7 @@ void Pet::SavePetToDB(PetSaveMode mode) } // pet is dead so it doesn't have to be shown at character login - if (mode == PET_SAVE_AS_CURRENT && !isAlive()) + if (mode == PET_SAVE_AS_CURRENT && !IsAlive()) mode = PET_SAVE_NOT_IN_SLOT; // On recup l'info dans le cache @@ -524,7 +523,7 @@ void Pet::SavePetToDB(PetSaveMode mode) m_pTmpCache->owner = ownerLow; m_pTmpCache->entry = GetEntry(); m_pTmpCache->modelid = GetNativeDisplayId(); - m_pTmpCache->level = getLevel(); + m_pTmpCache->level = GetLevel(); m_pTmpCache->exp = GetUInt32Value(UNIT_FIELD_PETEXPERIENCE); m_pTmpCache->Reactstate = GetReactState(); m_pTmpCache->loyaltypoints = m_loyaltyPoints; @@ -550,7 +549,7 @@ void Pet::SavePetToDB(PetSaveMode mode) savePet.addUInt32(GetEntry()); savePet.addUInt32(ownerLow); savePet.addUInt32(GetNativeDisplayId()); - savePet.addUInt32(getLevel()); + savePet.addUInt32(GetLevel()); savePet.addUInt32(GetUInt32Value(UNIT_FIELD_PETEXPERIENCE)); savePet.addUInt32(uint32(GetReactState())); savePet.addInt32(m_loyaltyPoints); @@ -638,7 +637,7 @@ void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction) void Pet::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState { Creature::SetDeathState(s); - if (getDeathState() == CORPSE) + if (GetDeathState() == CORPSE) //remove summoned pet (no corpse) { // pet corpse non lootable and non skinnable @@ -656,7 +655,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual if (getPetType() == SUMMON_PET) m_corpseDecayTimer = 15000; } - else if (getDeathState() == ALIVE) + else if (GetDeathState() == ALIVE) { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); CastPetAuras(true); @@ -701,7 +700,7 @@ void Pet::Update(uint32 update_diff, uint32 diff) } // Despawn if owner is dead and out of combat - if (owner->isDead() && !getAttackerForHelper()) + if (owner->IsDead() && !GetAttackerForHelper()) { Unsummon(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT, owner); return; @@ -729,7 +728,7 @@ void Pet::RegenerateAll(uint32 update_diff, bool skipCombatCheck) { if (m_regenTimer <= update_diff) { - if (!isInCombat() || IsPolymorphed()) + if (!IsInCombat() || IsPolymorphed()) RegenerateHealth(); RegenerateMana(); @@ -792,7 +791,7 @@ void Pet::LooseHappiness() if (curValue <= 0) return; int32 addvalue = (140 >> GetLoyaltyLevel()) * 125; //value is 70/35/17/8/4 (per min) * 1000 / 8 (timer 7.5 secs) - if (isInCombat()) //we know in combat happiness fades faster, multiplier guess + if (IsInCombat()) //we know in combat happiness fades faster, multiplier guess addvalue = int32(addvalue * 1.5); ModifyPower(POWER_HAPPINESS, -addvalue); } @@ -817,7 +816,7 @@ void Pet::ModifyLoyalty(int32 addvalue) --loyaltylevel; SetLoyaltyLevel(LoyaltyLevel(loyaltylevel)); m_loyaltyPoints = GetStartLoyaltyPoints(loyaltylevel); - SetTP(m_TrainingPoints - int32(getLevel())); + SetTP(m_TrainingPoints - int32(GetLevel())); } else { @@ -839,7 +838,7 @@ void Pet::ModifyLoyalty(int32 addvalue) ++loyaltylevel; SetLoyaltyLevel(LoyaltyLevel(loyaltylevel)); m_loyaltyPoints = GetStartLoyaltyPoints(loyaltylevel); - SetTP(m_TrainingPoints + getLevel()); + SetTP(m_TrainingPoints + GetLevel()); } } @@ -1215,11 +1214,11 @@ void Pet::GivePetXP(uint32 xp) if (xp < 1) return; - if (!isAlive()) + if (!IsAlive()) return; - uint32 level = getLevel(); - uint32 maxlevel = std::min(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL), GetOwner()->getLevel()); + uint32 level = GetLevel(); + uint32 maxlevel = std::min(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL), GetOwner()->GetLevel()); // pet not receive xp for level equal to owner level if (level >= maxlevel) @@ -1247,7 +1246,7 @@ void Pet::GivePetXP(uint32 xp) void Pet::GivePetLevel(uint32 level) { - if (!level || level == getLevel()) + if (!level || level == GetLevel()) return; if (getPetType() == HUNTER_PET) @@ -1293,10 +1292,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature) SetNativeDisplayId(creature->GetNativeDisplayId()); SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS)); SetPower(POWER_HAPPINESS, 166500); - setPowerType(POWER_FOCUS); + SetPowerType(POWER_FOCUS); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(creature->getLevel())); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(creature->GetLevel())); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->beast_family)) @@ -1384,12 +1383,12 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) if (cFamily && cFamily->minScale > 0.0f && getPetType() == HUNTER_PET) { float scale; - if (getLevel() >= cFamily->maxScaleLevel) + if (GetLevel() >= cFamily->maxScaleLevel) scale = cFamily->maxScale; - else if (getLevel() <= cFamily->minScaleLevel) + else if (GetLevel() <= cFamily->minScaleLevel) scale = cFamily->minScale; else - scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); + scale = cFamily->minScale + float(GetLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale); SetObjectScale(scale); UpdateModelData(); @@ -1542,13 +1541,13 @@ bool Pet::HaveInDiet(ItemPrototype const* item) const uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const { // -5 or greater food level - if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect + if (GetLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect return 35000; // -10..-6 - if (getLevel() <= itemlevel + 10) //pure guess, but sounds good + if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good return 17000; // -14..-11 - if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me + if (GetLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me return 8000; // -15 or less return 0; @@ -2257,7 +2256,7 @@ bool Pet::IsPermanentPetFor(Player* owner) const switch (getPetType()) { case SUMMON_PET: - switch (owner->getClass()) + switch (owner->GetClass()) { // oddly enough, Mage's Water Elemental is still treated as temporary pet with Glyph of Eternal Water // i.e. does not unsummon at mounting, gets dismissed at teleport etc. @@ -2369,12 +2368,12 @@ void Pet::SynchronizeLevelWithOwner() { // always same level case SUMMON_PET: - GivePetLevel(owner->getLevel()); + GivePetLevel(owner->GetLevel()); break; // can't be greater owner level case HUNTER_PET: - if (getLevel() > owner->getLevel()) - GivePetLevel(owner->getLevel()); + if (GetLevel() > owner->GetLevel()) + GivePetLevel(owner->GetLevel()); break; default: break; diff --git a/src/game/Objects/Pet.h b/src/game/Objects/Pet.h index 47938373a..9fc5d85fe 100644 --- a/src/game/Objects/Pet.h +++ b/src/game/Objects/Pet.h @@ -25,7 +25,6 @@ #include "Common.h" #include "ObjectGuid.h" #include "Creature.h" -#include "Unit.h" enum PetType { diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 01d57bed2..388bcf8f0 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -421,7 +421,7 @@ UpdateMask Player::updateVisualBits; Player::Player(WorldSession *session) : Unit(), m_mover(this), m_camera(this), m_reputationMgr(this), - m_enableInstanceSwitch(true), m_currentTicketCounter(0), + m_enableInstanceSwitch(true), m_currentTicketCounter(0), m_castingSpell(0), m_honorMgr(this), m_bNextRelocationsIgnored(0), m_personalXpRate(-1.0f), m_standStateTimer(0), m_newStandState(MAX_UNIT_STAND_STATE), m_foodEmoteTimer(0) { m_objectType |= TYPEMASK_PLAYER; @@ -750,7 +750,7 @@ bool Player::Create(uint32 guidlow, std::string const& name, uint8 race, uint8 c UpdateMaxHealth(); // Update max Health (for add bonus from stamina) SetHealth(GetMaxHealth()); - if (getPowerType() == POWER_MANA) + if (GetPowerType() == POWER_MANA) { UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect) SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); @@ -835,7 +835,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog.outError("STORAGE: Can't equip or store initial item %u for race %u class %u , error msg = %u", titem_id, getRace(), getClass(), msg); + sLog.outError("STORAGE: Can't equip or store initial item %u for race %u class %u , error msg = %u", titem_id, GetRace(), GetClass(), msg); return false; } @@ -883,7 +883,7 @@ void Player::StopMirrorTimer(MirrorTimerType Type) uint32 Player::EnvironmentalDamage(EnvironmentalDamageType type, uint32 damage) { - if (!isAlive() || IsGameMaster()) + if (!IsAlive() || IsGameMaster()) return 0; // Absorb, resist some environmental damage type @@ -906,7 +906,7 @@ uint32 Player::EnvironmentalDamage(EnvironmentalDamageType type, uint32 damage) uint32 final_damage = DealDamage(this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); - if (type == DAMAGE_FALL && !isAlive()) // DealDamage not apply item durability loss at self damage + if (type == DAMAGE_FALL && !IsAlive()) // DealDamage not apply item durability loss at self damage { DEBUG_LOG("We are fall to death, loosing 10 percents durability"); DurabilityLossAll(0.10f, false); @@ -928,7 +928,7 @@ int32 Player::GetMaxTimer(MirrorTimerType timer) return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS; case BREATH_TIMER: { - if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || + if (!IsAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_GMLEVEL)) return DISABLED_MIRROR_TIMER; int32 UnderWaterTime = sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_MAX) * IN_MILLISECONDS; @@ -939,7 +939,7 @@ int32 Player::GetMaxTimer(MirrorTimerType timer) } case FIRE_TIMER: { - if (!isAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL)) + if (!IsAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL)) return DISABLED_MIRROR_TIMER; return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS; } @@ -979,7 +979,7 @@ void Player::HandleDrowning(uint32 time_diff) m_MirrorTimer[BREATH_TIMER] += 1 * IN_MILLISECONDS; // Calculate and deal damage // TODO: Check this formula - uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); + uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1); EnvironmentalDamage(DAMAGE_DROWNING, damage); } else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need @@ -991,7 +991,7 @@ void Player::HandleDrowning(uint32 time_diff) int32 UnderWaterTime = GetMaxTimer(BREATH_TIMER); // Need breath regen m_MirrorTimer[BREATH_TIMER] += 10 * time_diff; - if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !isAlive()) + if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive()) StopMirrorTimer(BREATH_TIMER); else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER) SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10); @@ -1014,9 +1014,9 @@ void Player::HandleDrowning(uint32 time_diff) if (m_MirrorTimer[FATIGUE_TIMER] < 0) { m_MirrorTimer[FATIGUE_TIMER] += 1 * IN_MILLISECONDS; - if (isAlive()) // Calculate and deal damage + if (IsAlive()) // Calculate and deal damage { - uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); + uint32 damage = GetMaxHealth() / 5 + urand(0, GetLevel() - 1); EnvironmentalDamage(DAMAGE_EXHAUSTED, damage); } else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard @@ -1032,7 +1032,7 @@ void Player::HandleDrowning(uint32 time_diff) { int32 DarkWaterTime = GetMaxTimer(FATIGUE_TIMER); m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff; - if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !isAlive()) + if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive()) StopMirrorTimer(FATIGUE_TIMER); else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER) SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); @@ -1096,7 +1096,7 @@ DrunkenState Player::GetDrunkenstateByValue(uint16 value) void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) { m_drunk = newDrunkenValue; - SetUInt16Value(PLAYER_BYTES_3, 0, uint16(getGender()) | (m_drunk & 0xFFFE)); + SetUInt16Value(PLAYER_BYTES_3, 0, uint16(GetGender()) | (m_drunk & 0xFFFE)); uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk); @@ -1180,11 +1180,11 @@ void Player::Update(uint32 update_diff, uint32 p_time) } } - if (hasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (HasUnitState(UNIT_STAT_MELEE_ATTACKING)) { UpdateMeleeAttackingState(); - Unit const* pVictim = getVictim(); + Unit const* pVictim = GetVictim(); if (pVictim && !IsNonMeleeSpellCasted(false) && CanReachWithMeleeAutoAttack(pVictim)) TogglePlayerPvPFlagOnAttackVictim(pVictim); } @@ -1237,7 +1237,7 @@ void Player::Update(uint32 update_diff, uint32 p_time) if (m_cannotBeDetectedTimer > 0) m_cannotBeDetectedTimer -= update_diff; - if (isAlive()) + if (IsAlive()) { m_regenTimer -= update_diff; HandleFoodEmotes(update_diff); @@ -1288,9 +1288,9 @@ void Player::Update(uint32 update_diff, uint32 p_time) // dungeons, battlegrounds, and raid instances. #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 // not auto-free ghost from body in instances - if (getDeathState() == CORPSE && !GetMap()->Instanceable()) + if (GetDeathState() == CORPSE && !GetMap()->Instanceable()) #else - if (getDeathState() == CORPSE) + if (GetDeathState() == CORPSE) #endif { if (p_time >= m_deathTimer) @@ -1322,7 +1322,7 @@ void Player::Update(uint32 update_diff, uint32 p_time) bool transition = false; uint16 newInstanceId = sMapMgr.GetContinentInstanceId(GetMap()->GetId(), GetPositionX(), GetPositionY(), &transition); if (newInstanceId != GetInstanceId()) - if (!transition || !isInCombat()) + if (!transition || !IsInCombat()) sMapMgr.ScheduleInstanceSwitch(this, newInstanceId); } if (IsInWorld()) @@ -1346,7 +1346,7 @@ void Player::Update(uint32 update_diff, uint32 p_time) { if (m_newStandState < MAX_UNIT_STAND_STATE) { - if (isAlive()) + if (IsAlive()) SetStandState(m_newStandState); m_newStandState = MAX_UNIT_STAND_STATE; } @@ -1384,7 +1384,7 @@ void Player::OnDisconnected() if (IsInWorld() && FindMap()) { - if (!hasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) + if (!HasUnitState(UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) { float const height = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ()); if ((GetPositionZ() < height + 0.1f) && !IsInWater()) @@ -1393,7 +1393,7 @@ void Player::OnDisconnected() // 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_STAT_FLEEING | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) { GetMover()->RemoveUnitMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN); GetMover()->SendHeartBeat(GetMover() != this); @@ -1497,7 +1497,7 @@ void Player::SetDeathState(DeathState s) { uint32 ressSpellId = 0; - bool cur = isAlive(); + bool cur = IsAlive(); if (s == JUST_DIED && cur) { @@ -1536,7 +1536,7 @@ void Player::SetDeathState(DeathState s) if (s == JUST_DIED && cur && ressSpellId) SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId); - if (isAlive() && !cur) + if (IsAlive() && !cur) { //clear aura case after resurrection by another way (spells will be applied before next death) SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); @@ -1582,17 +1582,17 @@ void Player::AutoReSummonPet() } // 3. Execute the pet summon spell effect - EffectSummonPet(spell, entry, getLevel()); + EffectSummonPet(spell, entry, GetLevel()); // 4. We may want to resurrect the pet Pet* pet = GetPet(); - if (!pet || pet->isAlive()) + if (!pet || pet->IsAlive()) return; 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_STAT_ALL_DYN_STATES); pet->SetHealth(pet->GetMaxHealth()); } @@ -1800,7 +1800,7 @@ bool Player::SwitchInstance(uint32 newInstanceId) SetMover(this); // Clear hostile refs so that we have no cross-map (and thread) references being maintained - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); // remove from old map now oldmap->Remove(this, false); @@ -2047,7 +2047,7 @@ bool Player::ExecuteTeleportFar(ScheduledTeleportData *data) ScheduleDelayedOperation(DELAYED_CAST_HONORLESS_TARGET); // Clear hostile refs so that we have no cross-map (and thread) references being maintained - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); // if the player is saved before worldport ack (at logout for example) // this will be used instead of the current location in SaveToDB @@ -2201,7 +2201,7 @@ void Player::RewardRage(uint32 damage, bool attacker) // Vanilla rage formula source http://blue.mmo-champion.com/topic/18325-the-new-rage-formula-by-kalgan/ float addRage; - float rageconversion = float((0.0091107836 * getLevel() * getLevel()) + 3.225598133 * getLevel()) + 4.2652911f; + float rageconversion = float((0.0091107836 * GetLevel() * GetLevel()) + 3.225598133 * GetLevel()) + 4.2652911f; if (attacker) { @@ -2263,11 +2263,11 @@ void Player::RegenerateAll() return; // Not in combat or they have regeneration - if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || + if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) || HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed()) { RegenerateHealth(); - if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) + if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) Regenerate(POWER_RAGE); } @@ -2358,10 +2358,10 @@ void Player::RegenerateHealth() if (IsPolymorphed()) addvalue = (float)GetMaxHealth() / 10; // normal regen case (maybe partly in combat case) - else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) + else if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) { addvalue = GetRegenHPPerSpirit() * HealthIncreaseRate; - if (!isInCombat()) + if (!IsInCombat()) { AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT); for (AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i) @@ -2397,9 +2397,9 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver) const case TYPEID_GAMEOBJECT: return CanInteractWithGameObject(static_cast(questGiver), GAMEOBJECT_TYPE_QUESTGIVER); case TYPEID_PLAYER: - return isAlive() && static_cast(questGiver)->isAlive(); + return IsAlive() && static_cast(questGiver)->IsAlive(); case TYPEID_ITEM: - return isAlive(); + return IsAlive(); default: break; } @@ -2428,7 +2428,7 @@ bool Player::CanInteractWithNPC(Creature* pCreature, uint32 npcflagmask) const return false; // not in interactive state - if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; // appropriate npc type @@ -2437,17 +2437,17 @@ bool Player::CanInteractWithNPC(Creature* pCreature, uint32 npcflagmask) const if (npcflagmask == UNIT_NPC_FLAG_STABLEMASTER) { - if (getClass() != CLASS_HUNTER) + if (GetClass() != CLASS_HUNTER) return false; } - if (!pCreature->isAlive()) + if (!pCreature->IsAlive()) return false; - if (isAlive() && pCreature->isInvisibleForAlive()) + if (IsAlive() && pCreature->IsInvisibleForAlive()) return false; - if (!isAlive() && !pCreature->HasTypeFlag(CREATURE_TYPEFLAGS_GHOST_VISIBLE)) + if (!IsAlive() && !pCreature->HasTypeFlag(CREATURE_TYPEFLAGS_GHOST_VISIBLE)) return false; // not allow interaction under control, but allow with own pets @@ -2459,11 +2459,11 @@ bool Player::CanInteractWithNPC(Creature* pCreature, uint32 npcflagmask) const return false; // combat check - if (pCreature->isInCombat()) + if (pCreature->IsInCombat()) return false; // not unfriendly - if (FactionTemplateEntry const* factionTemplate = sObjectMgr.GetFactionTemplateEntry(pCreature->getFaction())) + if (FactionTemplateEntry const* factionTemplate = sObjectMgr.GetFactionTemplateEntry(pCreature->GetFactionTemplateId())) if (factionTemplate->faction) if (FactionEntry const* faction = sObjectMgr.GetFactionEntry(factionTemplate->faction)) if (faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY) @@ -2496,10 +2496,10 @@ bool Player::CanInteractWithGameObject(GameObject* pGo, uint32 gameobject_type) return false; // not in interactive state - if (hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) + if (HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; - if (!isAlive()) + if (!IsAlive()) return false; if (uint32(pGo->GetGoType()) == gameobject_type || gameobject_type == MAX_GAMEOBJECT_TYPE) @@ -2550,7 +2550,7 @@ void Player::SetInWater(bool apply) // remove auras that need water/land RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - getHostileRefManager().updateThreatTables(); + GetHostileRefManager().updateThreatTables(); } struct SetGameMasterOnHelper @@ -2558,8 +2558,8 @@ struct SetGameMasterOnHelper explicit SetGameMasterOnHelper() {} void operator()(Unit* unit) const { - unit->setFaction(35); - unit->getHostileRefManager().setOnlineOfflineState(false); + unit->SetFactionTemplateId(35); + unit->GetHostileRefManager().setOnlineOfflineState(false); } }; @@ -2568,8 +2568,8 @@ struct SetGameMasterOffHelper explicit SetGameMasterOffHelper(uint32 _faction) : faction(_faction) {} void operator()(Unit* unit) const { - unit->setFaction(faction); - unit->getHostileRefManager().setOnlineOfflineState(true); + unit->SetFactionTemplateId(faction); + unit->GetHostileRefManager().setOnlineOfflineState(true); } uint32 faction; }; @@ -2601,7 +2601,7 @@ void Player::SetGameMaster(bool on, bool notify) if (on) { m_ExtraFlags |= PLAYER_EXTRA_GM_ON; - setFaction(35); + SetFactionTemplateId(35); SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); CallForAllControlledUnits(SetGameMasterOnHelper(), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM); @@ -2609,7 +2609,7 @@ void Player::SetGameMaster(bool on, bool notify) SetFFAPvP(false); UpdatePvPContested(false, true); - getHostileRefManager().setOnlineOfflineState(false); + GetHostileRefManager().setOnlineOfflineState(false); CombatStopWithPets(); if (notify) @@ -2621,10 +2621,10 @@ void Player::SetGameMaster(bool on, bool notify) else { m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON; - SetFactionForRace(getRace()); + SetFactionForRace(GetRace()); RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); - CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM); + CallForAllControlledUnits(SetGameMasterOffHelper(GetFactionTemplateId()), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM); // restore FFA PvP Server state if (sWorld.IsFFAPvPRealm()) @@ -2633,7 +2633,7 @@ void Player::SetGameMaster(bool on, bool notify) // restore FFA PvP area state, remove not allowed for GM mounts UpdateArea(m_areaUpdateId); - getHostileRefManager().setOnlineOfflineState(true); + GetHostileRefManager().setOnlineOfflineState(true); if (notify) { @@ -2805,10 +2805,10 @@ void Player::GiveXP(uint32 xp, Unit* victim) if (xp < 1) return; - if (!isAlive()) + if (!IsAlive()) return; - uint32 level = getLevel(); + uint32 level = GetLevel(); // XP to money conversion processed in Player::RewardQuest if (level >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) @@ -2830,7 +2830,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) if (level < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) GiveLevel(level + 1); - level = getLevel(); + level = GetLevel(); nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP); } @@ -2841,7 +2841,7 @@ void Player::GiveXP(uint32 xp, Unit* victim) // Current player experience not update (must be update by caller) void Player::GiveLevel(uint32 level) { - if (level == getLevel()) + if (level == GetLevel()) return; uint32 numInstanceMembers = 0; @@ -2894,7 +2894,7 @@ void Player::GiveLevel(uint32 level) instanceInfo << "None"; sLog.out(LOG_LEVELUP, "Character %s:%u [c%u r%u] reaches level %2u, zone %u, pos: [%0.2f, %0.2f, %0.2f] [Group: %s] [Instance: %s]", - GetName(), GetGUIDLow(), getClass(), getRace(), level, GetZoneId(), GetPositionX(), GetPositionY(), GetPositionZ(), + GetName(), GetGUIDLow(), GetClass(), GetRace(), level, GetZoneId(), GetPositionX(), GetPositionY(), GetPositionZ(), groupInfo.str().c_str(), instanceInfo.str().c_str()); // If we have instance members, and the number of players in the instance is not @@ -2912,10 +2912,10 @@ void Player::GiveLevel(uint32 level) } PlayerLevelInfo info; - sObjectMgr.GetPlayerLevelInfo(getRace(), getClass(), level, &info); + sObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), level, &info); PlayerClassLevelInfo classInfo; - sObjectMgr.GetPlayerClassLevelInfo(getClass(), level, &classInfo); + sObjectMgr.GetPlayerClassLevelInfo(GetClass(), level, &classInfo); uint32 hp = uint32((int32(classInfo.basehealth) - int32(GetCreateHealth())) + (int32(GetHealthBonusFromStamina(info.stats[STAT_STAMINA])) - int32(GetHealthBonusFromStamina(GetCreateStat(STAT_STAMINA))))); @@ -2927,7 +2927,7 @@ void Player::GiveLevel(uint32 level) WorldPacket data(SMSG_LEVELUP_INFO, (4 + 4 + MAX_POWERS * 4 + MAX_STATS * 4)); data << uint32(level); data << hp; - data << uint32(getPowerType() == POWER_MANA ? mana : 0); + data << uint32(GetPowerType() == POWER_MANA ? mana : 0); data << uint32(0); data << uint32(0); data << uint32(0); @@ -2941,7 +2941,7 @@ void Player::GiveLevel(uint32 level) SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(level)); //update level, max level of skills - if (getLevel() != level) + if (GetLevel() != level) m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset SetLevel(level); UpdateSkillsForLevel(); @@ -2958,7 +2958,7 @@ void Player::GiveLevel(uint32 level) UpdateAllStats(); // set current level health and mana/energy to maximum after applying all mods. - if (isAlive()) + if (IsAlive()) SetHealth(GetMaxHealth()); SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); @@ -2972,14 +2972,14 @@ void Player::GiveLevel(uint32 level) if (Pet* pet = GetPet()) pet->SynchronizeLevelWithOwner(); - if (m_session->ShouldBeBanned(getLevel())) + if (m_session->ShouldBeBanned(GetLevel())) sWorld.BanAccount(BAN_ACCOUNT, m_session->GetUsername(), 0, m_session->GetScheduleBanReason(), ""); sAnticheatLib->OnPlayerLevelUp(this); } void Player::UpdateFreeTalentPoints(bool resetIfNeed) { - uint32 level = getLevel(); + uint32 level = GetLevel(); // talents base at level diff ( talents = level - 9 but some can be used already) if (level < 10) { @@ -3020,12 +3020,12 @@ void Player::InitStatsForLevel(bool reapplyMods) _RemoveAllStatBonuses(); PlayerClassLevelInfo classInfo; - sObjectMgr.GetPlayerClassLevelInfo(getClass(), getLevel(), &classInfo); + sObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), &classInfo); PlayerLevelInfo info; - sObjectMgr.GetPlayerLevelInfo(getRace(), getClass(), getLevel(), &info); + sObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), GetLevel(), &info); - SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(getLevel())); + SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(GetLevel())); // reset before any aura state sources (health set/aura apply) SetUInt32Value(UNIT_FIELD_AURASTATE, 0); @@ -3903,7 +3903,7 @@ bool Player::ResetTalents(bool no_cost) // unlearn only talents for character class // some spell learned by one class as normal spells or know at creation but another class learn it as talent, // to prevent unexpected lost normal learned spell skip another class talents - if ((getClassMask() & talentTabInfo->ClassMask) == 0) + if ((GetClassMask() & talentTabInfo->ClassMask) == 0) continue; for (int j = 0; j < MAX_TALENT_RANK; ++j) @@ -4163,7 +4163,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell // check level requirement uint32 spellLevel = trainer_spell->reqLevel ? trainer_spell->reqLevel : TriggerSpell->spellLevel; - if (getLevel() < spellLevel) + if (GetLevel() < spellLevel) return TRAINER_SPELL_RED; if (SpellChainNode const* spell_chain = sSpellMgr.GetSpellChainNode(TriggerSpell->Id)) @@ -4452,12 +4452,12 @@ void Player::SetFly(bool enable) if (enable) { m_movementInfo.moveFlags = (MOVEFLAG_LEVITATING | MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING); - addUnitState(UNIT_STAT_FLYING_ALLOWED); + AddUnitState(UNIT_STAT_FLYING_ALLOWED); } else { m_movementInfo.moveFlags = (MOVEFLAG_NONE); - clearUnitState(UNIT_STAT_FLYING_ALLOWED); + ClearUnitState(UNIT_STAT_FLYING_ALLOWED); } SendHeartBeat(true); @@ -4476,7 +4476,7 @@ void Player::BuildPlayerRepop() //this is spirit release confirm? RemovePet(PET_SAVE_REAGENTS); - if (getRace() == RACE_NIGHTELF) + if (GetRace() == RACE_NIGHTELF) CastSpell(this, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) CastSpell(this, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) @@ -4531,7 +4531,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) SetDeathState(ALIVE); - if (getRace() == RACE_NIGHTELF) + if (GetRace() == RACE_NIGHTELF) RemoveAurasDueToSpell(20584); // speed bonuses RemoveAurasDueToSpell(8326); // SPELL_AURA_GHOST @@ -4568,15 +4568,15 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) //Characters level 20 and up suffer from ten minutes of sickness. int32 startLevel = sWorld.getConfig(CONFIG_INT32_DEATH_SICKNESS_LEVEL); - if (int32(getLevel()) >= startLevel) + if (int32(GetLevel()) >= startLevel) { // set resurrection sickness CastSpell(this, SPELL_ID_PASSIVE_RESURRECTION_SICKNESS, true); // not full duration - if (int32(getLevel()) < startLevel + 9) + if (int32(GetLevel()) < startLevel + 9) { - int32 delta = (int32(getLevel()) - startLevel + 1) * MINUTE; + int32 delta = (int32(GetLevel()) - startLevel + 1) * MINUTE; if (SpellAuraHolder* holder = GetSpellAuraHolder(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS)) { @@ -4628,8 +4628,8 @@ Corpse* Player::CreateCorpse() uint8 haircolor = GetByteValue(PLAYER_BYTES, 3); uint8 facialhair = GetByteValue(PLAYER_BYTES_2, 0); - corpse->SetByteValue(CORPSE_FIELD_BYTES_1, 1, getRace()); - corpse->SetByteValue(CORPSE_FIELD_BYTES_1, 2, getGender()); + corpse->SetByteValue(CORPSE_FIELD_BYTES_1, 1, GetRace()); + corpse->SetByteValue(CORPSE_FIELD_BYTES_1, 2, GetGender()); corpse->SetByteValue(CORPSE_FIELD_BYTES_1, 3, skin); corpse->SetByteValue(CORPSE_FIELD_BYTES_2, 0, face); @@ -4885,7 +4885,7 @@ void Player::RepopAtGraveyard() else ClosestGrave = sObjectMgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); - if (isAlive()) + if (IsAlive()) { if (ClosestGrave) TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, GetOrientation(), 0, std::move(recover)); @@ -5051,7 +5051,7 @@ float Player::GetMeleeCritFromAgility() const float valLevel1 = 0.0f; float valLevel60 = 0.0f; // critical - switch (getClass()) + switch (GetClass()) { case CLASS_PALADIN: case CLASS_SHAMAN: @@ -5086,7 +5086,7 @@ float Player::GetMeleeCritFromAgility() const default: return 0.0f; } - float classrate = valLevel1 * float(60.0f - getLevel()) / 59.0f + valLevel60 * float(getLevel() - 1.0f) / 59.0f; + float classrate = valLevel1 * float(60.0f - GetLevel()) / 59.0f + valLevel60 * float(GetLevel() - 1.0f) / 59.0f; return GetStat(STAT_AGILITY) / classrate; } @@ -5095,7 +5095,7 @@ float Player::GetDodgeFromAgility() const float valLevel1 = 0.0f; float valLevel60 = 0.0f; // critical - switch (getClass()) + switch (GetClass()) { case CLASS_PALADIN: case CLASS_SHAMAN: @@ -5130,7 +5130,7 @@ float Player::GetDodgeFromAgility() const default: return 0.0f; } - float classrate = valLevel1 * float(60.0f - getLevel()) / 59.0f + valLevel60 * float(getLevel() - 1.0f) / 59.0f; + float classrate = valLevel1 * float(60.0f - GetLevel()) / 59.0f + valLevel60 * float(GetLevel() - 1.0f) / 59.0f; return GetStat(STAT_AGILITY) / classrate; } @@ -5168,8 +5168,8 @@ float Player::GetSpellCritFromIntellect() const // only players use intelligence for critical chance computations if (GetTypeId() == TYPEID_PLAYER) { - int my_class = getClass(); - float crit_ratio = crit_data[my_class].rate0 + crit_data[my_class].rate1 * getLevel(); + int my_class = GetClass(); + float crit_ratio = crit_data[my_class].rate0 + crit_data[my_class].rate1 * GetLevel(); crit_chance = crit_data[my_class].base + GetStat(STAT_INTELLECT) / crit_ratio; } else @@ -5350,7 +5350,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) void Player::UpdateWeaponSkill(WeaponAttackType attType) { // no skill gain in pvp - Unit *pVictim = getVictim(); + Unit *pVictim = GetVictim(); if (pVictim && pVictim->IsCharmerOrOwnerPlayerOrPlayerItself()) return; @@ -5388,7 +5388,7 @@ void Player::UpdateWeaponSkill(WeaponAttackType attType) void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence) { - uint32 plevel = getLevel(); // if defense than pVictim == attacker + uint32 plevel = GetLevel(); // if defense than pVictim == attacker uint32 greylevel = MaNGOS::XP::GetGrayLevel(plevel); uint32 moblevel = pVictim->GetLevelForTarget(this); @@ -5708,8 +5708,8 @@ int16 Player::GetSkillBonus(uint16 id, bool permanent/*= false*/) const void Player::UpdateSkillTrainedSpells(uint16 id, uint16 currVal) { - uint32 raceMask = getRaceMask(); - uint32 classMask = getClassMask(); + uint32 raceMask = GetRaceMask(); + uint32 classMask = GetClassMask(); SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBoundsBySkillId(id); @@ -6017,7 +6017,7 @@ void Player::SendCinematicStart(uint32 CinematicSequenceId) void Player::CheckAreaExploreAndOutdoor() { - if (!isAlive()) + if (!IsAlive()) return; if (IsTaxiFlying()) @@ -6093,15 +6093,15 @@ void Player::CheckAreaExploreAndOutdoor() { GetCheatData()->OnExplore(p); uint32 area = p->Id; - if (getLevel() >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (GetLevel() >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) SendExplorationExperience(area, 0); else { float const explorationRate = GetPersonalXpRate() >= 0.0f ? GetPersonalXpRate() : sWorld.getConfig(CONFIG_FLOAT_RATE_XP_EXPLORE); - int32 const diff = int32(getLevel()) - p->AreaLevel; + int32 const diff = int32(GetLevel()) - p->AreaLevel; uint32 XP = 0; if (diff < -5) - XP = uint32(sObjectMgr.GetBaseXP(getLevel() + 5) * explorationRate); + XP = uint32(sObjectMgr.GetBaseXP(GetLevel() + 5) * explorationRate); else if (diff > 5) { int32 exploration_percent = (100 - ((diff - 5) * 5)); @@ -6159,7 +6159,7 @@ uint32 Player::GetFactionForRace(uint8 race) void Player::SetFactionForRace(uint8 race) { m_team = TeamForRace(race); - setFaction(GetFactionForRace(race)); + SetFactionTemplateId(GetFactionForRace(race)); } ReputationRank Player::GetReputationRank(uint32 faction) const @@ -6202,15 +6202,15 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32 case REPUTATION_SOURCE_KILL: rate = sWorld.getConfig(CONFIG_FLOAT_RATE_REPUTATION_LOWLEVEL_KILL); // Ustaag : a priori, deja gere ailleurs... deque le mob est gris, la reput est divisee par 5. - /*if (MaNGOS::XP::GetGrayLevel(getLevel()) >= creatureOrQuestLevel) - diffLvl = MaNGOS::XP::GetGrayLevel(getLevel()) - creatureOrQuestLevel; + /*if (MaNGOS::XP::GetGrayLevel(GetLevel()) >= creatureOrQuestLevel) + diffLvl = MaNGOS::XP::GetGrayLevel(GetLevel()) - creatureOrQuestLevel; else diffLvl = 0;*/ break; case REPUTATION_SOURCE_QUEST: rate = sWorld.getConfig(CONFIG_FLOAT_RATE_REPUTATION_LOWLEVEL_QUEST); - if (getLevel() >= creatureOrQuestLevel + 5) - diffLvl = getLevel() - creatureOrQuestLevel - 5; + if (GetLevel() >= creatureOrQuestLevel + 5) + diffLvl = GetLevel() - creatureOrQuestLevel - 5; else diffLvl = 0; break; @@ -6243,7 +6243,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32 if (source == REPUTATION_SOURCE_QUEST) percent *= diffLvlRate; - if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel())) + if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(GetLevel())) percent *= rate; if (percent <= 0.0f) @@ -6294,7 +6294,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) if (Rep->repfaction1 && (!Rep->team_dependent || GetTeam() == ALLIANCE)) { - int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue1, Rep->repfaction1, pVictim->getLevel()); + int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue1, Rep->repfaction1, pVictim->GetLevel()); donerep1 = int32(donerep1 * rate); FactionEntry const *factionEntry1 = sObjectMgr.GetFactionEntry(Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); @@ -6323,7 +6323,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) if (Rep->repfaction2 && (!Rep->team_dependent || GetTeam() == HORDE)) { - int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue2, Rep->repfaction2, pVictim->getLevel()); + int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue2, Rep->repfaction2, pVictim->GetLevel()); donerep2 = int32(donerep2 * rate); FactionEntry const *factionEntry2 = sObjectMgr.GetFactionEntry(Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); @@ -6569,7 +6569,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) // remove items with area/map limitations (delete only for alive player to allow back in ghost mode) // if player resurrected at teleport this will be applied in resurrect code - if (isAlive()) + if (IsAlive()) DestroyZoneLimitedItem(true, newZone); // recent client version not send leave/join channel packets for built-in local channels @@ -6639,7 +6639,7 @@ void Player::CheckDuelDistance(time_t currTime) bool Player::IsOutdoorPvPActive() const { - return (isAlive() && !HasInvisibilityAura() && !HasStealthAura() && + return (IsAlive() && !HasInvisibilityAura() && !HasStealthAura() && (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_DESIRED) || sWorld.IsPvPRealm()) && !IsTaxiFlying()); } @@ -6953,7 +6953,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att { // ignore spell mods for not wands Modifier const* modifier = aura->GetModifier(); - if ((modifier->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) == 0 && (getClassMask() & CLASSMASK_WAND_USERS) == 0) + if ((modifier->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) == 0 && (GetClassMask() & CLASSMASK_WAND_USERS) == 0) return; // generic not weapon specific case processes in aura code @@ -7419,7 +7419,7 @@ void Player::RemovedInsignia(Player* looterPlr, Corpse *corpse) return; // If not released spirit, do it ! - if (getDeathState() != DEAD) + if (GetDeathState() != DEAD) { BuildPlayerRepop(); RepopAtGraveyard(); @@ -7485,10 +7485,10 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, Player* pVictim) } // Allowed to loot chest ? if (GameObjectInfo const* goInfo = go->GetGOInfo()) - if (goInfo->type == GAMEOBJECT_TYPE_CHEST && goInfo->chest.level > (getLevel() + 10)) + if (goInfo->type == GAMEOBJECT_TYPE_CHEST && goInfo->chest.level > (GetLevel() + 10)) { std::stringstream oss; - oss << "Level " << getLevel() << " attempt to loot chest " << go->GetDBTableGUIDLow() << " (level " << goInfo->chest.level << ")"; + oss << "Level " << GetLevel() << " attempt to loot chest " << go->GetDBTableGUIDLow() << " (level " << goInfo->chest.level << ")"; GetSession()->ProcessAnticheatAction("PassiveAnticheat", oss.str().c_str(), CHEAT_ACTION_LOG | CHEAT_ACTION_REPORT_GMS); SendLootRelease(guid); return; @@ -7597,14 +7597,14 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, Player* pVictim) // Now it works like this: lvl10: ~6copper, lvl70: ~9silver if (pVictim != nullptr) { - uint32 level = pVictim->getLevel(); + uint32 level = pVictim->GetLevel(); bones->loot.gold = (uint32)(urand(50, 150) * 0.016f * pow(((float)level) / 5.76f, 2.5f) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); bones->loot.m_personal = true; // Everyone can loot the corpse if (BattleGround* bg = GetBattleGround()) { if (bg->GetTypeID() == BATTLEGROUND_AV) { - uint8 race = pVictim->getRace(); + uint8 race = pVictim->GetRace(); uint32 rank = pVictim->GetHonorMgr().GetHighestRank().visualRank; uint32 raceItem = 0; uint32 rankItem = 0; @@ -7692,7 +7692,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, Player* pVictim) Creature *creature = GetMap()->GetCreature(guid); // must be in range and creature must be alive for pickpocket and must be dead for another loot - if (!creature || creature->isAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) + if (!creature || creature->IsAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) { SendLootRelease(guid); return; @@ -7725,8 +7725,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, Player* pVictim) loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, false); // Generate extra money for pick pocket loot - const uint32 a = urand(0, creature->getLevel() / 2); - const uint32 b = urand(0, getLevel() / 2); + const uint32 a = urand(0, creature->GetLevel() / 2); + const uint32 b = urand(0, GetLevel() / 2); loot->gold += uint32(10 * (a + b) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); creature->lootForPickPocketed = true; @@ -8189,7 +8189,7 @@ void Player::SetSheath(SheathState sheathed) uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const { - uint8 pClass = getClass(); + uint8 pClass = GetClass(); uint8 slots[4]; slots[0] = NULL_SLOT; @@ -9628,14 +9628,14 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool { // 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_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) return EQUIP_ERR_YOU_ARE_STUNNED; // do not allow equipping gear except weapons, offhands, projectiles, relics in // - combat if (!pProto->CanChangeEquipStateInCombat()) { - if (isInCombat()) + if (IsInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; } @@ -9643,7 +9643,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool if (GetSession()->isLogingOut()) return EQUIP_ERR_YOU_ARE_STUNNED; - if (isInCombat() && pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0) + if (IsInCombat() && pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0) return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err // Check is possibly not in vanilla. @@ -9750,7 +9750,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const // - combat if (!pProto->CanChangeEquipStateInCombat()) { - if (isInCombat()) + if (IsInCombat()) return EQUIP_ERR_NOT_IN_COMBAT; } @@ -9956,7 +9956,7 @@ InventoryResult Player::CanUseItem(Item *pItem, bool not_loading) const { DEBUG_LOG("STORAGE: CanUseItem item = %u", pItem->GetEntry()); - if (!isAlive() && not_loading) + if (!IsAlive() && not_loading) return EQUIP_ERR_YOU_ARE_DEAD; //if (isStunned()) @@ -9996,7 +9996,7 @@ InventoryResult Player::CanUseItem(ItemPrototype const *pProto, bool not_loading if (pProto) { - if ((pProto->AllowableClass & getClassMask()) == 0 || (pProto->AllowableRace & getRaceMask()) == 0) + if ((pProto->AllowableClass & GetClassMask()) == 0 || (pProto->AllowableRace & GetRaceMask()) == 0) return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM; if (pProto->RequiredSkill != 0) @@ -10015,7 +10015,7 @@ InventoryResult Player::CanUseItem(ItemPrototype const *pProto, bool not_loading if (not_loading && playerRank < (uint8)pProto->RequiredHonorRank) return EQUIP_ERR_CANT_EQUIP_RANK; - if (getLevel() < pProto->RequiredLevel) + if (GetLevel() < pProto->RequiredLevel) return EQUIP_ERR_CANT_EQUIP_LEVEL_I; return EQUIP_ERR_OK; @@ -10026,7 +10026,7 @@ InventoryResult Player::CanUseItem(ItemPrototype const *pProto, bool not_loading InventoryResult Player::CanUseAmmo(uint32 item) const { DEBUG_LOG("STORAGE: CanUseAmmo item = %u", item); - if (!isAlive()) + if (!IsAlive()) return EQUIP_ERR_YOU_ARE_DEAD; //if( isStunned() ) // return EQUIP_ERR_YOU_ARE_STUNNED; @@ -10255,7 +10255,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) { VisualizeItem(slot, pItem); - if (isAlive()) + if (IsAlive()) { ItemPrototype const *pProto = pItem->GetProto(); @@ -10271,13 +10271,13 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) // everyone else. #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_6_1 // Weapons and also Totem/Relic/Sigil/etc - if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0) + if (pProto && IsInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0) { uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; // There doesn't appear to be a 1 sec combat swap cd spell before 1.9. #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 - if (getClass() == CLASS_ROGUE) + if (GetClass() == CLASS_ROGUE) cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; #endif @@ -10290,7 +10290,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 m_weaponChangeTimer = spellProto->StartRecoveryTime; #else - m_weaponChangeTimer = (getClass() == CLASS_ROGUE) ? 1000 : spellProto->StartRecoveryTime; + m_weaponChangeTimer = (GetClass() == CLASS_ROGUE) ? 1000 : spellProto->StartRecoveryTime; #endif SendSpellCooldown(cooldownSpell, 0, GetObjectGuid()); } @@ -11021,7 +11021,7 @@ void Player::SwapItem(uint16 src, uint16 dst) DEBUG_LOG("STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); - if (!isAlive() && !(IsInventoryPos(src) && IsInventoryPos(dst))) + if (!IsAlive() && !(IsInventoryPos(src) && IsInventoryPos(dst))) { SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, pSrcItem, pDstItem); return; @@ -11758,7 +11758,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool } case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon { - if (getClass() == CLASS_SHAMAN) + if (GetClass() == CLASS_SHAMAN) { float addValue = 0.0f; if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) @@ -11915,7 +11915,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) hasMenuItem = false; // added in special mode break; case GOSSIP_OPTION_SPIRITHEALER: - if (!isDead()) + if (!IsDead()) hasMenuItem = false; break; case GOSSIP_OPTION_VENDOR: @@ -11950,7 +11950,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) hasMenuItem = false; break; case GOSSIP_OPTION_STABLEPET: - if (getClass() != CLASS_HUNTER) + if (GetClass() != CLASS_HUNTER) hasMenuItem = false; break; case GOSSIP_OPTION_SPIRITGUIDE: @@ -11991,12 +11991,12 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (itr->second.OptionBroadcastTextID) - strOptionText = sObjectMgr.GetBroadcastTextLocale(itr->second.OptionBroadcastTextID)->GetText(loc_idx, getGender(), false); + strOptionText = sObjectMgr.GetBroadcastTextLocale(itr->second.OptionBroadcastTextID)->GetText(loc_idx, GetGender(), false); else strOptionText = itr->second.option_text; if (itr->second.BoxBroadcastTextID) - strBoxText = sObjectMgr.GetBroadcastTextLocale(itr->second.BoxBroadcastTextID)->GetText(loc_idx, getGender(), false); + strBoxText = sObjectMgr.GetBroadcastTextLocale(itr->second.BoxBroadcastTextID)->GetText(loc_idx, GetGender(), false); else strBoxText = itr->second.box_text; @@ -12144,7 +12144,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId) break; } case GOSSIP_OPTION_SPIRITHEALER: - if (isDead()) + if (IsDead()) ((Creature*)pSource)->CastSpell(((Creature*)pSource), 17251, true, nullptr, nullptr, GetObjectGuid()); break; case GOSSIP_OPTION_QUESTGIVER: @@ -12380,7 +12380,7 @@ void Player::SendPreparedQuest(ObjectGuid guid) qe._Emote = bct->EmoteId0; qe._Delay = bct->EmoteDelay0; int loc_idx = GetSession()->GetSessionDbLocaleIndex(); - title = bct->GetText(loc_idx, pCreature->getGender(), false); + title = bct->GetText(loc_idx, pCreature->GetGender(), false); } } @@ -12460,7 +12460,7 @@ bool Player::CanSeeStartQuest(Quest const *pQuest) const int32 highLevelDiff = sWorld.getConfig(CONFIG_INT32_QUEST_HIGH_LEVEL_HIDE_DIFF); if (highLevelDiff < 0) return true; - return getLevel() + uint32(highLevelDiff) >= pQuest->GetMinLevel(); + return GetLevel() + uint32(highLevelDiff) >= pQuest->GetMinLevel(); } return false; @@ -12468,7 +12468,7 @@ bool Player::CanSeeStartQuest(Quest const *pQuest) const bool Player::CanTakeQuest(Quest const *pQuest, bool msg, bool skipStatusCheck /*false*/) const { - if (pQuest->GetMaxLevel() && pQuest->GetMaxLevel() < getLevel()) + if (pQuest->GetMaxLevel() && pQuest->GetMaxLevel() < GetLevel()) return false; return (skipStatusCheck || SatisfyQuestStatus(pQuest, msg)) && SatisfyQuestExclusiveGroup(pQuest, msg) && @@ -13017,7 +13017,7 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, WorldObject* questE // Not give XP in case already completed once repeatable quest uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue(this) * (GetPersonalXpRate() >= 0.0f ? GetPersonalXpRate() : sWorld.getConfig(CONFIG_FLOAT_RATE_XP_QUEST))); - if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (GetLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) GiveXP(XP , nullptr); else if (int32 money = pQuest->GetRewMoneyMaxLevelAtComplete()) LogModifyMoney(money, "QuestMaxLevel", questEnder->GetObjectGuid(), quest_id); @@ -13186,7 +13186,7 @@ bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) const { - if (getLevel() < qInfo->GetMinLevel()) + if (GetLevel() < qInfo->GetMinLevel()) { if (msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); @@ -13311,7 +13311,7 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const if (reqClass == 0) return true; - if ((reqClass & getClassMask()) == 0) + if ((reqClass & GetClassMask()) == 0) { if (msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); @@ -13329,7 +13329,7 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) const if (reqraces == 0) return true; - if ((reqraces & getRaceMask()) == 0) + if ((reqraces & GetRaceMask()) == 0) { if (msg) SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE); @@ -14163,7 +14163,7 @@ void Player::SendQuestReward(Quest const *pQuest, uint32 XP, Object * questGiver data << questid; data << uint32(0x03); - if (getLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (GetLevel() < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) { data << XP; data << uint32(pQuest->GetRewOrReqMoney()); @@ -14495,7 +14495,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) //Need to call it to initialize m_team (m_team can be calculated from race) //Other way is to saves m_team into characters table. - SetFactionForRace(getRace()); + SetFactionForRace(GetRace()); SetCharm(nullptr); // load home bind and check in same time class/race pair, it used later for restore broken positions @@ -14718,7 +14718,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) InitStatsForLevel(); // is it need, only in pre-2.x used and field byte removed later? - if (getPowerType() == POWER_RAGE || getPowerType() == POWER_MANA) + if (GetPowerType() == POWER_RAGE || GetPowerType() == POWER_MANA) SetByteValue(UNIT_FIELD_BYTES_1, 1, 0xEE); // rest bonus can only be calculated after InitStatsForLevel() @@ -14820,7 +14820,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder) // Spell code allow apply any auras to dead character in load time in aura/spell/item loading // Do now before stats re-calculation cleanup for ghost state unexpected auras - if (!isAlive()) + if (!IsAlive()) RemoveAllAurasOnDeath(); //apply all stat bonuses from items and auras @@ -15013,7 +15013,7 @@ void Player::SendPacketsAtRelogin() bool Player::IsAllowedToLoot(Creature const* creature) { - if (!creature->isDead()) + if (!creature->IsDead()) return false; if (creature->AI() && !creature->AI()->CanBeLooted()) @@ -15106,7 +15106,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) while (result->NextRow()); } - if (getClass() == CLASS_WARRIOR && !HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) + if (GetClass() == CLASS_WARRIOR && !HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) CastSpell(this, SPELL_ID_PASSIVE_BATTLE_STANCE, true); if (GetGroup()) @@ -15186,7 +15186,7 @@ void Player::LoadAura(AuraSaveStruct& s, uint32 timediff) void Player::LoadCorpse() { - if (isAlive()) + if (IsAlive()) sObjectAccessor.ConvertCorpseForPlayer(GetObjectGuid()); else { @@ -15281,7 +15281,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff, bool &has_epic itemGuids.insert(item_lowguid); // not allow have in alive state item limited to another map/zone - if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) + if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone)) { CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid); item->FSetState(ITEM_REMOVED); @@ -15415,7 +15415,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff, bool &has_epic } } - //if(isAlive()) + //if(IsAlive()) _ApplyAllItemMods(); } @@ -15850,7 +15850,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, ObjectGuid pl bool Player::_LoadHomeBind(QueryResult *result) { - PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(GetRace(), GetClass()); if (!info) { sLog.outError("Player have incorrect race/class pair. Can't be loaded."); @@ -15980,10 +15980,10 @@ void Player::SaveToDB(bool online, bool force) uberInsert.addUInt32(GetGUIDLow()); uberInsert.addUInt32(GetSession()->GetAccountId()); uberInsert.addString(m_name); - uberInsert.addUInt8(getRace()); - uberInsert.addUInt8(getClass()); - uberInsert.addUInt8(getGender()); - uberInsert.addUInt32(getLevel()); + uberInsert.addUInt8(GetRace()); + uberInsert.addUInt8(GetClass()); + uberInsert.addUInt8(GetGender()); + uberInsert.addUInt32(GetLevel()); uberInsert.addUInt32(GetUInt32Value(PLAYER_XP)); uberInsert.addUInt32(GetMoney()); uberInsert.addUInt32(GetUInt32Value(PLAYER_BYTES)); @@ -16122,7 +16122,7 @@ void Player::SaveToDB(bool online, bool force) pet->SavePetToDB(PET_SAVE_AS_CURRENT); if (PlayerCacheData* data = sObjectMgr.GetPlayerDataByGUID(GetGUIDLow())) { - data->uiLevel = getLevel(); + data->uiLevel = GetLevel(); data->uiZoneId = GetCachedZoneId(); } } @@ -16527,7 +16527,7 @@ void Player::_SaveSpells() void Player::_SaveStats() { // check if stat saving is enabled and if char level is high enough - if (!sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE) || getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE)) + if (!sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE) || GetLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_STAT_SAVE)) return; static SqlStatementID delStats ; @@ -16848,10 +16848,10 @@ float Player::GetYellRange() const float range = sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL); uint32 linearScaleMaxLevel = sWorld.getConfig(CONFIG_UINT32_YELLRANGE_LINEARSCALE_MAXLEVEL); uint32 quadraticScaleMaxLevel = sWorld.getConfig(CONFIG_UINT32_YELLRANGE_QUADRATICSCALE_MAXLEVEL); - if (getLevel() < linearScaleMaxLevel) - range *= getLevel() / float(linearScaleMaxLevel); - if (getLevel() < quadraticScaleMaxLevel) - range *= getLevel() * getLevel() / float(quadraticScaleMaxLevel * quadraticScaleMaxLevel); + if (GetLevel() < linearScaleMaxLevel) + range *= GetLevel() / float(linearScaleMaxLevel); + if (GetLevel() < quadraticScaleMaxLevel) + range *= GetLevel() * GetLevel() / float(quadraticScaleMaxLevel * quadraticScaleMaxLevel); if (range < sWorld.getConfig(CONFIG_UINT32_YELLRANGE_MIN)) range = sWorld.getConfig(CONFIG_UINT32_YELLRANGE_MIN); return range; @@ -16965,7 +16965,7 @@ void Player::CharmSpellInitialize() { CreatureInfo const *cinfo = ((Creature*)charm)->GetCreatureInfo(); - if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK) + if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && GetClass() == CLASS_WARLOCK) { for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { @@ -17019,13 +17019,13 @@ Creature* Player::SummonPossessedMinion(uint32 creatureId, uint32 spellId, float if (!pCreature) return nullptr; - pCreature->SetFactionTemporary(getFaction(), TEMPFACTION_NONE); // set same faction than player + pCreature->SetFactionTemporary(GetFactionTemplateId(), TEMPFACTION_NONE); // set same faction than player pCreature->SetCharmerGuid(GetObjectGuid()); // save guid of the charmer 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->SetLevel(getLevel()); // set level to same level than summoner TODO:: not sure its always the case... + pCreature->AddUnitState(UNIT_STAT_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 @@ -17063,7 +17063,7 @@ void Player::UnsummonPossessedMinion() SetClientControl(pMinion, false); pMinion->SetCharmerGuid(ObjectGuid()); pMinion->SetPossessorGuid(ObjectGuid()); - pMinion->clearUnitState(UNIT_STAT_POSSESSED); + pMinion->ClearUnitState(UNIT_STAT_POSSESSED); pMinion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pMinion->DoKillUnit(); } @@ -17297,7 +17297,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid) void Player::SetRestBonus(float rest_bonus_new) { // Prevent resting on max level - if (getLevel() >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) + if (GetLevel() >= sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)) rest_bonus_new = 0; if (rest_bonus_new < 0) @@ -17326,7 +17326,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc return false; // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi - if (GetSession()->isLogingOut() || isInCombat()) + if (GetSession()->isLogingOut() || IsInCombat()) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIPLAYERBUSY); @@ -17754,8 +17754,8 @@ void Player::InitDataForForm(bool reapplyMods) SetAttackTime(BASE_ATTACK, 1000, false); //Speed 1 SetAttackTime(OFF_ATTACK, 1000, false); //Speed 1 - if (getPowerType() != POWER_ENERGY) - setPowerType(POWER_ENERGY); + if (GetPowerType() != POWER_ENERGY) + SetPowerType(POWER_ENERGY); break; } case FORM_BEAR: @@ -17764,17 +17764,17 @@ void Player::InitDataForForm(bool reapplyMods) SetAttackTime(BASE_ATTACK, 2500, false); //Speed 2.5 SetAttackTime(OFF_ATTACK, 2500, false); //Speed 2.5 - if (getPowerType() != POWER_RAGE) - setPowerType(POWER_RAGE); + if (GetPowerType() != POWER_RAGE) + SetPowerType(POWER_RAGE); break; } default: // 0, for example { SetRegularAttackTime(false); - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass()); - if (cEntry && cEntry->powerType < MAX_POWERS && uint32(getPowerType()) != cEntry->powerType) - setPowerType(Powers(cEntry->powerType)); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(GetClass()); + if (cEntry && cEntry->powerType < MAX_POWERS && uint32(GetPowerType()) != cEntry->powerType) + SetPowerType(Powers(cEntry->powerType)); break; } @@ -17794,7 +17794,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, // cheating attempt if (count < 1) count = 1; - if (!isAlive()) + if (!IsAlive()) return false; ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item); @@ -17871,7 +17871,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, m_honorMgr.GetHighestRank().rank : m_honorMgr.GetRank().rank; // do not check level requirement for normal items (PvP related bonus items is another case) - if (pProto->RequiredHonorRank && (playerRank < (uint8)pProto->RequiredHonorRank || getLevel() < pProto->RequiredLevel)) + if (pProto->RequiredHonorRank && (playerRank < (uint8)pProto->RequiredHonorRank || GetLevel() < pProto->RequiredLevel)) { SendBuyError(BUY_ERR_RANK_REQUIRE, pCreature, item, 0); return false; @@ -18128,7 +18128,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint) bool Player::CanJoinToBattleground() const { // check Deserter debuff - if (GetDummyAura(26013)) + if (HasAura(26013)) return false; return true; } @@ -18144,15 +18144,15 @@ bool Player::IsVisibleInGridForPlayer(Player const* pl) const return true; // Live player see live player or dead player with not realized corpse - if (pl->getDeathState() != DEAD) - return getDeathState() != DEAD; + if (pl->GetDeathState() != DEAD) + return GetDeathState() != DEAD; // Ghost see other friendly ghosts, that's for sure - if (getDeathState() == DEAD && IsFriendlyTo(pl)) + if (GetDeathState() == DEAD && IsFriendlyTo(pl)) return true; // Dead player see live players near own corpse - if (isAlive()) + if (IsAlive()) { Corpse *corpse = pl->GetCorpse(); if (corpse) @@ -18203,7 +18203,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe bool inVisibleList = IsInVisibleList(target); if (inVisibleList) { - if (!target->FindMap() || !target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) || !target->isVisibleForInState(this, viewPoint, true)) + if (!target->FindMap() || !target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) || !target->IsVisibleForInState(this, viewPoint, true)) { ObjectGuid t_guid = target->GetObjectGuid(); @@ -18221,7 +18221,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe } else { - if (target->FindMap() && target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) && target->isVisibleForInState(this, viewPoint, false)) + if (target->FindMap() && target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) && target->IsVisibleForInState(this, viewPoint, false)) { target->SendCreateUpdateToPlayer(this); if (target->GetTypeId() != TYPEID_GAMEOBJECT || !((GameObject*)target)->IsTransport()) @@ -18287,7 +18287,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD bool inVisibleList = IsInVisibleList(target); if (inVisibleList) { - if (!target->FindMap() || !target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) || !target->isVisibleForInState(this, viewPoint, true)) + if (!target->FindMap() || !target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) || !target->IsVisibleForInState(this, viewPoint, true)) { ObjectGuid t_guid = target->GetObjectGuid(); @@ -18302,7 +18302,7 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateD } else { - if (target->FindMap() && target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) && target->isVisibleForInState(this, viewPoint, false)) + if (target->FindMap() && target->isWithinVisibilityDistanceOf(this, viewPoint, inVisibleList) && target->IsVisibleForInState(this, viewPoint, false)) { visibleNow.insert(target); target->BuildCreateUpdateBlockForPlayer(&data, this); @@ -18615,14 +18615,14 @@ void Player::ResetSpells() void Player::LearnDefaultSpells() { // learn default race/class spells - PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(GetRace(), GetClass()); if (!info) return; for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr != info->spell.end(); ++itr) { uint32 tspell = *itr; - DEBUG_LOG("PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getRace()), tspell); + DEBUG_LOG("PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(GetClass()), uint32(GetRace()), tspell); if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add AddSpell(tspell, true, true, true, false); else // but send in normal spell in game learn case @@ -18753,7 +18753,7 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const if (!bg) return false; - if (getLevel() < bg->GetMinLevel() || getLevel() > bg->GetMaxLevel()) + if (GetLevel() < bg->GetMinLevel() || GetLevel() > bg->GetMaxLevel()) return false; return true; @@ -18792,10 +18792,10 @@ BattleGroundBracketId Player::GetBattleGroundBracketIdFromLevel(BattleGroundType BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); ASSERT(bg); - if (getLevel() < bg->GetMinLevel()) + if (GetLevel() < bg->GetMinLevel()) return BG_BRACKET_ID_NONE; - uint32 bracket_id = (getLevel() - bg->GetMinLevel()) / 10; + uint32 bracket_id = (GetLevel() - bg->GetMinLevel()) / 10; if (bracket_id > MAX_BATTLEGROUND_BRACKETS) return BG_BRACKET_ID_LAST; @@ -18849,8 +18849,8 @@ float Player::GetReputationPriceDiscount(Creature const* pCreature) const */ bool Player::IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel /*= nullptr*/) const { - uint32 racemask = getRaceMask(); - uint32 classmask = getClassMask(); + uint32 racemask = GetRaceMask(); + uint32 classmask = GetClassMask(); SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBoundsBySpellId(spell_id); if (bounds.first == bounds.second) @@ -18886,7 +18886,7 @@ bool Player::IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel /*= nul } else // check availble case at train { - if (skillRCEntry->reqLevel && getLevel() < skillRCEntry->reqLevel) + if (skillRCEntry->reqLevel && GetLevel() < skillRCEntry->reqLevel) return false; } } @@ -19225,8 +19225,8 @@ uint32 Player::GetResurrectionSpellId() const // Used in triggers for check "Only to targets that grant experience or honor" req bool Player::IsHonorOrXPTarget(Unit* pVictim) const { - uint32 v_level = pVictim->getLevel(); - uint32 k_grey = MaNGOS::XP::GetGrayLevel(getLevel()); + uint32 v_level = pVictim->GetLevel(); + uint32 k_grey = MaNGOS::XP::GetGrayLevel(GetLevel()); // Victim level less gray level if (v_level <= k_grey) @@ -19237,7 +19237,7 @@ bool Player::IsHonorOrXPTarget(Unit* pVictim) const if (((Creature*)pVictim)->IsTotem() || ((Creature*)pVictim)->IsPet() || ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL || - pVictim->hasUnitState(UNIT_STAT_NO_KILL_REWARD)) + pVictim->HasUnitState(UNIT_STAT_NO_KILL_REWARD)) return false; } return true; @@ -19245,7 +19245,7 @@ bool Player::IsHonorOrXPTarget(Unit* pVictim) const void Player::RewardSinglePlayerAtKill(Unit* pVictim) { - bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); + bool PvP = pVictim->IsCharmedOwnedByPlayerOrPlayer(); uint32 xp = PvP ? 0 : MaNGOS::XP::Gain(this, pVictim); @@ -19287,7 +19287,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar continue; // member (alive or dead) or his corpse at req. distance // quest objectives updated only for alive group member or dead but with not released body - if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) pGroupGuy->KilledMonsterCredit(creature_id, creature_guid); } } @@ -19310,7 +19310,7 @@ void Player::RewardPlayerAndGroupAtCast(WorldObject* pRewardSource, uint32 spell continue; // member (alive or dead) or his corpse at req. distance // quest objectives updated only for alive group member or dead but with not released body - if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + if (pGroupGuy->IsAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) pGroupGuy->CastedCreatureOrGO(pRewardSource->GetEntry(), pRewardSource->GetObjectGuid(), spellid, pGroupGuy == this); } } @@ -19327,7 +19327,7 @@ bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const if (IsWithinLootXPDist(pRewardSource)) return true; - if (isAlive()) + if (IsAlive()) return false; Corpse* corpse = GetCorpse(); @@ -19403,7 +19403,7 @@ bool Player::HasSelfMovementControl() const if (m_longSightSpell) return false; - if (hasUnitState(UNIT_STAT_LOST_CONTROL | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) + if (HasUnitState(UNIT_STAT_LOST_CONTROL | UNIT_STAT_CONFUSED | UNIT_STAT_TAXI_FLIGHT)) return false; return true; @@ -19412,8 +19412,8 @@ bool Player::HasSelfMovementControl() const bool Player::IsAllowedToMove(Unit* unit) const { if (unit == this) - return !hasUnitState(UNIT_STAT_POSSESSED | UNIT_STAT_FLEEING | UNIT_FLAG_CONFUSED); - return !unit->hasUnitState(UNIT_STAT_FLEEING | UNIT_FLAG_CONFUSED); + return !HasUnitState(UNIT_STAT_POSSESSED | UNIT_STAT_FLEEING | UNIT_FLAG_CONFUSED); + return !unit->HasUnitState(UNIT_STAT_FLEEING | UNIT_FLAG_CONFUSED); } void Player::UpdateZoneDependentAuras() @@ -19726,7 +19726,7 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const bool Player::CanUseBattleGroundObject() const { // Spirit of redemption case - if (getClass() == CLASS_PRIEST && HasAura(27827)) + if (GetClass() == CLASS_PRIEST && HasAura(27827)) return false; if (IsGameMaster()) return false; @@ -19739,8 +19739,8 @@ bool Player::CanUseBattleGroundObject() const //i'm not sure if these two are correct, because invisible players should get visible when they click on flag //!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 + IsAlive() && // live player + !HasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) // Nostalrius : en cecite ou fear par exemple ); } @@ -19786,7 +19786,7 @@ void Player::AutoStoreLoot(Loot& loot, bool broadcast, uint8 bag, uint8 slot) uint32 Player::CalculateTalentsPoints() const { - uint32 talentPointsForLevel = getLevel() < 10 ? 0 : getLevel() - 9; + uint32 talentPointsForLevel = GetLevel() < 10 ? 0 : GetLevel() - 9; return uint32(talentPointsForLevel * sWorld.getConfig(CONFIG_FLOAT_RATE_TALENT)); } @@ -19956,7 +19956,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored // 14.57 can be calculated by resolving damageperc formula below to 0 - if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && + if (z_diff >= 14.57f && !IsDead() && !IsGameMaster() && !HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) && !IsImmuneToDamage(SPELL_SCHOOL_MASK_NORMAL)) { @@ -20011,7 +20011,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) return; // prevent learn talent for different class (cheating) - if ((getClassMask() & talentTabInfo->ClassMask) == 0) + if ((GetClassMask() & talentTabInfo->ClassMask) == 0) return; // find current max talent rank @@ -20119,7 +20119,7 @@ void Player::UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcod bool Player::FallGround(uint8 FallMode) { // Let's abort after we called this function one time - if (getDeathState() == CORPSE_FALLING && FallMode == 0) + if (GetDeathState() == CORPSE_FALLING && FallMode == 0) return false; float x, y, z; @@ -20379,11 +20379,11 @@ void Player::SetControlledBy(Unit* pWho) bool Player::ChangeRace(uint8 newRace) { - PlayerInfo const *info = sObjectMgr.GetPlayerInfo(newRace, getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(newRace, GetClass()); if (!info) return false; - uint8 oldRace = getRace(); + uint8 oldRace = GetRace(); bool bChangeTeam = (TeamForRace(oldRace) != TeamForRace(newRace)); m_DbSaveDisabled = true; @@ -20519,7 +20519,7 @@ bool Player::ChangeSpellsForRace(uint8 oldRace, uint8 newRace) { Team oldTeam = TeamForRace(oldRace); // Les classes qui ont des sorts differents - switch (getClass()) + switch (GetClass()) { case CLASS_PRIEST: { @@ -20530,7 +20530,7 @@ bool Player::ChangeSpellsForRace(uint8 oldRace, uint8 newRace) } } - PlayerInfo const *info = sObjectMgr.GetPlayerInfo(oldRace, getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(oldRace, GetClass()); ASSERT(info); for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr != info->spell.end(); ++itr) { @@ -20709,9 +20709,9 @@ bool Player::ChangeReputationsForRace(uint8 oldRace, uint8 newRace) continue; // Calcul des reputations/flags de base - int newIdx = pFactionEntry->GetIndexFitTo(newRaceMask, getClassMask()); + int newIdx = pFactionEntry->GetIndexFitTo(newRaceMask, GetClassMask()); int32 newBaseRep = newIdx >= 0 ? pFactionEntry->BaseRepValue[newIdx] : 0; - int oldIdx = pFactionEntry->GetIndexFitTo(oldRaceMask, getClassMask()); + int oldIdx = pFactionEntry->GetIndexFitTo(oldRaceMask, GetClassMask()); int32 oldBaseRep = oldIdx >= 0 ? pFactionEntry->BaseRepValue[oldIdx] : 0; // De signe different et non nulles. @@ -20999,7 +20999,7 @@ void Player::RewardHonor(Unit* uVictim, uint32 groupSize) if (sWorld.GetWowPatch() < WOW_PATCH_105 && sWorld.getConfig(CONFIG_BOOL_ACCURATE_PVP_TIMELINE)) return; - m_honorMgr.Add(HonorMgr::DishonorableKillPoints(getLevel()), DISHONORABLE, cVictim); + m_honorMgr.Add(HonorMgr::DishonorableKillPoints(GetLevel()), DISHONORABLE, cVictim); return; } @@ -21028,21 +21028,21 @@ void Player::RewardHonorOnDeath() uint32 totalDamage = 0; std::map damagePerGroup; std::map damagePerAlonePlayer; - for (auto itr : _damageTakenHistory) + for (auto itr : m_damageTakenHistory) { totalDamage += itr.second; if (Player* attacker = GetMap()->GetPlayer(itr.first)) { if (Group* g = attacker->GetGroup()) damagePerGroup[g] += itr.second; - else if (attacker->IsAtGroupRewardDistance(this) && attacker->isAlive() && attacker->GetTeam() != GetTeam()) + else if (attacker->IsAtGroupRewardDistance(this) && attacker->IsAlive() && attacker->GetTeam() != GetTeam()) damagePerAlonePlayer[attacker] += itr.second; } } if (!totalDamage) { - _damageTakenHistory.clear(); + m_damageTakenHistory.clear(); return; } @@ -21053,7 +21053,7 @@ void Player::RewardHonorOnDeath() std::list rewarded; for (auto grItr : g->GetMemberSlots()) if (Player* pl = GetMap()->GetPlayer(grItr.guid)) - if (pl->IsAtGroupRewardDistance(this) && pl->isAlive() && pl->GetTeam() != GetTeam()) + if (pl->IsAtGroupRewardDistance(this) && pl->IsAlive() && pl->GetTeam() != GetTeam()) rewarded.push_back(pl); uint32 totalRewarded = rewarded.size(); @@ -21084,7 +21084,7 @@ void Player::RewardHonorOnDeath() rewItr.first->GetHonorMgr().Add(rewPoints, HONORABLE, this); } - _damageTakenHistory.clear(); + m_damageTakenHistory.clear(); } void Player::OnReceivedItem(Item* item) @@ -21191,7 +21191,7 @@ void Player::HandleStealthedUnitsDetection() if ((*i) == this) continue; - bool hasDetected = (*i)->isVisibleForOrDetect(this, viewPoint, true); + bool hasDetected = (*i)->IsVisibleForOrDetect(this, viewPoint, true); if (hasDetected) { diff --git a/src/game/Objects/Player.h b/src/game/Objects/Player.h index 830e84a7f..683f3bacb 100644 --- a/src/game/Objects/Player.h +++ b/src/game/Objects/Player.h @@ -1088,7 +1088,7 @@ class MANGOS_DLL_SPEC Player final: public Unit #endif #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 - uint32 GetMaxKeyringSize() const { return getLevel() < 40 ? 4 : (getLevel() < 50 ? 8 : 12); } + uint32 GetMaxKeyringSize() const { return GetLevel() < 40 ? 4 : (GetLevel() < 50 ? 8 : 12); } #else uint32 GetMaxKeyringSize() const { return 0; } #endif @@ -1201,7 +1201,7 @@ class MANGOS_DLL_SPEC Player final: public Unit void RemoveQuestSlotState(uint16 slot, uint8 state) { RemoveByteFlag(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNT_STATE_OFFSET, 3, state); } void SetQuestSlotTimer(uint16 slot, uint32 timer) { SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer); } public: - uint32 GetQuestLevelForPlayer(Quest const* pQuest) const { return pQuest && (pQuest->GetQuestLevel() > 0) ? pQuest->GetQuestLevel() : getLevel(); } + uint32 GetQuestLevelForPlayer(Quest const* pQuest) const { return pQuest && (pQuest->GetQuestLevel() > 0) ? pQuest->GetQuestLevel() : GetLevel(); } void PrepareQuestMenu(ObjectGuid guid, uint32 exceptQuestId = 0); void SendPreparedQuest(ObjectGuid guid); bool IsActiveQuest(uint32 quest_id) const; // can be taken or taken @@ -1396,7 +1396,7 @@ class MANGOS_DLL_SPEC Player final: public Unit void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; } void UnsummonPetTemporaryIfAny(); void ResummonPetTemporaryUnSummonedIfAny(); - bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !isAlive() || IsMounted() /*+in flight*/; } + bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !IsAlive() || IsMounted() /*+in flight*/; } /*********************************************************/ /*** SPELL SYSTEM ***/ @@ -1451,6 +1451,7 @@ class MANGOS_DLL_SPEC Player final: public Unit void DropModCharge(SpellModifier* mod, Spell* spell); std::vector m_ItemSetEff; + uint32 m_castingSpell; // Last spell cast by client, or combo points if player is rogue /*********************************************************/ /*** TALENT SYSTEM ***/ @@ -1673,13 +1674,13 @@ class MANGOS_DLL_SPEC Player final: public Unit { // we should not execute delayed teleports for now dead players but has been alive at teleport // because we don't want player's ghost teleported from graveyard - return m_bHasDelayedTeleport && (isAlive() || !m_bHasBeenAliveAtDelayedTeleport); + return m_bHasDelayedTeleport && (IsAlive() || !m_bHasBeenAliveAtDelayedTeleport); } bool SetDelayedTeleportFlagIfCan() { m_bHasDelayedTeleport = m_bCanDelayTeleport; - m_bHasBeenAliveAtDelayedTeleport = isAlive(); + m_bHasBeenAliveAtDelayedTeleport = IsAlive(); return m_bHasDelayedTeleport; } @@ -1947,7 +1948,7 @@ class MANGOS_DLL_SPEC Player final: public Unit public: PlayerTaxi& GetTaxi() { return m_taxi; } PlayerTaxi const& GetTaxi() const { return m_taxi; } - void InitTaxiNodes() { m_taxi.InitTaxiNodes(getRace(), getLevel()); } + void InitTaxiNodes() { m_taxi.InitTaxiNodes(GetRace(), GetLevel()); } bool ActivateTaxiPathTo(std::vector const& nodes, Creature* npc = nullptr, uint32 spellid = 0, bool nocheck = false); bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0, bool nocheck = false); void TaxiStepFinished(); diff --git a/src/game/Objects/TemporarySummon.cpp b/src/game/Objects/TemporarySummon.cpp index 292c0b320..7b227ce76 100644 --- a/src/game/Objects/TemporarySummon.cpp +++ b/src/game/Objects/TemporarySummon.cpp @@ -47,7 +47,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) } case TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT: { - if (!isInCombat()) + if (!IsInCombat()) { if (m_timer <= update_diff) { @@ -79,7 +79,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (isDead()) + if (IsDead()) { UnSummon(); return; @@ -99,13 +99,13 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (isDead()) + if (IsDead()) { UnSummon(); return; } - if (!isInCombat()) + if (!IsInCombat()) { if (m_timer <= update_diff) { @@ -128,7 +128,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) return; } - if (!isInCombat() && isAlive()) + if (!IsInCombat() && IsAlive()) { if (m_timer <= update_diff) { @@ -144,14 +144,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) } case TEMPSUMMON_TIMED_COMBAT_OR_CORPSE_DESPAWN: { - if (isDead()) + if (IsDead()) { UnSummon(); return; } if (m_timer <= update_diff) { - if (!isInCombat()) + if (!IsInCombat()) { UnSummon(); return; @@ -172,7 +172,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) } // Reset timer when the mob dies - if (!isAlive() && !m_justDied) + if (!IsAlive() && !m_justDied) { m_justDied = true; m_timer = m_lifetime; @@ -181,7 +181,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) if (m_timer <= update_diff) { // Prevent despawn while the mob is still in combat - if (!isInCombat()) + if (!IsInCombat()) { UnSummon(); return; diff --git a/src/game/Objects/Totem.cpp b/src/game/Objects/Totem.cpp index e06d55c51..cd31c095c 100644 --- a/src/game/Objects/Totem.cpp +++ b/src/game/Objects/Totem.cpp @@ -68,7 +68,7 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* void Totem::Update(uint32 update_diff, uint32 time) { Unit *owner = GetOwner(); - if (!owner || !owner->isAlive() || !isAlive()) + if (!owner || !owner->IsAlive() || !IsAlive()) { UnSummon(); // remove self return; @@ -150,7 +150,7 @@ void Totem::UnSummon() } // any totem unsummon look like as totem kill, req. for proper animation - if (isAlive()) + if (IsAlive()) SetDeathState(DEAD); AddObjectToRemoveList(); @@ -160,8 +160,8 @@ void Totem::SetOwner(Unit* owner) { SetCreatorGuid(owner->GetObjectGuid()); SetOwnerGuid(owner->GetObjectGuid()); - setFaction(owner->getFaction()); - SetLevel(owner->getLevel()); + SetFactionTemplateId(owner->GetFactionTemplateId()); + SetLevel(owner->GetLevel()); } Unit *Totem::GetOwner() diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index d8d30245d..735889f68 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -105,9 +105,9 @@ void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo) Unit::Unit() : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostileRefManager(this), - movespline(new Movement::MoveSpline()), _debugFlags(0), m_needUpdateVisibility(false), - m_AutoRepeatFirstCast(true), m_castingSpell(0), m_regenTimer(0), _lastDamageTaken(0), - m_meleeZLimit(MELEE_Z_LIMIT), m_meleeZReach(MELEE_Z_LIMIT), m_lastSanctuaryTime(0) + movespline(new Movement::MoveSpline()), m_debugFlags(0), m_needUpdateVisibility(false), + m_AutoRepeatFirstCast(true), m_regenTimer(0), m_lastDamageTaken(0), + m_meleeZLimit(UNIT_DEFAULT_MELEE_Z_LIMIT), m_meleeZReach(UNIT_DEFAULT_MELEE_Z_LIMIT), m_lastSanctuaryTime(0) { m_objectType |= TYPEMASK_UNIT; m_objectTypeId = TYPEID_UNIT; @@ -127,14 +127,13 @@ Unit::Unit() m_extraAttacks = 0; m_extraMute = false; - m_state = 0; + m_stateFlags = 0; m_deathState = ALIVE; //m_Aura = nullptr; //m_AurasCheck = 2000; //m_removeAuraTimer = 4; m_spellAuraHoldersUpdateIterator = m_spellAuraHolders.end(); - m_AuraFlags = 0; m_Visibility = VISIBILITY_ON; m_AINotifyScheduled = false; @@ -203,7 +202,7 @@ Unit::Unit() // Phasing worldMask = WORLD_DEFAULT_UNIT; - _casterChaseDistance = 0.0f; + m_casterChaseDistance = 0.0f; m_doExtraAttacks = false; @@ -297,16 +296,16 @@ void Unit::Update(uint32 update_diff, uint32 p_time) } // update combat timer only for players and pets - if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet() || ((Creature*)this)->isCharmed())) + if (IsInCombat() && (IsPlayer() || ((Creature*)this)->IsPet() || ((Creature*)this)->IsCharmed())) { // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. // These flags are reset after target dies or another command is given. - if (GetCharmerGuid().IsPlayer() || GetOwnerGuid().IsPlayer() || GetTypeId() == TYPEID_PLAYER) + if (GetCharmerGuid().IsPlayer() || GetOwnerGuid().IsPlayer() || IsPlayer()) { // Pet in combat ? Pet* myPet = GetPet(); - if (!myPet || myPet->getHostileRefManager().isEmpty()) + if (!myPet || myPet->GetHostileRefManager().isEmpty()) { if (m_HostileRefManager.isEmpty()) { @@ -325,8 +324,8 @@ void Unit::Update(uint32 update_diff, uint32 p_time) } // extra attack - Unit* victim = getVictim(); - if (isInCombat() && m_doExtraAttacks && GetExtraAttacks() && victim && (CanAutoAttackTarget(victim) == ATTACK_RESULT_OK)) + Unit* victim = GetVictim(); + if (IsInCombat() && m_doExtraAttacks && GetExtraAttacks() && victim && (CanAutoAttackTarget(victim) == ATTACK_RESULT_OK)) { m_doExtraAttacks = false; @@ -338,21 +337,21 @@ void Unit::Update(uint32 update_diff, uint32 p_time) if (m_extraAttacks > 0) --m_extraAttacks; } - resetAttackTimer(BASE_ATTACK); + ResetAttackTimer(BASE_ATTACK); ExtraAttacksLocked(false); } - if (uint32 base_att = getAttackTimer(BASE_ATTACK)) - setAttackTimer(BASE_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff)); + if (uint32 base_att = GetAttackTimer(BASE_ATTACK)) + SetAttackTimer(BASE_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff)); - if (uint32 base_att = getAttackTimer(OFF_ATTACK)) - setAttackTimer(OFF_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff)); + if (uint32 base_att = GetAttackTimer(OFF_ATTACK)) + SetAttackTimer(OFF_ATTACK, (update_diff >= base_att ? 0 : base_att - update_diff)); - if (uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) - setAttackTimer(RANGED_ATTACK, (update_diff >= ranged_att ? 0 : ranged_att - update_diff)); + if (uint32 ranged_att = GetAttackTimer(RANGED_ATTACK)) + SetAttackTimer(RANGED_ATTACK, (update_diff >= ranged_att ? 0 : ranged_att - update_diff)); - if (isAlive()) + if (IsAlive()) ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, GetHealth() < GetMaxHealth() * 0.20f); CheckPendingMovementChanges(); @@ -376,21 +375,21 @@ void Unit::Update(uint32 update_diff, uint32 p_time) _delayedActions &= ~OBJECT_DELAYED_ADD_TO_RELOCATED_LIST; } - _lastDamageTaken += p_time; - if (_lastDamageTaken > 60000) - _damageTakenHistory.clear(); + m_lastDamageTaken += p_time; + if (m_lastDamageTaken > 60000) + m_damageTakenHistory.clear(); } AutoAttackCheckResult Unit::CanAutoAttackTarget(Unit const* pVictim) const { - if (hasUnitState(UNIT_STAT_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) + if (HasUnitState(UNIT_STAT_CAN_NOT_REACT) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) return ATTACK_RESULT_CANT_ATTACK; - if (!pVictim->isAlive() || !isAlive()) + if (!pVictim->IsAlive() || !IsAlive()) return ATTACK_RESULT_DEAD; - if (!CanReachWithMeleeAutoAttack(pVictim) || (!IsWithinLOSInMap(pVictim) && !hasUnitState(UNIT_STAT_ALLOW_LOS_ATTACK))) - return ATTACK_RESULT_NOT_IN_RANGE; + if (!CanReachWithMeleeAutoAttack(pVictim) || (!IsWithinLOSInMap(pVictim) && !HasUnitState(UNIT_STAT_ALLOW_LOS_ATTACK))) + return ATTACK_RESULT_NOT_IN_RANGE; if (!HasInArc(2 * M_PI_F / 3, pVictim)) return ATTACK_RESULT_BAD_FACING; @@ -400,20 +399,20 @@ AutoAttackCheckResult Unit::CanAutoAttackTarget(Unit const* pVictim) const void Unit::DelayAutoAttacks() { - if (isAttackReady(BASE_ATTACK)) - setAttackTimer(BASE_ATTACK, 100); - if (haveOffhandWeapon() && isAttackReady(OFF_ATTACK)) - setAttackTimer(OFF_ATTACK, 100); + if (IsAttackReady(BASE_ATTACK)) + SetAttackTimer(BASE_ATTACK, 100); + if (HaveOffhandWeapon() && IsAttackReady(OFF_ATTACK)) + SetAttackTimer(OFF_ATTACK, 100); } bool Unit::UpdateMeleeAttackingState() { - Unit* pVictim = getVictim(); + Unit* pVictim = GetVictim(); if (!pVictim || IsNonMeleeSpellCasted(false)) return false; - if (!isAttackReady(BASE_ATTACK) && !(isAttackReady(OFF_ATTACK) && haveOffhandWeapon())) + if (!IsAttackReady(BASE_ATTACK) && !(IsAttackReady(OFF_ATTACK) && HaveOffhandWeapon())) return false; AutoAttackCheckResult swingError = CanAutoAttackTarget(pVictim); @@ -423,26 +422,26 @@ bool Unit::UpdateMeleeAttackingState() { case ATTACK_RESULT_OK: { - if (isAttackReady(BASE_ATTACK)) + if (IsAttackReady(BASE_ATTACK)) { // prevent base and off attack in same time, delay attack at 0.2 sec - if (haveOffhandWeapon()) + if (HaveOffhandWeapon()) { - if (getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY) - setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); + if (GetAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY) + SetAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); } AttackerStateUpdate(pVictim, BASE_ATTACK, false); - resetAttackTimer(BASE_ATTACK); + ResetAttackTimer(BASE_ATTACK); } - if (haveOffhandWeapon() && isAttackReady(OFF_ATTACK)) + if (HaveOffhandWeapon() && IsAttackReady(OFF_ATTACK)) { // prevent base and off attack in same time, delay attack at 0.2 sec - uint32 base_att = getAttackTimer(BASE_ATTACK); + uint32 base_att = GetAttackTimer(BASE_ATTACK); if (base_att < ATTACK_DISPLAY_DELAY) - setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY); + SetAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY); // do attack AttackerStateUpdate(pVictim, OFF_ATTACK, false); - resetAttackTimer(OFF_ATTACK); + ResetAttackTimer(OFF_ATTACK); } break; } @@ -487,12 +486,12 @@ bool Unit::UpdateMeleeAttackingState() return swingError == ATTACK_RESULT_OK; } -bool Unit::haveOffhandWeapon() const +bool Unit::HaveOffhandWeapon() const { if (!CanUseEquippedWeapon(OFF_ATTACK)) return false; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK, true, true); else { @@ -519,7 +518,7 @@ void Unit::SendHeartBeat(bool includingSelf) SendMovementMessageToSet(std::move(data), includingSelf); } -void Unit::resetAttackTimer(WeaponAttackType type) +void Unit::ResetAttackTimer(WeaponAttackType type) { m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]); } @@ -549,8 +548,8 @@ void Unit::RemoveNonPassiveSpellsCausingAura(AuraType auraType) bool Unit::HasAuraTypeByCaster(AuraType auraType, ObjectGuid casterGuid) const { - for (AuraList::const_iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); ++iter) - if ((*iter)->GetCasterGuid() == casterGuid) + for (const auto& iter : m_modAuras[auraType]) + if (iter->GetCasterGuid() == casterGuid) return true; return false; } @@ -579,16 +578,6 @@ uint64 Unit::GetNegativeAuraApplicationMask() const return mask; } -uint32 Unit::GetFirstAuraBySpellIconAndVisual(uint32 spellIconId, uint32 spellVisual) const -{ - for (SpellAuraHolderMap::const_iterator i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); ++i) - { - if ((*i).second->GetSpellProto()->SpellIconID == spellIconId && (*i).second->GetSpellProto()->SpellVisual == spellVisual) - return (*i).second->GetId(); - } - return 0; -} - void Unit::RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except) { for (AuraList::const_iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();) @@ -614,7 +603,7 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage) return; // The chance to dispel an aura depends on the damage taken with respect to the casters level. - uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50; + uint32 max_dmg = GetLevel() > 8 ? 25 * GetLevel() - 150 : 50; float chance = float(damage) / max_dmg * 100.0f; if (roll_chance_f(chance)) { @@ -643,7 +632,7 @@ void Unit::RemoveFearEffectsByDamageTaken(uint32 damage, uint32 exceptSpellId, D // https://forum.nostalrius.org/viewtopic.php?f=5&t=17424#p119432 // The chance to dispel an aura depends on the damage taken with respect to the caster's level. - uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50; + uint32 max_dmg = GetLevel() > 8 ? 25 * GetLevel() - 150 : 50; // Players are 3x more likely to break fears #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 @@ -702,16 +691,16 @@ void Unit::RemoveFearEffectsByDamageTaken(uint32 damage, uint32 exceptSpellId, D } } -void Unit::DoKillUnit(Unit* victim) +void Unit::DoKillUnit(Unit* pVictim) { - if (!victim) - victim = this; - if (!victim->isAlive()) + if (!pVictim) + pVictim = this; + if (!pVictim->IsAlive()) return; - DealDamage(victim, victim->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); + DealDamage(pVictim, pVictim->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } -uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss, Spell* spell) +uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss, Spell* spell) { // remove affects from victim (including from 0 damage and DoTs) if (pVictim != this) @@ -726,7 +715,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim != this) RemoveNonPassiveSpellsCausingAura(SPELL_AURA_MOD_INVISIBILITY); - if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsMounted() && !pVictim->IsStandingUp()) + if (pVictim->IsPlayer() && !pVictim->IsMounted() && !pVictim->IsStandingUp()) pVictim->SetStandState(UNIT_STAND_STATE_STAND); } @@ -739,7 +728,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // Rage on outgoing parry/dodge if (cleanDamage->hitOutCome == MELEE_HIT_PARRY || cleanDamage->hitOutCome == MELEE_HIT_DODGE) { - if (cleanDamage->damage && damagetype == DIRECT_DAMAGE && this != pVictim && GetTypeId() == TYPEID_PLAYER && (getPowerType() == POWER_RAGE)) + if (cleanDamage->damage && damagetype == DIRECT_DAMAGE && this != pVictim && IsPlayer() && (GetPowerType() == POWER_RAGE)) ((Player*)this)->RewardRage(cleanDamage->damage*0.75, true); } @@ -754,7 +743,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (!spellProto || ((damagetype != SPELL_DIRECT_DAMAGE) && !spellProto->HasAura(SPELL_AURA_MOD_FEAR))) #endif { - if (!(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsWorldBoss())) + if (!(IsCreature() && ((Creature*)this)->IsWorldBoss())) pVictim->RemoveFearEffectsByDamageTaken(cleanDamage->absorb, spellProto ? spellProto->Id : 0, damagetype); } @@ -764,7 +753,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); // interrupt spells like trying to mount even through absorb shields - if (pVictim->GetTypeId() == TYPEID_PLAYER && damagetype != DOT) + if (pVictim->IsPlayer() && damagetype != DOT) pVictim->InterruptSpellsWithInterruptFlags(SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, spellProto ? spellProto->Id : 0); } if (damagetype != DOT) @@ -784,7 +773,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (!spellProto || ((damagetype != SPELL_DIRECT_DAMAGE) && !spellProto->HasAura(SPELL_AURA_MOD_FEAR))) #endif { - if (!(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsWorldBoss())) + if (!(IsCreature() && ((Creature*)this)->IsWorldBoss())) pVictim->RemoveFearEffectsByDamageTaken(damage, spellProto ? spellProto->Id : 0, damagetype); } @@ -794,7 +783,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // no xp,health if type 8 /critters/ uint32 victimEntry = pVictim->GetEntry(); - if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER && victimEntry != 10441 && victimEntry != 10461 && victimEntry != 10536) + if (pVictim->IsCreature() && pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER && victimEntry != 10441 && victimEntry != 10461 && victimEntry != 10536) { // TODO: fix this part // Critter may not die of damage taken, instead expect it to run away (no fighting back) @@ -815,7 +804,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } // some critters required for quests - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) if (CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(pVictim->GetEntry())) ((Player*)this)->KilledMonster(normalInfo, pVictim->GetObjectGuid()); // Nostalrius : ajout de 'JustDied' pour les CRITTER. @@ -828,7 +817,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DealDamage critter, critter dies"); // Rage from Damage made vs critters (only from direct weapon damage) - if (damage && damagetype == DIRECT_DAMAGE && this != pVictim && GetTypeId() == TYPEID_PLAYER && (getPowerType() == POWER_RAGE)) + if (damage && damagetype == DIRECT_DAMAGE && this != pVictim && IsPlayer() && (GetPowerType() == POWER_RAGE)) ((Player*)this)->RewardRage(damage, true); return damage; @@ -837,7 +826,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa uint32 health = pVictim->GetHealth(); // duel ends when player has 1 or less hp bool duel_hasEnded = false; - if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->duel && damage >= (health - 1)) + if (pVictim->IsPlayer() && ((Player*)pVictim)->duel && damage >= (health - 1)) { // prevent kill only if killed in duel and killed by opponent or opponent controlled creature if (((Player*)pVictim)->duel->opponent == this || ((Player*)pVictim)->duel->opponent->GetObjectGuid() == GetOwnerGuid()) @@ -851,10 +840,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { SetInCombatWithVictim(pVictim); pVictim->SetInCombatWithAggressor(this); - if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_UNIT) + if (IsPlayer() && pVictim->IsCreature()) pVictim->ToCreature()->ResetLastDamageTakenTime();; } - if (pVictim->GetTypeId() == TYPEID_UNIT) + if (pVictim->IsCreature()) pVictim->ToCreature()->CountDamageTaken(damage, GetCharmerOrOwnerOrOwnGuid().IsPlayer() || pVictim == this); else if (pVictim != this) { @@ -865,7 +854,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } // Rage from Damage made (only from direct weapon damage) - if (damage && damagetype == DIRECT_DAMAGE && this != pVictim && GetTypeId() == TYPEID_PLAYER && (getPowerType() == POWER_RAGE)) + if (damage && damagetype == DIRECT_DAMAGE && this != pVictim && IsPlayer() && (GetPowerType() == POWER_RAGE)) ((Player*)this)->RewardRage(damage, true); if (Creature* creaVictim = pVictim->ToCreature()) @@ -877,7 +866,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa else if (ObjectGuid recipient = creaVictim->GetLootRecipientGuid()) { // Replace loot recipient if current recipient is pet and attacker is owner or grouped with owner - if (recipient.IsPet() && GetTypeId() == TYPEID_PLAYER) + if (recipient.IsPet() && IsPlayer()) { if (GetPetGuid() == recipient) creaVictim->SetLootRecipient(this); @@ -903,7 +892,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // last damage from non duel opponent or opponent controlled creature if (duel_hasEnded) { - MANGOS_ASSERT(pVictim->GetTypeId() == TYPEID_PLAYER); + MANGOS_ASSERT(pVictim->IsPlayer()); Player *he = (Player*)pVictim; MANGOS_ASSERT(he->duel); @@ -920,7 +909,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (damagetype != DOT) { - if (!getVictim()) + if (!GetVictim()) { // if not have main target then attack state with target (including AI call) //start melee attacks only after melee hit @@ -933,7 +922,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } // polymorphed, hex and other negative transformed cases - uint32 morphSpell = pVictim->getTransForm(); + uint32 morphSpell = pVictim->GetTransForm(); if (morphSpell && !Spells::IsPositiveSpell(morphSpell)) { if (SpellEntry const* morphEntry = sSpellMgr.GetSpellEntry(morphSpell)) @@ -950,7 +939,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (!spellProto || !(spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DIRECT_DAMAGE)) pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE); } - if (pVictim->GetTypeId() != TYPEID_PLAYER) + if (!pVictim->IsPlayer()) { float threat = damage * sSpellMgr.GetSpellThreatMultiplier(spellProto); pVictim->AddThreat(this, threat, (cleanDamage && cleanDamage->hitOutCome == MELEE_HIT_CRIT), damageSchoolMask, spellProto); @@ -958,7 +947,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa else // victim is a player { // Rage from damage received - if (this != pVictim && pVictim->getPowerType() == POWER_RAGE) + if (this != pVictim && pVictim->GetPowerType() == POWER_RAGE) { ((Player*)pVictim)->RewardRage(damage, false); } @@ -971,7 +960,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } } - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // random durability for items (HIT DONE) if (roll_chance_f(sWorld.getConfig(CONFIG_FLOAT_RATE_DURABILITY_LOSS_DAMAGE))) @@ -991,7 +980,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa else pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE, spellProto ? spellProto->Id : 0); - if (damagetype != NODAMAGE && damage && pVictim->GetTypeId() == TYPEID_PLAYER) + if (damagetype != NODAMAGE && damage && pVictim->IsPlayer()) { if (damagetype != DOT) { @@ -1042,7 +1031,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // last damage from duel opponent if (duel_hasEnded) { - MANGOS_ASSERT(pVictim->GetTypeId() == TYPEID_PLAYER); + MANGOS_ASSERT(pVictim->IsPlayer()); Player *he = (Player*)pVictim; MANGOS_ASSERT(he->duel); @@ -1201,20 +1190,20 @@ void Unit::Kill(Unit* pVictim, SpellEntry const *spellProto, bool durabilityLoss pVictim->RemoveCharmAuras(); // stop combat pVictim->CombatStop(); - pVictim->getHostileRefManager().deleteReferences(); + pVictim->GetHostileRefManager().deleteReferences(); bool damageFromSpiritOfRedemtionTalent = (spellProto && spellProto->Id == 27795); // if talent known but not triggered (check priest class for speedup check) bool spiritOfRedemtionTalentImmune = false; - if (pPlayerVictim && pVictim->getClass() == CLASS_PRIEST) + if (pPlayerVictim && pVictim->GetClass() == CLASS_PRIEST) { if (!damageFromSpiritOfRedemtionTalent) // not called from SPELL_AURA_SPIRIT_OF_REDEMPTION { AuraList const& vDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); - for (AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr) + for (const auto& itr : vDummyAuras) { - if ((*itr)->GetSpellProto()->SpellIconID == 1654) + if (itr->GetSpellProto()->SpellIconID == 1654) { spiritOfRedemtionTalentImmune = true; break; @@ -1372,7 +1361,7 @@ struct PetOwnerKilledUnitHelper explicit PetOwnerKilledUnitHelper(Unit* pVictim) : m_victim(pVictim) {} void operator()(Unit* pTarget) const { - if (pTarget->GetTypeId() == TYPEID_UNIT) + if (pTarget->IsCreature()) { if (((Creature*)pTarget)->AI()) ((Creature*)pTarget)->AI()->OwnerKilledUnit(m_victim); @@ -1407,7 +1396,7 @@ void Unit::CastStop(uint32 except_spellid) // Obsolete func need remove, here only for comotability vs another patches -uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage) +uint32 Unit::SpellNonMeleeDamageLog(Unit* pVictim, uint32 spellID, uint32 damage) { SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(spellID); SpellNonMeleeDamage damageInfo(this, pVictim, spellInfo->Id, SpellSchools(spellInfo->School)); @@ -1420,7 +1409,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage } //TODO for melee need create structure as in -void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType) +void Unit::CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType) { damageInfo->attacker = this; damageInfo->target = pVictim; @@ -1428,7 +1417,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da if (!pVictim) return; - if (!isAlive() || !pVictim->isAlive()) + if (!IsAlive() || !pVictim->IsAlive()) return; // Select HitInfo/procAttacker/procVictim flag based on attack type @@ -1464,7 +1453,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da SubDamageInfo *subDamage = &damageInfo->subDamage[i]; // feral only allowed melee school - subDamage->damageSchoolMask = GetTypeId() == TYPEID_PLAYER && !feral + subDamage->damageSchoolMask = IsPlayer() && !feral ? GetSchoolMask(GetWeaponDamageSchool(damageInfo->attackType, i)) : GetMeleeDamageSchoolMask(); @@ -1627,7 +1616,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da float lowCap = 0.91f; float highCap = 0.99f; - if ((getClassMask() & CLASSMASK_WAND_USERS) != 0) { + if ((GetClassMask() & CLASSMASK_WAND_USERS) != 0) { low -= 0.7f; high -= 0.3f; lowCap = 0.6f; @@ -1718,12 +1707,12 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) { if (damageInfo == nullptr) return; - Unit *pVictim = damageInfo->target; + Unit* pVictim = damageInfo->target; if (!pVictim) return; - if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) + if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->IsCreature() && ((Creature*)pVictim)->IsInEvadeMode())) return; // Hmmmm dont like this emotes client must by self do all animations @@ -1737,19 +1726,19 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if (damageInfo->TargetState == VICTIMSTATE_PARRY) { // Get attack timers - float offtime = float(pVictim->getAttackTimer(OFF_ATTACK)); - float basetime = float(pVictim->getAttackTimer(BASE_ATTACK)); + float offtime = float(pVictim->GetAttackTimer(OFF_ATTACK)); + float basetime = float(pVictim->GetAttackTimer(BASE_ATTACK)); // Reduce attack time - if (pVictim->haveOffhandWeapon() && offtime < basetime) + if (pVictim->HaveOffhandWeapon() && offtime < basetime) { float percent20 = pVictim->GetAttackTime(OFF_ATTACK) * 0.20f; float percent60 = 3.0f * percent20; if (offtime > percent20 && offtime <= percent60) - pVictim->setAttackTimer(OFF_ATTACK, uint32(percent20)); + pVictim->SetAttackTimer(OFF_ATTACK, uint32(percent20)); else if (offtime > percent60) { offtime -= 2.0f * percent20; - pVictim->setAttackTimer(OFF_ATTACK, uint32(offtime)); + pVictim->SetAttackTimer(OFF_ATTACK, uint32(offtime)); } } else @@ -1757,11 +1746,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) float percent20 = pVictim->GetAttackTime(BASE_ATTACK) * 0.20f; float percent60 = 3.0f * percent20; if (basetime > percent20 && basetime <= percent60) - pVictim->setAttackTimer(BASE_ATTACK, uint32(percent20)); + pVictim->SetAttackTimer(BASE_ATTACK, uint32(percent20)); else if (basetime > percent60) { basetime -= 2.0f * percent20; - pVictim->setAttackTimer(BASE_ATTACK, uint32(basetime)); + pVictim->SetAttackTimer(BASE_ATTACK, uint32(basetime)); } } } @@ -1771,7 +1760,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) DealDamage(pVictim, damageInfo->totalDamage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->subDamage[0].damageSchoolMask), nullptr, durabilityLoss); // If this is a creature and it attacks from behind it has a probability to daze it's victim - if (damageInfo->totalDamage && GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGuid() && !pVictim->HasInArc(M_PI_F, this)) + if (damageInfo->totalDamage && !IsPlayer() && !((Creature*)this)->GetCharmerOrOwnerGuid() && !pVictim->HasInArc(M_PI_F, this)) { // -probability is between 0% and 40% // 20% base chance @@ -1781,8 +1770,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) float Probability = 0.0f; //there is a newbie protection, at level 10 just 7% base chance; assuming linear function - if (pVictim->getLevel() < 30) - Probability = 0.65f * pVictim->getLevel() + 0.5f + ((float)AttackerMeleeSkill - (float)VictimDefense) * 0.2f; + if (pVictim->GetLevel() < 30) + Probability = 0.65f * pVictim->GetLevel() + 0.5f + ((float)AttackerMeleeSkill - (float)VictimDefense) * 0.2f; else Probability = 20.0f + ((float)AttackerMeleeSkill - (float)VictimDefense) * 0.2f; @@ -1801,11 +1790,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if (damageInfo->totalDamage) { SpellAuraHolderMap const& vAuras = pVictim->GetSpellAuraHolderMap(); - for (SpellAuraHolderMap::const_iterator itr = vAuras.begin(); itr != vAuras.end(); ++itr) + for (const auto& itr : vAuras) { - SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); - if (spellInfo->AttributesEx3 & 0x40000 && spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && ((*itr).second->GetCasterGuid() == GetObjectGuid())) - (*itr).second->RefreshHolder(); + SpellEntry const *spellInfo = itr.second->GetSpellProto(); + if (spellInfo->AttributesEx3 & 0x40000 && spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && (itr.second->GetCasterGuid() == GetObjectGuid())) + itr.second->RefreshHolder(); } } @@ -1813,7 +1802,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if (!(damageInfo->HitInfo & HITINFO_MISS) && damageInfo->TargetState != VICTIMSTATE_PARRY && damageInfo->TargetState != VICTIMSTATE_DODGE) { // on weapon hit casts - if (GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) + if (IsPlayer() && pVictim->IsAlive()) ((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType); // victim's damage shield @@ -1830,20 +1819,20 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) // Apply damage percentage modifiers (#1601) float DoneTotalMod = 1.0f; AuraList const& mModDamagePercentDone = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + for (const auto& j : mModDamagePercentDone) { - if (((*i)->GetModifier()->m_miscvalue & i_spellProto->GetSpellSchoolMask()) && - (*i)->GetSpellProto()->EquippedItemClass == -1 && - (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) + if ((j->GetModifier()->m_miscvalue & i_spellProto->GetSpellSchoolMask()) && + j->GetSpellProto()->EquippedItemClass == -1 && + j->GetSpellProto()->EquippedItemInventoryTypeMask == 0) { - DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; + DoneTotalMod *= (j->GetModifier()->m_amount + 100.0f) / 100.0f; } } damage *= DoneTotalMod; // apply SpellBaseDamageBonusTaken for mobs only // for example, Death Talon Seethers with Aura of Flames reflect 1200 damage to tanks with Mark of Flame - if (pVictim->GetTypeId() == TYPEID_UNIT) + if (pVictim->IsCreature()) { int32 spellDmgTakenBonus = this->SpellBaseDamageBonusTaken(i_spellProto->GetSpellSchoolMask()); // don't allow damage shields to be reduced by Blessing of Sanctuary, etc. @@ -1949,7 +1938,7 @@ static ResistanceValues resistValues[] = void Unit::CalculateDamageAbsorbAndResist(WorldObject* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, int32 *resist, SpellEntry const* spellProto, Spell* spell) { - if (!pCaster || !isAlive() || !damage) + if (!pCaster || !IsAlive() || !damage) return; if (spell) @@ -2089,7 +2078,7 @@ void Unit::CalculateDamageAbsorbAndResist(WorldObject* pCaster, SpellSchoolMask // Damage can be splitted only if aura has an alive caster Unit* reflectTo = (*i)->GetCaster(); - if (!reflectTo || reflectTo == this || !reflectTo->IsInWorld() || !reflectTo->isAlive()) + if (!reflectTo || reflectTo == this || !reflectTo->IsInWorld() || !reflectTo->IsAlive()) continue; int32 currentAbsorb; @@ -2126,8 +2115,8 @@ void Unit::CalculateDamageAbsorbAndResist(WorldObject* pCaster, SpellSchoolMask continue; // Damage can be splitted only if aura has an alive caster - Unit *caster = (*i)->GetCaster(); - if (!caster || caster == this || !caster->IsInWorld() || !caster->isAlive()) + Unit* caster = (*i)->GetCaster(); + if (!caster || caster == this || !caster->IsInWorld() || !caster->IsAlive()) continue; uint32 splitted = uint32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f); @@ -2176,9 +2165,9 @@ void Unit::CalculateAbsorbResistBlock(WorldObject* pCaster, SpellNonMeleeDamage damageInfo->damage = (damageInfo->damage <= malus ? 0 : (damageInfo->damage - malus)); } -void Unit::AttackerStateUpdate(Unit *pVictim, WeaponAttackType attType, bool checkLoS, bool extra) +void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool checkLoS, bool extra) { - if (!pVictim->isAlive()) + if (!pVictim->IsAlive()) return; if (!extra && IsNonMeleeSpellCasted(false)) @@ -2193,7 +2182,7 @@ void Unit::AttackerStateUpdate(Unit *pVictim, WeaponAttackType attType, bool che return; // ignore ranged case // Nostalrius: check ligne de vision - if (checkLoS && !hasUnitState(UNIT_STAT_ALLOW_LOS_ATTACK) && !IsWithinLOSInMap(pVictim)) + if (checkLoS && !HasUnitState(UNIT_STAT_ALLOW_LOS_ATTACK) && !IsWithinLOSInMap(pVictim)) return; if (GetExtraAttacks() && !extra) @@ -2223,7 +2212,7 @@ void Unit::AttackerStateUpdate(Unit *pVictim, WeaponAttackType attType, bool che DealMeleeDamage(&damageInfo, true); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.totalDamage, damageInfo.totalAbsorb, damageInfo.blocked_amount, damageInfo.totalResist); else @@ -2235,20 +2224,20 @@ void Unit::AttackerStateUpdate(Unit *pVictim, WeaponAttackType attType, bool che RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MELEE_ATTACK); } -MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType) const +MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackType attType) const { // This is only wrapper // Miss chance based on melee - float miss_chance = MeleeMissChanceCalc(pVictim, attType); + float const miss_chance = MeleeMissChanceCalc(pVictim, attType); // Critical hit chance - float crit_chance = GetUnitCriticalChance(attType, pVictim); + float const crit_chance = GetUnitCriticalChance(attType, pVictim); // stunned target cannot dodge and this is check in GetUnitDodgeChance() (returned 0 in this case) - float dodge_chance = pVictim->GetUnitDodgeChance(); - float block_chance = pVictim->GetUnitBlockChance(); - float parry_chance = pVictim->GetUnitParryChance(); + float const dodge_chance = pVictim->GetUnitDodgeChance(); + float const block_chance = pVictim->GetUnitBlockChance(); + float const parry_chance = pVictim->GetUnitParryChance(); // Useful if want to specify crit & miss chances for melee, else it could be removed //DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); @@ -2256,13 +2245,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT return RollMeleeOutcomeAgainst(pVictim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100), false); } -MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted) const +MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted) const { // Nostalrius : cheat. if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_ALWAYS_CRIT)) return MELEE_HIT_CRIT; - if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + if (pVictim->IsCreature() && ((Creature*)pVictim)->IsInEvadeMode()) return MELEE_HIT_EVADE; int32 attackerMaxSkillValueForLevel = GetSkillMaxForLevel(pVictim); @@ -2292,7 +2281,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT } // always crit against a sitting target (except 0 crit chance) - if (pVictim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !pVictim->IsStandingUp()) + if (pVictim->IsPlayer() && crit_chance > 0 && !pVictim->IsStandingUp()) { DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); return MELEE_HIT_CRIT; @@ -2306,13 +2295,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT // Dodge chance // only players can't dodge if attacker is behind - if (pVictim->GetTypeId() != TYPEID_PLAYER || !from_behind) + if (!pVictim->IsPlayer() || !from_behind) { dodge_chance -= dodgeSkillBonus; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - dodge_chance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + dodge_chance *= pVictim->GetLevel() / 10.0f; if (dodge_chance > 0 && // check if unit _can_ dodge (roll < (sum += dodge_chance))) @@ -2326,13 +2315,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT // check if attack comes from behind, nobody can parry or block if attacker is behind if (!from_behind) { - if (parry_chance > 0 && (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))) + if (parry_chance > 0 && (pVictim->IsPlayer() || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))) { parry_chance -= parrySkillBonus; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - parry_chance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + parry_chance *= pVictim->GetLevel() / 10.0f; if (parry_chance > 0 && // check if unit _can_ parry (roll < (sum += parry_chance))) @@ -2345,8 +2334,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon) if (attType != RANGED_ATTACK && !SpellCasted && - (GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->IsPet()) && - pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->IsPet() && !((Creature*)pVictim)->IsTotem()) + (IsPlayer() || ((Creature*)this)->IsPet()) && + !pVictim->IsPlayer() && !((Creature*)pVictim)->IsPet() && !((Creature*)pVictim)->IsTotem()) { // cap possible value (with bonuses > max skill) int32 skill = attackerWeaponSkill; @@ -2375,8 +2364,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT // check if attack comes from behind, nobody can parry or block if attacker is behind if (!from_behind) { - if ((pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) - && !(GetTypeId() == TYPEID_UNIT && GetMeleeDamageSchoolMask() != SPELL_SCHOOL_MASK_NORMAL)) // can't block elemental melee attacks from mobs + if ((pVictim->IsPlayer() || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) + && !(IsCreature() && GetMeleeDamageSchoolMask() != SPELL_SCHOOL_MASK_NORMAL)) // can't block elemental melee attacks from mobs { block_chance -= blockSkillBonus; @@ -2385,15 +2374,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT block_chance = 500; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - block_chance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + block_chance *= pVictim->GetLevel() / 10.0f; if (block_chance > 0 && // check if unit _can_ block (roll < (sum += block_chance))) { // Critical chance tmp = crit_chance; - if (GetTypeId() == TYPEID_PLAYER && SpellCasted && tmp > 0) + if (IsPlayer() && SpellCasted && tmp > 0) { if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || (pVictim->IsPlayer() && pVictim->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) @@ -2419,7 +2408,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT return MELEE_HIT_CRIT; } - if ((GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->IsPet()) && + if ((!IsPlayer() && !IsPet()) && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) && !SpellCasted /*Only autoattack can be crashing blow*/) { @@ -2455,15 +2444,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT return MELEE_HIT_NORMAL; } -uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, uint8 index) +uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, uint8 index) const { float min_damage, max_damage; - if (GetTypeId() != TYPEID_PLAYER && index != 0) + if (!IsPlayer() && index != 0) return 0; - if ((normalized || index != 0) && GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->CalculateMinMaxDamage(attType, normalized, min_damage, max_damage, index); + if ((normalized || index != 0) && IsPlayer()) + static_cast(this)->CalculateMinMaxDamage(attType, normalized, min_damage, max_damage, index); else { switch (attType) @@ -2500,7 +2489,7 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, uint8 in return urand((uint32)min_damage, (uint32)max_damage); } -void Unit::SendMeleeAttackStart(Unit* pVictim) +void Unit::SendMeleeAttackStart(Unit* pVictim) const { WorldPacket data(SMSG_ATTACKSTART, 8 + 8); data << GetObjectGuid(); @@ -2510,28 +2499,25 @@ void Unit::SendMeleeAttackStart(Unit* pVictim) DEBUG_LOG("WORLD: Sent SMSG_ATTACKSTART"); } -void Unit::SendMeleeAttackStop(Unit* victim) +void Unit::SendMeleeAttackStop(Unit* pVictim) const { - if (!victim) + if (!pVictim) return; WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4)); // guess size, max is 9+9+4 #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 data << GetPackGUID(); - data << victim->GetPackGUID(); // can be 0x00... + data << pVictim->GetPackGUID(); // can be 0x00... #else data << GetGUID(); - data << victim->GetGUID(); // can be 0x00... + data << pVictim->GetGUID(); // can be 0x00... #endif data << uint32(0); // can be 0x1 SendObjectMessageToSet(&data, true); - DETAIL_FILTER_LOG(LOG_FILTER_COMBAT, "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); - - /*if(victim->GetTypeId() == TYPEID_UNIT) - ((Creature*)victim)->AI().EnterEvadeMode(this);*/ + DETAIL_FILTER_LOG(LOG_FILTER_COMBAT, "%s %u stopped attacking %s %u", (IsPlayer() ? "player" : "creature"), GetGUIDLow(), (pVictim->IsPlayer() ? "player" : "creature"), pVictim->GetGUIDLow()); } -bool Unit::IsSpellBlocked(WorldObject* pCaster, Unit *pVictim, SpellEntry const *spellEntry, WeaponAttackType attackType) +bool Unit::IsSpellBlocked(WorldObject* pCaster, Unit* pVictim, SpellEntry const* spellEntry, WeaponAttackType attackType) const { if (!HasInArc(M_PI_F, pCaster)) return false; @@ -2544,9 +2530,9 @@ bool Unit::IsSpellBlocked(WorldObject* pCaster, Unit *pVictim, SpellEntry const } // Check creatures flags_extra for disable block - if (GetTypeId() == TYPEID_UNIT) + if (Creature const* pCreature = ToCreature()) { - if (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) + if (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) return false; } @@ -2560,12 +2546,13 @@ bool Unit::IsSpellBlocked(WorldObject* pCaster, Unit *pVictim, SpellEntry const blockChance = 5.0f; // Low level reduction - if (!pVictim->IsPlayer() && pVictim->getLevel() < 10) - blockChance *= pVictim->getLevel() / 10.0f; + if (!pVictim->IsPlayer() && pVictim->GetLevel() < 10) + blockChance *= pVictim->GetLevel() / 10.0f; if ((IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE)) || (blockChance < 0) || (pCaster->IsPlayer() && pCaster->ToPlayer()->HasOption(PLAYER_CHEAT_UNRANDOMIZE))) blockChance = 0; + return roll_chance_f(blockChance); } @@ -2635,7 +2622,7 @@ float Unit::RollMagicResistanceMultiplierOutcomeAgainst(float resistanceChance, return resistCnt; } -bool Unit::IsEffectResist(SpellEntry const* spell, int eff) +bool Unit::IsEffectResist(SpellEntry const* spell, int eff) const { // Chance resist mechanic int32 effect_mech = spell->EffectMechanic[eff]; @@ -2649,7 +2636,7 @@ bool Unit::IsEffectResist(SpellEntry const* spell, int eff) return false; } -float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) const +float Unit::MeleeMissChanceCalc(Unit const* pVictim, WeaponAttackType attType) const { if (!pVictim || !pVictim->IsStandingUp()) return 0.0f; @@ -2658,7 +2645,7 @@ float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) c float missChance = 5.0f; // DualWield - white damage has an additional 19% miss penalty - if (haveOffhandWeapon() && attType != RANGED_ATTACK) + if (HaveOffhandWeapon() && attType != RANGED_ATTACK) { bool isNormal = false; for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) @@ -2676,7 +2663,7 @@ float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) c int32 skillDiff = int32(GetWeaponSkillValue(attType, pVictim)) - int32(pVictim->GetDefenseSkillValue(this)); float skillDiffBonus = 0.0f; // PvP - PvE melee chances - if (pVictim->GetTypeId() == TYPEID_PLAYER) + if (pVictim->IsPlayer()) skillDiffBonus = skillDiff * 0.04f; else if (skillDiff < -10) skillDiffBonus = skillDiff * 0.2f; @@ -2685,7 +2672,7 @@ float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) c missChance -= skillDiffBonus; // Low level reduction - float const levelDiffMultiplier = !pVictim->IsPlayer() && pVictim->getLevel() < 10 ? pVictim->getLevel() / 10.0f : 1.0f; + float const levelDiffMultiplier = !pVictim->IsPlayer() && pVictim->GetLevel() < 10 ? pVictim->GetLevel() / 10.0f : 1.0f; missChance *= levelDiffMultiplier; // Hit chance bonus from attacker based on ratings and auras @@ -2733,9 +2720,9 @@ float Unit::MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) c float Unit::GetUnitDodgeChance() const { - if (IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) return 0.0f; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return GetFloatValue(PLAYER_DODGE_PERCENTAGE); else { @@ -2752,25 +2739,24 @@ float Unit::GetUnitDodgeChance() const float Unit::GetUnitParryChance() const { - if (IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) return 0.0f; float chance = 0.0f; - if (GetTypeId() == TYPEID_PLAYER) + if (Player const* pPlayer = ToPlayer()) { - Player const* player = (Player const*)this; - if (player->CanParry()) + if (pPlayer->CanParry()) { - Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true, true); + Item* tmpitem = pPlayer->GetWeaponForAttack(BASE_ATTACK, true, true); if (!tmpitem) - tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true, true); + tmpitem = pPlayer->GetWeaponForAttack(OFF_ATTACK, true, true); if (tmpitem) chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE); } } - else if (GetTypeId() == TYPEID_UNIT) + else { // Can't really know for sure, but Totems probably shouldn't parry. // They are inanimate objects, have no arms nor weapons, and cannot move. @@ -2786,15 +2772,14 @@ float Unit::GetUnitParryChance() const float Unit::GetUnitBlockChance() const { - if (IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) return 0.0f; - if (GetTypeId() == TYPEID_PLAYER) + if (Player const* pPlayer = ToPlayer()) { - Player const* player = (Player const*)this; - if (player->CanBlock() && player->CanUseEquippedWeapon(OFF_ATTACK)) + if (pPlayer->CanBlock() && pPlayer->CanUseEquippedWeapon(OFF_ATTACK)) { - Item* tmpitem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* tmpitem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); } @@ -2814,11 +2799,11 @@ float Unit::GetUnitBlockChance() const } } -float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* pVictim) const +float Unit::GetUnitCriticalChance(WeaponAttackType attackType, Unit const* pVictim) const { float crit; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { switch (attackType) { @@ -2926,7 +2911,7 @@ void Unit::_UpdateSpells(uint32 time) void Unit::_UpdateAutoRepeatSpell() { //check "realtime" interrupts - if ((GetTypeId() == TYPEID_PLAYER && ((Player*)this)->IsMoving()) || IsNonMeleeSpellCasted(false, false, true)) + if ((IsPlayer() && ((Player*)this)->IsMoving()) || IsNonMeleeSpellCasted(false, false, true)) { // cancel wand shoot if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Category == 351) @@ -2936,12 +2921,12 @@ void Unit::_UpdateAutoRepeatSpell() } //apply delay - if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500) - setAttackTimer(RANGED_ATTACK, 500); + if (m_AutoRepeatFirstCast && GetAttackTimer(RANGED_ATTACK) < 500) + SetAttackTimer(RANGED_ATTACK, 500); m_AutoRepeatFirstCast = false; //castroutine - if (isAttackReady(RANGED_ATTACK)) + if (IsAttackReady(RANGED_ATTACK)) { // Check if able to cast // We need to update pointers before calling CheckCast ! @@ -2961,7 +2946,7 @@ void Unit::_UpdateAutoRepeatSpell() spell->prepare(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets); // all went good, reset attack - resetAttackTimer(RANGED_ATTACK); + ResetAttackTimer(RANGED_ATTACK); SetStandState(UNIT_STAND_STATE_STAND); } } @@ -2997,9 +2982,9 @@ bool Unit::IsBehindTarget(Unit const* pTarget, bool strict) const if (Creature const* pCreature = pTarget->ToCreature()) { // Mobs always face their currect victim, unless incapacitated. - if (!pCreature->m_castingTargetGuid && (pCreature->getVictim() == this) && + 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_STAT_CAN_NOT_REACT_OR_LOST_CONTROL)) return false; } } @@ -3007,7 +2992,7 @@ bool Unit::IsBehindTarget(Unit const* pTarget, bool strict) const return !pTarget->HasInArc(M_PI_F, this); } -bool Unit::isInAccessablePlaceFor(Creature const* c) const +bool Unit::IsInAccessablePlaceFor(Creature const* c) const { if (IsInWater()) return c->CanSwim(); @@ -3040,12 +3025,12 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const int32 modifier = 0; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + for (const auto& i : mTotalAuraList) { // Exception for stealth detection, remove hidden trap detection (id:2836) from stealth modifier (should not be taken into account) // If it was the cast, rogue will see others rogue at 40 meters - if ((*i)->GetId() != 2836) - modifier += (*i)->GetModifier()->m_amount; + if (i->GetId() != 2836) + modifier += i->GetModifier()->m_amount; } @@ -3057,8 +3042,8 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - multiplier *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; + for (const auto& i : mTotalAuraList) + multiplier *= (100.0f + i->GetModifier()->m_amount) / 100.0f; return multiplier; } @@ -3068,9 +3053,9 @@ int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const int32 modifier = 0; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - if ((*i)->GetModifier()->m_amount > modifier) - modifier = (*i)->GetModifier()->m_amount; + for (const auto& i : mTotalAuraList) + if (i->GetModifier()->m_amount > modifier) + modifier = i->GetModifier()->m_amount; return modifier; } @@ -3080,9 +3065,9 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const int32 modifier = 0; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - if ((*i)->GetModifier()->m_amount < modifier) - modifier = (*i)->GetModifier()->m_amount; + for (const auto& i : mTotalAuraList) + if (i->GetModifier()->m_amount < modifier) + modifier = i->GetModifier()->m_amount; return modifier; } @@ -3095,9 +3080,9 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) int32 modifier = 0; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + for (const auto& i : mTotalAuraList) { - Modifier* mod = (*i)->GetModifier(); + Modifier* mod = i->GetModifier(); if (mod->m_miscvalue & misc_mask) modifier += mod->m_amount; } @@ -3112,59 +3097,23 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + for (const auto& i : mTotalAuraList) { - Modifier* mod = (*i)->GetModifier(); + Modifier* mod = i->GetModifier(); if (mod->m_miscvalue & misc_mask) multiplier *= (100.0f + mod->m_amount) / 100.0f; } return multiplier; } -int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const -{ - if (!misc_mask) - return 0; - - int32 modifier = 0; - - AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue & misc_mask && mod->m_amount > modifier) - modifier = mod->m_amount; - } - - return modifier; -} - -int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const -{ - if (!misc_mask) - return 0; - - int32 modifier = 0; - - AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue & misc_mask && mod->m_amount < modifier) - modifier = mod->m_amount; - } - - return modifier; -} - int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const { int32 modifier = 0; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + for (const auto& i : mTotalAuraList) { - Modifier* mod = (*i)->GetModifier(); + Modifier* mod = i->GetModifier(); if (mod->m_miscvalue == misc_value) modifier += mod->m_amount; } @@ -3176,53 +3125,23 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + for (const auto& i : mTotalAuraList) { - Modifier* mod = (*i)->GetModifier(); + Modifier* mod = i->GetModifier(); if (mod->m_miscvalue == misc_value) multiplier *= (100.0f + mod->m_amount) / 100.0f; } return multiplier; } -int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const -{ - int32 modifier = 0; - - AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue == misc_value && mod->m_amount > modifier) - modifier = mod->m_amount; - } - - return modifier; -} - -int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const -{ - int32 modifier = 0; - - AuraList const& mTotalAuraList = GetAurasByType(auratype); - for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - Modifier* mod = (*i)->GetModifier(); - if (mod->m_miscvalue == misc_value && mod->m_amount < modifier) - modifier = mod->m_amount; - } - - return modifier; -} - bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) { SpellEntry const* aurSpellInfo = holder->GetSpellProto(); // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - if (!isAlive() && !aurSpellInfo->IsDeathPersistentSpell() && + if (!IsAlive() && !aurSpellInfo->IsDeathPersistentSpell() && !aurSpellInfo->IsDeathOnlySpell() && - (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading())) + (!IsPlayer() || !((Player*)this)->GetSession()->PlayerLoading())) { delete holder; return false; @@ -3231,8 +3150,8 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) if (holder->GetTarget() != this) { sLog.outError("Holder (spell %u) add to spell aura holder list of %s (lowguid: %u) but spell aura holder target is %s (lowguid: %u)", - holder->GetId(), (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), - (holder->GetTarget()->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), holder->GetTarget()->GetGUIDLow()); + holder->GetId(), (IsPlayer() ? "player" : "creature"), GetGUIDLow(), + (holder->GetTarget()->IsPlayer() ? "player" : "creature"), holder->GetTarget()->GetGUIDLow()); delete holder; return false; } @@ -3414,9 +3333,9 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) uint32 Unit::GetNegativeAurasCount() { uint32 count = 0; - for (SpellAuraHolderMap::const_iterator i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); ++i) + for (const auto& i : m_spellAuraHolders) { - if (!i->second || !i->second->IsAffectedByDebuffLimit()) + if (!i.second || !i.second->IsAffectedByDebuffLimit()) continue; ++count; @@ -3450,32 +3369,6 @@ void Unit::AddAuraToModList(Aura *aura) m_modAuras[aura->GetModifier()->m_auraname].push_back(aura); } -void Unit::RemoveRankAurasDueToSpell(uint32 spellId) -{ - SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(spellId); - if (!spellInfo) - return; - SpellAuraHolderMap::const_iterator i, next; - for (i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); i = next) - { - next = i; - ++next; - uint32 i_spellId = (*i).second->GetId(); - if ((*i).second && i_spellId && i_spellId != spellId) - { - if (sSpellMgr.IsRankSpellDueToSpell(spellInfo, i_spellId)) - { - RemoveAurasDueToSpell(i_spellId); - - if (m_spellAuraHolders.empty()) - break; - else - next = m_spellAuraHolders.begin(); - } - } - } -} - bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder) { if (!holder) @@ -3717,8 +3610,8 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder) // Sorts moins puissants : std::list lessPowerfullSpells; if (sSpellMgr.ListLessPowerfullSpells(spellId, lessPowerfullSpells)) - for (std::list::const_iterator it = lessPowerfullSpells.begin(); it != lessPowerfullSpells.end(); ++it) - RemoveAurasDueToSpell(*it); + for (const auto& it : lessPowerfullSpells) + RemoveAurasDueToSpell(it); return true; } @@ -3777,51 +3670,6 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount RemoveAuraHolderFromStack(spellId, stackAmount, casterGuid, AURA_REMOVE_BY_DISPEL); } -void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit *stealer) -{ - SpellAuraHolder *holder = GetSpellAuraHolder(spellId, casterGuid); - SpellEntry const* spellProto = sSpellMgr.GetSpellEntry(spellId); - SpellAuraHolder *new_holder = CreateSpellAuraHolder(spellProto, stealer, this, this); - - // set its duration and maximum duration - // max duration 2 minutes (in msecs) - int32 dur = holder->GetAuraDuration(); - int32 max_dur = 2 * MINUTE * IN_MILLISECONDS; - int32 new_max_dur = max_dur > dur ? dur : max_dur; - new_holder->SetAuraMaxDuration(new_max_dur); - new_holder->SetAuraDuration(new_max_dur); - - for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - { - Aura *aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i)); - - if (!aur) - continue; - - int32 basePoints = aur->GetBasePoints(); - // construct the new aura for the attacker - will never return nullptr, it's just a wrapper for - // some different constructors - Aura * new_aur = CreateAura(aur->GetSpellProto(), aur->GetEffIndex(), &basePoints, new_holder, stealer, this); - - // set periodic to do at least one tick (for case when original aura has been at last tick preparing) - int32 periodic = aur->GetModifier()->periodictime; - new_aur->GetModifier()->periodictime = periodic < new_max_dur ? periodic : new_max_dur; - - // add the new aura to stealer - new_holder->AddAura(new_aur, new_aur->GetEffIndex()); - } - - if (holder->ModStackAmount(-1)) - // Remove aura as dispel - RemoveSpellAuraHolder(holder, AURA_REMOVE_BY_DISPEL); - - // strange but intended behaviour: Stolen single target auras won't be treated as single targeted - new_holder->SetIsSingleTarget(false); - - if (!stealer->AddSpellAuraHolder(new_holder)) - new_holder = nullptr; -} - void Unit::RemoveAurasDueToSpellByCancel(uint32 spellId) { SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId); @@ -4001,7 +3849,7 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode) WorldObject* caster = holder->GetRealCaster(); bool isChanneled = holder->IsChanneled(); // cache for after the holder is deleted if (isChanneled && caster) - if (caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType() == TOTEM_STATUE) + if (caster->IsCreature() && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType() == TOTEM_STATUE) statue = ((Totem*)caster); if (m_spellAuraHoldersUpdateIterator != m_spellAuraHolders.end() && m_spellAuraHoldersUpdateIterator->second == holder) @@ -4207,14 +4055,14 @@ void Unit::DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid cast void Unit::_RemoveAllAuraMods() { - for (SpellAuraHolderMap::const_iterator i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); ++i) - (*i).second->ApplyAuraModifiers(false); + for (const auto& i : m_spellAuraHolders) + i.second->ApplyAuraModifiers(false); } void Unit::_ApplyAllAuraMods() { - for (SpellAuraHolderMap::const_iterator i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); ++i) - (*i).second->ApplyAuraModifiers(true); + for (const auto& i : m_spellAuraHolders) + i.second->ApplyAuraModifiers(true); } bool Unit::HasAuraType(AuraType auraType) const @@ -4222,19 +4070,6 @@ bool Unit::HasAuraType(AuraType auraType) const return !GetAurasByType(auraType).empty(); } -bool Unit::HasAffectedAura(AuraType auraType, SpellEntry const* spellProto) const -{ - Unit::AuraList const& auras = GetAurasByType(auraType); - - for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - if ((*itr)->isAffectedOnSpell(spellProto)) - return true; - } - - return false; -} - Aura* Unit::GetAura(uint32 spellId, SpellEffectIndex effindex) { SpellAuraHolderBounds bounds = GetSpellAuraHolderBounds(spellId); @@ -4246,10 +4081,10 @@ Aura* Unit::GetAura(uint32 spellId, SpellEffectIndex effindex) Aura* Unit::GetAura(AuraType type, SpellFamily family, uint64 familyFlag, ObjectGuid casterGuid) { AuraList const& auras = GetAurasByType(type); - for (AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) - if ((*i)->GetSpellProto()->IsFitToFamily(family, familyFlag) && - (!casterGuid || (*i)->GetCasterGuid() == casterGuid)) - return *i; + for (const auto& i : auras) + if (i->GetSpellProto()->IsFitToFamily(family, familyFlag) && + (!casterGuid || i->GetCasterGuid() == casterGuid)) + return i; return nullptr; } @@ -4266,55 +4101,63 @@ bool Unit::HasAura(uint32 spellId, SpellEffectIndex effIndex) const GameObject* Unit::GetGameObject(uint32 spellId) const { - for (GameObjectList::const_iterator i = m_gameObj.begin(); i != m_gameObj.end(); ++i) - if ((*i)->GetSpellId() == spellId) - return *i; + for (const auto& i : m_gameObj) + if (i->GetSpellId() == spellId) + return i; return nullptr; } -void Unit::AddGameObject(GameObject* gameObj) +void Unit::AddGameObject(GameObject* pGo) { - MANGOS_ASSERT(gameObj && !gameObj->GetOwnerGuid()); - m_gameObj.push_back(gameObj); - gameObj->SetOwnerGuid(GetObjectGuid()); - gameObj->SetWorldMask(GetWorldMask()); + MANGOS_ASSERT(pGo && !pGo->GetOwnerGuid()); + m_gameObj.push_back(pGo); + pGo->SetOwnerGuid(GetObjectGuid()); + pGo->SetWorldMask(GetWorldMask()); - if (GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId()) + if (pGo->GetSpellId()) { - SpellEntry const* createBySpell = sSpellMgr.GetSpellEntry(gameObj->GetSpellId()); - // Need disable spell use for owner - if (createBySpell && createBySpell->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) - // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) - ((Player*)this)->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true); + if (Player* pPlayer = ToPlayer()) + { + if (SpellEntry const* pCreateBySpell = sSpellMgr.GetSpellEntry(pGo->GetSpellId())) + { + // Need disable spell use for owner + if (pCreateBySpell->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) + // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) + pPlayer->AddSpellAndCategoryCooldowns(pCreateBySpell, 0, nullptr, true); + } + } } } -void Unit::RemoveGameObject(GameObject* gameObj, bool del) +void Unit::RemoveGameObject(GameObject* pGo, bool del) { - MANGOS_ASSERT(gameObj && gameObj->GetOwnerGuid() == GetObjectGuid()); + MANGOS_ASSERT(pGo && pGo->GetOwnerGuid() == GetObjectGuid()); - gameObj->SetOwnerGuid(ObjectGuid()); + pGo->SetOwnerGuid(ObjectGuid()); // GO created by some spell - if (uint32 spellid = gameObj->GetSpellId()) + if (uint32 spellid = pGo->GetSpellId()) { RemoveAurasDueToSpell(spellid); - SpellEntry const* createBySpell = sSpellMgr.GetSpellEntry(spellid); - // Need activate spell use for owner, for summoning rituals it happens at ritual success - if (createBySpell && createBySpell->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE && - gameObj->GetGoType() != GAMEOBJECT_TYPE_SUMMONING_RITUAL) - // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) - CooldownEvent(createBySpell); + if (SpellEntry const* pCreateBySpell = sSpellMgr.GetSpellEntry(spellid)) + { + // Need activate spell use for owner, for summoning rituals it happens at ritual success + if (pCreateBySpell->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE) && + pGo->GetGoType() != GAMEOBJECT_TYPE_SUMMONING_RITUAL) + // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) + CooldownEvent(pCreateBySpell); + } + } - m_gameObj.remove(gameObj); + m_gameObj.remove(pGo); if (del) { - gameObj->SetRespawnTime(0); - gameObj->Delete(); + pGo->SetRespawnTime(0); + pGo->Delete(); } } @@ -4354,7 +4197,7 @@ void Unit::RemoveAllGameObjects() } } -void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo, AuraType auraTypeOverride) +void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo, AuraType auraTypeOverride) const { Aura *aura = pInfo->aura; Modifier *mod = aura->GetModifier(); @@ -4422,7 +4265,7 @@ public: typedef std::list RemoveSpellList; -void Unit::HandleTriggers(Unit *pVictim, uint32 procExtra, uint32 amount, SpellEntry const *procSpell, ProcTriggeredList const& procTriggered) +void Unit::HandleTriggers(Unit* pVictim, uint32 procExtra, uint32 amount, SpellEntry const* procSpell, ProcTriggeredList const& procTriggered) { RemoveSpellList removedSpells; // Nothing found @@ -4430,21 +4273,21 @@ void Unit::HandleTriggers(Unit *pVictim, uint32 procExtra, uint32 amount, SpellE return; // Handle effects proceed this time - for (ProcTriggeredList::const_iterator itr = procTriggered.begin(); itr != procTriggered.end(); ++itr) + for (const auto& itr : procTriggered) { // Some auras can be deleted in function called in this loop (except first, ofc) - SpellAuraHolder *triggeredByHolder = itr->triggeredByHolder; + SpellAuraHolder *triggeredByHolder = itr.triggeredByHolder; if (triggeredByHolder->IsDeleted()) { triggeredByHolder->SetInUse(false); continue; } - SpellProcEventEntry const *spellProcEvent = itr->spellProcEvent; + SpellProcEventEntry const *spellProcEvent = itr.spellProcEvent; bool useCharges = triggeredByHolder->GetAuraCharges() > 0; bool procSuccess = true; bool anyAuraProc = false; - Unit* caster = itr->target == this ? pVictim : this; + Unit* caster = itr.target == this ? pVictim : this; if (!caster || !caster->IsInWorld()) { @@ -4482,10 +4325,10 @@ void Unit::HandleTriggers(Unit *pVictim, uint32 procExtra, uint32 amount, SpellE } // Spells that require target to be below 20%, like Deadly Swiftness (31255). - if ((triggeredByAura->GetSpellProto()->TargetAuraState == AURA_STATE_HEALTHLESS_20_PERCENT) && (!itr->target || !itr->target->HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))) + if ((triggeredByAura->GetSpellProto()->TargetAuraState == AURA_STATE_HEALTHLESS_20_PERCENT) && (!itr.target || !itr.target->HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))) continue; - SpellAuraProcResult procResult = (*caster.*AuraProcHandler[auraModifier->m_auraname])(itr->target, amount, triggeredByAura, procSpell, itr->procFlag, procExtra, cooldown); + SpellAuraProcResult procResult = (*caster.*AuraProcHandler[auraModifier->m_auraname])(itr.target, amount, triggeredByAura, procSpell, itr.procFlag, procExtra, cooldown); switch (procResult) { case SPELL_AURA_PROC_CANT_TRIGGER: @@ -4516,12 +4359,12 @@ void Unit::HandleTriggers(Unit *pVictim, uint32 procExtra, uint32 amount, SpellE removedSpells.sort(); removedSpells.unique(); // Remove auras from removedAuras - for (RemoveSpellList::iterator i = removedSpells.begin(); i != removedSpells.end(); ++i) - i->unit->RemoveAurasDueToSpell(i->spellId); + for (const auto& i : removedSpells) + i.unit->RemoveAurasDueToSpell(i.spellId); } } -void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) +void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) const { DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); @@ -4559,11 +4402,11 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) SendMessageToSet(&data, true); } -void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 /*SwingType*/, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, int32 Resist, VictimState TargetState, uint32 BlockedAmount) +void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType*/, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, int32 Resist, VictimState TargetState, uint32 BlockedAmount) const { CalcDamageInfo dmgInfo; dmgInfo.HitInfo = HitInfo; - dmgInfo.attacker = this; + dmgInfo.attacker = const_cast(this); dmgInfo.target = target; dmgInfo.attackType = BASE_ATTACK; dmgInfo.totalDamage = Damage; @@ -4582,11 +4425,11 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 /*SwingType void Unit::SetInitCreaturePowerType() { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return; - auto pCreature = static_cast(this); - auto pPet = pCreature->ToPet(); + Creature* pCreature = static_cast(this); + Pet* pPet = pCreature->ToPet(); if (pPet && pPet->getPetType() == HUNTER_PET) return; @@ -4596,7 +4439,7 @@ void Unit::SetInitCreaturePowerType() SetByteValue(UNIT_FIELD_BYTES_0, 3, POWER_MANA); else { - switch (getClass()) + switch (GetClass()) { case CLASS_ROGUE: SetByteValue(UNIT_FIELD_BYTES_0, 3, POWER_ENERGY); @@ -4612,23 +4455,22 @@ void Unit::SetInitCreaturePowerType() } } -void Unit::setPowerType(Powers new_powertype) +void Unit::SetPowerType(Powers new_powertype) { SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE); } } @@ -4692,7 +4534,7 @@ bool Unit::IsNeutralToAll() const return my_faction->IsNeutralToAll(); } -bool Unit::Attack(Unit *victim, bool meleeAttack) +bool Unit::Attack(Unit* victim, bool meleeAttack) { if (!victim || victim == this) return false; @@ -4702,7 +4544,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) return false; // dead units can neither attack nor be attacked - if (!isAlive() || !victim->IsInWorld() || !victim->isAlive()) + if (!IsAlive() || !victim->IsInWorld() || !victim->IsAlive()) return false; // player cannot attack in mount state @@ -4713,7 +4555,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) return false; // nobody can attack GM in GM-mode - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { if (((Player*)victim)->IsGameMaster()) return false; @@ -4734,9 +4576,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_STAT_MELEE_ATTACKING)) { - addUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STAT_MELEE_ATTACKING); SendMeleeAttackStart(victim); return true; } @@ -4751,24 +4593,24 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) SetTargetGuid(victim->GetObjectGuid()); if (meleeAttack) - addUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STAT_MELEE_ATTACKING); m_attacking = victim; m_attacking->_addAttacker(this); - if (GetTypeId() == TYPEID_UNIT) // && !((Creature*)this)->GetLinkGroup()) + if (Creature* pCreature = ToCreature()) // && !((Creature*)this)->GetLinkGroup()) { - ((Creature*)this)->SendAIReaction(AI_REACTION_HOSTILE); - ((Creature*)this)->CallAssistance(); + pCreature->SendAIReaction(AI_REACTION_HOSTILE); + pCreature->CallAssistance(); if (Pet* pet = GetPet()) - if (pet->isAlive()) + if (pet->IsAlive()) pet->AI()->OwnerAttacked(victim); } // delay offhand weapon attack to next attack time - if (haveOffhandWeapon()) - resetAttackTimer(OFF_ATTACK); + if (HaveOffhandWeapon()) + ResetAttackTimer(OFF_ATTACK); if (meleeAttack) SendMeleeAttackStart(victim); @@ -4779,20 +4621,19 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) void Unit::AttackedBy(Unit* attacker) { if (Pet* pet = GetPet()) - if (pet->isAlive()) + if (pet->IsAlive()) pet->AI()->OwnerAttackedBy(attacker); - if (!IsCreature()) - return; + if (Creature* pCreature = ToCreature()) + { + // trigger AI reaction + if (pCreature->AI()) + pCreature->AI()->AttackedBy(attacker); - // trigger AI reaction - if (((Creature*)this)->AI()) - ((Creature*)this)->AI()->AttackedBy(attacker); - - // trigger owner AI reaction - if(Unit* owner = GetCharmerOrOwner()) - if (owner->IsCreature() && ((Creature*)owner)->AI()){ - ((Creature*)owner)->AI()->AttackedBy(attacker); + // trigger owner AI reaction + if (Creature* pOwner = ::ToCreature(GetCharmerOrOwner())) + if (pOwner->AI()) + pOwner->AI()->AttackedBy(attacker); } } @@ -4809,7 +4650,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/) // Clear our target SetTargetGuid(ObjectGuid()); - clearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STAT_MELEE_ATTACKING); InterruptSpell(CURRENT_MELEE_SPELL); @@ -4840,7 +4681,7 @@ void Unit::CombatStop(bool includingCast) AttackStop(); RemoveAllAttackers(); - if (AI() && isInCombat()) + if (AI() && IsInCombat()) AI()->OnCombatStop(); if (Player* pPlayer = ToPlayer()) @@ -4893,16 +4734,16 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1))) { SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { const PlayerSpellMap& sp_list = ((Player*)this)->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) + for (const auto& itr : sp_list) { - if (itr->second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(itr->first); + if (itr.second.state == PLAYERSPELL_REMOVED) continue; + SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(itr.first); if (!spellInfo || !spellInfo->IsPassiveSpell()) continue; if (AuraState(spellInfo->CasterAuraState) == flag) - CastSpell(this, itr->first, true, nullptr); + CastSpell(this, itr.first, true, nullptr); } } else @@ -4940,7 +4781,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) } } - if (GetTypeId() == TYPEID_UNIT) + if (IsCreature()) { switch (flag) { @@ -4955,14 +4796,14 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) } } -Unit *Unit::GetOwner() const +Unit* Unit::GetOwner() const { if (ObjectGuid ownerid = GetOwnerGuid()) return ObjectAccessor::GetUnit(*this, ownerid); return nullptr; } -Unit *Unit::GetCharmer() const +Unit* Unit::GetCharmer() const { if (ObjectGuid charmerid = GetCharmerGuid()) return ObjectAccessor::GetUnit(*this, charmerid); @@ -4980,7 +4821,7 @@ Player* Unit::GetPossessor() const bool Unit::IsCharmerOrOwnerPlayerOrPlayerItself() const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return true; return GetCharmerOrOwnerGuid().IsPlayer(); @@ -4992,7 +4833,7 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const if (guid.IsPlayer()) return ObjectAccessor::FindPlayer(guid); - return GetTypeId() == TYPEID_PLAYER ? (Player*)this : nullptr; + return IsPlayer() ? (Player*)this : nullptr; } Player* Unit::GetAffectingPlayer() const @@ -5071,16 +4912,16 @@ void Unit::SetCharm(Unit* pet) void Unit::RestoreFaction() { - if (GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->SetFactionForRace(getRace()); + if (Player* pPlayer = ToPlayer()) + pPlayer->SetFactionForRace(GetRace()); else { if (CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo()) // normal creature - setFaction(cinfo->faction); + SetFactionTemplateId(cinfo->faction); } } -bool Unit::canAttack(Unit const* target, bool force) const +bool Unit::CanAttack(Unit const* target, bool force) const { ASSERT(target); @@ -5089,12 +4930,12 @@ bool Unit::canAttack(Unit const* target, bool force) const if (IsFriendlyTo(target)) return false; - if (GetTypeId() != TYPEID_PLAYER) + if (IsCreature()) { - if (((Creature*)this)->IsPet()) + if (IsPet()) { - if (Unit *owner = GetOwner()) - if (!(owner->canAttack(target))) + if (Unit* pOwner = GetOwner()) + if (!(pOwner->CanAttack(target))) return false; } else if (!IsHostileTo(target)) @@ -5104,12 +4945,12 @@ bool Unit::canAttack(Unit const* target, bool force) const else if (!IsHostileTo(target)) return false; - if (!target->isAttackableByAOE(false, IsPlayer()) || target->hasUnitState(UNIT_STAT_DIED)) + if (!target->IsAttackableByAOE(false, IsPlayer()) || target->HasUnitState(UNIT_STAT_DIED)) return false; // shaman totem quests: spell 8898, shaman can detect elementals but elementals cannot see shaman if (m_invisibilityMask || target->m_invisibilityMask) - if (!canDetectInvisibilityOf(target) && !target->canDetectInvisibilityOf(this)) + if (!CanDetectInvisibilityOf(target) && !target->CanDetectInvisibilityOf(this)) return false; return true; @@ -5149,8 +4990,8 @@ void Unit::RemoveGuardiansWithEntry(uint32 entry) Pet* Unit::FindGuardianWithEntry(uint32 entry) { - for (GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) - if (Pet* pet = GetMap()->GetPet(*itr)) + for (const auto& itr : m_guardianPets) + if (Pet* pet = GetMap()->GetPet(itr)) if (pet->GetEntry() == entry) return pet; @@ -5160,9 +5001,9 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry) uint32 Unit::GetGuardianCountWithEntry(uint32 entry) { uint32 result = 0; - for (GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) - if (Pet* pet = GetMap()->GetPet(*itr)) - if (pet->GetEntry() == entry && pet->isAlive()) + for (const auto& itr : m_guardianPets) + if (Pet* pet = GetMap()->GetPet(itr)) + if (pet->GetEntry() == entry && pet->IsAlive()) result++; return result; @@ -5222,7 +5063,7 @@ bool Unit::UnsummonOldPetBeforeNewSummon(uint32 newPetEntry) // if pet requested type already exist if (OldSummon) { - if (OldSummon->isDead() && (newPetEntry == 0 || OldSummon->GetEntry() == newPetEntry)) + if (OldSummon->IsDead() && (newPetEntry == 0 || OldSummon->GetEntry() == newPetEntry)) { if (newPetEntry) // warlock pet OldSummon->Unsummon(PET_SAVE_NOT_IN_SLOT); @@ -5253,7 +5094,7 @@ void Unit::SendEnvironmentalDamageLog(uint8 type, uint32 damage, uint32 absorb, * Calculates target part of spell damage bonuses, * will be called on each tick for periodic damage over time auras */ -uint32 Unit::SpellDamageBonusTaken(WorldObject* pCaster, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack, Spell* spell) +uint32 Unit::SpellDamageBonusTaken(WorldObject* pCaster, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack, Spell* spell) const { if (!spellProto || !pCaster || damagetype == DIRECT_DAMAGE) return pdamage; @@ -5278,16 +5119,16 @@ uint32 Unit::SpellDamageBonusTaken(WorldObject* pCaster, SpellEntry const *spell return tmpDamage > 0 ? uint32(tmpDamage) : 0; } -int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const { int32 TakenAdvertisedBenefit = 0; // ..taken AuraList const& mDamageTaken = GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN); - for (AuraList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) + for (const auto& i : mDamageTaken) { - if (((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) - TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount; + if ((i->GetModifier()->m_miscvalue & schoolMask) != 0) + TakenAdvertisedBenefit += i->GetModifier()->m_amount; } return TakenAdvertisedBenefit; @@ -5297,7 +5138,7 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS { ASSERT(pVictim); // Les mobs ne peuvent pas critiquer avec les sorts. Mais totems et pets peuvent. - if (GetTypeId() == TYPEID_UNIT && !GetOwnerGuid().IsPlayer()) + if (IsCreature() && !GetOwnerGuid().IsPlayer()) return false; if (IsPlayer() && ToPlayer()->HasOption(PLAYER_CHEAT_ALWAYS_CRIT)) @@ -5323,7 +5164,7 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS if (schoolMask & SPELL_SCHOOL_MASK_NORMAL) crit_chance = 0.0f; // For other schools - else if (GetTypeId() == TYPEID_PLAYER) + else if (IsPlayer()) crit_chance = ((Player*)this)->GetSpellCritPercent(GetFirstSchoolInMask(schoolMask)); else { @@ -5339,27 +5180,27 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS // scripted (increase crit chance ... against ... target by x% AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) + for (const auto& i : mOverrideClassScript) { - if (!((*i)->GetSpellProto()->SpellFamilyName == spellProto->SpellFamilyName)) + if (!(i->GetSpellProto()->SpellFamilyName == spellProto->SpellFamilyName)) continue; - switch ((*i)->GetModifier()->m_miscvalue) + switch (i->GetModifier()->m_miscvalue) { // Shatter case 849: - if (pVictim->isFrozen()) crit_chance += 10.0f; + if (pVictim->IsFrozen()) crit_chance += 10.0f; break; case 910: - if (pVictim->isFrozen()) crit_chance += 20.0f; + if (pVictim->IsFrozen()) crit_chance += 20.0f; break; case 911: - if (pVictim->isFrozen()) crit_chance += 30.0f; + if (pVictim->IsFrozen()) crit_chance += 30.0f; break; case 912: - if (pVictim->isFrozen()) crit_chance += 40.0f; + if (pVictim->IsFrozen()) crit_chance += 40.0f; break; case 913: - if (pVictim->isFrozen()) crit_chance += 50.0f; + if (pVictim->IsFrozen()) crit_chance += 50.0f; break; default: break; @@ -5370,7 +5211,7 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS case SPELL_DAMAGE_CLASS_MELEE: case SPELL_DAMAGE_CLASS_RANGED: { - if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandingUp()) + if (pVictim->IsPlayer() && !pVictim->IsStandingUp()) return true; crit_chance = GetUnitCriticalChance(attackType, pVictim); crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask); @@ -5401,7 +5242,7 @@ bool Unit::IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellS * Calculates target part of healing spell bonuses, * will be called on each tick for periodic damage over time auras */ -uint32 Unit::SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack, Spell* spell) +uint32 Unit::SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack, Spell* spell) const { float TakenTotalMod = 1.0f; @@ -5432,16 +5273,16 @@ uint32 Unit::SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spel if (spellProto->IsFitToFamily()) { AuraList const& mDummyAuras = GetAurasByType(SPELL_AURA_DUMMY); - for (AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + for (const auto& i : mDummyAuras) { - if ((*i)->GetSpellProto()->IsFitToFamilyMask() && (*i)->GetSpellProto()->SpellVisual == 300) + if (i->GetSpellProto()->IsFitToFamilyMask() && i->GetSpellProto()->SpellVisual == 300) { // Holy Light - if (spellProto->IsFitToFamilyMask() && (*i)->GetEffIndex() == EFFECT_INDEX_0) - TakenTotal += (*i)->GetModifier()->m_amount; + if (spellProto->IsFitToFamilyMask() && i->GetEffIndex() == EFFECT_INDEX_0) + TakenTotal += i->GetModifier()->m_amount; // Flash of Light - else if (spellProto->IsFitToFamilyMask() && (*i)->GetEffIndex() == EFFECT_INDEX_1) - TakenTotal += (*i)->GetModifier()->m_amount; + else if (spellProto->IsFitToFamilyMask() && i->GetEffIndex() == EFFECT_INDEX_1) + TakenTotal += i->GetModifier()->m_amount; } } } @@ -5454,9 +5295,9 @@ uint32 Unit::SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spel { // Search for Healing Way on Victim Unit::AuraList const& auraDummy = GetAurasByType(SPELL_AURA_DUMMY); - for (Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) - if ((*itr)->GetId() == 29203) - TakenTotalMod *= ((*itr)->GetModifier()->m_amount + 100.0f) / 100.0f; + for (const auto& itr : auraDummy) + if (itr->GetId() == 29203) + TakenTotalMod *= (itr->GetModifier()->m_amount + 100.0f) / 100.0f; } @@ -5466,26 +5307,26 @@ uint32 Unit::SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spel return heal < 0 ? 0 : uint32(heal); } -int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) +int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const { int32 AdvertisedBenefit = 0; AuraList const& mDamageTaken = GetAurasByType(SPELL_AURA_MOD_HEALING); - for (AuraList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue & schoolMask) - AdvertisedBenefit += (*i)->GetModifier()->m_amount; + for (const auto& i : mDamageTaken) + if (i->GetModifier()->m_miscvalue & schoolMask) + AdvertisedBenefit += i->GetModifier()->m_amount; return AdvertisedBenefit; } -bool Unit::IsImmuneToDamage(SpellSchoolMask shoolMask, SpellEntry const* spellInfo) +bool Unit::IsImmuneToDamage(SpellSchoolMask shoolMask, SpellEntry const* spellInfo) const { if (spellInfo && spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) return false; // If m_immuneToDamage type contain magic, IMMUNE damage. SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE]; - for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr) - if (itr->type & shoolMask) + for (const auto& itr : damageList) + if (itr.type & shoolMask) return true; if (spellInfo && spellInfo->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) @@ -5493,14 +5334,14 @@ bool Unit::IsImmuneToDamage(SpellSchoolMask shoolMask, SpellEntry const* spellIn // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; - for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) - if (itr->type & shoolMask) + for (const auto& itr : schoolList) + if (itr.type & shoolMask) return true; return false; } -bool Unit::IsImmuneToSpell(SpellEntry const *spellInfo, bool /*castOnSelf*/) +bool Unit::IsImmuneToSpell(SpellEntry const *spellInfo, bool /*castOnSelf*/) const { if (!spellInfo) return false; @@ -5509,8 +5350,8 @@ bool Unit::IsImmuneToSpell(SpellEntry const *spellInfo, bool /*castOnSelf*/) //SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_EFFECT]; SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL]; - for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr) - if (itr->type == spellInfo->Dispel) + for (const auto& itr : dispelList) + if (itr.type == spellInfo->Dispel) return true; if ( !(spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) // ignore invulnerability @@ -5518,26 +5359,26 @@ bool Unit::IsImmuneToSpell(SpellEntry const *spellInfo, bool /*castOnSelf*/) && !(spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) // can remove immune (by dispell or immune it) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; - for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) - if (!(Spells::IsPositiveSpell(itr->spellId) && spellInfo->IsPositiveSpell()) && - (itr->type & spellInfo->GetSpellSchoolMask())) + for (const auto& itr : schoolList) + if (!(Spells::IsPositiveSpell(itr.spellId) && spellInfo->IsPositiveSpell()) && + (itr.type & spellInfo->GetSpellSchoolMask())) return true; } if (uint32 mechanic = spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; - for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) + for (const auto& itr : mechanicList) { - if (itr->type == mechanic) + if (itr.type == mechanic) return true; } uint32 mask = 1 << (mechanic - 1); AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK); - for (AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) + for (const auto& iter : immuneAuraApply) { - if ((*iter)->GetModifier()->m_miscvalue & mask) + if (iter->GetModifier()->m_miscvalue & mask) return true; } } @@ -5550,20 +5391,20 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i //If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effect[index]; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; - for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr) - if (itr->type == effect) + for (const auto& itr : effectList) + if (itr.type == effect) return true; if (uint32 mechanic = spellInfo->EffectMechanic[index]) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; - for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) - if (itr->type == spellInfo->EffectMechanic[index]) + for (const auto& itr : mechanicList) + if (itr.type == spellInfo->EffectMechanic[index]) return true; AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK); - for (AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) - if ((*iter)->GetModifier()->m_miscvalue & (1 << (mechanic - 1))) + for (const auto& iter : immuneAuraApply) + if (iter->GetModifier()->m_miscvalue & (1 << (mechanic - 1))) return true; } @@ -5571,8 +5412,8 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i if (aura) { SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE]; - for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr) - if (itr->type == aura) + for (const auto& itr : list) + if (itr.type == aura) return true; } return false; @@ -5743,21 +5584,21 @@ void Unit::SetInCombatWith(Unit* pEnemy) SetInCombatState(pEnemy->GetCharmerOrOwnerPlayerOrPlayerItself(), pEnemy); } -void Unit::SetInCombatState(bool PvP, Unit* enemy) +void Unit::SetInCombatState(bool bPvP, Unit* pEnemy) { // only alive units can be in combat - if (!isAlive()) + if (!IsAlive()) return; - if (PvP) + if (bPvP) m_CombatTimer = 5500; - bool wasInCombat = isInCombat(); - bool creatureNotInCombat = GetTypeId() == TYPEID_UNIT && !wasInCombat; + bool wasInCombat = IsInCombat(); + bool creatureNotInCombat = IsCreature() && !wasInCombat; SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - if (isCharmed() || (GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->IsPet())) + if (IsCharmed() || (!IsPlayer() && ((Creature*)this)->IsPet())) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); // set pet in combat if (Pet* pet = GetPet()) @@ -5765,8 +5606,8 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) { pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); - if (IsPlayer() && pet->isAlive() && enemy) - pet->AI()->OwnerAttacked(enemy); + if (IsPlayer() && pet->IsAlive() && pEnemy) + pet->AI()->OwnerAttacked(pEnemy); } // interrupt all delayed non-combat casts @@ -5781,10 +5622,10 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) { auto pCreature = ToCreature(); pCreature->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ()); - OnEnterCombat(enemy, true); + OnEnterCombat(pEnemy, true); // Some bosses are set into combat with zone - if (GetMap()->IsDungeon() && (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_AGGRO_ZONE) && enemy && enemy->IsControlledByPlayer()) + if (GetMap()->IsDungeon() && (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_AGGRO_ZONE) && pEnemy && pEnemy->IsControlledByPlayer()) pCreature->SetInCombatWithZone(); if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) if (spell->getState() == SPELL_STATE_CASTING) @@ -5792,7 +5633,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) InterruptSpell(CURRENT_CHANNELED_SPELL); if (m_isCreatureLinkingTrigger) - GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_AGGRO, pCreature, enemy); + GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_AGGRO, pCreature, pEnemy); } } @@ -5879,17 +5720,17 @@ void Unit::TogglePlayerPvPFlagOnAttackVictim(Unit const* pVictim, bool touchOnly } } -void Unit::SetInCombatWithVictim(Unit* victim, bool touchOnly/* = false*/) +void Unit::SetInCombatWithVictim(Unit* pVictim, bool touchOnly/* = false*/) { // This is a wrapper for SetInCombatWith initially created to improve PvP timers responsiveness. Can be extended in the future for broader use. - if (!victim) + if (!pVictim) return; - TogglePlayerPvPFlagOnAttackVictim(victim, touchOnly); + TogglePlayerPvPFlagOnAttackVictim(pVictim, touchOnly); if (!touchOnly) - SetInCombatWith(victim); + SetInCombatWith(pVictim); } @@ -5899,17 +5740,20 @@ void Unit::ClearInCombat() RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) static_cast(this)->pvpInfo.inPvPCombat = false; } -bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/, bool isAttackerPlayer /*=false*/) const +bool Unit::IsTargetableForAttack(bool inverseAlive /*=false*/, bool isAttackerPlayer /*=false*/) const { if (!CanBeDetected()) return false; - if (GetTypeId() == TYPEID_PLAYER && (((Player *)this)->IsGameMaster() || ((Player*)this)->watching_cinematic_entry != 0)) - return false; + if (Player const* pPlayer = ToPlayer()) + { + if (pPlayer->IsGameMaster() || pPlayer->watching_cinematic_entry != 0) + return false; + } if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) return false; @@ -5918,11 +5762,11 @@ bool Unit::isTargetableForAttack(bool inverseAlive /*=false*/, bool isAttackerPl return false; // Players or their pets can attack feigned players - if (!isAttackerPlayer && hasUnitState(UNIT_STAT_DIED)) + if (!isAttackerPlayer && HasUnitState(UNIT_STAT_DIED)) return false; // inversealive is needed for some spells which need to be casted at dead targets (aoe) - if (isAlive() == inverseAlive) + if (IsAlive() == inverseAlive) return false; return IsInWorld() && !IsTaxiFlying(); @@ -5940,7 +5784,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const return false; // can't attack unattackable units or GMs - if (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster()) + if (target->IsPlayer() && target->ToPlayer()->IsGameMaster()) return false; // check flags @@ -6074,7 +5918,7 @@ float Unit::GetRegenHPPerSpirit() const float regen = 0.0f; float Spirit = GetStat(STAT_SPIRIT); - uint8 Class = getClass(); + uint8 Class = GetClass(); switch (Class) { @@ -6115,7 +5959,7 @@ float Unit::GetRegenMPPerSpirit() const float addvalue = 0.0; float Spirit = GetStat(STAT_SPIRIT); - uint8 Class = getClass(); + uint8 Class = GetClass(); switch (Class) { @@ -6147,7 +5991,7 @@ float Unit::GetRegenMPPerSpirit() const return addvalue; } -bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool /*inVisibleList*/, bool* alert) const +bool Unit::IsVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool /*inVisibleList*/, bool* alert) const { if (!pDetector || !IsInMap(pDetector)) return false; @@ -6177,13 +6021,13 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* return false; // if player is dead then he can't detect anyone in any cases - if (!pDetectorPlayer->isAlive()) + if (!pDetectorPlayer->IsAlive()) detect = false; } else { // all dead creatures/players not visible for any creatures - if ((pDetectorUnit && !pDetectorUnit->isAlive()) || !isAlive()) + if ((pDetectorUnit && !pDetectorUnit->IsAlive()) || !IsAlive()) return false; } @@ -6191,10 +6035,10 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* if (GetCharmerOrOwnerGuid() == pDetector->GetObjectGuid()) return true; - // isInvisibleForAlive() those units can only be seen by dead or if other + // IsInvisibleForAlive() those units can only be seen by dead or if other // unit is also invisible for alive.. if an isinvisibleforalive unit dies we // should be able to see it too - if (pDetectorUnit && pDetectorUnit->isAlive() && isAlive() && isInvisibleForAlive() != pDetectorUnit->isInvisibleForAlive()) + if (pDetectorUnit && pDetectorUnit->IsAlive() && IsAlive() && IsInvisibleForAlive() != pDetectorUnit->IsInvisibleForAlive()) if (!pDetectorPlayer || !pDetectorPlayer->IsGameMaster()) return false; @@ -6216,7 +6060,7 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* // GMs see any players, not higher GMs and all units if (pDetectorPlayer && pDetectorPlayer->IsGameMaster()) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return ToPlayer()->GetGMInvisibilityLevel() <= uint8(pDetectorPlayer->GetSession()->GetSecurity()); return true; } @@ -6235,7 +6079,7 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* (m_invisibilityMask & pDetectorUnit->m_invisibilityMask) || // Invisible units are always visible for units that can detect the // appropriate invisibility level - pDetectorUnit->canDetectInvisibilityOf(this))) + pDetectorUnit->CanDetectInvisibilityOf(this))) invisible = false; // special cases for always overwrite invisibility/stealth @@ -6245,7 +6089,7 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* if (!pDetector->IsHostileTo(this)) { // player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting) - if (GetTypeId() == TYPEID_PLAYER && pDetectorPlayer) + if (IsPlayer() && pDetectorPlayer) { if (((Player*)this)->IsGroupVisibleFor(pDetectorPlayer)) return true; @@ -6278,7 +6122,7 @@ bool Unit::isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* return pDetectorPlayer ? pDetectorPlayer->IsInVisibleList(this) : false; // Special cases - if (pDetectorUnit && !pDetectorUnit->canDetectStealthOf(this, GetDistance(viewPoint), alert)) + if (pDetectorUnit && !pDetectorUnit->CanDetectStealthOf(this, GetDistance(viewPoint), alert)) return false; // Now check if target is visible with LoS @@ -6302,7 +6146,7 @@ void Unit::UpdateVisibilityAndView() Aura* aura = (*it); Unit* owner = aura->GetCaster(); - if (!owner || !isVisibleForOrDetect(owner, this, false)) + if (!owner || !IsVisibleForOrDetect(owner, this, false)) { alist.erase(it); RemoveAura(aura); @@ -6327,7 +6171,7 @@ void Unit::SetVisibility(UnitVisibility x) UpdateVisibilityAndView(); } -bool Unit::canDetectInvisibilityOf(Unit const* u) const +bool Unit::CanDetectInvisibilityOf(Unit const* u) const { if (const Creature* worldBoss = ToCreature()) if (worldBoss->IsWorldBoss()) @@ -6343,18 +6187,18 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const // find invisibility level int32 invLevel = 0; Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); - for (Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr) - if ((*itr)->GetModifier()->m_miscvalue == i && invLevel < (*itr)->GetModifier()->m_amount) - invLevel = (*itr)->GetModifier()->m_amount; + for (const auto& itr : iAuras) + if (itr->GetModifier()->m_miscvalue == i && invLevel < itr->GetModifier()->m_amount) + invLevel = itr->GetModifier()->m_amount; // find invisibility detect level int32 detectLevel = 0; Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); - for (Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr) - if ((*itr)->GetModifier()->m_miscvalue == i && detectLevel < (*itr)->GetModifier()->m_amount) - detectLevel = (*itr)->GetModifier()->m_amount; + for (const auto& itr : dAuras) + if (itr->GetModifier()->m_miscvalue == i && detectLevel < itr->GetModifier()->m_amount) + detectLevel = itr->GetModifier()->m_amount; - if (i == 6 && GetTypeId() == TYPEID_PLAYER) // special drunk detection case + if (i == 6 && IsPlayer()) // special drunk detection case detectLevel = ((Player*)this)->GetDrunkValue(); if (invLevel <= detectLevel) @@ -6365,17 +6209,17 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const return false; } -bool Unit::canDetectStealthOf(Unit const* target, float distance, bool *alert) const +bool Unit::CanDetectStealthOf(Unit const* target, float distance, bool *alert) const { - if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) + if (HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) return false; if (distance < 0.388f) //collision return true; // Hunter mark functionality AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_STALKED); - for (AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) - if ((*iter)->GetCasterGuid() == GetObjectGuid()) + for (const auto& iter : auras) + if (iter->GetCasterGuid() == GetObjectGuid()) return true; // set max distance @@ -6435,7 +6279,7 @@ void Unit::CheckPendingMovementChanges() return; } - PlayerMovementPendingChange& oldestChangeToAck = GetPendingMovementChangesQueue().front(); + PlayerMovementPendingChange& oldestChangeToAck = m_pendingMovementChanges.front(); if (WorldTimer::getMSTime() > oldestChangeToAck.time + sWorld.getConfig(CONFIG_UINT32_MOVEMENT_CHANGE_ACK_TIME)) { // There is a new change for the same thing, don't resend old state. @@ -6690,7 +6534,7 @@ PlayerMovementPendingChange::PlayerMovementPendingChange() void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) { // not in combat pet have same speed as owner - if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW) && !isInCombat()) + if (IsCreature() && ((Creature*)this)->IsPet() && HasUnitState(UNIT_STAT_FOLLOW) && !IsInCombat()) { if (Unit* owner = GetOwner()) { @@ -6770,9 +6614,9 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) } // for player case, we look for some custom rates - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { - if (getDeathState() == CORPSE) + if (GetDeathState() == CORPSE) speed *= sWorld.getConfig(((Player*)this)->InBattleGround() ? CONFIG_FLOAT_GHOST_RUN_SPEED_BG : CONFIG_FLOAT_GHOST_RUN_SPEED_WORLD); } @@ -6781,7 +6625,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) if (slow) speed *= (100.0f + slow) / 100.0f; - if (GetTypeId() == TYPEID_UNIT) + if (IsCreature()) { // Before patch 1.9 pets should retain their wild speed, after that they are normalised Creature* pCreature = (Creature*)this; @@ -6902,7 +6746,7 @@ void Unit::SetSpeedRate(UnitMoveType mtype, float rate) void Unit::SetSpeedRateReal(UnitMoveType mtype, float rate) { m_speed_rate[mtype] = rate; - propagateSpeedChange(); + PropagateSpeedChange(); CallForAllControlledUnits(SetSpeedRateHelper(mtype, true), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM | CONTROLLED_MINIPET); } @@ -7072,28 +6916,28 @@ void Unit::SetDeathState(DeathState s) bool Unit::CanHaveThreatList() const { // only creatures can have threat list - if (GetTypeId() != TYPEID_UNIT) + if (!IsCreature()) return false; // only alive units can have threat list - if (!isAlive()) + if (!IsAlive()) return false; - Creature const* creature = ((Creature const*)this); + Creature const* pCreature = static_cast(this); // totems can not have threat list - if (creature->IsTotem()) + if (pCreature->IsTotem()) return false; // pets can not have a threat list, unless they are controlled by a creature - if (creature->IsPet() && creature->GetOwnerGuid().IsPlayer()) + if (pCreature->IsPet() && pCreature->GetOwnerGuid().IsPlayer()) return false; // charmed units can not have a threat list if charmed by player - if (creature->GetCharmerGuid().IsPlayer()) + if (pCreature->GetCharmerGuid().IsPlayer()) return false; - if (creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_THREAT_LIST) + if (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_THREAT_LIST) return false; return true; @@ -7134,15 +6978,15 @@ void Unit::DeleteThreatList() void Unit::TauntApply(Unit* taunter) { - MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT); + MANGOS_ASSERT(IsCreature()); - if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->IsGameMaster())) + if (!taunter || (taunter->IsPlayer() && ((Player*)taunter)->IsGameMaster())) return; if (!CanHaveThreatList()) return; - Unit *target = getVictim(); + Unit* target = GetVictim(); if (target && target == taunter) return; @@ -7150,7 +6994,7 @@ void Unit::TauntApply(Unit* taunter) if (!HasAuraType(SPELL_AURA_MOD_FEAR) && !HasAuraType(SPELL_AURA_MOD_CONFUSE)) { SetInFront(taunter); - OnEnterCombat(taunter, !isInCombat()); + OnEnterCombat(taunter, !IsInCombat()); if (((Creature*)this)->AI()) ((Creature*)this)->AI()->AttackStart(taunter); @@ -7161,17 +7005,17 @@ void Unit::TauntApply(Unit* taunter) //====================================================================== -void Unit::TauntFadeOut(Unit *taunter) +void Unit::TauntFadeOut(Unit* taunter) { - MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT); + MANGOS_ASSERT(IsCreature()); - if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->IsGameMaster())) + if (!taunter || (taunter->IsPlayer() && ((Player*)taunter)->IsGameMaster())) return; if (!CanHaveThreatList()) return; - Unit *target = getVictim(); + Unit* target = GetVictim(); if (!target || target != taunter) return; @@ -7210,7 +7054,7 @@ Unit* Unit::GetTauntTarget() const Unit* caster = nullptr; // The last taunt aura caster is alive an we are happy to attack him - if ((caster = tauntAuras.back()->GetCaster()) && caster->isAlive() && IsValidAttackTarget(caster)) + if ((caster = tauntAuras.back()->GetCaster()) && caster->IsAlive() && IsValidAttackTarget(caster)) return caster; else if (tauntAuras.size() > 1) { @@ -7222,7 +7066,7 @@ Unit* Unit::GetTauntTarget() const do { --aura; - if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) && caster->isTargetableForAttack()) + if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) && caster->IsTargetableForAttack()) { return caster; break; @@ -7239,9 +7083,9 @@ bool Unit::SelectHostileTarget() //next-victim-selection algorithm and evade mode are called //threat list sorting etc. - MANGOS_ASSERT(GetTypeId() == TYPEID_UNIT); + MANGOS_ASSERT(IsCreature()); - if (!this->isAlive()) + if (!this->IsAlive()) return false; //This function only useful once AI has been initialized @@ -7261,7 +7105,7 @@ bool Unit::SelectHostileTarget() if (target) { // Nostalrius : Correction bug sheep/fear - if (!hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) && (!HasAuraType(SPELL_AURA_MOD_FEAR) || HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !HasAuraType(SPELL_AURA_MOD_CONFUSE)) + if (!HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) && (!HasAuraType(SPELL_AURA_MOD_FEAR) || HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) && !HasAuraType(SPELL_AURA_MOD_CONFUSE)) { SetInFront(target); ((Creature*)this)->AI()->AttackStart(target); @@ -7270,7 +7114,7 @@ bool Unit::SelectHostileTarget() } // no target but something prevent go to evade mode // Nostalrius - fix evade quand CM. - if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_TAUNT) || GetCharmerGuid()) + if (!IsInCombat() || HasAuraType(SPELL_AURA_MOD_TAUNT) || GetCharmerGuid()) return false; // last case when creature don't must go to evade mode: @@ -7279,9 +7123,9 @@ bool Unit::SelectHostileTarget() // Note: creature not have targeted movement generator but have attacker in this case if (GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) { - for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) + for (const auto& itr : m_attackers) { - if ((*itr)->IsInMap(this) && (*itr)->isTargetableForAttack()) + if (itr->IsInMap(this) && itr->IsTargetableForAttack()) return false; } } @@ -7301,26 +7145,26 @@ bool Unit::SelectHostileTarget() DiminishingLevels Unit::GetDiminishing(DiminishingGroup group) { - for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i) + for (auto& i : m_Diminishing) { - if (i->DRGroup != group) + if (i.DRGroup != group) continue; - if (!i->hitCount) + if (!i.hitCount) return DIMINISHING_LEVEL_1; - if (!i->hitTime) + if (!i.hitTime) return DIMINISHING_LEVEL_1; // If last spell was casted more than 15 seconds ago - reset the count. - if (i->stack == 0 && WorldTimer::getMSTimeDiff(i->hitTime, WorldTimer::getMSTime()) > 15 * IN_MILLISECONDS) + if (i.stack == 0 && WorldTimer::getMSTimeDiff(i.hitTime, WorldTimer::getMSTime()) > 15 * IN_MILLISECONDS) { - i->hitCount = DIMINISHING_LEVEL_1; + i.hitCount = DIMINISHING_LEVEL_1; return DIMINISHING_LEVEL_1; } // or else increase the count. else - return DiminishingLevels(i->hitCount); + return DiminishingLevels(i.hitCount); } return DIMINISHING_LEVEL_1; } @@ -7328,12 +7172,12 @@ DiminishingLevels Unit::GetDiminishing(DiminishingGroup group) void Unit::IncrDiminishing(DiminishingGroup group) { // Checking for existing in the table - for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i) + for (auto& i : m_Diminishing) { - if (i->DRGroup != group) + if (i.DRGroup != group) continue; - if (i->hitCount < DIMINISHING_LEVEL_IMMUNE) - i->hitCount += 1; + if (i.hitCount < DIMINISHING_LEVEL_IMMUNE) + i.hitCount += 1; return; } m_Diminishing.push_back(DiminishingReturn(group, WorldTimer::getMSTime(), DIMINISHING_LEVEL_2)); @@ -7360,49 +7204,51 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, W void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply) { // Checking for existing in the table - for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i) + for (auto& i : m_Diminishing) { - if (i->DRGroup != group) + if (i.DRGroup != group) continue; if (apply) - i->stack += 1; - else if (i->stack) + i.stack += 1; + else if (i.stack) { - i->stack -= 1; + i.stack -= 1; // Remember time after last aura from group removed - if (i->stack == 0) - i->hitTime = WorldTimer::getMSTime(); + if (i.stack == 0) + i.hitTime = WorldTimer::getMSTime(); } break; } } -bool Unit::isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const +bool Unit::IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const { - return isVisibleForOrDetect(pDetector, viewPoint, false, inVisibleList); + return IsVisibleForOrDetect(pDetector, viewPoint, false, inVisibleList); } /// returns true if creature can't be seen by alive units -bool Unit::isInvisibleForAlive() const +bool Unit::IsInvisibleForAlive() const { - if (m_AuraFlags & UNIT_AURAFLAG_ALIVE_INVISIBLE) + // Shroud of Death + if (HasAura(10848) || HasAura(27978)) return true; + // TODO: maybe spiritservices also have just an aura - return isSpiritService(); + return IsSpiritService(); } /// returns true if creature can be seen by dead units -bool Unit::isVisibleForDead() const +bool Unit::IsVisibleForDead() const { - if (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_GHOST_VISIBLE) + if (IsCreature() && ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_GHOST_VISIBLE) return true; - return isSpiritService(); + return IsSpiritService(); } uint32 Unit::GetCreatureType() const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm()); if (ssEntry && ssEntry->creatureType > 0) @@ -7704,7 +7550,7 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const float Unit::GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange damageRange, uint8 index) const { - if (attType == OFF_ATTACK && !haveOffhandWeapon()) + if (attType == OFF_ATTACK && !HaveOffhandWeapon()) return 0.0f; return m_weaponDamage[attType][index].damage[damageRange]; @@ -7715,7 +7561,7 @@ void Unit::SetLevel(uint32 lvl) SetUInt32Value(UNIT_FIELD_LEVEL, lvl); // group update - if ((GetTypeId() == TYPEID_PLAYER) && ((Player*)this)->GetGroup()) + if ((IsPlayer()) && ((Player*)this)->GetGroup()) ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL); } @@ -7729,19 +7575,18 @@ void Unit::SetHealth(uint32 val) ForceValuesUpdateAtIndex(UNIT_FIELD_MAXHEALTH); // Necessaire pour script qui cache PV aux joueurs. // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_HP); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_HP); } } } @@ -7753,19 +7598,18 @@ void Unit::SetMaxHealth(uint32 val) ForceValuesUpdateAtIndex(UNIT_FIELD_HEALTH); // Cf plus haut. // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_HP); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_HP); } } @@ -7797,24 +7641,23 @@ void Unit::SetPower(Powers power, uint32 val) SetStatInt32Value(UNIT_FIELD_POWER1 + power, val); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); } // Update the pet's character sheet with happiness damage bonus - if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS) - pet->UpdateDamagePhysical(BASE_ATTACK); + if (pPet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS) + pPet->UpdateDamagePhysical(BASE_ATTACK); } } @@ -7824,19 +7667,18 @@ void Unit::SetMaxPower(Powers power, uint32 val) SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER); } } @@ -7849,19 +7691,18 @@ void Unit::ApplyPowerMod(Powers power, uint32 val, bool apply) ApplyModUInt32Value(UNIT_FIELD_POWER1 + power, val, apply); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); } } } @@ -7871,48 +7712,38 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply) ApplyModUInt32Value(UNIT_FIELD_MAXPOWER1 + power, val, apply); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - if (((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); } - else if (((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER); + Player* pOwner = ::ToPlayer(GetOwner()); + if (pOwner && pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER); } } } -void Unit::ApplyAuraProcTriggerDamage(Aura* aura, bool apply) -{ - AuraList& tAuraProcTriggerDamage = m_modAuras[SPELL_AURA_PROC_TRIGGER_DAMAGE]; - if (apply) - tAuraProcTriggerDamage.push_back(aura); - else - tAuraProcTriggerDamage.remove(aura); -} - uint32 Unit::GetCreatePowers(Powers power) const { switch (power) { case POWER_HEALTH: - return 0; // is it really should be here? + return 0; case POWER_MANA: return GetCreateMana(); case POWER_RAGE: return 1000; case POWER_FOCUS: - return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100); + return (IsPlayer() || !IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100); case POWER_ENERGY: return 100; case POWER_HAPPINESS: - return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000); + return (IsPlayer() || !IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000); } return 0; @@ -7954,12 +7785,12 @@ void Unit::CleanupsBeforeDelete() CombatStop(); ClearComboPointHolders(); DeleteThreatList(); - if (getHostileRefManager().getOwner() == this) + if (GetHostileRefManager().getOwner() == this) { - if (GetTypeId() == TYPEID_PLAYER) - getHostileRefManager().setOnlineOfflineState(false); + if (IsPlayer()) + GetHostileRefManager().setOnlineOfflineState(false); else - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); } RemoveAllAuras(AURA_REMOVE_BY_DELETE); CleanupDeletedAuras(); // any long range channeled spells need to be cleaned up after aura deletion @@ -7967,7 +7798,7 @@ void Unit::CleanupsBeforeDelete() WorldObject::CleanupsBeforeDelete(); } -CharmInfo* Unit::InitCharmInfo(Unit *charm) +CharmInfo* Unit::InitCharmInfo(Unit* charm) { if (!m_charmInfo) m_charmInfo = new CharmInfo(charm); @@ -8033,7 +7864,7 @@ void CharmInfo::InitPossessCreateSpells() void CharmInfo::InitCharmCreateSpells() { - if (m_unit->GetTypeId() == TYPEID_PLAYER) //charmed players don't have spells + if (m_unit->IsPlayer()) //charmed players don't have spells { //InitEmptyActionBar(); InitPetActionBar(); @@ -8274,12 +8105,6 @@ bool CharmInfo::IsReturning() return _isReturning; } - -bool Unit::isFrozen() const -{ - return HasAuraState(AURA_STATE_FROZEN); -} - uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition) { uint32 procEx = PROC_EX_NONE; @@ -8341,12 +8166,12 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, if (procFlag & MELEE_BASED_TRIGGER_MASK && pTarget) { // Update skills here for players - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // On melee based hit/miss/resist need update skill (for victim and attacker) if (procExtra & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT | PROC_EX_MISS | PROC_EX_DODGE | PROC_EX_PARRY | PROC_EX_BLOCK | PROC_EX_RESIST)) { - if (pTarget->GetTypeId() != TYPEID_PLAYER && pTarget->GetCreatureType() != CREATURE_TYPE_CRITTER) + if (!pTarget->IsPlayer() && pTarget->GetCreatureType() != CREATURE_TYPE_CRITTER) ((Player*)this)->UpdateCombatSkills(pTarget, attType, isVictim); } // Update defence if player is victim and parry/dodge/block @@ -8371,7 +8196,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, if (procExtra & PROC_EX_DODGE) { //Update AURA_STATE on dodge - if (getClass() != CLASS_ROGUE) // skip Rogue Riposte + if (GetClass() != CLASS_ROGUE) // skip Rogue Riposte { ModifyAuraState(AURA_STATE_DEFENSE, true); StartReactiveTimer(REACTIVE_DEFENSE, pTarget->GetObjectGuid()); @@ -8381,7 +8206,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, if (procExtra & PROC_EX_PARRY) { // For Hunters only Counterattack (skip Mongoose bite) - if (getClass() == CLASS_HUNTER) + if (GetClass() == CLASS_HUNTER) { ModifyAuraState(AURA_STATE_HUNTER_PARRY, true); StartReactiveTimer(REACTIVE_HUNTER_PARRY, pTarget->GetObjectGuid()); @@ -8405,7 +8230,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, else //For attacker { // Overpower on victim dodge - if (procExtra & PROC_EX_DODGE && GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_WARRIOR) + if (procExtra & PROC_EX_DODGE && IsPlayer() && GetClass() == CLASS_WARRIOR) { static_cast(this)->AddComboPoints(pTarget, 1); StartReactiveTimer(REACTIVE_OVERPOWER, pTarget->GetObjectGuid()); @@ -8416,21 +8241,21 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, DEBUG_UNIT(this, DEBUG_PROCS, "PROC: Flags 0x%.5x Ex 0x%.3x Spell %5u %s", procFlag, procExtra, procSpell ? procSpell->Id : 0, isVictim ? "[victim]" : ""); // Fill triggeredList list - for (SpellAuraHolderMap::const_iterator itr = GetSpellAuraHolderMap().begin(); itr != GetSpellAuraHolderMap().end(); ++itr) + for (const auto& itr : GetSpellAuraHolderMap()) { // Can not proc on self. - if (procSpell && procSpell->Id == itr->first) + if (procSpell && procSpell->Id == itr.first) continue; // skip deleted auras (possible at recursive triggered call - if (itr->second->IsDeleted()) + if (itr.second->IsDeleted()) continue; // Aura that applies a modifier with charges. Gere? otherwise. bool hasmodifier = false; for (int i = 0; i < 3; ++i) - if (itr->second->GetAuraByEffectIndex(SpellEffectIndex(i))) - if (SpellModifier* auraMod = itr->second->GetAuraByEffectIndex(SpellEffectIndex(i))->GetSpellModifier()) + if (itr.second->GetAuraByEffectIndex(SpellEffectIndex(i))) + if (SpellModifier* auraMod = itr.second->GetAuraByEffectIndex(SpellEffectIndex(i))->GetSpellModifier()) if (auraMod->charges > 0 || (spell && spell->HasModifierApplied(auraMod))) { hasmodifier = true; @@ -8440,24 +8265,28 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, continue; SpellProcEventEntry const* spellProcEvent = nullptr; - if (!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, spellProcEvent)) + if (!IsTriggeredAtSpellProcEvent(pTarget, itr.second, procSpell, procFlag, procExtra, attType, isVictim, spellProcEvent)) continue; - itr->second->SetInUse(true); // prevent holder deletion - triggeredList.push_back(ProcTriggeredData(spellProcEvent, itr->second, pTarget, procFlag)); + itr.second->SetInUse(true); // prevent holder deletion + triggeredList.push_back(ProcTriggeredData(spellProcEvent, itr.second, pTarget, procFlag)); } } Player* Unit::GetSpellModOwner() const { - if (GetTypeId() == TYPEID_PLAYER) - return (Player*)this; - if (((Creature*)this)->IsPet() || ((Creature*)this)->IsTotem()) + if (Player const* pPlayer = ToPlayer()) + return const_cast(pPlayer); + + if (Creature const* pCreature = ToCreature()) { - Unit* owner = GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - return (Player*)owner; + if (pCreature->IsPet() || pCreature->IsTotem()) + { + if (Player* pOwner = ::ToPlayer(GetOwner())) + return pOwner; + } } + return nullptr; } @@ -8467,59 +8296,55 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) if (msg == SPELL_CAST_OK) return; - Unit *owner = GetCharmerOrOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - - WorldPacket data(SMSG_PET_CAST_FAILED, 4 + 1 + 1); - data << uint32(spellid); - data << uint8(2); // 1.12: comme SMSG_CAST_RESULT je suppose. 2 = echec, 0 = reussi. - data << uint8(msg); - ((Player*)owner)->GetSession()->SendPacket(&data); + if (Player* pOwner = ::ToPlayer(GetCharmerOrOwner())) + { + WorldPacket data(SMSG_PET_CAST_FAILED, 4 + 1 + 1); + data << uint32(spellid); + data << uint8(2); // 1.12: for SMSG_CAST_RESULT probably 2 = failure, 0 = success. + data << uint8(msg); + pOwner->GetSession()->SendPacket(&data); + } } void Unit::SendPetActionFeedback(uint8 msg) { - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - - WorldPacket data(SMSG_PET_ACTION_FEEDBACK, 1); - data << uint8(msg); - ((Player*)owner)->GetSession()->SendPacket(&data); + if (Player* pOwner = ::ToPlayer(GetOwner())) + { + WorldPacket data(SMSG_PET_ACTION_FEEDBACK, 1); + data << uint8(msg); + pOwner->GetSession()->SendPacket(&data); + } } void Unit::SendPetTalk(uint32 pettalk) { #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - - WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4); - data << GetObjectGuid(); - data << uint32(pettalk); - ((Player*)owner)->GetSession()->SendPacket(&data); + if (Player* pOwner = ::ToPlayer(GetOwner())) + { + WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4); + data << GetObjectGuid(); + data << uint32(pettalk); + pOwner->GetSession()->SendPacket(&data); + } #endif } void Unit::SendPetAIReaction() { - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - - WorldPacket data(SMSG_AI_REACTION, 8 + 4); - data << GetObjectGuid(); - data << uint32(AI_REACTION_HOSTILE); - ((Player*)owner)->GetSession()->SendPacket(&data); + if (Player* pOwner = ::ToPlayer(GetOwner())) + { + WorldPacket data(SMSG_AI_REACTION, 8 + 4); + data << GetObjectGuid(); + data << uint32(AI_REACTION_HOSTILE); + pOwner->GetSession()->SendPacket(&data); + } } ///----------End of Pet responses methods---------- void Unit::StopMoving(bool force) { - clearUnitState(UNIT_STAT_MOVING); + ClearUnitState(UNIT_STAT_MOVING); RemoveUnitMovementFlag(MOVEFLAG_MASK_MOVING); // not need send any packets if not in world if (!IsInWorld()) @@ -8534,7 +8359,7 @@ void Unit::StopMoving(bool force) init.SetStop(); // Will trigger CMSG_MOVE_SPLINE_DONE from client. init.Launch(); } - else if (GetTypeId() != TYPEID_PLAYER) { + else if (!IsPlayer()) { init.SetFacing(GetOrientation()); init.Launch(); } @@ -8565,8 +8390,8 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID) void Unit::ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellID, MovementModType modType, uint32 time) { - if (GetTypeId() == TYPEID_UNIT) - if (ToCreature()->IsTotem()) + if (Creature* pCreature = ToCreature()) + if (pCreature->IsTotem()) return; bool controlFinished = true; @@ -8595,52 +8420,54 @@ void Unit::ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellID, Mo switch (modType) { - case MOV_MOD_FLEE_FOR_ASSISTANCE: - { - Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGuid) : nullptr; - GetMotionMaster()->MoveFleeing(caster, time); - break; - } - case MOV_MOD_FLEE_IN_FEAR: - { - Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGuid) : nullptr; - GetMotionMaster()->MoveFeared(caster, time); - break; - } - case MOV_MOD_CONFUSED: - GetMotionMaster()->MoveConfused(); - break; + case MOV_MOD_FLEE_FOR_ASSISTANCE: + { + Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGuid) : nullptr; + GetMotionMaster()->MoveFleeing(caster, time); + break; + } + case MOV_MOD_FLEE_IN_FEAR: + { + Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGuid) : nullptr; + GetMotionMaster()->MoveFeared(caster, time); + break; + } + case MOV_MOD_CONFUSED: + GetMotionMaster()->MoveConfused(); + break; } if (casterGuid != GetObjectGuid()) InterruptNonMeleeSpells(false); - if (GetTypeId() == TYPEID_UNIT) + if (IsCreature()) SetTargetGuid(ObjectGuid()); } else { switch (modType) { - case MOV_MOD_FLEE_FOR_ASSISTANCE: - case MOV_MOD_FLEE_IN_FEAR: - { - if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING)) - GetMotionMaster()->ClearType(FLEEING_MOTION_TYPE); - break; - } - case MOV_MOD_CONFUSED: - if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED)) - GetMotionMaster()->ClearType(CONFUSED_MOTION_TYPE); - break; + case MOV_MOD_FLEE_FOR_ASSISTANCE: + case MOV_MOD_FLEE_IN_FEAR: + { + if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING)) + GetMotionMaster()->ClearType(FLEEING_MOTION_TYPE); + break; + } + case MOV_MOD_CONFUSED: + { + if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED)) + GetMotionMaster()->ClearType(CONFUSED_MOTION_TYPE); + break; + } } - // Si spellID=0, c'est pour interrompre (par exemple male de temerite - 704) - // Donc on retire les effets meme si on a encore un aura de fear. + // If spellID = 0, it is to interrupt (eg Curse of Recklessness - 704) + // So we remove the effects even if we still have an aura of fear. if (!controlFinished && spellID) return; - if (GetTypeId() != TYPEID_PLAYER && isAlive()) + if (!IsPlayer() && IsAlive()) { Unit* caster = IsInWorld() ? GetMap()->GetUnit(casterGuid) : nullptr; if (caster) @@ -8650,8 +8477,8 @@ void Unit::ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellID, Mo if (!SelectHostileTarget()) return; - if (getVictim()) - SetTargetGuid(getVictim()->GetObjectGuid()); + if (GetVictim()) + SetTargetGuid(GetVictim()->GetObjectGuid()); RestoreMovement(); } @@ -8663,7 +8490,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) if (apply) { m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN); - if (GetTypeId() != TYPEID_PLAYER) + if (!IsPlayer()) StopMoving(); if (!success) @@ -8678,11 +8505,11 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) { InterruptSpellsCastedOnMe(); - addUnitState(UNIT_STAT_DIED); + AddUnitState(UNIT_STAT_DIED); CombatStop(); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); - getHostileRefManager().deleteReferences(); + GetHostileRefManager().deleteReferences(); } SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); @@ -8701,7 +8528,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - clearUnitState(UNIT_STAT_DIED); + ClearUnitState(UNIT_STAT_DIED); RestoreMovement(); } @@ -8709,7 +8536,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success) bool Unit::IsSittingDown() const { - switch (getStandState()) + switch (GetStandState()) { case UNIT_STAND_STATE_SIT: case UNIT_STAND_STATE_SIT_CHAIR: @@ -8724,7 +8551,7 @@ bool Unit::IsSittingDown() const bool Unit::IsStandingUp() const { - uint8 s = getStandState(); + uint8 s = GetStandState(); return (s == UNIT_STAND_STATE_STAND) || (s == UNIT_STAND_STATE_DEAD); } @@ -8743,7 +8570,7 @@ void Unit::SetStandState(uint8 state) if (IsStandingUp()) RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { WorldPacket data(SMSG_STANDSTATE_UPDATE, 1); data << (uint8)state; @@ -8754,10 +8581,10 @@ void Unit::SetStandState(uint8 state) bool Unit::IsPolymorphed() const { - return Spells::GetSpellSpecific(getTransForm()) == SPELL_MAGE_POLYMORPH; + return Spells::GetSpellSpecific(GetTransForm()) == SPELL_MAGE_POLYMORPH; } -bool Unit::isAttackReady(WeaponAttackType type) const +bool Unit::IsAttackReady(WeaponAttackType type) const { return m_attackTimer[type] == 0; } @@ -8767,15 +8594,11 @@ void Unit::SetDisplayId(uint32 modelId) UpdateModelData(); - if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet()) - { - Pet *pet = ((Pet*)this); - if (!pet->isControlled()) - return; - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) - ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MODEL_ID); - } + if (Pet* pPet = ToPet()) + if (pPet->isControlled()) + if (Player* pOwner = ::ToPlayer(GetOwner())) + if (pOwner->GetGroup()) + pOwner->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MODEL_ID); } void Unit::UpdateModelData() @@ -8792,7 +8615,7 @@ void Unit::UpdateModelData() { // Taurens have increased combat reach. Confirmed by Blizzard. // https://us.forums.blizzard.com/en/wow/t/wow-classic-not-a-bug-list/175887 - if (getRace() == RACE_TAUREN && GetDisplayId() == GetNativeDisplayId()) + if (GetRace() == RACE_TAUREN && GetDisplayId() == GetNativeDisplayId()) SetFloatValue(UNIT_FIELD_COMBATREACH, 4.05f); else SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f); @@ -8845,11 +8668,11 @@ void Unit::ClearAllReactives() if (HasAuraState(AURA_STATE_DEFENSE)) ModifyAuraState(AURA_STATE_DEFENSE, false); - if (getClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) + if (GetClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) ModifyAuraState(AURA_STATE_HUNTER_PARRY, false); - if (getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->ClearComboPoints(); + if (GetClass() == CLASS_WARRIOR && IsPlayer()) + static_cast(this)->ClearComboPoints(); } void Unit::UpdateReactives(uint32 p_time) @@ -8879,12 +8702,12 @@ void Unit::UpdateReactives(uint32 p_time) ModifyAuraState(AURA_STATE_DEFENSE, false); break; case REACTIVE_HUNTER_PARRY: - if (getClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) + if (GetClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY)) ModifyAuraState(AURA_STATE_HUNTER_PARRY, false); break; case REACTIVE_OVERPOWER: - if (getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->ClearComboPoints(); + if (GetClass() == CLASS_WARRIOR && IsPlayer()) + static_cast(this)->ClearComboPoints(); break; default: break; @@ -8897,7 +8720,7 @@ void Unit::UpdateReactives(uint32 p_time) Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= nullptr*/, float radius /*= ATTACK_DISTANCE*/, bool inFront /*= false*/, bool isValidAttackTarget /*= false*/) const { - std::list targets; + std::list targets; MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, radius); MaNGOS::UnitListSearcher searcher(targets, u_check); @@ -8908,11 +8731,11 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= nullptr*/, float radiu targets.remove(except); // remove not LoS targets - for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) + for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) { if ((!IsWithinLOSInMap(*tIter)) || (inFront && !this->HasInArc(M_PI_F / 2, *tIter)) || (isValidAttackTarget && !IsValidAttackTarget(*tIter))) { - std::list::iterator tIter2 = tIter; + std::list::iterator tIter2 = tIter; ++tIter; targets.erase(tIter2); } @@ -8926,7 +8749,7 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= nullptr*/, float radiu // select random uint32 rIdx = urand(0, targets.size() - 1); - std::list::const_iterator tcIter = targets.begin(); + std::list::const_iterator tcIter = targets.begin(); for (uint32 i = 0; i < rIdx; ++i) ++tcIter; @@ -8935,7 +8758,7 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= nullptr*/, float radiu Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= nullptr*/, float radius /*= ATTACK_DISTANCE*/, bool inCombat) const { - std::list targets; + std::list targets; MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(this, radius); MaNGOS::UnitListSearcher searcher(targets, u_check); @@ -8947,11 +8770,11 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= nullptr*/, float radius targets.remove(except); // remove not LoS targets - for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) + for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) { - if (!IsWithinLOSInMap(*tIter) || (inCombat && !(*tIter)->isInCombat())) + if (!IsWithinLOSInMap(*tIter) || (inCombat && !(*tIter)->IsInCombat())) { - std::list::iterator tIter2 = tIter; + std::list::iterator tIter2 = tIter; ++tIter; targets.erase(tIter2); } @@ -8965,7 +8788,7 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= nullptr*/, float radius // select random uint32 rIdx = urand(0, targets.size() - 1); - std::list::const_iterator tcIter = targets.begin(); + std::list::const_iterator tcIter = targets.begin(); for (uint32 i = 0; i < rIdx; ++i) ++tcIter; @@ -8975,17 +8798,17 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= nullptr*/, float radius // Returns friendly unit with the most amount of hp missing from max hp Unit* Unit::FindLowestHpFriendlyUnit(float fRange, uint32 uiMinHPDiff, bool bPercent, Unit* except) const { - std::list targets; + std::list targets; - if (Unit* pVictim = getVictim()) + if (Unit* pVictim = GetVictim()) { - HostileReference* pReference = pVictim->getHostileRefManager().getFirst(); + HostileReference* pReference = pVictim->GetHostileRefManager().getFirst(); while (pReference) { if (Unit* pTarget = pReference->getSourceUnit()) { - if (pTarget->isAlive() && IsFriendlyTo(pTarget) && IsWithinDistInMap(pTarget, fRange) && + if (pTarget->IsAlive() && IsFriendlyTo(pTarget) && IsWithinDistInMap(pTarget, fRange) && ((bPercent && (100 - pTarget->GetHealthPercent() > uiMinHPDiff)) || (!bPercent && (pTarget->GetMaxHealth() - pTarget->GetHealth() > uiMinHPDiff)))) { targets.push_back(pTarget); @@ -9016,7 +8839,7 @@ Unit* Unit::FindLowestHpFriendlyUnit(float fRange, uint32 uiMinHPDiff, bool bPer // Returns friendly unit that does not have an aura from the provided spellid Unit* Unit::FindFriendlyUnitMissingBuff(float range, uint32 spellid, Unit* except) const { - std::list targets; + std::list targets; MaNGOS::FriendlyMissingBuffInRangeCheck u_check(this, range, spellid); MaNGOS::UnitListSearcher searcher(targets, u_check); @@ -9067,20 +8890,21 @@ Player* Unit::FindNearestFriendlyPlayer(float range) const return target; } -bool Unit::IsSecondaryThreatTarget() +bool Unit::IsSecondaryThreatTarget() const { // Targets with Fear / Confuse / breakable CC - for (SpellAuraHolderMap::const_iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end(); ++iter) + for (const auto& iter : m_spellAuraHolders) { - if (iter->second->IsTargetSecondaryThreatFocus()) + if (iter.second->IsTargetSecondaryThreatFocus()) return true; } + // Totems have secondary threat priority - if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsTotem()) + if (Creature const* pCreature = ToCreature()) { - if (Totem* totem = ((Totem*)this)) + if (Totem const* pTotem = pCreature->ToTotem()) { - SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(totem->GetSpell()); + SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(pTotem->GetSpell()); if (!spellInfo) return true; @@ -9100,16 +8924,6 @@ bool Unit::IsSecondaryThreatTarget() return false; } -bool Unit::hasNegativeAuraWithInterruptFlag(uint32 flag) -{ - for (SpellAuraHolderMap::const_iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end(); ++iter) - { - if (!iter->second->IsPositive() && iter->second->GetSpellProto()->AuraInterruptFlags & flag) - return true; - } - return false; -} - void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply, bool recalcDamage /*= false*/) { if (val > 0) @@ -9149,40 +8963,30 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply) void Unit::UpdateAuraForGroup(uint8 slot) { - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - Player* player = (Player*)this; - if (player->GetGroup()) + if (pPlayer->GetGroup()) { - player->SetGroupUpdateFlag(slot < MAX_POSITIVE_AURAS ? GROUP_UPDATE_FLAG_AURAS : GROUP_UPDATE_FLAG_AURAS_NEGATIVE); - player->SetAuraUpdateSlot(slot); + pPlayer->SetGroupUpdateFlag(slot < MAX_POSITIVE_AURAS ? GROUP_UPDATE_FLAG_AURAS : GROUP_UPDATE_FLAG_AURAS_NEGATIVE); + pPlayer->SetAuraUpdateSlot(slot); } } - else if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet()) + else if (Pet* pPet = ToPet()) { - Pet *pet = ((Pet*)this); - if (pet->isControlled()) + if (pPet->isControlled()) { - Unit *owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) + if (Player* pOwner = ::ToPlayer(GetOwner())) { - ((Player*)owner)->SetGroupUpdateFlag(slot < MAX_POSITIVE_AURAS ? GROUP_UPDATE_FLAG_PET_AURAS : GROUP_UPDATE_FLAG_PET_AURAS_NEGATIVE); - pet->SetAuraUpdateSlot(slot); + if (pOwner->GetGroup()) + { + pOwner->SetGroupUpdateFlag(slot < MAX_POSITIVE_AURAS ? GROUP_UPDATE_FLAG_PET_AURAS : GROUP_UPDATE_FLAG_PET_AURAS_NEGATIVE); + pPet->SetAuraUpdateSlot(slot); + } } } } } -Aura* Unit::GetDummyAura(uint32 spell_id) const -{ - Unit::AuraList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY); - for (Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr) - if ((*itr)->GetId() == spell_id) - return *itr; - - return nullptr; -} - void Unit::AddPetAura(PetAura const* petSpell) { m_petAuras.insert(petSpell); @@ -9227,7 +9031,7 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, uint32 t { DisableSpline(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, teleportOptions); else { @@ -9333,8 +9137,9 @@ void Unit::SetPvP(bool state) else RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); - if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetGroup()) - ((Player*)this)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_STATUS); + if (Player* pPlayer = ToPlayer()) + if (pPlayer->GetGroup()) + pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_STATUS); CallForAllControlledUnits(SetPvPHelper(state), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM); } @@ -9377,14 +9182,14 @@ void Unit::KnockBack(float angle, float horizontalSpeed, float verticalSpeed) bool Unit::IsPvPContested() const { - if (const Player* thisPlayer = GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Player const* thisPlayer = GetCharmerOrOwnerPlayerOrPlayerItself()) return thisPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); return false; } void Unit::SetPvPContested(bool state) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (state) SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); @@ -9405,21 +9210,21 @@ struct StopAttackFactionHelper void Unit::StopAttackFaction(uint32 faction_id) { - if (Unit* victim = getVictim()) + if (Unit* pVictim = GetVictim()) { - if (victim->getFactionTemplateEntry()->faction == faction_id) + if (pVictim->getFactionTemplateEntry()->faction == faction_id) { AttackStop(); if (IsNonMeleeSpellCasted(false)) InterruptNonMeleeSpells(false); // melee and ranged forced attack cancel - if (GetTypeId() == TYPEID_PLAYER) - ((Player*)this)->SendAttackSwingCancelAttack(); + if (Player* pPlayer = ToPlayer()) + pPlayer->SendAttackSwingCancelAttack(); } } - AttackerSet const& attackers = getAttackers(); + AttackerSet const& attackers = GetAttackers(); for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();) { if ((*itr)->getFactionTemplateEntry()->faction == faction_id) @@ -9431,16 +9236,16 @@ void Unit::StopAttackFaction(uint32 faction_id) ++itr; } - getHostileRefManager().deleteReferencesForFaction(faction_id); + GetHostileRefManager().deleteReferencesForFaction(faction_id); CallForAllControlledUnits(StopAttackFactionHelper(faction_id), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_CHARM); } void Unit::CleanupDeletedAuras() { - for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter) + for (auto& iter : m_deletedHolders) { - if ((*iter)->IsInUse()) + if (iter->IsInUse()) { // Use case: // - Spell damage @@ -9448,25 +9253,25 @@ void Unit::CleanupDeletedAuras() // - Pet::AddObjectToRemoveList // Seen happening with spells like [Health Funnel], [Tainted Blood] ACE_Stack_Trace st; - sLog.outInfo("[Crash/Auras] Deleting aura holder %u in use (%s)", (*iter)->GetId(), GetObjectGuid().GetString().c_str()); + sLog.outInfo("[Crash/Auras] Deleting aura holder %u in use (%s)", iter->GetId(), GetObjectGuid().GetString().c_str()); sLog.outInfo("%s", st.c_str()); } else - delete *iter; + delete iter; } m_deletedHolders.clear(); // really delete auras "deleted" while processing its ApplyModify code - for (AuraList::const_iterator iter = m_deletedAuras.begin(); iter != m_deletedAuras.end(); ++iter) + for (auto& iter : m_deletedAuras) { - if ((*iter)->IsInUse()) + if (iter->IsInUse()) { ACE_Stack_Trace st; - sLog.outInfo("[Crash/Auras] Deleting aura %u in use (%s)", (*iter)->GetId(), GetObjectGuid().GetString().c_str()); + sLog.outInfo("[Crash/Auras] Deleting aura %u in use (%s)", iter->GetId(), GetObjectGuid().GetString().c_str()); sLog.outInfo("%s", st.c_str()); } else - delete *iter; + delete iter; } m_deletedAuras.clear(); } @@ -9493,29 +9298,29 @@ class RelocationNotifyEvent : public BasicEvent public: RelocationNotifyEvent(Unit& owner) : BasicEvent(), m_owner(owner) { - m_owner._SetAINotifyScheduled(true); + m_owner.SetAINotifyScheduled(true); } bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) { float radius = sWorld.getConfig(CONFIG_FLOAT_MAX_CREATURE_ATTACK_RADIUS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CREATURE_AGGRO); - if (m_owner.GetTypeId() == TYPEID_PLAYER) + if (m_owner.IsPlayer()) { MaNGOS::PlayerRelocationNotifier notify((Player&)m_owner); Cell::VisitAllObjects(&m_owner, notify, radius); } - else //if(m_owner.GetTypeId() == TYPEID_UNIT) + else //if(m_owner.IsCreature()) { MaNGOS::CreatureRelocationNotifier notify((Creature&)m_owner); Cell::VisitAllObjects(&m_owner, notify, radius); } - m_owner._SetAINotifyScheduled(false); + m_owner.SetAINotifyScheduled(false); return true; } void Abort(uint64) { - m_owner._SetAINotifyScheduled(false); + m_owner.SetAINotifyScheduled(false); } private: @@ -9573,20 +9378,20 @@ void Unit::InterruptSpellsCastedOnMe(bool killDelayed, bool interruptPositiveSpe MaNGOS::UnitListSearcher searcher(targets, u_check); // Don't need to use visibility modifier, units won't be able to cast outside of draw distance Cell::VisitAllObjects(this, searcher, GetMap()->GetVisibilityDistance()); - for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) + for (const auto& iter : targets) { - if (!interruptPositiveSpells && IsFriendlyTo(*iter)) + if (!interruptPositiveSpells && IsFriendlyTo(iter)) continue; for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) - if (Spell *spell = (*iter)->GetCurrentSpell(CurrentSpellTypes(i))) + if (Spell *spell = iter->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_targets.getUnitTargetGuid() == GetObjectGuid()) if (killDelayed || (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastedTime()) || i == CURRENT_CHANNELED_SPELL) - (*iter)->InterruptSpell(CurrentSpellTypes(i), true); + iter->InterruptSpell(CurrentSpellTypes(i), true); if (!killDelayed) continue; // 2/ Interruption des sorts qui ne sont plus reference, mais dont il reste un event (ceux en parcours par exemple) - auto i_Events = (*iter)->m_Events.GetEvents().begin(); - for (; i_Events != (*iter)->m_Events.GetEvents().end(); ++i_Events) + auto i_Events = iter->m_Events.GetEvents().begin(); + for (; i_Events != iter->m_Events.GetEvents().end(); ++i_Events) if (SpellEvent* event = dynamic_cast(i_Events->second)) if (event && event->GetSpell()->m_targets.getUnitTargetGuid() == GetObjectGuid()) if (event->GetSpell()->getState() != SPELL_STATE_FINISHED) @@ -9606,14 +9411,14 @@ void Unit::InterruptAttacksOnMe(float dist, bool guard_check) MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist); MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(this, searcher, dist); - for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) + for (const auto& iter : targets) { - if ((*iter)->getVictim() != this) + if (iter->GetVictim() != this) continue; - if (guard_check && (*iter)->IsContestedGuard()) + if (guard_check && iter->IsContestedGuard()) continue; - (*iter)->AttackStop(); - if (Player* pAttacker = (*iter)->ToPlayer()) + iter->AttackStop(); + if (Player* pAttacker = iter->ToPlayer()) pAttacker->SendAttackSwingCancelAttack(); } } @@ -9630,8 +9435,8 @@ void Unit::CombatStopInRange(float dist) MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist); MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(this, searcher, dist); - for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) - (*iter)->CombatStopWithPets(true); + for (const auto& iter : targets) + iter->CombatStopWithPets(true); } uint32 Unit::DespawnNearCreaturesByEntry(uint32 entry, float range) @@ -9639,12 +9444,12 @@ uint32 Unit::DespawnNearCreaturesByEntry(uint32 entry, float range) std::list creatures; GetCreatureListWithEntryInGrid(creatures, entry, range); uint32 count = 0; - for (std::list::iterator it = creatures.begin(); it != creatures.end(); ++it) + for (const auto& it : creatures) { - if ((*it)->IsInWorld()) + if (it->IsInWorld()) { ++count; - (*it)->DisappearAndDie(); + it->DisappearAndDie(); } } return count; @@ -9657,39 +9462,18 @@ uint32 Unit::RespawnNearCreaturesByEntry(uint32 entry, float range) uint32 count = 0; std::list lList; GetCreatureListWithEntryInGrid(lList, entry, range); - for (std::list::iterator it = lList.begin(); it != lList.end(); ++it) + for (const auto& it : lList) { - if (!(*it)->isAlive()) + if (!it->IsAlive()) { - (*it)->Respawn(); + it->Respawn(); ++count; } } return count; } - -uint32 Unit::DespawnHostileCreaturesInRange(float range) -{ - if (range == 0.0f) - range = GetMap()->GetVisibilityDistance(); - uint32 count = 0; - std::list targets; - MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, range); - MaNGOS::UnitListSearcher searcher(targets, u_check); - Cell::VisitAllObjects(this, searcher, range); - for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) - { - if ((*iter)->GetTypeId() == TYPEID_UNIT) - { - ++count; - (*iter)->AddObjectToRemoveList(); - } - } - return count; -} - -bool Unit::IsWithinMeleeRange(const Unit *obj, float dist) const +bool Unit::IsWithinMeleeRange(Unit const* obj, float dist) const { if (!obj || !IsInMap(obj)) return false; @@ -9708,7 +9492,7 @@ bool Unit::IsWithinMeleeRange(const Unit *obj, float dist) const } // TriniyCore -void Unit::GetRandomAttackPoint(const Unit* attacker, float &x, float &y, float &z) const +void Unit::GetRandomAttackPoint(Unit const* attacker, float &x, float &y, float &z) const { // Compute random angle float angle = GetAngle(attacker); @@ -9716,11 +9500,11 @@ void Unit::GetRandomAttackPoint(const Unit* attacker, float &x, float &y, float if (sizeFactor < 0.1f) sizeFactor = DEFAULT_COMBAT_REACH; - uint32 attacker_number = getAttackers().size(); + uint32 attacker_number = GetAttackers().size(); if (attacker_number > 0) --attacker_number; // Don't compute a random position for a moving player - if (GetTypeId() == TYPEID_PLAYER && IsMoving()) + if (IsPlayer() && IsMoving()) attacker_number = 0; angle += (attacker_number ? ((float(M_PI / 2) - float(M_PI) * rand_norm_f()) * attacker_number / sizeFactor) * 0.3f : 0); @@ -9729,7 +9513,7 @@ void Unit::GetRandomAttackPoint(const Unit* attacker, float &x, float &y, float GetPosition(initialPosX, initialPosY, initialPosZ); // Moving player: try to interpolate movement a bit - if (GetTypeId() == TYPEID_PLAYER && IsMoving()) + if (IsPlayer() && IsMoving()) if (!ToPlayer()->GetCheatData()->InterpolateMovement(m_movementInfo, 200, initialPosX, initialPosY, initialPosZ, o)) GetPosition(initialPosX, initialPosY, initialPosZ); @@ -9765,7 +9549,7 @@ void Unit::GetRandomAttackPoint(const Unit* attacker, float &x, float &y, float else { uint32 nav = NAV_GROUND | NAV_WATER; - if (attacker->GetTypeId() != TYPEID_PLAYER) + if (!attacker->IsPlayer()) nav |= NAV_MAGMA | NAV_SLIME; // Try mmaps. On fail, use target position (but should not fail) if (!GetMap()->GetWalkHitPosition(GetTransport(), initialPosX, initialPosY, initialPosZ, x, y, z, nav)) @@ -9845,7 +9629,7 @@ Unit* Unit::SummonCreatureAndAttack(uint32 creatureEntry, Unit* pVictim) summonAng = GetOrientation(); if (!pVictim) - if (!(pVictim = getVictim())) + if (!(pVictim = GetVictim())) return nullptr; if (Creature *pCreature = SummonCreature(creatureEntry, summonX, summonY, summonZ, summonAng, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 25000)) @@ -9857,13 +9641,13 @@ Unit* Unit::SummonCreatureAndAttack(uint32 creatureEntry, Unit* pVictim) return nullptr; } -bool Unit::IsCaster() +bool Unit::IsCaster() const { // Cast en cours : on est casteur. if (IsNonMeleeSpellCasted(true, false, true)) return true; - switch (getClass()) + switch (GetClass()) { case CLASS_WARRIOR: case CLASS_ROGUE: @@ -9889,9 +9673,9 @@ bool Unit::IsCaster() } } -bool Unit::isAttackableByAOE(bool requireDeadTarget, bool isCasterPlayer) const +bool Unit::IsAttackableByAOE(bool requireDeadTarget, bool isCasterPlayer) const { - if (isAlive() == requireDeadTarget) + if (IsAlive() == requireDeadTarget) return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) @@ -9900,8 +9684,9 @@ bool Unit::isAttackableByAOE(bool requireDeadTarget, bool isCasterPlayer) const if (isCasterPlayer && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER)) return false; - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster()) - return false; + if (Player const* pPlayer = ToPlayer()) + if (pPlayer->IsGameMaster()) + return false; return true; } @@ -9911,9 +9696,9 @@ bool Unit::IsImmuneToSchoolMask(uint32 schoolMask) const AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY); uint32 immuneMask = 0; - for (AuraList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr) + for (const auto& itr : immune) { - immuneMask |= (*itr)->GetModifier()->m_miscvalue; + immuneMask |= itr->GetModifier()->m_miscvalue; if (immuneMask & schoolMask) // Immunise return true; } @@ -9929,25 +9714,20 @@ void Unit::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) m_prohibitSpell.push_back(inf); } -bool Unit::IsSpellProhibited(SpellEntry const* pSpell) +bool Unit::IsSpellProhibited(SpellEntry const* pSpell) const { uint32 spellSchoolMask = pSpell->GetSpellSchoolMask(); - for (ProhibitSpellList::const_iterator it = m_prohibitSpell.begin(); it != m_prohibitSpell.end(); ++it) + for (const auto& it : m_prohibitSpell) { - if (it->SchoolMask & spellSchoolMask) + if (it.SchoolMask & spellSchoolMask) return true; } return false; } -bool Unit::HasProhibitedSpell() -{ - return (m_prohibitSpell.size() > 0); -} - CreatureAI* Unit::AI() const { - return GetTypeId() == TYPEID_UNIT ? ((Creature*)this)->AI() : nullptr; + return IsCreature() ? ((Creature*)this)->AI() : nullptr; } SpellAuraHolder* Unit::AddAura(uint32 spellId, uint32 addAuraFlags, Unit* pCaster) @@ -10013,19 +9793,19 @@ SpellAuraHolder* Unit::RefreshAura(uint32 spellId, int32 duration) return nullptr; } -bool Unit::HasMorePowerfullSpellActive(SpellEntry const* spell) +bool Unit::HasMorePowerfulSpellActive(SpellEntry const* spell) const { std::list morePowerfullSpells; if (!sSpellMgr.ListMorePowerfullSpells(spell->Id, morePowerfullSpells)) return false; - for (SpellAuraHolderMap::const_iterator i = m_spellAuraHolders.begin(); i != m_spellAuraHolders.end(); ++i) - for (std::list::const_iterator it = morePowerfullSpells.begin(); it != morePowerfullSpells.end(); ++it) - if ((*it) == i->first) + for (const auto& i : m_spellAuraHolders) + for (const auto& it : morePowerfullSpells) + if (it == i.first) return true; return false; } -Aura* Unit::GetMostImportantAuraAfter(Aura const* like, Aura const* except) +Aura* Unit::GetMostImportantAuraAfter(Aura const* like, Aura const* except) const { ASSERT(like); AuraType auraName = like->GetModifier()->m_auraname; @@ -10041,31 +9821,31 @@ Aura* Unit::GetMostImportantAuraAfter(Aura const* like, Aura const* except) } Aura* currMostImportant = nullptr; - for (AuraList::iterator iter = m_modAuras[auraName].begin(); iter != m_modAuras[auraName].end(); ++iter) + for (const auto& iter : m_modAuras[auraName]) { - if (!(*iter)->IsExclusive() || (*iter) == except) + if (!iter->IsExclusive() || iter == except) continue; if (!currMostImportant) { - int checkResult = (*iter)->CheckExclusiveWith(like); - // On veut un aura de meme type que 'like'. Osef qu'il soit mieux ou moins bien ici. + int checkResult = iter->CheckExclusiveWith(like); + // We want an aura of the same type as 'like'. if (checkResult > 0) - currMostImportant = (*iter); + currMostImportant = iter; } else { - int checkResult = (*iter)->CheckExclusiveWith(currMostImportant); - // '*iter' doit etre mieux que 'currMostImportant' + int checkResult = iter->CheckExclusiveWith(currMostImportant); + // 'iter' should be better than 'currMostImportant' if (checkResult == 1) - currMostImportant = (*iter); + currMostImportant = iter; } } if (currMostImportant) { - // A-t-on trouve ce qu'il faut ? - // Different de 'except' + // Have we found what we need ? + // Different from 'except' ASSERT(currMostImportant != except); - // Et de meme type que 'like'. + // And of the same type as 'like'. ASSERT(currMostImportant->CheckExclusiveWith(like) > 0); } return currMostImportant; @@ -10105,7 +9885,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff) if (!MaNGOS::IsValidMapCoord(loc.x, loc.y, loc.z)) return; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ((Player*)this)->SetPosition(loc.x, loc.y, loc.z, loc.orientation); else GetMap()->CreatureRelocation((Creature*)this, loc.x, loc.y, loc.z, loc.orientation); @@ -10122,9 +9902,9 @@ void Unit::SetWalk(bool enable, bool asDefault) if (asDefault) { if (enable) - clearUnitState(UNIT_STAT_RUNNING); + ClearUnitState(UNIT_STAT_RUNNING); else - addUnitState(UNIT_STAT_RUNNING); + AddUnitState(UNIT_STAT_RUNNING); } if (enable == m_movementInfo.HasMovementFlag(MOVEFLAG_WALK_MODE)) @@ -10157,7 +9937,7 @@ void Unit::DisableSpline() } -void Unit::SendSpellGo(Unit* target, uint32 spellId) +void Unit::SendSpellGo(Unit* target, uint32 spellId) const { SpellCastTargets targets; targets.setUnitTarget(target); @@ -10191,8 +9971,8 @@ void Unit::SendPlaySpellVisual(uint32 id) const } #define PRELOAD if (this == unit) return true; \ -const Unit* u1 = GetCharmerOrOwnerOrSelf(); \ -const Unit* u2 = unit->GetCharmerOrOwnerOrSelf(); \ +Unit const* u1 = GetCharmerOrOwnerOrSelf(); \ +Unit const* u2 = unit->GetCharmerOrOwnerOrSelf(); \ if (u1 == u2) return true; @@ -10216,18 +9996,17 @@ void Unit::Debug(uint32 flags, const char* format, ...) const { if (!format) return; - if (!(flags & _debugFlags)) + if (!(flags & m_debugFlags)) return; - if (_debuggerGuid.IsEmpty()) + if (m_debuggerGuid.IsEmpty()) return; if (!IsInWorld() || !FindMap()) return; - Player* player = FindMap()->GetPlayer(_debuggerGuid); + Player* player = FindMap()->GetPlayer(m_debuggerGuid); if (!player) { - Unit* me = (Unit*)this; - me->_debuggerGuid.Clear(); - me->_debugFlags = 0; + m_debuggerGuid.Clear(); + m_debugFlags = 0; return; } va_list ap; @@ -10249,33 +10028,26 @@ public: if (!unit->IsValidAttackTarget(_to)) return; - if (unit->getThreatManager().getThreat(_from) > 0.1f) - unit->AddThreat(_to, unit->getThreatManager().getThreat(_from)); - else if (unit->getVictim() == _from && unit->AI()) // Si on aggro sans faire de degat + if (unit->GetThreatManager().getThreat(_from) > 0.1f) + unit->AddThreat(_to, unit->GetThreatManager().getThreat(_from)); + else if (unit->GetVictim() == _from && unit->AI()) // Si on aggro sans faire de degat unit->AI()->AttackStart(_to); else return; - unit->getThreatManager().modifyThreatPercent(_from, -100); + unit->GetThreatManager().modifyThreatPercent(_from, -100); } protected: Unit* _from; Unit* _to; }; -void Unit::TransferAttackersThreatTo(Unit* unit) -{ - ThreatTransferDo u_do(this, unit); - MaNGOS::CreatureWorker worker(this, u_do); - Cell::VisitGridObjects(this, worker, 50.0f); -} - void Unit::RemoveAttackersThreat(Unit* owner) { - for (AttackerSet::iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) + for (const auto& itr : m_attackers) { - (*itr)->getThreatManager().modifyThreatPercent(this, -100); + itr->GetThreatManager().modifyThreatPercent(this, -100); if (owner) - (*itr)->AddThreat(owner, 1.0f); + itr->AddThreat(owner, 1.0f); } } @@ -10294,9 +10066,9 @@ bool Unit::HasAuraPetShouldAvoidBreaking(Unit* excludeCasterChannel) const bool Unit::HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const { AuraList const& auras = GetAurasByType(type); - for (AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - if ((!excludeAura || excludeAura != (*itr)->GetSpellProto()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction - ((*itr)->GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE)) + for (const auto& itr : auras) + if ((!excludeAura || excludeAura != itr->GetSpellProto()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction + (itr->GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE)) return true; return false; } @@ -10322,7 +10094,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_STAT_FLEEING | UNIT_STAT_CONFUSED)); // Inform myself if (mePlayer) { @@ -10330,10 +10102,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_STAT_FLEEING | UNIT_STAT_CONFUSED)); return; } - mePlayer->SetClientControl(mePlayer, !hasUnitState(UNIT_STAT_POSSESSED | UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED) && !GetCharmerGuid()); + mePlayer->SetClientControl(mePlayer, !HasUnitState(UNIT_STAT_POSSESSED | UNIT_STAT_FLEEING | UNIT_STAT_CONFUSED) && !GetCharmerGuid()); } } @@ -10344,7 +10116,7 @@ Unit* Unit::SelectNearestTarget(float dist) const Cell cell(p); cell.SetNoCreate(); - Unit *target = nullptr; + Unit* target = nullptr; if (dist == 0.0f || dist > MAX_VISIBILITY_DISTANCE) dist = MAX_VISIBILITY_DISTANCE; @@ -10363,26 +10135,26 @@ Unit* Unit::SelectNearestTarget(float dist) const float Unit::GetMinChaseDistance(Unit* victim) const { - if (_casterChaseDistance > 1.0f) - return _casterChaseDistance; + if (m_casterChaseDistance > 1.0f) + return m_casterChaseDistance; return GetObjectBoundingRadius(); } float Unit::GetMaxChaseDistance(Unit* victim) const { - if (_casterChaseDistance > 1.0f) - return _casterChaseDistance + GetObjectBoundingRadius() + victim->GetObjectBoundingRadius(); + if (m_casterChaseDistance > 1.0f) + return m_casterChaseDistance + GetObjectBoundingRadius() + victim->GetObjectBoundingRadius(); return GetMeleeReach() + BASE_MELEERANGE_OFFSET; } void Unit::RestoreMovement() { - if (GetTypeId() != TYPEID_UNIT) + 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_STAT_CONFUSED | UNIT_STAT_FLEEING)) { - if (Unit * victim = getVictim()) + if (Unit* victim = GetVictim()) GetMotionMaster()->MoveChase(victim); else GetMotionMaster()->Initialize(); @@ -10403,28 +10175,12 @@ bool Unit::HasSpellCategoryCooldown(uint32 cat) const { if (!cat) return false; - for (SpellCooldowns::const_iterator it = m_spellCooldowns.begin(); it != m_spellCooldowns.end(); ++it) - if (it->second.cat == cat && it->second.categoryEnd > time(nullptr)) + for (const auto& it : m_spellCooldowns) + if (it.second.cat == cat && it.second.categoryEnd > time(nullptr)) return true; return false; } -void Unit::RemoveSpellCategoryCooldown(uint32 cat, bool update /* = false */) -{ - SpellCategoriesStore::const_iterator ct = sSpellCategoriesStore.find(cat); - if (ct == sSpellCategoriesStore.end()) - return; - - const SpellCategorySet& ct_set = ct->second; - for (SpellCooldowns::const_iterator i = m_spellCooldowns.begin(); i != m_spellCooldowns.end();) - { - if (ct_set.find(i->first) != ct_set.end()) - RemoveSpellCooldown((i++)->first, update); - else - ++i; - } -} - void Unit::RemoveAllSpellCooldown() { if (!m_spellCooldowns.empty()) @@ -10436,7 +10192,7 @@ void Unit::RemoveAllSpellCooldown() } } -void Unit::setTransformScale(float scale) +void Unit::SetTransformScale(float scale) { if (!scale) { @@ -10447,19 +10203,19 @@ void Unit::setTransformScale(float scale) m_nativeScaleOverride = scale; } -void Unit::resetTransformScale() +void Unit::ResetTransformScale() { - setTransformScale(getNativeScale()); + SetTransformScale(GetNativeScale()); } -float Unit::getNativeScale() const +float Unit::GetNativeScale() const { return m_nativeScale; } -void Unit::setNativeScale(float scale) +void Unit::SetNativeScale(float scale) { - setTransformScale(scale); + SetTransformScale(scale); m_nativeScale = scale; } @@ -10555,7 +10311,7 @@ void Unit::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 item if (catrec < 0) catrec = 0; // Hackfix: minimum cooldown for controlled creatures - if (!rec && !catrec && GetTypeId() == TYPEID_UNIT && GetCharmerGuid().IsPlayer()) + if (!rec && !catrec && IsCreature() && GetCharmerGuid().IsPlayer()) rec = 1500; // Global cooldown // no cooldown after applying spell mods @@ -10589,33 +10345,31 @@ void Unit::AddSpellCooldown(uint32 spellid, uint32 itemid, time_t endTime, time_ m_spellCooldowns[spellid] = sc; } - -void Unit::WritePetSpellsCooldown(WorldPacket& data) +void Unit::WritePetSpellsCooldown(WorldPacket& data) const { uint8 cooldownsCount = GetSpellCooldownMap().size(); data << uint8(cooldownsCount); time_t curTime = time(nullptr); - for (SpellCooldowns::const_iterator itr = GetSpellCooldownMap().begin(); itr != GetSpellCooldownMap().end(); ++itr) + for (const auto& itr : GetSpellCooldownMap()) { //time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0; - data << uint16(itr->first); // spellid + data << uint16(itr.first); // spellid data << uint16(0); // spell category? - data << uint32(IN_MILLISECONDS * (itr->second.end - curTime)); // cooldown + data << uint32(IN_MILLISECONDS * (itr.second.end - curTime)); // cooldown data << uint32(0); // category cooldown } } - void Unit::InitPlayerDisplayIds() { - PlayerInfo const *info = sObjectMgr.GetPlayerInfo(getRace(), getClass()); + PlayerInfo const *info = sObjectMgr.GetPlayerInfo(GetRace(), GetClass()); if (!info) return; - uint8 gender = getGender(); + uint8 gender = GetGender(); SetObjectScale(DEFAULT_OBJECT_SCALE); switch (gender) @@ -10623,14 +10377,14 @@ void Unit::InitPlayerDisplayIds() case GENDER_FEMALE: SetNativeDisplayId(info->displayId_f); SetDisplayId(info->displayId_f); - if (getRace() == RACE_TAUREN) - setNativeScale(DEFAULT_TAUREN_FEMALE_SCALE); + if (GetRace() == RACE_TAUREN) + SetNativeScale(DEFAULT_TAUREN_FEMALE_SCALE); break; case GENDER_MALE: SetNativeDisplayId(info->displayId_m); SetDisplayId(info->displayId_m); - if (getRace() == RACE_TAUREN) - setNativeScale(DEFAULT_TAUREN_MALE_SCALE); + if (GetRace() == RACE_TAUREN) + SetNativeScale(DEFAULT_TAUREN_MALE_SCALE); break; default: return; diff --git a/src/game/Objects/Unit.h b/src/game/Objects/Unit.h index 4dfc925d4..622d9ba24 100644 --- a/src/game/Objects/Unit.h +++ b/src/game/Objects/Unit.h @@ -24,6 +24,7 @@ #include "Common.h" #include "Object.h" +#include "UnitDefines.h" #include "Opcodes.h" #include "SpellAuraDefines.h" #include "UpdateFields.h" @@ -34,46 +35,30 @@ #include "FollowerRefManager.h" #include "MotionMaster.h" #include "DBCStructure.h" -#include "Path.h" -#include "WorldPacket.h" #include "Timer.h" #include -enum UnitMoveType + +struct FactionTemplateEntry; +struct Modifier; + +class WorldPacket; +class SpellEntry; +class Aura; +class SpellAuraHolder; +class Creature; +class Spell; +class GameObject; +class Item; +class Pet; +class PetAura; +class Totem; +class CreatureAI; + +namespace Movement { - MOVE_WALK = 0, - MOVE_RUN = 1, - MOVE_RUN_BACK = 2, - MOVE_SWIM = 3, - MOVE_SWIM_BACK = 4, - MOVE_TURN_RATE = 5, -}; - -#define MAX_MOVE_TYPE 6 - -extern float baseMoveSpeed[MAX_MOVE_TYPE]; - -#define MOVEMENT_PACKET_TIME_DELAY 0 - -enum MovementChangeType -{ - INVALID, - - ROOT, - WATER_WALK, - SET_HOVER, - FEATHER_FALL, - - SPEED_CHANGE_WALK, - SPEED_CHANGE_RUN, - SPEED_CHANGE_RUN_BACK, - SPEED_CHANGE_SWIM, - SPEED_CHANGE_SWIM_BACK, - RATE_CHANGE_TURN, - - //TELEPORT, - not used - KNOCK_BACK -}; + class MoveSpline; +} struct PlayerMovementPendingChange { @@ -96,508 +81,6 @@ struct PlayerMovementPendingChange PlayerMovementPendingChange(); }; -enum SpellInterruptFlags -{ - SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01, - SPELL_INTERRUPT_FLAG_DAMAGE = 0x02, - SPELL_INTERRUPT_FLAG_INTERRUPT = 0x04, - SPELL_INTERRUPT_FLAG_AUTOATTACK = 0x08, - SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10, // _complete_ interrupt on direct damage -}; - -enum SpellChannelInterruptFlags -{ - CHANNEL_FLAG_ENTER_COMBAT = 0x0001, // Nostalrius: guessed - CHANNEL_FLAG_DAMAGE = 0x0002, - CHANNEL_FLAG_INTERRUPT = 0x0004, - CHANNEL_FLAG_MOVEMENT = 0x0008, - CHANNEL_FLAG_TURNING = 0x0010, - CHANNEL_FLAG_DAMAGE2 = 0x0080, - CHANNEL_FLAG_DELAY = 0x4000 -}; - -enum SpellAuraInterruptFlags -{ - // Certains ont ete repris de TrinityCore (3.3.5) - // ATTENTION: Tous ne sont pas encore implementes. - // TC: Par exemple buff BG restauration - AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell? - AURA_INTERRUPT_FLAG_DAMAGE = 0x00000002, // 1 removed by any damage - // Non implemente - AURA_INTERRUPT_FLAG_CAST = 0x00000004, // 2 - AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement - AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning - AURA_INTERRUPT_FLAG_ENTER_COMBAT = 0x00000020, // 5 removed by entering combat - Feign death only - AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by unmounting - AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water - AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water - AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing - AURA_INTERRUPT_FLAG_TALK = 0x00000400, // 10 on interact with NPC (gossip, trainer, stable pet ...) - implemented - AURA_INTERRUPT_FLAG_USE = 0x00000800, // 11 on interact with GO - implement - // TC - implemente - AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by attack? - // TC - non implemente - AURA_INTERRUPT_FLAG_SPELL_ATTACK = 0x00002000, // 13 - AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14 unused in 1.12 - // TC - non implemente - AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by casting a spell? - AURA_INTERRUPT_FLAG_ON_CAST_SPELL = 0x00010000, // 16 - AURA_INTERRUPT_FLAG_MOUNTING = 0x00020000, // 17 removed by mounting - AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up (used by food and drink mostly and sleep/Fake Death like) - AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported - AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION = 0x00100000, // 20 removed by auras that make you invulnerable, or make other to loose selection on you - AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21 - AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22 - // TC - non implemente (9 sorts) - AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat - AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000 // 24 removed by any direct damage -}; - -enum SpellModOp -{ - SPELLMOD_DAMAGE = 0, - SPELLMOD_DURATION = 1, - SPELLMOD_THREAT = 2, - SPELLMOD_ATTACK_POWER = 3, - SPELLMOD_CHARGES = 4, - SPELLMOD_RANGE = 5, - SPELLMOD_RADIUS = 6, - SPELLMOD_CRITICAL_CHANCE = 7, - SPELLMOD_ALL_EFFECTS = 8, - SPELLMOD_NOT_LOSE_CASTING_TIME = 9, - SPELLMOD_CASTING_TIME = 10, - SPELLMOD_COOLDOWN = 11, - SPELLMOD_SPEED = 12, - SPELLMOD_COST = 14, - SPELLMOD_CRIT_DAMAGE_BONUS = 15, - SPELLMOD_RESIST_MISS_CHANCE = 16, - SPELLMOD_JUMP_TARGETS = 17, - SPELLMOD_CHANCE_OF_SUCCESS = 18, // Only used with SPELL_AURA_ADD_FLAT_MODIFIER and affects proc spells - SPELLMOD_ACTIVATION_TIME = 19, - SPELLMOD_EFFECT_PAST_FIRST = 20, - SPELLMOD_CASTING_TIME_OLD = 21, - SPELLMOD_DOT = 22, - SPELLMOD_HASTE = 23, - SPELLMOD_SPELL_BONUS_DAMAGE = 24, - SPELLMOD_MULTIPLE_VALUE = 27, - SPELLMOD_RESIST_DISPEL_CHANCE = 28, - MAX_SPELLMOD = 29, -}; - -enum SpellFacingFlags -{ - SPELL_FACING_FLAG_INFRONT = 0x0001 -}; - -#define BASE_MELEERANGE_OFFSET 1.33f -#define BASE_MINDAMAGE 1.0f -#define BASE_MAXDAMAGE 2.0f -#define BASE_ATTACK_TIME 2000 - -// byte value (UNIT_FIELD_BYTES_1,0) -enum UnitStandStateType -{ - UNIT_STAND_STATE_STAND = 0, - UNIT_STAND_STATE_SIT = 1, - UNIT_STAND_STATE_SIT_CHAIR = 2, - UNIT_STAND_STATE_SLEEP = 3, - UNIT_STAND_STATE_SIT_LOW_CHAIR = 4, - UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5, - UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6, - UNIT_STAND_STATE_DEAD = 7, - UNIT_STAND_STATE_KNEEL = 8 -}; - -#define MAX_UNIT_STAND_STATE 9 - -/* byte flag value not exist in 1.12, moved/merged in (UNIT_FIELD_BYTES_1,3), in post-1.x it's in (UNIT_FIELD_BYTES_1,2) -enum UnitStandFlags -*/ - -// byte flags value (UNIT_FIELD_BYTES_1,3) -enum UnitBytes1_Flags -{ - UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01, // Ajoute a la mort. Non affichage du nom des vivants. - UNIT_BYTE1_FLAGS_CREEP = 0x02, - UNIT_BYTE1_FLAG_UNTRACKABLE = 0x04, - UNIT_BYTE1_FLAG_ALL = 0xFF -}; - -// byte value (UNIT_FIELD_BYTES_2,0) -enum SheathState -{ - SHEATH_STATE_UNARMED = 0, // non prepared weapon - SHEATH_STATE_MELEE = 1, // prepared melee weapon - SHEATH_STATE_RANGED = 2 // prepared ranged weapon -}; - -#define MAX_SHEATH_STATE 3 - -// byte flags value (UNIT_FIELD_BYTES_2,1) -enum UnitBytes2_Flags -{ - UNIT_BYTE2_FLAG_PVP = 0x01, - UNIT_BYTE2_FLAG_UNK1 = 0x02, - UNIT_BYTE2_FLAG_FFA_PVP = 0x04, - UNIT_BYTE2_FLAG_UNK3 = 0x08, // FLAG_SANCTUARY on 3.3.5 - UNIT_BYTE2_FLAG_AURAS = 0x10, // show possitive auras as positive, and allow its dispel - UNIT_BYTE2_FLAG_UNK5 = 0x20, - UNIT_BYTE2_FLAG_UNK6 = 0x40, - UNIT_BYTE2_FLAG_UNK7 = 0x80 -}; - -#define CREATURE_MAX_SPELLS 4 - -enum Swing -{ - NOSWING = 0, - SINGLEHANDEDSWING = 1, - TWOHANDEDSWING = 2 -}; - -enum VictimState -{ - VICTIMSTATE_UNAFFECTED = 0, // seen in relation with HITINFO_MISS - VICTIMSTATE_NORMAL = 1, - VICTIMSTATE_DODGE = 2, - VICTIMSTATE_PARRY = 3, - VICTIMSTATE_INTERRUPT = 4, - VICTIMSTATE_BLOCKS = 5, - VICTIMSTATE_EVADES = 6, - VICTIMSTATE_IS_IMMUNE = 7, - VICTIMSTATE_DEFLECTS = 8 -}; - -enum HitInfo -{ - HITINFO_NORMALSWING = 0x00000000, - HITINFO_UNK0 = 0x00000001, // req correct packet structure - HITINFO_NORMALSWING2 = 0x00000002, - HITINFO_LEFTSWING = 0x00000004, - HITINFO_UNK3 = 0x00000008, - HITINFO_MISS = 0x00000010, - HITINFO_ABSORB = 0x00000020, // plays absorb sound - HITINFO_RESIST = 0x00000040, // resisted atleast some damage -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 - HITINFO_CRITICALHIT = 0x00000080, -#else - HITINFO_CRITICALHIT = 0x00000008, -#endif - HITINFO_UNK8 = 0x00000100, // wotlk? - HITINFO_UNK9 = 0x00002000, // wotlk? - HITINFO_GLANCING = 0x00004000, - HITINFO_CRUSHING = 0x00008000, - HITINFO_NOACTION = 0x00010000, - HITINFO_SWINGNOHITSOUND = 0x00080000 -}; - -//i would like to remove this: (it is defined in item.h -enum InventorySlot -{ - NULL_BAG = 0, - NULL_SLOT = 255 -}; - -struct FactionTemplateEntry; -struct Modifier; -class SpellEntry; - -class Aura; -class SpellAuraHolder; -class Creature; -class Spell; -class GameObject; -class Item; -class Pet; -class PetAura; -class Totem; -class CreatureAI; - -struct SpellImmune -{ - uint32 type; - uint32 spellId; -}; - -typedef std::list SpellImmuneList; - -enum UnitModifierType -{ - BASE_VALUE = 0, - BASE_PCT = 1, - TOTAL_VALUE = 2, - TOTAL_PCT = 3, - MODIFIER_TYPE_END = 4 -}; - -enum WeaponDamageRange -{ - MINDAMAGE, - MAXDAMAGE -}; - -struct WeaponDamageInfo -{ - float damage[2]; - SpellSchools school; -}; - -enum DamageTypeToSchool -{ - RESISTANCE, - DAMAGE_DEALT, - DAMAGE_TAKEN -}; - -enum AuraRemoveMode -{ - AURA_REMOVE_BY_DEFAULT, - AURA_REMOVE_BY_STACK, // at replace by similar aura - AURA_REMOVE_BY_CANCEL, - AURA_REMOVE_BY_DISPEL, - AURA_REMOVE_BY_DEATH, - AURA_REMOVE_BY_DELETE, // use for speedup and prevent unexpected effects at player logout/pet unsummon (must be used _only_ after save), delete. - AURA_REMOVE_BY_SHIELD_BREAK, // when absorb shield is removed by damage - AURA_REMOVE_BY_EXPIRE, // at duration end - AURA_REMOVE_BY_CHANNEL, // when removing an aura due to channel finish or cancel - AURA_REMOVE_BY_RANGE, // when removing an area aura due to being out of range - AURA_REMOVE_BY_GROUP // when removing an aura due to not being in the same group (includes pet ownership) -}; - -enum UnitMods -{ - UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existing order, it's accessed by index values of Stats enum. - UNIT_MOD_STAT_AGILITY, - UNIT_MOD_STAT_STAMINA, - UNIT_MOD_STAT_INTELLECT, - UNIT_MOD_STAT_SPIRIT, - UNIT_MOD_HEALTH, - UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_HAPPINESS must be in existing order, it's accessed by index values of Powers enum. - UNIT_MOD_RAGE, - UNIT_MOD_FOCUS, - UNIT_MOD_ENERGY, - UNIT_MOD_HAPPINESS, - UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum. - UNIT_MOD_RESISTANCE_HOLY, - UNIT_MOD_RESISTANCE_FIRE, - UNIT_MOD_RESISTANCE_NATURE, - UNIT_MOD_RESISTANCE_FROST, - UNIT_MOD_RESISTANCE_SHADOW, - UNIT_MOD_RESISTANCE_ARCANE, - UNIT_MOD_ATTACK_POWER, - UNIT_MOD_ATTACK_POWER_RANGED, - UNIT_MOD_DAMAGE_MAINHAND, - UNIT_MOD_DAMAGE_OFFHAND, - UNIT_MOD_DAMAGE_RANGED, - UNIT_MOD_DAMAGE_PHYSICAL, - UNIT_MOD_END, - // synonyms - UNIT_MOD_STAT_START = UNIT_MOD_STAT_STRENGTH, - UNIT_MOD_STAT_END = UNIT_MOD_STAT_SPIRIT + 1, - UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR, - UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1, - UNIT_MOD_POWER_START = UNIT_MOD_MANA, - UNIT_MOD_POWER_END = UNIT_MOD_HAPPINESS + 1 -}; - -enum BaseModGroup -{ - CRIT_PERCENTAGE, - RANGED_CRIT_PERCENTAGE, - OFFHAND_CRIT_PERCENTAGE, - SHIELD_BLOCK_VALUE, - BASEMOD_END -}; - -enum BaseModType -{ - FLAT_MOD, - PCT_MOD -}; - -#define MOD_END (PCT_MOD+1) - -enum DeathState -{ - ALIVE = 0, // show as alive - JUST_DIED = 1, // temporary state at die, for creature auto converted to CORPSE, for player at next update call - CORPSE = 2, // corpse state, for player spirit is still within the corpse - DEAD = 3, // for creature despawned state (corpse despawned), for player spirit has been released (player is ghost) - JUST_ALIVED = 4, // temporary state at resurrection, for creature auto converted to ALIVE, for player at next update call - CORPSE_FALLING = 5 // corpse state in case when corpse still falling to ground -}; - -// internal state flags for some auras and movement generators, other. -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_DIED = 0x00000004, // Unit::SetFeignDeath - 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 - - // 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 - - // 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_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, - // MMAPS - UNIT_STAT_IGNORE_PATHFINDING = 0x00080000, // do not use pathfinding in any MovementGenerator - - UNIT_STAT_PENDING_ROOT = 0x00100000, - UNIT_STAT_PENDING_STUNNED = 0x00200000, - UNIT_STAT_FLYING_ALLOWED = 0x00400000, // has gm fly mode enabled - - // High-level states - UNIT_STAT_NO_COMBAT_MOVEMENT = 0x01000000, - UNIT_STAT_RUNNING = 0x02000000, - UNIT_STAT_IGNORE_MOVE_LOS = 0x04000000, - - UNIT_STAT_ALLOW_INCOMPLETE_PATH = 0x08000000, // allow movement with incomplete or partial paths - UNIT_STAT_ALLOW_LOS_ATTACK = 0x10000000, // allow melee attacks without LoS - // masks (only for check) - - // can't move currently - UNIT_STAT_CAN_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED, - - // stay by different reasons - UNIT_STAT_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED | - UNIT_STAT_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_DIED | - UNIT_STAT_TAXI_FLIGHT | - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, - - // not react at move in sight or other - UNIT_STAT_CAN_NOT_REACT = UNIT_STAT_STUNNED | UNIT_STAT_DIED | - UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, - - // AI disabled by some reason - UNIT_STAT_LOST_CONTROL = UNIT_STAT_FLEEING | UNIT_STAT_POSSESSED, - - // above 2 state cases - UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL = UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_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_STAT_ALL_STATE = 0xFFFFFFFF, - UNIT_STAT_ALL_DYN_STATES = UNIT_STAT_ALL_STATE & ~(UNIT_STAT_NO_COMBAT_MOVEMENT | UNIT_STAT_RUNNING | UNIT_STAT_IGNORE_PATHFINDING), -}; - -/// internal used flags for marking special auras - for example some dummy-auras -enum UnitAuraFlags -{ - UNIT_AURAFLAG_ALIVE_INVISIBLE = 0x1, // aura which makes unit invisible for alive -}; - -enum UnitVisibility -{ - VISIBILITY_OFF = 0, // absolute, not detectable, GM-like, can see all other - VISIBILITY_ON = 1, - VISIBILITY_GROUP_STEALTH = 2, // detect chance, seen and can see group members - VISIBILITY_GROUP_INVISIBILITY = 3, // invisibility, can see and can be seen only another invisible unit or invisible detection unit, set only if not stealthed, and in checks not used (mask used instead) - VISIBILITY_GROUP_NO_DETECT = 4, // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break - VISIBILITY_RESPAWN = 5 // special totally not detectable visibility for force delete object at respawn command -}; - -// [-ZERO] Need recheck values -// Value masks for UNIT_FIELD_FLAGS -enum UnitFlags -{ - UNIT_FLAG_NONE = 0x00000000, - UNIT_FLAG_UNK_0 = 0x00000001, // Movement checks disabled, likely paired with loss of client control packet. - UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable - UNIT_FLAG_DISABLE_MOVE = 0x00000004, - UNIT_FLAG_PLAYER_CONTROLLED = 0x00000008, // players, pets, totems, guardians, companions, charms, any units associated with players - UNIT_FLAG_PET_RENAME = 0x00000010, // Old pet rename: moved to UNIT_FIELD_BYTES_2,2 in TBC+ - UNIT_FLAG_PET_ABANDON = 0x00000020, // Old pet abandon: moved to UNIT_FIELD_BYTES_2,2 in TBC+ - UNIT_FLAG_UNK_6 = 0x00000040, - UNIT_FLAG_IMMUNE_TO_PLAYER = 0x00000100, // Target is immune to players - UNIT_FLAG_PASSIVE = 0x00000200, // makes you unable to attack everything. Almost identical to our "civilian"-term. Will ignore it's surroundings and not engage in combat unless "called upon" or engaged by another unit. - UNIT_FLAG_PVP = 0x00001000, - UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1 - UNIT_FLAG_UNK_14 = 0x00004000, - UNIT_FLAG_USE_SWIM_ANIMATION = 0x00008000, - UNIT_FLAG_NON_ATTACKABLE_2 = 0x00010000, // removes attackable icon, if on yourself, cannot assist self but can cast TARGET_UNIT_CASTER spells - added by SPELL_AURA_MOD_UNATTACKABLE - UNIT_FLAG_PACIFIED = 0x00020000, - UNIT_FLAG_STUNNED = 0x00040000, // Unit is a subject to stun, turn and strafe movement disabled - UNIT_FLAG_IN_COMBAT = 0x00080000, - UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // Unit is on taxi, paired with a duplicate loss of client control packet (likely a legacy serverside hack). Disables any spellcasts not allowed in taxi flight client-side. - UNIT_FLAG_CONFUSED = 0x00400000, // Unit is a subject to confused movement, movement checks disabled, paired with loss of client control packet. - UNIT_FLAG_FLEEING = 0x00800000, // Unit is a subject to fleeing movement, movement checks disabled, paired with loss of client control packet. - UNIT_FLAG_POSSESSED = 0x01000000, // Unit is under remote control by another unit, movement checks disabled, paired with loss of client control packet. New master is allowed to use melee attack and can't select this unit via mouse in the world (as if it was own character). - UNIT_FLAG_NOT_SELECTABLE = 0x02000000, - UNIT_FLAG_SKINNABLE = 0x04000000, - UNIT_FLAG_AURAS_VISIBLE = 0x08000000, // magic detect - UNIT_FLAG_SHEATHE = 0x40000000, - UNIT_FLAG_IMMUNE = 0x80000000, // Immune to damage - - // [-ZERO] TBC enumerations [?] - UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PLAYER_CONTROLLED | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE - UNIT_FLAG_LOOTING = 0x00000400, // loot animation - UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 - UNIT_FLAG_DISARMED = 0x00200000, // disable melee spells casting..., "Required melee weapon" added to melee spells tooltip. - - UNIT_FLAG_UNK_28 = 0x10000000, - UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell -}; - -/// Non Player Character flags -enum NPCFlags -{ - UNIT_NPC_FLAG_NONE = 0x00000000, - UNIT_NPC_FLAG_GOSSIP = 0x00000001, // 100% - UNIT_NPC_FLAG_QUESTGIVER = 0x00000002, // 100% - UNIT_NPC_FLAG_VENDOR = 0x00000004, // 100% - UNIT_NPC_FLAG_FLIGHTMASTER = 0x00000008, // 100% - UNIT_NPC_FLAG_TRAINER = 0x00000010, // 100% - UNIT_NPC_FLAG_SPIRITHEALER = 0x00000020, // guessed - UNIT_NPC_FLAG_SPIRITGUIDE = 0x00000040, // guessed - UNIT_NPC_FLAG_INNKEEPER = 0x00000080, // 100% - UNIT_NPC_FLAG_BANKER = 0x00000100, // 100% - UNIT_NPC_FLAG_PETITIONER = 0x00000200, // 100% 0xC0000 = guild petitions - UNIT_NPC_FLAG_TABARDDESIGNER = 0x00000400, // 100% - UNIT_NPC_FLAG_BATTLEMASTER = 0x00000800, // 100% - UNIT_NPC_FLAG_AUCTIONEER = 0x00001000, // 100% - UNIT_NPC_FLAG_STABLEMASTER = 0x00002000, // 100% - UNIT_NPC_FLAG_REPAIR = 0x00004000, // 100% - UNIT_NPC_FLAG_OUTDOORPVP = 0x20000000, // custom flag for outdoor pvp creatures || Custom flag -}; - -enum AutoAttackCheckResult -{ - ATTACK_RESULT_OK = 0, - ATTACK_RESULT_NOT_IN_RANGE = 1, - ATTACK_RESULT_BAD_FACING = 2, - ATTACK_RESULT_CANT_ATTACK = 3, - ATTACK_RESULT_DEAD = 4, - ATTACK_RESULT_FRIENDLY_TARGET = 5, -}; - -namespace Movement -{ - class MoveSpline; -} - /** * Structure to keep track of diminishing returns, for more information * about the idea behind diminishing returns, see: http://www.wowwiki.com/Diminishing_returns @@ -635,6 +118,12 @@ struct DiminishingReturn uint32 hitCount; }; +struct WeaponDamageInfo +{ + float damage[2]; + SpellSchools school; +}; + struct SubDamageInfo { SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL; @@ -687,7 +176,7 @@ enum SpellAuraProcResult SPELL_AURA_PROC_CANT_TRIGGER = 2 // aura can't trigger - skip charges taking, move to next aura if exists }; -typedef SpellAuraProcResult(Unit::*pAuraProcHandler)(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); +typedef SpellAuraProcResult(Unit::*pAuraProcHandler)(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); extern pAuraProcHandler AuraProcHandler[TOTAL_AURAS]; #define UNIT_SPELL_UPDATE_TIME_BUFFER 60 @@ -726,31 +215,6 @@ struct SpellCooldown typedef std::map SpellCooldowns; -enum ActiveStates -{ - ACT_PASSIVE = 0x01, // 0x01 - passive - ACT_DISABLED = 0x81, // 0x80 - castable - ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable - ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04 - ACT_REACTION = 0x06, // 0x02 | 0x04 - ACT_DECIDE = 0x00 // custom -}; - -enum ReactStates -{ - REACT_PASSIVE = 0, - REACT_DEFENSIVE = 1, - REACT_AGGRESSIVE = 2 -}; - -enum CommandStates -{ - COMMAND_STAY = 0, - COMMAND_FOLLOW = 1, - COMMAND_ATTACK = 2, - COMMAND_DISMISS = 3 -}; - #define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) #define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24) #define MAX_UNIT_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1) @@ -789,16 +253,6 @@ struct UnitActionBarEntry typedef UnitActionBarEntry CharmSpellEntry; -enum ActionBarIndex -{ - ACTION_BAR_INDEX_START = 0, - ACTION_BAR_INDEX_PET_SPELL_START = 3, - ACTION_BAR_INDEX_PET_SPELL_END = 7, - ACTION_BAR_INDEX_END = 10, -}; - -#define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START) - struct CharmInfo { explicit CharmInfo(Unit* unit); @@ -869,30 +323,6 @@ private: float _stayZ; }; -// used in CallForAllControlledUnits/CheckAllControlledUnits -enum ControlledUnitMask -{ - CONTROLLED_PET = 0x01, - CONTROLLED_MINIPET = 0x02, - CONTROLLED_GUARDIANS = 0x04, // including PROTECTOR_PET - CONTROLLED_CHARM = 0x08, - CONTROLLED_TOTEMS = 0x10, -}; - -// for clearing special attacks -#define REACTIVE_TIMER_START 4000 - -enum ReactiveType -{ - REACTIVE_DEFENSE = 1, - REACTIVE_HUNTER_PARRY = 2, - REACTIVE_CRIT = 3, - //REACTIVE_HUNTER_CRIT = 4, - REACTIVE_OVERPOWER = 5 -}; - -#define MAX_REACTIVE 6 - typedef std::set GuardianPetList; // delay time next attack to prevent client attack animation problems @@ -909,31 +339,9 @@ struct ProhibitSpellInfo uint32 RestingMsTime; }; -// cf Unit::AddAura -enum AddAuraFlags -{ - ADD_AURA_NO_OPTION = 0x00, - ADD_AURA_POSITIVE = 0x01, - ADD_AURA_NEGATIVE = 0x02, - ADD_AURA_PASSIVE = 0x04, - ADD_AURA_PERMANENT = 0x08, -}; - #define DEBUG_UNIT(unit, flags, ...) do { if (unit->GetDebugFlags() & flags) unit->Debug(flags, __VA_ARGS__); } while (false) #define DEBUG_UNIT_IF(cond, unit, flags, ...) do { if (unit->GetDebugFlags() & flags && cond) unit->Debug(flags, __VA_ARGS__); } while (false) -enum UnitDebugFlags -{ - DEBUG_SPELL_COMPUTE_RESISTS = 0x01, - DEBUG_PACKETS_RECV = 0x02, - DEBUG_PACKETS_SEND = 0x04, - DEBUG_AI = 0x08, - DEBUG_DR = 0x10, - DEBUG_CHEAT = 0x20, - DEBUG_PROCS = 0x40, - DEBUG_SPELLS_DAMAGE = 0x80, -}; - struct ProcTriggeredData { ProcTriggeredData(SpellProcEventEntry const * _spellProcEvent, SpellAuraHolder* _triggeredByHolder, Unit* _target, uint32 _procFlag) @@ -947,25 +355,6 @@ struct ProcTriggeredData typedef std::list< ProcTriggeredData > ProcTriggeredList; -enum TeleportToOptions -{ - TELE_TO_GM_MODE = 0x01, - TELE_TO_NOT_LEAVE_TRANSPORT = 0x02, - TELE_TO_NOT_LEAVE_COMBAT = 0x04, - TELE_TO_NOT_UNSUMMON_PET = 0x08, - TELE_TO_SPELL = 0x10, - TELE_TO_FORCE_MAP_CHANGE = 0x20, -}; - -#define MELEE_Z_LIMIT 36 // vertical range diff limit for melee attacks (no meleeing units that fly too high overhead) - -enum MovementModType -{ - MOV_MOD_FLEE_FOR_ASSISTANCE = 0, - MOV_MOD_FLEE_IN_FEAR = 1, - MOV_MOD_CONFUSED = 2 -}; - class MANGOS_DLL_SPEC Unit : public WorldObject { public: @@ -985,12 +374,314 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void AddToWorld() override; void RemoveFromWorld() override; - void CleanupsBeforeDelete() override; // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units) + void Update(uint32 update_diff, uint32 time) override; - float GetObjectBoundingRadius() const override { return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } // overwrite WorldObject version - float GetCombatReach() const override { return m_floatValues[UNIT_FIELD_COMBATREACH]; } // overwrite WorldObject version + /*********************************************************/ + /*** STAT SYSTEM ***/ + /*********************************************************/ + protected: + float m_createStats[MAX_STATS]; + int32 m_createResistances[MAX_SPELL_SCHOOL]; + float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; + WeaponDamageInfo m_weaponDamage[MAX_ATTACK][MAX_ITEM_PROTO_DAMAGES]; + uint8 m_weaponDamageCount[MAX_ATTACK]; + bool m_canModifyStats; + int32 m_regenTimer; + + void SetCreateStat(Stats stat, float val) { m_createStats[stat] = val; } + void SetCreateHealth(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_HEALTH, val); } + void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); } + void SetCreateResistance(SpellSchools school, int32 val) { m_createResistances[school] = val; } + void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0 + stat, val); } + void SetResistance(SpellSchools school, int32 val) { SetInt32Value(UNIT_FIELD_RESISTANCES + school, val); } + float GetRegenHPPerSpirit() const; + float GetRegenMPPerSpirit() const; + public: + // Data + float m_modMeleeHitChance; + float m_modRangedHitChance; + float m_modSpellHitChance; + int32 m_baseSpellCritChance; + float m_threatModifier[MAX_SPELL_SCHOOL]; + float m_modAttackSpeedPct[3]; + float m_modRecalcDamagePct[3]; + + float GetCreateStat(Stats stat) const { return m_createStats[stat]; } + uint32 GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); } + uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); } + uint32 GetCreatePowers(Powers power) const; + int32 GetCreateResistance(SpellSchools school) const { return m_createResistances[school]; } + float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); } + int32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); } + void SetArmor(int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES, val); } + int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + school); } + + uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } + uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } + float GetHealthPercent() const { return (GetHealth()*100.0f) / GetMaxHealth(); } + void SetHealth(uint32 val); + void SetMaxHealth(uint32 val); + void SetHealthPercent(float percent); + int32 ModifyHealth(int32 val); + bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); } + bool HealthBelowPct(int32 pct) const { return GetHealth() * 100 < GetMaxHealth() * pct; } + bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return (int32(GetHealth()) - damage) * 100 < GetMaxHealth() * pct; } + bool HealthAbovePct(int32 pct) const { return GetHealth() * 100 > GetMaxHealth() * pct; } + uint32 CountPctFromMaxHealth(int32 pct) const { return uint32(float(pct) * GetMaxHealth() / 100.0f); } + void SetFullHealth() { SetHealth(GetMaxHealth()); } + + Powers GetPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); } + void SetPowerType(Powers power); + void SetInitCreaturePowerType(); + uint32 GetPower( Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); } + uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); } + float GetPowerPercent(Powers power) const { return GetMaxPower(power) ? ((GetPower(power)*100.0f) / GetMaxPower(power)) : 100.0f; } + void SetPower( Powers power, uint32 val); + void SetMaxPower(Powers power, uint32 val); + void SetPowerPercent(Powers power, float percent); + int32 ModifyPower(Powers power, int32 val); + void ApplyPowerMod(Powers power, uint32 val, bool apply); + void ApplyMaxPowerMod(Powers power, uint32 val, bool apply); + + uint32 GetAttackTime(WeaponAttackType att) const { return (uint32)(GetFloatValue(UNIT_FIELD_BASEATTACKTIME+att)/m_modAttackSpeedPct[att]); } + void SetAttackTime(WeaponAttackType att, uint32 val, bool resetAttTime = true) + { + SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att,val*m_modAttackSpeedPct[att]); + if (resetAttTime) + ResetAttackTimer(att); + } + void ApplyAttackTimePercentMod(WeaponAttackType att,float val, bool apply, bool recalcDamage = false); + void ApplyCastTimePercentMod(float val, bool apply); + + float GetObjectBoundingRadius() const final { return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } + float GetCombatReach() const final { return m_floatValues[UNIT_FIELD_COMBATREACH]; } + + float GetUnitDodgeChance() const; + float GetUnitParryChance() const; + float GetUnitBlockChance() const; + float GetUnitCriticalChance(WeaponAttackType attackType, Unit const* pVictim) const; + + virtual uint32 GetShieldBlockValue() const = 0; + float GetPPMProcChance(uint32 WeaponSpeed, float PPM) const; + + bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply); + void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value) { m_auraModifiersGroup[unitMod][modifierType] = value; } + float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const; + float GetTotalStatValue(Stats stat) const; + int32 GetTotalResistanceValue(SpellSchools school) const; + float GetTotalAuraModValue(UnitMods unitMod) const; + + SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const; + Stats GetStatByAuraGroup(UnitMods unitMod) const; + Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const; + bool CanModifyStats() const { return m_canModifyStats; } + void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; } + + virtual bool UpdateStats(Stats stat) = 0; + virtual bool UpdateAllStats() = 0; + virtual void UpdateResistances(uint32 school) = 0; + virtual void UpdateArmor() = 0; + virtual void UpdateMaxHealth() = 0; + virtual void UpdateMaxPower(Powers power) = 0; + virtual void UpdateManaRegen() = 0; + + virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0; + virtual void UpdateDamagePhysical(WeaponAttackType attType) = 0; + float GetTotalAttackPowerValue(WeaponAttackType attType) const; + float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange damageRange, uint8 index = 0) const; + SpellSchools GetWeaponDamageSchool(WeaponAttackType attType, uint8 index = 0) const { return m_weaponDamage[attType][index].school; } + void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 index = 0) { m_weaponDamage[attType][index].damage[damageRange] = value; } + void SetWeaponDamageSchool(WeaponAttackType attType, SpellSchools school, uint8 index = 0) { m_weaponDamage[attType][index].school = school; } + uint8 GetWeaponDamageCount(WeaponAttackType attType) const { return m_weaponDamageCount[attType]; } + + private: + ComboPointHolderSet m_ComboPointHolders; + public: + void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); } + void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); } + void ClearComboPointHolders(); + + /*********************************************************/ + /*** STATE SYSTEM ***/ + /*********************************************************/ + + private: + uint32 m_stateFlags; // Even derived shouldn't modify + bool m_AINotifyScheduled; + protected: + DeathState m_deathState; + uint32 m_transform; + float m_modelCollisionHeight; + bool m_isCreatureLinkingTrigger; + bool m_isSpawningLinked; + float m_nativeScale = 1.0f; + float m_nativeScaleOverride = 1.0f; + public: + void AddUnitState(uint32 f) { m_stateFlags |= f; } + bool HasUnitState(uint32 f) const { return m_stateFlags & f; } + void ClearUnitState(uint32 f) { m_stateFlags &= ~f; } + uint32 GetUnitState() const { return m_stateFlags; } + void UpdateControl(); + bool CanFreeMove() const { return !HasUnitState(UNIT_STAT_NO_FREE_MOVE) && !GetOwnerGuid(); } + uint32 GetCreatureType() const; + uint32 GetCreatureTypeMask() const + { + uint32 creatureType = GetCreatureType(); + return creatureType ? (1 << (creatureType - 1)) : 0; + } + bool IsAlive() const { return m_deathState == ALIVE; } + bool IsDead() const { return m_deathState == DEAD || m_deathState == CORPSE; } + DeathState GetDeathState() const { return m_deathState; } + virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet + uint32 GetLevel() const final { return GetUInt32Value(UNIT_FIELD_LEVEL); } + void SetLevel(uint32 lvl); + uint8 GetRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); } + uint32 GetRaceMask() const { return GetRace() ? 1 << (GetRace()-1) : 0x0; } + uint8 GetClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); } + uint32 GetClassMask() const { return GetClass() ? 1 << (GetClass()-1) : 0x0; } + uint8 GetGender() const final { return GetByteValue(UNIT_FIELD_BYTES_0, 2); } + SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); } + virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); } + void SetStandState(uint8 state); + uint8 GetStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); } + bool IsSittingDown() const; + bool IsStandingUp() const; + virtual bool IsStandingUpForProc() const; // takes not yet applied stand state change into account (for players to simulate batching) + bool IsMounted() const { return (GetMountID() != 0); } + uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); } + virtual void Mount(uint32 mount, uint32 spellId = 0); + virtual void Unmount(bool from_aura = false); + ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_1, 2)); } + void SetShapeshiftForm(ShapeshiftForm form) { SetByteValue(UNIT_FIELD_BYTES_1, 2, form); } + bool IsInFeralForm() const + { + ShapeshiftForm form = GetShapeshiftForm(); + return form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR; + } + bool IsInDisallowedMountForm() const; + uint32 GetDisplayId() const { return GetUInt32Value(UNIT_FIELD_DISPLAYID); } + void SetDisplayId(uint32 modelId); + uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); } + void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); } + void SetTransForm(uint32 spellid) { m_transform = spellid; } + uint32 GetTransForm() const { return m_transform; } + void SetTransformScale(float scale); + void ResetTransformScale(); + float GetNativeScale() const; + void SetNativeScale(float scale); + float GetCollisionHeight() const { return m_modelCollisionHeight * m_nativeScaleOverride; } + void UpdateModelData(); // at any changes to scale and/or displayId + void InitPlayerDisplayIds(); + void DeMorph(); + + bool IsVendor() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ); } + bool IsTrainer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER ); } + bool IsQuestGiver() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ); } + bool IsGossip() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP ); } + bool IsTaxi() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER ); } + bool IsGuildMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER ); } + bool IsBattleMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BATTLEMASTER ); } + bool IsBanker() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER ); } + bool IsInnkeeper() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER ); } + bool IsSpiritHealer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER ); } + bool IsSpiritGuide() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITGUIDE ); } + bool IsTabardDesigner()const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TABARDDESIGNER ); } + bool IsAuctioner() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ); } + bool IsArmorer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR ); } + bool IsServiceProvider() const + { + return HasFlag( UNIT_NPC_FLAGS, + UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER | + UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER | + UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_SPIRITHEALER | + 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 IsCaster() const; + CreatureAI* AI() const; + void ScheduleAINotify(uint32 delay); + bool IsAINotifyScheduled() const { return m_AINotifyScheduled; } + void SetAINotifyScheduled(bool on) { m_AINotifyScheduled = on; } // only for call from RelocationNotifyEvent code + bool IsLinkingEventTrigger() const { return m_isCreatureLinkingTrigger; } + + void HandleEmote(uint32 emote_id); // auto-select command/state + void HandleEmoteCommand(uint32 emote_id); + void HandleEmoteState(uint32 emote_id); + // debug. + void Debug(uint32 debugType, const char* str, ...) const ATTR_PRINTF(3, 4); + void SetDebugger(ObjectGuid playerGuid, uint32 flags) + { + m_debuggerGuid = playerGuid; + m_debugFlags = flags; + } + uint32 GetDebugFlags() const { return m_debugFlags; } + ObjectGuid GetDebuggerGuid() const { return m_debuggerGuid; } + protected: + mutable ObjectGuid m_debuggerGuid; + mutable uint32 m_debugFlags; + + /*********************************************************/ + /*** VISIBILITY SYSTEM ***/ + /*********************************************************/ + + private: + UnitVisibility m_Visibility; + Position m_last_notified_position; + public: + uint32 m_detectInvisibilityMask; + uint32 m_invisibilityMask; + virtual bool CanBeDetected() const { return true; } + UnitVisibility GetVisibility() const { return m_Visibility; } + void SetVisibility(UnitVisibility x); + void UpdateVisibilityAndView() override; + + // common function for visibility checks for player/creatures with detection code + bool IsVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool* alert = nullptr) const final; + bool CanDetectInvisibilityOf(Unit const* u) const; + bool CanDetectStealthOf(Unit const* u, float distance, bool* alert = nullptr) const; + + // virtual functions for all world objects types + bool IsVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; + // function for low level grid visibility checks in player/creature cases + virtual bool IsVisibleInGridForPlayer(Player const* pl) const = 0; + bool IsInvisibleForAlive() const; + bool IsVisibleForDead() const; + + /*********************************************************/ + /*** SPELL SYSTEM ***/ + /*********************************************************/ + + private: + Diminishing m_Diminishing; + protected: + SpellAuraHolderMap m_spellAuraHolders; + SpellAuraHolderMap::iterator m_spellAuraHoldersUpdateIterator; // != end() in Unit::m_spellAuraHolders update and point to next element + AuraList m_deletedAuras; // auras removed while in ApplyModifier and waiting deleted + SpellAuraHolderList m_deletedHolders; + SingleCastSpellTargetMap m_singleCastSpellTargets; // casted by unit single per-caster auras + typedef std::list GameObjectList; + GameObjectList m_gameObj; + AuraList m_modAuras[TOTAL_AURAS]; + uint32 m_lastManaUseSpellId; + uint32 m_lastManaUseTimer; + uint32 m_spellUpdateTimeBuffer; + SpellCooldowns m_spellCooldowns; + GlobalCooldownMgr m_GlobalCooldownMgr; + + void _UpdateSpells(uint32 time); + void _UpdateAutoRepeatSpell(); + + public: + /** + * Stop all spells from casting except the one give by except_spellid + * @param except_spellid This spell id will not be stopped from casting, defaults to 0 + * \see Unit::InterruptSpell + */ + void CastStop(uint32 except_spellid = 0); /** * Gets the current DiminishingLevels for the given group * @param group The group that you would like to know the current diminishing return level for @@ -1028,38 +719,283 @@ class MANGOS_DLL_SPEC Unit : public WorldObject */ void ClearDiminishings() { m_Diminishing.clear(); } - void Update(uint32 update_diff, uint32 time) override; + void SendSpellGo(Unit* target, uint32 spellId) const; + void SendPlaySpellVisual(uint32 id) const; + void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo, AuraType auraTypeOverride = SPELL_AURA_NONE) const; + void SendEnvironmentalDamageLog(uint8 type, uint32 damage, uint32 absorb, int32 resist) const; + uint32 SpellNonMeleeDamageLog(Unit* pVictim, uint32 spellID, uint32 damage); + SpellAuraHolder* AddAura(uint32 spellId, uint32 addAuraFlags = 0, Unit* pCaster = nullptr); + SpellAuraHolder* RefreshAura(uint32 spellId, int32 duration); + bool AddSpellAuraHolder(SpellAuraHolder *holder); + void AddAuraToModList(Aura *aura); + + // pet auras + typedef std::set PetAuraSet; + PetAuraSet m_petAuras; + void AddPetAura(PetAura const* petSpell); + void RemovePetAura(PetAura const* petSpell); + + // Apply SpellEffects::EffectSummonPet after ressurecting in BG. + ObjectGuid EffectSummonPet(uint32 spellId, uint32 petEntry, uint32 petLevel); + void ModPossess(Unit* target, bool apply, AuraRemoveMode m_removeMode = AURA_REMOVE_BY_DEFAULT); + + private: + void CleanupDeletedAuras(); + + public: + // removing specific aura stack + void RemoveAura(Aura* aura, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = nullptr); + void RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder *holder, SpellEffectIndex index, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveSingleAuraFromSpellAuraHolder(uint32 id, SpellEffectIndex index, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveSingleAuraDueToItemSet(uint32 spellId, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void DeleteAuraHolder(SpellAuraHolder *holder); + + // removing specific aura stacks by diff reasons and selections + void RemoveAurasDueToSpell(uint32 spellId, SpellAuraHolder* except = nullptr, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId); + void RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAurasDueToSpellByCancel(uint32 spellId); + + // removing unknown aura stacks by diff reasons and selections + void RemoveNotOwnSingleTargetAuras(); + void RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive = false); + void RemoveSpellsCausingAura(AuraType auraType); + void RemoveNonPassiveSpellsCausingAura(AuraType auraType); + void RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except); + bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder); + void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0); + void RemoveAurasWithAttribute(uint32 flags); + void RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid = ObjectGuid()); + void RemoveAllAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAurasAtReset(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAllNegativeAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAuraTypeOnDeath(AuraType auraType); + void RemoveAllAurasOnDeath(); + bool RemoveAuraDueToDebuffLimit(SpellAuraHolder* currentAura); // Returns true if we remove 'currentAura' + void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage); + void RemoveFearEffectsByDamageTaken(uint32 damage, uint32 exceptSpellId, DamageEffectType damagetype); + uint32 GetNegativeAurasCount(); // Limit debuffs to 16 + + // removing specific aura FROM stack by diff reasons and selections + void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, ObjectGuid casterGuid = ObjectGuid(), AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid); + + void _RemoveAllAuraMods(); + void _ApplyAllAuraMods(); + + // group updates + void UpdateAuraForGroup(uint8 slot); + + // Managing objects spawned by: + // SPELL_EFFECT_DUEL + // SPELL_EFFECT_SUMMON_OBJECT_SLOT + // SPELL_EFFECT_TRANS_DOOR + GameObject* GetGameObject(uint32 spellId) const; + void AddGameObject(GameObject* pGo); + void RemoveGameObject(GameObject* pGo, bool del); + void RemoveGameObject(uint32 spellid, bool del); + void RemoveAllGameObjects(); + ObjectGuid m_ObjectSlotGuid[4]; + + uint32 m_lastSanctuaryTime; // Used by SPELL_EFFECT_SANCTUARY. + bool m_AutoRepeatFirstCast; // auto shoot and wand + + SingleCastSpellTargetMap & GetSingleCastSpellTargets() { return m_singleCastSpellTargets; } + SingleCastSpellTargetMap const& GetSingleCastSpellTargets() const { return m_singleCastSpellTargets; } + SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]; + + Aura* GetAura(uint32 spellId, SpellEffectIndex effindex); + Aura* GetAura(AuraType type, SpellFamily family, uint64 familyFlag, ObjectGuid casterGuid = ObjectGuid()); + SpellAuraHolder* GetSpellAuraHolder(uint32 spellid) const; + SpellAuraHolder* GetSpellAuraHolder(uint32 spellid, ObjectGuid casterGUID) const; + + SpellAuraHolderMap & GetSpellAuraHolderMap() { return m_spellAuraHolders; } + SpellAuraHolderMap const& GetSpellAuraHolderMap() const { return m_spellAuraHolders; } + void DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid); + AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; } + + int32 GetTotalAuraModifier(AuraType auratype) const; + float GetTotalAuraMultiplier(AuraType auratype) const; + int32 GetMaxPositiveAuraModifier(AuraType auratype) const; + int32 GetMaxNegativeAuraModifier(AuraType auratype) const; + + int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; + float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const; + int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; + float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const; + + uint64 GetAuraApplicationMask() const; + uint64 GetNegativeAuraApplicationMask() const; + + SpellAuraHolderBounds GetSpellAuraHolderBounds(uint32 spell_id) + { + return m_spellAuraHolders.equal_range(spell_id); + } + SpellAuraHolderConstBounds GetSpellAuraHolderBounds(uint32 spell_id) const + { + return m_spellAuraHolders.equal_range(spell_id); + } + + bool HasAuraType(AuraType auraType) const; + bool HasAuraTypeByCaster(AuraType auraType, ObjectGuid casterGuid) const; + bool HasAura(uint32 spellId, SpellEffectIndex effIndex) const; + bool HasAura(uint32 spellId) const { return m_spellAuraHolders.find(spellId) != m_spellAuraHolders.end(); } + bool virtual HasSpell(uint32 /*spellID*/) const { return false; } + bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } + bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); } + bool IsFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); } + bool IsInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); } + bool IsPolymorphed() const; + bool IsImmuneToSchoolMask(uint32 schoolMask) const; + bool IsFrozen() const { return HasAuraState(AURA_STATE_FROZEN); } + + bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = nullptr) const; + bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const; + bool HasAuraPetShouldAvoidBreaking(Unit* excludeCasterChannel = nullptr) const; + bool HasMorePowerfulSpellActive(SpellEntry const* spellInfos) const; + Aura* GetMostImportantAuraAfter(Aura const* like, Aura const* except = nullptr) const; // Returns the most important aura of the same type as 'like' except 'except' + + void ModifyAuraState(AuraState flag, bool apply); + bool HasAuraState(AuraState flag) const { return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)); } + + int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask) const; + uint32 SpellDamageBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1, Spell* spell = nullptr) const; + int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) const; + uint32 SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack = 1, Spell* spell = nullptr) const; + void CalculateDamageAbsorbAndResist(WorldObject* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, int32 *resist, SpellEntry const* spellProto = nullptr, Spell* spell = nullptr); + void CalculateAbsorbResistBlock(WorldObject* pCaster, SpellNonMeleeDamage *damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK, Spell* spell = nullptr); + float RollMagicResistanceMultiplierOutcomeAgainst(float resistanceChance, SpellSchoolMask schoolMask, DamageEffectType dmgType, SpellEntry const* spellProto) const; + bool IsSpellBlocked(WorldObject* pCaster, Unit* pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK) const; + bool IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK, Spell* spell = nullptr) const final; + bool IsEffectResist(SpellEntry const* spell, int eff) const; // SPELL_AURA_MOD_MECHANIC_RESISTANCE + bool IsTriggeredAtSpellProcEvent(Unit* pVictim, SpellAuraHolder* holder, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, SpellProcEventEntry const*& spellProcEvent) const; + + // Aura proc handlers + SpellAuraProcResult HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleHasteAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleProcTriggerDamageAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleOverrideClassScriptAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleModCastingSpeedNotStackAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleReflectSpellsSchoolAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleModPowerCostSchoolAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleMechanicImmuneResistanceAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleAddTargetTriggerAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleModResistanceAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleModDamageAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleNULLProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) + { + // no proc handler for this aura type + return SPELL_AURA_PROC_OK; + } + SpellAuraProcResult HandleCantTrigger(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) + { + // this aura type can't proc + return SPELL_AURA_PROC_CANT_TRIGGER; + } + + void SetLastManaUse(uint32 spellId) { m_lastManaUseTimer = 5000; m_lastManaUseSpellId = spellId; } + bool IsUnderLastManaUseEffect() const { return m_lastManaUseTimer; } + + void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); + void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); + virtual bool IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) const; + virtual bool IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo = nullptr) const; + virtual bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const; + + void ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellID, MovementModType modType, uint32 time = 0); + void SetFleeing(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0, uint32 time = 0); + void SetFeared(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0, uint32 time = 0);/*DEPRECATED METHOD*/ + void SetConfused(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0);/*DEPRECATED METHOD*/ + void SetFeignDeath(bool apply, ObjectGuid casterGuid = ObjectGuid(), bool success = true); + + // Cooldown management + SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; } + static uint32 const infinityCooldownDelay = MONTH; // used for set "infinity cooldowns" for spells and check + static uint32 const infinityCooldownDelayCheck = MONTH / 2; + + bool HasSpellCategoryCooldown(uint32 category) const; + bool HasSpellCooldown(uint32 spell_id) const + { + SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); + return itr != m_spellCooldowns.end() && itr->second.end > time(nullptr); + } + time_t GetSpellCooldownDelay(uint32 spell_id) const + { + SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); + time_t t = time(nullptr); + return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0; + } + void CooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = nullptr); + void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = nullptr, bool infinityCooldown = false); + void RemoveSpellCooldown(uint32 spell_id, bool update = false); + void RemoveAllSpellCooldown(); + void WritePetSpellsCooldown(WorldPacket& data) const; + GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; } + void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t endTime, time_t categoryEndTime = 0, uint32 cat = 0); + + virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); + bool IsSpellProhibited(SpellEntry const* pSpell) const; + protected: + typedef std::list ProhibitSpellList; + ProhibitSpellList m_prohibitSpell; + + /*********************************************************/ + /*** COMBAT SYSTEM ***/ + /*********************************************************/ + + private: + uint32 m_CombatTimer; + uint32 m_extraAttacks; + bool m_extraMute; + bool m_doExtraAttacks; + float m_meleeZLimit; + float m_meleeZReach; + ThreatManager m_ThreatManager; // Manage all Units threatening us + HostileRefManager m_HostileRefManager; // Manage all Units that are threatened by us + protected: + uint32 m_attackTimer[MAX_ATTACK]; + AttackerSet m_attackers; + Unit* m_attacking; + uint32 m_reactiveTimer[MAX_REACTIVE]; + ObjectGuid m_reactiveTarget[MAX_REACTIVE]; + typedef std::map DamageTakenHistoryMap; + DamageTakenHistoryMap m_damageTakenHistory; + uint32 m_lastDamageTaken; + public: /** * Updates the attack time for the given WeaponAttackType * @param type The type of weapon that we want to update the time for * @param time the remaining time until we can attack with the WeaponAttackType again */ - void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } + void SetAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } /** * Resets the attack timer to the base value decided by Unit::m_modAttackSpeedPct and * Unit::GetAttackTime * @param type The weapon attack type to reset the attack timer for. */ - void resetAttackTimer(WeaponAttackType type = BASE_ATTACK); + void ResetAttackTimer(WeaponAttackType type = BASE_ATTACK); /** * Get's the remaining time until we can do an attack * @param type The weapon type to check the remaining time for * @return The remaining time until we can attack with this weapon type. */ - uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; } + uint32 GetAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; } /** * Checks whether the unit can do an attack. Does this by checking the attacktimer for the * WeaponAttackType, can probably be thought of as a cooldown for each swing/shot * @param type What weapon should we check for * @return true if the Unit::m_attackTimer is zero for the given WeaponAttackType */ - bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const; + bool IsAttackReady(WeaponAttackType type = BASE_ATTACK) const; /** * Checks if the current Unit has an offhand weapon * @return True if there is a offhand weapon. */ - bool haveOffhandWeapon() const; + bool HaveOffhandWeapon() const; /** * Does an attack if any of the timers allow it and resets them, if the user * isn't in range or behind the target an error is sent to the client. @@ -1100,35 +1036,53 @@ class MANGOS_DLL_SPEC Unit : public WorldObject } } + void AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType = BASE_ATTACK, bool checkLoS = true, bool extra = false); + void SendAttackStateUpdate(CalcDamageInfo *damageInfo) const; + void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, int32 Resist, VictimState TargetState, uint32 BlockedAmount) const; + void SendMeleeAttackStop(Unit* victim) const; + void SendMeleeAttackStart(Unit* pVictim) const; + + void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage, ProcTriggeredList& triggeredList, Spell* spell = nullptr); + void HandleTriggers(Unit* pVictim, uint32 procExtra, uint32 amount, SpellEntry const *procSpell, ProcTriggeredList const& procTriggered); + void ClearAllReactives(); + void StartReactiveTimer(ReactiveType reactive, ObjectGuid target) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START; m_reactiveTarget[reactive] = target; } + ObjectGuid const& GetReactiveTarget(ReactiveType reactive) const { return m_reactiveTarget[reactive]; } + void UpdateReactives(uint32 p_time); + + float MeleeMissChanceCalc(Unit const* pVictim, WeaponAttackType attType) const; + void CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK); + void UnitDamaged(ObjectGuid from, uint32 damage) { m_damageTakenHistory[from] += damage; m_lastDamageTaken = 0; } + void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss); + uint32 CalculateDamage(WeaponAttackType attType, bool normalized, uint8 index = 0) const; + uint32 MeleeDamageBonusTaken(WorldObject* pCaster, uint32 pdamage, WeaponAttackType attType, SpellEntry const *spellProto = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, uint32 stack = 1, Spell* spell = nullptr, bool flat = true); + MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackType attType) const; + MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted) const; + // Extra attacks methods void ResetExtraAttacks() { m_extraAttacks = 0; } - void DropExtraAttack() { --m_extraAttacks; } void AddExtraAttack() { ++m_extraAttacks; } void SetExtraAttaks(uint32 attacks) { m_extraAttacks = attacks; } uint32 GetExtraAttacks() const { return m_extraAttacks; } bool IsExtraAttacksLocked() const { return m_extraMute; } void ExtraAttacksLocked(bool mute) { m_extraMute = mute; } + void AddExtraAttackOnUpdate() { m_doExtraAttacks = true; }; - void _addAttacker(Unit *pAttacker) // (Internal Use) must be called only from Unit::Attack(Unit*) - { - AttackerSet::const_iterator itr = m_attackers.find(pAttacker); - if(itr == m_attackers.end()) - m_attackers.insert(pAttacker); - } - void _removeAttacker(Unit *pAttacker) // (Internal Use) must be called only from Unit::AttackStop() - { - m_attackers.erase(pAttacker); - } - Unit * getAttackerForHelper() const // Return a possible enemy from this unit to help in combat - { - if (getVictim() != nullptr) - return getVictim(); + bool CanAttack(Unit const* target, bool force = false) const; + bool IsValidAttackTarget(Unit const* target) const final; + bool IsTargetableForAttack(bool inversAlive = false, bool isAttackerPlayer = false) const; + bool IsAttackableByAOE(bool requireDeadTarget = false, bool isCasterPlayer = false) const; - if (!m_attackers.empty()) - return *(m_attackers.begin()); - - return nullptr; - } + bool IsWithinMeleeRange(Unit const* obj, float dist = 0.0f) const; + bool CanReachWithMeleeAutoAttack(Unit const* pVictim, float flat_mod = 0.0f) const; + bool CanReachWithMeleeAutoAttackAtPosition(Unit const* pVictim, float x, float y, float z, float flat_mod = 0.0f) const; + float GetMeleeReach() const; + float GetCombatReach(bool forMeleeRange /*=true*/) const; + float GetCombatReach(Unit const* pVictim, bool ability, float flat_mod) const; + void SetMeleeZLimit(float newZLimit) { m_meleeZLimit = newZLimit; } + float GetMeleeZLimit() const { return m_meleeZLimit; } + void SetMeleeZReach(float newZReach) { m_meleeZReach = newZReach; } + float GetMeleeZReach() const { return m_meleeZReach; } + void GetRandomAttackPoint(Unit const* target, float &x, float &y, float &z) const; /** * Tries to attack a Unit/Player, also makes sure to stop attacking the current target @@ -1137,19 +1091,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject * @param meleeAttack Whether we should attack with melee or ranged/magic * @return True if an attack was initiated, false otherwise */ - bool Attack(Unit *victim, bool meleeAttack); + bool Attack(Unit* victim, bool meleeAttack); /** * Called when we are attacked by someone in someway, might be when a fear runs out and * we want to notify AI to attack again or when a spell hits. * @param attacker Who's attacking us */ void AttackedBy(Unit* attacker); - /** - * Stop all spells from casting except the one give by except_spellid - * @param except_spellid This spell id will not be stopped from casting, defaults to 0 - * \see Unit::InterruptSpell - */ - void CastStop(uint32 except_spellid = 0); /** * Stops attacking whatever we are attacking at the moment and tells the Unit we are attacking * that we are not doing that anymore. @@ -1166,16 +1114,53 @@ class MANGOS_DLL_SPEC Unit : public WorldObject */ void RemoveAllAttackers(); + void _addAttacker(Unit* pAttacker) // (Internal Use) must be called only from Unit::Attack(Unit*) + { + AttackerSet::const_iterator itr = m_attackers.find(pAttacker); + if (itr == m_attackers.end()) + m_attackers.insert(pAttacker); + } + void _removeAttacker(Unit* pAttacker) // (Internal Use) must be called only from Unit::AttackStop() + { + m_attackers.erase(pAttacker); + } + Unit* GetAttackerForHelper() const // Return a possible enemy from this unit to help in combat + { + if (GetVictim() != nullptr) + return GetVictim(); + + if (!m_attackers.empty()) + return *(m_attackers.begin()); + + return nullptr; + } + // Returns the Unit::m_attackers, that stores the units that are attacking you - AttackerSet const& getAttackers() const { return m_attackers; } + AttackerSet const& GetAttackers() const { return m_attackers; } // Returns the victim that this unit is currently attacking - Unit* getVictim() const { return m_attacking; } + Unit* GetVictim() const { return m_attacking; } + bool SelectHostileTarget(); + Unit* GetTauntTarget() const; + void TauntApply(Unit* pVictim); + void TauntFadeOut(Unit* taunter); - // Stop this unit from combat, if includingCast==true, also interrupt casting - void CombatStop(bool includingCast = false); - void CombatStopWithPets(bool includingCast = false); - void StopAttackFaction(uint32 faction_id); + // Threat related methods + bool CanHaveThreatList() const; + bool IsSecondaryThreatTarget() const; + void AddThreat(Unit* pVictim, float threat = 0.0f, bool crit = false, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NONE, SpellEntry const *threatSpell = nullptr); + float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); + void RemoveAttackersThreat(Unit* owner); + void DeleteThreatList(); + ThreatManager& GetThreatManager() { return m_ThreatManager; } + ThreatManager const& GetThreatManager() const { return m_ThreatManager; } + + void AddHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; + void RemoveHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } + HostileRefManager& GetHostileRefManager() { return m_HostileRefManager; } + HostileRefManager const& GetHostileRefManager() const { return m_HostileRefManager; } + + // Script Helpers Unit* SelectNearestTarget(float dist) const; Unit* SelectRandomUnfriendlyTarget(Unit* except = nullptr, float radius = ATTACK_DISTANCE, bool inFront = false, bool isValidAttackTarget = false) const; Unit* SelectRandomFriendlyTarget(Unit* except = nullptr, float radius = ATTACK_DISTANCE, bool inCombat = false) const; @@ -1184,87 +1169,60 @@ class MANGOS_DLL_SPEC Unit : public WorldObject Unit* FindLowestHpFriendlyUnit(float fRange, uint32 uiMinHPDiff = 1, bool bPercent = false, Unit* except = nullptr) const; Unit* FindFriendlyUnitMissingBuff(float range, uint32 spellid, Unit* except = nullptr) const; Unit* FindFriendlyUnitCC(float range) const; - Unit* SummonCreatureAndAttack(uint32 creatureEntry, Unit* pVictim= nullptr); - bool IsSecondaryThreatTarget(); - bool hasNegativeAuraWithInterruptFlag(uint32 flag); - void SendMeleeAttackStop(Unit* victim); - void SendMeleeAttackStart(Unit* pVictim); + Unit* SummonCreatureAndAttack(uint32 creatureEntry, Unit* pVictim = nullptr); - void addUnitState(uint32 f) { m_state |= f; } - bool hasUnitState(uint32 f) const { return m_state & f; } - void clearUnitState(uint32 f) { m_state &= ~f; } - uint32 getUnitState() const { return m_state; } - bool CanFreeMove() const - { - return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && !GetOwnerGuid(); - } + // Kills the victim. + void DoKillUnit(Unit* pVictim = nullptr); + uint32 DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const* spellProto, bool durabilityLoss, Spell* spell = nullptr) final; - uint32 getLevel() const final { return GetUInt32Value(UNIT_FIELD_LEVEL); } - void SetLevel(uint32 lvl); - uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); } - uint32 getRaceMask() const { return getRace() ? 1 << (getRace()-1) : 0x0; } - uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); } - uint32 getClassMask() const { return getClass() ? 1 << (getClass()-1) : 0x0; } - uint8 getGender() const override { return GetByteValue(UNIT_FIELD_BYTES_0, 2); } + // Called after this unit kills someone. + void Kill(Unit* pVictim, SpellEntry const *spellProto, bool durabilityLoss = true); + void PetOwnerKilledUnit(Unit* pVictim); + + bool IsInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } + void SetInCombatState(bool bPvP, Unit* pEnemy = nullptr); + void SetInCombatWith(Unit* pEnemy); + void SetInCombatWithAssisted(Unit* pAssisted); + void SetInCombatWithAggressor(Unit* pAggressor, bool touchOnly = false); + inline void SetOutOfCombatWithAggressor(Unit* pAggressor) { SetInCombatWithAggressor(pAggressor, true); } + void SetInCombatWithVictim(Unit* pVictim, bool touchOnly = false); + inline void SetOutOfCombatWithVictim(Unit* pVictim) { SetInCombatWithVictim(pVictim, true); } + void TogglePlayerPvPFlagOnAttackVictim(Unit const* pVictim, bool touchOnly = false); + uint32 GetCombatTimer() const { return m_CombatTimer; } + void SetCombatTimer(uint32 t) { m_CombatTimer = t; } + virtual void OnEnterCombat(Unit* /*pAttacker*/, bool /*notInCombat*/) {} // (pAttacker must be valid) - /** - * @brief Inits display id to player display ID, depending on race, class, gender - */ - void InitPlayerDisplayIds(); + // Stop this unit from combat, if includingCast==true, also interrupt casting + void CombatStop(bool includingCast = false); + void CombatStopWithPets(bool includingCast = false); + void StopAttackFaction(uint32 faction_id); + void CombatStopInRange(float dist = 0.0f); // CombatStop all enemies + void ClearInCombat(); + virtual void OnLeaveCombat() {} + void InterruptSpellsCastedOnMe(bool killDelayed = false, bool interruptPositiveSpells = false); + void InterruptAttacksOnMe(float dist = 0.0f, bool guard_check = false); // Interrupt auto-attacks + + // Script helpers. + uint32 DespawnNearCreaturesByEntry(uint32 entry, float range); + uint32 RespawnNearCreaturesByEntry(uint32 entry, float range); + + /*********************************************************/ + /*** RELATIONS SYSTEM ***/ + /*********************************************************/ - float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); } - void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); } - - inline int32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); } - inline void SetArmor(int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES, val); } - - inline int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + school); } - inline void SetResistance(SpellSchools school, int32 val) { SetInt32Value(UNIT_FIELD_RESISTANCES + school, val); } - - uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } - uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } - float GetHealthPercent() const { return (GetHealth()*100.0f) / GetMaxHealth(); } - void SetHealth( uint32 val); - void SetMaxHealth(uint32 val); - void SetHealthPercent(float percent); - int32 ModifyHealth(int32 val); - - bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); } - bool HealthBelowPct(int32 pct) const { return GetHealth() * 100 < GetMaxHealth() * pct; } - bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return (int32(GetHealth()) - damage) * 100 < GetMaxHealth() * pct; } - bool HealthAbovePct(int32 pct) const { return GetHealth() * 100 > GetMaxHealth() * pct; } - uint32 CountPctFromMaxHealth(int32 pct) const { return uint32(float(pct) * GetMaxHealth() / 100.0f); } - void SetFullHealth() { SetHealth(GetMaxHealth()); } - - Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); } - void setPowerType(Powers power); - void SetInitCreaturePowerType(); - uint32 GetPower( Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); } - uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); } - float GetPowerPercent(Powers power) const { return GetMaxPower(power) ? ((GetPower(power)*100.0f) / GetMaxPower(power)) : 100.0f; } - void SetPower( Powers power, uint32 val); - void SetMaxPower(Powers power, uint32 val); - void SetPowerPercent(Powers power, float percent); - int32 ModifyPower(Powers power, int32 val); - void ApplyPowerMod(Powers power, uint32 val, bool apply); - void ApplyMaxPowerMod(Powers power, uint32 val, bool apply); - - uint32 GetAttackTime(WeaponAttackType att) const { return (uint32)(GetFloatValue(UNIT_FIELD_BASEATTACKTIME+att)/m_modAttackSpeedPct[att]); } - void SetAttackTime(WeaponAttackType att, uint32 val, bool resetAttTime = true) - { - SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att,val*m_modAttackSpeedPct[att]); - if (resetAttTime) - resetAttackTimer(att); - } - void ApplyAttackTimePercentMod(WeaponAttackType att,float val, bool apply, bool recalcDamage = false); - void ApplyCastTimePercentMod(float val, bool apply); - - SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); } - virtual void SetSheath( SheathState sheathed ) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); } - - // faction template id - uint32 getFaction() const final { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); } - void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction ); } + private: + Unit* _GetTotem(TotemSlot slot) const; // for templated function without include need + Pet* _GetPet(ObjectGuid guid) const; // for templated function without include need + FollowerRefManager m_FollowingRefManager; + GuardianPetList m_guardianPets; + ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT]; + protected: + CharmInfo *m_charmInfo; + ObjectGuid m_possessorGuid; // Guid of unit possessing this one + public: + uint32 GetFactionTemplateId() const final { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); } + void SetFactionTemplateId(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); } + void RestoreFaction(); bool IsHostileTo(WorldObject const* target) const override; bool IsHostileToPlayers() const; @@ -1272,177 +1230,130 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool IsNeutralToAll() const; bool IsContestedGuard() const { - if(FactionTemplateEntry const* entry = getFactionTemplateEntry()) + if (FactionTemplateEntry const* entry = getFactionTemplateEntry()) return entry->IsContestedGuardFaction(); return false; } + bool IsInPartyWith(Unit const* unit) const; + bool IsInRaidWith(Unit const* unit) const; + bool IsPvP() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); } void SetPvP(bool state); bool IsPvPContested() const; void SetPvPContested(bool state); + bool IsPassiveToHostile() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } - uint32 GetCreatureType() const; - uint32 GetCreatureTypeMask() const + void SetTargetGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_TARGET, targetGuid); } + ObjectGuid const& GetTargetGuid() const { return GetGuidValue(UNIT_FIELD_TARGET); } + void ClearTarget() { SetTargetGuid(ObjectGuid()); } + ObjectGuid const& GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); } + void SetChannelObjectGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); } + + CharmInfo* GetCharmInfo() const { return m_charmInfo; } + CharmInfo* InitCharmInfo(Unit* charm); + + Unit* GetOwner() const; + ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); } + void SetOwnerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner); ForceValuesUpdateAtIndex(UNIT_FIELD_HEALTH); ForceValuesUpdateAtIndex(UNIT_FIELD_MAXHEALTH); } + ObjectGuid const& GetCreatorGuid() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); } + void SetCreatorGuid(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); } + + ObjectGuid const& GetPetGuid() const { return GetGuidValue(UNIT_FIELD_SUMMON); } + void SetPetGuid(ObjectGuid pet) { SetGuidValue(UNIT_FIELD_SUMMON, pet); } + Pet* GetPet() const; + void SetPet(Pet* pet); + virtual Pet* GetMiniPet() const { return nullptr; } // overwritten in Player + bool UnsummonOldPetBeforeNewSummon(uint32 newPetEntry); + + // Pet responses methods + void SendPetCastFail(uint32 spellid, SpellCastResult msg); + void SendPetActionFeedback(uint8 msg); + void SendPetTalk(uint32 pettalk); + void SendPetAIReaction(); + + void AddGuardian(Pet* pet); + void RemoveGuardian(Pet* pet); + void RemoveGuardians(); + void RemoveGuardiansWithEntry(uint32 entry); + Pet* FindGuardianWithEntry(uint32 entry); + uint32 GetGuardianCountWithEntry(uint32 entry); + + ObjectGuid const& GetTotemGuid(TotemSlot slot) const { return m_TotemSlot[slot]; } + Totem* GetTotem(TotemSlot slot) const; + bool IsAllTotemSlotsUsed() const; + void _AddTotem(TotemSlot slot, Totem* totem); // only for call from Totem summon code + void _RemoveTotem(Totem* totem); // only for call from Totem class + void UnsummonAllTotems(); + + Unit* GetCharmer() const; + ObjectGuid const& GetCharmerGuid() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); } + void SetCharmerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); ForceValuesUpdateAtIndex(UNIT_FIELD_HEALTH); ForceValuesUpdateAtIndex(UNIT_FIELD_MAXHEALTH); } + bool IsCharmed() const { return !GetCharmerGuid().IsEmpty(); } + bool IsCharmerOrOwnerPlayerOrPlayerItself() const; + bool IsCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGuid().IsPlayer(); } + ObjectGuid const& GetCharmerOrOwnerGuid() const { return GetCharmerGuid() ? GetCharmerGuid() : GetOwnerGuid(); } + ObjectGuid const& GetCharmerOrOwnerOrOwnGuid() const { - uint32 creatureType = GetCreatureType(); - return creatureType ? (1 << (creatureType - 1)) : 0; + if (ObjectGuid const& guid = GetCharmerOrOwnerGuid()) + return guid; + return GetObjectGuid(); + } + Player* GetCharmerOrOwnerPlayerOrPlayerItself() const; + Unit* GetCharmerOrOwner() const { return GetCharmerGuid() ? GetCharmer() : GetOwner(); } + Unit* GetCharmerOrOwnerOrSelf() + { + if (Unit* u = GetCharmerOrOwner()) + return u; + + return this; + } + Unit const* GetCharmerOrOwnerOrSelf() const + { + Unit const* u = GetCharmerOrOwner(); + return u ? u : this; } - uint8 getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); } - bool IsSittingDown() const; - bool IsStandingUp() const; - virtual bool IsStandingUpForProc() const; // takes not yet applied stand state change into account (for players) - void SetStandState(uint8 state); + Unit* GetCharm() const; + void SetCharm(Unit* pet); + void Uncharm(); + void RemoveCharmAuras(); + ObjectGuid const& GetCharmGuid() const { return GetGuidValue(UNIT_FIELD_CHARM); } + void SetCharmGuid(ObjectGuid charm) { SetGuidValue(UNIT_FIELD_CHARM, charm); } - bool IsMounted() const { return (GetMountID() != 0); } - uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); } - virtual void Mount(uint32 mount, uint32 spellId = 0); - virtual void Unmount(bool from_aura = false); + Player* GetSpellModOwner() const; + Player* GetAffectingPlayer() const final; - void HandleEmote(uint32 emote_id); // auto-select command/state - void HandleEmoteCommand(uint32 emote_id); - void HandleEmoteState(uint32 emote_id); + Player* GetPossessor() const; + ObjectGuid const& GetPossessorGuid() const { return m_possessorGuid; } + void SetPossessorGuid(ObjectGuid possession) { m_possessorGuid = possession; } + + template + void CallForAllControlledUnits(Func const& func, uint32 controlledMask); + template + bool CheckAllControlledUnits(Func const& func, uint32 controlledMask) const; - // Kills the victim. - void DoKillUnit(Unit *victim = nullptr); - uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss, Spell* spell = nullptr) final ; - // Called after this unit kills someone. - void Kill(Unit* pVictim, SpellEntry const *spellProto, bool durabilityLoss = true); - void PetOwnerKilledUnit(Unit* pVictim); + void AddFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } + void RemoveFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ } - void ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage, ProcTriggeredList& triggeredList, Spell* spell = nullptr); - void HandleTriggers(Unit *pVictim, uint32 procExtra, uint32 amount, SpellEntry const *procSpell, ProcTriggeredList const& procTriggered); - void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool checkLoS = true, bool extra = false ); - float MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const; - void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK); - void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss); - bool IsEffectResist(SpellEntry const* spell, int eff); // SPELL_AURA_MOD_MECHANIC_RESISTANCE - - float GetUnitDodgeChance() const; - float GetUnitParryChance() const; - float GetUnitBlockChance() const; - float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const; - - virtual uint32 GetShieldBlockValue() const =0; - float GetPPMProcChance(uint32 WeaponSpeed, float PPM) const; - - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const; - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted ) const; - - bool isVendor() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ); } - bool isTrainer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER ); } - bool isQuestGiver() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ); } - bool isGossip() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP ); } - bool isTaxi() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER ); } - bool isGuildMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER ); } - bool isBattleMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BATTLEMASTER ); } - bool isBanker() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER ); } - bool isInnkeeper() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER ); } - bool isSpiritHealer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER ); } - bool isSpiritGuide() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITGUIDE ); } - bool isTabardDesigner()const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TABARDDESIGNER ); } - bool isAuctioner() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ); } - bool isArmorer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR ); } - bool isServiceProvider() const - { - return HasFlag( UNIT_NPC_FLAGS, - UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER | - UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER | - UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_SPIRITHEALER | - 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 isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } - void SetInCombatState(bool PvP, Unit* enemy = nullptr); - void SetInCombatWith(Unit* enemy); - void ClearInCombat(); - void SetInCombatWithAssisted(Unit* assisted); - void SetInCombatWithAggressor(Unit* aggressor, bool touchOnly = false); - inline void SetOutOfCombatWithAggressor(Unit* aggressor) { SetInCombatWithAggressor(aggressor, true); } - void SetInCombatWithVictim(Unit* victim, bool touchOnly = false); - inline void SetOutOfCombatWithVictim(Unit* victim) { SetInCombatWithVictim(victim, true); } - void TogglePlayerPvPFlagOnAttackVictim(Unit const* pVictim, bool touchOnly = false); - uint32 GetCombatTimer() const { return m_CombatTimer; } - void SetCombatTimer(uint32 t) { m_CombatTimer = t; } - - bool HasAuraTypeByCaster(AuraType auraType, ObjectGuid casterGuid) const; - uint32 GetFirstAuraBySpellIconAndVisual(uint32 spellIconId, uint32 spellVisual) const; - uint64 GetAuraApplicationMask() const; - uint64 GetNegativeAuraApplicationMask() const; - - SpellAuraHolderBounds GetSpellAuraHolderBounds(uint32 spell_id) - { - return m_spellAuraHolders.equal_range(spell_id); - } - SpellAuraHolderConstBounds GetSpellAuraHolderBounds(uint32 spell_id) const - { - return m_spellAuraHolders.equal_range(spell_id); - } - - bool HasAuraType(AuraType auraType) const; - bool HasAffectedAura(AuraType auraType, SpellEntry const* spellProto) const; - bool HasAura(uint32 spellId, SpellEffectIndex effIndex) const; - bool HasAura(uint32 spellId) const - { - return m_spellAuraHolders.find(spellId) != m_spellAuraHolders.end(); - } - bool virtual HasSpell(uint32 /*spellID*/) const { return false; } - bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); } - bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); } - bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); } - bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); } - bool IsPolymorphed() const; - bool IsImmuneToSchoolMask(uint32 schoolMask) const; - bool isFrozen() const; - - void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage); - void RemoveFearEffectsByDamageTaken(uint32 damage, uint32 exceptSpellId, DamageEffectType damagetype); - - bool IsValidAttackTarget(Unit const* target) const final ; - bool isTargetableForAttack(bool inversAlive = false, bool isAttackerPlayer = false) const; - bool isAttackableByAOE(bool requireDeadTarget = false, bool isCasterPlayer = false) const; - bool isPassiveToHostile() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } - - virtual bool IsInWater() const; - virtual bool IsUnderWater() const; - bool IsReachableBySwmming() const; - bool isInAccessablePlaceFor(Creature const* c) const; - - void SendEnvironmentalDamageLog(uint8 type, uint32 damage, uint32 absorb, int32 resist) const; - uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage); - - // Affiche le visuel d'un sort - void SendSpellGo(Unit* target, uint32 spellId); - void SendPlaySpellVisual(uint32 id) const; - - void DeMorph(); - - void SendAttackStateUpdate(CalcDamageInfo *damageInfo); - void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, int32 Resist, VictimState TargetState, uint32 BlockedAmount); - void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo, AuraType auraTypeOverride = SPELL_AURA_NONE); - - void NearTeleportTo(float x, float y, float z, float orientation, uint32 teleportOptions = TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET); - void NearLandTo(float x, float y, float z, float orientation); - void TeleportPositionRelocation(float x, float y, float z, float o); - void MonsterMoveWithSpeed(float x, float y, float z, float o, float speed, uint32 options); - void MonsterMove(float x, float y, float z); - - void SendHeartBeat(bool includingSelf = true); - virtual void SetFly(bool enable); - void SetWalk(bool enable, bool asDefault = true); + /*********************************************************/ + /*** MOVEMENT SYSTEM ***/ + /*********************************************************/ private: // when a player controls this unit, and when change is made to this unit which requires an ack from the client to be acted (change of speed for example), this movementCounter is incremented uint32 m_movementCounter = 0; std::deque m_pendingMovementChanges; std::map m_lastMovementChangeCounterPerType; - + float m_casterChaseDistance; + float m_speed_rate[MAX_MOVE_TYPE]; + void UpdateSplineMovement(uint32 t_diff); + protected: + MotionMaster i_motionMaster; public: - std::deque& GetPendingMovementChangesQueue() { return m_pendingMovementChanges; } - + void SendHeartBeat(bool includingSelf = true); + virtual void SetFly(bool enable); + void SetRooted(bool apply); void SetRootedReal(bool apply); bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_ROOT); } @@ -1488,477 +1399,49 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool FindPendingMovementSpeedChange(float speedReceived, uint32 movementCounter, UnitMoveType moveType); void CheckPendingMovementChanges(); + void SetWalk(bool enable, bool asDefault = true); void SetSpeedRate(UnitMoveType mtype, float rate); void SetSpeedRateReal(UnitMoveType mtype, float rate); - void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f); + void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f); float GetSpeed(UnitMoveType mtype) const; float GetXZFlagBasedSpeed() const; float GetXZFlagBasedSpeed(uint32 moveFlags) const; float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; } + void PropagateSpeedChange() { GetMotionMaster()->PropagateSpeedChange(); } + // Terrain checks + virtual bool IsInWater() const; + virtual bool IsUnderWater() const; + bool IsReachableBySwmming() const; + bool IsInAccessablePlaceFor(Creature const* c) const; + + // Inhabit type checks virtual bool CanWalk() const = 0; virtual bool CanFly() const = 0; virtual bool CanSwim() const = 0; - virtual bool CanBeDetected() const { return true; } - - bool isAlive() const { return m_deathState == ALIVE; } - bool isDead() const { return m_deathState == DEAD || m_deathState == CORPSE; } - DeathState getDeathState() const { return m_deathState; } - virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet - - ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); } - void SetOwnerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_SUMMONEDBY, owner); ForceValuesUpdateAtIndex(UNIT_FIELD_HEALTH); ForceValuesUpdateAtIndex(UNIT_FIELD_MAXHEALTH); } - ObjectGuid const& GetCreatorGuid() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); } - void SetCreatorGuid(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); } - ObjectGuid const& GetPetGuid() const { return GetGuidValue(UNIT_FIELD_SUMMON); } - void SetPetGuid(ObjectGuid pet) { SetGuidValue(UNIT_FIELD_SUMMON, pet); } - ObjectGuid const& GetCharmerGuid() const { return GetGuidValue(UNIT_FIELD_CHARMEDBY); } - void SetCharmerGuid(ObjectGuid owner) { SetGuidValue(UNIT_FIELD_CHARMEDBY, owner); ForceValuesUpdateAtIndex(UNIT_FIELD_HEALTH); ForceValuesUpdateAtIndex(UNIT_FIELD_MAXHEALTH); } - ObjectGuid const& GetCharmGuid() const { return GetGuidValue(UNIT_FIELD_CHARM); } - void SetCharmGuid(ObjectGuid charm) { SetGuidValue(UNIT_FIELD_CHARM, charm); } - ObjectGuid const& GetTargetGuid() const { return GetGuidValue(UNIT_FIELD_TARGET); } - void SetTargetGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_TARGET, targetGuid); } - void ClearTarget() { SetTargetGuid(ObjectGuid()); } - ObjectGuid const& GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); } - void SetChannelObjectGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); } - - ObjectGuid const& GetPossessorGuid() const { return m_possessorGuid; } - void SetPossessorGuid(ObjectGuid possession) { m_possessorGuid = possession; } - - virtual Pet* GetMiniPet() const { return nullptr; } // overwrited in Player - - ObjectGuid const& GetCharmerOrOwnerGuid() const { return GetCharmerGuid() ? GetCharmerGuid() : GetOwnerGuid(); } - ObjectGuid const& GetCharmerOrOwnerOrOwnGuid() const - { - if (ObjectGuid const& guid = GetCharmerOrOwnerGuid()) - return guid; - return GetObjectGuid(); - } - bool isCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGuid().IsPlayer(); } - - Player* GetSpellModOwner() const; - Unit* GetOwner() const; - Pet* GetPet() const; - Unit* GetCharmer() const; - Player* GetPossessor() const; - Unit* GetCharm() const; - void Uncharm(); - void RemoveCharmAuras(); - Unit* GetCharmerOrOwner() const { return GetCharmerGuid() ? GetCharmer() : GetOwner(); } - Unit* GetCharmerOrOwnerOrSelf() - { - if(Unit* u = GetCharmerOrOwner()) - return u; - - return this; - } - Unit const* GetCharmerOrOwnerOrSelf() const - { - Unit const*u = GetCharmerOrOwner(); - return u ? u : this; - } - - bool IsCharmerOrOwnerPlayerOrPlayerItself() const; - Player* GetCharmerOrOwnerPlayerOrPlayerItself() const; - Player* GetAffectingPlayer() const final ; - - void SetPet(Pet* pet); - void SetCharm(Unit* pet); - - void RestoreFaction(); - bool canAttack(Unit const* target, bool force = false) const; - - void AddGuardian(Pet* pet); - void RemoveGuardian(Pet* pet); - void RemoveGuardians(); - void RemoveGuardiansWithEntry(uint32 entry); - Pet* FindGuardianWithEntry(uint32 entry); - uint32 GetGuardianCountWithEntry(uint32 entry); - - bool isCharmed() const { return !GetCharmerGuid().IsEmpty(); } - - CharmInfo* GetCharmInfo() const { return m_charmInfo; } - CharmInfo* InitCharmInfo(Unit* charm); - - ObjectGuid const& GetTotemGuid(TotemSlot slot) const { return m_TotemSlot[slot]; } - Totem* GetTotem(TotemSlot slot) const; - bool IsAllTotemSlotsUsed() const; - - void _AddTotem(TotemSlot slot, Totem* totem); // only for call from Totem summon code - void _RemoveTotem(Totem* totem); // only for call from Totem class - - void UnsummonAllTotems(); - bool UnsummonOldPetBeforeNewSummon(uint32 newPetEntry); - - template - void CallForAllControlledUnits(Func const& func, uint32 controlledMask); - template - bool CheckAllControlledUnits(Func const& func, uint32 controlledMask) const; - - bool AddSpellAuraHolder(SpellAuraHolder *holder); - void AddAuraToModList(Aura *aura); - - // removing specific aura stack - void RemoveAura(Aura* aura, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = nullptr); - void RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder *holder, SpellEffectIndex index, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveSingleAuraFromSpellAuraHolder(uint32 id, SpellEffectIndex index, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveSingleAuraDueToItemSet(uint32 spellId, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void DeleteAuraHolder(SpellAuraHolder *holder); - - // Limit debuffs a 16 - uint32 GetNegativeAurasCount(); - // Returns true if we remove 'currentAura' - bool RemoveAuraDueToDebuffLimit(SpellAuraHolder* currentAura); - - // removing specific aura stacks by diff reasons and selections - void RemoveAurasDueToSpell(uint32 spellId, SpellAuraHolder* except = nullptr, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); - void RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit *stealer); - void RemoveAurasDueToSpellByCancel(uint32 spellId); - - // removing unknown aura stacks by diff reasons and selections - void RemoveNotOwnSingleTargetAuras(); - void RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive = false); - void RemoveSpellsCausingAura(AuraType auraType); - void RemoveNonPassiveSpellsCausingAura(AuraType auraType); - void RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except); - void RemoveRankAurasDueToSpell(uint32 spellId); - bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder); - void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0); - void RemoveAurasWithAttribute(uint32 flags); - void RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid = ObjectGuid()); - void RemoveAllAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasAtReset(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAllNegativeAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAuraTypeOnDeath(AuraType auraType); - void RemoveAllAurasOnDeath(); - - // removing specific aura FROM stack by diff reasons and selections - void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, ObjectGuid casterGuid = ObjectGuid(), AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid); - - void DelaySpellAuraHolder(uint32 spellId, int32 delaytime, ObjectGuid casterGuid); - - void SetCreateStat(Stats stat, float val) { m_createStats[stat] = val; } - void SetCreateHealth(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_HEALTH, val); } - uint32 GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); } - void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); } - uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); } - uint32 GetCreatePowers(Powers power) const; - float GetCreateStat(Stats stat) const { return m_createStats[stat]; } - void SetCreateResistance(SpellSchools school, int32 val) { m_createResistances[school] = val; } - int32 GetCreateResistance(SpellSchools school) const { return m_createResistances[school]; } - - bool IsSpellProhibited(SpellEntry const* pSpell); - bool HasProhibitedSpell(); /* use this to check if creature is silenced */ - typedef std::list ProhibitSpellList; - ProhibitSpellList m_prohibitSpell; - - ObjectGuid m_ObjectSlotGuid[4]; - uint32 m_detectInvisibilityMask; - uint32 m_invisibilityMask; - - ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_1, 2)); } - void SetShapeshiftForm(ShapeshiftForm form) { SetByteValue(UNIT_FIELD_BYTES_1, 2, form); } - - bool IsInFeralForm() const - { - ShapeshiftForm form = GetShapeshiftForm(); - return form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR; - } - - bool IsInDisallowedMountForm() const; - - float m_modMeleeHitChance; - float m_modRangedHitChance; - float m_modSpellHitChance; - int32 m_baseSpellCritChance; - - float m_threatModifier[MAX_SPELL_SCHOOL]; - float m_modAttackSpeedPct[3]; - float m_modRecalcDamagePct[3]; - - // stat system - bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply); - void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value) { m_auraModifiersGroup[unitMod][modifierType] = value; } - float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const; - float GetTotalStatValue(Stats stat) const; - int32 GetTotalResistanceValue(SpellSchools school) const; - float GetTotalAuraModValue(UnitMods unitMod) const; - SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const; - Stats GetStatByAuraGroup(UnitMods unitMod) const; - Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const; - bool CanModifyStats() const { return m_canModifyStats; } - void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; } - virtual bool UpdateStats(Stats stat) = 0; - virtual bool UpdateAllStats() = 0; - virtual void UpdateResistances(uint32 school) = 0; - virtual void UpdateArmor() = 0; - virtual void UpdateMaxHealth() = 0; - virtual void UpdateMaxPower(Powers power) = 0; - virtual void UpdateManaRegen() = 0; - float GetRegenHPPerSpirit() const; - float GetRegenMPPerSpirit() const; - virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0; - virtual void UpdateDamagePhysical(WeaponAttackType attType) = 0; - float GetTotalAttackPowerValue(WeaponAttackType attType) const; - float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange damageRange, uint8 index = 0) const; - SpellSchools GetWeaponDamageSchool(WeaponAttackType attType, uint8 index = 0) const { return m_weaponDamage[attType][index].school; } - void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 index = 0) { m_weaponDamage[attType][index].damage[damageRange] = value; } - void SetWeaponDamageSchool(WeaponAttackType attType, SpellSchools school, uint8 index = 0) { m_weaponDamage[attType][index].school = school; } - uint8 GetWeaponDamageCount(WeaponAttackType attType) const { return m_weaponDamageCount[attType]; } - + void SetInFront(Unit const* pTarget); void SetFacingTo(float ori); void SetFacingToObject(WorldObject* pObject); bool IsBehindTarget(Unit const* pTarget, bool strict = true) const; - - // Visibility system - UnitVisibility GetVisibility() const { return m_Visibility; } - void SetVisibility(UnitVisibility x); - void UpdateVisibilityAndView() override; // overwrite WorldObject::UpdateVisibilityAndView() - - // common function for visibility checks for player/creatures with detection code - bool isVisibleForOrDetect(WorldObject const* pDetector, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool* alert = nullptr) const final ; - bool canDetectInvisibilityOf(Unit const* u) const; - bool canDetectStealthOf(Unit const* u, float distance, bool* alert = nullptr) const; - - // virtual functions for all world objects types - bool isVisibleForInState(WorldObject const* pDetector, WorldObject const* viewPoint, bool inVisibleList) const override; - // function for low level grid visibility checks in player/creature cases - virtual bool IsVisibleInGridForPlayer(Player const* pl) const = 0; - bool isInvisibleForAlive() const; - bool isVisibleForDead() const; - - SingleCastSpellTargetMap & GetSingleCastSpellTargets() { return m_singleCastSpellTargets; } - SingleCastSpellTargetMap const& GetSingleCastSpellTargets() const { return m_singleCastSpellTargets; } - SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]; - uint32 m_lastSanctuaryTime; - - // Threat related methods - bool CanHaveThreatList() const; - void AddThreat(Unit* pVictim, float threat = 0.0f, bool crit = false, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NONE, SpellEntry const *threatSpell = nullptr); - float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); - void DeleteThreatList(); - bool SelectHostileTarget(); - Unit* GetTauntTarget() const; - void TauntApply(Unit* pVictim); - void TauntFadeOut(Unit *taunter); - ThreatManager& getThreatManager() { return m_ThreatManager; } - ThreatManager const& getThreatManager() const { return m_ThreatManager; } - void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; - void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ } - HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } - - Aura* GetAura(uint32 spellId, SpellEffectIndex effindex); - Aura* GetAura(AuraType type, SpellFamily family, uint64 familyFlag, ObjectGuid casterGuid = ObjectGuid()); - SpellAuraHolder* GetSpellAuraHolder (uint32 spellid) const; - SpellAuraHolder* GetSpellAuraHolder (uint32 spellid, ObjectGuid casterGUID) const; - - SpellAuraHolderMap & GetSpellAuraHolderMap() { return m_spellAuraHolders; } - SpellAuraHolderMap const& GetSpellAuraHolderMap() const { return m_spellAuraHolders; } - AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; } - void ApplyAuraProcTriggerDamage(Aura* aura, bool apply); - - int32 GetTotalAuraModifier(AuraType auratype) const; - float GetTotalAuraMultiplier(AuraType auratype) const; - int32 GetMaxPositiveAuraModifier(AuraType auratype) const; - int32 GetMaxNegativeAuraModifier(AuraType auratype) const; - - int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; - float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const; - int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; - int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const; - - int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; - float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const; - int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; - int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const; - - Aura* GetDummyAura(uint32 spell_id) const; - - uint32 m_AuraFlags; - - uint32 GetDisplayId() const { return GetUInt32Value(UNIT_FIELD_DISPLAYID); } - void SetDisplayId(uint32 modelId); - uint32 GetNativeDisplayId() const { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); } - void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); } - void setTransForm(uint32 spellid) { m_transform = spellid;} - uint32 getTransForm() const { return m_transform;} - float GetCollisionHeight() const { return m_modelCollisionHeight * m_nativeScaleOverride; } - void UpdateModelData(); // at any changes to scale and/or displayId - - GameObject* GetGameObject(uint32 spellId) const; - void AddGameObject(GameObject* gameObj); - void RemoveGameObject(GameObject* gameObj, bool del); - void RemoveGameObject(uint32 spellid, bool del); - void RemoveAllGameObjects(); - - void ModifyAuraState(AuraState flag, bool apply); - bool HasAuraState(AuraState flag) const { return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); } - - uint32 CalculateDamage(WeaponAttackType attType, bool normalized, uint8 index = 0); - int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask); - uint32 SpellDamageBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack = 1, Spell* spell = nullptr); - int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask); - uint32 SpellHealingBonusTaken(WorldObject* pCaster, SpellEntry const* spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack = 1, Spell* spell = nullptr); - uint32 MeleeDamageBonusTaken(WorldObject* pCaster, uint32 pdamage, WeaponAttackType attType, SpellEntry const *spellProto = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, uint32 stack = 1, Spell* spell = nullptr, bool flat = true); - - bool IsSpellBlocked(WorldObject* pCaster, Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK); - bool IsSpellCrit(Unit const* pVictim, SpellEntry const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK, Spell* spell = nullptr) const final ; - - bool IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, SpellProcEventEntry const*& spellProcEvent ); - // Aura proc handlers - SpellAuraProcResult HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleProcTriggerDamageAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleModCastingSpeedNotStackAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleReflectSpellsSchoolAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleModPowerCostSchoolAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleMechanicImmuneResistanceAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleAddTargetTriggerAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleModResistanceAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleModDamageAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - SpellAuraProcResult HandleNULLProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) - { - // no proc handler for this aura type - return SPELL_AURA_PROC_OK; - } - SpellAuraProcResult HandleCantTrigger(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) - { - // this aura type can't proc - return SPELL_AURA_PROC_CANT_TRIGGER; - } - - void SetLastManaUse(uint32 spellId) { m_lastManaUseTimer = 5000; m_lastManaUseSpellId = spellId; } - bool IsUnderLastManaUseEffect() const { return m_lastManaUseTimer; } - - void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); - void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply); - virtual bool IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf); - virtual bool IsImmuneToDamage(SpellSchoolMask meleeSchoolMask, SpellEntry const* spellInfo = nullptr); - virtual bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const; - - void CalculateDamageAbsorbAndResist(WorldObject* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, int32 *resist, SpellEntry const* spellProto = nullptr, Spell* spell = nullptr); - void CalculateAbsorbResistBlock(WorldObject* pCaster, SpellNonMeleeDamage *damageInfo, SpellEntry const* spellProto, WeaponAttackType attType = BASE_ATTACK, Spell* spell = nullptr); - float RollMagicResistanceMultiplierOutcomeAgainst(float resistanceChance, SpellSchoolMask schoolMask, DamageEffectType dmgType, SpellEntry const* spellProto) const; - - void _RemoveAllAuraMods(); - void _ApplyAllAuraMods(); - - void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } - void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ } - + MotionMaster* GetMotionMaster() { return &i_motionMaster; } MotionMaster const* GetMotionMaster() const { return &i_motionMaster; } - - bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); } + void RestoreMovement(); + void NearTeleportTo(float x, float y, float z, float orientation, uint32 teleportOptions = TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET); + void NearLandTo(float x, float y, float z, float orientation); + void TeleportPositionRelocation(float x, float y, float z, float o); + void MonsterMoveWithSpeed(float x, float y, float z, float o, float speed, uint32 options); + void MonsterMove(float x, float y, float z); + bool IsStopped() const { return !(HasUnitState(UNIT_STAT_MOVING)); } void StopMoving(bool force = false); - - void SetFleeing(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0, uint32 time = 0); - void SetFeared(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0, uint32 time = 0);/*DEPRECATED METHOD*/ - void SetConfused(bool apply, ObjectGuid casterGuid = ObjectGuid(), uint32 spellID = 0);/*DEPRECATED METHOD*/ - void SetFeignDeath(bool apply, ObjectGuid casterGuid = ObjectGuid(), bool success = true); - - void InterruptSpellsCastedOnMe(bool killDelayed = false, bool interruptPositiveSpells = false); - uint32 DespawnNearCreaturesByEntry(uint32 entry, float range); - uint32 RespawnNearCreaturesByEntry(uint32 entry, float range); - uint32 DespawnHostileCreaturesInRange(float range = 0.0f); - void InterruptAttacksOnMe(float dist=0.0f, bool guard_check = false); // Interrompt toutes les "auto-attaques" - void CombatStopInRange(float dist=0.0f); // CombatStop tous les ennemis - - void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); } - void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); } - void ClearComboPointHolders(); - - ///----------Pet responses methods----------------- - void SendPetCastFail(uint32 spellid, SpellCastResult msg); - void SendPetActionFeedback (uint8 msg); - void SendPetTalk (uint32 pettalk); - void SendPetAIReaction(); - ///----------End of Pet responses methods---------- - - void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); } - - // reactive attacks - void ClearAllReactives(); - void StartReactiveTimer(ReactiveType reactive, ObjectGuid target) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START; m_reactiveTarget[reactive] = target; } - ObjectGuid const& GetReactiveTarget(ReactiveType reactive) const { return m_reactiveTarget[reactive]; } - void UpdateReactives(uint32 p_time); - - // group updates - void UpdateAuraForGroup(uint8 slot); - - bool IsLinkingEventTrigger() { return m_isCreatureLinkingTrigger; } - - // pet auras - typedef std::set PetAuraSet; - PetAuraSet m_petAuras; - void AddPetAura(PetAura const* petSpell); - void RemovePetAura(PetAura const* petSpell); - - void UpdateControl(); - uint32 m_castingSpell; - void ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellID, MovementModType modType, uint32 time=0); - // "Un sort plus puissant est actif" - bool HasMorePowerfullSpellActive(SpellEntry const* spellInfos); - - // Renvoit l'aura le plus important de la meme sorte que 'like', sauf except. - Aura* GetMostImportantAuraAfter(Aura const* like, Aura const* except = nullptr); - // debug. - void Debug(uint32 debugType, const char* str, ...) const ATTR_PRINTF(3, 4); - void SetDebugger(ObjectGuid playerGuid, uint32 flags) - { - _debuggerGuid = playerGuid; - _debugFlags = flags; - } - uint32 GetDebugFlags() const { return _debugFlags; } - ObjectGuid GetDebuggerGuid() const { return _debuggerGuid; } - ObjectGuid _debuggerGuid; - uint32 _debugFlags; - - bool IsWithinMeleeRange(const Unit *obj, float dist = 0.0f) const; - float GetMeleeReach() const; - float GetCombatReach(bool forMeleeRange /*=true*/) const; - float GetCombatReach(Unit const* pVictim, bool ability, float flat_mod) const; - void GetRandomAttackPoint(const Unit* target, float &x, float &y, float &z) const; - - bool CanReachWithMeleeAutoAttack(Unit const* pVictim, float flat_mod = 0.0f) const; - bool CanReachWithMeleeAutoAttackAtPosition(Unit const* pVictim, float x, float y, float z, float flat_mod = 0.0f) const; + void DisableSpline(); // Caster movement float GetMinChaseDistance(Unit* target) const; float GetMaxChaseDistance(Unit* target) const; - bool HasDistanceCasterMovement() const { return (_casterChaseDistance >= 1.0f); } - void SetCasterChaseDistance(float dist) { _casterChaseDistance = dist; } - float _casterChaseDistance; - - void RestoreMovement(); - - void AddExtraAttackOnUpdate() { m_doExtraAttacks = true; }; - - // (pAttacker doit etre valide) - virtual void OnEnterCombat(Unit* /*pAttacker*/, bool /*notInCombat*/) {} - virtual void OnLeaveCombat() {} - virtual void OnMoveTo(float, float, float) {} - - // Appele dans SpellEffects::EffectSummonPet et apres un rez en BG. - ObjectGuid EffectSummonPet(uint32 spellId, uint32 petEntry, uint32 petLevel); - void ModPossess(Unit* target, bool apply, AuraRemoveMode m_removeMode = AURA_REMOVE_BY_DEFAULT); - - // Caster ? - bool IsCaster(); - CreatureAI* AI() const; - - // Auras - SpellAuraHolder* AddAura(uint32 spellId, uint32 addAuraFlags = 0, Unit* pCaster = nullptr); - // Refresh seulement si l'aura existe. - SpellAuraHolder* RefreshAura(uint32 spellId, int32 duration); + bool HasDistanceCasterMovement() const { return (m_casterChaseDistance >= 1.0f); } + void SetCasterChaseDistance(float dist) { m_casterChaseDistance = dist; } Movement::MoveSpline* movespline; // Serialize access to the movespline to prevent thread race conditions in async @@ -1966,162 +1449,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject // spline for end point with targeted move gen) ACE_Thread_Mutex asyncMovesplineLock; - void ScheduleAINotify(uint32 delay); - bool IsAINotifyScheduled() const { return m_AINotifyScheduled;} - void _SetAINotifyScheduled(bool on) { m_AINotifyScheduled = on;} // only for call from RelocationNotifyEvent code void OnRelocated(); void ProcessRelocationVisibilityUpdates(); bool m_needUpdateVisibility; - // Nostalrius - en fin de CM par exemple - void TransferAttackersThreatTo(Unit* unit); - void RemoveAttackersThreat(Unit* owner); - - bool IsInPartyWith(Unit const* unit) const; - bool IsInRaidWith(Unit const* unit) const; - bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel= nullptr) const; - bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const; - bool HasAuraPetShouldAvoidBreaking(Unit* excludeCasterChannel = nullptr) const; - - // Cooldown management - SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; } - static uint32 const infinityCooldownDelay = MONTH; // used for set "infinity cooldowns" for spells and check - static uint32 const infinityCooldownDelayCheck = MONTH/2; - - bool HasSpellCategoryCooldown(uint32 category) const; - bool HasSpellCooldown(uint32 spell_id) const - { - SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); - return itr != m_spellCooldowns.end() && itr->second.end > time(nullptr); - } - time_t GetSpellCooldownDelay(uint32 spell_id) const - { - SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); - time_t t = time(nullptr); - return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0; - } - void CooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = nullptr); - void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = nullptr, bool infinityCooldown = false ); - void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t endTime, time_t categoryEndTime = 0, uint32 cat = 0); - virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); - void RemoveSpellCooldown(uint32 spell_id, bool update = false); - void RemoveSpellCategoryCooldown(uint32 cat, bool update = false); - void WritePetSpellsCooldown(WorldPacket& data); - GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; } - void RemoveAllSpellCooldown(); - - void setTransformScale(float scale); - void resetTransformScale(); - float getNativeScale() const; - void setNativeScale(float scale); - protected: - explicit Unit (); - - void _UpdateSpells(uint32 time); - void _UpdateAutoRepeatSpell(); - - uint32 m_attackTimer[MAX_ATTACK]; - float m_createStats[MAX_STATS]; - int32 m_createResistances[MAX_SPELL_SCHOOL]; - - AttackerSet m_attackers; - Unit* m_attacking; - - DeathState m_deathState; - - SpellAuraHolderMap m_spellAuraHolders; - SpellAuraHolderMap::iterator m_spellAuraHoldersUpdateIterator; // != end() in Unit::m_spellAuraHolders update and point to next element - AuraList m_deletedAuras; // auras removed while in ApplyModifier and waiting deleted - SpellAuraHolderList m_deletedHolders; - - SingleCastSpellTargetMap m_singleCastSpellTargets; // casted by unit single per-caster auras - - typedef std::list GameObjectList; - GameObjectList m_gameObj; - - uint32 m_transform; - float m_modelCollisionHeight; - - AuraList m_modAuras[TOTAL_AURAS]; - float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; - WeaponDamageInfo m_weaponDamage[MAX_ATTACK][MAX_ITEM_PROTO_DAMAGES]; - uint8 m_weaponDamageCount[MAX_ATTACK]; - bool m_canModifyStats; - //std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem - - float m_speed_rate[MAX_MOVE_TYPE]; - - CharmInfo *m_charmInfo; - ObjectGuid m_possessorGuid; // Guid of unit possessing this one - - MotionMaster i_motionMaster; - - uint32 m_reactiveTimer[MAX_REACTIVE]; - ObjectGuid m_reactiveTarget[MAX_REACTIVE]; - int32 m_regenTimer; - uint32 m_lastManaUseSpellId; - uint32 m_lastManaUseTimer; - uint32 m_spellUpdateTimeBuffer; - - SpellCooldowns m_spellCooldowns; - GlobalCooldownMgr m_GlobalCooldownMgr; - - bool m_isCreatureLinkingTrigger; - bool m_isSpawningLinked; - - public: - bool m_AutoRepeatFirstCast; - void DisableSpline(); - void UnitDamaged(ObjectGuid from, uint32 damage) { _damageTakenHistory[from] += damage; _lastDamageTaken = 0; } - void SetMeleeZLimit(float newZLimit) { m_meleeZLimit = newZLimit; } - float GetMeleeZLimit() const { return m_meleeZLimit; } - void SetMeleeZReach(float newZReach) { m_meleeZReach = newZReach; } - float GetMeleeZReach() const { return m_meleeZReach; } - - protected: - typedef std::map DamageTakenHistoryMap; - DamageTakenHistoryMap _damageTakenHistory; - uint32 _lastDamageTaken; - - float m_nativeScale = 1.0f; - float m_nativeScaleOverride = 1.0f; - - private: - void CleanupDeletedAuras(); - void UpdateSplineMovement(uint32 t_diff); - - Unit* _GetTotem(TotemSlot slot) const; // for templated function without include need - Pet* _GetPet(ObjectGuid guid) const; // for templated function without include need - - uint32 m_state; // Even derived shouldn't modify - uint32 m_CombatTimer; - - // extra attacks vars - uint32 m_extraAttacks; - bool m_extraMute; - bool m_doExtraAttacks; - - UnitVisibility m_Visibility; - Position m_last_notified_position; - bool m_AINotifyScheduled; - - Diminishing m_Diminishing; - // Manage all Units threatening us - ThreatManager m_ThreatManager; - - // Manage all Units that are threatened by us - HostileRefManager m_HostileRefManager; - FollowerRefManager m_FollowingRefManager; - - ComboPointHolderSet m_ComboPointHolders; - - GuardianPetList m_guardianPets; - - ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT]; - - float m_meleeZLimit; - float m_meleeZReach; + explicit Unit (); }; template @@ -2145,7 +1478,7 @@ void Unit::CallForAllControlledUnits(Func const& func, uint32 controlledMask) if (controlledMask & CONTROLLED_TOTEMS) { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) - if (Unit *totem = _GetTotem(TotemSlot(i))) + if (Unit* totem = _GetTotem(TotemSlot(i))) func(totem); } diff --git a/src/game/Objects/UnitDefines.h b/src/game/Objects/UnitDefines.h new file mode 100644 index 000000000..582a5a849 --- /dev/null +++ b/src/game/Objects/UnitDefines.h @@ -0,0 +1,539 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __UNIT_DEFINES_H +#define __UNIT_DEFINES_H + +#include "Common.h" + +enum UnitMoveType +{ + MOVE_WALK = 0, + MOVE_RUN = 1, + MOVE_RUN_BACK = 2, + MOVE_SWIM = 3, + MOVE_SWIM_BACK = 4, + MOVE_TURN_RATE = 5, +}; + +#define MAX_MOVE_TYPE 6 + +extern float baseMoveSpeed[MAX_MOVE_TYPE]; + +#define MOVEMENT_PACKET_TIME_DELAY 0 + +enum MovementChangeType +{ + INVALID, + + ROOT, + WATER_WALK, + SET_HOVER, + FEATHER_FALL, + + SPEED_CHANGE_WALK, + SPEED_CHANGE_RUN, + SPEED_CHANGE_RUN_BACK, + SPEED_CHANGE_SWIM, + SPEED_CHANGE_SWIM_BACK, + RATE_CHANGE_TURN, + + //TELEPORT, - not used + KNOCK_BACK +}; + +#define BASE_MELEERANGE_OFFSET 1.33f +#define BASE_MINDAMAGE 1.0f +#define BASE_MAXDAMAGE 2.0f +#define BASE_ATTACK_TIME 2000 + +// byte value (UNIT_FIELD_BYTES_1,0) +enum UnitStandStateType +{ + UNIT_STAND_STATE_STAND = 0, + UNIT_STAND_STATE_SIT = 1, + UNIT_STAND_STATE_SIT_CHAIR = 2, + UNIT_STAND_STATE_SLEEP = 3, + UNIT_STAND_STATE_SIT_LOW_CHAIR = 4, + UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5, + UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6, + UNIT_STAND_STATE_DEAD = 7, + UNIT_STAND_STATE_KNEEL = 8 +}; + +#define MAX_UNIT_STAND_STATE 9 + +/* byte flag value not exist in 1.12, moved/merged in (UNIT_FIELD_BYTES_1,3), in post-1.x it's in (UNIT_FIELD_BYTES_1,2) +enum UnitStandFlags +*/ + +// byte flags value (UNIT_FIELD_BYTES_1,3) +enum UnitBytes1_Flags +{ + UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01, // Ajoute a la mort. Non affichage du nom des vivants. + UNIT_BYTE1_FLAGS_CREEP = 0x02, + UNIT_BYTE1_FLAG_UNTRACKABLE = 0x04, + UNIT_BYTE1_FLAG_ALL = 0xFF +}; + +// byte value (UNIT_FIELD_BYTES_2,0) +enum SheathState +{ + SHEATH_STATE_UNARMED = 0, // non prepared weapon + SHEATH_STATE_MELEE = 1, // prepared melee weapon + SHEATH_STATE_RANGED = 2 // prepared ranged weapon +}; + +#define MAX_SHEATH_STATE 3 + +// byte flags value (UNIT_FIELD_BYTES_2,1) +enum UnitBytes2_Flags +{ + UNIT_BYTE2_FLAG_PVP = 0x01, + UNIT_BYTE2_FLAG_UNK1 = 0x02, + UNIT_BYTE2_FLAG_FFA_PVP = 0x04, + UNIT_BYTE2_FLAG_UNK3 = 0x08, // FLAG_SANCTUARY on 3.3.5 + UNIT_BYTE2_FLAG_AURAS = 0x10, // show possitive auras as positive, and allow its dispel + UNIT_BYTE2_FLAG_UNK5 = 0x20, + UNIT_BYTE2_FLAG_UNK6 = 0x40, + UNIT_BYTE2_FLAG_UNK7 = 0x80 +}; + +#define CREATURE_MAX_SPELLS 4 + +enum Swing +{ + NOSWING = 0, + SINGLEHANDEDSWING = 1, + TWOHANDEDSWING = 2 +}; + +enum VictimState +{ + VICTIMSTATE_UNAFFECTED = 0, // seen in relation with HITINFO_MISS + VICTIMSTATE_NORMAL = 1, + VICTIMSTATE_DODGE = 2, + VICTIMSTATE_PARRY = 3, + VICTIMSTATE_INTERRUPT = 4, + VICTIMSTATE_BLOCKS = 5, + VICTIMSTATE_EVADES = 6, + VICTIMSTATE_IS_IMMUNE = 7, + VICTIMSTATE_DEFLECTS = 8 +}; + +enum HitInfo +{ + HITINFO_NORMALSWING = 0x00000000, + HITINFO_UNK0 = 0x00000001, // req correct packet structure + HITINFO_NORMALSWING2 = 0x00000002, + HITINFO_LEFTSWING = 0x00000004, + HITINFO_UNK3 = 0x00000008, + HITINFO_MISS = 0x00000010, + HITINFO_ABSORB = 0x00000020, // plays absorb sound + HITINFO_RESIST = 0x00000040, // resisted atleast some damage +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 + HITINFO_CRITICALHIT = 0x00000080, +#else + HITINFO_CRITICALHIT = 0x00000008, +#endif + HITINFO_UNK8 = 0x00000100, // wotlk? + HITINFO_UNK9 = 0x00002000, // wotlk? + HITINFO_GLANCING = 0x00004000, + HITINFO_CRUSHING = 0x00008000, + HITINFO_NOACTION = 0x00010000, + HITINFO_SWINGNOHITSOUND = 0x00080000 +}; + +//i would like to remove this: (it is defined in item.h +enum InventorySlot +{ + NULL_BAG = 0, + NULL_SLOT = 255 +}; + + +struct SpellImmune +{ + uint32 type; + uint32 spellId; +}; + +typedef std::list SpellImmuneList; + +enum UnitModifierType +{ + BASE_VALUE = 0, + BASE_PCT = 1, + TOTAL_VALUE = 2, + TOTAL_PCT = 3, + MODIFIER_TYPE_END = 4 +}; + +enum WeaponDamageRange +{ + MINDAMAGE, + MAXDAMAGE +}; + +enum DamageTypeToSchool +{ + RESISTANCE, + DAMAGE_DEALT, + DAMAGE_TAKEN +}; + +enum AuraRemoveMode +{ + AURA_REMOVE_BY_DEFAULT, + AURA_REMOVE_BY_STACK, // at replace by similar aura + AURA_REMOVE_BY_CANCEL, + AURA_REMOVE_BY_DISPEL, + AURA_REMOVE_BY_DEATH, + AURA_REMOVE_BY_DELETE, // use for speedup and prevent unexpected effects at player logout/pet unsummon (must be used _only_ after save), delete. + AURA_REMOVE_BY_SHIELD_BREAK, // when absorb shield is removed by damage + AURA_REMOVE_BY_EXPIRE, // at duration end + AURA_REMOVE_BY_CHANNEL, // when removing an aura due to channel finish or cancel + AURA_REMOVE_BY_RANGE, // when removing an area aura due to being out of range + AURA_REMOVE_BY_GROUP // when removing an aura due to not being in the same group (includes pet ownership) +}; + +enum UnitMods +{ + UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existing order, it's accessed by index values of Stats enum. + UNIT_MOD_STAT_AGILITY, + UNIT_MOD_STAT_STAMINA, + UNIT_MOD_STAT_INTELLECT, + UNIT_MOD_STAT_SPIRIT, + UNIT_MOD_HEALTH, + UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_HAPPINESS must be in existing order, it's accessed by index values of Powers enum. + UNIT_MOD_RAGE, + UNIT_MOD_FOCUS, + UNIT_MOD_ENERGY, + UNIT_MOD_HAPPINESS, + UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum. + UNIT_MOD_RESISTANCE_HOLY, + UNIT_MOD_RESISTANCE_FIRE, + UNIT_MOD_RESISTANCE_NATURE, + UNIT_MOD_RESISTANCE_FROST, + UNIT_MOD_RESISTANCE_SHADOW, + UNIT_MOD_RESISTANCE_ARCANE, + UNIT_MOD_ATTACK_POWER, + UNIT_MOD_ATTACK_POWER_RANGED, + UNIT_MOD_DAMAGE_MAINHAND, + UNIT_MOD_DAMAGE_OFFHAND, + UNIT_MOD_DAMAGE_RANGED, + UNIT_MOD_DAMAGE_PHYSICAL, + UNIT_MOD_END, + // synonyms + UNIT_MOD_STAT_START = UNIT_MOD_STAT_STRENGTH, + UNIT_MOD_STAT_END = UNIT_MOD_STAT_SPIRIT + 1, + UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR, + UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1, + UNIT_MOD_POWER_START = UNIT_MOD_MANA, + UNIT_MOD_POWER_END = UNIT_MOD_HAPPINESS + 1 +}; + +enum BaseModGroup +{ + CRIT_PERCENTAGE, + RANGED_CRIT_PERCENTAGE, + OFFHAND_CRIT_PERCENTAGE, + SHIELD_BLOCK_VALUE, + BASEMOD_END +}; + +enum BaseModType +{ + FLAT_MOD, + PCT_MOD +}; + +#define MOD_END (PCT_MOD+1) + +enum DeathState +{ + ALIVE = 0, // show as alive + JUST_DIED = 1, // temporary state at die, for creature auto converted to CORPSE, for player at next update call + CORPSE = 2, // corpse state, for player spirit is still within the corpse + DEAD = 3, // for creature despawned state (corpse despawned), for player spirit has been released (player is ghost) + JUST_ALIVED = 4, // temporary state at resurrection, for creature auto converted to ALIVE, for player at next update call + CORPSE_FALLING = 5 // corpse state in case when corpse still falling to ground +}; + +// internal state flags for some auras and movement generators, other. +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_DIED = 0x00000004, // Unit::SetFeignDeath + 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 + + // 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 + + // 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_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, + // MMAPS + UNIT_STAT_IGNORE_PATHFINDING = 0x00080000, // do not use pathfinding in any MovementGenerator + + UNIT_STAT_PENDING_ROOT = 0x00100000, + UNIT_STAT_PENDING_STUNNED = 0x00200000, + UNIT_STAT_FLYING_ALLOWED = 0x00400000, // has gm fly mode enabled + + // High-level states + UNIT_STAT_NO_COMBAT_MOVEMENT = 0x01000000, + UNIT_STAT_RUNNING = 0x02000000, + UNIT_STAT_IGNORE_MOVE_LOS = 0x04000000, + + UNIT_STAT_ALLOW_INCOMPLETE_PATH = 0x08000000, // allow movement with incomplete or partial paths + UNIT_STAT_ALLOW_LOS_ATTACK = 0x10000000, // allow melee attacks without LoS + // masks (only for check) + + // can't move currently + UNIT_STAT_CAN_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED, + + // stay by different reasons + UNIT_STAT_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED | + UNIT_STAT_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_DIED | + UNIT_STAT_TAXI_FLIGHT | + UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, + + // not react at move in sight or other + UNIT_STAT_CAN_NOT_REACT = UNIT_STAT_STUNNED | UNIT_STAT_DIED | + UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING, + + // AI disabled by some reason + UNIT_STAT_LOST_CONTROL = UNIT_STAT_FLEEING | UNIT_STAT_POSSESSED, + + // above 2 state cases + UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL = UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_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_STAT_ALL_STATE = 0xFFFFFFFF, + UNIT_STAT_ALL_DYN_STATES = UNIT_STAT_ALL_STATE & ~(UNIT_STAT_NO_COMBAT_MOVEMENT | UNIT_STAT_RUNNING | UNIT_STAT_IGNORE_PATHFINDING), +}; + +enum UnitVisibility +{ + VISIBILITY_OFF = 0, // absolute, not detectable, GM-like, can see all other + VISIBILITY_ON = 1, + VISIBILITY_GROUP_STEALTH = 2, // detect chance, seen and can see group members + VISIBILITY_GROUP_INVISIBILITY = 3, // invisibility, can see and can be seen only another invisible unit or invisible detection unit, set only if not stealthed, and in checks not used (mask used instead) + VISIBILITY_GROUP_NO_DETECT = 4, // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break + VISIBILITY_RESPAWN = 5 // special totally not detectable visibility for force delete object at respawn command +}; + +// [-ZERO] Need recheck values +// Value masks for UNIT_FIELD_FLAGS +enum UnitFlags +{ + UNIT_FLAG_NONE = 0x00000000, + UNIT_FLAG_UNK_0 = 0x00000001, // Movement checks disabled, likely paired with loss of client control packet. + UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable + UNIT_FLAG_DISABLE_MOVE = 0x00000004, + UNIT_FLAG_PLAYER_CONTROLLED = 0x00000008, // players, pets, totems, guardians, companions, charms, any units associated with players + UNIT_FLAG_PET_RENAME = 0x00000010, // Old pet rename: moved to UNIT_FIELD_BYTES_2,2 in TBC+ + UNIT_FLAG_PET_ABANDON = 0x00000020, // Old pet abandon: moved to UNIT_FIELD_BYTES_2,2 in TBC+ + UNIT_FLAG_UNK_6 = 0x00000040, + UNIT_FLAG_IMMUNE_TO_PLAYER = 0x00000100, // Target is immune to players + UNIT_FLAG_PASSIVE = 0x00000200, // makes you unable to attack everything. Almost identical to our "civilian"-term. Will ignore it's surroundings and not engage in combat unless "called upon" or engaged by another unit. + UNIT_FLAG_PVP = 0x00001000, + UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1 + UNIT_FLAG_UNK_14 = 0x00004000, + UNIT_FLAG_USE_SWIM_ANIMATION = 0x00008000, + UNIT_FLAG_NON_ATTACKABLE_2 = 0x00010000, // removes attackable icon, if on yourself, cannot assist self but can cast TARGET_UNIT_CASTER spells - added by SPELL_AURA_MOD_UNATTACKABLE + UNIT_FLAG_PACIFIED = 0x00020000, + UNIT_FLAG_STUNNED = 0x00040000, // Unit is a subject to stun, turn and strafe movement disabled + UNIT_FLAG_IN_COMBAT = 0x00080000, + UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // Unit is on taxi, paired with a duplicate loss of client control packet (likely a legacy serverside hack). Disables any spellcasts not allowed in taxi flight client-side. + UNIT_FLAG_CONFUSED = 0x00400000, // Unit is a subject to confused movement, movement checks disabled, paired with loss of client control packet. + UNIT_FLAG_FLEEING = 0x00800000, // Unit is a subject to fleeing movement, movement checks disabled, paired with loss of client control packet. + UNIT_FLAG_POSSESSED = 0x01000000, // Unit is under remote control by another unit, movement checks disabled, paired with loss of client control packet. New master is allowed to use melee attack and can't select this unit via mouse in the world (as if it was own character). + UNIT_FLAG_NOT_SELECTABLE = 0x02000000, + UNIT_FLAG_SKINNABLE = 0x04000000, + UNIT_FLAG_AURAS_VISIBLE = 0x08000000, // magic detect + UNIT_FLAG_SHEATHE = 0x40000000, + UNIT_FLAG_IMMUNE = 0x80000000, // Immune to damage + + // [-ZERO] TBC enumerations [?] + UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PLAYER_CONTROLLED | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE + UNIT_FLAG_LOOTING = 0x00000400, // loot animation + UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 + UNIT_FLAG_DISARMED = 0x00200000, // disable melee spells casting..., "Required melee weapon" added to melee spells tooltip. + + UNIT_FLAG_UNK_28 = 0x10000000, + UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell +}; + +/// Non Player Character flags +enum NPCFlags +{ + UNIT_NPC_FLAG_NONE = 0x00000000, + UNIT_NPC_FLAG_GOSSIP = 0x00000001, // 100% + UNIT_NPC_FLAG_QUESTGIVER = 0x00000002, // 100% + UNIT_NPC_FLAG_VENDOR = 0x00000004, // 100% + UNIT_NPC_FLAG_FLIGHTMASTER = 0x00000008, // 100% + UNIT_NPC_FLAG_TRAINER = 0x00000010, // 100% + UNIT_NPC_FLAG_SPIRITHEALER = 0x00000020, // guessed + UNIT_NPC_FLAG_SPIRITGUIDE = 0x00000040, // guessed + UNIT_NPC_FLAG_INNKEEPER = 0x00000080, // 100% + UNIT_NPC_FLAG_BANKER = 0x00000100, // 100% + UNIT_NPC_FLAG_PETITIONER = 0x00000200, // 100% 0xC0000 = guild petitions + UNIT_NPC_FLAG_TABARDDESIGNER = 0x00000400, // 100% + UNIT_NPC_FLAG_BATTLEMASTER = 0x00000800, // 100% + UNIT_NPC_FLAG_AUCTIONEER = 0x00001000, // 100% + UNIT_NPC_FLAG_STABLEMASTER = 0x00002000, // 100% + UNIT_NPC_FLAG_REPAIR = 0x00004000, // 100% + UNIT_NPC_FLAG_OUTDOORPVP = 0x20000000, // custom flag for outdoor pvp creatures || Custom flag +}; + +enum AutoAttackCheckResult +{ + ATTACK_RESULT_OK = 0, + ATTACK_RESULT_NOT_IN_RANGE = 1, + ATTACK_RESULT_BAD_FACING = 2, + ATTACK_RESULT_CANT_ATTACK = 3, + ATTACK_RESULT_DEAD = 4, + ATTACK_RESULT_FRIENDLY_TARGET = 5, +}; + +enum ActiveStates +{ + ACT_PASSIVE = 0x01, // 0x01 - passive + ACT_DISABLED = 0x81, // 0x80 - castable + ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable + ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04 + ACT_REACTION = 0x06, // 0x02 | 0x04 + ACT_DECIDE = 0x00 // custom +}; + +enum ReactStates +{ + REACT_PASSIVE = 0, + REACT_DEFENSIVE = 1, + REACT_AGGRESSIVE = 2 +}; + +enum CommandStates +{ + COMMAND_STAY = 0, + COMMAND_FOLLOW = 1, + COMMAND_ATTACK = 2, + COMMAND_DISMISS = 3 +}; + +enum ActionBarIndex +{ + ACTION_BAR_INDEX_START = 0, + ACTION_BAR_INDEX_PET_SPELL_START = 3, + ACTION_BAR_INDEX_PET_SPELL_END = 7, + ACTION_BAR_INDEX_END = 10, +}; + +#define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START) + +// used in CallForAllControlledUnits/CheckAllControlledUnits +enum ControlledUnitMask +{ + CONTROLLED_PET = 0x01, + CONTROLLED_MINIPET = 0x02, + CONTROLLED_GUARDIANS = 0x04, // including PROTECTOR_PET + CONTROLLED_CHARM = 0x08, + CONTROLLED_TOTEMS = 0x10, +}; + +// for clearing special attacks +#define REACTIVE_TIMER_START 4000 + +enum ReactiveType +{ + REACTIVE_DEFENSE = 1, + REACTIVE_HUNTER_PARRY = 2, + REACTIVE_CRIT = 3, + //REACTIVE_HUNTER_CRIT = 4, + REACTIVE_OVERPOWER = 5 +}; + +#define MAX_REACTIVE 6 + +// for Unit::AddAura +enum AddAuraFlags +{ + ADD_AURA_NO_OPTION = 0x00, + ADD_AURA_POSITIVE = 0x01, + ADD_AURA_NEGATIVE = 0x02, + ADD_AURA_PASSIVE = 0x04, + ADD_AURA_PERMANENT = 0x08, +}; + + +enum UnitDebugFlags +{ + DEBUG_SPELL_COMPUTE_RESISTS = 0x01, + DEBUG_PACKETS_RECV = 0x02, + DEBUG_PACKETS_SEND = 0x04, + DEBUG_AI = 0x08, + DEBUG_DR = 0x10, + DEBUG_CHEAT = 0x20, + DEBUG_PROCS = 0x40, + DEBUG_SPELLS_DAMAGE = 0x80, +}; + + +enum TeleportToOptions +{ + TELE_TO_GM_MODE = 0x01, + TELE_TO_NOT_LEAVE_TRANSPORT = 0x02, + TELE_TO_NOT_LEAVE_COMBAT = 0x04, + TELE_TO_NOT_UNSUMMON_PET = 0x08, + TELE_TO_SPELL = 0x10, + TELE_TO_FORCE_MAP_CHANGE = 0x20, +}; + +#define UNIT_DEFAULT_MELEE_Z_LIMIT 36 // vertical range diff limit for melee attacks (no meleeing units that fly too high overhead) + +enum MovementModType +{ + MOV_MOD_FLEE_FOR_ASSISTANCE = 0, + MOV_MOD_FLEE_IN_FEAR = 1, + MOV_MOD_CONFUSED = 2 +}; + + +#endif diff --git a/src/game/PlayerBots/PlayerBotAI.cpp b/src/game/PlayerBots/PlayerBotAI.cpp index 146adfecb..19ab7d534 100644 --- a/src/game/PlayerBots/PlayerBotAI.cpp +++ b/src/game/PlayerBots/PlayerBotAI.cpp @@ -7,7 +7,7 @@ #include "ObjectMgr.h" #include "MoveSpline.h" #include "PlayerBotMgr.h" - +#include "WorldPacket.h" bool PlayerBotAI::OnSessionLoaded(PlayerBotEntry* entry, WorldSession* sess) { @@ -118,21 +118,21 @@ bool MageOrgrimmarAttackerAI::OnSessionLoaded(PlayerBotEntry* entry, WorldSessio void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) { PlayerBotAI::UpdateAI(diff); - if (me->getLevel() != 60) + if (me->GetLevel() != 60) me->GiveLevel(60); /// DEATH - if (!me->isAlive()) + if (!me->IsAlive()) { sPlayerBotMgr.deleteBot(me->GetGUIDLow()); /* - if (me->getDeathState() < CORPSE) + if (me->GetDeathState() < CORPSE) return; - if (me->getDeathState() == CORPSE && me->GetDeathTimer() && me->GetDeathTimer() < (6 * MINUTE * IN_MILLISECONDS - 30000)) + if (me->GetDeathState() == CORPSE && me->GetDeathTimer() && me->GetDeathTimer() < (6 * MINUTE * IN_MILLISECONDS - 30000)) { me->SetHealth(1); me->RepopAtGraveyard(); } - else if (me->getDeathState() == CORPSE && !me->GetDeathTimer()) + else if (me->GetDeathState() == CORPSE && !me->GetDeathTimer()) { me->ResurrectPlayer(0.5f); me->SpawnCorpseBones(); @@ -143,12 +143,12 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) /// COMBAT AI if (me->IsNonMeleeSpellCasted(false) || (me->HasAura(AURA_REGEN_MANA) && me->GetPower(POWER_MANA) != me->GetMaxPower(POWER_MANA))) return; - float range = me->isInCombat() ? 30.0f : frand(15, 30); + float range = me->IsInCombat() ? 30.0f : frand(15, 30); Unit* target = me->SelectNearestTarget(range); if (target && !me->IsWithinLOSInMap(target)) target = nullptr; // OOM ? - if (me->GetPower(POWER_MANA) < 40 && target && me->isInCombat()) + if (me->GetPower(POWER_MANA) < 40 && target && me->IsInCombat()) { if (me->Attack(target, true)) me->GetMotionMaster()->MoveChase(target); @@ -161,7 +161,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) if (!me->HasSpellCooldown(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_STAT_CAN_NOT_MOVE)) { // already runing if (!me->movespline->Finalized()) @@ -196,7 +196,7 @@ void MageOrgrimmarAttackerAI::UpdateAI(const uint32 diff) return; } /// OUT OF COMBAT REGEN - if (!me->isInCombat() && me->GetPower(POWER_MANA) < 150) + if (!me->IsInCombat() && me->GetPower(POWER_MANA) < 150) { if (!me->movespline->Finalized()) me->StopMoving(); diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index 02a75da5b..c3b9ce55f 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -176,7 +176,7 @@ uint32 Quest::XPValue(Player *pPlayer) const { if (RewXP > 0) { - uint32 pLevel = pPlayer->getLevel(); + uint32 pLevel = pPlayer->GetLevel(); uint32 qLevel = QuestLevel; float fullxp = RewXP; diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 083003d08..f3d09bb09 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -63,8 +63,8 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const if (!factionEntry) return 0; - uint32 raceMask = m_player->getRaceMask(); - uint32 classMask = m_player->getClassMask(); + uint32 raceMask = m_player->GetRaceMask(); + uint32 classMask = m_player->GetClassMask(); int idx = factionEntry->GetIndexFitTo(raceMask, classMask); @@ -108,8 +108,8 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con if (!factionEntry) return 0; - uint32 raceMask = m_player->getRaceMask(); - uint32 classMask = m_player->getClassMask(); + uint32 raceMask = m_player->GetRaceMask(); + uint32 classMask = m_player->GetClassMask(); int idx = factionEntry->GetIndexFitTo(raceMask, classMask); diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index ff4c22d8f..25cef151a 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -2605,7 +2605,7 @@ WorldObject* GetTargetByType(WorldObject* pSource, WorldObject* pTarget, uint8 T return pTarget; case TARGET_T_HOSTILE: if (Unit* pUnitSource = ToUnit(pSource)) - return pUnitSource->getVictim(); + return pUnitSource->GetVictim(); break; case TARGET_T_HOSTILE_SECOND_AGGRO: if (Creature* pCreatureSource = ToCreature(pSource)) diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index 812dfd15d..d0c12a9db 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -24,14 +24,18 @@ #include "Policies/Singleton.h" #include "ObjectGuid.h" #include "DBCEnums.h" +#include "SpellDefines.h" #include "ace/Atomic_Op.h" -#include "SpellMgr.h" -#include "Creature.h" struct AreaTriggerEntry; class Aura; +class Object; +class Unit; +class Player; +class Creature; class CreatureAI; class GameObject; +class WorldObject; class GameObjectAI; class InstanceData; class Item; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 0a88f0492..79b3c4b23 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -144,80 +144,6 @@ enum Powers #define MAX_POWERS 5 // not count POWER_RUNES for now -/** - * The different spell schools that are available, used in both damage calculation - * and spell casting to decide what should be affected, the SPELL_SCHOOL_NORMAL - * is the armor, others should be self explanatory. - * - * Note that these are the values to use for changing ie, the armor via a - * Modifier, and it is the Modifier::m_miscValue that should be set. - */ -enum SpellSchools -{ - SPELL_SCHOOL_NORMAL = 0, // Physical, Armor - SPELL_SCHOOL_HOLY = 1, - SPELL_SCHOOL_FIRE = 2, - SPELL_SCHOOL_NATURE = 3, - SPELL_SCHOOL_FROST = 4, - SPELL_SCHOOL_SHADOW = 5, - SPELL_SCHOOL_ARCANE = 6 -}; - -#define MAX_SPELL_SCHOOL 7 - -/** - * A bitmask of the available SpellSchools. Used for convenience - */ -enum SpellSchoolMask -{ - SPELL_SCHOOL_MASK_NONE = 0x00, // not exist - SPELL_SCHOOL_MASK_NORMAL = (1 << SPELL_SCHOOL_NORMAL), // PHYSICAL (Armor) - SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY ), - SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE ), - SPELL_SCHOOL_MASK_NATURE = (1 << SPELL_SCHOOL_NATURE), - SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST ), - SPELL_SCHOOL_MASK_SHADOW = (1 << SPELL_SCHOOL_SHADOW), - SPELL_SCHOOL_MASK_ARCANE = (1 << SPELL_SCHOOL_ARCANE), - - // unions - - // 124, not include normal and holy damage - SPELL_SCHOOL_MASK_SPELL = ( SPELL_SCHOOL_MASK_FIRE | - SPELL_SCHOOL_MASK_NATURE | SPELL_SCHOOL_MASK_FROST | - SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE ), - // 126 - SPELL_SCHOOL_MASK_MAGIC = ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL ), - - // 127 - SPELL_SCHOOL_MASK_ALL = ( SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC ) -}; - -#define SPELL_SCHOOL_MASK_MAGIC \ - ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_FIRE | SPELL_SCHOOL_MASK_NATURE | \ - SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW | \ - SPELL_SCHOOL_MASK_ARCANE ) - -// converts school value into schoolmask missing in 1.12 dbc -inline SpellSchoolMask GetSchoolMask(uint32 school) -{ - return SpellSchoolMask(1 << school); -} - -inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask) -{ - for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) - if(mask & (1 << i)) - return SpellSchools(i); - - return SPELL_SCHOOL_NORMAL; -} - -enum SpellVisualKit -{ - SPELL_VISUAL_KIT_FOOD = 406, - SPELL_VISUAL_KIT_DRINK = 438 -}; - enum ItemQualities { ITEM_QUALITY_POOR = 0, // GREY @@ -241,190 +167,6 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = { 0xffe6cc80 // LIGHT YELLOW }; - -// *********************************** -// Spell Attributes definitions -// *********************************** -enum SpellAttributes -{ - SPELL_ATTR_DONT_DISPLAY_SPELL_RESULT = 0x00000001, // 0 - SPELL_ATTR_RANGED = 0x00000002, // 1 All ranged abilites have this flag - SPELL_ATTR_ON_NEXT_SWING_1 = 0x00000004, // 2 on next swing - SPELL_ATTR_IS_REPLENISHMENT = 0x00000008, // 3 not set in 2.4.2 - SPELL_ATTR_IS_ABILITY = 0x00000010, // 4 client puts 'ability' instead of 'spell' in game strings for these spells - SPELL_ATTR_TRADESPELL = 0x00000020, // 5 trade spells, will be added by client to a sublist of profession spell - SPELL_ATTR_PASSIVE = 0x00000040, // 6 Passive spell - SPELL_ATTR_HIDDEN_CLIENTSIDE = 0x00000080, // 7 Spells with this attribute are not visible in spellbook or aura bar - SPELL_ATTR_HIDE_IN_COMBAT_LOG = 0x00000100, // 8 this attributes controls whether spell appears in combat logs - SPELL_ATTR_TARGET_MAINHAND_ITEM = 0x00000200, // 9 Client automatically selects item from mainhand slot as a cast target - SPELL_ATTR_ON_NEXT_SWING_2 = 0x00000400, // 10 on next swing 2 - SPELL_ATTR_UNK11 = 0x00000800, // 11 - SPELL_ATTR_DAYTIME_ONLY = 0x00001000, // 12 only useable at daytime, not set in 2.4.2 - SPELL_ATTR_NIGHT_ONLY = 0x00002000, // 13 only useable at night, not set in 2.4.2 - SPELL_ATTR_INDOORS_ONLY = 0x00004000, // 14 only useable indoors, not set in 2.4.2 - SPELL_ATTR_OUTDOORS_ONLY = 0x00008000, // 15 Only useable outdoors. - SPELL_ATTR_NOT_SHAPESHIFT = 0x00010000, // 16 Not while shapeshifted - SPELL_ATTR_ONLY_STEALTHED = 0x00020000, // 17 Must be in stealth - SPELL_ATTR_DONT_AFFECT_SHEATH_STATE = 0x00040000, // 18 client won't hide unit weapons in sheath on cast/channel - SPELL_ATTR_LEVEL_DAMAGE_CALCULATION = 0x00080000, // 19 spelldamage depends on caster level - SPELL_ATTR_STOP_ATTACK_TARGET = 0x00100000, // 20 Stop attack after use this spell (and not begin attack if use) - SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK = 0x00200000, // 21 Cannot be dodged/parried/blocked - SPELL_ATTR_SET_TRACKING_TARGET = 0x00400000, // 22 SetTrackingTarget - SPELL_ATTR_CASTABLE_WHILE_DEAD = 0x00800000, // 23 castable while dead? - SPELL_ATTR_CASTABLE_WHILE_MOUNTED = 0x01000000, // 24 castable while mounted - SPELL_ATTR_DISABLED_WHILE_ACTIVE = 0x02000000, // 25 Activate and start cooldown after aura fade or remove summoned creature or go - SPELL_ATTR_NEGATIVE = 0x04000000, // 26 Almost all negative spell have it - SPELL_ATTR_CASTABLE_WHILE_SITTING = 0x08000000, // 27 castable while sitting - SPELL_ATTR_CANT_USED_IN_COMBAT = 0x10000000, // 28 Cannot be used in combat - SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY = 0x20000000, // 29 unaffected by invulnerability (hmm possible not...) - SPELL_ATTR_DIMINISHING_RETURNS = 0x40000000, // 30 breakable by damage? - SPELL_ATTR_CANT_CANCEL = 0x80000000 // 31 positive aura can't be canceled -}; - -enum SpellAttributesEx -{ - SPELL_ATTR_EX_DISMISS_PET = 0x00000001, // 0 for spells without this flag client doesn't allow to summon pet if caster has a pet - SPELL_ATTR_EX_DRAIN_ALL_POWER = 0x00000002, // 1 use all power (Only paladin Lay of Hands and Bunyanize) - SPELL_ATTR_EX_CHANNELED_1 = 0x00000004, // 2 channeled 1 - SPELL_ATTR_EX_CANT_BE_REDIRECTED = 0x00000008, // 3 - SPELL_ATTR_EX_UNK4 = 0x00000010, // 4 - SPELL_ATTR_EX_NOT_BREAK_STEALTH = 0x00000020, // 5 Not break stealth - SPELL_ATTR_EX_CHANNELED_2 = 0x00000040, // 6 channeled 2 - SPELL_ATTR_EX_CANT_BE_REFLECTED = 0x00000080, // 7 - SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET = 0x00000100, // 8 Spell req target not to be in combat state - SPELL_ATTR_EX_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast - SPELL_ATTR_EX_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% - SPELL_ATTR_EX_UNK11 = 0x00000800, // 11 - SPELL_ATTR_EX_IS_PICKPOCKET = 0x00001000, // 12 - SPELL_ATTR_EX_FARSIGHT = 0x00002000, // 13 - SPELL_ATTR_EX_CHANNEL_TRACK_TARGET = 0x00004000, // 14 Client automatically forces player to face target when channeling - SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity - SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // 16 unaffected by school immunity - SPELL_ATTR_EX_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 for auras SPELL_AURA_TRACK_CREATURES, SPELL_AURA_TRACK_RESOURCES and SPELL_AURA_TRACK_STEALTHED select non-stacking tracking spells - SPELL_ATTR_EX_UNK18 = 0x00040000, // 18 stun, polymorph, daze, sleep - SPELL_ATTR_EX_CANT_TARGET_SELF = 0x00080000, // 19 - SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS = 0x00100000, // 20 Req combo points on target - SPELL_ATTR_EX_UNK21 = 0x00200000, // 21 - SPELL_ATTR_EX_REQ_COMBO_POINTS = 0x00400000, // 22 Use combo points (in 4.x not required combo point target selected) - SPELL_ATTR_EX_UNK23 = 0x00800000, // 23 - SPELL_ATTR_EX_IS_FISHING = 0x01000000, // 24 only fishing spells - SPELL_ATTR_EX_UNK25 = 0x02000000, // 25 not set in 2.4.2 - SPELL_ATTR_EX_UNK26 = 0x04000000, // 26 - SPELL_ATTR_EX_REFUND_POWER = 0x08000000, // 27 All these spells refund power on parry or deflect - SPELL_ATTR_EX_DONT_DISPLAY_IN_AURA_BAR = 0x10000000, // 28 client doesn't display these spells in aura bar - SPELL_ATTR_EX_CHANNEL_DISPLAY_SPELL_NAME = 0x20000000, // 29 spell name is displayed in cast bar instead of 'channeling' text - SPELL_ATTR_EX_ENABLE_AT_DODGE = 0x40000000, // 30 Overpower - SPELL_ATTR_EX_UNK31 = 0x80000000 // 31 -}; - -enum SpellAttributesEx2 -{ - SPELL_ATTR_EX2_CAN_TARGET_DEAD = 0x00000001, // 0 can target dead unit or corpse - SPELL_ATTR_EX2_UNK1 = 0x00000002, // 1 - SPELL_ATTR_EX2_IGNORE_LOS = 0x00000004, // 2 ? used for detect can or not spell reflected // do not need LOS (e.g. 18220 since 3.3.3) - SPELL_ATTR_EX2_UNK3 = 0x00000008, // 3 auto targeting? (e.g. fishing skill enhancement items since 3.3.3) - SPELL_ATTR_EX2_DISPLAY_IN_STANCE_BAR = 0x00000010, // 4 client displays icon in stance bar when learned, even if not shapeshift - SPELL_ATTR_EX2_AUTOREPEAT_FLAG = 0x00000020, // 5 - SPELL_ATTR_EX2_CANT_TARGET_TAPPED = 0x00000040, // 6 target must be tapped by caster - SPELL_ATTR_EX2_UNK7 = 0x00000080, // 7 - SPELL_ATTR_EX2_UNK8 = 0x00000100, // 8 not set in 2.4.2 - SPELL_ATTR_EX2_UNK9 = 0x00000200, // 9 - SPELL_ATTR_EX2_UNK10 = 0x00000400, // 10 - SPELL_ATTR_EX2_HEALTH_FUNNEL = 0x00000800, // 11 - SPELL_ATTR_EX2_UNK12 = 0x00001000, // 12 - SPELL_ATTR_EX2_PRESERVE_ENCHANT_IN_ARENA = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas - SPELL_ATTR_EX2_UNK14 = 0x00004000, // 14 - SPELL_ATTR_EX2_UNK15 = 0x00008000, // 15 not set in 2.4.2 - SPELL_ATTR_EX2_TAME_BEAST = 0x00010000, // 16 - SPELL_ATTR_EX2_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 don't reset timers for melee autoattacks (swings) or ranged autoattacks (autoshoots) - SPELL_ATTR_EX2_REQ_DEAD_PET = 0x00040000, // 18 Only Revive pet - SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT = 0x00080000, // 19 does not necessary need shapeshift (pre-3.x not have passive spells with this attribute) - SPELL_ATTR_EX2_UNK20 = 0x00100000, // 20 - SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD = 0x00200000, // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure! - SPELL_ATTR_EX2_UNK22 = 0x00400000, // 22 - SPELL_ATTR_EX2_IS_ARCANE_CONCENTRATION = 0x00800000, // 23 Only mage Arcane Concentration have this flag - SPELL_ATTR_EX2_UNK24 = 0x01000000, // 24 - SPELL_ATTR_EX2_UNK25 = 0x02000000, // 25 - SPELL_ATTR_EX2_UNK26 = 0x04000000, // 26 unaffected by school immunity - SPELL_ATTR_EX2_UNK27 = 0x08000000, // 27 - SPELL_ATTR_EX2_UNK28 = 0x10000000, // 28 no breaks stealth if it fails?? - SPELL_ATTR_EX2_CANT_CRIT = 0x20000000, // 29 Spell can't crit - SPELL_ATTR_EX2_TRIGGERED_CAN_TRIGGER_PROC = 0x40000000, // 30 - SPELL_ATTR_EX2_FOOD_BUFF = 0x80000000 // 31 Food or Drink Buff (like Well Fed) -}; - -enum SpellAttributesEx3 -{ - SPELL_ATTR_EX3_OUT_OF_COMBAT_ATTACK = 0x00000001, // 0 Spell landed counts as hostile action against enemy even if it doesn't trigger combat state, propagates PvP flags - SPELL_ATTR_EX3_UNK1 = 0x00000002, // 1 - SPELL_ATTR_EX3_UNK2 = 0x00000004, // 2 - SPELL_ATTR_EX3_BLOCKABLE_SPELL = 0x00000008, // 3 Only dmg class melee in 3.1.3 - SPELL_ATTR_EX3_IGNORE_RESURRECTION_TIMER = 0x00000010, // 4 you don't have to wait to be resurrected with these spells. Druid Rebirth only this spell have this flag - SPELL_ATTR_EX3_UNK5 = 0x00000020, // 5 - SPELL_ATTR_EX3_UNK6 = 0x00000040, // 6 - SPELL_ATTR_EX3_STACK_FOR_DIFF_CASTERS = 0x00000080, // 7 create a separate (de)buff stack for each caster - SPELL_ATTR_EX3_TARGET_ONLY_PLAYER = 0x00000100, // 8 can target only players - SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_PROC = 0x00000200, // 9 - SPELL_ATTR_EX3_MAIN_HAND = 0x00000400, // 10 Main hand weapon required - SPELL_ATTR_EX3_BATTLEGROUND = 0x00000800, // 11 Can casted only on battleground - SPELL_ATTR_EX3_CAST_ON_DEAD = 0x00001000, // 12 target is a dead player (not every spell has this flag) - SPELL_ATTR_EX3_DONT_DISPLAY_CHANNEL_BAR = 0x00002000, // 13 Clientside attribute - will not display channeling bar - SPELL_ATTR_EX3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag - SPELL_ATTR_EX3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag - SPELL_ATTR_EX3_CANT_TRIGGER_PROC = 0x00010000, // 16 confirmed with many patchnotes - SPELL_ATTR_EX3_NO_INITIAL_AGGRO = 0x00020000, // 17 Causes no aggro if not missed - SPELL_ATTR_EX3_CANT_MISS = 0x00040000, // 18 Spell should always hit its target - SPELL_ATTR_EX3_UNK19 = 0x00080000, // 19 during aura proc no spells can trigger (20178, 20375) - SPELL_ATTR_EX3_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells - SPELL_ATTR_EX3_UNK21 = 0x00200000, // 21 - SPELL_ATTR_EX3_REQ_WAND = 0x00400000, // 22 Req wand - SPELL_ATTR_EX3_UNK23 = 0x00800000, // 23 - SPELL_ATTR_EX3_REQ_OFFHAND = 0x01000000, // 24 Req offhand weapon - SPELL_ATTR_EX3_UNK25 = 0x02000000, // 25 no cause spell pushback ? - SPELL_ATTR_EX3_UNK26 = 0x04000000, // 26 - SPELL_ATTR_EX3_DRAIN_SOUL = 0x08000000, // 27 - SPELL_ATTR_EX3_UNK28 = 0x10000000, // 28 - SPELL_ATTR_EX3_UNK29 = 0x20000000, // 29 Probably ignore any damage modifiers (determined to be so in trinitycore as well) - SPELL_ATTR_EX3_DONT_DISPLAY_RANGE = 0x40000000, // 30 - SPELL_ATTR_EX3_UNK31 = 0x80000000 // 31 -}; - -enum SpellAttributesEx4 -{ - SPELL_ATTR_EX4_IGNORE_RESISTANCES = 0x00000001, // 0 From TC 3.3.5, but not present in 1.12 native DBCs. Add it with spell_mod to prevent a spell from being resisted. - SPELL_ATTR_EX4_UNK1 = 0x00000002, // 1 proc on finishing move? - SPELL_ATTR_EX4_REAL_TIME_DURATION = 0x00000004, // 2 aura continues to expire while player is offline - SPELL_ATTR_EX4_UNK3 = 0x00000008, // 3 - SPELL_ATTR_EX4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use?? - SPELL_ATTR_EX4_UNK5 = 0x00000020, // 5 - SPELL_ATTR_EX4_NOT_STEALABLE = 0x00000040, // 6 although such auras might be dispellable, they cannot be stolen - SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING = 0x00000080, // 7 In theory, can use this spell while another is channeled/cast/autocast - SPELL_ATTR_EX4_STACK_DOT_MODIFIER = 0x00000100, // 8 no effect on non DoTs? - SPELL_ATTR_EX4_TRIGGER_ACTIVATE = 0x00000200, // 9 initially disabled / trigger activate from event (Execute, Riposte, Deep Freeze end other) - SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST = 0x00000400, // 10 Rogue Shiv have this flag - SPELL_ATTR_EX4_UNK11 = 0x00000800, // 11 - SPELL_ATTR_EX4_UNK12 = 0x00001000, // 12 - SPELL_ATTR_EX4_UNK13 = 0x00002000, // 13 - SPELL_ATTR_EX4_DAMAGE_DOESNT_BREAK_AURAS = 0x00004000, // 14 - SPELL_ATTR_EX4_UNK15 = 0x00008000, // 15 -// SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA = 0x00010000, // 16 not usable in arena -// SPELL_ATTR_EX4_USABLE_IN_ARENA = 0x00020000, // 17 usable in arena - SPELL_ATTR_EX4_UNK18 = 0x00040000, // 18 - SPELL_ATTR_EX4_UNK19 = 0x00080000, // 19 - SPELL_ATTR_EX4_NOT_CHECK_SELFCAST_POWER = 0x00100000, // 20 do not give "more powerful spell" error message - SPELL_ATTR_EX4_UNK21 = 0x00200000, // 21 - SPELL_ATTR_EX4_UNK22 = 0x00400000, // 22 - SPELL_ATTR_EX4_UNK23 = 0x00800000, // 23 - SPELL_ATTR_EX4_UNK24 = 0x01000000, // 24 - SPELL_ATTR_EX4_IS_PET_SCALING = 0x02000000, // 25 pet scaling auras - SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND = 0x04000000, // 26 Can only be used in Outland. - SPELL_ATTR_EX4_UNK27 = 0x08000000, // 27 - SPELL_ATTR_EX4_UNK28 = 0x10000000, // 28 - SPELL_ATTR_EX4_UNK29 = 0x20000000, // 29 - SPELL_ATTR_EX4_UNK30 = 0x40000000, // 30 - SPELL_ATTR_EX4_UNK31 = 0x80000000, // 31 -}; - enum SheathTypes { SHEATHETYPE_NONE = 0, @@ -494,428 +236,6 @@ enum Team ALLIANCE = 469, }; -enum SpellEffects -{ - SPELL_EFFECT_NONE = 0, - SPELL_EFFECT_INSTAKILL = 1, - SPELL_EFFECT_SCHOOL_DAMAGE = 2, - SPELL_EFFECT_DUMMY = 3, - SPELL_EFFECT_PORTAL_TELEPORT = 4, - SPELL_EFFECT_TELEPORT_UNITS = 5, - SPELL_EFFECT_APPLY_AURA = 6, - SPELL_EFFECT_ENVIRONMENTAL_DAMAGE = 7, - SPELL_EFFECT_POWER_DRAIN = 8, - SPELL_EFFECT_HEALTH_LEECH = 9, - SPELL_EFFECT_HEAL = 10, - SPELL_EFFECT_BIND = 11, - SPELL_EFFECT_PORTAL = 12, - SPELL_EFFECT_RITUAL_BASE = 13, - SPELL_EFFECT_RITUAL_SPECIALIZE = 14, - SPELL_EFFECT_RITUAL_ACTIVATE_PORTAL = 15, - SPELL_EFFECT_QUEST_COMPLETE = 16, - SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL = 17, - SPELL_EFFECT_RESURRECT = 18, - SPELL_EFFECT_ADD_EXTRA_ATTACKS = 19, - SPELL_EFFECT_DODGE = 20, - SPELL_EFFECT_EVADE = 21, - SPELL_EFFECT_PARRY = 22, - SPELL_EFFECT_BLOCK = 23, - SPELL_EFFECT_CREATE_ITEM = 24, - SPELL_EFFECT_WEAPON = 25, - SPELL_EFFECT_DEFENSE = 26, - SPELL_EFFECT_PERSISTENT_AREA_AURA = 27, - SPELL_EFFECT_SUMMON = 28, - SPELL_EFFECT_LEAP = 29, - SPELL_EFFECT_ENERGIZE = 30, - SPELL_EFFECT_WEAPON_PERCENT_DAMAGE = 31, - SPELL_EFFECT_TRIGGER_MISSILE = 32, - SPELL_EFFECT_OPEN_LOCK = 33, - SPELL_EFFECT_SUMMON_CHANGE_ITEM = 34, - SPELL_EFFECT_APPLY_AREA_AURA_PARTY = 35, - SPELL_EFFECT_LEARN_SPELL = 36, - SPELL_EFFECT_SPELL_DEFENSE = 37, - SPELL_EFFECT_DISPEL = 38, - SPELL_EFFECT_LANGUAGE = 39, - SPELL_EFFECT_DUAL_WIELD = 40, - SPELL_EFFECT_SUMMON_WILD = 41, - SPELL_EFFECT_SUMMON_GUARDIAN = 42, - SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER= 43, - SPELL_EFFECT_SKILL_STEP = 44, - SPELL_EFFECT_ADD_HONOR = 45, - SPELL_EFFECT_SPAWN = 46, - SPELL_EFFECT_TRADE_SKILL = 47, - SPELL_EFFECT_STEALTH = 48, - SPELL_EFFECT_DETECT = 49, - SPELL_EFFECT_TRANS_DOOR = 50, - SPELL_EFFECT_FORCE_CRITICAL_HIT = 51, - SPELL_EFFECT_GUARANTEE_HIT = 52, - SPELL_EFFECT_ENCHANT_ITEM = 53, - SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY = 54, - SPELL_EFFECT_TAMECREATURE = 55, - SPELL_EFFECT_SUMMON_PET = 56, - SPELL_EFFECT_LEARN_PET_SPELL = 57, - SPELL_EFFECT_WEAPON_DAMAGE = 58, - SPELL_EFFECT_OPEN_LOCK_ITEM = 59, - SPELL_EFFECT_PROFICIENCY = 60, - SPELL_EFFECT_SEND_EVENT = 61, - SPELL_EFFECT_POWER_BURN = 62, - SPELL_EFFECT_THREAT = 63, - SPELL_EFFECT_TRIGGER_SPELL = 64, - SPELL_EFFECT_HEALTH_FUNNEL = 65, - SPELL_EFFECT_POWER_FUNNEL = 66, - SPELL_EFFECT_HEAL_MAX_HEALTH = 67, - SPELL_EFFECT_INTERRUPT_CAST = 68, - SPELL_EFFECT_DISTRACT = 69, - SPELL_EFFECT_PULL = 70, - SPELL_EFFECT_PICKPOCKET = 71, - SPELL_EFFECT_ADD_FARSIGHT = 72, - SPELL_EFFECT_SUMMON_POSSESSED = 73, - SPELL_EFFECT_SUMMON_TOTEM = 74, - SPELL_EFFECT_HEAL_MECHANICAL = 75, - SPELL_EFFECT_SUMMON_OBJECT_WILD = 76, - SPELL_EFFECT_SCRIPT_EFFECT = 77, - SPELL_EFFECT_ATTACK = 78, - SPELL_EFFECT_SANCTUARY = 79, - SPELL_EFFECT_ADD_COMBO_POINTS = 80, - SPELL_EFFECT_CREATE_HOUSE = 81, - SPELL_EFFECT_BIND_SIGHT = 82, - SPELL_EFFECT_DUEL = 83, - SPELL_EFFECT_STUCK = 84, - SPELL_EFFECT_SUMMON_PLAYER = 85, - SPELL_EFFECT_ACTIVATE_OBJECT = 86, - SPELL_EFFECT_SUMMON_TOTEM_SLOT1 = 87, - SPELL_EFFECT_SUMMON_TOTEM_SLOT2 = 88, - SPELL_EFFECT_SUMMON_TOTEM_SLOT3 = 89, - SPELL_EFFECT_SUMMON_TOTEM_SLOT4 = 90, - SPELL_EFFECT_THREAT_ALL = 91, - SPELL_EFFECT_ENCHANT_HELD_ITEM = 92, - SPELL_EFFECT_SUMMON_PHANTASM = 93, - SPELL_EFFECT_SELF_RESURRECT = 94, - SPELL_EFFECT_SKINNING = 95, - SPELL_EFFECT_CHARGE = 96, - SPELL_EFFECT_SUMMON_CRITTER = 97, - SPELL_EFFECT_KNOCK_BACK = 98, - SPELL_EFFECT_DISENCHANT = 99, - SPELL_EFFECT_INEBRIATE = 100, - SPELL_EFFECT_FEED_PET = 101, - SPELL_EFFECT_DISMISS_PET = 102, - SPELL_EFFECT_REPUTATION = 103, - SPELL_EFFECT_SUMMON_OBJECT_SLOT1 = 104, - SPELL_EFFECT_SUMMON_OBJECT_SLOT2 = 105, - SPELL_EFFECT_SUMMON_OBJECT_SLOT3 = 106, - SPELL_EFFECT_SUMMON_OBJECT_SLOT4 = 107, - SPELL_EFFECT_DISPEL_MECHANIC = 108, - SPELL_EFFECT_SUMMON_DEAD_PET = 109, - SPELL_EFFECT_DESTROY_ALL_TOTEMS = 110, - SPELL_EFFECT_DURABILITY_DAMAGE = 111, - SPELL_EFFECT_SUMMON_DEMON = 112, - SPELL_EFFECT_RESURRECT_NEW = 113, - SPELL_EFFECT_ATTACK_ME = 114, - SPELL_EFFECT_DURABILITY_DAMAGE_PCT = 115, - SPELL_EFFECT_SKIN_PLAYER_CORPSE = 116, - SPELL_EFFECT_SPIRIT_HEAL = 117, - SPELL_EFFECT_SKILL = 118, - SPELL_EFFECT_APPLY_AREA_AURA_PET = 119, - SPELL_EFFECT_TELEPORT_GRAVEYARD = 120, - SPELL_EFFECT_NORMALIZED_WEAPON_DMG = 121, - SPELL_EFFECT_122 = 122, - SPELL_EFFECT_SEND_TAXI = 123, - SPELL_EFFECT_PLAYER_PULL = 124, - SPELL_EFFECT_MODIFY_THREAT_PERCENT = 125, - SPELL_EFFECT_126 = 126, - SPELL_EFFECT_127 = 127, - // Effets "backportes" depuis MaNGOS BC+. - SPELL_EFFECT_APPLY_AREA_AURA_FRIEND = 128, - SPELL_EFFECT_APPLY_AREA_AURA_ENEMY = 129, - // Custom - SPELL_EFFECT_DESPAWN_OBJECT = 130, - SPELL_EFFECT_NOSTALRIUS = 131, - SPELL_EFFECT_APPLY_AREA_AURA_RAID = 132, - SPELL_EFFECT_APPLY_AREA_AURA_OWNER = 133, - TOTAL_SPELL_EFFECTS = 134 -}; - -enum SpellCastResult -{ - SPELL_FAILED_AFFECTING_COMBAT = 0x00, // You are in combat - SPELL_FAILED_ALREADY_AT_FULL_HEALTH , // You are already at full Health. - SPELL_FAILED_ALREADY_AT_FULL_POWER , // You are already at full %s. - SPELL_FAILED_ALREADY_BEING_TAMED , // That creature is already being tamed - SPELL_FAILED_ALREADY_HAVE_CHARM , // You already control a charmed creature - SPELL_FAILED_ALREADY_HAVE_SUMMON , // You already control a summoned creature - SPELL_FAILED_ALREADY_OPEN , // Already open - SPELL_FAILED_AURA_BOUNCED , // A more powerful spell is already active - SPELL_FAILED_AUTOTRACK_INTERRUPTED , // Message is hidden/unused - SPELL_FAILED_BAD_IMPLICIT_TARGETS , // You have no target. - SPELL_FAILED_BAD_TARGETS , // Invalid target - SPELL_FAILED_CANT_BE_CHARMED , // Target can't be charmed - SPELL_FAILED_CANT_BE_DISENCHANTED , // Item cannot be disenchanted -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 - SPELL_FAILED_CANT_BE_PROSPECTED , // There are no gems in this -#endif - SPELL_FAILED_CANT_CAST_ON_TAPPED , // Target is tapped - SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE , // You can't start a duel while invisible - SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED , // You can't start a duel while stealthed - SPELL_FAILED_CANT_STEALTH , // You are too close to enemies - SPELL_FAILED_CASTER_AURASTATE , // You can't do that yet - SPELL_FAILED_CASTER_DEAD , // You are dead -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_11_2 - SPELL_FAILED_CHARMED , // Can't do that while charmed -#endif - SPELL_FAILED_CHEST_IN_USE , // That is already being used - SPELL_FAILED_CONFUSED , // Can't do that while confused - SPELL_FAILED_DONT_REPORT , // Message is hidden/unused - SPELL_FAILED_EQUIPPED_ITEM , // Must have the proper item equipped - SPELL_FAILED_EQUIPPED_ITEM_CLASS , // Must have a %s equipped - SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND , // Must have a %s equipped in the main hand -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 - SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND , // Must have a %s equipped in the offhand -#endif - SPELL_FAILED_ERROR , // Internal error - SPELL_FAILED_FIZZLE , // Fizzled - SPELL_FAILED_FLEEING , // Can't do that while fleeing - SPELL_FAILED_FOOD_LOWLEVEL , // That food's level is not high enough for your pet - SPELL_FAILED_HIGHLEVEL , // Target is too high level - SPELL_FAILED_HUNGER_SATIATED , // Message is hidden/unused - SPELL_FAILED_IMMUNE , // Immune - SPELL_FAILED_INTERRUPTED , // Interrupted - SPELL_FAILED_INTERRUPTED_COMBAT , // Interrupted - SPELL_FAILED_ITEM_ALREADY_ENCHANTED , // Item is already enchanted - SPELL_FAILED_ITEM_GONE , // Item is gone - SPELL_FAILED_ITEM_NOT_FOUND , // Tried to enchant an item that didn't exist - SPELL_FAILED_ITEM_NOT_READY , // Item is not ready yet. - SPELL_FAILED_LEVEL_REQUIREMENT , // You are not high enough level - SPELL_FAILED_LINE_OF_SIGHT , // Target not in line of sight - SPELL_FAILED_LOWLEVEL , // Target is too low level - SPELL_FAILED_LOW_CASTLEVEL , // Skill not high enough - SPELL_FAILED_MAINHAND_EMPTY , // Your weapon hand is empty - SPELL_FAILED_MOVING , // Can't do that while moving - SPELL_FAILED_NEED_AMMO , // Ammo needs to be in the paper doll ammo slot before it can be fired - SPELL_FAILED_NEED_AMMO_POUCH , // Requires: %s - SPELL_FAILED_NEED_EXOTIC_AMMO , // Requires exotic ammo: %s - SPELL_FAILED_NOPATH , // No path available - SPELL_FAILED_NOT_BEHIND , // You must be behind your target - SPELL_FAILED_NOT_FISHABLE , // Your cast didn't land in fishable water - SPELL_FAILED_NOT_HERE , // You can't use that here - SPELL_FAILED_NOT_INFRONT , // You must be in front of your target - SPELL_FAILED_NOT_IN_CONTROL , // You are not in control of your actions - SPELL_FAILED_NOT_KNOWN , // Spell not learned - SPELL_FAILED_NOT_MOUNTED , // You are mounted - SPELL_FAILED_NOT_ON_TAXI , // You are in flight - SPELL_FAILED_NOT_ON_TRANSPORT , // You are on a transport - SPELL_FAILED_NOT_READY , // Spell is not ready yet. - SPELL_FAILED_NOT_SHAPESHIFT , // You are in shapeshift form - SPELL_FAILED_NOT_STANDING , // You must be standing to do that - SPELL_FAILED_NOT_TRADEABLE , // You can only use this on an object you own - SPELL_FAILED_NOT_TRADING , // Tried to enchant a trade item, but not trading - SPELL_FAILED_NOT_UNSHEATHED , // You have to be unsheathed to do that! - SPELL_FAILED_NOT_WHILE_GHOST , // Can't cast as ghost - SPELL_FAILED_NO_AMMO , // Out of ammo - SPELL_FAILED_NO_CHARGES_REMAIN , // No charges remain -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 - SPELL_FAILED_NO_CHAMPION , // You haven't selected a champion -#endif - SPELL_FAILED_NO_COMBO_POINTS , // That ability requires combo points - SPELL_FAILED_NO_DUELING , // Dueling isn't allowed here - SPELL_FAILED_NO_ENDURANCE , // Not enough endurance - SPELL_FAILED_NO_FISH , // There aren't any fish here - SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED , // Can't use items while shapeshifted - SPELL_FAILED_NO_MOUNTS_ALLOWED , // You can't mount here - SPELL_FAILED_NO_PET , // You do not have a pet - SPELL_FAILED_NO_POWER , // Dynamic pre-defined messages, no args: Not enough mana, Not enough rage, etc -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 - SPELL_FAILED_NOTHING_TO_DISPEL , // Nothing to dispel -#endif -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 - SPELL_FAILED_NOTHING_TO_STEAL , // Nothing to steal -#endif - SPELL_FAILED_ONLY_ABOVEWATER , // Cannot use while swimming - SPELL_FAILED_ONLY_DAYTIME , // Can only use during the day - SPELL_FAILED_ONLY_INDOORS , // Can only use indoors - SPELL_FAILED_ONLY_MOUNTED , // Can only use while mounted - SPELL_FAILED_ONLY_NIGHTTIME , // Can only use during the night - SPELL_FAILED_ONLY_OUTDOORS , // Can only use outside - SPELL_FAILED_ONLY_SHAPESHIFT , // Must be in %s - SPELL_FAILED_ONLY_STEALTHED , // You must be in stealth mode - SPELL_FAILED_ONLY_UNDERWATER , // Can only use while swimming - SPELL_FAILED_OUT_OF_RANGE , // Out of range. - SPELL_FAILED_PACIFIED , // Can't use that ability while pacified - SPELL_FAILED_POSSESSED , // You are possessed - SPELL_FAILED_REAGENTS , // Message is hidden/unused, supposedly implemented client-side only - SPELL_FAILED_REQUIRES_AREA , // You need to be in %s - SPELL_FAILED_REQUIRES_SPELL_FOCUS , // Requires %s - SPELL_FAILED_ROOTED , // You are unable to move - SPELL_FAILED_SILENCED , // Can't do that while silenced - SPELL_FAILED_SPELL_IN_PROGRESS , // Another action is in progress - SPELL_FAILED_SPELL_LEARNED , // You have already learned the spell - SPELL_FAILED_SPELL_UNAVAILABLE , // The spell is not available to you - SPELL_FAILED_STUNNED , // Can't do that while stunned - SPELL_FAILED_TARGETS_DEAD , // Your target is dead - SPELL_FAILED_TARGET_AFFECTING_COMBAT , // Target is in combat - SPELL_FAILED_TARGET_AURASTATE , // You can't do that yet - SPELL_FAILED_TARGET_DUELING , // Target is currently dueling - SPELL_FAILED_TARGET_ENEMY , // Target is hostile - SPELL_FAILED_TARGET_ENRAGED , // Target is too enraged to be charmed - SPELL_FAILED_TARGET_FRIENDLY , // Target is friendly - SPELL_FAILED_TARGET_IN_COMBAT , // The target can't be in combat - SPELL_FAILED_TARGET_IS_PLAYER , // Can't target players - SPELL_FAILED_TARGET_NOT_DEAD , // Target is alive - SPELL_FAILED_TARGET_NOT_IN_PARTY , // Target is not in your party - SPELL_FAILED_TARGET_NOT_LOOTED , // Creature must be looted first - SPELL_FAILED_TARGET_NOT_PLAYER , // Target is not a player - SPELL_FAILED_TARGET_NO_POCKETS , // No pockets to pick - SPELL_FAILED_TARGET_NO_WEAPONS , // Target has no weapons equipped - SPELL_FAILED_TARGET_UNSKINNABLE , // Creature is not skinnable - SPELL_FAILED_THIRST_SATIATED , // Message is hidden/unused - SPELL_FAILED_TOO_CLOSE , // Target too close - SPELL_FAILED_TOO_MANY_OF_ITEM , // You have too many of that item already - SPELL_FAILED_TOTEMS , // Message is hidden/unused, supposedly implemented client-side only - SPELL_FAILED_TRAINING_POINTS , // Not enough training points - SPELL_FAILED_TRY_AGAIN , // Failed attempt - SPELL_FAILED_UNIT_NOT_BEHIND , // Target needs to be behind you - SPELL_FAILED_UNIT_NOT_INFRONT , // Target needs to be in front of you - SPELL_FAILED_WRONG_PET_FOOD , // Your pet doesn't like that food - SPELL_FAILED_NOT_WHILE_FATIGUED , // Can't cast while fatigued - SPELL_FAILED_TARGET_NOT_IN_INSTANCE , // Target must be in this instance - SPELL_FAILED_NOT_WHILE_TRADING , // Can't cast while trading - SPELL_FAILED_TARGET_NOT_IN_RAID , // Target is not in your party or raid group - SPELL_FAILED_DISENCHANT_WHILE_LOOTING , // Cannot disenchant while looting -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 - SPELL_FAILED_PROSPECT_WHILE_LOOTING , // Cannot prospect while looting - SPELL_FAILED_PROSPECT_NEED_MORE , // Message is hidden/unused, supposedly implemented client-side only -#endif - SPELL_FAILED_TARGET_FREEFORALL , // Target is currently in free-for-all PvP combat - SPELL_FAILED_NO_EDIBLE_CORPSES , // There are no nearby corpses to eat - SPELL_FAILED_ONLY_BATTLEGROUNDS , // Can only use in battlegrounds - SPELL_FAILED_TARGET_NOT_GHOST , // Target is not a ghost - SPELL_FAILED_TOO_MANY_SKILLS , // Your pet can't learn any more skills -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - SPELL_FAILED_TRANSFORM_UNUSABLE , // You can't use the new item - SPELL_FAILED_WRONG_WEATHER , // The weather isn't right for that - SPELL_FAILED_DAMAGE_IMMUNE , // You can't do that while you are immune - SPELL_FAILED_PREVENTED_BY_MECHANIC , // Can't do that while %s - SPELL_FAILED_PLAY_TIME , // Maximum play time exceeded -#endif -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_9_4 - SPELL_FAILED_REPUTATION , // Your reputation isn't high enough -#endif -#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 - SPELL_FAILED_MIN_SKILL , // Your skill is not high enough. Requires %s (%d). -#endif - SPELL_FAILED_UNKNOWN , // Generic out of bounds response: Unknown reason - - SPELL_CAST_OK = 0xFF // custom value, must not be send to client -}; - -// Spell aura states -enum AuraState -{ // (C) used in caster aura state (T) used in target aura state - AURA_STATE_DEFENSE = 1, // C | - AURA_STATE_HEALTHLESS_20_PERCENT = 2, // C T | - AURA_STATE_BERSERKING = 3, // C | - AURA_STATE_FROZEN = 4, // | frozen target (but not used for any spells in 1.12.1 at client side) - AURA_STATE_JUDGEMENT = 5, // C | - //AURA_STATE_UNKNOWN6 = 6, // | not used - AURA_STATE_HUNTER_PARRY = 7, // C | - AURA_STATE_ROGUE_ATTACK_FROM_STEALTH = 8, // C | FIX ME: not implemented yet! - // Custom aura states - not based on spell data: - AURA_STATE_HEALTHLESS_15_PERCENT = 9, - AURA_STATE_HEALTHLESS_10_PERCENT = 10, - AURA_STATE_HEALTHLESS_5_PERCENT = 11, -}; - -// Spell mechanics -enum Mechanics -{ - MECHANIC_NONE = 0, - MECHANIC_CHARM = 1, - MECHANIC_DISORIENTED = 2, - MECHANIC_DISARM = 3, - MECHANIC_DISTRACT = 4, - MECHANIC_FEAR = 5, - MECHANIC_FUMBLE = 6, - MECHANIC_ROOT = 7, - MECHANIC_PACIFY = 8, // 0 spells use this mechanic - MECHANIC_SILENCE = 9, - MECHANIC_SLEEP = 10, - MECHANIC_SNARE = 11, - MECHANIC_STUN = 12, - MECHANIC_FREEZE = 13, - MECHANIC_KNOCKOUT = 14, - MECHANIC_BLEED = 15, - MECHANIC_BANDAGE = 16, - MECHANIC_POLYMORPH = 17, - MECHANIC_BANISH = 18, - MECHANIC_SHIELD = 19, - MECHANIC_SHACKLE = 20, - MECHANIC_MOUNT = 21, - MECHANIC_PERSUADE = 22, // 0 spells use this mechanic - MECHANIC_TURN = 23, - MECHANIC_HORROR = 24, - MECHANIC_INVULNERABILITY = 25, - MECHANIC_INTERRUPT = 26, - MECHANIC_DAZE = 27, - MECHANIC_DISCOVERY = 28, - MECHANIC_IMMUNE_SHIELD = 29, // Divine (Blessing) Shield/Protection and Ice Block - MECHANIC_SAPPED = 30, - - // Custom - MECHANIC_SLOW_CAST_SPEED = 31 // Curse of Tongues -}; - -#define FIRST_MECHANIC 1 -#define MAX_MECHANIC 31 - -#define IMMUNE_TO_ROOT_AND_SNARE_MASK ( \ - (1<<(MECHANIC_ROOT-1))|(1<<(MECHANIC_SNARE-1))) - -#define IMMUNE_TO_ROOT_AND_STUN_MASK ( \ - (1<<(MECHANIC_ROOT-1))|(1<<(MECHANIC_STUN-1))) - -#define CONFUSED_MECHANIC_MASK ( \ - (1<<(MECHANIC_DISORIENTED-1))|(1<<(MECHANIC_POLYMORPH-1))) - -// Daze and all croud control spells except polymorph are not removed -#define MECHANIC_NOT_REMOVED_BY_SHAPESHIFT ( \ - (1<<(MECHANIC_CHARM -1))|(1<<(MECHANIC_DISORIENTED-1))|(1<<(MECHANIC_FEAR -1))| \ - (1<<(MECHANIC_PACIFY-1))|(1<<(MECHANIC_STUN -1))|(1<<(MECHANIC_FREEZE-1))| \ - (1<<(MECHANIC_BANISH-1))|(1<<(MECHANIC_SHACKLE -1))|(1<<(MECHANIC_HORROR-1))| \ - (1<<(MECHANIC_TURN -1))|(1<<(MECHANIC_DAZE -1))|(1<<(MECHANIC_SAPPED-1))) - -// Spell dispell type -enum DispelType -{ - DISPEL_NONE = 0, - DISPEL_MAGIC = 1, - DISPEL_CURSE = 2, - DISPEL_DISEASE = 3, - DISPEL_POISON = 4, - DISPEL_STEALTH = 5, - DISPEL_INVISIBILITY = 6, - DISPEL_ALL = 7, - DISPEL_SPE_NPC_ONLY = 8, - DISPEL_ENRAGE = 9, - DISPEL_ZG_TICKET = 10 -}; - -#define DISPEL_ALL_MASK ( (1<(only this effect in the spell) can't cast to it, -// some aura(related to Mechanics or ImmuneToState) can't apply to it. -enum SpellImmunity -{ - IMMUNITY_EFFECT = 0, // enum SpellEffects - IMMUNITY_STATE = 1, // enum AuraType - IMMUNITY_SCHOOL = 2, // enum SpellSchoolMask - IMMUNITY_DAMAGE = 3, // enum SpellSchoolMask - IMMUNITY_DISPEL = 4, // enum DispelType - IMMUNITY_MECHANIC = 5 // enum Mechanics -}; - -#define MAX_SPELL_IMMUNITY 6 - enum WeaponAttackType // The different weapon attack-types { BASE_ATTACK = 0, // Main-hand weapon @@ -925,118 +245,6 @@ enum WeaponAttackType // The different wea #define MAX_ATTACK 3 -enum SpellTarget -{ - TARGET_NONE = 0, - TARGET_SELF = 1, - TARGET_RANDOM_ENEMY_CHAIN_IN_AREA = 2, // only one spell has that, but regardless, it's a target type after all - TARGET_RANDOM_FRIEND_CHAIN_IN_AREA = 3, - TARGET_RANDOM_UNIT_CHAIN_IN_AREA = 4, // some plague spells that are infectious - maybe targets not-infected friends inrange - TARGET_PET = 5, - TARGET_CHAIN_DAMAGE = 6, - TARGET_AREAEFFECT_INSTANT = 7, // targets around provided destination point - TARGET_AREAEFFECT_CUSTOM = 8, - TARGET_INNKEEPER_COORDINATES = 9, // uses in teleport to innkeeper spells - TARGET_11 = 11, // used by spell 4 'Word of Recall Other' - TARGET_ALL_ENEMY_IN_AREA = 15, - TARGET_ALL_ENEMY_IN_AREA_INSTANT = 16, - TARGET_TABLE_X_Y_Z_COORDINATES = 17, // uses in teleport spells and some other - TARGET_EFFECT_SELECT = 18, // highly depends on the spell effect - TARGET_ALL_PARTY_AROUND_CASTER = 20, - TARGET_SINGLE_FRIEND = 21, - TARGET_CASTER_COORDINATES = 22, // used only in TargetA, target selection dependent from TargetB - TARGET_GAMEOBJECT = 23, - TARGET_IN_FRONT_OF_CASTER = 24, - TARGET_UNIT_TARGET_ANY = 25, - TARGET_GAMEOBJECT_ITEM = 26, - TARGET_MASTER = 27, - TARGET_ALL_ENEMY_IN_AREA_CHANNELED = 28, - TARGET_29 = 29, - TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER = 30, // select friendly for caster object faction (in different original caster faction) in TargetB used only with TARGET_ALL_AROUND_CASTER and in self casting range in TargetA - TARGET_ALL_FRIENDLY_UNITS_IN_AREA = 31, - TARGET_MINION = 32, - TARGET_ALL_PARTY = 33, - TARGET_ALL_PARTY_AROUND_CASTER_2 = 34, // used in Tranquility - TARGET_SINGLE_PARTY = 35, - TARGET_ALL_HOSTILE_UNITS_AROUND_CASTER = 36, - TARGET_AREAEFFECT_PARTY = 37, - TARGET_SCRIPT = 38, - TARGET_SELF_FISHING = 39, - TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT= 40, - TARGET_TOTEM_EARTH = 41, - TARGET_TOTEM_WATER = 42, - TARGET_TOTEM_AIR = 43, - TARGET_TOTEM_FIRE = 44, - TARGET_CHAIN_HEAL = 45, - TARGET_SCRIPT_COORDINATES = 46, - TARGET_DYNAMIC_OBJECT_FRONT = 47, - TARGET_DYNAMIC_OBJECT_BEHIND = 48, - TARGET_DYNAMIC_OBJECT_LEFT_SIDE = 49, - TARGET_DYNAMIC_OBJECT_RIGHT_SIDE = 50, - TARGET_AREAEFFECT_GO_AROUND_SOURCE = 51, - TARGET_AREAEFFECT_GO_AROUND_DEST = 52, // gameobject around destination, select by spell_script_target - TARGET_CURRENT_ENEMY_COORDINATES = 53, // set unit coordinates as dest, only 16 target B imlemented - TARGET_LARGE_FRONTAL_CONE = 54, - TARGET_DEST_CASTER_FRONT_LEAP = 55, - TARGET_ALL_RAID_AROUND_CASTER = 56, - TARGET_SINGLE_FRIEND_2 = 57, - TARGET_58 = 58, - TARGET_FRIENDLY_FRONTAL_CONE = 59, - TARGET_NARROW_FRONTAL_CONE = 60, - TARGET_AREAEFFECT_PARTY_AND_CLASS = 61, - TARGET_62 = 62, - TARGET_DUELVSPLAYER_COORDINATES = 63, -}; - -enum SpellMissInfo -{ - SPELL_MISS_NONE = 0, - SPELL_MISS_MISS = 1, - SPELL_MISS_RESIST = 2, - SPELL_MISS_DODGE = 3, - SPELL_MISS_PARRY = 4, - SPELL_MISS_BLOCK = 5, - SPELL_MISS_EVADE = 6, - SPELL_MISS_IMMUNE = 7, - SPELL_MISS_IMMUNE2 = 8, - SPELL_MISS_DEFLECT = 9, - SPELL_MISS_ABSORB = 10, - SPELL_MISS_REFLECT = 11 -}; - -enum SpellHitType -{ - SPELL_HIT_TYPE_CRIT_DEBUG = 0x01, - SPELL_HIT_TYPE_CRIT = 0x02, - SPELL_HIT_TYPE_HIT_DEBUG = 0x04, - SPELL_HIT_TYPE_SPLIT = 0x08, - SPELL_HIT_TYPE_VICTIM_IS_ATTACKER = 0x10, - SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG = 0x20 -}; - -enum SpellDmgClass -{ - SPELL_DAMAGE_CLASS_NONE = 0, - SPELL_DAMAGE_CLASS_MAGIC = 1, - SPELL_DAMAGE_CLASS_MELEE = 2, - SPELL_DAMAGE_CLASS_RANGED = 3 -}; - -enum SpellPreventionType -{ - SPELL_PREVENTION_TYPE_NONE = 0, - SPELL_PREVENTION_TYPE_SILENCE = 1, - SPELL_PREVENTION_TYPE_PACIFY = 2 -}; - -// Indexes from SpellRange.dbc, listed only special and used in code -enum SpellRangeIndex -{ - SPELL_RANGE_IDX_SELF_ONLY = 1, // 0.0 - SPELL_RANGE_IDX_COMBAT = 2, // often ~5.5 (but infact dynamic melee combat range) - SPELL_RANGE_IDX_ANYWHERE = 13, // 500000 (anywhere) -}; - enum DamageEffectType { DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells) diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index cd4e3a674..8b56fcc1b 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -195,8 +195,8 @@ void SocialMgr::GetFriendInfo(MasterPlayer* player, uint32 friend_lowguid, Frien if (player->IsDND()) friendInfo.Status = FRIEND_STATUS_DND; friendInfo.Area = player->GetZoneId(); - friendInfo.Level = player->getLevel(); - friendInfo.Class = player->getClass(); + friendInfo.Level = player->GetLevel(); + friendInfo.Class = player->GetClass(); return; } @@ -223,8 +223,8 @@ void SocialMgr::GetFriendInfo(MasterPlayer* player, uint32 friend_lowguid, Frien if (pFriend->IsDND()) friendInfo.Status = FRIEND_STATUS_DND; friendInfo.Area = pFriend->GetZoneId(); - friendInfo.Level = pFriend->getLevel(); - friendInfo.Class = pFriend->getClass(); + friendInfo.Level = pFriend->GetLevel(); + friendInfo.Class = pFriend->GetClass(); } else { diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 1260a0efa..9f83537a3 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -33,7 +33,6 @@ #include "SpellMgr.h" #include "Player.h" #include "Pet.h" -#include "Unit.h" #include "DynamicObject.h" #include "Group.h" #include "UpdateData.h" @@ -301,7 +300,7 @@ Spell::Spell(Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid or // wand case if (m_attackType == RANGED_ATTACK) - if (!!(caster->getClassMask() & CLASSMASK_WAND_USERS) && caster->IsPlayer()) + if (!!(caster->GetClassMask() & CLASSMASK_WAND_USERS) && caster->IsPlayer()) m_spellSchoolMask = GetSchoolMask(caster->GetWeaponDamageSchool(RANGED_ATTACK)); m_originalCasterGUID = originalCasterGUID ? originalCasterGUID : caster->GetObjectGuid(); @@ -1186,7 +1185,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { if (pRealUnitCaster && pRealUnitCaster != unit) { - if (!m_spellInfo->IsPositiveSpell() && (m_caster->isVisibleForOrDetect(unit, unit, false) || m_spellInfo->HasAttribute(SPELL_ATTR_EX_IS_PICKPOCKET))) + if (!m_spellInfo->IsPositiveSpell() && (m_caster->IsVisibleForOrDetect(unit, unit, false) || m_spellInfo->HasAttribute(SPELL_ATTR_EX_IS_PICKPOCKET))) { bool combat = (m_spellInfo->Id != 3600) && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO); @@ -1201,7 +1200,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { if (!m_spellInfo->HasAura(SPELL_AURA_MOD_POSSESS)) { - if (!unit->isInCombat()) + if (!unit->IsInCombat()) unit->AttackedBy(pRealUnitCaster); unit->AddThreat(pRealUnitCaster); @@ -1302,10 +1301,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) int32 gain = pCaster->DealHeal(unitTarget, addhealth, m_spellInfo, crit); - float classThreatModifier = pUnitCaster && pUnitCaster->getClass() == CLASS_PALADIN ? 0.25f : 0.5f; + float classThreatModifier = pUnitCaster && pUnitCaster->GetClass() == CLASS_PALADIN ? 0.25f : 0.5f; if (pRealUnitCaster) - unitTarget->getHostileRefManager().threatAssist(pRealUnitCaster, float(gain) * classThreatModifier * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo); + unitTarget->GetHostileRefManager().threatAssist(pRealUnitCaster, float(gain) * classThreatModifier * sSpellMgr.GetSpellThreatMultiplier(m_spellInfo), m_spellInfo); } // Do damage and triggers else if (m_damage) @@ -1357,7 +1356,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // (HACK) trigger Vengeance on weapon crits for Paladins // item procs should probably trigger for all classes, e.g. Judgement of Wisdom, but many issues to test for first. Paladin exclusive for now. - if (m_CastItem && m_casterUnit && m_casterUnit->getClass() == CLASS_PALADIN && (procEx & PROC_EX_CRITICAL_HIT) && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CANT_TRIGGER_PROC)) + if (m_CastItem && m_casterUnit && m_casterUnit->GetClass() == CLASS_PALADIN && (procEx & PROC_EX_CRITICAL_HIT) && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CANT_TRIGGER_PROC)) m_canTrigger = true; // JoR and JoC: Paladin melee spells trigger melee procs instead of magic if ((m_spellInfo->IsFitToFamilyMask() && m_spellInfo->SpellIconID == 25) || @@ -1518,7 +1517,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) m_casterUnit && unit->HasAuraPetShouldAvoidBreaking(m_casterUnit)) { // Tell any pets to stop attacking the target on application of breakable crowd control spells - Unit::AttackerSet attackers = unit->getAttackers(); + Unit::AttackerSet attackers = unit->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) { if ((*itr)->IsPet()) @@ -1541,7 +1540,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) if (!effectMask) { - if (pRealUnitCaster && !unit->isInCombat()) + if (pRealUnitCaster && !unit->IsInCombat()) unit->AttackedBy(pRealUnitCaster); return; } @@ -1595,7 +1594,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) // for delayed spells ignore not visible explicit target if (m_delayed && unit == m_targets.getUnitTarget() && - !unit->isVisibleForOrDetect(m_caster, m_caster, false)) + !unit->IsVisibleForOrDetect(m_caster, m_caster, false)) { pRealCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); ResetEffectDamageAndHeal(); @@ -1606,7 +1605,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) if ((!m_spellInfo->IsPositiveSpell() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)) && !m_spellInfo->IsFitToFamily() && // Sap handled somewhere else. Without this, sap will remove stealth if the rogue is visible. (m_spellInfo->Id == 6358 || // Exception to fix succubus seduction. - m_caster->isVisibleForOrDetect(unit, unit, false))) + m_caster->IsVisibleForOrDetect(unit, unit, false))) { if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO)) { @@ -1628,7 +1627,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) { if (!m_spellInfo->HasAura(SPELL_AURA_MOD_POSSESS)) { - if (!unit->isInCombat()) + if (!unit->IsInCombat()) unit->AttackedBy(pRealUnitCaster); unit->AddThreat(pRealUnitCaster); @@ -1660,12 +1659,12 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) // NPCs are in combat. if (pRealUnitCaster) { - if (unit->isInCombat()) + if (unit->IsInCombat()) { if (!(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO)) { pRealUnitCaster->SetInCombatWithAssisted(unit); - unit->getHostileRefManager().threatAssist(pRealUnitCaster, 0.0f, m_spellInfo); + unit->GetHostileRefManager().threatAssist(pRealUnitCaster, 0.0f, m_spellInfo); } } else if (unit->IsPvP() && unit->IsPlayer()) @@ -1904,7 +1903,7 @@ bool Spell::HasValidUnitPresentInTargetList() // It does not stop unless it dies of course. if (!needTargetsMask) { - if (m_casterUnit && m_casterUnit->isAlive() == m_spellInfo->IsDeathOnlySpell()) + if (m_casterUnit && m_casterUnit->IsAlive() == m_spellInfo->IsDeathOnlySpell()) return false; return true; } @@ -1919,7 +1918,7 @@ bool Spell::HasValidUnitPresentInTargetList() Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_casterUnit : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); // either unit is alive and normal spell, or unit dead and deathonly-spell - if (unit && (unit->isAlive() != m_spellInfo->IsDeathOnlySpell())) + if (unit && (unit->IsAlive() != m_spellInfo->IsDeathOnlySpell())) foundMask |= ihit->effectMask; } @@ -2415,7 +2414,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { if (i_spellST->second.type == SPELL_TARGET_TYPE_DEAD && ((Creature*)(*iter))->IsCorpse()) targetUnitMap.push_back((*iter)); - else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive()) + else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && (*iter)->IsAlive()) targetUnitMap.push_back((*iter)); break; @@ -2462,7 +2461,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { if (i_spellST->second.type == SPELL_TARGET_TYPE_DEAD && ((Creature*)(*iter))->IsCorpse()) targetUnitMap.push_back((*iter)); - else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive()) + else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && (*iter)->IsAlive()) targetUnitMap.push_back((*iter)); break; @@ -2475,7 +2474,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // remove not targetable units if spell has no script targets for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end();) { - if (!(*itr)->isTargetableForAttack(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD, m_caster->IsPlayer())) + if (!(*itr)->IsTargetableForAttack(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD, m_caster->IsPlayer())) targetUnitMap.erase(itr++); else ++itr; @@ -2804,7 +2803,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Player* target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if (target && target->GetSubGroup() == subgroup && target->getLevel() + 10 >= m_spellInfo->spellLevel && !m_caster->IsHostileTo(target)) + if (target && target->GetSubGroup() == subgroup && target->GetLevel() + 10 >= m_spellInfo->spellLevel && !m_caster->IsHostileTo(target)) { if (pTarget->IsWithinDistInMap(target, radius)) targetUnitMap.push_back(target); @@ -2930,7 +2929,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // IsHostileTo check duel and controlled by enemy if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && - targetPlayer->getClass() == Target->getClass() && + targetPlayer->GetClass() == Target->GetClass() && !m_caster->IsHostileTo(Target)) targetUnitMap.push_back(Target); } @@ -3510,7 +3509,7 @@ void Spell::cancel() if (ihit->missCondition == SPELL_MISS_NONE) { Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_casterUnit : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); - if (unit && unit->isAlive()) + if (unit && unit->IsAlive()) unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); } } @@ -3598,7 +3597,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_STAT_POSSESSED)))) { if (m_targets.getUnitTarget() && m_targets.getUnitTarget() != m_caster) m_casterUnit->SetInFront(m_targets.getUnitTarget()); @@ -3817,9 +3816,9 @@ void Spell::cast(bool skipCheck) if (m_casterUnit && IsMeleeAttackResetSpell() && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTO_ACTIONS)) { - m_casterUnit->resetAttackTimer(BASE_ATTACK); - if (m_casterUnit->haveOffhandWeapon()) - m_casterUnit->resetAttackTimer(OFF_ATTACK); + m_casterUnit->ResetAttackTimer(BASE_ATTACK); + if (m_casterUnit->HaveOffhandWeapon()) + m_casterUnit->ResetAttackTimer(OFF_ATTACK); } m_caster->DecreaseCastCounter(); @@ -4101,7 +4100,7 @@ void Spell::update(uint32 difftime) { // check for incapacitating states if (m_casterUnit && m_casterUnit->IsPlayer() && - m_casterUnit->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) + m_casterUnit->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) cancel(); if (difftime >= m_timer) @@ -4124,12 +4123,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_STAT_CAN_NOT_REACT)) { - if (m_casterUnit->hasUnitState(UNIT_STAT_DIED) || - (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_STAT_DIED) || + (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)))) cancel(); } } @@ -4284,7 +4283,7 @@ void Spell::HandleAddTargetTriggerAuras() target = m_casterUnit; if (!target) continue; - if (target && target->isAlive()) + if (target && target->IsAlive()) { SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); SpellEffectIndex auraSpellIdx = (*i)->GetEffIndex(); @@ -4316,7 +4315,7 @@ void Spell::finish(bool ok) if (Player* pPlayer = m_caster->ToPlayer()) { - if (!ok && pPlayer->getClass() == CLASS_WARLOCK) + if (!ok && pPlayer->GetClass() == CLASS_WARLOCK) { // Fix a client problem with ritual of doom, by itself it disables // the spell during cast and then the spell stays disabled @@ -4353,7 +4352,7 @@ void Spell::finish(bool ok) m_casterUnit->DealHeal(m_casterUnit, uint32(m_healthLeech), m_spellInfo); /*if (IsRangedAttackResetSpell()) - m_caster->resetAttackTimer(RANGED_ATTACK);*/ + m_caster->ResetAttackTimer(RANGED_ATTACK);*/ // Clear combo at finish state if (m_caster->IsPlayer() && m_spellInfo->NeedsComboPoints()) @@ -4842,7 +4841,7 @@ void Spell::SendChannelUpdate(uint32 time) if (possessed) { - possessed->clearUnitState(UNIT_STAT_POSSESSED); + possessed->ClearUnitState(UNIT_STAT_POSSESSED); possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); possessed->SetCharmerGuid(ObjectGuid()); // TODO - Requires more specials for target? @@ -5213,7 +5212,7 @@ void Spell::HandleThreatSpells() // positive spells distribute threat among all units that are in combat with target, like healing if (positive) - target->getHostileRefManager().threatAssist(m_casterUnit /*pRealCaster ??*/, threat, m_spellInfo); + target->GetHostileRefManager().threatAssist(m_casterUnit /*pRealCaster ??*/, threat, m_spellInfo); // for negative spells threat gets distributed among affected targets else { @@ -5375,7 +5374,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // check death state to prevent cheating ("deathbug") - if (m_casterUnit && !m_casterUnit->isAlive() && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE) && !((m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) || (m_IsTriggeredSpell && !m_triggeredByAuraSpell))) + if (m_casterUnit && !m_casterUnit->IsAlive() && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE) && !((m_spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) || (m_IsTriggeredSpell && !m_triggeredByAuraSpell))) { if (m_triggeredByAuraSpell) return SPELL_FAILED_DONT_REPORT; @@ -5403,7 +5402,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (strict && m_casterUnit) { - if (m_casterUnit && m_casterUnit->isInCombat() && m_spellInfo->IsNonCombatSpell()) + if (m_casterUnit && m_casterUnit->IsInCombat() && m_spellInfo->IsNonCombatSpell()) return SPELL_FAILED_AFFECTING_COMBAT; // only check at first call, Stealth auras are already removed at second call @@ -5451,7 +5450,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_IsTriggeredSpell && m_spellInfo->NeedsComboPoints() && Spells::IsExplicitlySelectedUnitTarget(m_spellInfo->EffectImplicitTargetA[0]) && (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetObjectGuid() != ((Player*)m_caster)->GetComboTargetGuid())) // warrior not have real combo-points at client side but use this way for mark allow Overpower use - return m_casterUnit->getClass() == CLASS_WARRIOR ? SPELL_FAILED_BAD_TARGETS : SPELL_FAILED_NO_COMBO_POINTS; + return m_casterUnit->GetClass() == CLASS_WARRIOR ? SPELL_FAILED_BAD_TARGETS : SPELL_FAILED_NO_COMBO_POINTS; switch (m_spellInfo->Id) { @@ -5504,7 +5503,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (Unit *target = m_targets.getUnitTarget()) { // A more powerful spell is already active - if (m_spellInfo->IsSpellAppliesAura() && !m_spellInfo->IsAreaOfEffectSpell() && m_spellInfo->IsPositiveSpell() && target->HasMorePowerfullSpellActive(m_spellInfo)) + if (m_spellInfo->IsSpellAppliesAura() && !m_spellInfo->IsAreaOfEffectSpell() && m_spellInfo->IsPositiveSpell() && target->HasMorePowerfulSpellActive(m_spellInfo)) return SPELL_FAILED_AURA_BOUNCED; #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 @@ -5515,21 +5514,21 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_AURASTATE; } #endif - if (!m_IsTriggeredSpell && m_spellInfo->IsDeathOnlySpell() && target->isAlive()) + if (!m_IsTriggeredSpell && m_spellInfo->IsDeathOnlySpell() && target->IsAlive()) return SPELL_FAILED_TARGET_NOT_DEAD; // Check spell min target level - if ((m_spellInfo->MinTargetLevel > 0) && (int32(target->getLevel()) < m_spellInfo->MinTargetLevel)) + if ((m_spellInfo->MinTargetLevel > 0) && (int32(target->GetLevel()) < m_spellInfo->MinTargetLevel)) return SPELL_FAILED_LOWLEVEL; // Check spell max target level - if ((m_spellInfo->MaxTargetLevel > 0) && (int32(target->getLevel()) > m_spellInfo->MaxTargetLevel)) + if ((m_spellInfo->MaxTargetLevel > 0) && (int32(target->GetLevel()) > m_spellInfo->MaxTargetLevel)) return SPELL_FAILED_HIGHLEVEL; #if SUPPORTED_CLIENT_BUILD <= CLIENT_BUILD_1_11_2 // World of Warcraft Client Patch 1.12.0 (2006-08-22) // - Pickpocket can now be used on targets that are in combat, as long as the rogue remains stealthed. - if ((m_spellInfo->AttributesEx & SPELL_ATTR_EX_IS_PICKPOCKET) && target->isInCombat()) + if ((m_spellInfo->AttributesEx & SPELL_ATTR_EX_IS_PICKPOCKET) && target->IsInCombat()) return SPELL_FAILED_TARGET_IN_COMBAT; #endif @@ -5547,7 +5546,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_LINE_OF_SIGHT; // check if target is in combat - if (strict && non_caster_target && (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->isInCombat()) + if (strict && non_caster_target && (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->IsInCombat()) return SPELL_FAILED_TARGET_AFFECTING_COMBAT; // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode @@ -5555,7 +5554,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsPlayer() && !m_CastItem && !m_IsTriggeredSpell) { // spell expected to be auto-downranking in cast handle, so must be same - if (m_spellInfo != sSpellMgr.SelectAuraRankForLevel(m_spellInfo, target->getLevel())) + if (m_spellInfo != sSpellMgr.SelectAuraRankForLevel(m_spellInfo, target->GetLevel())) return SPELL_FAILED_LOWLEVEL; } @@ -5629,7 +5628,7 @@ SpellCastResult Spell::CheckCast(bool strict) else return SPELL_FAILED_NO_PET; } - else if (!pet->isAlive()) + else if (!pet->IsAlive()) { if (m_triggeredByAuraSpell) return SPELL_FAILED_DONT_REPORT; @@ -5767,7 +5766,7 @@ SpellCastResult Spell::CheckCast(bool strict) // TODO: This condition allows an antifear item to be used while stuned for example. if (!m_IsTriggeredSpell && !m_spellInfo->HasAura(SPELL_AURA_SCHOOL_IMMUNITY) && !m_spellInfo->HasAura(SPELL_AURA_MECHANIC_IMMUNITY) && m_spellInfo->Id != 20594 && // Stoneform - m_casterUnit->hasUnitState(UNIT_STAT_ISOLATED | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) + m_casterUnit->HasUnitState(UNIT_STAT_ISOLATED | UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)) return SPELL_FAILED_DONT_REPORT; // zone check @@ -5883,7 +5882,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange))) targetExplicit = (Creature*)pTarget; } - else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && pTarget->isAlive()) + else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && pTarget->IsAlive()) { // always use spellMaxRange, in case GetLastRange returned different in a previous pass if (pTarget->IsWithinDistInMap(m_caster, GetSpellMaxRange(srange))) @@ -6008,7 +6007,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_STAT_POSSESSED)) { if (m_spellInfo->Category == 21) // Enrage return SPELL_FAILED_NOT_READY; @@ -6093,7 +6092,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; } - if (plrCaster->getClass() != CLASS_HUNTER && !gmmode) + if (plrCaster->GetClass() != CLASS_HUNTER && !gmmode) { plrCaster->SendPetTameFailure(PETTAME_UNITSCANTTAME); return SPELL_FAILED_DONT_REPORT; @@ -6101,13 +6100,13 @@ SpellCastResult Spell::CheckCast(bool strict) Creature* target = (Creature*)m_targets.getUnitTarget(); - if (target->IsPet() || target->isCharmed()) + if (target->IsPet() || target->IsCharmed()) { plrCaster->SendPetTameFailure(PETTAME_CREATUREALREADYOWNED); return SPELL_FAILED_DONT_REPORT; } - if (target->getLevel() > plrCaster->getLevel() && !gmmode) + if (target->GetLevel() > plrCaster->GetLevel() && !gmmode) { plrCaster->SendPetTameFailure(PETTAME_TOOHIGHLEVEL); return SPELL_FAILED_DONT_REPORT; @@ -6146,7 +6145,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet->CanTakeMoreActiveSpells(learn_spellproto->Id)) return SPELL_FAILED_TOO_MANY_SKILLS; - if (m_spellInfo->spellLevel > pet->getLevel()) + if (m_spellInfo->spellLevel > pet->GetLevel()) return SPELL_FAILED_LOWLEVEL; if (!pet->HasTPForSpell(learn_spellproto->Id)) @@ -6169,7 +6168,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet->CanTakeMoreActiveSpells(learn_spellproto->Id)) return SPELL_FAILED_TOO_MANY_SKILLS; - if (m_spellInfo->spellLevel > pet->getLevel()) + if (m_spellInfo->spellLevel > pet->GetLevel()) return SPELL_FAILED_LOWLEVEL; if (!pet->HasTPForSpell(learn_spellproto->Id)) @@ -6197,7 +6196,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel)) return SPELL_FAILED_FOOD_LOWLEVEL; - if (pet->isInCombat()) + if (pet->IsInCombat()) return SPELL_FAILED_AFFECTING_COMBAT; break; @@ -6208,7 +6207,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) if (m_caster->IsPlayer()) if (Unit* target = m_targets.getUnitTarget()) - if (target != m_caster && int32(target->getPowerType()) != m_spellInfo->EffectMiscValue[i]) + if (target != m_caster && int32(target->GetPowerType()) != m_spellInfo->EffectMiscValue[i]) return SPELL_FAILED_BAD_TARGETS; break; } @@ -6217,7 +6216,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_STAT_ROOT | UNIT_STAT_PENDING_ROOT)) return SPELL_FAILED_ROOTED; // No path available? @@ -6270,7 +6269,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_OUT_OF_RANGE; int32 skillValue = ((Player*)m_caster)->GetSkillValue(SKILL_SKINNING); - int32 TargetLevel = m_targets.getUnitTarget()->getLevel(); + int32 TargetLevel = m_targets.getUnitTarget()->GetLevel(); int32 ReqValue = (skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5); if (ReqValue > skillValue) return SPELL_FAILED_LOW_CASTLEVEL; @@ -6408,7 +6407,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - if (pet->isAlive()) + if (pet->IsAlive()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; break; @@ -6441,7 +6440,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_casterUnit) return SPELL_FAILED_BAD_TARGETS; - if (m_casterUnit->getClass() == CLASS_WARLOCK && m_spellInfo->Id == 698) + if (m_casterUnit->GetClass() == CLASS_WARLOCK && m_spellInfo->Id == 698) { if (!m_caster->IsPlayer()) return SPELL_FAILED_BAD_TARGETS; @@ -6452,7 +6451,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster)) return SPELL_FAILED_BAD_TARGETS; - if (target->isInCombat()) + if (target->IsInCombat()) return SPELL_FAILED_TARGET_IN_COMBAT; // check if our map is dungeon @@ -6461,9 +6460,9 @@ SpellCastResult Spell::CheckCast(bool strict) { if (m_caster->GetMap() != target->GetMap()) return SPELL_FAILED_TARGET_NOT_IN_INSTANCE; - if (mapEntry->levelMin > target->getLevel()) + if (mapEntry->levelMin > target->GetLevel()) return SPELL_FAILED_LOWLEVEL; - if (mapEntry->levelMax && mapEntry->levelMax < target->getLevel()) + if (mapEntry->levelMax && mapEntry->levelMax < target->GetLevel()) return SPELL_FAILED_HIGHLEVEL; } else if (m_caster->ToPlayer()->InBattleGround()) @@ -6490,9 +6489,9 @@ SpellCastResult Spell::CheckCast(bool strict) { if (m_caster->GetMap() != target->GetMap()) return SPELL_FAILED_TARGET_NOT_IN_INSTANCE; - if (mapEntry->levelMin > target->getLevel()) + if (mapEntry->levelMin > target->GetLevel()) return SPELL_FAILED_LOWLEVEL; - if (mapEntry->levelMax && mapEntry->levelMax < target->getLevel()) + if (mapEntry->levelMax && mapEntry->levelMax < target->GetLevel()) return SPELL_FAILED_HIGHLEVEL; } else if (m_caster->ToPlayer()->InBattleGround()) @@ -6677,7 +6676,7 @@ SpellCastResult Spell::CheckCast(bool strict) #endif if (m_spellInfo->Id != 530) // Spell for ".possess" command. - if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i), m_targets.getUnitTarget())) + if (int32(m_targets.getUnitTarget()->GetLevel()) > CalculateDamage(SpellEffectIndex(i), m_targets.getUnitTarget())) return SPELL_FAILED_HIGHLEVEL; break; @@ -6713,7 +6712,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_FIZZLE; #endif - if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i), m_targets.getUnitTarget())) + if (int32(m_targets.getUnitTarget()->GetLevel()) > CalculateDamage(SpellEffectIndex(i), m_targets.getUnitTarget())) return SPELL_FAILED_HIGHLEVEL; // Mob tapped by another player or group. @@ -6820,7 +6819,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_caster->IsPlayer() || m_CastItem) break; - if (m_targets.getUnitTarget()->getPowerType() != POWER_MANA) + if (m_targets.getUnitTarget()->GetPowerType() != POWER_MANA) return SPELL_FAILED_BAD_TARGETS; break; @@ -6878,20 +6877,20 @@ SpellCastResult Spell::CheckCast(bool strict) SpellCastResult Spell::CheckPetCast(Unit* target) { - if (!m_casterUnit->isAlive()) + if (!m_casterUnit->IsAlive()) return SPELL_FAILED_CASTER_DEAD; //prevent spellcast interruption by another spellcast if (m_casterUnit->IsNonMeleeSpellCasted(false)) return SPELL_FAILED_SPELL_IN_PROGRESS; - if (m_casterUnit->isInCombat() && m_spellInfo->IsNonCombatSpell()) + if (m_casterUnit->IsInCombat() && m_spellInfo->IsNonCombatSpell()) return SPELL_FAILED_AFFECTING_COMBAT; - if (m_casterUnit->IsCreature() && (((Creature*)m_casterUnit)->IsPet() || m_casterUnit->isCharmed())) + if (m_casterUnit->IsCreature() && (((Creature*)m_casterUnit)->IsPet() || m_casterUnit->IsCharmed())) { //dead owner (pets still alive when owners ressed?) - if (m_casterUnit->GetCharmerOrOwner() && !m_casterUnit->GetCharmerOrOwner()->isAlive()) + if (m_casterUnit->GetCharmerOrOwner() && !m_casterUnit->GetCharmerOrOwner()->IsAlive()) return SPELL_FAILED_CASTER_DEAD; if (!target && m_targets.getUnitTarget()) @@ -6920,7 +6919,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) if (_target) //for target dead/target not valid { - if (!_target->isTargetableForAttack(false, m_casterUnit->IsPlayer())) + if (!_target->IsTargetableForAttack(false, m_casterUnit->IsPlayer())) return SPELL_FAILED_BAD_TARGETS; // guessed error // SPELL_EFFECT_DISPEL -> Positive or negative depending on the target @@ -7073,13 +7072,13 @@ bool Spell::CanAutoCast(Unit* target) // Nostalrius - par exemple roder ne doit pas se declencher si on envoie le pet attaquer. // Sinon le pet revient a cause de cet attribut : - if (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET && m_casterUnit->getVictim()) + if (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET && m_casterUnit->GetVictim()) return false; // 2947 - Fire Shield, rank 1 enUS // When set to auto-cast, the Imp will cast this on any party members within 30 yds if they receive a melee attack. if (m_spellInfo->IsFitToFamily() && m_spellInfo->SpellVisual == 289) - if (!target->getAttackerForHelper()) + if (!target->GetAttackerForHelper()) return false; if (!m_spellInfo->HasEffect(SPELL_EFFECT_SCHOOL_DAMAGE)) @@ -7272,7 +7271,7 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost, spell); if (spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) - powerCost = int32(powerCost / (1.117f * spellInfo->spellLevel / caster->getLevel() - 0.1327f)); + powerCost = int32(powerCost / (1.117f * spellInfo->spellLevel / caster->GetLevel() - 0.1327f)); // PCT mod from user auras by school powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school))); @@ -8299,7 +8298,7 @@ public: if (i_TargetType != SPELL_TARGETS_ALL) { - if (!unit->isAttackableByAOE(i_spell.m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD, i_playerControlled)) + if (!unit->IsAttackableByAOE(i_spell.m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD, i_playerControlled)) continue; } @@ -8439,7 +8438,7 @@ void Spell::FillRaidOrPartyTargets(UnitList &TagUnitMap, Unit* target, float rad // IsHostileTo check duel and controlled by enemy if (target && (raid || subgroup == target->GetSubGroup()) - && target->getLevel() + 10 >= m_spellInfo->spellLevel + && target->GetLevel() + 10 >= m_spellInfo->spellLevel && !m_caster->IsHostileTo(target)) { if ((target == m_caster && withcaster) || @@ -8602,8 +8601,8 @@ void Spell::OnSpellLaunch() // Delay attack, otherwise player makes instant attack after cast if (m_casterUnit->IsPlayer()) { - m_casterUnit->setAttackTimer(BASE_ATTACK, m_casterUnit->getAttackTimer(BASE_ATTACK) + 200 + 40 * m_casterUnit->GetDistance(unitTarget)); - m_casterUnit->setAttackTimer(OFF_ATTACK, m_casterUnit->getAttackTimer(OFF_ATTACK) + 200 + 40 * m_casterUnit->GetDistance(unitTarget)); + m_casterUnit->SetAttackTimer(BASE_ATTACK, m_casterUnit->GetAttackTimer(BASE_ATTACK) + 200 + 40 * m_casterUnit->GetDistance(unitTarget)); + m_casterUnit->SetAttackTimer(OFF_ATTACK, m_casterUnit->GetAttackTimer(OFF_ATTACK) + 200 + 40 * m_casterUnit->GetDistance(unitTarget)); } bool triggerAutoAttack = unitTarget != m_casterUnit && !m_spellInfo->IsPositiveSpell() && !(m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET); diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index 8a6302ad7..a39ea0964 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -28,7 +28,6 @@ #include "DBCEnums.h" #include "ObjectGuid.h" #include "LootMgr.h" -#include "Unit.h" #include "Player.h" #ifdef USE_STANDARD_MALLOC @@ -763,7 +762,7 @@ namespace MaNGOS for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { Player * pPlayer = itr->getSource(); - if( !pPlayer->isAlive() || pPlayer->IsTaxiFlying()) + if( !pPlayer->IsAlive() || pPlayer->IsTaxiFlying()) continue; if( i_originalCaster->IsFriendlyTo(pPlayer) ) diff --git a/src/game/Spells/SpellAuraDefines.h b/src/game/Spells/SpellAuraDefines.h index dc2bdae1d..4a11991bd 100644 --- a/src/game/Spells/SpellAuraDefines.h +++ b/src/game/Spells/SpellAuraDefines.h @@ -107,7 +107,7 @@ enum AuraType */ SPELL_AURA_MOD_STEALTH = 16, /** - * Not handled by the Aura class, implemented in Unit::isVisibleForOrDetect + * Not handled by the Aura class, implemented in Unit::IsVisibleForOrDetect * which does a lot of checks to determine whether the person is visible or not, * the SPELL_AURA_MOD_STEALTH seems to determine how in/visible ie a rogue is. */ diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index ff31fced8..f180191ff 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -30,7 +30,6 @@ #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" -#include "Unit.h" #include "Spell.h" #include "DynamicObject.h" #include "Group.h" @@ -218,7 +217,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS] = &Aura::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED &Aura::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance &Aura::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT implemented in Unit::CalculateAbsorbAndResist - &Aura::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL implemented in Unit::isVisibleForOrDetect + &Aura::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL implemented in Unit::IsVisibleForOrDetect &Aura::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING implemented in Player::GetMaxTimer &Aura::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN implemented in Player::CalculateReputationGain &Aura::HandleUnused, //157 SPELL_AURA_PET_DAMAGE_MULTI (single test like spell 20782, also single for 214 aura) @@ -553,7 +552,7 @@ void AreaAura::Update(uint32 diff) { Unit* caster = GetTarget(); - if (!caster->hasUnitState(UNIT_STAT_ISOLATED)) + if (!caster->HasUnitState(UNIT_STAT_ISOLATED)) { Unit* owner = caster->GetCharmerOrOwner(); if (!owner) @@ -575,12 +574,12 @@ void AreaAura::Update(uint32 diff) for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->getSource(); - if (Target && Target->isAlive() && Target->GetSubGroup() == subgroup && (!Target->duel || owner == Target) && caster->IsFriendlyTo(Target)) + if (Target && Target->IsAlive() && Target->GetSubGroup() == subgroup && (!Target->duel || owner == Target) && caster->IsFriendlyTo(Target)) { if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); Pet *pet = Target->GetPet(); - if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) + if (pet && pet->IsAlive() && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } } @@ -609,12 +608,12 @@ void AreaAura::Update(uint32 diff) for (GroupReference *itr = pGroup->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* Target = itr->getSource(); - if (Target && Target->isAlive() && caster->IsFriendlyTo(Target)) + if (Target && Target->IsAlive() && caster->IsFriendlyTo(Target)) { if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); Pet *pet = Target->GetPet(); - if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) + if (pet && pet->IsAlive() && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } } @@ -702,7 +701,7 @@ void AreaAura::Update(uint32 diff) if (GetSpellProto()->AttributesEx3 & SPELL_ATTR_EX3_TARGET_ONLY_PLAYER && target->GetTypeId() != TYPEID_PLAYER) continue; - if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(GetSpellProto(), target->getLevel())) + if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(GetSpellProto(), target->GetLevel())) { int32 actualBasePoints = m_currentBasePoints; // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?) @@ -769,7 +768,7 @@ void AreaAura::Update(uint32 diff) // or caster is isolated or caster no longer has the aura // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true); - if (!caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || + if (!caster || caster->HasUnitState(UNIT_STAT_ISOLATED) || !caster->IsWithinDistInMap(target, m_radius) || !caster->HasAura(GetId(), GetEffIndex()) || caster->IsFriendlyTo(target) != needFriendly @@ -1051,7 +1050,7 @@ void Aura::TriggerSpell() uint32 spellRandom; // not in banished state - if (triggerTarget->hasUnitState(UNIT_STAT_ISOLATED)) + if (triggerTarget->HasUnitState(UNIT_STAT_ISOLATED)) return; // specific code for cases with no trigger spell provided in field @@ -1272,7 +1271,7 @@ void Aura::TriggerSpell() // case 28522: // Icebolt { - if (target && target->isAlive() && !target->HasAura(31800)) + if (target && target->IsAlive() && !target->HasAura(31800)) { target->CastSpell(target, 31800, true); // Icebolt which causes immunity to frost dmg trigger_spell_id = 28535; //summon ice block @@ -1401,7 +1400,7 @@ void Aura::TriggerSpell() case 9347: // Mortal Strike { // expected selection current fight target - triggerTarget = GetTarget()->getVictim(); + triggerTarget = GetTarget()->GetVictim(); if (!triggerTarget) return; @@ -1485,7 +1484,7 @@ void Aura::TriggerSpell() Player* pPlayer = (*it).getSource(); if (pPlayer->GetGUID() == casterGUID) continue; if (!pPlayer) continue; - if (pPlayer->isDead()) continue; + if (pPlayer->IsDead()) continue; // 2d distance should be good enough if (pPlayer->HasAura(28084) && caster->GetDistance2d(pPlayer) < 13.0f) // 13.0f taken from dbc { @@ -1518,7 +1517,7 @@ void Aura::TriggerSpell() Player* pPlayer = (*it).getSource(); if (!pPlayer) continue; if (pPlayer->GetGUID() == triggerTarget->GetGUID()) continue; - if (pPlayer->isDead()) continue; + if (pPlayer->IsDead()) continue; // 2d distance should be good enough if (pPlayer->HasAura(28059) && caster->GetDistance2d(pPlayer) < 13.0f) // 13.0f taken from dbc { @@ -1648,7 +1647,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { if (Player* pPlayer = ToPlayer(target)) { - if (!pPlayer->isInCombat()) + if (!pPlayer->IsInCombat()) pPlayer->HandleEmoteCommand(EMOTE_STATE_DANCE); } return; @@ -1667,7 +1666,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_STAT_ROOT); } return; } @@ -1743,13 +1742,13 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // AT REMOVE else { - if (IsQuestTameSpell(GetId()) && target->isAlive()) + if (IsQuestTameSpell(GetId()) && target->IsAlive()) { if (m_removeMode != AURA_REMOVE_BY_CHANNEL) return; Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; uint32 finalSpellId = 0; @@ -1813,7 +1812,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_STAT_ROOT | UNIT_STAT_PENDING_ROOT); caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } return; @@ -1847,7 +1846,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (Unit* caster = GetCaster()) if (Player* casterPlayer = caster->ToPlayer()) { - if (casterPlayer->isAlive() && !casterPlayer->isInCombat() && !casterPlayer->IsTaxiFlying()) + if (casterPlayer->IsAlive() && !casterPlayer->IsInCombat() && !casterPlayer->IsTaxiFlying()) { casterPlayer->AddAura(15007); // Add Resurrection Sickness if (sObjectMgr.GetClosestGraveYard(casterPlayer->GetPositionX(), casterPlayer->GetPositionY(), casterPlayer->GetPositionZ(), casterPlayer->GetMapId(), casterPlayer->GetTeam())) @@ -2015,10 +2014,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case 10848: // Shroud of Death case 27978: // Shroud of Death - if (apply) - target->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE; - else - target->m_AuraFlags |= ~UNIT_AURAFLAG_ALIVE_INVISIBLE; + // Checked for in Unit::IsInvisibleForAlive() return; } break; @@ -2222,7 +2218,7 @@ std::pair getShapeshiftModelInfo(ShapeshiftForm form, Unit if (target->IsPlayer()) { - if (Player::TeamForRace(target->getRace()) == ALLIANCE) + if (Player::TeamForRace(target->GetRace()) == ALLIANCE) modelid = 892; else modelid = 8571; @@ -2243,7 +2239,7 @@ std::pair getShapeshiftModelInfo(ShapeshiftForm form, Unit case FORM_DIREBEAR: if (target->IsPlayer()) { - if (Player::TeamForRace(target->getRace()) == ALLIANCE) + if (Player::TeamForRace(target->GetRace()) == ALLIANCE) modelid = 2281; else modelid = 2289; @@ -2252,7 +2248,7 @@ std::pair getShapeshiftModelInfo(ShapeshiftForm form, Unit modelid = 2281; break; case FORM_GHOUL: - if (Player::TeamForRace(target->getRace()) == ALLIANCE) + if (Player::TeamForRace(target->GetRace()) == ALLIANCE) modelid = 10045; break; case FORM_CREATUREBEAR: @@ -2265,7 +2261,7 @@ std::pair getShapeshiftModelInfo(ShapeshiftForm form, Unit case FORM_MOONKIN: if (target->IsPlayer()) { - if (Player::TeamForRace(target->getRace()) == ALLIANCE) + if (Player::TeamForRace(target->GetRace()) == ALLIANCE) modelid = 15374; else modelid = 15375; @@ -2336,16 +2332,16 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) std::pair info = getShapeshiftModelInfo(form, target); unsigned int modelid = info.first; - if (modelid > 0 && !target->getTransForm()) + if (modelid > 0 && !target->GetTransForm()) { if (apply) { - target->setTransformScale(info.second); + target->SetTransformScale(info.second); target->SetDisplayId(modelid); } else { - target->resetTransformScale(); + target->ResetTransformScale(); target->SetDisplayId(target->GetNativeDisplayId()); } } @@ -2391,8 +2387,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { // reset power to default values only at power change uint32 powaa = target->GetPower(PowerType); - if (target->getPowerType() != PowerType) - target->setPowerType(PowerType); + if (target->GetPowerType() != PowerType) + target->SetPowerType(PowerType); switch (form) { @@ -2473,9 +2469,9 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) } else { - if (target->getClass() == CLASS_DRUID) + if (target->GetClass() == CLASS_DRUID) { - target->setPowerType(POWER_MANA); + target->SetPowerType(POWER_MANA); target->SetPower(POWER_RAGE, 0); } @@ -2504,7 +2500,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); // update active transform spell only not set or not overwriting negative by positive case - if (!target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(target->getTransForm())) + if (!target->GetTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(target->GetTransForm())) { if (GetId() == 23603) // Ustaag : Nefarian Class Call Mage { @@ -2530,7 +2526,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) case 16739: // Orb of Deception { uint8 gender = sObjectMgr.GetCreatureModelInfo(target->GetDisplayId())->gender; - switch (target->getRace()) + switch (target->GetRace()) { case RACE_TROLL: model_id = gender == GENDER_MALE ? @@ -2612,19 +2608,19 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (model_id) { target->SetDisplayId(model_id); - target->setTransformScale(mod_x); + target->SetTransformScale(mod_x); } - target->setTransForm(GetId()); + target->SetTransForm(GetId()); } } else { //reset cosmetics only if it's the current transform - if (target->getTransForm() == GetId()) + if (target->GetTransForm() == GetId()) { - target->setTransForm(0); + target->SetTransForm(0); target->SetDisplayId(target->GetNativeDisplayId()); - target->resetTransformScale(); + target->ResetTransformScale(); // apply default equipment for creature case if (target->GetTypeId() == TYPEID_UNIT) @@ -2654,7 +2650,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (info.first) { target->SetDisplayId(info.first); - target->setTransformScale(info.second); + target->SetTransformScale(info.second); } } } @@ -2911,11 +2907,11 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode m_removeMode) FactionTemplateEntry const* origFactionTemplate = pTarget->getFactionTemplateEntry(); - pTarget->addUnitState(UNIT_STAT_POSSESSED); + pTarget->AddUnitState(UNIT_STAT_POSSESSED); pTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pTarget->SetCharmerGuid(pCaster->GetObjectGuid()); pTarget->SetPossessorGuid(pCaster->GetObjectGuid()); - pTarget->setFaction(pCaster->getFaction()); + pTarget->SetFactionTemplateId(pCaster->GetFactionTemplateId()); // Target should became visible at SetView call (if not visible before), // otherwise client will ignore packets from the target (SetClientControl for example). @@ -2937,7 +2933,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode m_removeMode) pCaster->PossessSpellInitialize(); if (Creature* pCreature = pTarget->ToCreature()) - if (!pCreature->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!pCreature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) if (pCreature->AI()->SwitchAiAtControl()) pCreature->AIM_Initialize(); @@ -2946,7 +2942,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode m_removeMode) 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_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT)) pTarget->SetRooted(true); pTarget->StopMoving(); pTarget->SetWalk(pCaster->IsWalking()); @@ -2970,7 +2966,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode m_removeMode) if (m_removeMode == AURA_REMOVE_BY_DELETE) return; - pTarget->clearUnitState(UNIT_STAT_POSSESSED); + pTarget->ClearUnitState(UNIT_STAT_POSSESSED); pTarget->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); pTarget->SetCharmerGuid(ObjectGuid()); pTarget->SetPossessorGuid(ObjectGuid()); @@ -2988,7 +2984,7 @@ void Unit::ModPossess(Unit* pTarget, bool apply, AuraRemoveMode m_removeMode) if (Creature* pCreature = pTarget->ToCreature()) { - if (!pCreature->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (!pCreature->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) { pTarget->StopMoving(true); if (pCreature->AI() && pCreature->AI()->SwitchAiAtControl()) @@ -3041,7 +3037,7 @@ void Player::ModPossessPet(Pet* pPet, bool apply, AuraRemoveMode m_removeMode) if (apply) { - pPet->addUnitState(UNIT_STAT_POSSESSED); + pPet->AddUnitState(UNIT_STAT_POSSESSED); // Target should became visible at SetView call(if not visible before), // otherwise client will ignore packets from the target(SetClientControl for example). @@ -3082,7 +3078,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_STAT_CAN_NOT_REACT)) pPet->StopMoving(true); // To avoid moving the wrong unit on server side between cancellation and mover swap @@ -3128,13 +3124,13 @@ void Aura::HandleModCharm(bool apply, bool Real) target->RemoveSpellsCausingAura(SPELL_AURA_AOE_CHARM, GetHolder()); // this is a bit dodgy, like most removals of SPELL_AURA_AOE_CHARM target->SetCharmerGuid(GetCasterGuid()); - target->setFaction(caster->getFaction()); + target->SetFactionTemplateId(caster->GetFactionTemplateId()); target->CastStop(target == caster ? GetId() : 0); caster->SetCharm(target); target->CombatStop(true); target->DeleteThreatList(); - target->getHostileRefManager().deleteReferences(); + target->GetHostileRefManager().deleteReferences(); CharmInfo *charmInfo = target->InitCharmInfo(target); charmInfo->InitCharmCreateSpells(); @@ -3160,7 +3156,7 @@ void Aura::HandleModCharm(bool apply, bool Real) if (pCreatureTarget->AI() && pCreatureTarget->AI()->SwitchAiAtControl()) pCreatureTarget->AIM_Initialize(); - if (caster->IsPlayer() && caster->getClass() == CLASS_WARLOCK) + if (caster->IsPlayer() && caster->GetClass() == CLASS_WARLOCK) { CreatureInfo const *cinfo = pCreatureTarget->GetCreatureInfo(); if (cinfo && cinfo->type == CREATURE_TYPE_DEMON) @@ -3218,15 +3214,15 @@ void Aura::HandleModCharm(bool apply, bool Real) if (target->IsPet()) { if (Unit* owner = target->GetOwner()) - target->setFaction(owner->getFaction()); + target->SetFactionTemplateId(owner->GetFactionTemplateId()); else if (cinfo) - target->setFaction(cinfo->faction); + target->SetFactionTemplateId(cinfo->faction); } else if (cinfo) // normal creature - target->setFaction(cinfo->faction); + target->SetFactionTemplateId(cinfo->faction); // restore UNIT_FIELD_BYTES_0 - if (cinfo && caster && caster->IsPlayer() && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) + if (cinfo && caster && caster->IsPlayer() && caster->GetClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) { // DB must have proper class set in field at loading, not req. restore, including workaround case at apply // target->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class); @@ -3248,9 +3244,9 @@ void Aura::HandleModCharm(bool apply, bool Real) target->UpdateControl(); if (pPlayerTarget) - pPlayerTarget->SetFactionForRace(target->getRace()); + pPlayerTarget->SetFactionForRace(target->GetRace()); - if (pPlayerTarget && pPlayerTarget->isAlive() && caster && caster->isAlive() && caster->isInCombat()) + if (pPlayerTarget && pPlayerTarget->IsAlive() && caster && caster->IsAlive() && caster->IsInCombat()) { pPlayerTarget->SendAttackSwingCancelAttack(); @@ -3260,7 +3256,7 @@ void Aura::HandleModCharm(bool apply, bool Real) target->AttackStop(); target->RemoveAllAttackers(); target->DeleteThreatList(); - target->getHostileRefManager().deleteReferences(); + target->GetHostileRefManager().deleteReferences(); caster->SetInCombatWith(target); target->SetInCombatWith(caster); @@ -3271,7 +3267,7 @@ void Aura::HandleModCharm(bool apply, bool Real) { target->CombatStop(true); target->DeleteThreatList(); - target->getHostileRefManager().deleteReferences(); + target->GetHostileRefManager().deleteReferences(); } //target->SetUnitMovementFlags(MOVEFLAG_NONE); @@ -3325,7 +3321,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real) if (apply) { - HostileReference* pReference = pTarget->getHostileRefManager().getFirst(); + HostileReference* pReference = pTarget->GetHostileRefManager().getFirst(); while (pReference) { if (Creature* refTarget = ToCreature(pReference->getSourceUnit())) @@ -3419,7 +3415,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_STAT_PENDING_STUNNED : UNIT_STAT_STUNNED); target->SetTargetGuid(ObjectGuid()); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); @@ -3473,14 +3469,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_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (target->getVictim() && target->isAlive()) - target->SetTargetGuid(target->getVictim()->GetObjectGuid()); + 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_STAT_ROOT | UNIT_STAT_PENDING_ROOT)) // prevent allow move if have also root effect target->SetRooted(false); // Wyvern Sting @@ -3681,11 +3677,11 @@ 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_STAT_PENDING_ROOT : UNIT_STAT_ROOT); //Save last orientation - if (target->getVictim()) - target->SetOrientation(target->GetAngle(target->getVictim())); + if (target->GetVictim()) + target->SetOrientation(target->GetAngle(target->GetVictim())); if (!target->movespline->Finalized() && !inCharge) target->StopMoving(); @@ -3721,9 +3717,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_STAT_ROOT | UNIT_STAT_PENDING_ROOT); - if (!target->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) // prevent allow move if have also stun effect + if (!target->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) // prevent allow move if have also stun effect { target->SetRooted(false); //target->SetUnitMovementFlags(MOVEFLAG_NONE); @@ -3773,12 +3769,12 @@ void Aura::HandleModThreat(bool apply, bool Real) { // Arcane Shroud case 26400: - level_diff = target->getLevel() - 60; + level_diff = target->GetLevel() - 60; multiplier = 2; break; // The Eye of Diminution case 28862: - level_diff = target->getLevel() - 60; + level_diff = target->GetLevel() - 60; multiplier = 1; break; } @@ -3800,15 +3796,15 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) Unit *target = GetTarget(); - if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) + if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER) return; Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; - target->getHostileRefManager().addTempThreat(m_modifier.m_amount, apply); + target->GetHostileRefManager().addTempThreat(m_modifier.m_amount, apply); } void Aura::HandleModTaunt(bool apply, bool Real) @@ -3819,12 +3815,12 @@ void Aura::HandleModTaunt(bool apply, bool Real) Unit *target = GetTarget(); - if (!target->isAlive() || !target->CanHaveThreatList()) + if (!target->IsAlive() || !target->CanHaveThreatList()) return; Unit* caster = GetCaster(); - if (!caster || !caster->isAlive()) + if (!caster || !caster->IsAlive()) return; if (apply) @@ -3975,7 +3971,7 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) // remove all flag auras (they are positive, but they must be removed when you are immune) if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY && GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD - && target->IsPlayer() && !target->isCharmed()) + && target->IsPlayer() && !target->IsCharmed()) target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else @@ -4017,9 +4013,9 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) if (Real && GetSpellProto()->Mechanic == MECHANIC_BANISH) { if (apply) - target->addUnitState(UNIT_STAT_ISOLATED); + target->AddUnitState(UNIT_STAT_ISOLATED); else - target->clearUnitState(UNIT_STAT_ISOLATED); + target->ClearUnitState(UNIT_STAT_ISOLATED); } } @@ -4574,7 +4570,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) } //recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag) - if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (GetSpellProto()->Attributes & 0x10) && target->isAlive()) + if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (GetSpellProto()->Attributes & 0x10) && target->IsAlive()) { // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed uint32 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue; @@ -4630,7 +4626,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking if (!Real) return; - Powers pt = GetTarget()->getPowerType(); + Powers pt = GetTarget()->GetPowerType(); if (m_modifier.periodictime == 0) { // Anger Management (only spell use this aura for rage) @@ -4679,7 +4675,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { if (int32(target->GetHealth()) > m_modifier.m_amount) target->ModifyHealth(-m_modifier.m_amount); - else if (target->isAlive()) + else if (target->IsAlive()) target->SetHealth(1); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); } @@ -4744,7 +4740,7 @@ void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); - if (target->isAlive()) + if (target->IsAlive()) target->SetPower(powerType, target->GetMaxPower(powerType) * powerPercent / 100.0f); } @@ -4754,7 +4750,7 @@ void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/) float healthPercent = target->GetHealthPercent(); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); - if (target->isAlive()) + if (target->IsAlive()) target->SetHealthPercent(healthPercent); if (target->GetMaxHealth() == 1) @@ -4981,7 +4977,7 @@ void Aura::HandleAuraModAttackPower(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedAttackPower(bool apply, bool /*Real*/) { - if ((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS) != 0) + if ((GetTarget()->GetClassMask() & CLASSMASK_WAND_USERS) != 0) return; float amount = m_modifier.m_amount; @@ -5008,7 +5004,7 @@ void Aura::HandleAuraModAttackPowerPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool /*Real*/) { #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 - if ((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS) != 0) + if ((GetTarget()->GetClassMask() & CLASSMASK_WAND_USERS) != 0) return; float amount = m_modifier.m_amount; @@ -5530,7 +5526,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) // Power Word: Shield generates half the threat as healing for the same amount if (spellProto->IsFitToFamily() && spellProto->Id != 27779) - caster->getHostileRefManager().threatAssist(caster, float(m_modifier.m_amount) * 0.25, spellProto); + caster->GetHostileRefManager().threatAssist(caster, float(m_modifier.m_amount) * 0.25, spellProto); } } } @@ -5547,7 +5543,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: { // don't damage target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit *pCaster = GetCaster(); @@ -5662,7 +5658,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data cleanDamage.resist = resist; pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, spellProto->GetSpellSchoolMask(), spellProto, true); // Curse of Doom: If the target dies from this damage, there is a chance that a Doomguard will be summoned. - if (spellProto->Id == 603 && !target->isAlive() && !urand(0, 9)) + if (spellProto->Id == 603 && !target->IsAlive() && !urand(0, 9)) pCaster->CastSpell(pCaster, 18662, true); break; } @@ -5670,14 +5666,14 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: { // don't damage target if not alive, possible death persistent effects - if (!target->IsInWorld() || !target->isAlive()) + if (!target->IsInWorld() || !target->IsAlive()) return; Unit *pCaster = GetCaster(); if (!pCaster) return; - if (!pCaster->IsInWorld() || !pCaster->isAlive()) + if (!pCaster->IsInWorld() || !pCaster->IsAlive()) return; if (spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && @@ -5735,7 +5731,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto); int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, spellProto->GetSpellSchoolMask(), spellProto, false); - if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false)) + if (!target->IsAlive() && pCaster->IsNonMeleeSpellCasted(false)) for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->Id == GetId()) @@ -5747,14 +5743,14 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data uint32 heal = int32(new_damage * multiplier); int32 gain = pCaster->DealHeal(pCaster, heal, spellProto); - pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); + pCaster->GetHostileRefManager().threatAssist(pCaster, gain * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_OBS_MOD_HEALTH: { // don't heal target if not alive, mostly death persistent effects from items - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit *pCaster = GetCaster(); @@ -5774,7 +5770,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data } // heal for caster damage (must be alive) - if (target != pCaster && spellProto->SpellVisual == 163 && !pCaster->isAlive()) + if (target != pCaster && spellProto->SpellVisual == 163 && !pCaster->IsAlive()) return; #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 @@ -5814,7 +5810,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data uint32 procEx = PROC_EX_NORMAL_HIT | PROC_EX_PERIODIC_POSITIVE; pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, gain, BASE_ATTACK, spellProto); - target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); + target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); // heal for caster damage, warlock's health funnel already cost hps if (target != pCaster && spellProto->SpellVisual == 163 && @@ -5846,7 +5842,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_PERIODIC_MANA_LEECH: { // don't damage target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) @@ -5855,14 +5851,14 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data Powers power = Powers(m_modifier.m_miscvalue); // power type might have changed between aura applying and tick (druid's shapeshift) - if (target->getPowerType() != power) + if (target->GetPowerType() != power) return; Unit *pCaster = GetCaster(); if (!pCaster) return; - if (!pCaster->isAlive()) + if (!pCaster->IsAlive()) return; if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && @@ -5930,7 +5926,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_PERIODIC_ENERGIZE: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage @@ -5954,13 +5950,13 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data if (power != POWER_MANA) // 1.9 - Mana regeneration over time will no longer generate threat. if (Unit* pCaster = GetCaster()) - target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); + target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } case SPELL_AURA_OBS_MOD_MANA: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage @@ -5980,13 +5976,13 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data int32 gain = target->ModifyPower(POWER_MANA, pdamage); if (Unit* pCaster = GetCaster()) - target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); + target->GetHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } case SPELL_AURA_POWER_BURN_MANA: { // don't mana burn target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; Unit *pCaster = GetCaster(); @@ -6001,7 +5997,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data Powers powerType = Powers(m_modifier.m_miscvalue); - if (!target->isAlive() || target->getPowerType() != powerType) + if (!target->IsAlive() || target->GetPowerType() != powerType) return; uint32 gain = uint32(-target->ModifyPower(powerType, -pdamage)); @@ -6035,12 +6031,12 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_MOD_REGEN: { // don't heal target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; int32 gain = target->ModifyHealth(m_modifier.m_amount); if (Unit *caster = GetCaster()) - target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); + target->GetHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); // Eating anim if (spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) target->HandleEmoteCommand(EMOTE_ONESHOT_EAT); @@ -6049,10 +6045,10 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data case SPELL_AURA_MOD_POWER_REGEN: { // don't energize target if not alive, possible death persistent effects - if (!target->isAlive()) + if (!target->IsAlive()) return; - Powers pt = target->getPowerType(); + Powers pt = target->GetPowerType(); if (int32(pt) != m_modifier.m_miscvalue) return; @@ -6160,7 +6156,7 @@ void Aura::PeriodicDummyTick() return; } case 24596: // Intoxicating Venom - if (target->isInCombat()) + if (target->IsInCombat()) { uint32 rand = urand(0, 99); if (rand < 7) @@ -6179,7 +6175,7 @@ void Aura::PeriodicDummyTick() // Judgement of Command if (spell->SpellIconID == 561) { - if (target && target->hasUnitState(UNIT_STAT_STUNNED)) + if (target && target->HasUnitState(UNIT_STAT_STUNNED)) { if (Unit* pCaster = GetCaster()) { @@ -6427,7 +6423,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() { SetAura(slot, false); SetAuraFlag(slot, true); - SetAuraLevel(slot, caster ? caster->getLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); + SetAuraLevel(slot, caster ? caster->GetLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); UpdateAuraApplication(); // update for out of range group members @@ -6489,7 +6485,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() return; SetAura(slot, true); SetAuraFlag(slot, false); - SetAuraLevel(slot, caster ? caster->getLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); + SetAuraLevel(slot, caster ? caster->GetLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)); } // unregister aura diminishing (and store last time) @@ -6932,7 +6928,7 @@ void SpellAuraHolder::Update(uint32 diff) if (Unit* caster = GetCaster()) { Powers powertype = Powers(m_spellProto->powerType); - int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->getLevel(); + int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->GetLevel(); m_timeCla = 1 * IN_MILLISECONDS; Unit* target = GetTarget(); @@ -6975,7 +6971,7 @@ void SpellAuraHolder::Update(uint32 diff) // Nostalrius : mise en combat if (!(GetSpellProto()->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositive() && - caster->isVisibleForOrDetect(m_target, m_target, false)) + caster->IsVisibleForOrDetect(m_target, m_target, false)) { m_target->SetInCombatWith(caster); caster->SetInCombatWith(m_target); diff --git a/src/game/Spells/SpellDefines.h b/src/game/Spells/SpellDefines.h new file mode 100644 index 000000000..39ef59f51 --- /dev/null +++ b/src/game/Spells/SpellDefines.h @@ -0,0 +1,1137 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __SPELL_DEFINES_H +#define __SPELL_DEFINES_H + +#include "Common.h" + + +enum SpellTarget +{ + TARGET_NONE = 0, + TARGET_SELF = 1, + TARGET_RANDOM_ENEMY_CHAIN_IN_AREA = 2, // only one spell has that, but regardless, it's a target type after all + TARGET_RANDOM_FRIEND_CHAIN_IN_AREA = 3, + TARGET_RANDOM_UNIT_CHAIN_IN_AREA = 4, // some plague spells that are infectious - maybe targets not-infected friends inrange + TARGET_PET = 5, + TARGET_CHAIN_DAMAGE = 6, + TARGET_AREAEFFECT_INSTANT = 7, // targets around provided destination point + TARGET_AREAEFFECT_CUSTOM = 8, + TARGET_INNKEEPER_COORDINATES = 9, // uses in teleport to innkeeper spells + TARGET_11 = 11, // used by spell 4 'Word of Recall Other' + TARGET_ALL_ENEMY_IN_AREA = 15, + TARGET_ALL_ENEMY_IN_AREA_INSTANT = 16, + TARGET_TABLE_X_Y_Z_COORDINATES = 17, // uses in teleport spells and some other + TARGET_EFFECT_SELECT = 18, // highly depends on the spell effect + TARGET_ALL_PARTY_AROUND_CASTER = 20, + TARGET_SINGLE_FRIEND = 21, + TARGET_CASTER_COORDINATES = 22, // used only in TargetA, target selection dependent from TargetB + TARGET_GAMEOBJECT = 23, + TARGET_IN_FRONT_OF_CASTER = 24, + TARGET_UNIT_TARGET_ANY = 25, + TARGET_GAMEOBJECT_ITEM = 26, + TARGET_MASTER = 27, + TARGET_ALL_ENEMY_IN_AREA_CHANNELED = 28, + TARGET_29 = 29, + TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER = 30, // select friendly for caster object faction (in different original caster faction) in TargetB used only with TARGET_ALL_AROUND_CASTER and in self casting range in TargetA + TARGET_ALL_FRIENDLY_UNITS_IN_AREA = 31, + TARGET_MINION = 32, + TARGET_ALL_PARTY = 33, + TARGET_ALL_PARTY_AROUND_CASTER_2 = 34, // used in Tranquility + TARGET_SINGLE_PARTY = 35, + TARGET_ALL_HOSTILE_UNITS_AROUND_CASTER = 36, + TARGET_AREAEFFECT_PARTY = 37, + TARGET_SCRIPT = 38, + TARGET_SELF_FISHING = 39, + TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT= 40, + TARGET_TOTEM_EARTH = 41, + TARGET_TOTEM_WATER = 42, + TARGET_TOTEM_AIR = 43, + TARGET_TOTEM_FIRE = 44, + TARGET_CHAIN_HEAL = 45, + TARGET_SCRIPT_COORDINATES = 46, + TARGET_DYNAMIC_OBJECT_FRONT = 47, + TARGET_DYNAMIC_OBJECT_BEHIND = 48, + TARGET_DYNAMIC_OBJECT_LEFT_SIDE = 49, + TARGET_DYNAMIC_OBJECT_RIGHT_SIDE = 50, + TARGET_AREAEFFECT_GO_AROUND_SOURCE = 51, + TARGET_AREAEFFECT_GO_AROUND_DEST = 52, // gameobject around destination, select by spell_script_target + TARGET_CURRENT_ENEMY_COORDINATES = 53, // set unit coordinates as dest, only 16 target B imlemented + TARGET_LARGE_FRONTAL_CONE = 54, + TARGET_DEST_CASTER_FRONT_LEAP = 55, + TARGET_ALL_RAID_AROUND_CASTER = 56, + TARGET_SINGLE_FRIEND_2 = 57, + TARGET_58 = 58, + TARGET_FRIENDLY_FRONTAL_CONE = 59, + TARGET_NARROW_FRONTAL_CONE = 60, + TARGET_AREAEFFECT_PARTY_AND_CLASS = 61, + TARGET_62 = 62, + TARGET_DUELVSPLAYER_COORDINATES = 63, +}; + +enum SpellMissInfo +{ + SPELL_MISS_NONE = 0, + SPELL_MISS_MISS = 1, + SPELL_MISS_RESIST = 2, + SPELL_MISS_DODGE = 3, + SPELL_MISS_PARRY = 4, + SPELL_MISS_BLOCK = 5, + SPELL_MISS_EVADE = 6, + SPELL_MISS_IMMUNE = 7, + SPELL_MISS_IMMUNE2 = 8, + SPELL_MISS_DEFLECT = 9, + SPELL_MISS_ABSORB = 10, + SPELL_MISS_REFLECT = 11 +}; + +enum SpellHitType +{ + SPELL_HIT_TYPE_CRIT_DEBUG = 0x01, + SPELL_HIT_TYPE_CRIT = 0x02, + SPELL_HIT_TYPE_HIT_DEBUG = 0x04, + SPELL_HIT_TYPE_SPLIT = 0x08, + SPELL_HIT_TYPE_VICTIM_IS_ATTACKER = 0x10, + SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG = 0x20 +}; + +enum SpellDmgClass +{ + SPELL_DAMAGE_CLASS_NONE = 0, + SPELL_DAMAGE_CLASS_MAGIC = 1, + SPELL_DAMAGE_CLASS_MELEE = 2, + SPELL_DAMAGE_CLASS_RANGED = 3 +}; + +enum SpellPreventionType +{ + SPELL_PREVENTION_TYPE_NONE = 0, + SPELL_PREVENTION_TYPE_SILENCE = 1, + SPELL_PREVENTION_TYPE_PACIFY = 2 +}; + +// Indexes from SpellRange.dbc, listed only special and used in code +enum SpellRangeIndex +{ + SPELL_RANGE_IDX_SELF_ONLY = 1, // 0.0 + SPELL_RANGE_IDX_COMBAT = 2, // often ~5.5 (but infact dynamic melee combat range) + SPELL_RANGE_IDX_ANYWHERE = 13, // 500000 (anywhere) +}; + +enum SpellEffects +{ + SPELL_EFFECT_NONE = 0, + SPELL_EFFECT_INSTAKILL = 1, + SPELL_EFFECT_SCHOOL_DAMAGE = 2, + SPELL_EFFECT_DUMMY = 3, + SPELL_EFFECT_PORTAL_TELEPORT = 4, + SPELL_EFFECT_TELEPORT_UNITS = 5, + SPELL_EFFECT_APPLY_AURA = 6, + SPELL_EFFECT_ENVIRONMENTAL_DAMAGE = 7, + SPELL_EFFECT_POWER_DRAIN = 8, + SPELL_EFFECT_HEALTH_LEECH = 9, + SPELL_EFFECT_HEAL = 10, + SPELL_EFFECT_BIND = 11, + SPELL_EFFECT_PORTAL = 12, + SPELL_EFFECT_RITUAL_BASE = 13, + SPELL_EFFECT_RITUAL_SPECIALIZE = 14, + SPELL_EFFECT_RITUAL_ACTIVATE_PORTAL = 15, + SPELL_EFFECT_QUEST_COMPLETE = 16, + SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL = 17, + SPELL_EFFECT_RESURRECT = 18, + SPELL_EFFECT_ADD_EXTRA_ATTACKS = 19, + SPELL_EFFECT_DODGE = 20, + SPELL_EFFECT_EVADE = 21, + SPELL_EFFECT_PARRY = 22, + SPELL_EFFECT_BLOCK = 23, + SPELL_EFFECT_CREATE_ITEM = 24, + SPELL_EFFECT_WEAPON = 25, + SPELL_EFFECT_DEFENSE = 26, + SPELL_EFFECT_PERSISTENT_AREA_AURA = 27, + SPELL_EFFECT_SUMMON = 28, + SPELL_EFFECT_LEAP = 29, + SPELL_EFFECT_ENERGIZE = 30, + SPELL_EFFECT_WEAPON_PERCENT_DAMAGE = 31, + SPELL_EFFECT_TRIGGER_MISSILE = 32, + SPELL_EFFECT_OPEN_LOCK = 33, + SPELL_EFFECT_SUMMON_CHANGE_ITEM = 34, + SPELL_EFFECT_APPLY_AREA_AURA_PARTY = 35, + SPELL_EFFECT_LEARN_SPELL = 36, + SPELL_EFFECT_SPELL_DEFENSE = 37, + SPELL_EFFECT_DISPEL = 38, + SPELL_EFFECT_LANGUAGE = 39, + SPELL_EFFECT_DUAL_WIELD = 40, + SPELL_EFFECT_SUMMON_WILD = 41, + SPELL_EFFECT_SUMMON_GUARDIAN = 42, + SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER= 43, + SPELL_EFFECT_SKILL_STEP = 44, + SPELL_EFFECT_ADD_HONOR = 45, + SPELL_EFFECT_SPAWN = 46, + SPELL_EFFECT_TRADE_SKILL = 47, + SPELL_EFFECT_STEALTH = 48, + SPELL_EFFECT_DETECT = 49, + SPELL_EFFECT_TRANS_DOOR = 50, + SPELL_EFFECT_FORCE_CRITICAL_HIT = 51, + SPELL_EFFECT_GUARANTEE_HIT = 52, + SPELL_EFFECT_ENCHANT_ITEM = 53, + SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY = 54, + SPELL_EFFECT_TAMECREATURE = 55, + SPELL_EFFECT_SUMMON_PET = 56, + SPELL_EFFECT_LEARN_PET_SPELL = 57, + SPELL_EFFECT_WEAPON_DAMAGE = 58, + SPELL_EFFECT_OPEN_LOCK_ITEM = 59, + SPELL_EFFECT_PROFICIENCY = 60, + SPELL_EFFECT_SEND_EVENT = 61, + SPELL_EFFECT_POWER_BURN = 62, + SPELL_EFFECT_THREAT = 63, + SPELL_EFFECT_TRIGGER_SPELL = 64, + SPELL_EFFECT_HEALTH_FUNNEL = 65, + SPELL_EFFECT_POWER_FUNNEL = 66, + SPELL_EFFECT_HEAL_MAX_HEALTH = 67, + SPELL_EFFECT_INTERRUPT_CAST = 68, + SPELL_EFFECT_DISTRACT = 69, + SPELL_EFFECT_PULL = 70, + SPELL_EFFECT_PICKPOCKET = 71, + SPELL_EFFECT_ADD_FARSIGHT = 72, + SPELL_EFFECT_SUMMON_POSSESSED = 73, + SPELL_EFFECT_SUMMON_TOTEM = 74, + SPELL_EFFECT_HEAL_MECHANICAL = 75, + SPELL_EFFECT_SUMMON_OBJECT_WILD = 76, + SPELL_EFFECT_SCRIPT_EFFECT = 77, + SPELL_EFFECT_ATTACK = 78, + SPELL_EFFECT_SANCTUARY = 79, + SPELL_EFFECT_ADD_COMBO_POINTS = 80, + SPELL_EFFECT_CREATE_HOUSE = 81, + SPELL_EFFECT_BIND_SIGHT = 82, + SPELL_EFFECT_DUEL = 83, + SPELL_EFFECT_STUCK = 84, + SPELL_EFFECT_SUMMON_PLAYER = 85, + SPELL_EFFECT_ACTIVATE_OBJECT = 86, + SPELL_EFFECT_SUMMON_TOTEM_SLOT1 = 87, + SPELL_EFFECT_SUMMON_TOTEM_SLOT2 = 88, + SPELL_EFFECT_SUMMON_TOTEM_SLOT3 = 89, + SPELL_EFFECT_SUMMON_TOTEM_SLOT4 = 90, + SPELL_EFFECT_THREAT_ALL = 91, + SPELL_EFFECT_ENCHANT_HELD_ITEM = 92, + SPELL_EFFECT_SUMMON_PHANTASM = 93, + SPELL_EFFECT_SELF_RESURRECT = 94, + SPELL_EFFECT_SKINNING = 95, + SPELL_EFFECT_CHARGE = 96, + SPELL_EFFECT_SUMMON_CRITTER = 97, + SPELL_EFFECT_KNOCK_BACK = 98, + SPELL_EFFECT_DISENCHANT = 99, + SPELL_EFFECT_INEBRIATE = 100, + SPELL_EFFECT_FEED_PET = 101, + SPELL_EFFECT_DISMISS_PET = 102, + SPELL_EFFECT_REPUTATION = 103, + SPELL_EFFECT_SUMMON_OBJECT_SLOT1 = 104, + SPELL_EFFECT_SUMMON_OBJECT_SLOT2 = 105, + SPELL_EFFECT_SUMMON_OBJECT_SLOT3 = 106, + SPELL_EFFECT_SUMMON_OBJECT_SLOT4 = 107, + SPELL_EFFECT_DISPEL_MECHANIC = 108, + SPELL_EFFECT_SUMMON_DEAD_PET = 109, + SPELL_EFFECT_DESTROY_ALL_TOTEMS = 110, + SPELL_EFFECT_DURABILITY_DAMAGE = 111, + SPELL_EFFECT_SUMMON_DEMON = 112, + SPELL_EFFECT_RESURRECT_NEW = 113, + SPELL_EFFECT_ATTACK_ME = 114, + SPELL_EFFECT_DURABILITY_DAMAGE_PCT = 115, + SPELL_EFFECT_SKIN_PLAYER_CORPSE = 116, + SPELL_EFFECT_SPIRIT_HEAL = 117, + SPELL_EFFECT_SKILL = 118, + SPELL_EFFECT_APPLY_AREA_AURA_PET = 119, + SPELL_EFFECT_TELEPORT_GRAVEYARD = 120, + SPELL_EFFECT_NORMALIZED_WEAPON_DMG = 121, + SPELL_EFFECT_122 = 122, + SPELL_EFFECT_SEND_TAXI = 123, + SPELL_EFFECT_PLAYER_PULL = 124, + SPELL_EFFECT_MODIFY_THREAT_PERCENT = 125, + SPELL_EFFECT_126 = 126, + SPELL_EFFECT_127 = 127, + // Effets "backportes" depuis MaNGOS BC+. + SPELL_EFFECT_APPLY_AREA_AURA_FRIEND = 128, + SPELL_EFFECT_APPLY_AREA_AURA_ENEMY = 129, + // Custom + SPELL_EFFECT_DESPAWN_OBJECT = 130, + SPELL_EFFECT_NOSTALRIUS = 131, + SPELL_EFFECT_APPLY_AREA_AURA_RAID = 132, + SPELL_EFFECT_APPLY_AREA_AURA_OWNER = 133, + TOTAL_SPELL_EFFECTS = 134 +}; + +enum SpellCastResult +{ + SPELL_FAILED_AFFECTING_COMBAT = 0x00, // You are in combat + SPELL_FAILED_ALREADY_AT_FULL_HEALTH , // You are already at full Health. + SPELL_FAILED_ALREADY_AT_FULL_POWER , // You are already at full %s. + SPELL_FAILED_ALREADY_BEING_TAMED , // That creature is already being tamed + SPELL_FAILED_ALREADY_HAVE_CHARM , // You already control a charmed creature + SPELL_FAILED_ALREADY_HAVE_SUMMON , // You already control a summoned creature + SPELL_FAILED_ALREADY_OPEN , // Already open + SPELL_FAILED_AURA_BOUNCED , // A more powerful spell is already active + SPELL_FAILED_AUTOTRACK_INTERRUPTED , // Message is hidden/unused + SPELL_FAILED_BAD_IMPLICIT_TARGETS , // You have no target. + SPELL_FAILED_BAD_TARGETS , // Invalid target + SPELL_FAILED_CANT_BE_CHARMED , // Target can't be charmed + SPELL_FAILED_CANT_BE_DISENCHANTED , // Item cannot be disenchanted +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 + SPELL_FAILED_CANT_BE_PROSPECTED , // There are no gems in this +#endif + SPELL_FAILED_CANT_CAST_ON_TAPPED , // Target is tapped + SPELL_FAILED_CANT_DUEL_WHILE_INVISIBLE , // You can't start a duel while invisible + SPELL_FAILED_CANT_DUEL_WHILE_STEALTHED , // You can't start a duel while stealthed + SPELL_FAILED_CANT_STEALTH , // You are too close to enemies + SPELL_FAILED_CASTER_AURASTATE , // You can't do that yet + SPELL_FAILED_CASTER_DEAD , // You are dead +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_11_2 + SPELL_FAILED_CHARMED , // Can't do that while charmed +#endif + SPELL_FAILED_CHEST_IN_USE , // That is already being used + SPELL_FAILED_CONFUSED , // Can't do that while confused + SPELL_FAILED_DONT_REPORT , // Message is hidden/unused + SPELL_FAILED_EQUIPPED_ITEM , // Must have the proper item equipped + SPELL_FAILED_EQUIPPED_ITEM_CLASS , // Must have a %s equipped + SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND , // Must have a %s equipped in the main hand +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 + SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND , // Must have a %s equipped in the offhand +#endif + SPELL_FAILED_ERROR , // Internal error + SPELL_FAILED_FIZZLE , // Fizzled + SPELL_FAILED_FLEEING , // Can't do that while fleeing + SPELL_FAILED_FOOD_LOWLEVEL , // That food's level is not high enough for your pet + SPELL_FAILED_HIGHLEVEL , // Target is too high level + SPELL_FAILED_HUNGER_SATIATED , // Message is hidden/unused + SPELL_FAILED_IMMUNE , // Immune + SPELL_FAILED_INTERRUPTED , // Interrupted + SPELL_FAILED_INTERRUPTED_COMBAT , // Interrupted + SPELL_FAILED_ITEM_ALREADY_ENCHANTED , // Item is already enchanted + SPELL_FAILED_ITEM_GONE , // Item is gone + SPELL_FAILED_ITEM_NOT_FOUND , // Tried to enchant an item that didn't exist + SPELL_FAILED_ITEM_NOT_READY , // Item is not ready yet. + SPELL_FAILED_LEVEL_REQUIREMENT , // You are not high enough level + SPELL_FAILED_LINE_OF_SIGHT , // Target not in line of sight + SPELL_FAILED_LOWLEVEL , // Target is too low level + SPELL_FAILED_LOW_CASTLEVEL , // Skill not high enough + SPELL_FAILED_MAINHAND_EMPTY , // Your weapon hand is empty + SPELL_FAILED_MOVING , // Can't do that while moving + SPELL_FAILED_NEED_AMMO , // Ammo needs to be in the paper doll ammo slot before it can be fired + SPELL_FAILED_NEED_AMMO_POUCH , // Requires: %s + SPELL_FAILED_NEED_EXOTIC_AMMO , // Requires exotic ammo: %s + SPELL_FAILED_NOPATH , // No path available + SPELL_FAILED_NOT_BEHIND , // You must be behind your target + SPELL_FAILED_NOT_FISHABLE , // Your cast didn't land in fishable water + SPELL_FAILED_NOT_HERE , // You can't use that here + SPELL_FAILED_NOT_INFRONT , // You must be in front of your target + SPELL_FAILED_NOT_IN_CONTROL , // You are not in control of your actions + SPELL_FAILED_NOT_KNOWN , // Spell not learned + SPELL_FAILED_NOT_MOUNTED , // You are mounted + SPELL_FAILED_NOT_ON_TAXI , // You are in flight + SPELL_FAILED_NOT_ON_TRANSPORT , // You are on a transport + SPELL_FAILED_NOT_READY , // Spell is not ready yet. + SPELL_FAILED_NOT_SHAPESHIFT , // You are in shapeshift form + SPELL_FAILED_NOT_STANDING , // You must be standing to do that + SPELL_FAILED_NOT_TRADEABLE , // You can only use this on an object you own + SPELL_FAILED_NOT_TRADING , // Tried to enchant a trade item, but not trading + SPELL_FAILED_NOT_UNSHEATHED , // You have to be unsheathed to do that! + SPELL_FAILED_NOT_WHILE_GHOST , // Can't cast as ghost + SPELL_FAILED_NO_AMMO , // Out of ammo + SPELL_FAILED_NO_CHARGES_REMAIN , // No charges remain +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 + SPELL_FAILED_NO_CHAMPION , // You haven't selected a champion +#endif + SPELL_FAILED_NO_COMBO_POINTS , // That ability requires combo points + SPELL_FAILED_NO_DUELING , // Dueling isn't allowed here + SPELL_FAILED_NO_ENDURANCE , // Not enough endurance + SPELL_FAILED_NO_FISH , // There aren't any fish here + SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED , // Can't use items while shapeshifted + SPELL_FAILED_NO_MOUNTS_ALLOWED , // You can't mount here + SPELL_FAILED_NO_PET , // You do not have a pet + SPELL_FAILED_NO_POWER , // Dynamic pre-defined messages, no args: Not enough mana, Not enough rage, etc +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_10_2 + SPELL_FAILED_NOTHING_TO_DISPEL , // Nothing to dispel +#endif +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 + SPELL_FAILED_NOTHING_TO_STEAL , // Nothing to steal +#endif + SPELL_FAILED_ONLY_ABOVEWATER , // Cannot use while swimming + SPELL_FAILED_ONLY_DAYTIME , // Can only use during the day + SPELL_FAILED_ONLY_INDOORS , // Can only use indoors + SPELL_FAILED_ONLY_MOUNTED , // Can only use while mounted + SPELL_FAILED_ONLY_NIGHTTIME , // Can only use during the night + SPELL_FAILED_ONLY_OUTDOORS , // Can only use outside + SPELL_FAILED_ONLY_SHAPESHIFT , // Must be in %s + SPELL_FAILED_ONLY_STEALTHED , // You must be in stealth mode + SPELL_FAILED_ONLY_UNDERWATER , // Can only use while swimming + SPELL_FAILED_OUT_OF_RANGE , // Out of range. + SPELL_FAILED_PACIFIED , // Can't use that ability while pacified + SPELL_FAILED_POSSESSED , // You are possessed + SPELL_FAILED_REAGENTS , // Message is hidden/unused, supposedly implemented client-side only + SPELL_FAILED_REQUIRES_AREA , // You need to be in %s + SPELL_FAILED_REQUIRES_SPELL_FOCUS , // Requires %s + SPELL_FAILED_ROOTED , // You are unable to move + SPELL_FAILED_SILENCED , // Can't do that while silenced + SPELL_FAILED_SPELL_IN_PROGRESS , // Another action is in progress + SPELL_FAILED_SPELL_LEARNED , // You have already learned the spell + SPELL_FAILED_SPELL_UNAVAILABLE , // The spell is not available to you + SPELL_FAILED_STUNNED , // Can't do that while stunned + SPELL_FAILED_TARGETS_DEAD , // Your target is dead + SPELL_FAILED_TARGET_AFFECTING_COMBAT , // Target is in combat + SPELL_FAILED_TARGET_AURASTATE , // You can't do that yet + SPELL_FAILED_TARGET_DUELING , // Target is currently dueling + SPELL_FAILED_TARGET_ENEMY , // Target is hostile + SPELL_FAILED_TARGET_ENRAGED , // Target is too enraged to be charmed + SPELL_FAILED_TARGET_FRIENDLY , // Target is friendly + SPELL_FAILED_TARGET_IN_COMBAT , // The target can't be in combat + SPELL_FAILED_TARGET_IS_PLAYER , // Can't target players + SPELL_FAILED_TARGET_NOT_DEAD , // Target is alive + SPELL_FAILED_TARGET_NOT_IN_PARTY , // Target is not in your party + SPELL_FAILED_TARGET_NOT_LOOTED , // Creature must be looted first + SPELL_FAILED_TARGET_NOT_PLAYER , // Target is not a player + SPELL_FAILED_TARGET_NO_POCKETS , // No pockets to pick + SPELL_FAILED_TARGET_NO_WEAPONS , // Target has no weapons equipped + SPELL_FAILED_TARGET_UNSKINNABLE , // Creature is not skinnable + SPELL_FAILED_THIRST_SATIATED , // Message is hidden/unused + SPELL_FAILED_TOO_CLOSE , // Target too close + SPELL_FAILED_TOO_MANY_OF_ITEM , // You have too many of that item already + SPELL_FAILED_TOTEMS , // Message is hidden/unused, supposedly implemented client-side only + SPELL_FAILED_TRAINING_POINTS , // Not enough training points + SPELL_FAILED_TRY_AGAIN , // Failed attempt + SPELL_FAILED_UNIT_NOT_BEHIND , // Target needs to be behind you + SPELL_FAILED_UNIT_NOT_INFRONT , // Target needs to be in front of you + SPELL_FAILED_WRONG_PET_FOOD , // Your pet doesn't like that food + SPELL_FAILED_NOT_WHILE_FATIGUED , // Can't cast while fatigued + SPELL_FAILED_TARGET_NOT_IN_INSTANCE , // Target must be in this instance + SPELL_FAILED_NOT_WHILE_TRADING , // Can't cast while trading + SPELL_FAILED_TARGET_NOT_IN_RAID , // Target is not in your party or raid group + SPELL_FAILED_DISENCHANT_WHILE_LOOTING , // Cannot disenchant while looting +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 + SPELL_FAILED_PROSPECT_WHILE_LOOTING , // Cannot prospect while looting + SPELL_FAILED_PROSPECT_NEED_MORE , // Message is hidden/unused, supposedly implemented client-side only +#endif + SPELL_FAILED_TARGET_FREEFORALL , // Target is currently in free-for-all PvP combat + SPELL_FAILED_NO_EDIBLE_CORPSES , // There are no nearby corpses to eat + SPELL_FAILED_ONLY_BATTLEGROUNDS , // Can only use in battlegrounds + SPELL_FAILED_TARGET_NOT_GHOST , // Target is not a ghost + SPELL_FAILED_TOO_MANY_SKILLS , // Your pet can't learn any more skills +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + SPELL_FAILED_TRANSFORM_UNUSABLE , // You can't use the new item + SPELL_FAILED_WRONG_WEATHER , // The weather isn't right for that + SPELL_FAILED_DAMAGE_IMMUNE , // You can't do that while you are immune + SPELL_FAILED_PREVENTED_BY_MECHANIC , // Can't do that while %s + SPELL_FAILED_PLAY_TIME , // Maximum play time exceeded +#endif +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_9_4 + SPELL_FAILED_REPUTATION , // Your reputation isn't high enough +#endif +#if SUPPORTED_CLIENT_BUILD >= CLIENT_BUILD_1_12_1 + SPELL_FAILED_MIN_SKILL , // Your skill is not high enough. Requires %s (%d). +#endif + SPELL_FAILED_UNKNOWN , // Generic out of bounds response: Unknown reason + + SPELL_CAST_OK = 0xFF // custom value, must not be send to client +}; + +enum SpellInterruptFlags +{ + SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01, + SPELL_INTERRUPT_FLAG_DAMAGE = 0x02, + SPELL_INTERRUPT_FLAG_INTERRUPT = 0x04, + SPELL_INTERRUPT_FLAG_AUTOATTACK = 0x08, + SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10, // _complete_ interrupt on direct damage +}; + +enum SpellChannelInterruptFlags +{ + CHANNEL_FLAG_ENTER_COMBAT = 0x0001, // Nostalrius: guessed + CHANNEL_FLAG_DAMAGE = 0x0002, + CHANNEL_FLAG_INTERRUPT = 0x0004, + CHANNEL_FLAG_MOVEMENT = 0x0008, + CHANNEL_FLAG_TURNING = 0x0010, + CHANNEL_FLAG_DAMAGE2 = 0x0080, + CHANNEL_FLAG_DELAY = 0x4000 +}; + +enum SpellAuraInterruptFlags +{ + // Certains ont ete repris de TrinityCore (3.3.5) + // ATTENTION: Tous ne sont pas encore implementes. + // TC: Par exemple buff BG restauration + AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell? + AURA_INTERRUPT_FLAG_DAMAGE = 0x00000002, // 1 removed by any damage + // Non implemente + AURA_INTERRUPT_FLAG_CAST = 0x00000004, // 2 + AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement + AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning + AURA_INTERRUPT_FLAG_ENTER_COMBAT = 0x00000020, // 5 removed by entering combat - Feign death only + AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by unmounting + AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water + AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water + AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing + AURA_INTERRUPT_FLAG_TALK = 0x00000400, // 10 on interact with NPC (gossip, trainer, stable pet ...) - implemented + AURA_INTERRUPT_FLAG_USE = 0x00000800, // 11 on interact with GO - implement + // TC - implemente + AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by attack? + // TC - non implemente + AURA_INTERRUPT_FLAG_SPELL_ATTACK = 0x00002000, // 13 + AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14 unused in 1.12 + // TC - non implemente + AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by casting a spell? + AURA_INTERRUPT_FLAG_ON_CAST_SPELL = 0x00010000, // 16 + AURA_INTERRUPT_FLAG_MOUNTING = 0x00020000, // 17 removed by mounting + AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up (used by food and drink mostly and sleep/Fake Death like) + AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported + AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION = 0x00100000, // 20 removed by auras that make you invulnerable, or make other to loose selection on you + AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21 + AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22 + // TC - non implemente (9 sorts) + AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat + AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000 // 24 removed by any direct damage +}; + +enum SpellModOp +{ + SPELLMOD_DAMAGE = 0, + SPELLMOD_DURATION = 1, + SPELLMOD_THREAT = 2, + SPELLMOD_ATTACK_POWER = 3, + SPELLMOD_CHARGES = 4, + SPELLMOD_RANGE = 5, + SPELLMOD_RADIUS = 6, + SPELLMOD_CRITICAL_CHANCE = 7, + SPELLMOD_ALL_EFFECTS = 8, + SPELLMOD_NOT_LOSE_CASTING_TIME = 9, + SPELLMOD_CASTING_TIME = 10, + SPELLMOD_COOLDOWN = 11, + SPELLMOD_SPEED = 12, + SPELLMOD_COST = 14, + SPELLMOD_CRIT_DAMAGE_BONUS = 15, + SPELLMOD_RESIST_MISS_CHANCE = 16, + SPELLMOD_JUMP_TARGETS = 17, + SPELLMOD_CHANCE_OF_SUCCESS = 18, // Only used with SPELL_AURA_ADD_FLAT_MODIFIER and affects proc spells + SPELLMOD_ACTIVATION_TIME = 19, + SPELLMOD_EFFECT_PAST_FIRST = 20, + SPELLMOD_CASTING_TIME_OLD = 21, + SPELLMOD_DOT = 22, + SPELLMOD_HASTE = 23, + SPELLMOD_SPELL_BONUS_DAMAGE = 24, + SPELLMOD_MULTIPLE_VALUE = 27, + SPELLMOD_RESIST_DISPEL_CHANCE = 28, + MAX_SPELLMOD = 29, +}; + +// Spell aura states +enum AuraState +{ // (C) used in caster aura state (T) used in target aura state + AURA_STATE_DEFENSE = 1, // C | + AURA_STATE_HEALTHLESS_20_PERCENT = 2, // C T | + AURA_STATE_BERSERKING = 3, // C | + AURA_STATE_FROZEN = 4, // | frozen target (but not used for any spells in 1.12.1 at client side) + AURA_STATE_JUDGEMENT = 5, // C | + //AURA_STATE_UNKNOWN6 = 6, // | not used + AURA_STATE_HUNTER_PARRY = 7, // C | + AURA_STATE_ROGUE_ATTACK_FROM_STEALTH = 8, // C | FIX ME: not implemented yet! + // Custom aura states - not based on spell data: + AURA_STATE_HEALTHLESS_15_PERCENT = 9, + AURA_STATE_HEALTHLESS_10_PERCENT = 10, + AURA_STATE_HEALTHLESS_5_PERCENT = 11, +}; + +// Spell mechanics +enum Mechanics +{ + MECHANIC_NONE = 0, + MECHANIC_CHARM = 1, + MECHANIC_DISORIENTED = 2, + MECHANIC_DISARM = 3, + MECHANIC_DISTRACT = 4, + MECHANIC_FEAR = 5, + MECHANIC_FUMBLE = 6, + MECHANIC_ROOT = 7, + MECHANIC_PACIFY = 8, // 0 spells use this mechanic + MECHANIC_SILENCE = 9, + MECHANIC_SLEEP = 10, + MECHANIC_SNARE = 11, + MECHANIC_STUN = 12, + MECHANIC_FREEZE = 13, + MECHANIC_KNOCKOUT = 14, + MECHANIC_BLEED = 15, + MECHANIC_BANDAGE = 16, + MECHANIC_POLYMORPH = 17, + MECHANIC_BANISH = 18, + MECHANIC_SHIELD = 19, + MECHANIC_SHACKLE = 20, + MECHANIC_MOUNT = 21, + MECHANIC_PERSUADE = 22, // 0 spells use this mechanic + MECHANIC_TURN = 23, + MECHANIC_HORROR = 24, + MECHANIC_INVULNERABILITY = 25, + MECHANIC_INTERRUPT = 26, + MECHANIC_DAZE = 27, + MECHANIC_DISCOVERY = 28, + MECHANIC_IMMUNE_SHIELD = 29, // Divine (Blessing) Shield/Protection and Ice Block + MECHANIC_SAPPED = 30, + + // Custom + MECHANIC_SLOW_CAST_SPEED = 31 // Curse of Tongues +}; + +#define FIRST_MECHANIC 1 +#define MAX_MECHANIC 31 + +#define IMMUNE_TO_ROOT_AND_SNARE_MASK ( \ + (1<<(MECHANIC_ROOT-1))|(1<<(MECHANIC_SNARE-1))) + +#define IMMUNE_TO_ROOT_AND_STUN_MASK ( \ + (1<<(MECHANIC_ROOT-1))|(1<<(MECHANIC_STUN-1))) + +#define CONFUSED_MECHANIC_MASK ( \ + (1<<(MECHANIC_DISORIENTED-1))|(1<<(MECHANIC_POLYMORPH-1))) + +// Daze and all croud control spells except polymorph are not removed +#define MECHANIC_NOT_REMOVED_BY_SHAPESHIFT ( \ + (1<<(MECHANIC_CHARM -1))|(1<<(MECHANIC_DISORIENTED-1))|(1<<(MECHANIC_FEAR -1))| \ + (1<<(MECHANIC_PACIFY-1))|(1<<(MECHANIC_STUN -1))|(1<<(MECHANIC_FREEZE-1))| \ + (1<<(MECHANIC_BANISH-1))|(1<<(MECHANIC_SHACKLE -1))|(1<<(MECHANIC_HORROR-1))| \ + (1<<(MECHANIC_TURN -1))|(1<<(MECHANIC_DAZE -1))|(1<<(MECHANIC_SAPPED-1))) + +// Spell dispell type +enum DispelType +{ + DISPEL_NONE = 0, + DISPEL_MAGIC = 1, + DISPEL_CURSE = 2, + DISPEL_DISEASE = 3, + DISPEL_POISON = 4, + DISPEL_STEALTH = 5, + DISPEL_INVISIBILITY = 6, + DISPEL_ALL = 7, + DISPEL_SPE_NPC_ONLY = 8, + DISPEL_ENRAGE = 9, + DISPEL_ZG_TICKET = 10 +}; + +#define DISPEL_ALL_MASK ( (1<(only this effect in the spell) can't cast to it, +// some aura(related to Mechanics or ImmuneToState) can't apply to it. +enum SpellImmunity +{ + IMMUNITY_EFFECT = 0, // enum SpellEffects + IMMUNITY_STATE = 1, // enum AuraType + IMMUNITY_SCHOOL = 2, // enum SpellSchoolMask + IMMUNITY_DAMAGE = 3, // enum SpellSchoolMask + IMMUNITY_DISPEL = 4, // enum DispelType + IMMUNITY_MECHANIC = 5 // enum Mechanics +}; + +#define MAX_SPELL_IMMUNITY 6 + +/** + * The different spell schools that are available, used in both damage calculation + * and spell casting to decide what should be affected, the SPELL_SCHOOL_NORMAL + * is the armor, others should be self explanatory. + * + * Note that these are the values to use for changing ie, the armor via a + * Modifier, and it is the Modifier::m_miscValue that should be set. + */ +enum SpellSchools +{ + SPELL_SCHOOL_NORMAL = 0, // Physical, Armor + SPELL_SCHOOL_HOLY = 1, + SPELL_SCHOOL_FIRE = 2, + SPELL_SCHOOL_NATURE = 3, + SPELL_SCHOOL_FROST = 4, + SPELL_SCHOOL_SHADOW = 5, + SPELL_SCHOOL_ARCANE = 6 +}; + +#define MAX_SPELL_SCHOOL 7 + +/** + * A bitmask of the available SpellSchools. Used for convenience + */ +enum SpellSchoolMask +{ + SPELL_SCHOOL_MASK_NONE = 0x00, // not exist + SPELL_SCHOOL_MASK_NORMAL = (1 << SPELL_SCHOOL_NORMAL), // PHYSICAL (Armor) + SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY ), + SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE ), + SPELL_SCHOOL_MASK_NATURE = (1 << SPELL_SCHOOL_NATURE), + SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST ), + SPELL_SCHOOL_MASK_SHADOW = (1 << SPELL_SCHOOL_SHADOW), + SPELL_SCHOOL_MASK_ARCANE = (1 << SPELL_SCHOOL_ARCANE), + + // unions + + // 124, not include normal and holy damage + SPELL_SCHOOL_MASK_SPELL = ( SPELL_SCHOOL_MASK_FIRE | + SPELL_SCHOOL_MASK_NATURE | SPELL_SCHOOL_MASK_FROST | + SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE ), + // 126 + SPELL_SCHOOL_MASK_MAGIC = ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL ), + + // 127 + SPELL_SCHOOL_MASK_ALL = ( SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC ) +}; + +#define SPELL_SCHOOL_MASK_MAGIC \ + ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_FIRE | SPELL_SCHOOL_MASK_NATURE | \ + SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW | \ + SPELL_SCHOOL_MASK_ARCANE ) + +// converts school value into schoolmask missing in 1.12 dbc +inline SpellSchoolMask GetSchoolMask(uint32 school) +{ + return SpellSchoolMask(1 << school); +} + +inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask) +{ + for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) + if(mask & (1 << i)) + return SpellSchools(i); + + return SPELL_SCHOOL_NORMAL; +} + +enum SpellVisualKit +{ + SPELL_VISUAL_KIT_FOOD = 406, + SPELL_VISUAL_KIT_DRINK = 438 +}; + + +// *********************************** +// Spell Attributes definitions +// *********************************** +enum SpellAttributes +{ + SPELL_ATTR_DONT_DISPLAY_SPELL_RESULT = 0x00000001, // 0 + SPELL_ATTR_RANGED = 0x00000002, // 1 All ranged abilites have this flag + SPELL_ATTR_ON_NEXT_SWING_1 = 0x00000004, // 2 on next swing + SPELL_ATTR_IS_REPLENISHMENT = 0x00000008, // 3 not set in 2.4.2 + SPELL_ATTR_IS_ABILITY = 0x00000010, // 4 client puts 'ability' instead of 'spell' in game strings for these spells + SPELL_ATTR_TRADESPELL = 0x00000020, // 5 trade spells, will be added by client to a sublist of profession spell + SPELL_ATTR_PASSIVE = 0x00000040, // 6 Passive spell + SPELL_ATTR_HIDDEN_CLIENTSIDE = 0x00000080, // 7 Spells with this attribute are not visible in spellbook or aura bar + SPELL_ATTR_HIDE_IN_COMBAT_LOG = 0x00000100, // 8 this attributes controls whether spell appears in combat logs + SPELL_ATTR_TARGET_MAINHAND_ITEM = 0x00000200, // 9 Client automatically selects item from mainhand slot as a cast target + SPELL_ATTR_ON_NEXT_SWING_2 = 0x00000400, // 10 on next swing 2 + SPELL_ATTR_UNK11 = 0x00000800, // 11 + SPELL_ATTR_DAYTIME_ONLY = 0x00001000, // 12 only useable at daytime, not set in 2.4.2 + SPELL_ATTR_NIGHT_ONLY = 0x00002000, // 13 only useable at night, not set in 2.4.2 + SPELL_ATTR_INDOORS_ONLY = 0x00004000, // 14 only useable indoors, not set in 2.4.2 + SPELL_ATTR_OUTDOORS_ONLY = 0x00008000, // 15 Only useable outdoors. + SPELL_ATTR_NOT_SHAPESHIFT = 0x00010000, // 16 Not while shapeshifted + SPELL_ATTR_ONLY_STEALTHED = 0x00020000, // 17 Must be in stealth + SPELL_ATTR_DONT_AFFECT_SHEATH_STATE = 0x00040000, // 18 client won't hide unit weapons in sheath on cast/channel + SPELL_ATTR_LEVEL_DAMAGE_CALCULATION = 0x00080000, // 19 spelldamage depends on caster level + SPELL_ATTR_STOP_ATTACK_TARGET = 0x00100000, // 20 Stop attack after use this spell (and not begin attack if use) + SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK = 0x00200000, // 21 Cannot be dodged/parried/blocked + SPELL_ATTR_SET_TRACKING_TARGET = 0x00400000, // 22 SetTrackingTarget + SPELL_ATTR_CASTABLE_WHILE_DEAD = 0x00800000, // 23 castable while dead? + SPELL_ATTR_CASTABLE_WHILE_MOUNTED = 0x01000000, // 24 castable while mounted + SPELL_ATTR_DISABLED_WHILE_ACTIVE = 0x02000000, // 25 Activate and start cooldown after aura fade or remove summoned creature or go + SPELL_ATTR_NEGATIVE = 0x04000000, // 26 Almost all negative spell have it + SPELL_ATTR_CASTABLE_WHILE_SITTING = 0x08000000, // 27 castable while sitting + SPELL_ATTR_CANT_USED_IN_COMBAT = 0x10000000, // 28 Cannot be used in combat + SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY = 0x20000000, // 29 unaffected by invulnerability (hmm possible not...) + SPELL_ATTR_DIMINISHING_RETURNS = 0x40000000, // 30 breakable by damage? + SPELL_ATTR_CANT_CANCEL = 0x80000000 // 31 positive aura can't be canceled +}; + +enum SpellAttributesEx +{ + SPELL_ATTR_EX_DISMISS_PET = 0x00000001, // 0 for spells without this flag client doesn't allow to summon pet if caster has a pet + SPELL_ATTR_EX_DRAIN_ALL_POWER = 0x00000002, // 1 use all power (Only paladin Lay of Hands and Bunyanize) + SPELL_ATTR_EX_CHANNELED_1 = 0x00000004, // 2 channeled 1 + SPELL_ATTR_EX_CANT_BE_REDIRECTED = 0x00000008, // 3 + SPELL_ATTR_EX_UNK4 = 0x00000010, // 4 + SPELL_ATTR_EX_NOT_BREAK_STEALTH = 0x00000020, // 5 Not break stealth + SPELL_ATTR_EX_CHANNELED_2 = 0x00000040, // 6 channeled 2 + SPELL_ATTR_EX_CANT_BE_REFLECTED = 0x00000080, // 7 + SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET = 0x00000100, // 8 Spell req target not to be in combat state + SPELL_ATTR_EX_MELEE_COMBAT_START = 0x00000200, // 9 player starts melee combat after this spell is cast + SPELL_ATTR_EX_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100% + SPELL_ATTR_EX_UNK11 = 0x00000800, // 11 + SPELL_ATTR_EX_IS_PICKPOCKET = 0x00001000, // 12 + SPELL_ATTR_EX_FARSIGHT = 0x00002000, // 13 + SPELL_ATTR_EX_CHANNEL_TRACK_TARGET = 0x00004000, // 14 Client automatically forces player to face target when channeling + SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity + SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // 16 unaffected by school immunity + SPELL_ATTR_EX_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 for auras SPELL_AURA_TRACK_CREATURES, SPELL_AURA_TRACK_RESOURCES and SPELL_AURA_TRACK_STEALTHED select non-stacking tracking spells + SPELL_ATTR_EX_UNK18 = 0x00040000, // 18 stun, polymorph, daze, sleep + SPELL_ATTR_EX_CANT_TARGET_SELF = 0x00080000, // 19 + SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS = 0x00100000, // 20 Req combo points on target + SPELL_ATTR_EX_UNK21 = 0x00200000, // 21 + SPELL_ATTR_EX_REQ_COMBO_POINTS = 0x00400000, // 22 Use combo points (in 4.x not required combo point target selected) + SPELL_ATTR_EX_UNK23 = 0x00800000, // 23 + SPELL_ATTR_EX_IS_FISHING = 0x01000000, // 24 only fishing spells + SPELL_ATTR_EX_UNK25 = 0x02000000, // 25 not set in 2.4.2 + SPELL_ATTR_EX_UNK26 = 0x04000000, // 26 + SPELL_ATTR_EX_REFUND_POWER = 0x08000000, // 27 All these spells refund power on parry or deflect + SPELL_ATTR_EX_DONT_DISPLAY_IN_AURA_BAR = 0x10000000, // 28 client doesn't display these spells in aura bar + SPELL_ATTR_EX_CHANNEL_DISPLAY_SPELL_NAME = 0x20000000, // 29 spell name is displayed in cast bar instead of 'channeling' text + SPELL_ATTR_EX_ENABLE_AT_DODGE = 0x40000000, // 30 Overpower + SPELL_ATTR_EX_UNK31 = 0x80000000 // 31 +}; + +enum SpellAttributesEx2 +{ + SPELL_ATTR_EX2_CAN_TARGET_DEAD = 0x00000001, // 0 can target dead unit or corpse + SPELL_ATTR_EX2_UNK1 = 0x00000002, // 1 + SPELL_ATTR_EX2_IGNORE_LOS = 0x00000004, // 2 ? used for detect can or not spell reflected // do not need LOS (e.g. 18220 since 3.3.3) + SPELL_ATTR_EX2_UNK3 = 0x00000008, // 3 auto targeting? (e.g. fishing skill enhancement items since 3.3.3) + SPELL_ATTR_EX2_DISPLAY_IN_STANCE_BAR = 0x00000010, // 4 client displays icon in stance bar when learned, even if not shapeshift + SPELL_ATTR_EX2_AUTOREPEAT_FLAG = 0x00000020, // 5 + SPELL_ATTR_EX2_CANT_TARGET_TAPPED = 0x00000040, // 6 target must be tapped by caster + SPELL_ATTR_EX2_UNK7 = 0x00000080, // 7 + SPELL_ATTR_EX2_UNK8 = 0x00000100, // 8 not set in 2.4.2 + SPELL_ATTR_EX2_UNK9 = 0x00000200, // 9 + SPELL_ATTR_EX2_UNK10 = 0x00000400, // 10 + SPELL_ATTR_EX2_HEALTH_FUNNEL = 0x00000800, // 11 + SPELL_ATTR_EX2_UNK12 = 0x00001000, // 12 + SPELL_ATTR_EX2_PRESERVE_ENCHANT_IN_ARENA = 0x00002000, // 13 Items enchanted by spells with this flag preserve the enchant to arenas + SPELL_ATTR_EX2_UNK14 = 0x00004000, // 14 + SPELL_ATTR_EX2_UNK15 = 0x00008000, // 15 not set in 2.4.2 + SPELL_ATTR_EX2_TAME_BEAST = 0x00010000, // 16 + SPELL_ATTR_EX2_NOT_RESET_AUTO_ACTIONS = 0x00020000, // 17 don't reset timers for melee autoattacks (swings) or ranged autoattacks (autoshoots) + SPELL_ATTR_EX2_REQ_DEAD_PET = 0x00040000, // 18 Only Revive pet + SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT = 0x00080000, // 19 does not necessary need shapeshift (pre-3.x not have passive spells with this attribute) + SPELL_ATTR_EX2_UNK20 = 0x00100000, // 20 + SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD = 0x00200000, // 21 for ice blocks, pala immunity buffs, priest absorb shields, but used also for other spells -> not sure! + SPELL_ATTR_EX2_UNK22 = 0x00400000, // 22 + SPELL_ATTR_EX2_IS_ARCANE_CONCENTRATION = 0x00800000, // 23 Only mage Arcane Concentration have this flag + SPELL_ATTR_EX2_UNK24 = 0x01000000, // 24 + SPELL_ATTR_EX2_UNK25 = 0x02000000, // 25 + SPELL_ATTR_EX2_UNK26 = 0x04000000, // 26 unaffected by school immunity + SPELL_ATTR_EX2_UNK27 = 0x08000000, // 27 + SPELL_ATTR_EX2_UNK28 = 0x10000000, // 28 no breaks stealth if it fails?? + SPELL_ATTR_EX2_CANT_CRIT = 0x20000000, // 29 Spell can't crit + SPELL_ATTR_EX2_TRIGGERED_CAN_TRIGGER_PROC = 0x40000000, // 30 + SPELL_ATTR_EX2_FOOD_BUFF = 0x80000000 // 31 Food or Drink Buff (like Well Fed) +}; + +enum SpellAttributesEx3 +{ + SPELL_ATTR_EX3_OUT_OF_COMBAT_ATTACK = 0x00000001, // 0 Spell landed counts as hostile action against enemy even if it doesn't trigger combat state, propagates PvP flags + SPELL_ATTR_EX3_UNK1 = 0x00000002, // 1 + SPELL_ATTR_EX3_UNK2 = 0x00000004, // 2 + SPELL_ATTR_EX3_BLOCKABLE_SPELL = 0x00000008, // 3 Only dmg class melee in 3.1.3 + SPELL_ATTR_EX3_IGNORE_RESURRECTION_TIMER = 0x00000010, // 4 you don't have to wait to be resurrected with these spells. Druid Rebirth only this spell have this flag + SPELL_ATTR_EX3_UNK5 = 0x00000020, // 5 + SPELL_ATTR_EX3_UNK6 = 0x00000040, // 6 + SPELL_ATTR_EX3_STACK_FOR_DIFF_CASTERS = 0x00000080, // 7 create a separate (de)buff stack for each caster + SPELL_ATTR_EX3_TARGET_ONLY_PLAYER = 0x00000100, // 8 can target only players + SPELL_ATTR_EX3_TRIGGERED_CAN_TRIGGER_PROC = 0x00000200, // 9 + SPELL_ATTR_EX3_MAIN_HAND = 0x00000400, // 10 Main hand weapon required + SPELL_ATTR_EX3_BATTLEGROUND = 0x00000800, // 11 Can casted only on battleground + SPELL_ATTR_EX3_CAST_ON_DEAD = 0x00001000, // 12 target is a dead player (not every spell has this flag) + SPELL_ATTR_EX3_DONT_DISPLAY_CHANNEL_BAR = 0x00002000, // 13 Clientside attribute - will not display channeling bar + SPELL_ATTR_EX3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag + SPELL_ATTR_EX3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag + SPELL_ATTR_EX3_CANT_TRIGGER_PROC = 0x00010000, // 16 confirmed with many patchnotes + SPELL_ATTR_EX3_NO_INITIAL_AGGRO = 0x00020000, // 17 Causes no aggro if not missed + SPELL_ATTR_EX3_CANT_MISS = 0x00040000, // 18 Spell should always hit its target + SPELL_ATTR_EX3_UNK19 = 0x00080000, // 19 during aura proc no spells can trigger (20178, 20375) + SPELL_ATTR_EX3_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells + SPELL_ATTR_EX3_UNK21 = 0x00200000, // 21 + SPELL_ATTR_EX3_REQ_WAND = 0x00400000, // 22 Req wand + SPELL_ATTR_EX3_UNK23 = 0x00800000, // 23 + SPELL_ATTR_EX3_REQ_OFFHAND = 0x01000000, // 24 Req offhand weapon + SPELL_ATTR_EX3_UNK25 = 0x02000000, // 25 no cause spell pushback ? + SPELL_ATTR_EX3_UNK26 = 0x04000000, // 26 + SPELL_ATTR_EX3_DRAIN_SOUL = 0x08000000, // 27 + SPELL_ATTR_EX3_UNK28 = 0x10000000, // 28 + SPELL_ATTR_EX3_UNK29 = 0x20000000, // 29 Probably ignore any damage modifiers (determined to be so in trinitycore as well) + SPELL_ATTR_EX3_DONT_DISPLAY_RANGE = 0x40000000, // 30 + SPELL_ATTR_EX3_UNK31 = 0x80000000 // 31 +}; + +enum SpellAttributesEx4 +{ + SPELL_ATTR_EX4_IGNORE_RESISTANCES = 0x00000001, // 0 From TC 3.3.5, but not present in 1.12 native DBCs. Add it with spell_mod to prevent a spell from being resisted. + SPELL_ATTR_EX4_UNK1 = 0x00000002, // 1 proc on finishing move? + SPELL_ATTR_EX4_REAL_TIME_DURATION = 0x00000004, // 2 aura continues to expire while player is offline + SPELL_ATTR_EX4_UNK3 = 0x00000008, // 3 + SPELL_ATTR_EX4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use?? + SPELL_ATTR_EX4_UNK5 = 0x00000020, // 5 + SPELL_ATTR_EX4_NOT_STEALABLE = 0x00000040, // 6 although such auras might be dispellable, they cannot be stolen + SPELL_ATTR_EX4_CAN_CAST_WHILE_CASTING = 0x00000080, // 7 In theory, can use this spell while another is channeled/cast/autocast + SPELL_ATTR_EX4_STACK_DOT_MODIFIER = 0x00000100, // 8 no effect on non DoTs? + SPELL_ATTR_EX4_TRIGGER_ACTIVATE = 0x00000200, // 9 initially disabled / trigger activate from event (Execute, Riposte, Deep Freeze end other) + SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST = 0x00000400, // 10 Rogue Shiv have this flag + SPELL_ATTR_EX4_UNK11 = 0x00000800, // 11 + SPELL_ATTR_EX4_UNK12 = 0x00001000, // 12 + SPELL_ATTR_EX4_UNK13 = 0x00002000, // 13 + SPELL_ATTR_EX4_DAMAGE_DOESNT_BREAK_AURAS = 0x00004000, // 14 + SPELL_ATTR_EX4_UNK15 = 0x00008000, // 15 +// SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA = 0x00010000, // 16 not usable in arena +// SPELL_ATTR_EX4_USABLE_IN_ARENA = 0x00020000, // 17 usable in arena + SPELL_ATTR_EX4_UNK18 = 0x00040000, // 18 + SPELL_ATTR_EX4_UNK19 = 0x00080000, // 19 + SPELL_ATTR_EX4_NOT_CHECK_SELFCAST_POWER = 0x00100000, // 20 do not give "more powerful spell" error message + SPELL_ATTR_EX4_UNK21 = 0x00200000, // 21 + SPELL_ATTR_EX4_UNK22 = 0x00400000, // 22 + SPELL_ATTR_EX4_UNK23 = 0x00800000, // 23 + SPELL_ATTR_EX4_UNK24 = 0x01000000, // 24 + SPELL_ATTR_EX4_IS_PET_SCALING = 0x02000000, // 25 pet scaling auras + SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND = 0x04000000, // 26 Can only be used in Outland. + SPELL_ATTR_EX4_UNK27 = 0x08000000, // 27 + SPELL_ATTR_EX4_UNK28 = 0x10000000, // 28 + SPELL_ATTR_EX4_UNK29 = 0x20000000, // 29 + SPELL_ATTR_EX4_UNK30 = 0x40000000, // 30 + SPELL_ATTR_EX4_UNK31 = 0x80000000, // 31 +}; + +// Custom flags assigned in the db +enum SpellAttributesCustom +{ + SPELL_CUSTOM_NONE = 0x000, + SPELL_CUSTOM_ALLOW_STACK_BETWEEN_CASTER = 0x001, // For example 'Siphon Soul' must be able to stack between the warlocks on a mob + SPELL_CUSTOM_NEGATIVE = 0x002, + SPELL_CUSTOM_POSITIVE = 0x004, + SPELL_CUSTOM_CHAN_NO_DIST_LIMIT = 0x008, + SPELL_CUSTOM_FIXED_DAMAGE = 0x010, // Not affected by damage/healing done bonus + SPELL_CUSTOM_IGNORE_ARMOR = 0x020, + SPELL_CUSTOM_BEHIND_TARGET = 0x040, // For spells that require the caster to be behind the target + SPELL_CUSTOM_FACE_TARGET = 0x080, // For spells that require the target to be in front of the caster + SPELL_CUSTOM_SINGLE_TARGET_AURA = 0x100, // Aura applied by spell can only be on 1 target at a time + SPELL_CUSTOM_AURA_APPLY_BREAKS_STEALTH = 0x200, // Stealth is removed when this aura is applied +}; + +// Custom flags assigned by the core based on spell template data +enum SpellAttributesInternal +{ + SPELL_INTERNAL_APPLIES_AURA = 0x001, + SPELL_INTERNAL_APPLIES_PERIODIC_AURA = 0x002, + SPELL_INTERNAL_PASSIVE_STACK_WITH_RANKS = 0x004, + SPELL_INTERNAL_POSITIVE = 0x008, + SPELL_INTERNAL_HEAL = 0x010, + SPELL_INTERNAL_DIRECT_DAMAGE = 0x020, + SPELL_INTERNAL_CASTER_SOURCE_TARGETS = 0x040, + SPELL_INTERNAL_AOE = 0x080, + SPELL_INTERNAL_AOE_AURA = 0x100, + SPELL_INTERNAL_DISMOUNT = 0x200, + SPELL_INTERNAL_CHARM = 0x400, + SPELL_INTERNAL_REFLECTABLE = 0x800, +}; + +// original names, do not edit +enum SpellCategories +{ + SPELLCATEGORY_DEFAULT = 1, + SPELLCATEGORY_DIRECT_DAMAGE_SPELL = 2, + SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_POTION = 4, + SPELLCATEGORY_ITEM_FOOD = 11, + SPELLCATEGORY_HEALING_SPELL = 12, + SPELLCATEGORY_QUICK_BUFF_RESIST_SPELL = 17, + SPELLCATEGORY_DAMAGE_OVER_TIME_SPELL = 18, + SPELLCATEGORY_QUICK_DAMAGE_SPELL = 19, + SPELLCATEGORY_INVULNERABILITY_OTHER = 20, + SPELLCATEGORY_QUICK_BUFF_SPELL = 21, + SPELLCATEGORY_QUICK_DEBUFF_SPELL = 22, + SPELLCATEGORY_SUMMONING = 23, + SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_AGGRESSIVE = 24, + SPELLCATEGORY_QUICK_HEAL_SPELL = 25, + SPELLCATEGORY_RESURRECTION_FULL = 26, + SPELLCATEGORY_ITEM_SCROLL = 27, + SPELLCATEGORY_ITEM_QUICK_BUFF = 28, + SPELLCATEGORY_ITEM_DEBUFF = 29, + SPELLCATEGORY_ITEM_HEALING = 30, + SPELLCATEGORY_CONJURE_SHORT = 31, + SPELLCATEGORY_STUN = 32, + SPELLCATEGORY_MEZ = 33, + SPELLCATEGORY_ROOT = 34, + SPELLCATEGORY_DIRECT_DAMAGE_AE_SPELL = 35, + SPELLCATEGORY_DEBUFF_SPELL = 36, + SPELLCATEGORY_INVULNERABILITY = 37, + SPELLCATEGORY_AURA = 38, + SPELLCATEGORY_SHAPESHIFT = 39, + SPELLCATEGORY_MELEE_GENERIC = 40, + SPELLCATEGORY_CRITICAL = 41, + SPELLCATEGORY_SNARE = 42, + SPELLCATEGORY_SHOUT = 43, + SPELLCATEGORY_SPEED = 44, + SPELLCATEGORY_TOTEM_STONECLAW = 45, + SPELLCATEGORY_HEALING_GROUP_SPELL = 46, + SPELLCATEGORY_COMBAT_STATES = 47, + SPELLCATEGORY_DIRECT_DAMAGE_AE_ABILITY = 49, + SPELLCATEGORY_DIRECT_DAMAGE_AECONE_ABILITY = 50, + SPELLCATEGORY_QUICK_DEBUFF_DPS_SPELL = 51, + SPELLCATEGORY_QUICK_DEBUFF_DR_SPELL = 52, + SPELLCATEGORY_QUICK_BUFF_DR_SPELL = 54, + SPELLCATEGORY_QUICK_BUFF_DPS_SPELL = 55, + SPELLCATEGORY_INSTANT_HEAL_SPELL = 56, + SPELLCATEGORY_QUICK_HEAL_GROUP_SPELL = 57, + SPELLCATEGORY_INSTANT_HEAL_GROUP_SPELL = 58, + SPELLCATEGORY_ITEM_DRINK = 59, + SPELLCATEGORY_INVULNERABILITY_TEMP = 60, + SPELLCATEGORY_ENERGIZE_GROUP_SPELL = 61, + SPELLCATEGORY_ENERGIZE_SPELL = 62, + SPELLCATEGORY_BIG_DIRECT_DAMAGE_SPELL = 63, + SPELLCATEGORY_MINIMAP_SPECIAL = 64, + SPELLCATEGORY_MELEE_SPECIAL = 65, + SPELLCATEGORY_DODGE_MANEUVER = 66, + SPELLCATEGORY_BLOCK_MANEUVER = 67, + SPELLCATEGORY_PARRY_MANEUVER = 68, + SPELLCATEGORY_DIRECT_DAMAGE_AEPERSISTENT_SPELL = 72, + SPELLCATEGORY_MARTIAL_ARTS_GENERIC = 73, + SPELLCATEGORY_MARTIAL_ARTS_SPECIAL = 74, + SPELLCATEGORY_DETECT = 75, + SPELLCATEGORY_SHOOT_THROW = 76, + SPELLCATEGORY_TRADE_HERBALISM = 77, + SPELLCATEGORY_TRADE_MINING = 78, + SPELLCATEGORY_ITEM_POTION_NONCOMBAT = 79, + SPELLCATEGORY_TAUNT_DETAUNT = 82, + SPELLCATEGORY_TAMING = 83, + SPELLCATEGORY_TAUNT_AE = 84, + SPELLCATEGORY_DIRECT_DAMAGE_AECHAIN_ABILITY = 85, + SPELLCATEGORY_PET = 86, + SPELLCATEGORY_CONJURE_LONG = 87, + SPELLCATEGORY_SILENCE = 88, + SPELLCATEGORY_PORTAL = 89, + SPELLCATEGORY_CHARM = 93, + SPELLCATEGORY_ITEM_SUMMONING = 94, + SPELLCATEGORY_RACIAL_ABILITY = 95, + SPELLCATEGORY_RACIAL_ABILITY_2 = 96, + SPELLCATEGORY_SECONDARY_SURVIVAL = 97, + SPELLCATEGORY_BIG_DIRECT_DAMAGE_SPELL_2 = 98, + SPELLCATEGORY_INSTANT_SPELL = 99, + SPELLCATEGORY_ITEM_MANA_GEM = 100, + SPELLCATEGORY_FELHUNTER = 101, + SPELLCATEGORY_ITEM_LONG_BUFF = 102, + SPELLCATEGORY_ITEM_EPIC = 103, + SPELLCATEGORY_TOTEM_HEALING = 104, + SPELLCATEGORY_TOTEM_SERPENT = 105, + SPELLCATEGORY_TOTEM_SLOWING = 106, + SPELLCATEGORY_TOTEM_MANA = 107, + SPELLCATEGORY_TOTEM_INVISIBILITY = 108, + SPELLCATEGORY_MELEE_DISARM = 109, + SPELLCATEGORY_DISCIPLINE = 132, + SPELLCATEGORY_GLOBAL = 133, + SPELLCATEGORY_ITEM_BANDAGE = 150, + SPELLCATEGORY_FINISHING_MOVE_WEAPONSCALED = 170, + SPELLCATEGORY_BANISH = 190, + SPELLCATEGORY_TOTEM_GROUNDING = 230, + SPELLCATEGORY_BLAST_WAVE = 250, + SPELLCATEGORY_KIDNEY_SHOT = 270, + SPELLCATEGORY_PYROBLAST_REUSE = 290, + SPELLCATEGORY_TRANSMUTE_ALCHEMY = 310, + SPELLCATEGORY_MOUNT = 330, + SPELLCATEGORY_INNER_RAGE = 350, + SPELLCATEGORY_RANGED_WEAPON = 351, + SPELLCATEGORY_LIGHTNING_SHIELD = 371, + SPELLCATEGORY_QUEST_FELCURSE = 391, + SPELLCATEGORY_TRAP = 411, + SPELLCATEGORY_HOLY_NOVA = 431, + SPELLCATEGORY_HOLY_FIRE = 451, + SPELLCATEGORY_ICE_BARRIER = 471, + SPELLCATEGORY_ASTRAL_RECALL = 511, + SPELLCATEGORY_NATURES_GRASP = 531, + SPELLCATEGORY_AURA_OF_THE_PIOUS = 551, + SPELLCATEGORY_HURRICANE = 571, + SPELLCATEGORY_TOTEM_MANA_TIDE = 591, + SPELLCATEGORY_WINGS_OF_HOPE = 611, + SPELLCATEGORY_SOUL_FIRE = 631, + SPELLCATEGORY_DEATH_COIL = 633, + SPELLCATEGORY_HOWL_OF_TERROR = 634, + SPELLCATEGORY_SHADOWBURN = 651, + SPELLCATEGORY_DESPERATE_PRAYER = 671, + SPELLCATEGORY_CONFLAGRATE = 672, + SPELLCATEGORY_DEVOURING_PLAGUE = 691, + SPELLCATEGORY_SUMMON_INFERNAL = 731, + SPELLCATEGORY_TREE_FORM = 751, + SPELLCATEGORY_ITEM_SALT_SHAKER = 791, + SPELLCATEGORY_DIVINE_INTERVENTION = 811, + SPELLCATEGORY_SOULSTONE = 831, + SPELLCATEGORY_RESTORATION = 851, + SPELLCATEGORY_SHADOWMELD = 871, + SPELLCATEGORY_INTERCEPT = 872, + SPELLCATEGORY_WHIRLWIND = 891, + SPELLCATEGORY_HOLY_SHOCK = 892, + SPELLCATEGORY_DISTRACTING_SHOT = 911, + SPELLCATEGORY_HOLY_SHIELD = 931, + SPELLCATEGORY_CONSECRATION = 932, + SPELLCATEGORY_PVP_BATTLEFIELD_ITEM_LONG_30_MINS = 951, + SPELLCATEGORY_MORTAL_STRIKE = 971, + SPELLCATEGORY_ITEM_SNOWMASTER = 991, + SPELLCATEGORY_FRENZIED_HEALING = 1011, + SPELLCATEGORY_ITEM_HALF_HOUR = 1031, + SPELLCATEGORY_ITEM_JUMPER_CABLES = 1051, + SPELLCATEGORY_ITEM_HATCH_JUBLING = 1071, + SPELLCATEGORY_BATTLEGROUNDS_RECALL = 1091, + SPELLCATEGORY_WYVERN_STING = 1111, + SPELLCATEGORY_HAMMER_OF_VENGEANCE = 1131, + SPELLCATEGORY_INTIMIDATION = 1132, + SPELLCATEGORY_FAERIE_FIRE_FERAL = 1133, + SPELLCATEGORY_RIPOSTE = 1134, + SPELLCATEGORY_COUNTERATTACK = 1135, + SPELLCATEGORY_HOLIDAY_FIREWORK_ROCKETS = 1136, + SPELLCATEGORY_HOLIDAY_FIRECRACKER = 1137, + SPELLCATEGORY_RC_WEAPONS = 1138, + SPELLCATEGORY_ITEM_QUEST_10_MINUTES = 1139, + SPELLCATEGORY_ITEM_QUEST_1_MIN = 1140, + SPELLCATEGORY_ITEM_BURST_TRINKET = 1141, + SPELLCATEGORY_HOLIDAY_VALENTINE_PERFUME_COLOGNE = 1142, + SPELLCATEGORY_ITEM_TARGET_DUMMY = 1143, + SPELLCATEGORY_PRIEST_RACIAL = 1144, + SPELLCATEGORY_LIGHTWELL = 1145, + SPELLCATEGORY_QUEST_1_HOUR = 1149, + SPELLCATEGORY_SHADOWTHUNDERSTRIKE = 1150, + SPELLCATEGORY_TALENT_DPS = 1151, + SPELLCATEGORY_CREATURE_SPECIAL = 1152, + SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_NONAGGRESSIVE = 1153, + SPELLCATEGORY_ARATHI_BASIN_TRINKET = 1155, + SPELLCATEGORY_CREATURE_SPECIAL_2 = 1159, + SPELLCATEGORY_ITEM_PRIEST_EPIC_STAFF = 1160, + SPELLCATEGORY_REINCARNATION = 1161 +}; + +// Spell clasification +enum SpellSpecific +{ + SPELL_NORMAL = 0, + SPELL_SEAL = 1, + SPELL_BLESSING = 2, + SPELL_AURA = 3, + SPELL_STING = 4, + SPELL_CURSE = 5, + SPELL_ASPECT = 6, + SPELL_TRACKER = 7, + SPELL_WARLOCK_ARMOR = 8, + SPELL_MAGE_ARMOR = 9, + SPELL_ELEMENTAL_SHIELD = 10, + SPELL_MAGE_POLYMORPH = 11, + SPELL_POSITIVE_SHOUT = 12, + SPELL_JUDGEMENT = 13, + SPELL_BATTLE_ELIXIR = 14, + SPELL_GUARDIAN_ELIXIR = 15, + SPELL_FLASK_ELIXIR = 16, + //SPELL_PRESENCE = 17, // used in 3.x + //SPELL_HAND = 18, // used in 3.x + SPELL_WELL_FED = 19, + SPELL_FOOD = 20, + SPELL_DRINK = 21, + SPELL_FOOD_AND_DRINK = 22, + SPELL_NEGATIVE_HASTE = 23, + SPELL_SNARE = 24, +}; + +#endif diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 3f82ffaa9..52897c3ca 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -29,7 +29,6 @@ #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" -#include "Unit.h" #include "Spell.h" #include "DynamicObject.h" #include "SpellAuras.h" @@ -213,7 +212,7 @@ void Spell::EffectUnused(SpellEffectIndex /*eff_idx*/) void Spell::EffectResurrectNew(SpellEffectIndex eff_idx) { - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (!unitTarget->IsInWorld()) @@ -234,7 +233,7 @@ void Spell::EffectResurrectNew(SpellEffectIndex eff_idx) 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_STAT_ALL_DYN_STATES); pet->SetHealth(pet->GetMaxHealth() > health ? health : pet->GetMaxHealth()); pet->AIM_Initialize(); @@ -272,7 +271,7 @@ void Spell::EffectResurrectNew(SpellEffectIndex eff_idx) void Spell::EffectInstaKill(SpellEffectIndex /*eff_idx*/) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; // Demonic Sacrifice @@ -317,7 +316,7 @@ void Spell::EffectInstaKill(SpellEffectIndex /*eff_idx*/) void Spell::EffectEnvironmentalDMG(SpellEffectIndex eff_idx) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() == TYPEID_PLAYER) @@ -334,7 +333,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffectIndex eff_idx) void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { - if (unitTarget && unitTarget->isAlive()) + if (unitTarget && unitTarget->IsAlive()) { switch (m_spellInfo->SpellFamilyName) { @@ -522,7 +521,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_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED)) damage = int32(damage * 0.5f); damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE); @@ -567,7 +566,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 11889: // Capture Mountain Giant case 12699: // Summon Screecher Spirit { - if (unitTarget->isDead() && unitTarget->GetTypeId() == TYPEID_UNIT) + if (unitTarget->IsDead() && unitTarget->GetTypeId() == TYPEID_UNIT) ((Creature*)unitTarget)->ForcedDespawn(1000); return; } @@ -602,7 +601,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case 27798: // Nature's Bounty { - switch(unitTarget->getPowerType()) + switch(unitTarget->GetPowerType()) { case POWER_RAGE : unitTarget->CastSpell(unitTarget, 27783, true); @@ -819,7 +818,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!unitTarget) return; - uint32 spell_id = (unitTarget->getGender() == GENDER_MALE) ? 10651 : 10653; + uint32 spell_id = (unitTarget->GetGender() == GENDER_MALE) ? 10651 : 10653; m_caster->CastSpell(unitTarget, spell_id, true); return; @@ -869,8 +868,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) uint32 spell_id = 0; uint32 spells[6] = { - (pPlayer->getGender() == GENDER_MALE ? 8219u : 8220u), // Flip Out - ninja - (pPlayer->getGender() == GENDER_MALE ? 8221u : 8222u), // Yaaarrrr - pirate + (pPlayer->GetGender() == GENDER_MALE ? 8219u : 8220u), // Flip Out - ninja + (pPlayer->GetGender() == GENDER_MALE ? 8221u : 8222u), // Yaaarrrr - pirate 8223u, // Oops - goo 8215u, // Rapid Cast 8224u, // Cowardice @@ -899,7 +898,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!unitTarget || !m_casterUnit) return; - m_casterUnit->getThreatManager().modifyThreatPercent(unitTarget, -100); + m_casterUnit->GetThreatManager().modifyThreatPercent(unitTarget, -100); return; } case 9976: // Polly Eats the E.C.A.C. @@ -923,7 +922,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) float damage; // DW should benefit of attack power, damage percent mods etc. // TODO: check if using offhand damage is correct and if it should be divided by 2 - if (m_casterUnit->haveOffhandWeapon() && m_casterUnit->getAttackTimer(BASE_ATTACK) > m_casterUnit->getAttackTimer(OFF_ATTACK)) + if (m_casterUnit->HaveOffhandWeapon() && m_casterUnit->GetAttackTimer(BASE_ATTACK) > m_casterUnit->GetAttackTimer(OFF_ATTACK)) damage = (m_casterUnit->GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE) + m_casterUnit->GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)) / 2; else damage = (m_casterUnit->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_casterUnit->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; @@ -1142,7 +1141,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) float distance = m_originalCaster->GetDistance(unitTarget); distance = 1.0 - (distance / 25.0f); - if (unitTarget->isAlive()) + if (unitTarget->IsAlive()) { if (unitTarget->IsPlayer()) { @@ -1190,8 +1189,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { // Spell used by Azuregos to teleport all the players to him // This also resets the target threat - if (m_casterUnit->getThreatManager().getThreat(unitTarget)) - m_casterUnit->getThreatManager().modifyThreatPercent(unitTarget, -100); + if (m_casterUnit->GetThreatManager().getThreat(unitTarget)) + m_casterUnit->GetThreatManager().modifyThreatPercent(unitTarget, -100); // cast summon player m_casterUnit->CastSpell(unitTarget, 21150, true); @@ -1201,7 +1200,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case 23019: // Crystal Prison Dummy DND { - if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->IsPet()) + if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->IsPet()) return; Creature* creatureTarget = (Creature*)unitTarget; @@ -1224,7 +1223,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) pGameObj->SetRespawnTime(creatureTarget->GetRespawnTime() - time(nullptr)); pGameObj->SetOwnerGuid(m_caster->GetObjectGuid()); //Pose un soucis(Maxinus) - // pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); + // pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel()); pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetWorldMask(m_caster->GetWorldMask()); @@ -1425,7 +1424,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) //m_casterUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FEING_DEATH); m_casterUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_casterUnit->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - m_casterUnit->addUnitState(UNIT_STAT_DIED); + m_casterUnit->AddUnitState(UNIT_STAT_DIED); // Summon globs m_casterUnit->CastSpell(m_casterUnit, 25885, true); @@ -1437,7 +1436,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!m_casterUnit) return; - if (!m_casterUnit->isAlive()) + if (!m_casterUnit->IsAlive()) return; m_casterUnit->CastSpell(m_casterUnit, 26002, true); @@ -1458,7 +1457,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case 26626: // Mana Burn Area { - if (unitTarget->getPowerType() != POWER_MANA) + if (unitTarget->GetPowerType() != POWER_MANA) return; m_caster->CastSpell(unitTarget, 25779, true); @@ -1481,7 +1480,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (unitTarget->GetTypeId() != TYPEID_UNIT) return; - if (m_casterUnit->getVictim() && !m_casterUnit->IsWithinDistInMap(unitTarget, 60.0f)) + if (m_casterUnit->GetVictim() && !m_casterUnit->IsWithinDistInMap(unitTarget, 60.0f)) { // Cast Shock on nearby targets if (Unit* pTarget = ((Creature*)m_casterUnit)->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) @@ -1828,7 +1827,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 29201: // Loatheb Corrupted Mind triggered sub spells { uint32 spellid = 0; - switch (unitTarget->getClass()) + switch (unitTarget->GetClass()) { // priests should be getting 29185, but it triggers on dmg effects as well, don't know why. // stealing druid version for priests until anyone has a reason priests cant smite.s @@ -2293,11 +2292,11 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx) return; // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - if ((!unitTarget->isAlive() && !(m_spellInfo->IsDeathOnlySpell() || m_spellInfo->IsDeathPersistentSpell())) && + if ((!unitTarget->IsAlive() && !(m_spellInfo->IsDeathOnlySpell() || m_spellInfo->IsDeathPersistentSpell())) && (unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading())) return; - if (unitTarget->HasMorePowerfullSpellActive(m_spellInfo)) + if (unitTarget->HasMorePowerfulSpellActive(m_spellInfo)) return; Unit* caster = GetAffectiveCaster(); @@ -2321,7 +2320,7 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx) // for now we use linear level scaling, but this is likely incorrect (hp pools don't scale exactly linearly) // there is some speculation that this should be tied to Engineering skill level, but since you don't need Engineering to use the item at all this seems doubtful else if (m_spellInfo->Id == 13278) - m_currentBasePoints[eff_idx] = eff_idx == EFFECT_INDEX_0 ? int32(urand(600, 1200) * (caster->getLevel() / 60.0f)) * (!urand(0,6) ? 2 : 1) + m_currentBasePoints[eff_idx] = eff_idx == EFFECT_INDEX_0 ? int32(urand(600, 1200) * (caster->GetLevel() / 60.0f)) * (!urand(0,6) ? 2 : 1) : m_currentBasePoints[EFFECT_INDEX_0] * 0.1249f; // Paladin T3 JoL else if (m_spellInfo->IsFitToFamilyMask() && m_spellInfo->SpellIconID == 299 && m_casterUnit && m_casterUnit->HasAura(28775)) @@ -2340,9 +2339,9 @@ void Spell::EffectPowerDrain(SpellEffectIndex eff_idx) if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; - if (unitTarget->getPowerType() != drain_power) + if (unitTarget->GetPowerType() != drain_power) return; if (damage < 0) return; @@ -2413,9 +2412,9 @@ void Spell::EffectPowerBurn(SpellEffectIndex eff_idx) if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; - if (unitTarget->getPowerType() != powertype) + if (unitTarget->GetPowerType() != powertype) return; if (damage < 0) return; @@ -2439,7 +2438,7 @@ void Spell::EffectPowerBurn(SpellEffectIndex eff_idx) void Spell::EffectHeal(SpellEffectIndex eff_idx) { - if (unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->IsAlive() && damage >= 0) { // Try to get original caster WorldObject *caster = GetAffectiveCasterObject(); @@ -2514,7 +2513,7 @@ void Spell::EffectHeal(SpellEffectIndex eff_idx) void Spell::EffectHealMechanical(SpellEffectIndex /*eff_idx*/) { // Mechanic creature type should be correctly checked by targetCreatureType field - if (unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->IsAlive() && damage >= 0) { // Try to get original caster WorldObject *caster = GetAffectiveCasterObject(); @@ -2530,7 +2529,7 @@ void Spell::EffectHealMechanical(SpellEffectIndex /*eff_idx*/) void Spell::EffectHealthLeech(SpellEffectIndex effIndex) { - if (!unitTarget || !unitTarget->isAlive() || damage < 0) + if (!unitTarget || !unitTarget->IsAlive() || damage < 0) return; int32 initialDamage = damage; @@ -2551,7 +2550,7 @@ void Spell::EffectHealthLeech(SpellEffectIndex effIndex) if (damage > static_cast(unitTarget->GetHealth())) damage = unitTarget->GetHealth(); - if (m_casterUnit && m_casterUnit->isAlive()) + if (m_casterUnit && m_casterUnit->IsAlive()) m_casterUnit->DealHeal(m_casterUnit, uint32(damage * healMultiplier), m_spellInfo); // Non delayed spells bonus damage is added later @@ -2707,7 +2706,7 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (m_spellInfo->EffectMiscValue[eff_idx] < 0 || m_spellInfo->EffectMiscValue[eff_idx] >= MAX_POWERS) @@ -2999,7 +2998,7 @@ void Spell::EffectApplyAreaAura(SpellEffectIndex eff_idx) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; AreaAura* Aur = new AreaAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], m_spellAuraHolder, unitTarget, m_casterUnit ? m_casterUnit : unitTarget, m_CastItem); @@ -3028,7 +3027,7 @@ void Spell::EffectSummon(SpellEffectIndex eff_idx) return; } - uint32 level = m_casterUnit->getLevel(); + uint32 level = m_casterUnit->GetLevel(); Pet* spawnCreature = new Pet(SUMMON_PET); if (m_casterUnit->GetTypeId() == TYPEID_PLAYER && spawnCreature->LoadPetFromDB((Player*)m_casterUnit, pet_entry)) @@ -3068,7 +3067,7 @@ void Spell::EffectSummon(SpellEffectIndex eff_idx) spawnCreature->SetOwnerGuid(m_casterUnit->GetObjectGuid()); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); spawnCreature->SetInitCreaturePowerType(); - spawnCreature->setFaction(m_casterUnit->getFaction()); + spawnCreature->SetFactionTemplateId(m_casterUnit->GetFactionTemplateId()); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); @@ -3320,15 +3319,15 @@ void Spell::EffectPull(SpellEffectIndex /*eff_idx*/) void Spell::EffectDistract(SpellEffectIndex eff_idx) { // Check for possible target - if (!unitTarget || unitTarget->isInCombat()) + if (!unitTarget || unitTarget->IsInCombat()) return; // target must be OK to do this - if (unitTarget->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (unitTarget->HasUnitState(UNIT_STAT_CAN_NOT_REACT)) return; unitTarget->SetFacingTo(unitTarget->GetAngle(m_targets.m_destX, m_targets.m_destY)); - unitTarget->clearUnitState(UNIT_STAT_MOVING); + unitTarget->ClearUnitState(UNIT_STAT_MOVING); if (unitTarget->GetTypeId() == TYPEID_UNIT) unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); @@ -3346,7 +3345,7 @@ void Spell::EffectPickPocket(SpellEffectIndex /*eff_idx*/) return; // victim have to be alive and humanoid or undead - if (unitTarget->isAlive() && (unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0) + if (unitTarget->IsAlive() && (unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0) ((Player*)m_caster)->SendLoot(unitTarget->GetObjectGuid(), LOOT_PICKPOCKETING); } @@ -3378,7 +3377,7 @@ void Spell::EffectSummonWild(SpellEffectIndex eff_idx) if (!creature_entry) return; - uint32 level = m_caster->getLevel(); + uint32 level = m_caster->GetLevel(); // level of creature summoned using engineering item based at engineering skill level if (m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem) @@ -3456,7 +3455,7 @@ void Spell::EffectSummonWild(SpellEffectIndex eff_idx) case 4071: case 4072: case 19805: - summon->SetFactionTemporary(m_caster->getFaction(), TEMPFACTION_NONE); + summon->SetFactionTemporary(m_caster->GetFactionTemplateId(), TEMPFACTION_NONE); summon->lootForCreator = true; summon->SetCreatorGuid(m_caster->GetObjectGuid()); if (m_casterUnit) @@ -3466,7 +3465,7 @@ void Spell::EffectSummonWild(SpellEffectIndex eff_idx) case 16381: if (m_casterUnit) { - if (Unit* pTarget = m_casterUnit->getAttackerForHelper()) + if (Unit* pTarget = m_casterUnit->GetAttackerForHelper()) summon->AI()->AttackStart(pTarget); } break; @@ -3549,7 +3548,7 @@ void Spell::EffectSummonGuardian(SpellEffectIndex eff_idx) return; // in another case summon new - uint32 level = m_casterUnit->getLevel(); + uint32 level = m_casterUnit->GetLevel(); // Summoned by unit: use creature level but cap at owner level if (m_casterUnit->GetTypeId() == TYPEID_UNIT) @@ -3585,7 +3584,7 @@ void Spell::EffectSummonGuardian(SpellEffectIndex eff_idx) } // Eye of Kilrog if (m_spellInfo->Effect[eff_idx] == SPELL_EFFECT_SUMMON_POSSESSED) - level = m_casterUnit->getLevel(); + level = m_casterUnit->GetLevel(); } // select center of summon position @@ -3637,7 +3636,7 @@ void Spell::EffectSummonGuardian(SpellEffectIndex eff_idx) spawnCreature->SetOwnerGuid(m_casterUnit->GetObjectGuid()); spawnCreature->SetInitCreaturePowerType(); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, spawnCreature->GetCreatureInfo()->npc_flags); - spawnCreature->setFaction(m_casterUnit->getFaction()); + spawnCreature->SetFactionTemplateId(m_casterUnit->GetFactionTemplateId()); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); spawnCreature->SetCreatorGuid(m_casterUnit->GetObjectGuid()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); @@ -3919,13 +3918,13 @@ void Spell::EffectTameCreature(SpellEffectIndex /*eff_idx*/) pet->SetOwnerGuid(plr->GetObjectGuid()); pet->SetCreatorGuid(plr->GetObjectGuid()); - pet->setFaction(plr->getFaction()); + pet->SetFactionTemplateId(plr->GetFactionTemplateId()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); if (plr->IsPvP()) pet->SetPvP(true); - if (!pet->InitStatsForLevel(creatureTarget->getLevel())) + if (!pet->InitStatsForLevel(creatureTarget->GetLevel())) { sLog.outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", creatureTarget->GetEntry()); delete pet; @@ -3942,7 +3941,7 @@ void Spell::EffectTameCreature(SpellEffectIndex /*eff_idx*/) creatureTarget->ForcedDespawn(); // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel() - 1); + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->GetLevel() - 1); // Apply default loyalty at summon LoyaltyLevel defaultLoyalty = LoyaltyLevel(sWorld.getConfig(CONFIG_UINT32_PET_DEFAULT_LOYALTY)); @@ -3953,7 +3952,7 @@ void Spell::EffectTameCreature(SpellEffectIndex /*eff_idx*/) pet->GetMap()->Add((Creature*)pet); // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()); + pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->GetLevel()); // caster have pet now plr->SetPet(pet); @@ -3967,7 +3966,7 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) if (!m_casterUnit) return; - uint32 petLevel = m_casterUnit->IsPlayer() ? m_casterUnit->getLevel() : std::max(int32(m_casterUnit->getLevel()) + int32(m_spellInfo->EffectMultipleValue[eff_idx]), 1); + uint32 petLevel = m_casterUnit->IsPlayer() ? m_casterUnit->GetLevel() : std::max(int32(m_casterUnit->GetLevel()) + int32(m_spellInfo->EffectMultipleValue[eff_idx]), 1); ObjectGuid petGuid = m_casterUnit->EffectSummonPet(m_spellInfo->Id, m_spellInfo->EffectMiscValue[eff_idx], petLevel); if (petGuid) @@ -4032,7 +4031,7 @@ ObjectGuid Unit::EffectSummonPet(uint32 spellId, uint32 petEntry, uint32 petLeve NewSummon->setPetType(SUMMON_PET); - uint32 faction = getFaction(); + uint32 faction = GetFactionTemplateId(); if (GetTypeId() == TYPEID_UNIT) NewSummon->SetReactState(REACT_AGGRESSIVE); else @@ -4041,7 +4040,7 @@ ObjectGuid Unit::EffectSummonPet(uint32 spellId, uint32 petEntry, uint32 petLeve NewSummon->SetOwnerGuid(GetObjectGuid()); NewSummon->SetCreatorGuid(GetObjectGuid()); NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - NewSummon->setFaction(faction); + NewSummon->SetFactionTemplateId(faction); NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); @@ -4111,7 +4110,7 @@ void Spell::EffectLearnPetSpell(SpellEffectIndex eff_idx) Pet *pet = _player->GetPet(); if (!pet) return; - if (!pet->isAlive()) + if (!pet->IsAlive()) return; SpellEntry const *learn_spellproto = sSpellMgr.GetSpellEntry(m_spellInfo->EffectTriggerSpell[eff_idx]); @@ -4137,7 +4136,7 @@ void Spell::EffectTaunt(SpellEffectIndex eff_idx) // for spell as marked "non effective at already attacking target" if (unitTarget->GetTypeId() != TYPEID_PLAYER) { - if (unitTarget->getVictim() == m_caster) + if (unitTarget->GetVictim() == m_caster) { SendCastResult(SPELL_FAILED_DONT_REPORT); return; @@ -4145,9 +4144,9 @@ void Spell::EffectTaunt(SpellEffectIndex eff_idx) } // Also use this effect to set the taunter's threat to the taunted creature's highest value - if (unitTarget->CanHaveThreatList() && unitTarget->getThreatManager().getCurrentVictim()) + if (unitTarget->CanHaveThreatList() && unitTarget->GetThreatManager().getCurrentVictim()) { - unitTarget->getThreatManager().addThreat(m_casterUnit, unitTarget->getThreatManager().getCurrentVictim()->getThreat()); + unitTarget->GetThreatManager().addThreat(m_casterUnit, unitTarget->GetThreatManager().getCurrentVictim()->getThreat()); // Patch 1.11 notes // https://web.archive.org/web/20061109034626/http://evilempireguild.org:80/guides/kenco2.php @@ -4161,7 +4160,7 @@ void Spell::EffectTaunt(SpellEffectIndex eff_idx) // Of course if other people are generating significant threat on the mob, they could exceed your threat by more than 10 % before the taunt debuff wears off, // and will gain aggro as soon as it does.There is no limit to the amount of threat you can gain from Taunt. #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2 - unitTarget->getThreatManager().setCurrentVictimIfCan(m_casterUnit); + unitTarget->GetThreatManager().setCurrentVictimIfCan(m_casterUnit); #endif } @@ -4174,12 +4173,12 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) return; if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; if (m_spellInfo->Id == 17364) // Courroux naturel { - if (!m_casterUnit->isAlive()) // CalculateMeleeDamage does not work in that case. + if (!m_casterUnit->IsAlive()) // CalculateMeleeDamage does not work in that case. return; m_casterUnit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MELEE_ATTACK); if (Spell* spell = m_casterUnit->GetCurrentSpell(CURRENT_MELEE_SPELL)) @@ -4314,7 +4313,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) void Spell::EffectThreat(SpellEffectIndex eff_idx) { - if (!unitTarget || !unitTarget->isAlive() || !m_casterUnit || !m_casterUnit->isAlive()) + if (!unitTarget || !unitTarget->IsAlive() || !m_casterUnit || !m_casterUnit->IsAlive()) return; if (!unitTarget->CanHaveThreatList()) @@ -4329,7 +4328,7 @@ void Spell::EffectHealMaxHealth(SpellEffectIndex eff_idx) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; uint32 heal = m_casterUnit ? m_casterUnit->GetMaxHealth() : unitTarget->GetMaxHealth(); @@ -4373,7 +4372,7 @@ void Spell::EffectInterruptCast(SpellEffectIndex eff_idx) { if (!unitTarget) return; - if (!unitTarget->isAlive()) + if (!unitTarget->IsAlive()) return; // TODO: not all spells that used this effect apply cooldown at school spells @@ -4573,7 +4572,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget || !m_casterUnit) return; - m_casterUnit->getThreatManager().modifyThreatPercent(unitTarget, -100); + m_casterUnit->GetThreatManager().modifyThreatPercent(unitTarget, -100); return; } @@ -4600,11 +4599,11 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) case 22984: case 22985: { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; // Onyxia Scale Cloak - if (unitTarget->GetDummyAura(22683)) + if (unitTarget->HasAura(22683)) return; // Shadow Flame @@ -4617,7 +4616,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - uint8 race = m_casterUnit->getRace(); + uint8 race = m_casterUnit->GetRace(); uint32 spellId = 0; switch (m_spellInfo->Id) @@ -4677,7 +4676,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) SPELL_BLOODSIPHON_HEAL = 24322, SPELL_POISONOUS_BLOOD = 24321 }; - if (!unitTarget || !unitTarget->isAlive() || !m_casterUnit) + if (!unitTarget || !unitTarget->IsAlive() || !m_casterUnit) return; if (unitTarget->HasAura(SPELL_POISONOUS_BLOOD)) @@ -4694,7 +4693,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - bool gender = unitTarget->getGender(); + bool gender = unitTarget->GetGender(); uint32 spellId = 0; uint32 spells[8] = { gender == GENDER_MALE ? 24708u : 24709u, // Pirate @@ -4718,7 +4717,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Pirate Costume (male or female) - m_caster->CastSpell(unitTarget, unitTarget->getGender() == GENDER_MALE ? 24708 : 24709, true); + m_caster->CastSpell(unitTarget, unitTarget->GetGender() == GENDER_MALE ? 24708 : 24709, true); return; } case 24718: // Ninja Costume @@ -4727,7 +4726,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Ninja Costume (male or female) - m_caster->CastSpell(unitTarget, unitTarget->getGender() == GENDER_MALE ? 24711 : 24710, true); + m_caster->CastSpell(unitTarget, unitTarget->GetGender() == GENDER_MALE ? 24711 : 24710, true); return; } case 24719: // Leper Gnome Costume @@ -4736,7 +4735,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Leper Gnome Costume (male or female) - m_caster->CastSpell(unitTarget, unitTarget->getGender() == GENDER_MALE ? 24712 : 24713, true); + m_caster->CastSpell(unitTarget, unitTarget->GetGender() == GENDER_MALE ? 24712 : 24713, true); return; } case 24720: // Random Costume @@ -4749,13 +4748,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) switch (urand(0, 6)) { case 0: - spellId = unitTarget->getGender() == GENDER_MALE ? 24708 : 24709; + spellId = unitTarget->GetGender() == GENDER_MALE ? 24708 : 24709; break; case 1: - spellId = unitTarget->getGender() == GENDER_MALE ? 24711 : 24710; + spellId = unitTarget->GetGender() == GENDER_MALE ? 24711 : 24710; break; case 2: - spellId = unitTarget->getGender() == GENDER_MALE ? 24712 : 24713; + spellId = unitTarget->GetGender() == GENDER_MALE ? 24712 : 24713; break; case 3: spellId = 24723; @@ -4764,7 +4763,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) spellId = 24732; break; case 5: - spellId = unitTarget->getGender() == GENDER_MALE ? 24735 : 24736; + spellId = unitTarget->GetGender() == GENDER_MALE ? 24735 : 24736; break; case 6: spellId = 24740; @@ -4780,7 +4779,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // Ghost Costume (male or female) - m_caster->CastSpell(unitTarget, unitTarget->getGender() == GENDER_MALE ? 24735 : 24736, true); + m_caster->CastSpell(unitTarget, unitTarget->GetGender() == GENDER_MALE ? 24735 : 24736, true); return; } case 24751: // Trick or Treat @@ -4928,14 +4927,14 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // Select maintank + 4 random targets std::vector viableTargets; - const ThreatList& tl = m_casterUnit->getThreatManager().getThreatList(); + const ThreatList& tl = m_casterUnit->GetThreatManager().getThreatList(); for (auto it = tl.begin(); it != tl.end(); it++) { if ((*it)->getUnitGuid().IsPlayer()) { if (Unit* pUnit = m_casterUnit->GetMap()->GetUnit((*it)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) viableTargets.push_back(pUnit); } } @@ -4944,7 +4943,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) int num_targets = std::min(int(viableTargets.size()), 5)-1; // leaving 1 target not MCed to avoid reset due to all MCed // always MC maintank - if (Unit* maintank = m_casterUnit->getVictim()) + if (Unit* maintank = m_casterUnit->GetVictim()) { auto it = std::find(viableTargets.begin(), viableTargets.end(), maintank); if (it != viableTargets.end()) @@ -5170,7 +5169,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // Flash of Light if (m_spellInfo->SpellIconID == 242) { - if (!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->IsAlive()) return; int32 heal = damage; @@ -5179,7 +5178,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } else if (m_spellInfo->IsFitToFamilyMask()) { - if (!unitTarget || !unitTarget->isAlive() || !m_casterUnit) + if (!unitTarget || !unitTarget->IsAlive() || !m_casterUnit) return; uint32 spellId2 = 0; @@ -5213,8 +5212,8 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget || !unitTarget->CanHaveThreatList() || !m_casterUnit) return; - if (unitTarget->getThreatManager().getThreat(m_casterUnit)) - unitTarget->getThreatManager().addThreat(m_casterUnit, damage * m_casterUnit->GetAttackTime(BASE_ATTACK) / 1000); + if (unitTarget->GetThreatManager().getThreat(m_casterUnit)) + unitTarget->GetThreatManager().addThreat(m_casterUnit, damage * m_casterUnit->GetAttackTime(BASE_ATTACK) / 1000); } break; } @@ -5232,8 +5231,8 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!unitTarget || !unitTarget->CanHaveThreatList() || !m_casterUnit) return; - if (unitTarget->getThreatManager().getThreat(m_casterUnit)) - unitTarget->getThreatManager().addThreat(m_casterUnit, damage * m_casterUnit->GetAttackTime(BASE_ATTACK) / 1000); + if (unitTarget->GetThreatManager().getThreat(m_casterUnit)) + unitTarget->GetThreatManager().addThreat(m_casterUnit, damage * m_casterUnit->GetAttackTime(BASE_ATTACK) / 1000); } } break; @@ -5261,7 +5260,7 @@ void Spell::EffectSanctuary(SpellEffectIndex eff_idx) unitTarget->InterruptSpellsCastedOnMe(true); unitTarget->CombatStop(); - HostileReference* pReference = unitTarget->getHostileRefManager().getFirst(); + HostileReference* pReference = unitTarget->GetHostileRefManager().getFirst(); while (pReference) { @@ -5381,8 +5380,8 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx) return; } - pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_casterUnit->getFaction()); - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->getLevel() + 1); + pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_casterUnit->GetFactionTemplateId()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->GetLevel() + 1); int32 duration = m_spellInfo->GetDuration(); pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); @@ -5450,7 +5449,7 @@ void Spell::EffectSummonPlayer(SpellEffectIndex /*eff_idx*/) return; // Evil Twin (ignore player summon, but hide this for summoner) - if (unitTarget->GetDummyAura(23445)) + if (unitTarget->HasAura(23445)) return; float x, y, z; @@ -5796,7 +5795,7 @@ void Spell::EffectFeedPet(SpellEffectIndex eff_idx) if (!pet) return; - if (!pet->isAlive()) + if (!pet->IsAlive()) return; if (!pet->IsWithinLOSInMap(pPlayer)) @@ -5828,7 +5827,7 @@ void Spell::EffectDismissPet(SpellEffectIndex eff_idx) Pet* pet = pPlayer->GetPet(); // not let dismiss dead pet - if (!pet || !pet->isAlive()) + if (!pet || !pet->IsAlive()) return; pet->Unsummon(PET_SAVE_NOT_IN_SLOT, pPlayer); @@ -5891,7 +5890,7 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx) return; } - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->getLevel()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->GetLevel()); int32 duration = m_spellInfo->GetDuration(); pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); @@ -5919,7 +5918,7 @@ void Spell::EffectResurrect(SpellEffectIndex eff_idx) if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; - if (unitTarget->isAlive()) + if (unitTarget->IsAlive()) return; if (!unitTarget->IsInWorld()) return; @@ -5967,7 +5966,7 @@ void Spell::EffectAddExtraAttacks(SpellEffectIndex eff_idx) if (!unitTarget) return; - if (!unitTarget->isAlive()|| unitTarget->IsExtraAttacksLocked()) + if (!unitTarget->IsAlive() || unitTarget->IsExtraAttacksLocked()) return; if (m_spellInfo->Id == 20178) // Reckoning @@ -6046,7 +6045,7 @@ void Spell::EffectQuestComplete(SpellEffectIndex eff_idx) void Spell::EffectSelfResurrect(SpellEffectIndex eff_idx) { - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -6089,7 +6088,7 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/) return; Creature* creature = (Creature*) unitTarget; - int32 targetLevel = creature->getLevel(); + int32 targetLevel = creature->GetLevel(); ((Player*)m_caster)->SendLoot(creature->GetObjectGuid(), LOOT_SKINNING); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); @@ -6161,7 +6160,7 @@ void Spell::EffectSummonCritter(SpellEffectIndex eff_idx) //critter->SetName(""); // generated by client critter->SetOwnerGuid(m_caster->GetObjectGuid()); critter->SetCreatorGuid(m_caster->GetObjectGuid()); - critter->setFaction(m_caster->getFaction()); + critter->SetFactionTemplateId(m_caster->GetFactionTemplateId()); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); critter->AIM_Initialize(); @@ -6288,7 +6287,7 @@ void Spell::EffectSummonDeadPet(SpellEffectIndex /*eff_idx*/) Pet *pet = _player->GetPet(); if (!pet) return; - if (pet->isAlive()) + if (pet->IsAlive()) return; if (damage < 0) return; @@ -6298,7 +6297,7 @@ void Spell::EffectSummonDeadPet(SpellEffectIndex /*eff_idx*/) 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_STAT_ALL_DYN_STATES); pet->SetHealth(uint32(pet->GetMaxHealth() * (float(damage) / 100))); pet->AIM_Initialize(); @@ -6384,7 +6383,7 @@ void Spell::EffectModifyThreatPercent(SpellEffectIndex eff_idx) if (!unitTarget || !m_casterUnit) return; - unitTarget->getThreatManager().modifyThreatPercent(m_casterUnit, damage); + unitTarget->GetThreatManager().modifyThreatPercent(m_casterUnit, damage); AddExecuteLogInfo(eff_idx, ExecuteLogInfo(unitTarget->GetObjectGuid())); } @@ -6527,7 +6526,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) if(Group * group = ((Player*)m_casterUnit)->GetGroup()) pGameObj->SetOwnerGroupId(group->GetId()); } - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->getLevel()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_casterUnit->GetLevel()); pGameObj->SetSpellId(m_spellInfo->Id); DEBUG_LOG("AddObject at SpellEfects.cpp EffectTransmitted"); @@ -6565,7 +6564,7 @@ void Spell::EffectSummonDemon(SpellEffectIndex eff_idx) return; // might not always work correctly, maybe the creature that dies from CoD casts the effect on itself and is therefore the caster? - Charmed->SetLevel(m_caster->getLevel()); + Charmed->SetLevel(m_caster->GetLevel()); // TODO: Add damage/mana/hp according to level @@ -6584,7 +6583,7 @@ void Spell::EffectSummonDemon(SpellEffectIndex eff_idx) void Spell::EffectSpiritHeal(SpellEffectIndex /*eff_idx*/) { // TODO player can't see the heal-animation - he should respawn some ticks later - if (!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->IsAlive()) return; if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -6628,7 +6627,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffectIndex eff_idx) return; } - if (target->GetTypeId() != TYPEID_PLAYER || target->isAlive()) + if (target->GetTypeId() != TYPEID_PLAYER || target->IsAlive()) return; ((Player*)target)->RemovedInsignia(playerCaster, corpseTarget); diff --git a/src/game/Spells/SpellEntry.h b/src/game/Spells/SpellEntry.h index 690dba982..2c6570a5e 100644 --- a/src/game/Spells/SpellEntry.h +++ b/src/game/Spells/SpellEntry.h @@ -25,6 +25,7 @@ #include #include "DBCStructure.h" #include "SharedDefines.h" +#include "SpellDefines.h" #include "SpellAuraDefines.h" class Spell; @@ -32,240 +33,6 @@ class Unit; class WorldObject; class SpellEntry; -// Custom flags assigned in the db -enum SpellAttributeCustom -{ - SPELL_CUSTOM_NONE = 0x000, - SPELL_CUSTOM_ALLOW_STACK_BETWEEN_CASTER = 0x001, // For example 'Siphon Soul' must be able to stack between the warlocks on a mob - SPELL_CUSTOM_NEGATIVE = 0x002, - SPELL_CUSTOM_POSITIVE = 0x004, - SPELL_CUSTOM_CHAN_NO_DIST_LIMIT = 0x008, - SPELL_CUSTOM_FIXED_DAMAGE = 0x010, // Not affected by damage/healing done bonus - SPELL_CUSTOM_IGNORE_ARMOR = 0x020, - SPELL_CUSTOM_BEHIND_TARGET = 0x040, // For spells that require the caster to be behind the target - SPELL_CUSTOM_FACE_TARGET = 0x080, // For spells that require the target to be in front of the caster - SPELL_CUSTOM_SINGLE_TARGET_AURA = 0x100, // Aura applied by spell can only be on 1 target at a time - SPELL_CUSTOM_AURA_APPLY_BREAKS_STEALTH = 0x200, // Stealth is removed when this aura is applied -}; - -// Custom flags assigned by the core based on spell template data -enum SpellAttributeInternal -{ - SPELL_INTERNAL_APPLIES_AURA = 0x001, - SPELL_INTERNAL_APPLIES_PERIODIC_AURA = 0x002, - SPELL_INTERNAL_PASSIVE_STACK_WITH_RANKS = 0x004, - SPELL_INTERNAL_POSITIVE = 0x008, - SPELL_INTERNAL_HEAL = 0x010, - SPELL_INTERNAL_DIRECT_DAMAGE = 0x020, - SPELL_INTERNAL_CASTER_SOURCE_TARGETS = 0x040, - SPELL_INTERNAL_AOE = 0x080, - SPELL_INTERNAL_AOE_AURA = 0x100, - SPELL_INTERNAL_DISMOUNT = 0x200, - SPELL_INTERNAL_CHARM = 0x400, - SPELL_INTERNAL_REFLECTABLE = 0x800, -}; - -// original names, do not edit -enum SpellCategories -{ - SPELLCATEGORY_DEFAULT = 1, - SPELLCATEGORY_DIRECT_DAMAGE_SPELL = 2, - SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_POTION = 4, - SPELLCATEGORY_ITEM_FOOD = 11, - SPELLCATEGORY_HEALING_SPELL = 12, - SPELLCATEGORY_QUICK_BUFF_RESIST_SPELL = 17, - SPELLCATEGORY_DAMAGE_OVER_TIME_SPELL = 18, - SPELLCATEGORY_QUICK_DAMAGE_SPELL = 19, - SPELLCATEGORY_INVULNERABILITY_OTHER = 20, - SPELLCATEGORY_QUICK_BUFF_SPELL = 21, - SPELLCATEGORY_QUICK_DEBUFF_SPELL = 22, - SPELLCATEGORY_SUMMONING = 23, - SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_AGGRESSIVE = 24, - SPELLCATEGORY_QUICK_HEAL_SPELL = 25, - SPELLCATEGORY_RESURRECTION_FULL = 26, - SPELLCATEGORY_ITEM_SCROLL = 27, - SPELLCATEGORY_ITEM_QUICK_BUFF = 28, - SPELLCATEGORY_ITEM_DEBUFF = 29, - SPELLCATEGORY_ITEM_HEALING = 30, - SPELLCATEGORY_CONJURE_SHORT = 31, - SPELLCATEGORY_STUN = 32, - SPELLCATEGORY_MEZ = 33, - SPELLCATEGORY_ROOT = 34, - SPELLCATEGORY_DIRECT_DAMAGE_AE_SPELL = 35, - SPELLCATEGORY_DEBUFF_SPELL = 36, - SPELLCATEGORY_INVULNERABILITY = 37, - SPELLCATEGORY_AURA = 38, - SPELLCATEGORY_SHAPESHIFT = 39, - SPELLCATEGORY_MELEE_GENERIC = 40, - SPELLCATEGORY_CRITICAL = 41, - SPELLCATEGORY_SNARE = 42, - SPELLCATEGORY_SHOUT = 43, - SPELLCATEGORY_SPEED = 44, - SPELLCATEGORY_TOTEM_STONECLAW = 45, - SPELLCATEGORY_HEALING_GROUP_SPELL = 46, - SPELLCATEGORY_COMBAT_STATES = 47, - SPELLCATEGORY_DIRECT_DAMAGE_AE_ABILITY = 49, - SPELLCATEGORY_DIRECT_DAMAGE_AECONE_ABILITY = 50, - SPELLCATEGORY_QUICK_DEBUFF_DPS_SPELL = 51, - SPELLCATEGORY_QUICK_DEBUFF_DR_SPELL = 52, - SPELLCATEGORY_QUICK_BUFF_DR_SPELL = 54, - SPELLCATEGORY_QUICK_BUFF_DPS_SPELL = 55, - SPELLCATEGORY_INSTANT_HEAL_SPELL = 56, - SPELLCATEGORY_QUICK_HEAL_GROUP_SPELL = 57, - SPELLCATEGORY_INSTANT_HEAL_GROUP_SPELL = 58, - SPELLCATEGORY_ITEM_DRINK = 59, - SPELLCATEGORY_INVULNERABILITY_TEMP = 60, - SPELLCATEGORY_ENERGIZE_GROUP_SPELL = 61, - SPELLCATEGORY_ENERGIZE_SPELL = 62, - SPELLCATEGORY_BIG_DIRECT_DAMAGE_SPELL = 63, - SPELLCATEGORY_MINIMAP_SPECIAL = 64, - SPELLCATEGORY_MELEE_SPECIAL = 65, - SPELLCATEGORY_DODGE_MANEUVER = 66, - SPELLCATEGORY_BLOCK_MANEUVER = 67, - SPELLCATEGORY_PARRY_MANEUVER = 68, - SPELLCATEGORY_DIRECT_DAMAGE_AEPERSISTENT_SPELL = 72, - SPELLCATEGORY_MARTIAL_ARTS_GENERIC = 73, - SPELLCATEGORY_MARTIAL_ARTS_SPECIAL = 74, - SPELLCATEGORY_DETECT = 75, - SPELLCATEGORY_SHOOT_THROW = 76, - SPELLCATEGORY_TRADE_HERBALISM = 77, - SPELLCATEGORY_TRADE_MINING = 78, - SPELLCATEGORY_ITEM_POTION_NONCOMBAT = 79, - SPELLCATEGORY_TAUNT_DETAUNT = 82, - SPELLCATEGORY_TAMING = 83, - SPELLCATEGORY_TAUNT_AE = 84, - SPELLCATEGORY_DIRECT_DAMAGE_AECHAIN_ABILITY = 85, - SPELLCATEGORY_PET = 86, - SPELLCATEGORY_CONJURE_LONG = 87, - SPELLCATEGORY_SILENCE = 88, - SPELLCATEGORY_PORTAL = 89, - SPELLCATEGORY_CHARM = 93, - SPELLCATEGORY_ITEM_SUMMONING = 94, - SPELLCATEGORY_RACIAL_ABILITY = 95, - SPELLCATEGORY_RACIAL_ABILITY_2 = 96, - SPELLCATEGORY_SECONDARY_SURVIVAL = 97, - SPELLCATEGORY_BIG_DIRECT_DAMAGE_SPELL_2 = 98, - SPELLCATEGORY_INSTANT_SPELL = 99, - SPELLCATEGORY_ITEM_MANA_GEM = 100, - SPELLCATEGORY_FELHUNTER = 101, - SPELLCATEGORY_ITEM_LONG_BUFF = 102, - SPELLCATEGORY_ITEM_EPIC = 103, - SPELLCATEGORY_TOTEM_HEALING = 104, - SPELLCATEGORY_TOTEM_SERPENT = 105, - SPELLCATEGORY_TOTEM_SLOWING = 106, - SPELLCATEGORY_TOTEM_MANA = 107, - SPELLCATEGORY_TOTEM_INVISIBILITY = 108, - SPELLCATEGORY_MELEE_DISARM = 109, - SPELLCATEGORY_DISCIPLINE = 132, - SPELLCATEGORY_GLOBAL = 133, - SPELLCATEGORY_ITEM_BANDAGE = 150, - SPELLCATEGORY_FINISHING_MOVE_WEAPONSCALED = 170, - SPELLCATEGORY_BANISH = 190, - SPELLCATEGORY_TOTEM_GROUNDING = 230, - SPELLCATEGORY_BLAST_WAVE = 250, - SPELLCATEGORY_KIDNEY_SHOT = 270, - SPELLCATEGORY_PYROBLAST_REUSE = 290, - SPELLCATEGORY_TRANSMUTE_ALCHEMY = 310, - SPELLCATEGORY_MOUNT = 330, - SPELLCATEGORY_INNER_RAGE = 350, - SPELLCATEGORY_RANGED_WEAPON = 351, - SPELLCATEGORY_LIGHTNING_SHIELD = 371, - SPELLCATEGORY_QUEST_FELCURSE = 391, - SPELLCATEGORY_TRAP = 411, - SPELLCATEGORY_HOLY_NOVA = 431, - SPELLCATEGORY_HOLY_FIRE = 451, - SPELLCATEGORY_ICE_BARRIER = 471, - SPELLCATEGORY_ASTRAL_RECALL = 511, - SPELLCATEGORY_NATURES_GRASP = 531, - SPELLCATEGORY_AURA_OF_THE_PIOUS = 551, - SPELLCATEGORY_HURRICANE = 571, - SPELLCATEGORY_TOTEM_MANA_TIDE = 591, - SPELLCATEGORY_WINGS_OF_HOPE = 611, - SPELLCATEGORY_SOUL_FIRE = 631, - SPELLCATEGORY_DEATH_COIL = 633, - SPELLCATEGORY_HOWL_OF_TERROR = 634, - SPELLCATEGORY_SHADOWBURN = 651, - SPELLCATEGORY_DESPERATE_PRAYER = 671, - SPELLCATEGORY_CONFLAGRATE = 672, - SPELLCATEGORY_DEVOURING_PLAGUE = 691, - SPELLCATEGORY_SUMMON_INFERNAL = 731, - SPELLCATEGORY_TREE_FORM = 751, - SPELLCATEGORY_ITEM_SALT_SHAKER = 791, - SPELLCATEGORY_DIVINE_INTERVENTION = 811, - SPELLCATEGORY_SOULSTONE = 831, - SPELLCATEGORY_RESTORATION = 851, - SPELLCATEGORY_SHADOWMELD = 871, - SPELLCATEGORY_INTERCEPT = 872, - SPELLCATEGORY_WHIRLWIND = 891, - SPELLCATEGORY_HOLY_SHOCK = 892, - SPELLCATEGORY_DISTRACTING_SHOT = 911, - SPELLCATEGORY_HOLY_SHIELD = 931, - SPELLCATEGORY_CONSECRATION = 932, - SPELLCATEGORY_PVP_BATTLEFIELD_ITEM_LONG_30_MINS = 951, - SPELLCATEGORY_MORTAL_STRIKE = 971, - SPELLCATEGORY_ITEM_SNOWMASTER = 991, - SPELLCATEGORY_FRENZIED_HEALING = 1011, - SPELLCATEGORY_ITEM_HALF_HOUR = 1031, - SPELLCATEGORY_ITEM_JUMPER_CABLES = 1051, - SPELLCATEGORY_ITEM_HATCH_JUBLING = 1071, - SPELLCATEGORY_BATTLEGROUNDS_RECALL = 1091, - SPELLCATEGORY_WYVERN_STING = 1111, - SPELLCATEGORY_HAMMER_OF_VENGEANCE = 1131, - SPELLCATEGORY_INTIMIDATION = 1132, - SPELLCATEGORY_FAERIE_FIRE_FERAL = 1133, - SPELLCATEGORY_RIPOSTE = 1134, - SPELLCATEGORY_COUNTERATTACK = 1135, - SPELLCATEGORY_HOLIDAY_FIREWORK_ROCKETS = 1136, - SPELLCATEGORY_HOLIDAY_FIRECRACKER = 1137, - SPELLCATEGORY_RC_WEAPONS = 1138, - SPELLCATEGORY_ITEM_QUEST_10_MINUTES = 1139, - SPELLCATEGORY_ITEM_QUEST_1_MIN = 1140, - SPELLCATEGORY_ITEM_BURST_TRINKET = 1141, - SPELLCATEGORY_HOLIDAY_VALENTINE_PERFUME_COLOGNE = 1142, - SPELLCATEGORY_ITEM_TARGET_DUMMY = 1143, - SPELLCATEGORY_PRIEST_RACIAL = 1144, - SPELLCATEGORY_LIGHTWELL = 1145, - SPELLCATEGORY_QUEST_1_HOUR = 1149, - SPELLCATEGORY_SHADOWTHUNDERSTRIKE = 1150, - SPELLCATEGORY_TALENT_DPS = 1151, - SPELLCATEGORY_CREATURE_SPECIAL = 1152, - SPELLCATEGORY_ITEM_COMBAT_CONSUMABLE_NONAGGRESSIVE = 1153, - SPELLCATEGORY_ARATHI_BASIN_TRINKET = 1155, - SPELLCATEGORY_CREATURE_SPECIAL_2 = 1159, - SPELLCATEGORY_ITEM_PRIEST_EPIC_STAFF = 1160, - SPELLCATEGORY_REINCARNATION = 1161 -}; - -// Spell clasification -enum SpellSpecific -{ - SPELL_NORMAL = 0, - SPELL_SEAL = 1, - SPELL_BLESSING = 2, - SPELL_AURA = 3, - SPELL_STING = 4, - SPELL_CURSE = 5, - SPELL_ASPECT = 6, - SPELL_TRACKER = 7, - SPELL_WARLOCK_ARMOR = 8, - SPELL_MAGE_ARMOR = 9, - SPELL_ELEMENTAL_SHIELD = 10, - SPELL_MAGE_POLYMORPH = 11, - SPELL_POSITIVE_SHOUT = 12, - SPELL_JUDGEMENT = 13, - SPELL_BATTLE_ELIXIR = 14, - SPELL_GUARDIAN_ELIXIR = 15, - SPELL_FLASK_ELIXIR = 16, - //SPELL_PRESENCE = 17, // used in 3.x - //SPELL_HAND = 18, // used in 3.x - SPELL_WELL_FED = 19, - SPELL_FOOD = 20, - SPELL_DRINK = 21, - SPELL_FOOD_AND_DRINK = 22, - SPELL_NEGATIVE_HASTE = 23, - SPELL_SNARE = 24, -}; - namespace Spells { SpellSpecific GetSpellSpecific(uint32 spellId); diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 7d42e6ee6..15a65afa0 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -3131,14 +3131,14 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (gender != GENDER_NONE) { // not in expected gender - if (!player || gender != player->getGender()) + if (!player || gender != player->GetGender()) return false; } if (raceMask) { // not in expected race - if (!player || !(raceMask & player->getRaceMask())) + if (!player || !(raceMask & player->GetRaceMask())) return false; } diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 62f1108d6..1b0df83b8 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Unit.h" #include "Player.h" #include "Pet.h" #include "Creature.h" @@ -142,7 +141,7 @@ void Player::UpdateArmor() #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_8_4 // Add dummy effects from spells (check class and other conditions first for optimization) - if (getClass() == CLASS_DRUID) + if (GetClass() == CLASS_DRUID) { ShapeshiftForm form = GetShapeshiftForm(); if ((form == FORM_DIREBEAR) || (form == FORM_BEAR)) @@ -219,7 +218,7 @@ void Player::UpdateMaxPower(Powers power) void Player::UpdateAttackPowerAndDamage(bool ranged) { float val2 = 0.0f; - float level = float(getLevel()); + float level = float(GetLevel()); UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER; @@ -237,7 +236,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; #endif - switch (getClass()) + switch (GetClass()) { case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_AGILITY) * 2.0f - 10.0f; @@ -268,7 +267,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) } else { - switch (getClass()) + switch (GetClass()) { case CLASS_WARRIOR: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; @@ -316,14 +315,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) switch (form) { case FORM_CAT: - val2 = getLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f; + val2 = GetLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f; break; case FORM_BEAR: case FORM_DIREBEAR: - val2 = getLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; + val2 = GetLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; case FORM_MOONKIN: - val2 = getLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; + val2 = GetLevel() * mLevelMult + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; default: val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f; @@ -362,7 +361,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) else { UpdateDamagePhysical(BASE_ATTACK); - if (CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon + if (CanDualWield() && HaveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon UpdateDamagePhysical(OFF_ATTACK); } } @@ -410,7 +409,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl } else { - uint32 lvl = getLevel(); + uint32 lvl = GetLevel(); if (lvl > 60) lvl = 60; @@ -512,7 +511,7 @@ void Player::UpdateCritPercentage(WeaponAttackType attType) } float value = GetTotalPercentageModValue(modGroup); - switch (getClass()) + switch (GetClass()) { case CLASS_DRUID: value += 0.9f; @@ -573,7 +572,7 @@ void Player::UpdateDodgePercentage() { // Nostalrius : base dodge per class float value = 0.0f; - switch (getClass()) + switch (GetClass()) { case CLASS_DRUID: value += 0.9f; diff --git a/src/game/Threat/HostileRefManager.cpp b/src/game/Threat/HostileRefManager.cpp index 531d38ae0..6edf174bd 100644 --- a/src/game/Threat/HostileRefManager.cpp +++ b/src/game/Threat/HostileRefManager.cpp @@ -23,7 +23,7 @@ #include "ThreatManager.h" #include "Unit.h" #include "DBCStructure.h" -#include "SpellMgr.h" +#include "SpellEntry.h" HostileRefManager::HostileRefManager(Unit *pOwner) : iOwner(pOwner) { diff --git a/src/game/Threat/ThreatManager.cpp b/src/game/Threat/ThreatManager.cpp index b375cd81e..767792ff1 100644 --- a/src/game/Threat/ThreatManager.cpp +++ b/src/game/Threat/ThreatManager.cpp @@ -20,7 +20,6 @@ */ #include "ThreatManager.h" -#include "Unit.h" #include "Creature.h" #include "CreatureAI.h" #include "Map.h" @@ -74,14 +73,14 @@ HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, f // Tell our refTo (target) object that we have a link void HostileReference::targetObjectBuildLink() { - getTarget()->addHatedBy(this); + getTarget()->AddHatedBy(this); } //============================================================ // Tell our refTo (taget) object, that the link is cut void HostileReference::targetObjectDestroyLink() { - getTarget()->removeHatedBy(this); + getTarget()->RemoveHatedBy(this); } //============================================================ @@ -119,7 +118,7 @@ void HostileReference::addThreat(float pMod) if (isValid() && pMod >= 0) { Unit* victim_owner = getTarget()->GetOwner(); - if (victim_owner && victim_owner->isAlive()) + if (victim_owner && victim_owner->IsAlive()) getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks } } @@ -293,7 +292,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_STAT_CAN_NOT_MOVE); for (int attempt = 0; attempt < 2 && !found; ++attempt) { @@ -309,7 +308,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile bool outOfThreatArea = pAttacker->IsOutOfThreatArea(target); bool validAttackTarget = pAttacker->IsValidAttackTarget(target); - bool targetableForAttack = target->isTargetableForAttack(); + bool targetableForAttack = target->IsTargetableForAttack(); if (outOfThreatArea) return nullptr; @@ -402,7 +401,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho return; // not to dead and not for dead - if (!pVictim->isAlive() || !getOwner()->isAlive()) + if (!pVictim->IsAlive() || !getOwner()->IsAlive()) return; MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT); @@ -411,8 +410,8 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho // 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, NULL))) + if (getOwner()->HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ISOLATED) + || (getOwner()->HasUnitState(UNIT_STAT_STUNNED) && getOwner()->HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, NULL))) { pThreat = 0.0f; } @@ -425,7 +424,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho void ThreatManager::addThreatDirectly(Unit* pVictim, float threat) { - if (!pVictim || pVictim == getOwner() || !pVictim->isAlive() || !pVictim->IsInMap(getOwner())) + if (!pVictim || pVictim == getOwner() || !pVictim->IsAlive() || !pVictim->IsInMap(getOwner())) return; HostileReference* ref = iThreatContainer.addThreat(pVictim, threat); diff --git a/src/game/Threat/ThreatManager.h b/src/game/Threat/ThreatManager.h index 64813fab3..a933f4480 100644 --- a/src/game/Threat/ThreatManager.h +++ b/src/game/Threat/ThreatManager.h @@ -27,6 +27,7 @@ #include "Utilities/LinkedReference/Reference.h" #include "UnitEvents.h" #include "ObjectGuid.h" +#include "SpellDefines.h" #include //============================================================== diff --git a/src/game/Transports/Transport.cpp b/src/game/Transports/Transport.cpp index d6ce551a5..8bb285527 100644 --- a/src/game/Transports/Transport.cpp +++ b/src/game/Transports/Transport.cpp @@ -322,7 +322,7 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl break; } - if (!player->isAlive()) + if (!player->IsAlive()) player->ResurrectPlayer(1.0f); player->RemoveSpellsCausingAura(SPELL_AURA_MOD_CONFUSE); diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 4f68d48d7..2637be4b1 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -24,7 +24,6 @@ #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" -#include "Unit.h" #include "Spell.h" #include "SpellAuras.h" #include "Totem.h" @@ -236,7 +235,7 @@ inline bool SpellCanTrigger(const SpellEntry* spellProto, const SpellEntry* proc return (procSpell && procSpell->SpellFamilyName == spellProto->SpellFamilyName && procSpell->SpellFamilyFlags & spellProto->EffectItemType[eff_idx]); } -bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, SpellProcEventEntry const*& spellProcEvent) +bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, SpellProcEventEntry const*& spellProcEvent) const { SpellEntry const* spellProto = holder->GetSpellProto(); /* @@ -739,7 +738,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura // Magic Absorption if (dummySpell->SpellIconID == 459) // only this spell have SpellIconID == 459 and dummy aura { - if (getPowerType() != POWER_MANA) + if (GetPowerType() != POWER_MANA) return SPELL_AURA_PROC_FAILED; // mana reward @@ -896,7 +895,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura // Vampiric Embrace case 15286: { - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; // pVictim is caster of aura @@ -1068,7 +1067,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura return SPELL_AURA_PROC_FAILED; // Set class defined buff - switch (pVictim->getClass()) + switch (pVictim->GetClass()) { case CLASS_PALADIN: case CLASS_PRIEST: @@ -1106,7 +1105,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura return SPELL_AURA_PROC_FAILED; // Set class defined buff - switch (pVictim->getClass()) + switch (pVictim->GetClass()) { case CLASS_PALADIN: case CLASS_PRIEST: @@ -1157,7 +1156,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura } // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; if (cooldown && HasSpellCooldown(triggered_spell_id)) @@ -1178,7 +1177,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura return SPELL_AURA_PROC_OK; } -SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown) +SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown) { // Get triggered aura spell info SpellEntry const* auraSpellInfo = triggeredByAura->GetSpellProto(); @@ -1220,9 +1219,9 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d case 27522: // Mana Drain Trigger { // On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target. - if (isAlive()) + if (IsAlive()) CastSpell(this, 29471, true, castItem, triggeredByAura); - if (pVictim && pVictim->isAlive()) + if (pVictim && pVictim->IsAlive()) CastSpell(pVictim, 27526, true, castItem, triggeredByAura); return SPELL_AURA_PROC_OK; } @@ -1265,7 +1264,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d // Pyroclasm if (auraSpellInfo->SpellIconID == 1137) { - if (!pVictim || !pVictim->isAlive() || pVictim == this || procSpell == nullptr) + if (!pVictim || !pVictim->IsAlive() || pVictim == this || procSpell == nullptr) return SPELL_AURA_PROC_FAILED; // Calculate spell tick count for spells uint32 tick = 1; // Default tick = 1 @@ -1494,20 +1493,21 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d if (!procSpell) return SPELL_AURA_PROC_FAILED; + Player* pPlayer = ToPlayer(); + if (!pPlayer) + return SPELL_AURA_PROC_FAILED; + // procspell is triggered spell but we need mana cost of original casted spell + // The casted spell is in a variable: Player::m_castingSpell. Otherwise we can not find the spell that caused the proc. - //[Nostalrius] : Stocke autremenent - //Le sort caste est dans une varible : Unit::m_castingSpell. Sinon, impossible de trouver le sort qui a provoque le proc - - SpellEntry const *originalSpell = sSpellMgr.GetSpellEntry(m_castingSpell); - //SpellEntry const *originalSpell = sSpellMgr.GetSpellEntry(originalSpellId); + SpellEntry const *originalSpell = sSpellMgr.GetSpellEntry(pPlayer->m_castingSpell); if (!originalSpell) { - sLog.outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", m_castingSpell); + sLog.outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", pPlayer->m_castingSpell); return SPELL_AURA_PROC_FAILED; } // Histoire de pas reproc une autre fois ... :S - m_castingSpell = 0; + pPlayer->m_castingSpell = 0; basepoints[0] = originalSpell->manaCost; trigger_spell_id = 20272; target = this; @@ -1600,7 +1600,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset) case 15250: // Rogue Setup { - if (!pVictim || pVictim != getVictim()) // applied only for main target + if (!pVictim || pVictim != GetVictim()) // applied only for main target return SPELL_AURA_PROC_FAILED; break; // continue normal case } @@ -1626,7 +1626,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL) && Spells::IsPositiveSpell(trigger_spell_id) ? this : pVictim; // default case - if (!target || (target != this && !target->isAlive())) + if (!target || (target != this && !target->IsAlive())) return SPELL_AURA_PROC_FAILED; if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) @@ -1689,7 +1689,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 { int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue; - if (!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->IsAlive()) return SPELL_AURA_PROC_FAILED; Item* castItem = triggeredByAura->GetCastItemGuid() && GetTypeId() == TYPEID_PLAYER @@ -1748,7 +1748,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 { if (procSpell->IsFitToFamily()) { - switch (pVictim->getPowerType()) + switch (pVictim->GetPowerType()) { case POWER_MANA: triggered_spell_id = 28722; @@ -1836,13 +1836,13 @@ SpellAuraProcResult Unit::HandleAddTargetTriggerAuraProc(Unit *pVictim, uint32 / { switch (aurEntry->Id) { - // Frappes implacables - case 14179: // Rang 1 : 4% + // Relentless Strikes + case 14179: // Rank 1 : 4% { - if (GetTypeId() == TYPEID_PLAYER) + if (Player* pPlayer = ToPlayer()) { - chance = 20.0f * m_castingSpell; - m_castingSpell = 0; + chance = 20.0f * pPlayer->m_castingSpell; + pPlayer->m_castingSpell = 0; } break; } diff --git a/src/game/UnitEvents.h b/src/game/UnitEvents.h index 096a362f2..7e4dc94a3 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -111,7 +111,7 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } - ThreatManager* getThreatManager() const { return iThreatManager; } + ThreatManager* GetThreatManager() const { return iThreatManager; } }; //============================================================== diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 7a568797a..48eebac9f 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -651,14 +651,14 @@ void WorldSession::LogoutPlayer(bool Save) ///- If the player just died before logging out, make him appear as a ghost if (inWorld && _player->GetDeathTimer()) { - _player->getHostileRefManager().deleteReferences(); + _player->GetHostileRefManager().deleteReferences(); _player->BuildPlayerRepop(); _player->RepopAtGraveyard(); } - else if (inWorld && _player->isInCombat()) + else if (inWorld && _player->IsInCombat()) { _player->CombatStop(); - _player->getHostileRefManager().setOnlineOfflineState(false); + _player->GetHostileRefManager().setOnlineOfflineState(false); } else if (inWorld && _player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) { @@ -697,7 +697,7 @@ void WorldSession::LogoutPlayer(bool Save) Save = false; sLog.outInfo("[CRASH] Joueur %s pas dans le monde a la deco.", _player->GetName()); } - else if (ShouldBeBanned(_player->getLevel())) + else if (ShouldBeBanned(_player->GetLevel())) doBanPlayer = true; sBattleGroundMgr.PlayerLoggedOut(_player); diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index e46c65670..0e208ec8a 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -115,7 +115,7 @@ bool GameObjectModel::initialize(const GameObject* const pGo, const GameObjectDi Vector3 pos(iBound.corner(i)); if (Creature* c = const_cast(pGo)->SummonCreature(24440, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN, 0)) { - c->setFaction(35); + c->SetFactionTemplateId(35); c->SetObjectScale(0.1f); } } diff --git a/src/scripts/battlegrounds/battleground.cpp b/src/scripts/battlegrounds/battleground.cpp index 7d3a72ba2..b7996aff5 100644 --- a/src/scripts/battlegrounds/battleground.cpp +++ b/src/scripts/battlegrounds/battleground.cpp @@ -90,7 +90,7 @@ struct npc_spirit_guideAI : ScriptedAI for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (!pPlayer || !pPlayer->IsWithinDistInMap(m_creature, 20.0f) || !pPlayer->HasAura(SPELL_WAITING_TO_RESURRECT) || pPlayer->isAlive()) + if (!pPlayer || !pPlayer->IsWithinDistInMap(m_creature, 20.0f) || !pPlayer->HasAura(SPELL_WAITING_TO_RESURRECT) || pPlayer->IsAlive()) continue; // repop player again - now this node won't be counted and another node is searched diff --git a/src/scripts/battlegrounds/battleground_alterac.cpp b/src/scripts/battlegrounds/battleground_alterac.cpp index 1dda8757d..75801bfe5 100644 --- a/src/scripts/battlegrounds/battleground_alterac.cpp +++ b/src/scripts/battlegrounds/battleground_alterac.cpp @@ -67,7 +67,7 @@ class npc_alterac_bossHelper for (int i = 0; i < m_linkedEntries.size(); ++i) GetCreatureListWithEntryInGrid(creaturesLinked, me, m_linkedEntries[i], 100.0f); for (std::list::iterator it = creaturesLinked.begin(); it != creaturesLinked.end(); ++it) - if ((*it)->isAlive() && !(*it)->isInCombat()) + if ((*it)->IsAlive() && !(*it)->IsInCombat()) { ThreatListCopier* c = new ThreatListCopier(*it); me->ProcessThreatList(c); @@ -108,7 +108,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_STAT_ROOT); m_bAggro = true; m_bLeashed = false; m_bCombat1 = true; @@ -140,7 +140,7 @@ struct npc_VanndarAI : public ScriptedAI, public npc_alterac_bossHelper void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if ((pWho->GetDistance(m_creature) < 23.0f) && (m_creature->IsHostileTo(pWho))) @@ -154,13 +154,13 @@ 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_STAT_ROOT); m_bLeashed = true; EnterEvadeMode(); return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // GlobalCD non ecoule. @@ -194,7 +194,7 @@ struct npc_VanndarAI : public ScriptedAI, public npc_alterac_bossHelper { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STORMBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STORMBOLT) == CAST_OK) { m_uiStormbolt_Timer = urand(8000, 10000); m_uiGlobalCooldown = 1000; @@ -350,7 +350,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_STAT_ROOT); m_bAggro = true; m_bLeashed = false; m_bCombat1 = true; @@ -363,13 +363,13 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper std::list m_Wolf; GetCreatureListWithEntryInGrid(m_Wolf, m_creature, 12121, 100.0f); for (std::list::iterator it = m_Wolf.begin(); it != m_Wolf.end(); ++it) - if (!(*it)->isAlive()) + if (!(*it)->IsAlive()) (*it)->Respawn(); m_Wolf.clear(); GetCreatureListWithEntryInGrid(m_Wolf, m_creature, 12122, 100.0f); for (std::list::iterator it = m_Wolf.begin(); it != m_Wolf.end(); ++it) - if (!(*it)->isAlive()) + if (!(*it)->IsAlive()) (*it)->Respawn(); m_Wolf.clear(); @@ -397,7 +397,7 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if ((pWho->GetDistance(m_creature) < 22.0f) && (m_creature->IsHostileTo(pWho))) @@ -412,7 +412,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_STAT_ROOT); m_bLeashed = true; EnterEvadeMode(); return; @@ -424,7 +424,7 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper else m_uiIsInWhirlwind_Timer -= diff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // GlobalCD non ecoule. @@ -440,13 +440,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_STAT_ROOT)) + m_creature->ClearUnitState(UNIT_STAT_ROOT); } else { - if (!m_creature->hasUnitState(UNIT_STAT_ROOT)) - m_creature->addUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) + m_creature->AddUnitState(UNIT_STAT_ROOT); } // SPELL_WHIRLWIND @@ -470,7 +470,7 @@ struct npc_DrekTharAI : public ScriptedAI, public npc_alterac_bossHelper { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKDOWN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKDOWN) == CAST_OK) { m_uiKnockDown_Timer = urand(16000, 24000); m_uiGlobalCooldown = 1000; @@ -588,7 +588,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_STAT_ROOT); if (m_bReset) DoScriptText(SAY_BALINDA_RESET, m_creature); m_bReset = true; @@ -598,7 +598,7 @@ struct npc_BalindaAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if ((pWho->GetDistance(m_creature) < 28.0f) && (m_creature->IsHostileTo(pWho))) @@ -616,7 +616,7 @@ struct npc_BalindaAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetMapId() == 30) @@ -624,7 +624,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_STAT_ROOT); EnterEvadeMode(); return; } @@ -649,16 +649,16 @@ struct npc_BalindaAI : public ScriptedAI m_uiGlobalCooldown = 0; } - 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->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_STAT_ROOT)) + m_creature->ClearUnitState(UNIT_STAT_ROOT); } else { - if (!m_creature->hasUnitState(UNIT_STAT_ROOT)) - m_creature->addUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) + m_creature->AddUnitState(UNIT_STAT_ROOT); } // ARCANE EXPLOSION @@ -667,7 +667,7 @@ struct npc_BalindaAI : public ScriptedAI if (!m_uiGlobalCooldown) { uint32 uiTargetInRangeCount = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { if (ObjectGuid uiTargetGuid = (*i)->getUnitGuid()) @@ -681,7 +681,7 @@ struct npc_BalindaAI : public ScriptedAI } if (urand(0, 1000) > (1000 * (3 / (uiTargetInRangeCount + 1)))) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEEXPLO) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEEXPLO) == CAST_OK) { m_uiArcaneExplo_Timer = urand(6000, 9000); m_uiGlobalCooldown = 1000; @@ -699,9 +699,9 @@ struct npc_BalindaAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (m_creature->getVictim()->GetDistance(m_creature) < 10.0f) + if (m_creature->GetVictim()->GetDistance(m_creature) < 10.0f) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CONEOFCOLD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CONEOFCOLD) == CAST_OK) { m_uiConeOfCold_Timer = urand(12000, 16000); m_uiGlobalCooldown = 1000; @@ -740,9 +740,9 @@ struct npc_BalindaAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (m_creature->getVictim()->GetDistance(m_creature) > 15.0f) + if (m_creature->GetVictim()->GetDistance(m_creature) > 15.0f) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROSTBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROSTBOLT) == CAST_OK) { m_uiFrostbolt_Timer = urand(8000, 12000); m_uiGlobalCooldown = 1000; @@ -760,7 +760,7 @@ struct npc_BalindaAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIREBALL) == CAST_OK) { m_uiFireball_Timer = urand(2500, 3000); m_uiGlobalCooldown = 1000; @@ -837,7 +837,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_STAT_ROOT); if (m_bReset) DoScriptText(SAY_GALVANGAR_RESET, m_creature); m_bReset = true; @@ -847,7 +847,7 @@ struct npc_GalvangarAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if ((pWho->GetDistance(m_creature) < 28.0f) && (m_creature->IsHostileTo(pWho))) @@ -857,7 +857,7 @@ struct npc_GalvangarAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetMapId() == 30) @@ -866,7 +866,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_STAT_ROOT); EnterEvadeMode(); return; } @@ -900,13 +900,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_STAT_ROOT)) + m_creature->ClearUnitState(UNIT_STAT_ROOT); } else { - if (!m_creature->hasUnitState(UNIT_STAT_ROOT)) - m_creature->addUnitState(UNIT_STAT_ROOT); + if (!m_creature->HasUnitState(UNIT_STAT_ROOT)) + m_creature->AddUnitState(UNIT_STAT_ROOT); } // SPELL_WHIRLWIND_GAL @@ -915,7 +915,7 @@ struct npc_GalvangarAI : public ScriptedAI if (!m_uiGlobalCooldown) { uint32 uiTargetInRangeCount = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { if (ObjectGuid uiTargetGuid = (*i)->getUnitGuid()) @@ -929,7 +929,7 @@ struct npc_GalvangarAI : public ScriptedAI } if (urand(0, 1000) > (1000 * (3 / (uiTargetInRangeCount + 1)))) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WHIRLWIND_GAL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WHIRLWIND_GAL) == CAST_OK) { m_uiWhirlwind_Timer = urand(10000, 16000); m_uiIsInWhirlwind_Timer = 2000; @@ -948,7 +948,7 @@ struct npc_GalvangarAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FRIGHTSHOUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FRIGHTSHOUT) == CAST_OK) { m_uiFrighteningShout_Timer = urand(24000, 32000); m_uiGlobalCooldown = 1000; @@ -963,7 +963,7 @@ struct npc_GalvangarAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) { m_uiCleave_Timer = urand(7000, 9000); m_uiGlobalCooldown = 1000; @@ -978,7 +978,7 @@ struct npc_GalvangarAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALSTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALSTRIKE) == CAST_OK) { m_uiMortalStrike_Timer = urand(9000, 13000); m_uiGlobalCooldown = 1000; @@ -1039,12 +1039,12 @@ 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_STAT_ROOT); } void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (pWho->GetDistance(m_creature) < 22.0f && m_creature->IsValidAttackTarget(pWho)) @@ -1077,7 +1077,7 @@ struct npc_WarMasterAI : public ScriptedAI else m_uiIsInWhirlwind_Timer -= diff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // GlobalCD non ecoule. @@ -1092,9 +1092,9 @@ struct npc_WarMasterAI : public ScriptedAI } if (!m_uiIsInWhirlwind_Timer) - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); else - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); // SPELL_WHIRLWIND_WM if (m_uiWhirlwind_Timer < diff) @@ -1233,13 +1233,13 @@ struct npc_AlteracBowmanAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { - if (pWho && !m_creature->getVictim() && m_creature->IsValidAttackTarget(pWho) && TargetWithinShootRange(pWho)) + if (pWho && !m_creature->GetVictim() && m_creature->IsValidAttackTarget(pWho) && TargetWithinShootRange(pWho)) AttackStart(pWho); } void UpdateAI(const uint32 diff) override { - if (!m_creature->IsInEvadeMode() && (!m_creature->getVictim() || !TargetWithinShootRange(m_creature->getVictim()))) + if (!m_creature->IsInEvadeMode() && (!m_creature->GetVictim() || !TargetWithinShootRange(m_creature->GetVictim()))) { if (m_uiReset_Timer < diff) { @@ -1251,14 +1251,14 @@ struct npc_AlteracBowmanAI : public ScriptedAI m_uiReset_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiShoot_Timer < diff) { - if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (!m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT) == CAST_OK) m_uiShoot_Timer = SHOOT_SPEED; } } @@ -1270,7 +1270,7 @@ struct npc_AlteracBowmanAI : public ScriptedAI void GetAIInformation(ChatHandler& reader) override { reader.PSendSysMessage("npc_AlteracBowmanAI::GetAIInformation"); - reader.PSendSysMessage("victim: %s", m_creature->getVictim() ? m_creature->getVictim()->GetName() : "nullptr"); + reader.PSendSysMessage("victim: %s", m_creature->GetVictim() ? m_creature->GetVictim()->GetName() : "nullptr"); reader.PSendSysMessage("evade_mode: %u", m_creature->IsInEvadeMode()); ScriptedAI::GetAIInformation(reader); } @@ -1303,12 +1303,12 @@ struct npc_AlteracDardoshAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCleave_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleave_Timer = 3000; } else @@ -1445,7 +1445,7 @@ struct npc_ram_wolf_tamedAI : public ScriptedAI { EnterEvadeMode(); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); /** Link the tamed creature to the player it shall follow */ m_creature->CastSpell(m_creature, SPELL_TAME_OWNED_BY_PLAYER, true); @@ -1481,7 +1481,7 @@ struct npc_ram_wolf_tamedAI : public ScriptedAI ObjectGuid playerOwner(HIGHGUID_PLAYER, m_creature->AI()->GetData(0)); if (Player* player = m_creature->GetMap()->GetPlayer(playerOwner)) { - if (player->isDead()) + if (player->IsDead()) { /** Make the tamed beast disappears, respawn in 2min30 */ m_creature->SetRespawnDelay(180); @@ -1499,7 +1499,7 @@ struct npc_ram_wolf_tamedAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1575,7 +1575,7 @@ struct RamWolfMasterAI : public ScriptedAI else m_uiCheckTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1747,7 +1747,7 @@ struct AV_NpcEventTroopsAI : public npc_escortAI std::list m_RamRiderList; GetCreatureListWithEntryInGrid(m_RamRiderList, m_creature, commander_id, 200.0f); for (std::list::iterator it = m_RamRiderList.begin(); it != m_RamRiderList.end(); ++it) - if ((*it)->isDead()) + if ((*it)->IsDead()) isLeaderDead = true; m_RamRiderList.clear(); } @@ -1761,7 +1761,7 @@ struct AV_NpcEventTroopsAI : public npc_escortAI leaderDie_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1802,7 +1802,7 @@ class npc_korrak_the_bloodragerAI: public ScriptedAI m_yell = true; } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); } @@ -2566,7 +2566,7 @@ struct AV_NpcEventAI : public npc_escortAI { if (m_uiEntanglingRoots_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ENTANGLING_ROOTS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ENTANGLING_ROOTS) == CAST_OK) m_uiEntanglingRoots_Timer = urand(9000, 13000); } else @@ -2582,7 +2582,7 @@ struct AV_NpcEventAI : public npc_escortAI if (m_uiStarFire_Timer < uiDiff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_STARFIRE, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_STARFIRE, false); m_uiStarFire_Timer = 7000; } else @@ -2593,7 +2593,7 @@ struct AV_NpcEventAI : public npc_escortAI { if (m_uiChainLightning_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) m_uiChainLightning_Timer = urand(15000, 18000); } else @@ -2601,7 +2601,7 @@ struct AV_NpcEventAI : public npc_escortAI if (m_uiFlameShock_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_SHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_SHOCK) == CAST_OK) m_uiFlameShock_Timer = urand(8000, 9000); } else @@ -2609,7 +2609,7 @@ struct AV_NpcEventAI : public npc_escortAI if (m_uiLightningBolt_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_LIGHNING_BOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_LIGHNING_BOLT) == CAST_OK) m_uiLightningBolt_Timer = urand(11000, 12000); } else @@ -2811,7 +2811,7 @@ struct AV_NpcEventAI : public npc_escortAI } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetEntry() == AV_NPC_PRIMALIST_THURLOGA) @@ -3015,7 +3015,7 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GROUND_ASSAULT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + m_challenge + 1); - // if (pCreature->isVendor()) + // if (pCreature->IsVendor()) // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); // pPlayer->SEND_GOSSIP_MENU(6255, pCreature->GetGUID()); @@ -3121,13 +3121,13 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) { if (AV_NpcEventAI* pEscortAI = dynamic_cast(pCreature->AI())) { - pCreature->setFaction(1194); + pCreature->SetFactionTemplateId(1194); pEscortAI->Start(true, 0, nullptr, false); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); pCreature->SetWalk(false); - pCreature->setFaction(pPlayer->getFaction()); + pCreature->SetFactionTemplateId(pPlayer->GetFactionTemplateId()); if (pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } @@ -3148,13 +3148,13 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) if (pCreature->GetEntry() == AV_NPC_ENTRY_VIPORE) pCreature->CastSpell(pCreature, 5759, false); - pCreature->setFaction(1194); + pCreature->SetFactionTemplateId(1194); pEscortAI->Start(true, 0, nullptr, false); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); pCreature->SetWalk(false); - pCreature->setFaction(pPlayer->getFaction()); + pCreature->SetFactionTemplateId(pPlayer->GetFactionTemplateId()); if (pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } @@ -3421,7 +3421,7 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) if (pCreature->GetEntry() == AV_NPC_QUARTERMASTER_A || pCreature->GetEntry() == AV_NPC_QUARTERMASTER) { - if (pCreature->isVendor()) + if (pCreature->IsVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); pPlayer->SEND_GOSSIP_MENU(6255, pCreature->GetGUID()); @@ -3438,11 +3438,11 @@ bool GossipHello_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature) pCreature->HandleEmote(EMOTE_ONESHOT_BOW); return true; } - else if (pCreature->isQuestGiver()) + else if (pCreature->IsQuestGiver()) { if (pCreature->GetEntry() == AV_NPC_QUARTERMASTER_A || pCreature->GetEntry() == AV_NPC_QUARTERMASTER) { - if (pCreature->isVendor()) + if (pCreature->IsVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); pPlayer->SEND_GOSSIP_MENU(6255, pCreature->GetGUID()); @@ -3645,7 +3645,7 @@ struct AV_npc_troops_chief_EventAI : public npc_escortAI else Event_Timer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -3916,7 +3916,7 @@ bool GossipSelect_npc_AVBlood_collector(Player* pPlayer, Creature* pCreature, ui if (AV_NpcEventAI* pEscortAI = dynamic_cast(pCreature->AI())) { pEscortAI->Start(true, 0, nullptr, false); - //pCreature->setFaction(pPlayer->getFaction()); + //pCreature->SetFactionTemplateId(pPlayer->GetFactionTemplateId()); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); @@ -4121,7 +4121,7 @@ struct AV_WarRiderAI : public ScriptedAI /** Patrol moving in circle from the spawn position */ - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { // Find new target if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != HOME_MOTION_TYPE) @@ -4130,11 +4130,11 @@ struct AV_WarRiderAI : public ScriptedAI return; } - if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 30.0f)) + if (m_creature->IsWithinDistInMap(m_creature->GetVictim(), 30.0f)) { if (m_uiFireball_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AV_FIREBALL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AV_FIREBALL) == CAST_OK) m_uiFireball_Timer = 5000; } else @@ -4142,7 +4142,7 @@ struct AV_WarRiderAI : public ScriptedAI if (m_uiFireballVolley_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AV_FIREBALL_VOLLEY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AV_FIREBALL_VOLLEY) == CAST_OK) m_uiFireballVolley_Timer = 7500; } else @@ -4150,7 +4150,7 @@ struct AV_WarRiderAI : public ScriptedAI if (m_uiStunBombAttack_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AV_STUN_BOMB_ATTACK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AV_STUN_BOMB_ATTACK) == CAST_OK) m_uiStunBombAttack_Timer = 9000; } else @@ -4358,7 +4358,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { - if (i->getSource()->isAlive()) + if (i->getSource()->IsAlive()) i->getSource()->RemoveAurasDueToSpell(11206); } @@ -4484,12 +4484,12 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai m_uiEngageTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiBlizzardTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_BLIZZARD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_BLIZZARD) == CAST_OK) m_uiBlizzardTimer = urand(10000, 12000); } else @@ -4497,7 +4497,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiFrostBoltTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_FROSTBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_FROSTBOLT) == CAST_OK) m_uiFrostBoltTimer = urand(4500, 6500); } else @@ -4505,7 +4505,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiFrostNovaTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_FROSTNOVA) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_FROSTNOVA) == CAST_OK) m_uiFrostNovaTimer = urand(8000, 12000); } else @@ -4513,7 +4513,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiFrostShockTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_FROSTSHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_FROSTSHOCK) == CAST_OK) m_uiFrostShockTimer = urand(3000, 5000); } else @@ -4521,7 +4521,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiIceBlastTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_ICEBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_ICEBLAST) == CAST_OK) m_uiIceBlastTimer = urand(10000, 12000); } else @@ -4529,7 +4529,7 @@ struct AV_NpcEventWorldBoss_H_AI : public av_world_boss_baseai if (m_uiIceTombTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_ICETOMB) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_ICETOMB) == CAST_OK) m_uiIceTombTimer = urand(8000, 12000); } else @@ -4568,7 +4568,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { - if (i->getSource()->isAlive()) + if (i->getSource()->IsAlive()) i->getSource()->RemoveAurasDueToSpell(11206); } @@ -4665,7 +4665,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai m_uiEngageTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiRootsTimer < uiDiff) @@ -4678,7 +4678,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai if (m_uiFaerieFireTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_FAERIEFIRE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_FAERIEFIRE) == CAST_OK) m_uiFaerieFireTimer = urand(3000, 7000); } else @@ -4686,7 +4686,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai if (m_uiMoonFireTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_MOONFIRE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_MOONFIRE) == CAST_OK) m_uiMoonFireTimer = urand(8000, 12000); } else @@ -4694,7 +4694,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai if (m_uiStarFireTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_STARFIRE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_STARFIRE) == CAST_OK) m_uiStarFireTimer = urand(3000, 7000); } else @@ -4702,7 +4702,7 @@ struct AV_NpcEventWorldBoss_A_AI : public av_world_boss_baseai if (m_uiWrathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WB_WRATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WB_WRATH) == CAST_OK) m_uiWrathTimer = urand(1000, 3000); } else @@ -4782,7 +4782,7 @@ struct AV_CommanderAI : public ScriptedAI break; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -4861,7 +4861,7 @@ struct AV_DismountAI : public ScriptedAI break; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -4922,12 +4922,12 @@ struct FrostwolfShamanAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFrostShock_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_SHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROST_SHOCK) == CAST_OK) m_uiFrostShock_Timer = urand(5000, 6000); } else @@ -5003,12 +5003,12 @@ struct DruidOfTheGroveAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiEntanglingRoots_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ENTANGLING_ROOTS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ENTANGLING_ROOTS) == CAST_OK) m_uiEntanglingRoots_Timer = urand(9000, 13000); } else @@ -5016,7 +5016,7 @@ struct DruidOfTheGroveAI : public ScriptedAI if (m_uiStarFire_Timer < uiDiff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_STARFIRE, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_STARFIRE, false); m_uiStarFire_Timer = urand(7000, 9500); } else @@ -5366,7 +5366,7 @@ struct MineNPC_AI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; /* A druid in changeform is also condisered as a pet. @@ -5414,7 +5414,7 @@ struct MineNPC_AI : public ScriptedAI Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); if (target) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BOMB); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BOMB); m_uiBomb_Timer = 7500; } } @@ -5471,7 +5471,7 @@ struct AV_mineNpcAI : public ScriptedAI return 0; BattleGroundAV* bgAv = dynamic_cast(((BattleGroundMap*)m)->GetBG()); uint32 m_factionId; - if (m_creature->getFaction() == 85) + if (m_creature->GetFactionTemplateId() == 85) m_factionId = 1; else m_factionId = 0; @@ -5599,7 +5599,7 @@ struct AV_mineNpcAI : public ScriptedAI if (m_newEntry != 0 && m_creature->GetEntry() != m_newEntry) m_creature->UpdateEntry(m_newEntry); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/custom/boss_arena_hardog.cpp b/src/scripts/custom/boss_arena_hardog.cpp index ef037b6fa..8b0da716b 100644 --- a/src/scripts/custom/boss_arena_hardog.cpp +++ b/src/scripts/custom/boss_arena_hardog.cpp @@ -236,7 +236,7 @@ struct arena_szerelmesAI : public ScriptedAI void Aggro(Unit* pPlayer) override { add_Timer = 1000; - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FAIL); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FAIL); } void JustDied(Unit* Victim) override @@ -247,12 +247,12 @@ struct arena_szerelmesAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (Pummel_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PUMMEL) == CAST_OK) Pummel_Timer = 12000; } else @@ -260,7 +260,7 @@ struct arena_szerelmesAI : public ScriptedAI if (KnockAway_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKAWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKAWAY) == CAST_OK) KnockAway_Timer = 14000; } else @@ -269,7 +269,7 @@ struct arena_szerelmesAI : public ScriptedAI /* enlevé car trop dure! if (Shoot_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(),SPELL_SHOOT); + DoCastSpellIfCan(m_creature->GetVictim(),SPELL_SHOOT); Shoot_Timer = 2000; } else @@ -420,7 +420,7 @@ struct npc_karlekAI : public ScriptedAI ResetEvent(); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/custom/custom_creatures.cpp b/src/scripts/custom/custom_creatures.cpp index cc614ef7f..e183affbe 100644 --- a/src/scripts/custom/custom_creatures.cpp +++ b/src/scripts/custom/custom_creatures.cpp @@ -803,7 +803,7 @@ bool GossipSelect_EnchantNPC(Player* player, Creature* creature, uint32 sender, void LearnSkillRecipesHelper(Player *player, uint32 skill_id) { - uint32 classmask = player->getClassMask(); + uint32 classmask = player->GetClassMask(); for (uint32 j = 0; j < sObjectMgr.GetMaxSkillLineAbilityId(); ++j) { @@ -1005,7 +1005,7 @@ struct npc_training_dummyAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) { if (m_uiCombatTimer <= diff) { @@ -1021,14 +1021,14 @@ struct npc_training_dummyAI : ScriptedAI if (itr->second + 10 < std::time(nullptr)) { m_creature->_removeAttacker(pAttacker); - m_creature->getThreatManager().modifyThreatPercent(pAttacker, -101.0f); + m_creature->GetThreatManager().modifyThreatPercent(pAttacker, -101.0f); itr = attackers.erase(itr); continue; } ++itr; } - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) EnterEvadeMode(); m_uiCombatTimer = 15000; @@ -1079,7 +1079,7 @@ struct npc_summon_debugAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) return; if (m_summonCount >= m_maxSummonCount) diff --git a/src/scripts/custom/event_attack_city.cpp b/src/scripts/custom/event_attack_city.cpp index 9c9954b68..b10ba6e1a 100644 --- a/src/scripts/custom/event_attack_city.cpp +++ b/src/scripts/custom/event_attack_city.cpp @@ -230,7 +230,7 @@ struct npc_attack_masterAI : public ScriptedAI { if (Unit* invoc = Unit::GetUnit(*ME, *itr)) { - if (invoc->isAlive()) + if (invoc->IsAlive()) { ++num; SetAttackable(invoc, false); @@ -339,7 +339,7 @@ struct npc_attack_masterAI : public ScriptedAI { if (Unit* waveMob = Unit::GetUnit(*ME, *it)) { - if (waveMob->isAlive()) + if (waveMob->IsAlive()) { if (!waveMob->HasAura(SPELL_AURA_RED)) { @@ -651,7 +651,7 @@ struct npc_event_wave_mobAI : public ScriptedAI void DoCastRandomSpell() { uint32 randEntry = m_lSpells[ urand(0, m_lSpells.size() - 1) ]; - ME->CastSpell(ME->getVictim(), randEntry, false); + ME->CastSpell(ME->GetVictim(), randEntry, false); } void DoSpawnRandomGobj() { @@ -733,9 +733,9 @@ struct npc_event_wave_mobAI : public ScriptedAI for (std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) { uint32 currVictimQuality = 0; - if ((*iter)->getFaction() == ME->getFaction()) + if ((*iter)->GetFactionTemplateId() == ME->GetFactionTemplateId()) continue; - if (!(*iter)->isAlive()) + if (!(*iter)->IsAlive()) continue; uint32 entry = (*iter)->GetEntry(); if (entry == NPC_BOSS_CAPITAL_ADD1 || entry == NPC_BOSS_CAPITAL_ADD2 @@ -753,8 +753,8 @@ struct npc_event_wave_mobAI : public ScriptedAI if ((*iter)->GetDistance2d(ME) <= nearest->GetDistance2d(ME)) currVictimQuality += 0x2; // Autre priorite : le niveau - if ((*iter)->getLevel() > 50) - currVictimQuality += ((*iter)->getLevel() - 50); + if ((*iter)->GetLevel() > 50) + currVictimQuality += ((*iter)->GetLevel() - 50); if (currVictimQuality > quality) { quality = currVictimQuality; @@ -768,7 +768,7 @@ struct npc_event_wave_mobAI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (ME->IsStopped() && !ME->getVictim()) + if (ME->IsStopped() && !ME->GetVictim()) { if (Unit* newTarget = GetRandomNearUnitToAttack()) AttackStart(newTarget); @@ -964,7 +964,7 @@ struct npc_guard_masterAI : public ScriptedAI { if (Unit* crea = Unit::GetUnit(*ME, *itr)) { - if (crea->isAlive()) + if (crea->IsAlive()) ((Creature*)crea)->AI()->AttackStart(crea); } } @@ -975,7 +975,7 @@ struct npc_guard_masterAI : public ScriptedAI { if (Unit* crea = Unit::GetUnit(*ME, *itr)) { - if (crea->isAlive()) + if (crea->IsAlive()) ((Creature*)crea)->MonsterSay(what, 0, 0); } } diff --git a/src/scripts/custom/gmisland.cpp b/src/scripts/custom/gmisland.cpp index ac4a4046d..ed6d8cfd9 100644 --- a/src/scripts/custom/gmisland.cpp +++ b/src/scripts/custom/gmisland.cpp @@ -93,7 +93,7 @@ struct boss_gmislandAI : public ScriptedAI { uiGeneralTimer += uiDiff; uiGmRefreshTimer += uiDiff; - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { Reset(); if ((uiGeneralTimer - uiLastFusee) > 4000) @@ -135,9 +135,9 @@ struct boss_gmislandAI : public ScriptedAI m_creature->MonsterSay("Vous ne derangerez pas les MJs : ils sont en reunion !", LANG_UNIVERSAL, 0); break; case 4: - if (Unit* mort = m_creature->getVictim()) + if (Unit* mort = m_creature->GetVictim()) { - if (mort->isAlive()) + if (mort->IsAlive()) { // "Presque" mort :p mort->DealDamage(mort, mort->GetHealth() - 50, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); @@ -148,9 +148,9 @@ struct boss_gmislandAI : public ScriptedAI /* // Trop mechant case 9: - if(Unit* pauvreVictime = m_creature->getVictim()) + if(Unit* pauvreVictime = m_creature->GetVictim()) { - if(pauvreVictime->GetTypeId() == TYPEID_PLAYER && pauvreVictime->isAlive()) + if(pauvreVictime->GetTypeId() == TYPEID_PLAYER && pauvreVictime->IsAlive()) { // Mais qui retirera ce "setConfused" ... ? :P pauvreVictime->SetConfused(true, m_creature->GetGUID(), 5); diff --git a/src/scripts/custom/npc_escort.cpp b/src/scripts/custom/npc_escort.cpp index ec628af1d..2d68ae504 100644 --- a/src/scripts/custom/npc_escort.cpp +++ b/src/scripts/custom/npc_escort.cpp @@ -96,7 +96,7 @@ struct npc_escort_genericAI : public npc_escortAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); - m_creature->setFaction(m_pEscortData->uiEscortFaction); + m_creature->SetFactionTemplateId(m_pEscortData->uiEscortFaction); } void OnQuestAccept(Player* pPlayer, const Quest* pQuest) { @@ -115,7 +115,7 @@ struct npc_escort_genericAI : public npc_escortAI if (!m_pEscortData) return; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasEscortState(STATE_ESCORT_PAUSED)) SetEscortPaused(false); diff --git a/src/scripts/custom/npc_j_eevee.cpp b/src/scripts/custom/npc_j_eevee.cpp index 3fec8b2b9..8ffce8da1 100644 --- a/src/scripts/custom/npc_j_eevee.cpp +++ b/src/scripts/custom/npc_j_eevee.cpp @@ -39,7 +39,7 @@ npc_j_eevee_dreadsteedAI::npc_j_eevee_dreadsteedAI(Creature* pCreature) : Script { //m_pInstance = (instance_dire_maul*) pCreature->GetInstanceData(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); - m_creature->setFaction(35); //friendly to everyone + m_creature->SetFactionTemplateId(35); //friendly to everyone m_creature->SetWalk(true); Reset(); } @@ -77,7 +77,7 @@ void npc_j_eevee_dreadsteedAI::MovementInform(uint32 uiType, uint32 uiPointId) } void npc_j_eevee_dreadsteedAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (waypointReached) { @@ -148,7 +148,7 @@ npc_j_eevee_scholomanceAI::npc_j_eevee_scholomanceAI(Creature* pCreature) : Scri if (Player *player = m_creature->GetMap()->GetPlayer(guidPlayer)) { player->HandleEmote(EMOTE_ONESHOT_KNEEL); - m_creature->setFaction(player->getFaction()); // player faction, friendly to player but hostile to other mobs + m_creature->SetFactionTemplateId(player->GetFactionTemplateId()); // player faction, friendly to player but hostile to other mobs } } @@ -197,7 +197,7 @@ void npc_j_eevee_scholomanceAI::MovementInform(uint32 uiType, uint32 uiPointId) void npc_j_eevee_scholomanceAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (waypointReached || finished) { diff --git a/src/scripts/custom/zero_creatures.cpp b/src/scripts/custom/zero_creatures.cpp index 3e238a5f4..3fc5d94b6 100644 --- a/src/scripts/custom/zero_creatures.cpp +++ b/src/scripts/custom/zero_creatures.cpp @@ -140,7 +140,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (Razor_Phase_1 == 1) @@ -179,7 +179,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI //Cleave_Timer if (Cleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); Cleave_Timer = urand(7000, 10000); } else Cleave_Timer -= diff; @@ -188,7 +188,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI //WarStomp_Timer if (WarStomp_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_WARSTOMP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WARSTOMP); WarStomp_Timer = urand(15000, 25000); } else WarStomp_Timer -= diff; @@ -197,7 +197,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI //FireballVolley_Timer if (FireballVolley_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALLVOLLEY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIREBALLVOLLEY); FireballVolley_Timer = urand(12000, 15000); } else FireballVolley_Timer -= diff; @@ -205,14 +205,14 @@ struct Zero_boss_razorgoreAI : public ScriptedAI //Conflagration_Timer if (Conflagration_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CONFLAGRATION); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CONFLAGRATION); Conflagration_Timer = 12000; } else Conflagration_Timer -= diff; // Aura Check. If the gamer is affected by confliguration we attack a random gamer. - if (m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION, EFFECT_INDEX_0)) + if (m_creature->GetVictim()->HasAura(SPELL_CONFLAGRATION, EFFECT_INDEX_0)) { Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); @@ -327,7 +327,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI if (target && Spawned) { Spawned->AI()->AttackStart(target); - Spawned->setFaction(103); + Spawned->SetFactionTemplateId(103); } ++SpawnedAdds; @@ -341,7 +341,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI if (target && Spawned) { Spawned->AI()->AttackStart(target); - Spawned->setFaction(103); + Spawned->SetFactionTemplateId(103); } @@ -356,7 +356,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI if (target && Spawned) { Spawned->AI()->AttackStart(target); - Spawned->setFaction(103); + Spawned->SetFactionTemplateId(103); } @@ -371,7 +371,7 @@ struct Zero_boss_razorgoreAI : public ScriptedAI if (target && Spawned) { Spawned->AI()->AttackStart(target); - Spawned->setFaction(103); + Spawned->SetFactionTemplateId(103); } Despawn_Timer = Despawn_Timer - 15000; AddSpawnTimer = 15000; @@ -416,7 +416,7 @@ struct Mob_Grethok_The_ControllerAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Greater Polymorph diff --git a/src/scripts/eastern_kingdoms/arathi_highlands/arathi_highlands.cpp b/src/scripts/eastern_kingdoms/arathi_highlands/arathi_highlands.cpp index 4c9436cb1..62949aff6 100644 --- a/src/scripts/eastern_kingdoms/arathi_highlands/arathi_highlands.cpp +++ b/src/scripts/eastern_kingdoms/arathi_highlands/arathi_highlands.cpp @@ -112,7 +112,7 @@ bool QuestAccept_npc_professor_phizzlethorpe(Player* pPlayer, Creature* pCreatur { if (pQuest->GetQuestId() == QUEST_SUNKEN_TREASURE) { - pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_N_NEUTRAL_PASSIVE); DoScriptText(SAY_PROGRESS_1, pCreature, pPlayer); if (npc_professor_phizzlethorpeAI* pEscortAI = dynamic_cast(pCreature->AI())) @@ -400,7 +400,7 @@ struct npc_kineloryAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiBearFormTimer < uiDiff) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/arena_challenge_ai.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/arena_challenge_ai.cpp index 50e29742e..4b2b29772 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/arena_challenge_ai.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/arena_challenge_ai.cpp @@ -70,7 +70,7 @@ struct npc_theldrenAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiInterceptTimer < diff) @@ -85,7 +85,7 @@ struct npc_theldrenAI : public ScriptedAI if (m_uiMortalStrikeTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THELDREN_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THELDREN_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrikeTimer = urand(8000, 15000); } else @@ -93,7 +93,7 @@ struct npc_theldrenAI : public ScriptedAI if (m_uiFearTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THELDREN_INTIMIDATING_SHOUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THELDREN_INTIMIDATING_SHOUT) == CAST_OK) m_uiFearTimer = urand(30000, 40000); } else @@ -160,7 +160,7 @@ struct npc_va_jashniAI : public ScriptedAI else m_uiRenewTimer -= diff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -192,7 +192,7 @@ struct npc_korvAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFrostShockTimer < diff) @@ -247,12 +247,12 @@ struct npc_leftyAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFiveFingerTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_LEFTY_FIVE_FAT_FINGERS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_LEFTY_FIVE_FAT_FINGERS) == CAST_OK) m_uiFiveFingerTimer = urand(2000, 3000); } else @@ -289,12 +289,12 @@ struct npc_snokh_blackspineAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiPyroblastTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SNOKH_BLACKSPINE_PYROBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SNOKH_BLACKSPINE_PYROBLAST) == CAST_OK) m_uiPyroblastTimer = urand(10000, 20000); } else @@ -302,7 +302,7 @@ struct npc_snokh_blackspineAI : public ScriptedAI if (m_uiScorchTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SNOKH_BLACKSPINE_SCORCH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SNOKH_BLACKSPINE_SCORCH) == CAST_OK) m_uiScorchTimer = urand(3000, 5000); } else @@ -355,7 +355,7 @@ struct npc_volidaAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiBlizzardTimer < diff) @@ -370,7 +370,7 @@ struct npc_volidaAI : public ScriptedAI if (m_uiConeOfColdTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_VOLIDA_CONEOFCOLD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VOLIDA_CONEOFCOLD) == CAST_OK) m_uiConeOfColdTimer = 20000; } else @@ -435,7 +435,7 @@ struct npc_malgen_longspearAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_bIsFeigned && (!m_creature->SelectHostileTarget() || !m_creature->getVictim())) + if (!m_bIsFeigned && (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())) return; if (m_uiFeignDeathTimer < diff) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp index cf7962d93..a8f56b5ad 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/blackrock_depths.cpp @@ -317,7 +317,7 @@ struct npc_grimstoneAI : public npc_escortAI if (RingBossGUID) { Creature *boss = m_creature->GetMap()->GetCreature(RingBossGUID); - if (boss && !boss->isAlive() && boss->isDead()) + if (boss && !boss->IsAlive() && boss->IsDead()) { RingBossGUID = 0; Event_Timer = 5000; @@ -333,7 +333,7 @@ struct npc_grimstoneAI : public npc_escortAI for (uint8 i = 0; i < 4; ++i) { Creature *mob = m_creature->GetMap()->GetCreature(ChallengeMobGUID[i]); - if (mob && !mob->isAlive() && mob->isDead()) + if (mob && !mob->IsAlive() && mob->IsDead()) { ChallengeMobGUID[i] = 0; --MobCount; @@ -346,7 +346,7 @@ struct npc_grimstoneAI : public npc_escortAI for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { Creature *mob = m_creature->GetMap()->GetCreature(RingMobGUID[i]); - if (mob && !mob->isAlive() && mob->isDead()) + if (mob && !mob->IsAlive() && mob->IsDead()) { RingMobGUID[i] = 0; --MobCount; @@ -476,7 +476,7 @@ struct npc_grimstoneAI : public npc_escortAI { Player *player = itr->getSource(); - if (player && player->IsWithinDistInMap(m_creature, 80.0f) && player->isInCombat()) { + if (player && player->IsWithinDistInMap(m_creature, 80.0f) && player->IsInCombat()) { wiped = false; break; } @@ -606,7 +606,7 @@ struct mob_phalanxAI : public ScriptedAI DoScriptText(YELL_PHALANX_AGGRO, m_creature); m_creature->SetHomePosition(868.122f, -223.884f, -43.695f, m_fKeepDoorOrientation); m_creature->GetMotionMaster()->MovePoint(0, 865.555f, -219.056f, -43.70f); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_bActivated = true; } @@ -635,13 +635,13 @@ struct mob_phalanxAI : public ScriptedAI m_uiCallPatrolTimer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ThunderClap_Timer if (ThunderClap_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCLAP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCLAP); ThunderClap_Timer = 10000; } else ThunderClap_Timer -= diff; @@ -651,7 +651,7 @@ struct mob_phalanxAI : public ScriptedAI { if (FireballVolley_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALLVOLLEY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIREBALLVOLLEY); FireballVolley_Timer = 15000; } else FireballVolley_Timer -= diff; @@ -660,7 +660,7 @@ struct mob_phalanxAI : public ScriptedAI //MightyBlow_Timer if (MightyBlow_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIGHTYBLOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIGHTYBLOW); MightyBlow_Timer = 10000; } else MightyBlow_Timer -= diff; @@ -695,7 +695,7 @@ CreatureAI* GetAI_mob_phalanx(Creature* pCreature) bool GossipHello_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) @@ -774,10 +774,10 @@ bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, u bool GossipHello_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) + if (pCreature->IsVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && @@ -931,7 +931,7 @@ struct npc_mistress_nagmaraAI : public ScriptedAI bool GossipHello_npc_mistress_nagmara(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid()); if (pPlayer->GetQuestRewardStatus(QUEST_POTION_LOVE)) @@ -1166,7 +1166,7 @@ struct npc_rocknotAI : public npc_escortAI if (Unit *pPhalanx = m_creature->GetMap()->GetUnit(m_pInstance->GetData64(DATA_PHALANX))) { if (mob_phalanxAI* pPhalanxAI = dynamic_cast (pPhalanx->AI())) - if (pPhalanx->isAlive()) + if (pPhalanx->IsAlive()) pPhalanxAI->Activate(); } m_pInstance->SetData(TYPE_ROCKNOT, DONE); @@ -1409,12 +1409,12 @@ struct npc_hurley_blackbreathAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (uiFlameBreathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BREATH) == CAST_OK) uiFlameBreathTimer = urand(8000, 12000); } else @@ -1513,7 +1513,7 @@ struct npc_watchman_doomgripAI : public ScriptedAI { for (std::list::iterator itr = m_lGolems.begin(); itr != m_lGolems.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) { (*itr)->RemoveAurasDueToSpell(10255); (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE); @@ -1526,7 +1526,7 @@ struct npc_watchman_doomgripAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //BoireLaPotionDeSoins_Timer @@ -1534,7 +1534,7 @@ struct npc_watchman_doomgripAI : public ScriptedAI { if (BoireLaPotionDeSoins_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BOIRE_LA_POTION_DE_SOINS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BOIRE_LA_POTION_DE_SOINS); BoireLaPotionDeSoins_Timer = 15000; } else BoireLaPotionDeSoins_Timer -= diff; @@ -1543,7 +1543,7 @@ struct npc_watchman_doomgripAI : public ScriptedAI //FracasserArmure_Timer if (FracasserArmure_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FRACASSER_ARMURE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FRACASSER_ARMURE); FracasserArmure_Timer = 10000; } else FracasserArmure_Timer -= diff; @@ -1591,13 +1591,13 @@ struct npc_ribbly_fermevanneAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //BiseGenou_Timer if (BiseGenou_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BRISE_GENOU); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BRISE_GENOU); BiseGenou_Timer = urand(9000, 15000); } else BiseGenou_Timer -= diff; @@ -1605,7 +1605,7 @@ struct npc_ribbly_fermevanneAI : public ScriptedAI //Suriner_Timer if (Suriner_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SURINER); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SURINER); Suriner_Timer = urand(9000, 12000); } else Suriner_Timer -= diff; @@ -1635,7 +1635,7 @@ bool GossipSelect_npc_ribbly_fermevanne(Player* pPlayer, Creature* pCreature, ui { pPlayer->CLOSE_GOSSIP_MENU(); pCreature->MonsterYell(4973, 0, pPlayer); - pCreature->setFaction(14); + pCreature->SetFactionTemplateId(14); pCreature->AI()->AttackStart(pPlayer); if (ScriptedInstance* pInstance = (ScriptedInstance*)pCreature->GetInstanceData()) @@ -1692,7 +1692,7 @@ struct npc_golem_lord_argelmachAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //BouclierDeFoudre_Timer @@ -1707,7 +1707,7 @@ struct npc_golem_lord_argelmachAI : public ScriptedAI //ChaineDEclaires_Timer if (ChaineDEclaires_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAINE_D_ECLAIRES) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAINE_D_ECLAIRES) == CAST_OK) ChaineDEclaires_Timer = 14000; } else ChaineDEclaires_Timer -= diff; @@ -1715,7 +1715,7 @@ struct npc_golem_lord_argelmachAI : public ScriptedAI //Horion_Timer if (Horion_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_HORION) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HORION) == CAST_OK) Horion_Timer = 6000; } else Horion_Timer -= diff; @@ -1750,7 +1750,7 @@ bool AreaTrigger_at_shadowforge_bridge(Player* pPlayer, AreaTriggerEntry const* { if (ScriptedInstance* pInstance = (ScriptedInstance*)pPlayer->GetInstanceData()) { - if (pPlayer->IsGameMaster() || !pPlayer->isAlive() || pInstance->GetData(TYPE_BRIDGE) == DONE) + if (pPlayer->IsGameMaster() || !pPlayer->IsAlive() || pInstance->GetData(TYPE_BRIDGE) == DONE) return false; if (Creature* pMasterGuard = pPlayer->SummonCreature(NPC_ANVILRAGE_GUARDMAN, aGuardSpawnPositions[0][0], aGuardSpawnPositions[0][1], aGuardSpawnPositions[0][2], aGuardSpawnPositions[0][3], TEMPSUMMON_DEAD_DESPAWN, 0)) @@ -1854,7 +1854,7 @@ struct boss_plugger_spazzringAI : public ScriptedAI if (Unit *pPhalanx = m_creature->GetMap()->GetUnit(m_pInstance->GetData64(DATA_PHALANX))) { if (mob_phalanxAI* pPhalanxAI = dynamic_cast (pPhalanx->AI())) - if (pPhalanx->isAlive()) + if (pPhalanx->IsAlive()) pPhalanxAI->Activate(); } } @@ -1890,7 +1890,7 @@ struct boss_plugger_spazzringAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Combat check - if (m_creature->SelectHostileTarget() && m_creature->getVictim()) + if (m_creature->SelectHostileTarget() && m_creature->GetVictim()) { if (m_uiBanishTimer < uiDiff) { @@ -1905,7 +1905,7 @@ struct boss_plugger_spazzringAI : public ScriptedAI if (m_uiImmolateTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_IMMOLATE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_IMMOLATE) == CAST_OK) m_uiImmolateTimer = 25000; } else @@ -1913,7 +1913,7 @@ struct boss_plugger_spazzringAI : public ScriptedAI if (m_uiShadowBoltTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_BOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_BOLT) == CAST_OK) m_uiShadowBoltTimer = urand(36, 63) * 100; } else @@ -2290,17 +2290,17 @@ struct npc_marshal_reginald_windsorAI : npc_escortAI { Creature* pJaz = m_pInstance->instance->GetCreature(m_pInstance->GetData64(NPC_JAZ)); Creature* pOgrabisi = m_pInstance->instance->GetCreature(m_pInstance->GetData64(NPC_OGRABISI)); - if (pJaz && pOgrabisi && pJaz->isAlive() && pOgrabisi->isAlive() && m_pInstance->GetData(GO_JAIL_DOOR_JAZ) && !m_bEncounterStarted) + if (pJaz && pOgrabisi && pJaz->IsAlive() && pOgrabisi->IsAlive() && m_pInstance->GetData(GO_JAIL_DOOR_JAZ) && !m_bEncounterStarted) { - pJaz->setFaction(54); + pJaz->SetFactionTemplateId(54); pJaz->AI()->AttackStart(m_creature); - pOgrabisi->setFaction(54); + pOgrabisi->SetFactionTemplateId(54); pOgrabisi->AI()->AttackStart(m_creature); m_pInstance->SetData(GO_JAIL_DOOR_JAZ, false); DoScriptText(SAY_OGRABISI, pOgrabisi); m_bEncounterStarted = true; } - if (pJaz && pOgrabisi && pJaz->isDead() && pOgrabisi->isDead()) + if (pJaz && pOgrabisi && pJaz->IsDead() && pOgrabisi->IsDead()) { SetEscortPaused(false); m_bEncounterStarted = false; @@ -2310,15 +2310,15 @@ struct npc_marshal_reginald_windsorAI : npc_escortAI case 11: { Creature* pShill = m_pInstance->instance->GetCreature(m_pInstance->GetData64(NPC_SHILL)); - if (pShill && pShill->isAlive() && m_pInstance->GetData(GO_JAIL_DOOR_SHILL) && !m_bEncounterStarted) + if (pShill && pShill->IsAlive() && m_pInstance->GetData(GO_JAIL_DOOR_SHILL) && !m_bEncounterStarted) { - pShill->setFaction(54); + pShill->SetFactionTemplateId(54); pShill->AI()->AttackStart(m_creature); m_pInstance->SetData(GO_JAIL_DOOR_SHILL, false); DoScriptText(SAY_SHILL_DINGER, pShill); m_bEncounterStarted = true; } - if (pShill && pShill->isDead()) + if (pShill && pShill->IsDead()) { SetEscortPaused(false); m_bEncounterStarted = false; @@ -2328,14 +2328,14 @@ struct npc_marshal_reginald_windsorAI : npc_escortAI case 20: { Creature* pCrest = m_pInstance->instance->GetCreature(m_pInstance->GetData64(NPC_CREST)); - if (pCrest && pCrest->isAlive() && m_pInstance->GetData(GO_JAIL_DOOR_CREST) && !m_bEncounterStarted) + if (pCrest && pCrest->IsAlive() && m_pInstance->GetData(GO_JAIL_DOOR_CREST) && !m_bEncounterStarted) { - pCrest->setFaction(54); + pCrest->SetFactionTemplateId(54); pCrest->AI()->AttackStart(m_creature); m_pInstance->SetData(GO_JAIL_DOOR_CREST, false); m_bEncounterStarted = true; } - if (pCrest && pCrest->isDead()) + if (pCrest && pCrest->IsDead()) { SetEscortPaused(false); m_bEncounterStarted = false; @@ -2434,7 +2434,7 @@ struct npc_marshal_windsorAI : npc_escortAI { if (auto pEscortAI = dynamic_cast(pTemp->AI())) { - pTemp->setFaction(11); + pTemp->SetFactionTemplateId(11); m_pInstance->SetData(TYPE_JAIL_SUPPLY_ROOM, DONE); pEscortAI->Start(false, GetPlayerForEscort()->GetObjectGuid()); } @@ -2498,7 +2498,7 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, const if (pInstance->GetData(TYPE_QUEST_JAIL_BREAK) == NOT_STARTED) { pInstance->SetData(TYPE_QUEST_JAIL_BREAK, IN_PROGRESS); - pCreature->setFaction(11); + pCreature->SetFactionTemplateId(11); if (auto pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(false, pPlayer->GetObjectGuid(), pQuest); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_ambassador_flamelash.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_ambassador_flamelash.cpp index f345a1def..abafe17d1 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_ambassador_flamelash.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_ambassador_flamelash.cpp @@ -109,14 +109,14 @@ struct boss_ambassador_flamelashAI : public ScriptedAI { ScriptedAI::MoveInLineOfSight(pWho); - if (pWho->GetEntry() == NPC_BURNING_SPIRIT && pWho->isAlive() && !pWho->isInCombat() && pWho->IsWithinDistInMap(m_creature, 4 * CONTACT_DISTANCE)) + if (pWho->GetEntry() == NPC_BURNING_SPIRIT && pWho->IsAlive() && !pWho->IsInCombat() && pWho->IsWithinDistInMap(m_creature, 4 * CONTACT_DISTANCE)) pWho->CastSpell(m_creature, SPELL_BURNING_SPIRIT, true); } void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Burning Spirit diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp index bedba6c5b..99f7c25bd 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_anubshiah.cpp @@ -54,13 +54,13 @@ struct boss_anubshiahAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLT); ShadowBolt_Timer = 7000; } else ShadowBolt_Timer -= diff; @@ -78,7 +78,7 @@ struct boss_anubshiahAI : public ScriptedAI //CurseOfWeakness_Timer if (CurseOfWeakness_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFWEAKNESS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFWEAKNESS); CurseOfWeakness_Timer = 45000; } else CurseOfWeakness_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_emperor_dagran_thaurissan.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_emperor_dagran_thaurissan.cpp index d65c4c64d..e0a8662e3 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_emperor_dagran_thaurissan.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_emperor_dagran_thaurissan.cpp @@ -71,9 +71,9 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI if (Creature* pPrincess = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_PRINCESS))) { - if (pPrincess->isAlive()) + if (pPrincess->IsAlive()) { - pPrincess->setFaction(FACTION_NEUTRAL); + pPrincess->SetFactionTemplateId(FACTION_NEUTRAL); pPrincess->AI()->EnterEvadeMode(); } } @@ -86,14 +86,14 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiHandOfThaurissan_Timer < uiDiff) { if (m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, nullptr, SELECT_FLAG_PLAYER)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_HANDOFTHAURISSAN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HANDOFTHAURISSAN) == CAST_OK) m_uiHandOfThaurissan_Timer = urand(10000, 15000); } } @@ -119,7 +119,7 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI /* if (m_uiIronfoeTimer < uiDiff) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) if (DoCastSpellIfCan(m_creature, SPELL_IRONFOE) == CAST_OK) m_uiIronfoeTimer = urand(20000, 25000); } @@ -182,7 +182,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI if (Creature* pEmperor = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_EMPEROR))) { // if evade, then check if he is alive. If not, start make portal - if (!pEmperor->isAlive()) + if (!pEmperor->IsAlive()) m_creature->CastSpell(m_creature, SPELL_OPEN_PORTAL, false); } } @@ -191,13 +191,13 @@ struct boss_moira_bronzebeardAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //MindBlast_Timer if (m_uiMindBlast_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MINDBLAST); m_uiMindBlast_Timer = 14000; } else @@ -206,7 +206,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI //ShadowWordPain_Timer if (m_uiShadowWordPain_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWWORDPAIN); m_uiShadowWordPain_Timer = 18000; } else @@ -215,7 +215,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI //Smite_Timer if (m_uiSmite_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SMITE); m_uiSmite_Timer = 10000; } else @@ -226,7 +226,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI { if (Creature* pEmperor = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_EMPEROR))) { - if (pEmperor->isAlive() && pEmperor->GetHealthPercent() != 100.0f) + if (pEmperor->IsAlive() && pEmperor->GetHealthPercent() != 100.0f) DoCastSpellIfCan(pEmperor, SPELL_HEAL); } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_general_angerforge.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_general_angerforge.cpp index 7d920773b..8b4f5ad37 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_general_angerforge.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_general_angerforge.cpp @@ -81,13 +81,13 @@ struct boss_general_angerforgeAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Sunder Armor if (m_uiSunderArmorTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) m_uiSunderArmorTimer = urand(5 * IN_MILLISECONDS, 15 * IN_MILLISECONDS); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_gorosh_the_dervish.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_gorosh_the_dervish.cpp index 5f53241d5..8a4b4f6e6 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_gorosh_the_dervish.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_gorosh_the_dervish.cpp @@ -49,7 +49,7 @@ struct boss_gorosh_the_dervishAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //WhirlWind_Timer @@ -63,7 +63,7 @@ struct boss_gorosh_the_dervishAI : public ScriptedAI //MortalStrike_Timer if (MortalStrike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALSTRIKE); MortalStrike_Timer = 15000; } else MortalStrike_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_grizzle.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_grizzle.cpp index e65014b49..66ef054d3 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_grizzle.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_grizzle.cpp @@ -47,7 +47,7 @@ struct boss_grizzleAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //GroundTremor_Timer diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_high_interrogator_gerstahn.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_high_interrogator_gerstahn.cpp index 38ae41443..b3ccdb8ef 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_high_interrogator_gerstahn.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_high_interrogator_gerstahn.cpp @@ -54,7 +54,7 @@ struct boss_high_interrogator_gerstahnAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ShadowWordPain_Timer @@ -82,7 +82,7 @@ struct boss_high_interrogator_gerstahnAI : public ScriptedAI //PsychicScream_Timer if (m_uiPsychicScream_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_PSYCHICSCREAM); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PSYCHICSCREAM); m_uiPsychicScream_Timer = 30000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_magmus.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_magmus.cpp index e33909cdd..458ac86dd 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_magmus.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_magmus.cpp @@ -72,13 +72,13 @@ struct boss_magmusAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //FieryBurst_Timer if (m_uiFieryBurst_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIERYBURST); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIERYBURST); m_uiFieryBurst_Timer = 6000; } else @@ -89,7 +89,7 @@ struct boss_magmusAI : public ScriptedAI { if (m_uiWarStomp_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_WARSTOMP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WARSTOMP); m_uiWarStomp_Timer = 8000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp index 4ba9895b4..f7c694b42 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/boss_tomb_of_seven.cpp @@ -179,18 +179,18 @@ struct boss_doomrelAI : public ScriptedAI { if (Creature* pDwarf = GetDwarfForPhase(m_uiDwarfRound)) { - if (bStartFight && pDwarf->isAlive()) + if (bStartFight && pDwarf->IsAlive()) { pDwarf->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER); - pDwarf->setFaction(FACTION_HOSTILE); + pDwarf->SetFactionTemplateId(FACTION_HOSTILE); pDwarf->SetInCombatWithZone(); // attackstart } else { - if (!pDwarf->isAlive() || pDwarf->isDead()) + if (!pDwarf->IsAlive() || pDwarf->IsDead()) pDwarf->Respawn(); - pDwarf->setFaction(FACTION_NEUTRAL); + pDwarf->SetFactionTemplateId(FACTION_NEUTRAL); } } } @@ -217,9 +217,9 @@ struct boss_doomrelAI : public ScriptedAI { if (Creature* pDwarf = GetDwarfForPhase(m_uiDwarfRound - 1)) { - if (pDwarf->isAlive()) + if (pDwarf->IsAlive()) { - if (!pDwarf->SelectHostileTarget() || !pDwarf->getVictim()) + if (!pDwarf->SelectHostileTarget() || !pDwarf->GetVictim()) { if (m_pInstance) m_pInstance->SetData(TYPE_TOMB_OF_SEVEN, FAIL); @@ -245,13 +245,13 @@ struct boss_doomrelAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ShadowVolley_Timer if (m_uiShadowVolley_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLTVOLLEY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLTVOLLEY); m_uiShadowVolley_Timer = 12000; } else @@ -271,7 +271,7 @@ struct boss_doomrelAI : public ScriptedAI //CurseOfWeakness_Timer if (m_uiCurseOfWeakness_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFWEAKNESS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFWEAKNESS); m_uiCurseOfWeakness_Timer = 45000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/instance_blackrock_depths.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/instance_blackrock_depths.cpp index 6c7614011..31142cc97 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_depths/instance_blackrock_depths.cpp @@ -443,7 +443,7 @@ struct instance_blackrock_depths : ScriptedInstance { uint32 uiTextId; - if (!pDagran->isAlive()) + if (!pDagran->IsAlive()) return; if (m_uiDagranTimer > 0) @@ -678,7 +678,7 @@ struct instance_blackrock_depths : ScriptedInstance { crea->SetInCombatWithZone(); crea->AI()->AttackStart(who); - crea->setFaction(16); + crea->SetFactionTemplateId(16); } } @@ -727,8 +727,8 @@ struct instance_blackrock_depths : ScriptedInstance { if (Creature* pCreature = instance->GetCreature(*itr)) { - if (pCreature->isAlive()) - pCreature->setFaction(674); + if (pCreature->IsAlive()) + pCreature->SetFactionTemplateId(674); } } } @@ -832,10 +832,10 @@ struct instance_blackrock_depths : ScriptedInstance { if (Creature* pCreature = instance->GetCreature(*itr)) { - if (pCreature->isAlive()) + if (pCreature->IsAlive()) { - pCreature->setFaction(14); - Unit* pVictim = pCreature->getVictim(); + pCreature->SetFactionTemplateId(14); + Unit* pVictim = pCreature->GetVictim(); if (pCreature->AI()) pCreature->AI()->AttackStart(pVictim); } @@ -848,10 +848,10 @@ struct instance_blackrock_depths : ScriptedInstance if (uiData == IN_PROGRESS) { if (Creature* argelmach = instance->GetCreature(m_uiGolemLordArgelmachGUID)) - if (Unit* pVictim = argelmach->getVictim()) + if (Unit* pVictim = argelmach->GetVictim()) for (std::list::const_iterator itr = m_lArgelmachProtectorsMobGUIDList.begin(); itr != m_lArgelmachProtectorsMobGUIDList.end(); itr++) if (Creature* protector = instance->GetCreature(*itr)) - if (protector->isAlive() && protector->AI() && protector->IsWithinDist(argelmach, 80.0f)) + if (protector->IsAlive() && protector->AI() && protector->IsWithinDist(argelmach, 80.0f)) protector->AI()->AttackStart(pVictim); } m_auiEncounter[DATA_ARGELMACH_AGGRO] = uiData; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_drakkisath.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_drakkisath.cpp index b1d3b4096..1ea84d56a 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_drakkisath.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_drakkisath.cpp @@ -61,13 +61,13 @@ struct boss_drakkisathAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // FlameStrike if (m_uiFlameStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAMESTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAMESTRIKE) == CAST_OK) m_uiFlameStrikeTimer = urand(13000, 14000); } else @@ -76,7 +76,7 @@ struct boss_drakkisathAI : public ScriptedAI // Cleave if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(8000, 10000); } else @@ -85,7 +85,7 @@ struct boss_drakkisathAI : public ScriptedAI // Confliguration if (m_uiConfligurationTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CONFLIGURATION, 0, m_creature->getVictim()->GetGUID()) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CONFLIGURATION, 0, m_creature->GetVictim()->GetGUID()) == CAST_OK) m_uiConfligurationTimer = 18000; } else @@ -94,7 +94,7 @@ struct boss_drakkisathAI : public ScriptedAI // Thunderclap if (m_uiThunderclapTimer < uiDiff) { - if ((m_creature->getVictim())->GetDistance(m_creature) < 10.0f) + if ((m_creature->GetVictim())->GetDistance(m_creature) < 10.0f) { if (DoCastSpellIfCan(m_creature, SPELL_THUNDERCLAP) == CAST_OK) m_uiThunderclapTimer = 20000; @@ -114,7 +114,7 @@ struct boss_drakkisathAI : public ScriptedAI if (m_uiPierceArmorTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PIERCEARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PIERCEARMOR) == CAST_OK) m_uiPierceArmorTimer = 40000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_gyth.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_gyth.cpp index 4b74d5443..21c73211d 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_gyth.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_gyth.cpp @@ -185,7 +185,7 @@ struct boss_gythAI : public ScriptedAI void SummonedCreatureJustDied(Creature* summ) override { // Rend - invoque par Gyth - peut mourir apres Gyth. - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->SetInCombatWithZone(); // Ne doit pas etre negatif @@ -285,7 +285,7 @@ struct boss_gythAI : public ScriptedAI m_pInstance->SetData(TYPE_GYTH, FAIL); DespawnAdds(); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { m_creature->SetDeathState(JUST_DIED); m_creature->Respawn(); @@ -301,7 +301,7 @@ struct boss_gythAI : public ScriptedAI m_pInstance->SetData(TYPE_GYTH, FAIL); DespawnAdds(); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { m_creature->SetDeathState(JUST_DIED); m_creature->Respawn(); @@ -331,13 +331,13 @@ struct boss_gythAI : public ScriptedAI m_bInitialized = true; } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_bRootSelf) { //DoCastSpellIfCan(m_creature, SPELL_ROOT_SELF); - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_bRootSelf = true; } @@ -354,10 +354,10 @@ struct boss_gythAI : public ScriptedAI //m_creature->GetMotionMaster()->Initialize(); m_creature->SetDisplayId(MODEL_ID_GYTH_MOUNTED); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //m_creature->RemoveAurasDueToSpell(SPELL_ROOT_SELF); - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); DoResetThreat(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_halycon.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_halycon.cpp index 842e458b7..c04a77a08 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_halycon.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_halycon.cpp @@ -47,13 +47,13 @@ struct boss_halyconAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //CrowdPummel_Timer if (CrowdPummel_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CROWDPUMMEL); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CROWDPUMMEL); CrowdPummel_Timer = 14000; } else CrowdPummel_Timer -= diff; @@ -61,7 +61,7 @@ struct boss_halyconAI : public ScriptedAI //MightyBlow_Timer if (MightyBlow_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIGHTYBLOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIGHTYBLOW); MightyBlow_Timer = 10000; } else MightyBlow_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_highlord_omokk.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_highlord_omokk.cpp index e01300ce6..c1e941a63 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_highlord_omokk.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_highlord_omokk.cpp @@ -60,7 +60,7 @@ struct boss_highlordomokkAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // WarStomp @@ -75,7 +75,7 @@ struct boss_highlordomokkAI : public ScriptedAI // Strike if (m_uiStrikeTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE); m_uiStrikeTimer = 10000; } else @@ -84,7 +84,7 @@ struct boss_highlordomokkAI : public ScriptedAI // Rend if (m_uiRendTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_REND); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_REND); m_uiRendTimer = 18000; } else @@ -93,7 +93,7 @@ struct boss_highlordomokkAI : public ScriptedAI // Sunder Armor if (m_uiSunderArmorTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDERARMOR); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDERARMOR); m_uiSunderArmorTimer = 25000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_mother_smolderweb.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_mother_smolderweb.cpp index f92b259a3..7dcd75cb7 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_mother_smolderweb.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_mother_smolderweb.cpp @@ -55,7 +55,7 @@ struct boss_mothersmolderwebAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Crystalize diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_overlord_wyrmthalak.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_overlord_wyrmthalak.cpp index 98a68bfd3..1c1004afd 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_overlord_wyrmthalak.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_overlord_wyrmthalak.cpp @@ -73,10 +73,10 @@ struct boss_overlordwyrmthalakAI : public ScriptedAI if (pSummoned->GetEntry() != NPC_SPIRESTONE_WARLORD && pSummoned->GetEntry() != NPC_SMOLDERTHORN_BERSERKER) return; - if (m_creature->getVictim()) + if (m_creature->GetVictim()) { Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); - pSummoned->AI()->AttackStart(pTarget ? pTarget : m_creature->getVictim()); + pSummoned->AI()->AttackStart(pTarget ? pTarget : m_creature->GetVictim()); } } @@ -107,7 +107,7 @@ struct boss_overlordwyrmthalakAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Prevent players from pulling Wyrmthalak into UBRS @@ -134,7 +134,7 @@ struct boss_overlordwyrmthalakAI : public ScriptedAI // Cleave if (m_uiCleaveTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 7000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_pyroguard_emberseer.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_pyroguard_emberseer.cpp index f8dd16fe0..5fcef42ac 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_pyroguard_emberseer.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_pyroguard_emberseer.cpp @@ -74,7 +74,7 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI for (it = canaliseurs.begin(); it != canaliseurs.end(); ++it) if (Creature* pCanaliser = m_creature->GetMap()->GetCreature(*it)) { - if (!pCanaliser->isAlive()) + if (!pCanaliser->IsAlive()) pCanaliser->Respawn(); pCanaliser->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE); } @@ -106,7 +106,7 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI std::vector::iterator it; for (it = canaliseurs.begin(); it != canaliseurs.end(); ++it) if (Creature* pCanaliser = m_creature->GetMap()->GetCreature(*it)) - if (pCanaliser->isAlive()) + if (pCanaliser->IsAlive()) return false; return true; } @@ -171,7 +171,7 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI for (Map::PlayerList::const_iterator it2 = pl.begin(); it2 != pl.end(); ++it2) { Player* currPlayer = it2->getSource(); - if (currPlayer && currPlayer->isAlive() && m_creature->IsInRange(currPlayer, 0.0f, 50.0f)) + if (currPlayer && currPlayer->IsAlive() && m_creature->IsInRange(currPlayer, 0.0f, 50.0f)) AttackStart(currPlayer); } m_creature->SetInCombatWithZone(); @@ -273,7 +273,7 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI } // Sinon, on est "normalement" en combat. - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // FireNova Timer @@ -385,7 +385,7 @@ struct npc_geolier_main_noireAI : public ScriptedAI return; } // Sinon go. - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (MiseEnCage_Timer < uiDiff) { @@ -403,7 +403,7 @@ struct npc_geolier_main_noireAI : public ScriptedAI if (Frappe_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), 15580) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), 15580) == CAST_OK) Frappe_Timer = urand(7900, 14000); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_quartermaster_zigris.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_quartermaster_zigris.cpp index e579ffbcf..99a276c22 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_quartermaster_zigris.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_quartermaster_zigris.cpp @@ -52,13 +52,13 @@ struct boss_quatermasterzigrisAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shoot if (m_uiShootTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT); m_uiShootTimer = 1750; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_rend_blackhand.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_rend_blackhand.cpp index 09f6edf0e..b55ffc408 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_rend_blackhand.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_rend_blackhand.cpp @@ -62,14 +62,14 @@ struct boss_rend_blackhandAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // WhirlWind Check if (m_uiCloseCombatCheckTimer < uiDiff) { m_uiCloseCombatCount = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()); @@ -96,7 +96,7 @@ struct boss_rend_blackhandAI : public ScriptedAI // Mortal Strike if (m_uiMortalStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALSTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALSTRIKE) == CAST_OK) m_uiMortalStrikeTimer = urand(6000, 10000); } else @@ -105,7 +105,7 @@ struct boss_rend_blackhandAI : public ScriptedAI // Cleave if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(4000, 6000); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_shadow_hunter_voshgajin.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_shadow_hunter_voshgajin.cpp index 33e43577b..c47feebf7 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_shadow_hunter_voshgajin.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_shadow_hunter_voshgajin.cpp @@ -53,7 +53,7 @@ struct boss_shadowvoshAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Curse Of Blood @@ -80,7 +80,7 @@ struct boss_shadowvoshAI : public ScriptedAI // Cleave if (m_uiCleaveTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); m_uiCleaveTimer = 7000; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_the_beast.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_the_beast.cpp index 46ee88413..3588807be 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_the_beast.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_the_beast.cpp @@ -70,7 +70,7 @@ struct boss_thebeastAI : public ScriptedAI if (!m_creature->HasAura(AURA_IMMOLATE)) m_creature->CastSpell(m_creature, AURA_IMMOLATE, true); // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Flamebreak @@ -107,7 +107,7 @@ struct boss_thebeastAI : public ScriptedAI if (m_uiBeserkerChargeTimer <= uiDiff) { Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); - if (m_uiBeserkerChargeTimer == 0) pTarget = m_creature->getVictim(); + if (m_uiBeserkerChargeTimer == 0) pTarget = m_creature->GetVictim(); if (DoCastSpellIfCan(pTarget, SPELL_BERSERKER_CHARGE) == CAST_OK) m_uiBeserkerChargeTimer = urand(15000, 20000); @@ -129,7 +129,7 @@ struct boss_thebeastAI : public ScriptedAI if (m_uiFireBlastTimer < uiDiff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { if (DoCastSpellIfCan(pTarget, SPELL_FIREBLAST) == CAST_OK) m_uiFireBlastTimer = urand(14000, 20000); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp index 42b8aabe8..9b2ddec79 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_urok.cpp @@ -96,7 +96,7 @@ struct go_urok_challengeAI: public GameObjectAI Map::PlayerList const& list = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator it = list.begin(); it != list.end(); ++it) if (Player* player = it->getSource()) - if (player->isAlive() && !invoc->IsFriendlyTo(player)) + if (player->IsAlive() && !invoc->IsFriendlyTo(player)) invoc->AI()->AttackStart(player); } } @@ -258,7 +258,7 @@ struct urokUnderlingAI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if ( timer < uiDiff) { @@ -301,7 +301,7 @@ struct urokEnforcerAI : public urokUnderlingAI { if (m_uiStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE ) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE ) == CAST_OK) m_uiStrike_Timer = urand(10000, 18000); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_warmaster_voone.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_warmaster_voone.cpp index 2c6d482ef..0a5c396df 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_warmaster_voone.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/boss_warmaster_voone.cpp @@ -57,13 +57,13 @@ struct boss_warmastervooneAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Snapkick_Timer if (Snapkick_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SNAPKICK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SNAPKICK); Snapkick_Timer = 6000; } else Snapkick_Timer -= diff; @@ -71,7 +71,7 @@ struct boss_warmastervooneAI : public ScriptedAI //Cleave_Timer if (Cleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); Cleave_Timer = 12000; } else Cleave_Timer -= diff; @@ -79,7 +79,7 @@ struct boss_warmastervooneAI : public ScriptedAI //Uppercut_Timer if (Uppercut_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT); Uppercut_Timer = 14000; } else Uppercut_Timer -= diff; @@ -87,7 +87,7 @@ struct boss_warmastervooneAI : public ScriptedAI //MortalStrike_Timer if (MortalStrike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALSTRIKE); MortalStrike_Timer = 10000; } else MortalStrike_Timer -= diff; @@ -95,7 +95,7 @@ struct boss_warmastervooneAI : public ScriptedAI //Pummel_Timer if (Pummel_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PUMMEL); Pummel_Timer = 16000; } else Pummel_Timer -= diff; @@ -103,7 +103,7 @@ struct boss_warmastervooneAI : public ScriptedAI //ThrowAxe_Timer if (ThrowAxe_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_THROWAXE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THROWAXE); ThrowAxe_Timer = 8000; } else ThrowAxe_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp index 322ab0e99..c273f8a1e 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp @@ -551,7 +551,7 @@ void instance_blackrock_spire::DoSortRoomEventMobs() { if (Creature* pCreature = instance->GetCreature(*itr)) { - if (pCreature->isAlive() && pCreature->GetDistance(pRune) < 10.0f) + if (pCreature->IsAlive() && pCreature->GetDistance(pRune) < 10.0f) m_alRoomEventMobGUIDSorted[i].push_back(*itr); } #ifdef DEBUG_ON @@ -571,7 +571,7 @@ InstanceData* GetInstanceData_instance_blackrock_spire(Map* pMap) bool AreaTrigger_at_blackrock_spire(Player* pPlayer, const AreaTriggerEntry* pAt) { - if (pPlayer->isDead()) + if (pPlayer->IsDead()) return false; switch (pAt->id) @@ -588,7 +588,7 @@ bool AreaTrigger_at_blackrock_spire(Player* pPlayer, const AreaTriggerEntry* pAt case AREATRIGGER_STADIUM: if (instance_blackrock_spire* pInstance = (instance_blackrock_spire*) pPlayer->GetInstanceData()) if (Creature* pGyth = pInstance->instance->GetCreature(pInstance->GetData64(NPC_GYTH))) - if (pGyth->isAlive() && !pGyth->isInCombat()) + if (pGyth->IsAlive() && !pGyth->IsInCombat()) pGyth->AI()->AttackStart(pPlayer); break; } @@ -605,7 +605,7 @@ struct go_father_flameAI: public GameObjectAI if (ScriptedInstance* pInstance = (instance_blackrock_spire*)me->GetInstanceData()) if (pInstance->GetData(TYPE_SOLAKAR) != IN_PROGRESS && pInstance->GetData(TYPE_SOLAKAR) != DONE) if (Creature* pDrakki = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DRAKKISATH))) - if (pDrakki->isAlive()) + if (pDrakki->IsAlive()) pInstance->SetData(TYPE_SOLAKAR, IN_PROGRESS); return true; } @@ -649,7 +649,7 @@ struct npc_solakar_triggerAI : public ScriptedAI { if (listHatcher.empty()) break; - if (!(*itr)->isAlive()) + if (!(*itr)->IsAlive()) continue; (*itr)->AI()->EnterEvadeMode(); @@ -748,13 +748,13 @@ struct npc_rookery_hatcherAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Sunder Armor if (SunderArmor_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) SunderArmor_Timer = urand(10000, 15000); } else @@ -763,7 +763,7 @@ struct npc_rookery_hatcherAI : public ScriptedAI // Strike if (Strike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE) == CAST_OK) Strike_Timer = urand(4000, 6000); } else @@ -843,12 +843,12 @@ GameObjectAI* GetAIgo_rookey_egg(GameObject *pGo) bool AreaTrigger_at_ubrs_the_beast(Player* pPlayer, const AreaTriggerEntry* pAt) { - if (pPlayer->isDead()) + if (pPlayer->IsDead()) return false; if (instance_blackrock_spire* pInstance = (instance_blackrock_spire*)pPlayer->GetInstanceData()) if (Creature* pBeast = pInstance->instance->GetCreature(pInstance->GetData64(NPC_THE_BEAST))) - if (pBeast->isAlive() && !pBeast->isInCombat()) + if (pBeast->IsAlive() && !pBeast->IsInCombat()) pBeast->AI()->AttackStart(pPlayer); return false; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/ubrs_trash.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/ubrs_trash.cpp index 963c90f5b..977480965 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/ubrs_trash.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/ubrs_trash.cpp @@ -57,7 +57,7 @@ struct npc_blackhand_summonerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->IsNonMeleeSpellCasted(false)) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || m_creature->IsNonMeleeSpellCasted(false)) return; if (ManageTimer(uiDiff, &m_uiSummonTimer)) @@ -93,7 +93,7 @@ struct npc_blackhand_summonerAI : public ScriptedAI } if (ManageTimer(uiDiff, &m_uiNovaGivreTimer)) { - if (Unit* pTarget = m_creature->getVictim())//m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) + if (Unit* pTarget = m_creature->GetVictim())//m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (pTarget->GetDistance(m_creature) < 10.0f) { @@ -152,7 +152,7 @@ struct npc_blackhand_veteranAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (ManageTimer(uiDiff, &m_uiChargeBouclierTimer)) @@ -162,7 +162,7 @@ struct npc_blackhand_veteranAI : public ScriptedAI pTarget1 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); else { - pTarget1 = m_creature->getVictim(); + pTarget1 = m_creature->GetVictim(); m_bFirstChargeDone = true; } if (pTarget1) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_broodlord_lashlayer.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_broodlord_lashlayer.cpp index e354bfe33..86a8331f5 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_broodlord_lashlayer.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_broodlord_lashlayer.cpp @@ -67,7 +67,7 @@ struct boss_broodlordAI : public ScriptedAI if (m_pInstance) m_pInstance->SetData(TYPE_LASHLAYER, IN_PROGRESS); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { SetMobsDesactivated(true); DoScriptText(SAY_AGGRO, m_creature); @@ -93,15 +93,15 @@ struct boss_broodlordAI : public ScriptedAI void MoveInLineOfSight(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 40.0f) && m_creature->IsWithinLOSInMap(who) && !m_creature->isInCombat() - && who->isInAccessablePlaceFor(m_creature) && !who->HasStealthAura()) + if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 40.0f) && m_creature->IsWithinLOSInMap(who) && !m_creature->IsInCombat() + && who->IsInAccessablePlaceFor(m_creature) && !who->HasStealthAura()) m_creature->SetInCombatWithZone(); } void SpellHitTarget(Unit* pCaster, const SpellEntry* pSpell) override { if (pSpell->Id == SPELL_KNOCK_AWAY) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -50); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -50); } void SetMobsDesactivated(bool on) @@ -141,7 +141,7 @@ struct boss_broodlordAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiInCombatTimer < uiDiff) @@ -156,7 +156,7 @@ struct boss_broodlordAI : public ScriptedAI // Cleave Timer if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(13000, 20000); } else @@ -174,7 +174,7 @@ struct boss_broodlordAI : public ScriptedAI // Mortal Strike Timer if (m_uiMortalStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrikeTimer = urand(20000, 30000); } else @@ -183,7 +183,7 @@ struct boss_broodlordAI : public ScriptedAI // Knock Away Timer if (m_uiKnockAwayTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = urand(12000, 25000); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp index 2a809c4ce..f3229a72e 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_chromaggus.cpp @@ -156,11 +156,11 @@ struct boss_chromaggusAI : public ScriptedAI void MoveInLineOfSight(Unit *pUnit) override { - if (!pUnit || m_creature->getVictim()) + if (!pUnit || m_creature->GetVictim()) return; if (m_bEngagedOnce && pUnit->IsPlayer() && m_creature->GetDistance2d(pUnit) < 55.0f && m_creature->IsWithinLOSInMap(pUnit) - && pUnit->isTargetableForAttack() && pUnit->isInAccessablePlaceFor(m_creature)) + && pUnit->IsTargetableForAttack() && pUnit->IsInAccessablePlaceFor(m_creature)) AttackStart(pUnit); } @@ -199,7 +199,7 @@ struct boss_chromaggusAI : public ScriptedAI holder->SetTargetSecondaryThreatFocus(true); if (pTarget->GetTypeId() != TYPEID_PLAYER) return; - m_vTimeLapseInfo.push_back(new TimeLapseInfo(pTarget->GetObjectGuid(), m_creature->getThreatManager().getThreat(pTarget), pTarget->GetHealth())); + m_vTimeLapseInfo.push_back(new TimeLapseInfo(pTarget->GetObjectGuid(), m_creature->GetThreatManager().getThreat(pTarget), pTarget->GetHealth())); } } @@ -226,7 +226,7 @@ struct boss_chromaggusAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->isInCombat() && !m_bEngagedOnce) + if (!m_creature->IsInCombat() && !m_bEngagedOnce) { if (GameObject* pGO = m_creature->GetMap()->GetGameObject(m_pInstance->GetData64(DATA_DOOR_CHROMAGGUS_SIDE))) { @@ -252,13 +252,13 @@ struct boss_chromaggusAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; for (std::vector::iterator itr = m_vTimeLapseInfo.begin(); itr != m_vTimeLapseInfo.end(); ++itr) if (Player* pTarget = m_creature->GetMap()->GetPlayer((*itr)->m_targetGuid)) { - if (!pTarget->HasAura(SPELL_TIME_LAPSE) && pTarget->isAlive()) + if (!pTarget->HasAura(SPELL_TIME_LAPSE) && pTarget->IsAlive()) { if ((*itr)->m_targetHealth >= (pTarget->GetMaxHealth() / 2)) pTarget->SetHealth(pTarget->GetMaxHealth()); @@ -352,7 +352,7 @@ struct boss_chromaggusAI : public ScriptedAI } std::vector m_vPossibleVictim; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) if (Player* target = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid())) m_vPossibleVictim.push_back(target->GetObjectGuid()); @@ -404,13 +404,13 @@ struct boss_chromaggusAI : public ScriptedAI for (AfflictionGuids::iterator itr = m_lRedAfflictionPlayerGUID.begin(); itr != m_lRedAfflictionPlayerGUID.end();) { Player* pTarget = m_creature->GetMap()->GetPlayer(*itr); - if (pTarget && pTarget->isAlive() && !pTarget->HasAura(SPELL_BROODAF_RED, EFFECT_INDEX_0)) + if (pTarget && pTarget->IsAlive() && !pTarget->HasAura(SPELL_BROODAF_RED, EFFECT_INDEX_0)) { itr = m_lRedAfflictionPlayerGUID.erase(itr); continue; } - if (!pTarget || pTarget->isDead()) + if (!pTarget || pTarget->IsDead()) { if (DoCastSpellIfCan(m_creature, SPELL_CHROMA_HEAL) == CAST_OK) //Heal 150000 HP m_lRedAfflictionPlayerGUID.erase(itr); @@ -424,7 +424,7 @@ struct boss_chromaggusAI : public ScriptedAI { if (Player* pTarget = m_creature->GetMap()->GetPlayer(*itr)) { - if (pTarget->isDead()) + if (pTarget->IsDead()) { pTarget->RemoveAurasDueToSpell(23175); pTarget->RemoveAurasDueToSpell(23177); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_ebonroc.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_ebonroc.cpp index 8912a4801..4b3623861 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_ebonroc.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_ebonroc.cpp @@ -82,14 +82,14 @@ struct boss_ebonrocAI : public ScriptedAI { if (!pCaster || pCaster->GetTypeId() != TYPEID_PLAYER) return; - if (m_creature->getThreatManager().getThreat(pCaster)) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -50); + if (m_creature->GetThreatManager().getThreat(pCaster)) + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -50); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shadow Flame Timer @@ -107,7 +107,7 @@ struct boss_ebonrocAI : public ScriptedAI // Wing Buffet Timer if (m_uiWingBuffetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WING_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WING_BUFFET) == CAST_OK) { DoScriptText(EMOTE_GENERIC_WING_BUFFET, m_creature); m_uiWingBuffetTimer = 30000; @@ -119,13 +119,13 @@ struct boss_ebonrocAI : public ScriptedAI // Shadow of Ebonroc Timer if (m_uiShadowOfEbonrocTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_OF_EBONROC, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_OF_EBONROC, CF_AURA_NOT_PRESENT) == CAST_OK) m_uiShadowOfEbonrocTimer = 8000; } else m_uiShadowOfEbonrocTimer -= uiDiff; - if (m_creature->isAttackReady() && !urand(0, 2)) + if (m_creature->IsAttackReady() && !urand(0, 2)) DoCastSpellIfCan(m_creature, SPELL_THRASH); DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_firemaw.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_firemaw.cpp index 70bb6ecc7..cb68249c4 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_firemaw.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_firemaw.cpp @@ -82,14 +82,14 @@ struct boss_firemawAI : public ScriptedAI { if (!pCaster || pCaster->GetTypeId() != TYPEID_PLAYER) return; - if (m_creature->getThreatManager().getThreat(pCaster)) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -50); + if (m_creature->GetThreatManager().getThreat(pCaster)) + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -50); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shadow Flame Timer @@ -107,7 +107,7 @@ struct boss_firemawAI : public ScriptedAI // Wing Buffet Timer if (m_uiWingBuffetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WING_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WING_BUFFET) == CAST_OK) { DoScriptText(EMOTE_GENERIC_WING_BUFFET, m_creature); m_uiWingBuffetTimer = 30000; @@ -125,7 +125,7 @@ struct boss_firemawAI : public ScriptedAI else m_uiFlameBuffetTimer -= uiDiff; - if (m_creature->isAttackReady() && !urand(0, 2)) + if (m_creature->IsAttackReady() && !urand(0, 2)) DoCastSpellIfCan(m_creature, SPELL_THRASH); DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_flamegor.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_flamegor.cpp index 5c93fde1d..c32f0f904 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_flamegor.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_flamegor.cpp @@ -83,14 +83,14 @@ struct boss_flamegorAI : public ScriptedAI { if (!pCaster || pCaster->GetTypeId() != TYPEID_PLAYER) return; - if (m_creature->getThreatManager().getThreat(pCaster)) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -50); + if (m_creature->GetThreatManager().getThreat(pCaster)) + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -50); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shadow Flame Timer @@ -108,7 +108,7 @@ struct boss_flamegorAI : public ScriptedAI // Wing Buffet Timer if (m_uiWingBuffetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WING_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WING_BUFFET) == CAST_OK) { DoScriptText(EMOTE_GENERIC_WING_BUFFET, m_creature); m_uiWingBuffetTimer = 30000; @@ -129,7 +129,7 @@ struct boss_flamegorAI : public ScriptedAI else m_uiFrenzyTimer -= uiDiff; - if (m_creature->isAttackReady() && !urand(0, 2)) + if (m_creature->IsAttackReady() && !urand(0, 2)) DoCastSpellIfCan(m_creature, SPELL_THRASH); DoMeleeAttackIfReady(); 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 7efcbde54..4e60d8743 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 @@ -214,9 +214,9 @@ struct boss_nefarianAI : ScriptedAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive()) + if (pPlayer && pPlayer->IsAlive()) { - if (pPlayer->getClass() == ClassCalled) + if (pPlayer->GetClass() == ClassCalled) { bClassFound = true; switch (ClassCalled) @@ -311,7 +311,7 @@ struct boss_nefarianAI : ScriptedAI case 2: m_creature->SetWalk(true); m_creature->RemoveAurasDueToSpell(17131); - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { //m_creature->AI()->AttackStart(pTarget); //m_creature->GetMotionMaster()->Clear(false); @@ -327,7 +327,7 @@ struct boss_nefarianAI : ScriptedAI m_uiTransitionTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || !m_bTransitionDone) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || !m_bTransitionDone) return; // ShadowFlame_Timer @@ -357,7 +357,7 @@ struct boss_nefarianAI : ScriptedAI // VeilOfShadow_Timer if (m_uiVeilOfShadowTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_VEIL_OF_SHADOW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VEIL_OF_SHADOW) == CAST_OK) m_uiVeilOfShadowTimer = urand(10000, 15000); } else @@ -366,7 +366,7 @@ struct boss_nefarianAI : ScriptedAI // Cleave_Timer if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(7000, 10000); } else @@ -414,7 +414,7 @@ struct boss_nefarianAI : ScriptedAI if (pMage->HasAura(SPELL_MAGE)) { std::vector m_vPossibleVictim; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr2 = tList.begin(); itr2 != tList.end(); ++itr2) { Unit* pUnit = m_creature->GetMap()->GetUnit((*itr2)->getUnitGuid()); @@ -507,7 +507,7 @@ struct npc_corrupted_totemAI : ScriptedAI void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); if (!m_creature->HasAura(SPELL_ROOT_SELF)) m_creature->AddAura(SPELL_ROOT_SELF); @@ -575,10 +575,10 @@ struct npc_corrupted_totemAI : ScriptedAI Creature* curr = tmpMobsList.front(); tmpMobsList.pop_front(); - if (!curr->isAlive()) + if (!curr->IsAlive()) continue; - if (on && m_creature->isAlive()) + if (on && m_creature->IsAlive()) { if (m_creature->IsWithinDistInMap(curr, 40.0f)) { @@ -607,7 +607,7 @@ struct npc_corrupted_totemAI : ScriptedAI if (!m_creature->HasAura(SPELL_ROOT_SELF)) m_creature->AddAura(SPELL_ROOT_SELF); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; uint32 addAuraEntry = 0; 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 850ad123f..f328feab5 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 @@ -123,7 +123,7 @@ struct boss_razorgoreAI : public ScriptedAI return; if (pSpell->Id == SPELL_WARSTOMP) - m_creature->getThreatManager().modifyThreatPercent(pTarget, -30); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -30); } void Aggro(Unit* /*pWho*/) override @@ -146,7 +146,7 @@ struct boss_razorgoreAI : public ScriptedAI Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { - if (i->getSource() && i->getSource()->isAlive()) + if (i->getSource() && i->getSource()->IsAlive()) i->getSource()->CastSpell(i->getSource(), SPELL_EXPLOSION, true); } @@ -220,7 +220,7 @@ struct boss_razorgoreAI : public ScriptedAI for (std::list::iterator itr = GardesListe.begin(); itr != GardesListe.end(); ++itr) { - if (!(*itr)->isAlive()) + if (!(*itr)->IsAlive()) (*itr)->Respawn(); if ((*itr)->GetEntry() == MOB_GRETHOK) (*itr)->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_POSSESS_ORB); @@ -246,14 +246,14 @@ struct boss_razorgoreAI : public ScriptedAI for (std::list::iterator it = lCreatureNear.begin(); it != lCreatureNear.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) (*it)->AI()->EnterEvadeMode(); } } void UpdateAI(const uint32 uiDiff) override { - if (m_creature->hasUnitState(UNIT_STAT_POSSESSED)) + if (m_creature->HasUnitState(UNIT_STAT_POSSESSED)) { ScriptedAI::UpdateAI(uiDiff); return; @@ -269,7 +269,7 @@ struct boss_razorgoreAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_pInstance->GetData64(DATA_EGG) == DONE) @@ -295,7 +295,7 @@ struct boss_razorgoreAI : public ScriptedAI if (m_uiOutOfReachTimer < uiDiff) { DEBUG_EMOTE("summon"); - if (m_creature->TryToCast(m_creature->getVictim(), SPELL_SUMMON_PLAYER, CF_TRIGGERED, 100) == SPELL_CAST_OK) + if (m_creature->TryToCast(m_creature->GetVictim(), SPELL_SUMMON_PLAYER, CF_TRIGGERED, 100) == SPELL_CAST_OK) m_uiOutOfReachTimer = 10000; } else @@ -305,7 +305,7 @@ struct boss_razorgoreAI : public ScriptedAI if (m_uiCleaveTimer < uiDiff) { DEBUG_EMOTE("cleave"); - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(5000, 10000); } else @@ -394,7 +394,7 @@ struct trigger_orb_of_commandAI : public ScriptedAI for (std::list::iterator it = lCreatureNear.begin(); it != lCreatureNear.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) { (*it)->SetHomePosition(-7555.55f, -1025.16f, 408.4914f, 0.65f); (*it)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_SILENCED); @@ -578,7 +578,7 @@ struct trigger_orb_of_commandAI : public ScriptedAI for (std::list::iterator itr = lGuards.begin(); itr != lGuards.end(); ++itr) { - if (!(*itr)->isInCombat()) + if (!(*itr)->IsInCombat()) { (*itr)->SetInCombatWithZone(); if ((*itr)->GetEntry() == MOB_GRETHOK) @@ -614,10 +614,10 @@ struct trigger_orb_of_commandAI : public ScriptedAI if (Unit* pChanneler = m_creature->GetMap()->GetUnit(m_uiPossesseurGuid)) { - if (pChanneler->isDead()) + if (pChanneler->IsDead()) { pRazorgore->RemoveAurasDueToSpell(SPELL_POSSESS_ORB); - if (pRazorgore->getThreatManager().isThreatListEmpty()) + if (pRazorgore->GetThreatManager().isThreatListEmpty()) pRazorgore->AI()->EnterEvadeMode(); } @@ -628,10 +628,10 @@ struct trigger_orb_of_commandAI : public ScriptedAI for (std::list::iterator itr = lCreature.begin(); itr != lCreature.end(); ++itr) { - if ((*itr)->getThreatManager().getThreat(pRazorgore)) + if ((*itr)->GetThreatManager().getThreat(pRazorgore)) { - (*itr)->getThreatManager().modifyThreatPercent(pChanneler, -100); - (*itr)->AddThreat(pChanneler, (*itr)->getThreatManager().getThreat(pRazorgore)); + (*itr)->GetThreatManager().modifyThreatPercent(pChanneler, -100); + (*itr)->AddThreat(pChanneler, (*itr)->GetThreatManager().getThreat(pRazorgore)); } } } @@ -652,7 +652,7 @@ struct trigger_orb_of_commandAI : public ScriptedAI GetCreatureListWithEntryInGrid(lCreature, m_creature, BLACKWING_MAGE, 150.0f); for (std::list::iterator itr = lCreature.begin(); itr != lCreature.end(); ++itr) - (*itr)->getThreatManager().modifyThreatPercent(pRazorgore, -100); + (*itr)->GetThreatManager().modifyThreatPercent(pRazorgore, -100); // Razorgore must attack the possessor ((ScriptedAI*)pRazorgore->AI())->DoResetThreat(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_vaelastrasz.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_vaelastrasz.cpp index 270d91f50..4fe7d8a7c 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_vaelastrasz.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_vaelastrasz.cpp @@ -222,7 +222,7 @@ struct boss_vaelAI : public ScriptedAI { if (m_pInstance) m_pInstance->SetData(TYPE_VAELASTRASZ, FAIL); - m_creature->setFaction(FACTION_BLACK_DRAGON); + m_creature->SetFactionTemplateId(FACTION_BLACK_DRAGON); m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); @@ -282,18 +282,18 @@ struct boss_vaelAI : public ScriptedAI m_uiIntroTimer -= uiDiff; } - if (!m_creature->isInCombat() && !m_bFlagSet) + if (!m_creature->IsInCombat() && !m_bFlagSet) { if (m_uiInitTimer < uiDiff) { if (m_pInstance->GetData(TYPE_VAEL_EVENT) != DONE) { - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); } else { - m_creature->setFaction(FACTION_BLACK_DRAGON); + m_creature->SetFactionTemplateId(FACTION_BLACK_DRAGON); m_creature->SetStandState(UNIT_STAND_STATE_STAND); } m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); @@ -337,7 +337,7 @@ struct boss_vaelAI : public ScriptedAI ++m_uiSpeechNum; break; case 2: - m_creature->setFaction(FACTION_BLACK_DRAGON); + m_creature->SetFactionTemplateId(FACTION_BLACK_DRAGON); if (m_playerGuid) { if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) @@ -356,7 +356,7 @@ struct boss_vaelAI : public ScriptedAI } // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Burning Adrenaline Caster Timer @@ -364,11 +364,11 @@ struct boss_vaelAI : public ScriptedAI if (m_uiBurningAdrenalineCasterTimer < uiDiff) { std::vector vPossibleVictim; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Player* pPlayer = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid()); - if (pPlayer && pPlayer->isAlive() && pPlayer->getPowerType() == POWER_MANA && !pPlayer->HasAura(SPELL_BURNING_ADRENALINE, EFFECT_INDEX_0)) + if (pPlayer && pPlayer->IsAlive() && pPlayer->GetPowerType() == POWER_MANA && !pPlayer->HasAura(SPELL_BURNING_ADRENALINE, EFFECT_INDEX_0)) vPossibleVictim.push_back(pPlayer->GetObjectGuid()); } if (!vPossibleVictim.empty()) @@ -386,9 +386,9 @@ struct boss_vaelAI : public ScriptedAI { // have the victim cast the spell on himself otherwise the third effect aura will be applied // to Vael instead of the player - if (m_creature->getVictim() && !m_creature->getVictim()->HasAura(SPELL_BURNING_ADRENALINE) && m_creature->getVictim()->isAlive()) + if (m_creature->GetVictim() && !m_creature->GetVictim()->HasAura(SPELL_BURNING_ADRENALINE) && m_creature->GetVictim()->IsAlive()) { - m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_BURNING_ADRENALINE, true); + m_creature->GetVictim()->CastSpell(m_creature->GetVictim(), SPELL_BURNING_ADRENALINE, true); m_uiBurningAdrenalineTankTimer = 45000; } } @@ -405,7 +405,7 @@ struct boss_vaelAI : public ScriptedAI // Cleave Timer if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(5000, 10000); } else @@ -414,7 +414,7 @@ struct boss_vaelAI : public ScriptedAI // Flame Breath Timer if (m_uiFlameBreathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BREATH) == CAST_OK) m_uiFlameBreathTimer = urand(5000, 10000); } else @@ -470,7 +470,7 @@ bool GossipHello_boss_vael(Player* pPlayer, Creature* pCreature) if (m_pInstance->GetData(TYPE_RAZORGORE) != DONE && !pPlayer->IsGameMaster()) return false; - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) if (m_pInstance->GetData(TYPE_SCEPTER_RUN) == NOT_STARTED) pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid()); @@ -557,11 +557,11 @@ struct npc_death_talon_CaptainAI : public ScriptedAI void MoveInLineOfSight(Unit *pUnit) override { - if (!pUnit || m_creature->getVictim()) + if (!pUnit || m_creature->GetVictim()) return; if (pUnit->IsPlayer() && m_creature->GetDistance2d(pUnit) < 29.0f && m_creature->IsWithinLOSInMap(pUnit) - && pUnit->isTargetableForAttack() && pUnit->isInAccessablePlaceFor(m_creature)) + && pUnit->IsTargetableForAttack() && pUnit->IsInAccessablePlaceFor(m_creature)) AttackStart(pUnit); } @@ -587,10 +587,10 @@ struct npc_death_talon_CaptainAI : public ScriptedAI for (std::list::iterator itr = lCreature.begin(); itr != lCreature.end(); ++itr) { - if (!(*itr)->isAlive()) + if (!(*itr)->IsAlive()) continue; - if (on && m_creature->isAlive()) + if (on && m_creature->IsAlive()) { if (m_creature->IsWithinDistInMap((*itr), 15.0f)) { @@ -607,14 +607,14 @@ struct npc_death_talon_CaptainAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; SetAuraFlames(true); if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE2) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE2) == CAST_OK) m_uiCleaveTimer = urand(4000, 8000); } else @@ -643,7 +643,7 @@ struct npc_death_talon_CaptainAI : public ScriptedAI { if (Unit* pUnit = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pUnit->CastSpell(pUnit, SPELL_MARK_DETONATION, true); m_uiMarkDetonationTimer = 20000; @@ -694,7 +694,7 @@ struct npc_death_talon_SeetherAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFrenzyTimer < uiDiff) @@ -709,14 +709,14 @@ struct npc_death_talon_SeetherAI : public ScriptedAI if (!m_bEngaged) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) m_bEngaged = true; } else { if (m_uiFlameBuffetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BUFFET) == CAST_OK) m_uiFlameBuffetTimer = urand(8000, 12000); } else m_uiFlameBuffetTimer -= uiDiff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp index d23552427..a211b8b0a 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackwing_lair/boss_victor_nefarius.cpp @@ -191,7 +191,7 @@ struct boss_victor_nefariusAI : ScriptedAI scepterRun = false; watchScepterRun = false; - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); // set gossip flag to begin the event m_creature->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR); @@ -259,7 +259,7 @@ struct boss_victor_nefariusAI : ScriptedAI void JustReachedHome() override { - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (m_pInstance) @@ -336,11 +336,11 @@ struct boss_victor_nefariusAI : ScriptedAI break; case 3: DoCastSpellIfCan(m_creature, SPELL_NEFARIUS_BARRIER); - m_creature->setFaction(FACTION_BLACK_DRAGON); + m_creature->SetFactionTemplateId(FACTION_BLACK_DRAGON); Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) - if (i->getSource() && i->getSource()->isAlive()) + if (i->getSource() && i->getSource()->IsAlive()) m_creature->AddThreat(i->getSource(), 10000.0f); DoCastSpellIfCan(m_creature, SPELL_ROOT, CF_TRIGGERED); // root @@ -373,7 +373,7 @@ struct boss_victor_nefariusAI : ScriptedAI } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (phase2bis) @@ -461,7 +461,7 @@ struct boss_victor_nefariusAI : ScriptedAI // Shadowbolt Timer if (m_uiShadowBoltTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLT) == CAST_OK) m_uiShadowBoltTimer = urand(3000, 10000); } else @@ -470,7 +470,7 @@ struct boss_victor_nefariusAI : ScriptedAI // Shadowbolt Volley Timer if (m_uiShadowBoltVolleyTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT_VOLLEY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLT_VOLLEY) == CAST_OK) m_uiShadowBoltVolleyTimer = 15000; } else @@ -531,8 +531,8 @@ struct boss_victor_nefariusAI : ScriptedAI { if (!pTarget->HasAura(SPELL_SHADOW_COMMAND)) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, m_uiMindControledPlayerAggro); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().addThreatDirectly(pTarget, m_uiMindControledPlayerAggro); DoCastSpellIfCan(m_creature, SPELL_ROOT, CF_TRIGGERED); // Root self m_uiMindControledPlayerGuid.Clear(); m_uiMindControledPlayerAggro = 0; @@ -551,7 +551,7 @@ struct boss_victor_nefariusAI : ScriptedAI if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1)) { m_uiMindControledPlayerGuid = pTarget->GetObjectGuid(); - m_uiMindControledPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); + m_uiMindControledPlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_COMMAND, CF_AURA_NOT_PRESENT) == CAST_OK) m_uiMindControlTimer = urand(25000, 40000); } 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 d1405c38e..94f540832 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 @@ -150,13 +150,13 @@ public: { ASSERT(pTechnician); m_vTechniciansGuid.push_back(pTechnician->GetObjectGuid()); - ThreatList threatList = pTechnician->getThreatManager().getThreatList(); + ThreatList threatList = pTechnician->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) { if (Unit *pUnit = m_pInstance->instance->GetCreature((*i)->getUnitGuid())) { m_mThreatGuid[pUnit->GetObjectGuid()] += (*i)->getThreat(); - pTechnician->getThreatManager().modifyThreatPercent(pUnit, -100); + pTechnician->GetThreatManager().modifyThreatPercent(pUnit, -100); } } } @@ -220,16 +220,16 @@ public: { if (Creature *pCreature = m_pInstance->instance->GetCreature(*itr)) { - if (!pCreature->isAlive()) + if (!pCreature->IsAlive()) continue; // Copy the list, since it may get invalidated at 'modifyThreatPercent' call - ThreatList threatList = pCreature->getThreatManager().getThreatList(); + ThreatList threatList = pCreature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) { if (Unit *pUnit = m_pInstance->instance->GetUnit((*i)->getUnitGuid())) { m_mThreatGuid[pUnit->GetObjectGuid()] += (*i)->getThreat(); - pCreature->getThreatManager().modifyThreatPercent(pUnit, -100); + pCreature->GetThreatManager().modifyThreatPercent(pUnit, -100); } } } @@ -342,14 +342,14 @@ struct instance_blackwing_lair : public ScriptedInstance m_auiEncounter[TYPE_RAZORGORE] = IN_PROGRESS; if (Creature* pCreature = instance->GetCreature(m_auiData[DATA_RAZORGORE_GUID])) { - if (pCreature->isAlive() && !pCreature->isInCombat()) + if (pCreature->IsAlive() && !pCreature->IsInCombat()) pCreature->SetInCombatWithZone(); } break; case NPC_RAZORGORE: if (Creature* pCreature = instance->GetCreature(m_auiData[DATA_GRETOK_GUID])) { - if (pCreature->isAlive() && !pCreature->isInCombat()) + if (pCreature->IsAlive() && !pCreature->IsInCombat()) pCreature->SetInCombatWithZone(); } break; @@ -900,9 +900,9 @@ 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_STAT_POSSESSED)) return true; - if (pCreature->isInCombat() && pInstance->GetData64(DATA_EGG) != DONE) + if (pCreature->IsInCombat() && pInstance->GetData64(DATA_EGG) != DONE) { pPlayer->CastSpell(pPlayer, SPELL_MIND_EXHAUSTION, true); pPlayer->CastSpell(pCreature, SPELL_POSSESS, true); @@ -1000,7 +1000,7 @@ struct go_engin_suppressionAI: public GameObjectAI for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { if (me->GetDistance(i->getSource()) <= 15.0f) - if (!i->getSource()->HasStealthAura() && i->getSource()->isAlive() && !i->getSource()->IsGameMaster()) + if (!i->getSource()->HasStealthAura() && i->getSource()->IsAlive() && !i->getSource()->IsGameMaster()) i->getSource()->AddAura(SPELL_SUPPRESSION_AURA); } } @@ -1046,7 +1046,7 @@ bool AreaTrigger_at_orb_of_command(Player* pPlayer, const AreaTriggerEntry* pAt) if (pAt->id == AT_ORB_OF_COMMAND) { Corpse *pCorpse = pPlayer->GetCorpse(); - if (pPlayer && pPlayer->isDead() && pPlayer->GetQuestRewardStatus(7761) && pCorpse && (pCorpse->GetMapId() == 469)) + if (pPlayer && pPlayer->IsDead() && pPlayer->GetQuestRewardStatus(7761) && pCorpse && (pCorpse->GetMapId() == 469)) { pPlayer->ResurrectPlayer(0.5f); pPlayer->SpawnCorpseBones(); @@ -1180,12 +1180,12 @@ struct npc_death_talonAI : public ScriptedAI if (!m_creature->HasAura(m_uiSchoolSensibility)) m_creature->AddAura(m_uiSchoolSensibility); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(5000, 9000); } else @@ -1308,7 +1308,7 @@ struct npc_blackwing_technicianAI : public ScriptedAI // If we don't have a current victim and we're not added to the helper, stop AI. // Have to check the helper if possible in case the victim has died, otherwise // the technician will stand still doing nothing rather than re-targeting - if (!m_creature->getVictim() && !m_bAdded) + if (!m_creature->GetVictim() && !m_bAdded) return; if (m_pTechnicianHelper) @@ -1322,7 +1322,7 @@ struct npc_blackwing_technicianAI : public ScriptedAI m_uiAggroSyncTimer -= uiDiff; } - Unit* victim = m_creature->getVictim(); + Unit* victim = m_creature->GetVictim(); if (m_pTechnicianHelper) if (ObjectGuid victimGuid = m_pTechnicianHelper->GetVictimGuid()) victim = m_pTechnicianHelper->GetInstance()->instance->GetUnit(victimGuid); @@ -1378,7 +1378,7 @@ struct CorruptedWhelpAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp b/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp index 65fb6a3e9..32045a0ad 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/burning_steppes.cpp @@ -44,7 +44,7 @@ struct npc_ragged_johnAI : public ScriptedAI { if (who->HasAura(16468, EFFECT_INDEX_0)) { - if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 15) && who->isInAccessablePlaceFor(m_creature)) + if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 15) && who->IsInAccessablePlaceFor(m_creature)) { DoCastSpellIfCan(who, 16472); ((Player*)who)->AreaExploredOrEventHappens(4866); @@ -62,7 +62,7 @@ CreatureAI* GetAI_npc_ragged_john(Creature* pCreature) bool GossipHello_npc_ragged_john(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) @@ -467,7 +467,7 @@ struct npc_grark_lorkrubAI : public npc_escortAI/*, private DialogueHelper*/ m_uiSomethingWentWrongTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -610,7 +610,7 @@ struct npc_klinfranAI : public ScriptedAI /** Klinfran the Crazed */ void Aggro(Unit* pWho) override { - if (pWho->getClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) + if (pWho->GetClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) { m_hunterGuid = pWho->GetObjectGuid(); } @@ -644,13 +644,13 @@ struct npc_klinfranAI : public ScriptedAI Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 20*MINUTE*IN_MILLISECONDS); if (pCleaner) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); @@ -703,17 +703,17 @@ struct npc_klinfranAI : public ScriptedAI { if (m_uiDespawn_Timer <= uiDiff) { - if (m_creature->isAlive() && !m_creature->isInCombat()) + if (m_creature->IsAlive() && !m_creature->IsInCombat()) DemonDespawn(false); } else m_uiDespawn_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (m_creature->getThreatManager().getThreatList().size() > 1 /*|| pHunter->isDead()*/) + if (m_creature->GetThreatManager().getThreatList().size() > 1 /*|| pHunter->IsDead()*/) DemonDespawn(); if (m_uiDemonic_Frenzy_Timer < uiDiff) 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 049c284d2..fa99f1b76 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 @@ -60,10 +60,10 @@ struct boss_baron_geddonAI : public ScriptedAI m_bInferno = false; m_bArmageddon = false; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_GEDDON, NOT_STARTED); - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); } void Aggro(Unit* pWho) override @@ -81,7 +81,7 @@ struct boss_baron_geddonAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_bArmageddon) @@ -123,7 +123,7 @@ struct boss_baron_geddonAI : public ScriptedAI { if (m_uiRestoreTargetTimer <= diff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { m_creature->SetInFront(pTarget); m_creature->SetTargetGuid(pTarget->GetObjectGuid()); @@ -150,7 +150,7 @@ struct boss_baron_geddonAI : public ScriptedAI InfCount = 0; Tick = 1000; m_bInferno = true; - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); } } else @@ -183,7 +183,7 @@ struct boss_baron_geddonAI : public ScriptedAI case 8: Damage = 2500; m_bInferno = false; - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); break; } m_creature->CastCustomSpell(m_creature, 19698, &Damage, nullptr, nullptr, true); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_garr.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_garr.cpp index a4ca4eb42..4786daf9e 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_garr.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_garr.cpp @@ -51,7 +51,7 @@ struct boss_garrAI : ScriptedAI m_uiCheckAddsTimer = 2000; m_uiExplodeTimer = urand(3000, 6000); - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_GARR, NOT_STARTED); } @@ -132,7 +132,7 @@ struct boss_garrAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiAntiMagicPulseTimer < diff) @@ -205,7 +205,7 @@ struct mob_fireswornAI : ScriptedAI if (Creature* pGarr = m_pInstance->GetSingleCreatureFromStorage(NPC_GARR)) { - if (pGarr->isAlive()) + if (pGarr->IsAlive()) { if (auto pGarrAI = static_cast(pGarr->AI())) pGarrAI->FireswornJustDied(m_creature->GetObjectGuid()); @@ -243,7 +243,7 @@ struct mob_fireswornAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiAnxietyTimer < diff) diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_gehennas.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_gehennas.cpp index a0124c7f2..4e0e0b8d8 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_gehennas.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_gehennas.cpp @@ -54,7 +54,7 @@ struct boss_gehennasAI : public ScriptedAI m_uiShadowBoltRandomTimer = urand(3 * IN_MILLISECONDS, 6 * IN_MILLISECONDS); m_uiShadowBoltTargetTimer = urand(3 * IN_MILLISECONDS, 6 * IN_MILLISECONDS); - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_GEHENNAS, NOT_STARTED); } @@ -73,7 +73,7 @@ struct boss_gehennasAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Rain of Fire @@ -106,7 +106,7 @@ struct boss_gehennasAI : public ScriptedAI // Shadow Bolt (target) if (m_uiShadowBoltTargetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_BOLT_TARGET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_BOLT_TARGET) == CAST_OK) m_uiShadowBoltTargetTimer = urand(3 * IN_MILLISECONDS, 6 * IN_MILLISECONDS); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp index 4a46d13e1..26bb103a1 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_golemagg.cpp @@ -64,7 +64,7 @@ struct boss_golemaggAI : public ScriptedAI TickTimer = 10000; m_bEnraged = false; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_GOLEMAGG, NOT_STARTED); @@ -74,7 +74,7 @@ struct boss_golemaggAI : public ScriptedAI { for (std::list::iterator itr = ChiensListe.begin(); itr != ChiensListe.end(); ++itr) { - if ((*itr)->getDeathState() == ALIVE) + if ((*itr)->GetDeathState() == ALIVE) (*itr)->DealDamage((*itr), (*itr)->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); (*itr)->Respawn(); } @@ -97,7 +97,7 @@ struct boss_golemaggAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Pyroblast @@ -131,7 +131,7 @@ struct boss_golemaggAI : public ScriptedAI { if (m_uiEarthquakeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_EARTHQUAKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_EARTHQUAKE) == CAST_OK) m_uiEarthquakeTimer = 3 * IN_MILLISECONDS; } else @@ -167,7 +167,7 @@ struct mob_core_ragerAI : public ScriptedAI { if (Creature* pGolemagg = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_GOLEMAGG))) { - if (pGolemagg->isAlive()) + if (pGolemagg->IsAlive()) { if (m_creature->GetHealthPercent() < 50.0f) { @@ -183,13 +183,13 @@ struct mob_core_ragerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Mangle if (m_uiMangleTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MANGLE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MANGLE) == CAST_OK) m_uiMangleTimer = 10 * IN_MILLISECONDS; } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp index cc65d0d4b..5fe565f9c 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp @@ -41,7 +41,7 @@ struct boss_lucifronAI : public ScriptedAI m_Events.ScheduleEvent(eEvents::EventCurse, Seconds(20)); // Zerix: 20s Initial Cast, Repeats every 15s. m_Events.ScheduleEvent(eEvents::EventShadowShock, Seconds(6)); // Zerix: 6s Initial Cast, Repeats every 6s. - if (m_Instance && m_creature->isAlive()) + if (m_Instance && m_creature->IsAlive()) m_Instance->SetData(TYPE_LUCIFRON, NOT_STARTED); } @@ -61,7 +61,7 @@ struct boss_lucifronAI : public ScriptedAI void UpdateAI(const uint32 p_Diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; m_Events.Update(p_Diff); diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_magmadar.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_magmadar.cpp index efc954f8d..1a6615ccd 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_magmadar.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_magmadar.cpp @@ -77,7 +77,7 @@ struct boss_magmadarAI : public ScriptedAI if (!m_creature->HasAura(SPELL_MAGMASPIT)) m_creature->CastSpell(m_creature, SPELL_MAGMASPIT, true); - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_MAGMADAR, NOT_STARTED); } @@ -95,7 +95,7 @@ struct boss_magmadarAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Frenzy @@ -113,7 +113,7 @@ struct boss_magmadarAI : public ScriptedAI // Panic if (m_uiPanicTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PANIC) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PANIC) == CAST_OK) m_uiPanicTimer = urand(30000, 35000); } else @@ -138,7 +138,7 @@ struct boss_magmadarAI : public ScriptedAI { //scale at 0 is necessary for spell animation Cre->SetObjectScale(0.0f); - Cre->setFaction(m_creature->getFaction()); + Cre->SetFactionTemplateId(m_creature->GetFactionTemplateId()); } m_uiLavaBombTimer = urand(10000, 13000); m_uiLavaBombTriggerTimer = 500; @@ -170,8 +170,8 @@ struct boss_magmadarAI : public ScriptedAI { if (m_uiRestoreTargetTimer <= diff) { - m_creature->SetInFront(m_creature->getVictim()); - m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); + m_creature->SetInFront(m_creature->GetVictim()); + m_creature->SetTargetGuid(m_creature->GetVictim()->GetObjectGuid()); m_uiRestoreTargetTimer = 0; } else @@ -180,7 +180,7 @@ struct boss_magmadarAI : public ScriptedAI if (m_uiMagmaSpitTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), 19450) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), 19450) == CAST_OK) m_uiMagmaSpitTimer = urand(10000, 20000); } else diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp index cbc5262d2..c21bd7d21 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_majordomo_executus.cpp @@ -117,7 +117,7 @@ struct boss_majordomoAI : public ScriptedAI while (Creature* Add = m_creature->FindNearestCreature(11664, 100.0f, true)) Add->ForcedDespawn(); - if (m_pInstance && m_creature->getFaction() != 35) + if (m_pInstance && m_creature->GetFactionTemplateId() != 35) { if (m_pInstance->GetData(TYPE_MAJORDOMO) != DONE) m_pInstance->SetData(TYPE_MAJORDOMO, NOT_STARTED); @@ -142,7 +142,7 @@ struct boss_majordomoAI : public ScriptedAI { for (std::list::iterator itr = AddListe.begin(); itr != AddListe.end(); ++itr) { - if ((*itr)->isAlive() && AddVivant > 0) + if ((*itr)->IsAlive() && AddVivant > 0) { const CreatureInfo *cinfo = (*itr)->GetCreatureInfo(); (*itr)->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->dmg_min + cinfo->dmg_min / AddVivant); @@ -157,7 +157,7 @@ struct boss_majordomoAI : public ScriptedAI { for (std::list::iterator itr = AddListe.begin(); itr != AddListe.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) { (*itr)->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true); (*itr)->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); @@ -173,7 +173,7 @@ struct boss_majordomoAI : public ScriptedAI { for (std::list::iterator itr = AddListe.begin(); itr != AddListe.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) { m_creature->MonsterYell(SAY_LAST_ADD); (*itr)->SetPower(POWER_MANA, (*itr)->GetMaxPower(POWER_MANA)); @@ -187,7 +187,7 @@ struct boss_majordomoAI : public ScriptedAI { DialogRagnarosTimer = 0; m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); EnterEvadeMode(); DoScriptText(SAY_DEFEAT, m_creature); if (m_pInstance) @@ -200,13 +200,13 @@ struct boss_majordomoAI : public ScriptedAI void KilledUnit(Unit* victim) override { - if (m_creature->getFaction() != 35) + if (m_creature->GetFactionTemplateId() != 35) DoScriptText(SAY_SLAY, m_creature); } void Aggro(Unit *who) override { - if (m_creature->getFaction() != 35) + if (m_creature->GetFactionTemplateId() != 35) DoScriptText(SAY_AGGRO, m_creature); if (m_pInstance) @@ -255,7 +255,7 @@ struct boss_majordomoAI : public ScriptedAI if (Creature* Domo = m_creature->SummonCreature(m_creature->GetEntry(), 847.103f, -816.153f, -229.775f, 4.344f, TEMPSUMMON_TIMED_DESPAWN, (2 * 60 * 60 * 1000))) { Domo->SetUInt32Value(UNIT_NPC_FLAGS, 1); - Domo->setFaction(35); + Domo->SetFactionTemplateId(35); Domo->SetHealth(35); Domo->SetMaxHealth(35); } @@ -321,7 +321,7 @@ struct boss_majordomoAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (m_creature->getFaction() != 35 && AddSpawn == false) + if (m_creature->GetFactionTemplateId() != 35 && AddSpawn == false) { Creature* DomoAdd[8]; for (int i = 0; i < 8; i++) @@ -344,7 +344,7 @@ struct boss_majordomoAI : public ScriptedAI AddSpawn = true; } - if (RagnarosEventStart == true && m_creature->getFaction() == 35) + if (RagnarosEventStart == true && m_creature->GetFactionTemplateId() == 35) { bool Up = false; DialogRagnarosTimer += diff; @@ -358,9 +358,9 @@ struct boss_majordomoAI : public ScriptedAI DomoEvent(); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->getFaction() == 35) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || m_creature->GetFactionTemplateId() == 35) { - if (m_creature->GetDistance2d(758.089f, -1176.71f) < 2.0f && m_creature->getFaction() == 35) + if (m_creature->GetDistance2d(758.089f, -1176.71f) < 2.0f && m_creature->GetFactionTemplateId() == 35) { DialogRagnarosTimer += diff; if (DialogRagnarosTimer > 28000) @@ -378,7 +378,7 @@ struct boss_majordomoAI : public ScriptedAI { uint32 Reflect = rand() % 2 ? SPELL_MAGIC_REFLECTION : SPELL_DAMAGE_REFLECTION; - if (m_creature->getVictim()) + if (m_creature->GetVictim()) m_creature->CastSpell(m_creature, Reflect, true); Reflection_Timer = 30000; } @@ -397,7 +397,7 @@ struct boss_majordomoAI : public ScriptedAI { if (TPDomo_Timer[i] < diff) { - Unit* uTarget = m_creature->getVictim(); + Unit* uTarget = m_creature->GetVictim(); if (i == 1) uTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); if (uTarget && uTarget->IsPlayer() && DoCastSpellIfCan(uTarget, SPELL_TELEPORT) == CAST_OK) 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 7625f2912..5d5852dcb 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 @@ -166,7 +166,7 @@ struct boss_ragnarosAI : ScriptedAI HasAura = true; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) { m_pInstance->SetData(TYPE_RAGNAROS, NOT_STARTED); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); @@ -230,7 +230,7 @@ struct boss_ragnarosAI : ScriptedAI m_creature->ProcessThreatList(dataCopier); if (Unit* randomTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { - Crea->getThreatManager().modifyThreatPercent(randomTarget, 90); + Crea->GetThreatManager().modifyThreatPercent(randomTarget, 90); Crea->AI()->AttackStart(randomTarget); Crea->GetMotionMaster()->MoveChase(randomTarget); } @@ -342,7 +342,7 @@ struct boss_ragnarosAI : ScriptedAI { m_creature->RemoveAurasDueToSpell(SPELL_SUBMERGE_FADE); m_creature->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->SetVisibility(VISIBILITY_ON); if (DoCastSpellIfCan(m_creature, SPELL_EMERGE_VISUAL) == CAST_OK) @@ -373,9 +373,9 @@ struct boss_ragnarosAI : ScriptedAI for (std::list::iterator itr = FilsListe.begin(); itr != FilsListe.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) { - if (!(*itr)->hasUnitState(UNIT_STAT_ISOLATED)) // banished + if (!(*itr)->HasUnitState(UNIT_STAT_ISOLATED)) // banished { Allbanished = false; break; @@ -401,7 +401,7 @@ struct boss_ragnarosAI : ScriptedAI } m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); m_uiSubmergeStateTimer = 0; } else @@ -415,7 +415,7 @@ struct boss_ragnarosAI : ScriptedAI } // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Phase 1 ----------------------------------------------------------------------------------- @@ -427,7 +427,7 @@ struct boss_ragnarosAI : ScriptedAI { if (m_uiRestoreTargetTimer <= diff) { - if (Unit *pTarget = m_creature->getVictim()) + if (Unit *pTarget = m_creature->GetVictim()) { m_creature->SetTargetGuid(pTarget->GetObjectGuid()); m_creature->SetFacingToObject(pTarget); @@ -485,11 +485,11 @@ struct boss_ragnarosAI : ScriptedAI { std::vector manaPlayers; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Player* pPlayer = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid()); - if (pPlayer && pPlayer->isAlive() && pPlayer->getPowerType() == POWER_MANA && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && pPlayer->GetPowerType() == POWER_MANA && !pPlayer->IsGameMaster()) manaPlayers.push_back(pPlayer); } if (!manaPlayers.empty()) @@ -560,16 +560,16 @@ struct boss_ragnarosAI : ScriptedAI void CheckForMelee() { // at first we check for the current player-type target - Unit* pMainTarget = m_creature->getVictim(); + Unit* pMainTarget = m_creature->GetVictim(); if (pMainTarget->GetTypeId() == TYPEID_PLAYER && !pMainTarget->ToPlayer()->IsGameMaster() && m_creature->IsWithinMeleeRange(pMainTarget) && m_creature->IsWithinLOSInMap(pMainTarget)) { m_bInMelee = true; - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + if (m_creature->IsAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { m_creature->AttackerStateUpdate(pMainTarget); - m_creature->resetAttackTimer(); + m_creature->ResetAttackTimer(); } return; @@ -582,15 +582,15 @@ struct boss_ragnarosAI : ScriptedAI m_bInMelee = true; // erase current target's threat as soon as we switch the target now - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); // give the new target aggro - m_creature->getThreatManager().modifyThreatPercent(pTarget, 100); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, 100); - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + if (m_creature->IsAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { m_creature->AttackerStateUpdate(pTarget); - m_creature->resetAttackTimer(); + m_creature->ResetAttackTimer(); } return; @@ -604,15 +604,15 @@ struct boss_ragnarosAI : ScriptedAI SELECT_FLAG_PET | SELECT_FLAG_IN_LOS | SELECT_FLAG_IN_MELEE_RANGE)) { // erase current target's threat as soon as we switch the target now - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); // give the new target aggro - m_creature->getThreatManager().modifyThreatPercent(pTarget, 100); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, 100); - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + if (m_creature->IsAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { m_creature->AttackerStateUpdate(pTarget); - m_creature->resetAttackTimer(); + m_creature->ResetAttackTimer(); } return; @@ -623,15 +623,15 @@ struct boss_ragnarosAI : ScriptedAI SELECT_FLAG_NOT_PLAYER | SELECT_FLAG_IN_LOS | SELECT_FLAG_IN_MELEE_RANGE)) { // erase current target's threat as soon as we switch the target now - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); // give the new target aggro - m_creature->getThreatManager().modifyThreatPercent(pTarget, 100); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, 100); - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + if (m_creature->IsAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) { m_creature->AttackerStateUpdate(pTarget); - m_creature->resetAttackTimer(); + m_creature->ResetAttackTimer(); } //sLog.outError("[MoltenCore.Ragnaros] Target type #4 reached with name <%s> and entry <%u>.", pTarget->GetName(), pTarget->GetEntry()); @@ -661,11 +661,11 @@ struct boss_flame_of_ragnarosAI : ScriptedAI void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetLevel(63); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->CastSpell(m_creature, SPELL_INTENSE_HEAT, false); Explode = false; } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_shazzrah.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_shazzrah.cpp index ad98fc01b..0d321a875 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_shazzrah.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_shazzrah.cpp @@ -57,7 +57,7 @@ struct boss_shazzrahAI : public ScriptedAI Countspell_Timer = 15000; Blink_Timer = urand(25000, 30000); - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_SHAZZRAH, NOT_STARTED); } @@ -75,13 +75,13 @@ struct boss_shazzrahAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEEXPLOSION) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEEXPLOSION) == CAST_OK) ArcaneExplosion_Timer = urand(3000, 5000); } else ArcaneExplosion_Timer -= diff; @@ -89,7 +89,7 @@ struct boss_shazzrahAI : public ScriptedAI //ShazzrahCurse_Timer if (ShazzrahCurse_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHAZZRAHCURSE, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHAZZRAHCURSE, CF_AURA_NOT_PRESENT) == CAST_OK) ShazzrahCurse_Timer = 20000; } else ShazzrahCurse_Timer -= diff; @@ -105,7 +105,7 @@ struct boss_shazzrahAI : public ScriptedAI //Countspell_Timer if (Countspell_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_COUNTERSPELL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_COUNTERSPELL) == CAST_OK) Countspell_Timer = urand(16000, 18000); } else Countspell_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp index 62cd7127e..7617c302e 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_sulfuron_harbinger.cpp @@ -57,7 +57,7 @@ struct boss_sulfuronAI : public ScriptedAI Knockdown_Timer = 6000; Flamespear_Timer = 2000; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_SULFURON, NOT_STARTED); } @@ -76,13 +76,13 @@ struct boss_sulfuronAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //DemoralizingShout_Timer if (DemoralizingShout_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DEMORALIZINGSHOUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DEMORALIZINGSHOUT) == CAST_OK) DemoralizingShout_Timer = urand(15000, 20000); } else DemoralizingShout_Timer -= diff; @@ -113,7 +113,7 @@ struct boss_sulfuronAI : public ScriptedAI //Knockdown_Timer if (Knockdown_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKDOWN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKDOWN) == CAST_OK) Knockdown_Timer = urand(12000, 15000); } else Knockdown_Timer -= diff; @@ -132,7 +132,7 @@ struct boss_sulfuronAI : public ScriptedAI //DarkStrike_Timer if (Darkstrike_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DARKSTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DARKSTRIKE) == CAST_OK) Darkstrike_Timer = urand(15000, 18000); } else Darkstrike_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp index 2cf34854a..cc8065ebd 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/instance_molten_core.cpp @@ -204,7 +204,7 @@ struct instance_molten_core : ScriptedInstance void OnCreatureEnterCombat(Creature* pCreature) override { - Unit* victim = pCreature->getVictim(); + Unit* victim = pCreature->GetVictim(); if (!victim) return; std::list DomoListe; @@ -220,7 +220,7 @@ struct instance_molten_core : ScriptedInstance { for (std::list::iterator itr = DomoListe.begin(); itr != DomoListe.end(); ++itr) { - if ((*itr)->isAlive() && !(*itr)->isInCombat()) + if ((*itr)->IsAlive() && !(*itr)->IsInCombat()) (*itr)->SetInCombatWith(victim); } } diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp index 50b8ea51c..f9156d7c1 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/molten_core.cpp @@ -70,7 +70,7 @@ struct FirewalkerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFireBlossomCasting_Timer < uiDiff) @@ -86,7 +86,7 @@ struct FirewalkerAI : public ScriptedAI if (m_uiInciteFlames_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_INCITE_FLAMES) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_INCITE_FLAMES) == CAST_OK) m_uiInciteFlames_Timer = 20000; } else @@ -192,9 +192,9 @@ struct mob_ancient_core_houndAI : public ScriptedAI /* void MoveInLineOfSight(Unit *pWho) override { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) { - if (pWho->IsPlayer() && m_creature->IsWithinDistInMap(pWho, 20.0f) && pWho->isTargetableForAttack()) + if (pWho->IsPlayer() && m_creature->IsWithinDistInMap(pWho, 20.0f) && pWho->IsTargetableForAttack()) { // allow Soothe Animal to lower aggro range if (m_creature->HasAuraType(SPELL_AURA_MOD_DETECT_RANGE) && !m_creature->IsWithinDistInMap(pWho, 10.0f)) @@ -209,7 +209,7 @@ struct mob_ancient_core_houndAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiConeOfFireTimer < uiDiff) @@ -228,21 +228,21 @@ struct mob_ancient_core_houndAI : public ScriptedAI if (m_uiBiteTimer < uiDiff) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_BITE, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_BITE, false); m_uiBiteTimer = 6000; } } else m_uiBiteTimer -= uiDiff; - if (m_creature->isAttackReady()) + if (m_creature->IsAttackReady()) { //If we are within range melee the target - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_VICIOUS_BITE, true); - m_creature->resetAttackTimer(); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_VICIOUS_BITE, true); + m_creature->ResetAttackTimer(); } } } @@ -293,7 +293,7 @@ struct mob_core_houndAI : public ScriptedAI void FeignDeath() { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; m_creature->MonsterTextEmote("Core Hound collapses and begins to smolder."); @@ -342,7 +342,7 @@ struct mob_core_houndAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || !m_pInstance) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || !m_pInstance) return; // Resurrect pack if not died during 10 seconds @@ -356,7 +356,7 @@ struct mob_core_houndAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_CoreHoundList, m_creature, NPC_CORE_HOUND, 100.0f); for (std::list::const_iterator itr = m_CoreHoundList.begin(); itr != m_CoreHoundList.end(); ++itr) { - if ((*itr) && (*itr)->isInCombat()) + if ((*itr) && (*itr)->IsInCombat()) { if ((*itr)->GetHealth() > 0) m_bResurrectionOkay = true; @@ -381,7 +381,7 @@ struct mob_core_houndAI : public ScriptedAI //Serrated Bite if (m_uiSerratedBiteTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(),SPELL_SERRATED_BITE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(),SPELL_SERRATED_BITE) == CAST_OK) m_uiSerratedBiteTimer = urand(4000, 7000); } else @@ -441,7 +441,7 @@ struct mob_firelordAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Summon Lava Spawn @@ -508,7 +508,7 @@ struct mob_lava_surgerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->HasAuraType(SPELL_AURA_MOD_STUN)) // don't update CDs while Banished diff --git a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp index 159457ddb..8edfc1751 100644 --- a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp +++ b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/boss_thermaplugg.cpp @@ -143,7 +143,7 @@ struct boss_thermapluggAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Movement of Summoned mobs @@ -172,7 +172,7 @@ struct boss_thermapluggAI : public ScriptedAI } else { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = urand(17000, 20000); } } diff --git a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp index fca0a7e19..bc74d7fe3 100644 --- a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp +++ b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp @@ -348,7 +348,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI void UpdateEscortAI(uint32 const uiDiff) override { // the phases are handled OOC (keeps them in sync with the waypoints) - if (m_uiPhaseTimer && !m_creature->getVictim()) + if (m_uiPhaseTimer && !m_creature->GetVictim()) { if (m_uiPhaseTimer <= uiDiff) { @@ -594,7 +594,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI m_uiPhaseTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -713,7 +713,7 @@ struct npc_kernobeeAI : public FollowerAI m_nextStepTimer -= uiDiff; } - if (m_creature->isInCombat() || !HasFollowState(STATE_FOLLOW_INPROGRESS) || HasFollowState(STATE_FOLLOW_COMPLETE)) + if (m_creature->IsInCombat() || !HasFollowState(STATE_FOLLOW_INPROGRESS) || HasFollowState(STATE_FOLLOW_COMPLETE)) return; if (nextStep == 1) /*HasFollowState(STATE_FOLLOW_PAUSED)*/ diff --git a/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp b/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp index 7b7002639..37fa91f95 100644 --- a/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp +++ b/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp @@ -28,7 +28,7 @@ enum void Handle_NightmareCorruption(/*const*/ Player* player) { - if (player->isDead() || player->GetQuestStatus(QUEST_NIGHTMARE_CORRUPTION) != QUEST_STATUS_INCOMPLETE) + if (player->IsDead() || player->GetQuestStatus(QUEST_NIGHTMARE_CORRUPTION) != QUEST_STATUS_INCOMPLETE) { return; } @@ -102,7 +102,7 @@ struct npc_twilight_corrupterAI : ScriptedAI for (int i = 0; i < 40; i++) GUIDs[i] = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()); @@ -116,7 +116,7 @@ struct npc_twilight_corrupterAI : ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSoulCorruptionTimer < uiDiff) @@ -133,8 +133,8 @@ struct npc_twilight_corrupterAI : ScriptedAI { if (!pTarget->HasAura(SPELL_CREATURE_OF_NIGHTMARE)) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, CoNPlayerAggro); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().addThreatDirectly(pTarget, CoNPlayerAggro); CoNPlayerGuid = 0; CoNPlayerAggro = 0; } @@ -152,7 +152,7 @@ struct npc_twilight_corrupterAI : ScriptedAI if (pTarg && pTarg->IsPlayer()) { CoNPlayerGuid = pTarg->GetGUID(); - CoNPlayerAggro = m_creature->getThreatManager().getThreat(pTarg); + CoNPlayerAggro = m_creature->GetThreatManager().getThreat(pTarg); if (DoCastSpellIfCan(pTarg, SPELL_CREATURE_OF_NIGHTMARE) == CAST_OK) m_uiCreatureOfNightmareTimer = urand(35000, 40000); } @@ -167,7 +167,7 @@ struct npc_twilight_corrupterAI : ScriptedAI { if (Player* player = m_creature->GetMap()->GetPlayer(GUIDs[i])) { - if (player->isDead()) + if (player->IsDead()) { char eMessage[200]; sprintf(eMessage, "Twilight Corrupter squeezes the last bit of life out of %s and swallows their soul.", player->GetName()); @@ -313,7 +313,7 @@ struct npc_commander_felstromAI : ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSuicide_Timer < uiDiff) @@ -467,7 +467,7 @@ struct npc_stitchesAI : npc_escortAI void JustDied(Unit* /*pKiller*/) override { auto pTownCrier = m_creature->GetMap()->GetCreature(m_townCrierGuid); - if (pTownCrier && pTownCrier->isAlive()) + if (pTownCrier && pTownCrier->IsAlive()) pTownCrier->MonsterYellToZone(TOWNCRIER_YELL_5); DespawnWatcher(); @@ -490,7 +490,7 @@ struct npc_stitchesAI : npc_escortAI if (pUnit && (pUnit->GetEntry() == NPC_WATCHER_SELKIN)) { auto pTownCrier = m_creature->GetMap()->GetCreature(m_townCrierGuid); - if (pTownCrier && pTownCrier->isAlive()) + if (pTownCrier && pTownCrier->IsAlive()) pTownCrier->MonsterYellToZone(TOWNCRIER_YELL_3); } } @@ -501,7 +501,7 @@ struct npc_stitchesAI : npc_escortAI { if (auto pWatchman = m_creature->GetMap()->GetCreature(*itr)) { - if (pWatchman->isAlive()) + if (pWatchman->IsAlive()) pWatchman->DisappearAndDie(); } } @@ -583,7 +583,7 @@ struct npc_stitchesAI : npc_escortAI case 30: { auto pTownCrier = m_creature->GetMap()->GetCreature(m_townCrierGuid); - if (pTownCrier && pTownCrier->isAlive()) + if (pTownCrier && pTownCrier->IsAlive()) pTownCrier->MonsterYellToZone(TOWNCRIER_YELL_1); } break; @@ -597,7 +597,7 @@ struct npc_stitchesAI : npc_escortAI case 35: { auto pTownCrier = m_creature->GetMap()->GetCreature(m_townCrierGuid); - if (pTownCrier && pTownCrier->isAlive()) + if (pTownCrier && pTownCrier->IsAlive()) pTownCrier->MonsterYellToZone(TOWNCRIER_YELL_2); } break; @@ -616,7 +616,7 @@ struct npc_stitchesAI : npc_escortAI SummonWatchman(7); SummonWatchman(8); auto pTownCrier = m_creature->GetMap()->GetCreature(m_townCrierGuid); - if (pTownCrier && pTownCrier->isAlive()) + if (pTownCrier && pTownCrier->IsAlive()) pTownCrier->MonsterYellToZone(TOWNCRIER_YELL_4); } break; @@ -652,12 +652,12 @@ struct npc_stitchesAI : npc_escortAI m_uiLaunchTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiAuraOfRotTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AURA_OF_ROT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AURA_OF_ROT) == CAST_OK) m_uiAuraOfRotTimer = 3000; } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp index 5d50e8cfd..e1604771d 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp @@ -69,10 +69,10 @@ bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) bool GossipHello_npc_tirion_fordring(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) + if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->GetStandState() == UNIT_STAND_STATE_SIT) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am ready to hear your tale, Tirion.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); @@ -276,22 +276,22 @@ struct npc_eris_havenfireAI : public ScriptedAI Creature* curr = tmpMobsList.front(); tmpMobsList.pop_front(); - if (curr->isAlive()) + if (curr->IsAlive()) summoned->AddThreat(curr, float(urand(100, 200))); } } if (Player* player = GetPlayer()) - if (player->isAlive()) + if (player->IsAlive()) { summoned->AddThreat(player, 50.0f); if ((rand() % 4) > 0) { - if (Unit* victim = summoned->getVictim()) + if (Unit* victim = summoned->GetVictim()) summoned->SendMeleeAttackStop(victim); summoned->AddThreat(player, 200.0f); summoned->GetMotionMaster()->Clear(false); summoned->GetMotionMaster()->MoveChase(player); - if (Unit* victim = summoned->getVictim()) + if (Unit* victim = summoned->GetVictim()) summoned->SendMeleeAttackStart(victim); } } @@ -317,7 +317,7 @@ struct npc_eris_havenfireAI : public ScriptedAI Creature* curr = tmpMobsList.front(); tmpMobsList.pop_front(); - if (curr->isAlive()) + if (curr->IsAlive()) curr->ForcedDespawn(); } } @@ -338,7 +338,7 @@ struct npc_eris_havenfireAI : public ScriptedAI ArchersGUIDs[Var] = summoned->GetGUID(); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summoned->addUnitState(UNIT_STAT_ROOT); + summoned->AddUnitState(UNIT_STAT_ROOT); break; case NPC_GUERRIER: SetAttackOnPeasantOrPlayer(summoned); @@ -354,7 +354,7 @@ struct npc_eris_havenfireAI : public ScriptedAI VillageoisGUIDs[Var] = summoned->GetGUID(); if (Player* player = GetPlayer()) - summoned->setFaction(player->getFaction()); + summoned->SetFactionTemplateId(player->GetFactionTemplateId()); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); break; } @@ -579,7 +579,7 @@ struct npc_eris_havenfireAI : public ScriptedAI if (currPlayer->IsGameMaster()) continue; - if (currPlayer->isAlive() && questPlayer != currPlayer) + if (currPlayer->IsAlive() && questPlayer != currPlayer) return true; } } @@ -606,7 +606,7 @@ struct npc_eris_havenfireAI : public ScriptedAI { Player* currPlayer = it->getSource(); if (currPlayer && m_creature->GetAreaId() == myArea && m_creature->IsWithinDist(currPlayer, 80.0f, false)) - if (player && player != currPlayer && currPlayer->isAlive() && !currPlayer->IsGameMaster()) + if (player && player != currPlayer && currPlayer->IsAlive() && !currPlayer->IsGameMaster()) Crea->AddThreat(currPlayer, 1000.0f); } } @@ -679,7 +679,7 @@ struct npc_eris_havenfireAI : public ScriptedAI if (VillageoisGUIDs[Var]) { Unit* Villagois = m_creature->GetMap()->GetCreature(VillageoisGUIDs[Var]); - if (Villagois && Villagois->isAlive()) + if (Villagois && Villagois->IsAlive()) { GUIDs[var] = VillageoisGUIDs[Var]; ++var; @@ -931,21 +931,21 @@ struct npc_demetriaAI : public ScriptedAI { if (Creature* deadTrooper = m_creature->FindNearestCreature(NPC_SCARLET_TROOPER, 40.0f, false)) { - DoRessurectUnit(deadTrooper, m_creature->getVictim()); + DoRessurectUnit(deadTrooper, m_creature->GetVictim()); Resurrect_Timer = 10000; } } else Resurrect_Timer -= diff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!(m_creature->GetSpellAuraHolder(SPELL_SHADOWFORM))) DoCastSpellIfCan(m_creature, SPELL_SHADOWFORM); if (MindBlast_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_BLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_BLAST) == CAST_OK) MindBlast_Timer = urand(4000, 5000); } else @@ -988,7 +988,7 @@ struct npc_demetriaAI : public ScriptedAI } else { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISPELL_MAGIC2) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISPELL_MAGIC2) == CAST_OK) DispelMagic_Timer = 6000; } } @@ -1143,7 +1143,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI for (Map::PlayerList::const_iterator it = pl.begin(); it != pl.end(); ++it) { Player* pPlayer = it->getSource(); - if (pPlayer && pPlayer->isAlive() && !pPlayer->IsGameMaster() && m_creature->IsWithinDist(pPlayer, 20.0f, false)) + if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsGameMaster() && m_creature->IsWithinDist(pPlayer, 20.0f, false)) { if (pPlayer->GetQuestStatus(QUEST_BATTLE_DARROWSHIRE) == QUEST_STATUS_INCOMPLETE) { @@ -1188,7 +1188,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI for (std::list::const_iterator itr = summonedMobsList.begin(); itr != summonedMobsList.end(); ++itr) if (Creature* creature = m_creature->GetMap()->GetCreature(*itr)) - if (creature->isAlive() && creature->GetEntry() != NPC_JOSEPH_REDPATH && creature->GetEntry() != NPC_DAVIL_CROKFORD) + if (creature->IsAlive() && creature->GetEntry() != NPC_JOSEPH_REDPATH && creature->GetEntry() != NPC_DAVIL_CROKFORD) creature->ForcedDespawn(5000); summonedMobsList.clear(); @@ -1213,7 +1213,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI case NPC_DARROWSHIRE_DEFENDER: case NPC_SILVERHAND_DISCIPLE: case NPC_REDPATH_MILITIA: - summoned->setFaction(DefenderFaction); + summoned->SetFactionTemplateId(DefenderFaction); // no break case NPC_MARAUDING_CORPSE: case NPC_MARAUDING_SKELETON: @@ -1227,7 +1227,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI break; case NPC_DAVIL_LIGHTFIRE: case NPC_CAPTAIN_REDPATH: - summoned->setFaction(DefenderFaction); + summoned->SetFactionTemplateId(DefenderFaction); summoned->SetWalk(false); summoned->SetHomePosition(DarrowshireEvent[4].X, DarrowshireEvent[4].Y, DarrowshireEvent[4].Z, DarrowshireEvent[4].O); summoned->GetMotionMaster()->MovePoint(2, DarrowshireEvent[4].X, DarrowshireEvent[4].Y, DarrowshireEvent[4].Z, MOVE_PATHFINDING, 5.0f); @@ -1494,7 +1494,7 @@ struct npc_darrowshire_triggerAI : public ScriptedAI if (Crea->GetEntry() != NPC_BLOODLETTER && Crea->GetEntry() != NPC_DAVIL_LIGHTFIRE && Crea->GetEntry() != NPC_CAPTAIN_REDPATH) continue; - if (Crea->isAlive() && !Crea->isInCombat() && Crea->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + if (Crea->IsAlive() && !Crea->IsInCombat() && Crea->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) { int point = 0; int Rand = 0; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_anubrekhan.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_anubrekhan.cpp index 0762956c9..c4a1f8475 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_anubrekhan.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_anubrekhan.cpp @@ -330,7 +330,7 @@ struct boss_anubrekhanAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { if (pWho->GetTypeId() == TYPEID_PLAYER - && !m_creature->isInCombat() + && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 55.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { @@ -385,7 +385,7 @@ struct boss_anubrekhanAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) @@ -395,8 +395,8 @@ struct boss_anubrekhanAI : public ScriptedAI { if (m_uiRestoreTargetTimer <= uiDiff) { - m_creature->SetInFront(m_creature->getVictim()); - m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); + m_creature->SetInFront(m_creature->GetVictim()); + m_creature->SetTargetGuid(m_creature->GetVictim()->GetObjectGuid()); m_uiRestoreTargetTimer = 0; } else @@ -447,8 +447,8 @@ struct boss_anubrekhanAI : public ScriptedAI // restore target at once if we have just done an impale if (m_uiRestoreTargetTimer) { - m_creature->SetInFront(m_creature->getVictim()); - m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); + m_creature->SetInFront(m_creature->GetVictim()); + m_creature->SetTargetGuid(m_creature->GetVictim()->GetObjectGuid()); m_uiRestoreTargetTimer = 0; } @@ -512,7 +512,7 @@ struct mob_cryptguardsAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Crypt guards enrage at 50% @@ -534,7 +534,7 @@ struct mob_cryptguardsAI : public ScriptedAI } if (cleaveTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CRYPTGUARD_CLEAVE) == CanCastResult::CAST_OK) { + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CRYPTGUARD_CLEAVE) == CanCastResult::CAST_OK) { cleaveTimer = CRYPTGUARD_CLEAVE_CD; } } @@ -543,7 +543,7 @@ struct mob_cryptguardsAI : public ScriptedAI } if (acidSpitTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CRYPTGUARD_ACID) == CanCastResult::CAST_OK) { + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CRYPTGUARD_ACID) == CanCastResult::CAST_OK) { acidSpitTimer = CRYPTGUARD_ACID_CD; } } @@ -587,7 +587,7 @@ struct anub_doorAI : public GameObjectAI // on door open, while the rest are said at random points during the fight? if (Creature* anubRekhan = m_pInstance->GetSingleCreatureFromStorage(NPC_ANUB_REKHAN)) { - if (anubRekhan->isAlive()) { + if (anubRekhan->IsAlive()) { switch (urand(0, 4)) { case 0: diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_faerlina.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_faerlina.cpp index cefb1330c..d409a453c 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_faerlina.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_faerlina.cpp @@ -240,7 +240,7 @@ struct boss_faerlinaAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) @@ -263,7 +263,7 @@ struct boss_faerlinaAI : public ScriptedAI } else { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_POSIONBOLT_VOLLEY) == CanCastResult::CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POSIONBOLT_VOLLEY) == CanCastResult::CAST_OK) { m_uiPoisonBoltVolleyTimer = POSIONBOLT_VOLLEY_CD(); } @@ -347,7 +347,7 @@ struct mob_faerlina_rp : public ScriptedAI Reset(); break; } - if ((*creatures.begin())->isInCombat()) + if ((*creatures.begin())->IsInCombat()) { Reset(); break; @@ -355,7 +355,7 @@ struct mob_faerlina_rp : public ScriptedAI for (auto it = creatures.begin(); it != creatures.end();) { - if ((*it)->isDead()) + if ((*it)->IsDead()) it = creatures.erase(it); else ++it; 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 93abda85c..80db055f9 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 @@ -163,13 +163,13 @@ struct boss_four_horsemen_shared : public ScriptedAI if (m_creature->GetDistanceToCenter(pPlayer) > 74.0f) continue; bool alert; - if (!pPlayer->isVisibleForOrDetect(m_creature, m_creature, true, false, &alert)) + if (!pPlayer->IsVisibleForOrDetect(m_creature, m_creature, true, false, &alert)) return; - if (m_creature->CanInitiateAttack() && pPlayer->isTargetableForAttack() && m_creature->IsHostileTo(pPlayer)) + if (m_creature->CanInitiateAttack() && pPlayer->IsTargetableForAttack() && m_creature->IsHostileTo(pPlayer)) { - if (pPlayer->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pPlayer)) + if (pPlayer->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pPlayer)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { AttackStart(pPlayer); return; @@ -194,11 +194,11 @@ struct boss_four_horsemen_shared : public ScriptedAI if (!m_creature->IsWithinDistInMap(pWho, 75.0f)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -231,7 +231,7 @@ struct boss_four_horsemen_shared : public ScriptedAI if (m_bIsSpirit) { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->SetInCombatWithZone(); } else @@ -351,13 +351,13 @@ struct boss_four_horsemen_shared : public ScriptedAI { m_uiMarkTimer = 12000; //todo: this behavior should get some more confirmation - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { Unit* pUnit = m_creature->GetMap()->GetUnit( (*itr)->getUnitGuid()); - if (pUnit && m_creature->getThreatManager().getThreat(pUnit)) - m_creature->getThreatManager().modifyThreatPercent(pUnit, -50); + if (pUnit && m_creature->GetThreatManager().getThreat(pUnit)) + m_creature->GetThreatManager().modifyThreatPercent(pUnit, -50); } } } @@ -447,7 +447,7 @@ struct boss_lady_blaumeuxAI : public boss_four_horsemen_shared void UpdateAI(const uint32 uiDiff) override { AggroRadius(uiDiff); - if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->getVictim())) + if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())) return; if (!m_bIsSpirit && !m_pInstance->HandleEvadeOutOfHome(m_creature)) return; @@ -568,7 +568,7 @@ struct boss_highlord_mograineAI : public boss_four_horsemen_shared { AggroRadius(uiDiff); - if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->getVictim())) + if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())) return; if (!m_bIsSpirit && !m_pInstance->HandleEvadeOutOfHome(m_creature)) return; @@ -656,7 +656,7 @@ struct boss_thane_korthazzAI : public boss_four_horsemen_shared { AggroRadius(uiDiff); - if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->getVictim())) + if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())) return; if (!m_bIsSpirit && !m_pInstance->HandleEvadeOutOfHome(m_creature)) return; @@ -755,7 +755,7 @@ struct boss_sir_zeliekAI : public boss_four_horsemen_shared AggroRadius(uiDiff); //Return since we have no target - if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->getVictim())) + if (!m_bIsSpirit && (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())) return; if (!m_bIsSpirit && !m_pInstance->HandleEvadeOutOfHome(m_creature)) return; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gluth.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gluth.cpp index fa62a4a6b..69386bd16 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gluth.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gluth.cpp @@ -116,7 +116,7 @@ struct boss_gluthAI : public ScriptedAI { // He should aggro just at the edge of the sewer pipe players jump from if (pWho->GetTypeId() == TYPEID_PLAYER - && !m_creature->isInCombat() + && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 49.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { @@ -158,7 +158,7 @@ struct boss_gluthAI : public ScriptedAI { Player* pPlayer = (*it).getSource(); if (!pPlayer) continue; - if (pPlayer->isDead()) continue; + if (pPlayer->IsDead()) continue; DoCastSpellIfCan(pPlayer, SPELL_DECIMATE_OTHER, CF_TRIGGERED); } } @@ -166,7 +166,7 @@ struct boss_gluthAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; m_events.Update(uiDiff); @@ -177,7 +177,7 @@ struct boss_gluthAI : public ScriptedAI case EVENT_MORTAL_WOUND: { // mortal wound current target every - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALWOUND) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALWOUND) == CAST_OK) m_events.Repeat(MORTAL_WOUND_CD); else m_events.Repeat(100); @@ -271,7 +271,7 @@ struct boss_gluthAI : public ScriptedAI return; for (auto it = chowableZombies.begin(); it != chowableZombies.end(); ++it) { - if (!(*it)->isAlive()) + if (!(*it)->IsAlive()) continue; // Using 2d distance, should do fine @@ -362,7 +362,7 @@ struct mob_zombieChow : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp index 50b52f92b..bfd000ccd 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_gothik.cpp @@ -186,7 +186,7 @@ struct boss_gothikAI : public ScriptedAI void SummonAdd(uint32 entry, float x, float y, float z, float o) { - if (!m_creature->isInCombat() && !m_creature->isDead()) + if (!m_creature->IsInCombat() && !m_creature->IsDead()) return; if (Creature *pCreature = m_creature->SummonCreature(entry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 420000)) @@ -346,7 +346,7 @@ struct boss_gothikAI : public ScriptedAI if (const Player* p = playerRef.getSource()) { // Don't count dead players, except those feigned - if (p->isDead() && !p->HasAura(SPELL_AURA_FEIGN_DEATH)) + if (p->IsDead() && !p->HasAura(SPELL_AURA_FEIGN_DEATH)) continue; if(m_pInstance->IsInRightSideGothArea(p)) @@ -366,14 +366,14 @@ struct boss_gothikAI : public ScriptedAI { if(!m_creature->HasAura(SPELL_IMMUNE_ALL)) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) return; } else { - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) { EnterEvadeMode(); } @@ -484,12 +484,12 @@ struct boss_gothikAI : public ScriptedAI // Prevent units in the other side of the room getting aggro from dots if (!gatesOpened) { - if (Unit* victim = m_creature->getVictim()) + if (Unit* victim = m_creature->GetVictim()) { bool unitIsRight = m_pInstance->IsInRightSideGothArea(victim); if ((m_bRightSide && !unitIsRight) || (!m_bRightSide && unitIsRight)) { - m_creature->getThreatManager().modifyThreatPercent(victim, -100); + m_creature->GetThreatManager().modifyThreatPercent(victim, -100); m_creature->SelectHostileTarget(); } } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_grobbulus.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_grobbulus.cpp index 0438e5e91..11efa115f 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_grobbulus.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_grobbulus.cpp @@ -131,7 +131,7 @@ struct boss_grobbulusAI : public ScriptedAI return false; std::vector suitableTargets; - ThreatList const& threatList = m_creature->getThreatManager().getThreatList(); + ThreatList const& threatList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { @@ -168,7 +168,7 @@ struct boss_grobbulusAI : public ScriptedAI void UpdateSlimeStream(uint32 uiDiff) { - if (m_creature->CanReachWithMeleeAutoAttack(m_creature->getVictim())) + if (m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim())) m_uiSlimeStreamTimer = SLIMESTREAM_REPEAT_CD; else { @@ -184,7 +184,7 @@ struct boss_grobbulusAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) @@ -212,7 +212,7 @@ struct boss_grobbulusAI : public ScriptedAI m_events.Repeat(100); break; case EVENT_SLIME_SPRAY: - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SLIME_SPRAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SLIME_SPRAY) == CAST_OK) { m_events.Repeat(SLIMESPRAY_CD(false)); //DoScriptText(EMOTE_SPRAY_SLIME, m_creature); @@ -240,7 +240,7 @@ struct grob_poison_cloud : public ScriptedAI uint32 untilDespawn; void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); untilDespawn = 70000; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_heigan.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_heigan.cpp index 1ec8df588..e23101d01 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_heigan.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_heigan.cpp @@ -167,11 +167,11 @@ struct boss_heiganAI : public ScriptedAI { if (pWho->GetPositionX() > 2825.0f) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -342,15 +342,15 @@ struct boss_heiganAI : public ScriptedAI eruptionPhase = 0; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); } void EventPortPlayer() { - const ThreatList& tl = m_creature->getThreatManager().getThreatList(); + const ThreatList& tl = m_creature->GetThreatManager().getThreatList(); std::vector candidates; auto it = tl.begin(); ++it; // skip the tank @@ -359,7 +359,7 @@ struct boss_heiganAI : public ScriptedAI if (Unit* pUnit = m_creature->GetMap()->GetUnit((*it)->getUnitGuid())) { // Candidates are only alive players who have not yet been ported during this phase rotation - if (pUnit->IsPlayer() && pUnit->isAlive() + if (pUnit->IsPlayer() && pUnit->IsAlive() && std::find(portedPlayersThisPhase.begin(), portedPlayersThisPhase.end(), pUnit->GetObjectGuid()) == portedPlayersThisPhase.end()) { candidates.push_back(pUnit); @@ -415,13 +415,13 @@ struct boss_heiganAI : public ScriptedAI { // Looking for anyone with a manabar, currently excluded pets and totems // within 25yd range (radius of SPELL_MANABURN). If there is one we cast SPELL_MANABURN - const auto& tl = m_creature->getThreatManager().getThreatList(); + const auto& tl = m_creature->GetThreatManager().getThreatList(); bool found_mana_in_range = false; for (auto it = tl.begin(); it != tl.end(); ++it) { if (Unit* pTarget = m_creature->GetMap()->GetUnit((*it)->getUnitGuid())) { - if (pTarget->getPowerType() == POWER_MANA && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) + if (pTarget->GetPowerType() == POWER_MANA && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->IsAlive()) { if (m_creature->GetDistanceToCenter((*it)->getTarget()) < 28.0f) { @@ -443,14 +443,14 @@ struct boss_heiganAI : public ScriptedAI // This will avoid him running off the platform during dance phase. if (currentPhase == PHASE_FIGHT) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) return; } else { // If wipe, we force the dance phase to end so above code runs and he evades. - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) EventDanceEnd(); } @@ -507,7 +507,7 @@ struct mob_plague_cloudAI : public ScriptedAI } void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_kelthuzad.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_kelthuzad.cpp index 383931186..f847a0f70 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_kelthuzad.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_kelthuzad.cpp @@ -623,7 +623,7 @@ struct boss_kelthuzadAI : public ScriptedAI timeSinceLastShadowFissure += diff; timeSinceLastAEFrostBolt += diff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetHealthPercent() < 40.0f && !p3Started) @@ -722,7 +722,7 @@ struct boss_kelthuzadAI : public ScriptedAI case EVENT_FROSTBOLT: { events.Repeat(Seconds(urand(5, 7))); // todo: this is guesswork - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_BOLT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROST_BOLT); break; } case EVENT_SHADOW_FISSURE: @@ -787,7 +787,7 @@ struct boss_kelthuzadAI : public ScriptedAI if (hasPutInCombat) { // won't have a victim if we are in p1, even if selectHostileTarget returns true, so check that before return - if (!m_creature->SelectHostileTarget() || (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && !m_creature->getVictim())) + if (!m_creature->SelectHostileTarget() || (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && !m_creature->GetVictim())) return; } @@ -832,13 +832,13 @@ struct mob_abomAI : public kt_p1AddAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (mortalWoundTimer < diff) { - if(m_creature->getVictim() && m_creature->IsWithinMeleeRange(m_creature->getVictim())) - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_WOUND) == CAST_OK) + if(m_creature->GetVictim() && m_creature->IsWithinMeleeRange(m_creature->GetVictim())) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_WOUND) == CAST_OK) mortalWoundTimer = 7500; } else @@ -858,22 +858,22 @@ struct mob_soldierAI : public kt_p1AddAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_creature->HasAura(SPELL_DARK_BLAST_AUR)) m_creature->CastSpell(m_creature, SPELL_DARK_BLAST_AUR, true); - //if (m_creature->getVictim() && m_creature->getVictim()->IsPlayer()) + //if (m_creature->GetVictim() && m_creature->GetVictim()->IsPlayer()) //{ - // bool inVisibleList = m_creature->getVictim()->ToPlayer()->IsInVisibleList(m_creature); - // sLog.outBasic("%s visible: %d", m_creature->getVictim()->GetName(), inVisibleList); + // bool inVisibleList = m_creature->GetVictim()->ToPlayer()->IsInVisibleList(m_creature); + // sLog.outBasic("%s visible: %d", m_creature->GetVictim()->GetName(), inVisibleList); //} //m_creature->ForceValuesUpdateAtIndex(UNIT_FIELD_TARGET); // to avoid melees being able to dps while casters hold aggro, this is most likely a logic that's supposed to exist if (Unit* pNearest = m_creature->SelectAttackingTarget(ATTACKING_TARGET_NEAREST, 0)) { - if (m_creature->getVictim() != pNearest && m_creature->CanReachWithMeleeAutoAttack(pNearest)) + if (m_creature->GetVictim() != pNearest && m_creature->CanReachWithMeleeAutoAttack(pNearest)) { ScriptedAI::AttackStart(pNearest); } @@ -893,7 +893,7 @@ struct mob_soulweaverAI : public kt_p1AddAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_creature->HasAura(SPELL_WAIL_SOULS_AUR)) m_creature->CastSpell(m_creature, SPELL_WAIL_SOULS_AUR, true); @@ -901,7 +901,7 @@ struct mob_soulweaverAI : public kt_p1AddAI // to avoid melees being able to dps while casters hold aggro, this is most likely a logic that's supposed to exist if (Unit* pNearest = m_creature->SelectAttackingTarget(ATTACKING_TARGET_NEAREST, 0)) { - if (m_creature->getVictim() != pNearest && m_creature->CanReachWithMeleeAutoAttack(pNearest)) + if (m_creature->GetVictim() != pNearest && m_creature->CanReachWithMeleeAutoAttack(pNearest)) { ScriptedAI::AttackStart(pNearest); } @@ -978,12 +978,12 @@ struct mob_guardian_icecrownAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (bloodTapTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLOOD_TAP) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BLOOD_TAP) == CAST_OK) bloodTapTimer = 15000; } else bloodTapTimer -= diff; 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 8b59b1861..36f528b41 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_loatheb.cpp @@ -92,13 +92,13 @@ struct mob_rottingMaggotAI : public ScriptedAI if (!m_creature->IsWithinDistInMap(pWho, 1.5f)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { m_creature->SetNoCallAssistance(true); - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -117,7 +117,7 @@ struct mob_rottingMaggotAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (isDiseased) { @@ -153,7 +153,7 @@ struct mob_eyeStalkAI : public ScriptedAI void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); m_creature->SetNoCallAssistance(true); @@ -167,12 +167,12 @@ struct mob_eyeStalkAI : public ScriptedAI if (!m_creature->IsWithinDistInMap(pWho, 19.0f)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { m_creature->SetNoCallAssistance(true); - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -198,13 +198,13 @@ struct mob_eyeStalkAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_creature->IsNonMeleeSpellCasted()) { - if (m_creature->GetDistance(m_creature->getVictim()) < 35.0f) - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_FLAY); + if (m_creature->GetDistance(m_creature->GetVictim()) < 35.0f) + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_FLAY); else DoStopAttack(); } @@ -408,7 +408,7 @@ struct boss_loathebAI : public ScriptedAI WhackAStalk(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp index f62a77576..272ca559c 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp @@ -119,7 +119,7 @@ struct mob_webwrapAI : public ScriptedAI { if (Player* pVictim = m_creature->GetMap()->GetPlayer(m_victimGuid)) { - if (pVictim->isAlive()) { + if (pVictim->IsAlive()) { pVictim->RemoveAurasDueToSpell(SPELL_WEBWRAP); pVictim->RemoveAurasDueToSpell(SPELL_SUMMON_WEB_WRAP); } @@ -134,7 +134,7 @@ struct mob_webwrapAI : public ScriptedAI return; Player* pVictim = m_creature->GetMap()->GetPlayer(m_victimGuid); - if (!pVictim || pVictim->isDead()) { + if (!pVictim || pVictim->IsDead()) { m_creature->Kill(m_creature, nullptr); // ((TemporarySummon*)m_creature)->UnSummon(); return; @@ -211,11 +211,11 @@ struct boss_maexxnaAI : public ScriptedAI if (!m_creature->IsWithinDistInMap(pWho, 40.0f)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -238,7 +238,7 @@ struct boss_maexxnaAI : public ScriptedAI bool DoCastWebWrap() { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); if (tList.size() < 2) return false; @@ -251,7 +251,7 @@ struct boss_maexxnaAI : public ScriptedAI // todo: verify that IsWithinLOSInMap does not screw anyting up. Afaik there should be nowhere // to los in maexxnas room, so would only stop us from selecting players outside the room, which is good. - if (pPlayer->isAlive() && !pPlayer->IsGameMaster() + if (pPlayer->IsAlive() && !pPlayer->IsGameMaster() && m_creature->IsWithinLOSInMap(pPlayer) // Only players in the room && !pPlayer->HasAura(SPELL_WEBWRAP)) // Don't retarget players who are still wrapped { @@ -365,7 +365,7 @@ struct boss_maexxnaAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; UpdateWraps(uiDiff); @@ -382,7 +382,7 @@ struct boss_maexxnaAI : public ScriptedAI // Web Spray if (m_uiWebSprayTimer < uiDiff) { - if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_WEBSPRAY) == CAST_OK) + if(DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WEBSPRAY) == CAST_OK) m_uiWebSprayTimer = WebSprayCooldown(); } else @@ -391,7 +391,7 @@ struct boss_maexxnaAI : public ScriptedAI // Poison Shock if (m_uiPoisonShockTimer < uiDiff) { - if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_POISONSHOCK) == CAST_OK) + if(DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POISONSHOCK) == CAST_OK) m_uiPoisonShockTimer = PoisonShockCooldown(); } else @@ -400,7 +400,7 @@ struct boss_maexxnaAI : public ScriptedAI // Necrotic Poison if (m_uiNecroticPoisonTimer < uiDiff) { - if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_NECROTICPOISON) == CAST_OK) + if(DoCastSpellIfCan(m_creature->GetVictim(), SPELL_NECROTICPOISON) == CAST_OK) m_uiNecroticPoisonTimer = NecroticPoisonCooldown(); } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_noth.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_noth.cpp index 10a7863bf..49d7a5bc5 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_noth.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_noth.cpp @@ -204,7 +204,7 @@ struct boss_nothAI : public ScriptedAI { // From what I can understand, the plague should always target the current target, // and will then also target the next 19 closest players to the current target - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { DoCastSpellIfCan(pTarget, SPELL_CURSE_PLAGUEBRINGER); m_events.Repeat(Seconds(urand(50,60))); //It's somewhere around 50seconds+ @@ -395,7 +395,7 @@ struct boss_nothAI : public ScriptedAI { if (!isOnBalc) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) return; @@ -403,7 +403,7 @@ struct boss_nothAI : public ScriptedAI else { // Will make him TP down rather thank walk through the air on a reset/wipe - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) { if (m_events.GetTimeUntilEvent(EVENT_RMV_INVULN) > 2000) { 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 ff441ce55..6fd401765 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_patchwerk.cpp @@ -124,7 +124,7 @@ struct boss_patchwerkAI : public ScriptedAI // todo: can it hit anything other than players? - Unit* mainTank = m_creature->getVictim(); + Unit* mainTank = m_creature->GetVictim(); // Shouldnt really be possible, but hey, weirder things have happened if (!mainTank) @@ -134,7 +134,7 @@ struct boss_patchwerkAI : public ScriptedAI Unit* pTarget = nullptr; uint32 uiHighestHP = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator iter = tList.begin(); iter != tList.end(); ++iter) { // Skipping maintank, only using him if there is no other viable target todo: not sure if this is correct. Should we target the MT over the offtanks, if the offtanks have less hp? @@ -172,23 +172,23 @@ struct boss_patchwerkAI : public ScriptedAI bool CustomGetTarget() { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return false; Unit* target = nullptr; // No taunt aura or taunt aura caster is dead, standard target selection - if (!target && !m_creature->getThreatManager().isThreatListEmpty()) - target = m_creature->getThreatManager().getHostileTarget(); + if (!target && !m_creature->GetThreatManager().isThreatListEmpty()) + target = m_creature->GetThreatManager().getHostileTarget(); if (target) { // Nostalrius : Correction bug sheep/fear - if (!m_creature->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) + if (!m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_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->IsWithinMeleeRange(target)) // he does not have offhand attack + if (!m_creature->IsAttackReady(BASE_ATTACK) && m_creature->IsWithinMeleeRange(target)) // he does not have offhand attack return true; if (target->GetObjectGuid() != previousTarget) @@ -203,7 +203,7 @@ struct boss_patchwerkAI : public ScriptedAI } // no target but something prevent go to evade mode // Nostalrius - fix evade quand CM. - if (!m_creature->isInCombat() || m_creature->HasAuraType(SPELL_AURA_MOD_TAUNT) || m_creature->GetCharmerGuid()) + if (!m_creature->IsInCombat() || m_creature->HasAuraType(SPELL_AURA_MOD_TAUNT) || m_creature->GetCharmerGuid()) return false; // last case when creature don't must go to evade mode: @@ -212,9 +212,9 @@ struct boss_patchwerkAI : public ScriptedAI // Note: creature not have targeted movement generator but have attacker in this case if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) { - for (std::set::const_iterator itr = m_creature->getAttackers().begin(); itr != m_creature->getAttackers().end(); ++itr) + for (std::set::const_iterator itr = m_creature->GetAttackers().begin(); itr != m_creature->GetAttackers().end(); ++itr) { - if ((*itr)->IsInMap(m_creature) && (*itr)->isTargetableForAttack()) + if ((*itr)->IsInMap(m_creature) && (*itr)->IsTargetableForAttack()) return false; } } @@ -226,7 +226,7 @@ struct boss_patchwerkAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!CustomGetTarget() || !m_creature->getVictim()) + if (!CustomGetTarget() || !m_creature->GetVictim()) return; // Soft Enrage at 5% @@ -259,7 +259,7 @@ struct boss_patchwerkAI : public ScriptedAI m_events.Repeat(HATEFUL_CD); break; case EVENT_SLIMEBOLT: - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SLIMEBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SLIMEBOLT) == CAST_OK) m_events.Repeat(SLIMEBOLT_REPEAT_CD); else m_events.Repeat(100); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_razuvious.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_razuvious.cpp index 609fbe6f2..a5a85d2bb 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_razuvious.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_razuvious.cpp @@ -108,7 +108,7 @@ struct mob_deathknightUnderstudyAI : public ScriptedAI attackTimer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -141,11 +141,11 @@ struct boss_razuviousAI : public ScriptedAI if (!m_creature->IsWithinDistInMap(pWho, 33.0f)) return; - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); else if (m_creature->GetMap()->IsDungeon()) { @@ -308,10 +308,10 @@ struct boss_razuviousAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) UpdateRP(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_pInstance->HandleEvadeOutOfHome(m_creature)) @@ -323,11 +323,11 @@ struct boss_razuviousAI : public ScriptedAI switch (eventId) { case EVENT_UNBALANCING_STRIKE: - DoCastSpellIfCan(m_creature->getVictim(), SPELL_UNBALANCING_STRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UNBALANCING_STRIKE); events.Repeat(Seconds(30)); break; case EVENT_DISRUPTING_SHOUT: - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISRUPTING_SHOUT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISRUPTING_SHOUT); DoScriptText(EMOTE_SHOUT, m_creature); events.Repeat(Seconds(25)); break; 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 11c026b9e..259eb93fe 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_sapphiron.cpp @@ -244,7 +244,7 @@ struct boss_sapphironAI : public ScriptedAI void AggroRadius(uint32 diff) { - if (m_creature->isInCombat() || m_creature->IsInEvadeMode()) + if (m_creature->IsInCombat() || m_creature->IsInEvadeMode()) return; if (phase != PHASE_GROUND && phase != PHASE_SKELETON) return; @@ -278,10 +278,10 @@ struct boss_sapphironAI : public ScriptedAI bool alert; - if (!pPlayer->isVisibleForOrDetect(m_creature, m_creature, true, false, &alert)) + if (!pPlayer->IsVisibleForOrDetect(m_creature, m_creature, true, false, &alert)) continue; - if (!pPlayer->isTargetableForAttack() || !m_creature->IsHostileTo(pPlayer)) + if (!pPlayer->IsTargetableForAttack() || !m_creature->IsHostileTo(pPlayer)) continue; if (phase == PHASE_SKELETON) @@ -291,9 +291,9 @@ struct boss_sapphironAI : public ScriptedAI } if (m_creature->CanInitiateAttack()) { - if (pPlayer->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pPlayer)) + if (pPlayer->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pPlayer)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { AttackStart(pPlayer); return; @@ -342,7 +342,7 @@ struct boss_sapphironAI : public ScriptedAI void DoIceBolt() { - ThreatList const& threatlist = m_creature->getThreatManager().getThreatList(); + ThreatList const& threatlist = m_creature->GetThreatManager().getThreatList(); if (threatlist.size() <= iceboltTargets.size()) { RescheduleIcebolt(); @@ -353,7 +353,7 @@ struct boss_sapphironAI : public ScriptedAI for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) if (Unit* pTarget = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid())) { - if (pTarget->isDead()) + if (pTarget->IsDead()) continue; if (std::find(iceboltTargets.begin(), iceboltTargets.end(), pTarget->GetObjectGuid()) != iceboltTargets.end()) @@ -425,7 +425,7 @@ struct boss_sapphironAI : public ScriptedAI //m_creature->SetFly(false); //m_creature->SetLevitate(false); - m_creature->SetMeleeZLimit(MELEE_Z_LIMIT); + m_creature->SetMeleeZLimit(UNIT_DEFAULT_MELEE_Z_LIMIT); } } @@ -433,10 +433,10 @@ struct boss_sapphironAI : public ScriptedAI { bool unreachableTarget = !m_creature->GetMotionMaster()->empty() && - m_creature->getVictim() && + m_creature->GetVictim() && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE && !m_creature->HasDistanceCasterMovement() && - (!m_creature->IsWithinDistInMap(m_creature->getVictim(), m_creature->GetMaxChaseDistance(m_creature->getVictim())) || !m_creature->IsWithinLOSInMap(m_creature->getVictim())) && + (!m_creature->IsWithinDistInMap(m_creature->GetVictim(), m_creature->GetMaxChaseDistance(m_creature->GetVictim())) || !m_creature->IsWithinLOSInMap(m_creature->GetVictim())) && !m_creature->GetMotionMaster()->GetCurrent()->IsReachable(); if (unreachableTarget) @@ -470,7 +470,7 @@ struct boss_sapphironAI : public ScriptedAI if (phase == PHASE_GROUND) { AggroRadius(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; UpdateReachable(uiDiff); @@ -493,7 +493,7 @@ struct boss_sapphironAI : public ScriptedAI } else { - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) { EnterEvadeMode(); } @@ -513,7 +513,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_STAT_MELEE_ATTACKING); m_creature->InterruptNonMeleeSpells(false); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); @@ -626,7 +626,7 @@ struct boss_sapphironAI : public ScriptedAI } case EVENT_CLEAVE: { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) events.Repeat(Seconds(urand(5, 10))); else events.Repeat(100); @@ -739,7 +739,7 @@ struct npc_sapphiron_blizzardAI : public ScriptedAI } // if only "tank" alive, move random - ThreatList const& threatlist = pSapp->getThreatManager().getThreatList(); + ThreatList const& threatlist = pSapp->GetThreatManager().getThreatList(); if (threatlist.size() < 2) { SetRandomMove(); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp index 96652bf5a..c63350965 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp @@ -204,7 +204,7 @@ struct npc_tesla_coilAI : public Scripted_NoMovementAI { if (Creature* add = m_pInstance->GetCreature(m_guid)) { - if (add->isInCombat() && !m_creature->isInCombat()) + if (add->IsInCombat() && !m_creature->IsInCombat()) { m_creature->SetInCombatWithZone(); } @@ -317,7 +317,7 @@ struct boss_thaddiusAddsAI : public ScriptedAI if (Creature* pOtherAdd = GetOtherAdd()) { - if (!pOtherAdd->isInCombat()) + if (!pOtherAdd->IsInCombat()) pOtherAdd->AI()->AttackStart(pWho); } } @@ -338,7 +338,7 @@ struct boss_thaddiusAddsAI : public ScriptedAI bool HandleMagneticPull() { if (m_bFakeDeath) return false; - Unit* myVictim = m_creature->getVictim(); + Unit* myVictim = m_creature->GetVictim(); if (!myVictim) return false; Creature* otherAdd = GetOtherAdd(); @@ -347,12 +347,12 @@ struct boss_thaddiusAddsAI : public ScriptedAI { if (otherAI->m_bFakeDeath) return false; // can, presumably, only do it when both are alive } - Unit* otherVictim = otherAdd->getVictim(); + Unit* otherVictim = otherAdd->GetVictim(); if (!otherVictim) return false; - ThreatManager& myThreat = m_creature->getThreatManager(); - ThreatManager& otherThreat = otherAdd->getThreatManager(); + ThreatManager& myThreat = m_creature->GetThreatManager(); + ThreatManager& otherThreat = otherAdd->GetThreatManager(); float myTankThreat = myThreat.getThreat(myVictim); float myOtherTankThreat = myThreat.getThreat(otherVictim); @@ -407,7 +407,7 @@ struct boss_thaddiusAddsAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; timeSincePull += uiDiff; m_events.Update(uiDiff); @@ -849,7 +849,7 @@ struct boss_thaddiusAI : public ScriptedAI for (auto& p : lPlayers) { Player* pPlayer = p.getSource(); - if (pPlayer->isDead()) + if (pPlayer->IsDead()) continue; playerVec.push_back(p.getSource()); @@ -885,7 +885,7 @@ struct boss_thaddiusAI : public ScriptedAI if (!m_pInstance) return; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; m_events.Update(diff); @@ -925,7 +925,7 @@ struct boss_thaddiusAI : public ScriptedAI // This will prevent the boss from starting to spam balls of lightning if the boss is being moved with lag or something if (!DoMeleeAttackIfReady()) { - if (!m_creature->CanReachWithMeleeAutoAttack(m_creature->getVictim())) + if (!m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim())) { m_uiBallLightningTimer -= std::min(diff, m_uiBallLightningTimer); } @@ -942,7 +942,7 @@ struct boss_thaddiusAI : public ScriptedAI // it's time to start hurl some balls of lightning if (m_uiBallLightningTimer < diff && !m_creature->IsNonMeleeSpellCasted()) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BALL_LIGHTNING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BALL_LIGHTNING) == CAST_OK) m_uiBallLightningTimer = 1500; } } @@ -956,7 +956,7 @@ struct boss_thaddiusAI : public ScriptedAI if (m_Phase != THAD_NOT_STARTED) { - if (m_creature->getThreatManager().isThreatListEmpty()) + if (m_creature->GetThreatManager().isThreatListEmpty()) { TransitionToPhase(THAD_NOT_STARTED); } @@ -964,7 +964,7 @@ struct boss_thaddiusAI : public ScriptedAI else { // He can act a bit weird if you stand next to him on server startup :/ - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) TransitionToPhase(THAD_NOT_STARTED); } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp index 1a54a54e8..0f2795575 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/instance_naxxramas.cpp @@ -179,13 +179,13 @@ bool instance_naxxramas::HandleEvadeOutOfHome(Creature* pWho) if (entry == NPC_BLAUMEUX || entry == NPC_MOGRAINE || entry == NPC_ZELIEK || entry == NPC_THANE) { if (Creature* pC = GetSingleCreatureFromStorage(NPC_BLAUMEUX)) - if (pC->isAlive()) pC->AI()->EnterEvadeMode(); + if (pC->IsAlive()) pC->AI()->EnterEvadeMode(); if (Creature* pC = GetSingleCreatureFromStorage(NPC_MOGRAINE)) - if (pC->isAlive()) pC->AI()->EnterEvadeMode(); + if (pC->IsAlive()) pC->AI()->EnterEvadeMode(); if (Creature* pC = GetSingleCreatureFromStorage(NPC_ZELIEK)) - if (pC->isAlive()) pC->AI()->EnterEvadeMode(); + if (pC->IsAlive()) pC->AI()->EnterEvadeMode(); if (Creature* pC = GetSingleCreatureFromStorage(NPC_THANE)) - if (pC->isAlive()) pC->AI()->EnterEvadeMode(); + if (pC->IsAlive()) pC->AI()->EnterEvadeMode(); } else { @@ -204,7 +204,7 @@ void instance_naxxramas::OnCreatureEnterCombat(Creature * creature) GetCreatureListWithEntryInGrid(sewageSlimes, creature, NPC_SewageSlime, 100.0f); for (Creature* pC : sewageSlimes) { - if (!pC->isInCombat()) + if (!pC->IsInCombat()) { pC->CastSpell(pC, 28033, true); // aggro all in los } @@ -413,7 +413,7 @@ void instance_naxxramas::OnCreatureCreate(Creature* pCreature) // 4hm if (pCreature->GetEntry() >= 16062 && pCreature->GetEntry() <= 16065) { - if (m_auiEncounter[TYPE_FOUR_HORSEMEN] != DONE && pCreature->isDead()) + if (m_auiEncounter[TYPE_FOUR_HORSEMEN] != DONE && pCreature->IsDead()) { pCreature->Respawn(); } @@ -871,7 +871,7 @@ void instance_naxxramas::SetData(uint32 uiType, uint32 uiData) for (uint32 i = NPC_MOGRAINE; i <= NPC_BLAUMEUX; i++) { if (Creature* p = GetSingleCreatureFromStorage(i)) - if (p->isDead()) + if (p->IsDead()) p->Respawn(); } @@ -1393,7 +1393,7 @@ void instance_naxxramas::onNaxxramasAreaTrigger(Player* pPlayer, const AreaTrigg m_faerlinaHaveGreeted = true; if (Creature* pFaerlina = GetSingleCreatureFromStorage(NPC_FAERLINA)) { - if(pFaerlina->isAlive()) + if(pFaerlina->IsAlive()) DoScriptText(SAY_FAERLINA_GREET, pFaerlina); } } @@ -1404,7 +1404,7 @@ void instance_naxxramas::onNaxxramasAreaTrigger(Player* pPlayer, const AreaTrigg m_thaddiusHaveGreeted = true; if (Creature* pThaddius = GetSingleCreatureFromStorage(NPC_THADDIUS)) { - if (pThaddius->isAlive()) + if (pThaddius->IsAlive()) DoScriptText(SAY_THADDIUS_GREET, pThaddius); } } @@ -1425,7 +1425,7 @@ void instance_naxxramas::onNaxxramasAreaTrigger(Player* pPlayer, const AreaTrigg bool AreaTrigger_at_naxxramas(Player* pPlayer, const AreaTriggerEntry* pAt) { - if (pPlayer->IsGameMaster() || !pPlayer->isAlive()) + if (pPlayer->IsGameMaster() || !pPlayer->IsAlive()) return false; if (instance_naxxramas* pInstance = (instance_naxxramas*)pPlayer->GetInstanceData()) @@ -1473,7 +1473,7 @@ struct mob_spiritOfNaxxramasAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (portalTimer) @@ -1547,7 +1547,7 @@ struct mob_naxxramasGarboyleAI : public ScriptedAI if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE)) { if (pWho->GetTypeId() == TYPEID_PLAYER - && !m_creature->isInCombat() + && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 17.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH) && m_creature->IsWithinLOSInMap(pWho)) @@ -1571,7 +1571,7 @@ struct mob_naxxramasGarboyleAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetHealthPercent() < 30.0f && !m_creature->IsNonMeleeSpellCasted() && !m_creature->HasAura(28995)) @@ -1635,7 +1635,7 @@ struct mob_naxxramasPlagueSlimeAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (colorChangeTimer < diff) @@ -1716,7 +1716,7 @@ struct mob_dark_touched_warriorAI : public ScriptedAI void FleeToHorse() { - if (!m_creature->getVictim() || m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) + if (!m_creature->GetVictim() || m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; Creature* pNearest = nullptr; @@ -1736,7 +1736,7 @@ struct mob_dark_touched_warriorAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!hasFled && m_creature->GetHealthPercent() < 50.0f) @@ -1777,7 +1777,7 @@ CreatureAI* GetAI_dark_touched_warrior(Creature* pCreature) bool GossipHello_npc_ArchmageTarsis(Player* pPlayer, Creature* pCreature) { - if (pCreature->getStandState() != UNIT_STAND_STATE_SIT) + if (pCreature->GetStandState() != UNIT_STAND_STATE_SIT) pCreature->SetStandState(UNIT_STAND_STATE_SIT); return false; } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_baroness_anastari.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_baroness_anastari.cpp index c2064b771..20fdd5b47 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_baroness_anastari.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_baroness_anastari.cpp @@ -110,7 +110,7 @@ struct boss_baroness_anastariAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (Possessed) @@ -128,7 +128,7 @@ struct boss_baroness_anastariAI : public ScriptedAI m_creature->NearTeleportTo(old_Position.x, old_Position.y, old_Position.z, 0.0f); /** Set the player health back to its old state unless their party members killed them, whoops! */ - if (pTarget->isAlive()) + if (pTarget->IsAlive()) pTarget->SetHealthPercent(PlayerHealth); m_creature->SetVisibility(VISIBILITY_ON); @@ -139,8 +139,8 @@ struct boss_baroness_anastariAI : public ScriptedAI { if (Unit* pTarg = m_creature->GetMap()->GetUnit(PlayerGuids[i])) { - m_creature->getThreatManager().addThreatDirectly(pTarg, PlayerAggro[i]); - if (pTarg->isAlive()) + m_creature->GetThreatManager().addThreatDirectly(pTarg, PlayerAggro[i]); + if (pTarg->IsAlive()) m_creature->SetInCombatWith(pTarg); } } @@ -174,14 +174,14 @@ struct boss_baroness_anastariAI : public ScriptedAI if (target->IsPlayer() && target->GetHealthPercent() > 30.0f) { PossessedPlayerGuid = target->GetGUID(); - /*PossessedPlayerAggro = m_creature->getThreatManager().getThreat(target);*/ + /*PossessedPlayerAggro = m_creature->GetThreatManager().getThreat(target);*/ for (int i = 0; i < 5; i++) { PlayerGuids[i] = 0; PlayerAggro[i] = 0; } - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()); @@ -192,7 +192,7 @@ struct boss_baroness_anastariAI : public ScriptedAI if (PlayerGuids[i] == 0) { PlayerGuids[i] = pUnit->GetGUID(); - PlayerAggro[i] = m_creature->getThreatManager().getThreat(pUnit); + PlayerAggro[i] = m_creature->GetThreatManager().getThreat(pUnit); } } } @@ -221,7 +221,7 @@ struct boss_baroness_anastariAI : public ScriptedAI for (int i = 0; i < 5; i++) { if (PlayerGuids[i] != PossessedPlayerGuid) - m_creature->getThreatManager().addThreatDirectly(m_creature->GetMap()->GetUnit(PlayerGuids[i]), PlayerAggro[i]); + m_creature->GetThreatManager().addThreatDirectly(m_creature->GetMap()->GetUnit(PlayerGuids[i]), PlayerAggro[i]); } Possessed = true; @@ -238,7 +238,7 @@ struct boss_baroness_anastariAI : public ScriptedAI //BansheeWail if (BansheeWail_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BANSHEEWAIL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BANSHEEWAIL) == CAST_OK) BansheeWail_Timer = 4000; } else BansheeWail_Timer -= diff; @@ -246,7 +246,7 @@ struct boss_baroness_anastariAI : public ScriptedAI //BansheeCurse if (BansheeCurse_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BANSHEECURSE, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BANSHEECURSE, CF_AURA_NOT_PRESENT) == CAST_OK) BansheeCurse_Timer = 18000; } else BansheeCurse_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_cannon_master_willey.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_cannon_master_willey.cpp index a90804629..2a63f6406 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_cannon_master_willey.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_cannon_master_willey.cpp @@ -159,13 +159,13 @@ struct boss_cannon_master_willeyAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Pummel if (m_uiPummelTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PUMMEL) == CAST_OK) m_uiPummelTimer = 12000; } else @@ -174,7 +174,7 @@ struct boss_cannon_master_willeyAI : public ScriptedAI // Knock Away if (m_uiKnockAwayTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = urand(15000, 20000); } else @@ -240,7 +240,7 @@ struct boss_cannon_master_willeyAI : public ScriptedAI // Shoot if (m_uiShootTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT) == CAST_OK) m_uiShootTimer = urand(2500, 3500); } else @@ -248,21 +248,21 @@ struct boss_cannon_master_willeyAI : public ScriptedAI if (!IsCombatMovementEnabled()) { //Melee - if (!m_bInMelee && (m_creature->GetDistance2d(m_creature->getVictim()) < 8.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 27.0f || !m_creature->IsWithinLOSInMap(m_creature->getVictim()))) + if (!m_bInMelee && (m_creature->GetDistance2d(m_creature->GetVictim()) < 8.0f || m_creature->GetDistance2d(m_creature->GetVictim()) > 27.0f || !m_creature->IsWithinLOSInMap(m_creature->GetVictim()))) { SetCombatMovement(true); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); m_bInMelee = true; return; } } else { //Range - if (m_bInMelee && m_creature->GetDistance2d(m_creature->getVictim()) >= 8.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 27.0f && m_creature->IsWithinLOSInMap(m_creature->getVictim())) + if (m_bInMelee && m_creature->GetDistance2d(m_creature->GetVictim()) >= 8.0f && m_creature->GetDistance2d(m_creature->GetVictim()) <= 27.0f && m_creature->IsWithinLOSInMap(m_creature->GetVictim())) { SetCombatMovement(false); m_bInMelee = false; - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); return; } } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp index fd3389cef..8ecb94aa0 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_dathrohan_balnazzar.cpp @@ -173,7 +173,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //START NOT TRANSFORMED @@ -182,7 +182,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI //MindBlast if (m_uiMindBlast_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MINDBLAST) == CAST_OK) m_uiMindBlast_Timer = urand(15000, 20000); } else m_uiMindBlast_Timer -= uiDiff; @@ -198,7 +198,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI //CrusaderStrike if (m_uiCrusaderStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CRUSADERSTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CRUSADERSTRIKE) == CAST_OK) m_uiCrusaderStrike_Timer = 15000; } else m_uiCrusaderStrike_Timer -= uiDiff; @@ -206,7 +206,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI //HolyStrike if (m_uiHolyStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_HOLYSTRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HOLYSTRIKE) == CAST_OK) m_uiHolyStrike_Timer = 15000; } else m_uiHolyStrike_Timer -= uiDiff; @@ -247,8 +247,8 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI { if (!pTarget->HasAura(SPELL_MINDCONTROL)) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, MCPlayerAggro); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().addThreatDirectly(pTarget, MCPlayerAggro); MCPlayerGuid = 0; MCPlayerAggro = 0; } @@ -266,8 +266,8 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI { if (!pTarget->HasAura(SPELL_SLEEP)) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, SleepPlayerAggro); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().addThreatDirectly(pTarget, SleepPlayerAggro); SleepPlayerGuid = 0; SleepPlayerAggro = 0; } @@ -282,7 +282,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI //MindBlast if (m_uiMindBlast_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MINDBLAST) == CAST_OK) m_uiMindBlast_Timer = urand(15000, 20000); } else m_uiMindBlast_Timer -= uiDiff; @@ -290,7 +290,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI //ShadowShock if (m_uiShadowShock_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWSHOCK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWSHOCK); m_uiShadowShock_Timer = 11000; } else m_uiShadowShock_Timer -= uiDiff; @@ -311,10 +311,10 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI if (!pTarget->HasAura(SPELL_SLEEP)) { SleepPlayerGuid = pTarget->GetGUID(); - SleepPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); + SleepPlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); if (DoCastSpellIfCan(pTarget, SPELL_SLEEP) == CAST_OK) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); m_uiDeepSleep_Timer = 15000; } } @@ -330,7 +330,7 @@ struct boss_dathrohan_balnazzarAI : public ScriptedAI if (pTarget != nullptr && !pTarget->HasAura(SPELL_SLEEP)) { MCPlayerGuid = pTarget->GetGUID(); - MCPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); + MCPlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); if (DoCastSpellIfCan(pTarget, SPELL_MINDCONTROL) == CAST_OK) m_uiMindControl_Timer = urand(25000, 30000); } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_magistrate_barthilas.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_magistrate_barthilas.cpp index 2906e41b5..5f637c8e0 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_magistrate_barthilas.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_magistrate_barthilas.cpp @@ -39,7 +39,7 @@ struct boss_magistrate_barthilasAI : public ScriptedAI m_mvt_timer = 0; m_mvt_id = 0; - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->SetDisplayId(MODEL_NORMAL); else m_creature->SetDisplayId(MODEL_HUMAN); @@ -115,7 +115,7 @@ struct boss_magistrate_barthilasAI : public ScriptedAI else m_mvt_timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (FuriousAnger_Timer < diff) @@ -132,7 +132,7 @@ struct boss_magistrate_barthilasAI : public ScriptedAI //DrainingBlow if (DrainingBlow_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DRAININGBLOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DRAININGBLOW); DrainingBlow_Timer = 15000; } else DrainingBlow_Timer -= diff; @@ -140,7 +140,7 @@ struct boss_magistrate_barthilasAI : public ScriptedAI //CrowdPummel if (CrowdPummel_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CROWDPUMMEL); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CROWDPUMMEL); CrowdPummel_Timer = 15000; } else CrowdPummel_Timer -= diff; @@ -148,7 +148,7 @@ struct boss_magistrate_barthilasAI : public ScriptedAI //MightyBlow if (MightyBlow_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIGHTYBLOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIGHTYBLOW); MightyBlow_Timer = 20000; } else MightyBlow_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_maleki_the_pallid.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_maleki_the_pallid.cpp index 8f64ec4bb..f0110c991 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_maleki_the_pallid.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_maleki_the_pallid.cpp @@ -73,7 +73,7 @@ struct boss_maleki_the_pallidAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (IcedPlayerGuid) @@ -82,7 +82,7 @@ struct boss_maleki_the_pallidAI : public ScriptedAI { if (!pTarget->HasAura(SPELL_ICETOMB)) { - m_creature->getThreatManager().addThreatDirectly(pTarget, IcedPlayerAggro); + m_creature->GetThreatManager().addThreatDirectly(pTarget, IcedPlayerAggro); IcedPlayerGuid = 0; IcedPlayerAggro = 0; } @@ -97,7 +97,7 @@ struct boss_maleki_the_pallidAI : public ScriptedAI //Frostbolt if (Frostbolt_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROSTBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROSTBOLT) == CAST_OK) Frostbolt_Timer = urand(3500, 4500); } else @@ -106,13 +106,13 @@ struct boss_maleki_the_pallidAI : public ScriptedAI //IceTomb if (IceTomb_Timer < diff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { if (DoCastSpellIfCan(pTarget, SPELL_ICETOMB) == CAST_OK) { IcedPlayerGuid = pTarget->GetGUID(); - IcedPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + IcedPlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); IceTomb_Timer = urand(20000, 25000); } } @@ -126,10 +126,10 @@ struct boss_maleki_the_pallidAI : public ScriptedAI if (Drain_Timer < diff) { bool ManaTarget = false; - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) if (pTarget->GetPower(POWER_MANA)) ManaTarget = true; - if (DoCastSpellIfCan(m_creature->getVictim(), (ManaTarget ? SPELL_DRAIN_MANA : SPELL_DRAIN_LIFE)) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), (ManaTarget ? SPELL_DRAIN_MANA : SPELL_DRAIN_LIFE)) == CAST_OK) Drain_Timer = urand(12000, 18000); } else @@ -138,7 +138,7 @@ struct boss_maleki_the_pallidAI : public ScriptedAI else NeedMoveCloser = false; - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { if ((pTarget->GetDistance2d(m_creature) > (NeedMoveCloser ? 20.0f : 40.0f)) || (GetManaPercent() < 10.0f)) { diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_nerubenkan.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_nerubenkan.cpp index 9215e122b..4eb064d22 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_nerubenkan.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_nerubenkan.cpp @@ -97,7 +97,7 @@ struct boss_nerubenkanAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (WebbedPlayerGuid) @@ -106,7 +106,7 @@ struct boss_nerubenkanAI : public ScriptedAI { if (!pTarget->HasAura(SPELL_ENCASINGWEBS)) { - m_creature->getThreatManager().addThreatDirectly(pTarget, WebbedPlayerAggro); + m_creature->GetThreatManager().addThreatDirectly(pTarget, WebbedPlayerAggro); WebbedPlayerGuid = 0; WebbedPlayerAggro = 0; } @@ -121,13 +121,13 @@ struct boss_nerubenkanAI : public ScriptedAI //EncasingWebs if (EncasingWebs_Timer < diff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { if (DoCastSpellIfCan(pTarget, SPELL_ENCASINGWEBS) == CAST_OK) { WebbedPlayerGuid = pTarget->GetGUID(); - WebbedPlayerAggro = m_creature->getThreatManager().getThreat(pTarget); - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + WebbedPlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); EncasingWebs_Timer = urand(10000, 15000); } } @@ -137,7 +137,7 @@ struct boss_nerubenkanAI : public ScriptedAI //PierceArmor if (PierceArmor_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PIERCEARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PIERCEARMOR) == CAST_OK) PierceArmor_Timer = urand(15000, 20000); } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_order_of_silver_hand.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_order_of_silver_hand.cpp index 69ee1aef7..114b1787e 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_order_of_silver_hand.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_order_of_silver_hand.cpp @@ -112,7 +112,7 @@ struct boss_silver_hand_bossesAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (HolyLight_Timer < diff) diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_postmaster_malown.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_postmaster_malown.cpp index de6abf5d3..ded1ee488 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_postmaster_malown.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_postmaster_malown.cpp @@ -74,7 +74,7 @@ struct boss_postmaster_malownAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //WailingDead @@ -82,7 +82,7 @@ struct boss_postmaster_malownAI : public ScriptedAI { //Cast if (rand() % 100 < 65) //65% chance to cast - DoCastSpellIfCan(m_creature->getVictim(), SPELL_WAILINGDEAD); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WAILINGDEAD); //19 seconds until we should cast this again WailingDead_Timer = 19000; } @@ -93,7 +93,7 @@ struct boss_postmaster_malownAI : public ScriptedAI { //Cast if (rand() % 100 < 45) //45% chance to cast - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACKHAND); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACKHAND); //8 seconds until we should cast this again Backhand_Timer = 8000; } @@ -104,7 +104,7 @@ struct boss_postmaster_malownAI : public ScriptedAI { //Cast if (rand() % 100 < 3) //3% chance to cast - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFWEAKNESS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFWEAKNESS); //20 seconds until we should cast this again CurseOfWeakness_Timer = 20000; } @@ -115,7 +115,7 @@ struct boss_postmaster_malownAI : public ScriptedAI { //Cast if (rand() % 100 < 3) //3% chance to cast - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFTONGUES); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFTONGUES); //22 seconds until we should cast this again CurseOfTongues_Timer = 22000; } @@ -126,7 +126,7 @@ struct boss_postmaster_malownAI : public ScriptedAI { //Cast if (rand() % 100 < 5) //5% chance to cast - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CALLOFTHEGRAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CALLOFTHEGRAVE); //25 seconds until we should cast this again CallOfTheGrave_Timer = 25000; } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_ramstein_the_gorger.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_ramstein_the_gorger.cpp index b1329b6f4..a36bd4c42 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_ramstein_the_gorger.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_ramstein_the_gorger.cpp @@ -77,7 +77,7 @@ struct boss_ramstein_the_gorgerAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Trample @@ -91,9 +91,9 @@ struct boss_ramstein_the_gorgerAI : public ScriptedAI //Knockout if (Knockout_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKOUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKOUT) == CAST_OK) { - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); Knockout_Timer = 10000; } } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_timmy_the_cruel.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_timmy_the_cruel.cpp index 28829de24..11898f8a2 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_timmy_the_cruel.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/boss_timmy_the_cruel.cpp @@ -47,13 +47,13 @@ struct boss_timmy_the_cruelAI : public ScriptedAI void UpdateAI(const uint32 diff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Ravenous Claw if (m_uiRavenousClawTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_RAVENOUSCLAW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_RAVENOUSCLAW) == CAST_OK) m_uiRavenousClawTimer = 12000; } else @@ -122,12 +122,12 @@ struct npc_crimson_guardsmanAI : public ScriptedAI void UpdateAI(const uint32 diff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiDisarmTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), 6713) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), 6713) == CAST_OK) m_uiDisarmTimer = 15000; } else @@ -135,7 +135,7 @@ struct npc_crimson_guardsmanAI : public ScriptedAI if (m_uiShieldBashTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), 11972) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), 11972) == CAST_OK) m_uiShieldBashTimer = 8000; } else @@ -143,7 +143,7 @@ struct npc_crimson_guardsmanAI : public ScriptedAI if (m_uiShieldChargeTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), 15749) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), 15749) == CAST_OK) m_uiShieldChargeTimer = 12000; } else diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp index 79b30d42e..298a1049d 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/instance_stratholme.cpp @@ -200,7 +200,7 @@ struct instance_stratholme : public ScriptedInstance { if (Creature* pCristal = instance->GetCreature(*i)) { - if (!pCristal->isAlive()) + if (!pCristal->IsAlive()) --uiCount; } else @@ -491,7 +491,7 @@ struct instance_stratholme : public ScriptedInstance { if (Creature* pAbom = instance->GetCreature(*i)) { - if (!pAbom->isAlive()) + if (!pAbom->IsAlive()) --uiCount; } } @@ -704,7 +704,7 @@ struct instance_stratholme : public ScriptedInstance |->x /------------/ ^x1 ^x3 */ - if (itr->getSource()->isAlive() && !itr->getSource()->IsGameMaster() && itr->getSource()->IsGMVisible()) + if (itr->getSource()->IsAlive() && !itr->getSource()->IsGameMaster() && itr->getSource()->IsGMVisible()) { //hauteur corect ? if (itr->getSource()->GetPositionZ() < 135 && itr->getSource()->GetPositionZ() > 130) @@ -726,7 +726,7 @@ struct instance_stratholme : public ScriptedInstance Map::PlayerList const &listeJoueur = instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = listeJoueur.begin(); itr != listeJoueur.end(); ++itr) { - if (itr->getSource()->isAlive() && !itr->getSource()->IsGameMaster() && itr->getSource()->IsGMVisible() && + if (itr->getSource()->IsAlive() && !itr->getSource()->IsGameMaster() && itr->getSource()->IsGMVisible() && itr->getSource()->GetPositionX() < 3621.32 && itr->getSource()->GetPositionX() > 3603.18 && itr->getSource()->GetPositionY() < -3335 && itr->getSource()->GetPositionY() > -3340.46 && itr->getSource()->GetPositionZ() < 130 && itr->getSource()->GetPositionZ() > 123) @@ -746,7 +746,7 @@ struct instance_stratholme : public ScriptedInstance if (Creature* pAbom = instance->GetCreature(*Iter)) { - if (pAbom->isAlive() && !pAbom->isInCombat()) + if (pAbom->IsAlive() && !pAbom->IsInCombat()) { pAbom->GetMotionMaster()->MovePoint(0, 4037.194f, -3473.741943f, 121.738808f); //pAbom->GetMotionMaster()->MovePoint(1, 4038.45288f, -3487.635498f, 121.742157f); diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp index c2c19ae15..617bb8ecd 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/stratholme/stratholme.cpp @@ -47,7 +47,7 @@ bool GOHello_go_entree_de_service(Player* pPlayer, GameObject* pGo) GetCreatureListWithEntryInGrid(listBarthilas, pGo, 10435, 1000); for (std::list::const_iterator itr = listBarthilas.begin(); itr != listBarthilas.end(); ++itr) { - if (!(*itr)->isAlive()) + if (!(*itr)->IsAlive()) continue; (*itr)->AI()->ReceiveEmote(pPlayer, 1000); @@ -269,12 +269,12 @@ struct mobs_spectral_ghostly_citizenAI : public ScriptedAI else Die_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (cast_Haunting < diff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_HAUNTING_PHANTOM, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_HAUNTING_PHANTOM, false); cast_Haunting = 20000; } else cast_Haunting -= diff; @@ -287,7 +287,7 @@ struct mobs_spectral_ghostly_citizenAI : public ScriptedAI switch (emote) { case TEXTEMOTE_DANCE: - if (m_creature->isInCombat() && !hasEvadedOnce) + if (m_creature->IsInCombat() && !hasEvadedOnce) { EnterEvadeMode(); hasEvadedOnce = true; @@ -354,7 +354,7 @@ struct mobs_cristal_zugguratAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->isAlive() || !m_pInstance) + if (!m_creature->IsAlive() || !m_pInstance) return; if (uiUpdateTimer > diff) @@ -377,7 +377,7 @@ struct mobs_cristal_zugguratAI : public ScriptedAI for (std::list::const_iterator itr = acolyte.begin(); itr != acolyte.end(); ++itr) if (Creature *pCreature = m_pInstance->instance->GetCreature((*itr))) - if (pCreature && pCreature->isAlive()) + if (pCreature && pCreature->IsAlive()) return; m_creature->DealDamage(m_creature, m_creature->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); @@ -692,7 +692,7 @@ struct npc_auriusAI : public ScriptedAI m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); - m_creature->addUnitState(UNIT_STAT_DIED); + m_creature->AddUnitState(UNIT_STAT_DIED); m_creature->CombatStop(); //m_creature->RemoveAllAuras(); //m_creature->DeleteThreatList(); @@ -701,7 +701,7 @@ struct npc_auriusAI : public ScriptedAI //m_creature->GetMotionMaster()->MoveIdle(); m_creature->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); m_creature->InterruptNonMeleeSpells(true); - m_creature->getHostileRefManager().deleteReferences(); + m_creature->GetHostileRefManager().deleteReferences(); } } @@ -752,7 +752,7 @@ struct npc_auriusAI : public ScriptedAI { case IN_PROGRESS : { - if (((m_pInstance->GetData(TYPE_EVENT_AURIUS)) == IN_PROGRESS) && (m_creature->getStandState() != UNIT_STAND_STATE_DEAD)) + if (((m_pInstance->GetData(TYPE_EVENT_AURIUS)) == IN_PROGRESS) && (m_creature->GetStandState() != UNIT_STAND_STATE_DEAD)) { if (Creature* pTarget = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(DATA_BARON))) { @@ -870,7 +870,7 @@ struct npc_couloir_trigger1AI : public ScriptedAI if (Creature* Crea = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_DATHROHAN))) { - if (Crea->isAlive() && !Crea->isInCombat()) + if (Crea->IsAlive() && !Crea->IsInCombat()) { //"The scourge has broken into our bastion!" Crea->MonsterYellToZone(SAY_SCOURGE_HAVE_BROKEN_IN); @@ -1016,7 +1016,7 @@ struct npc_Scourge_TriggerAI : public ScriptedAI if (Creature* Crea = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(NPC_DATHROHAN))) { - if (Crea->isAlive() && !Crea->isInCombat()) + if (Crea->IsAlive() && !Crea->IsInCombat()) { //"The scourge has broken into our bastion!" Crea->MonsterYellToZone(SAY_SCOURGE_HAVE_BROKEN_IN); diff --git a/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp b/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp index 6bf18983b..2a0e644bc 100644 --- a/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp +++ b/src/scripts/eastern_kingdoms/hillsbrad_foothills/hillsbrad_foothills.cpp @@ -82,7 +82,7 @@ struct go_dusty_rugAI: public GameObjectAI me->GetCreatureListWithEntryInGrid(lCrea, NPC_CAPTURED_FARMER, 30.0f); for (std::list::iterator it = lCrea.begin(); it != lCrea.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) { Farmers.push_back((*it)->GetGUID()); pKeg->GetContactPoint((*it), fX, fY, fZ, CONTACT_DISTANCE); diff --git a/src/scripts/eastern_kingdoms/hinterlands/hinterlands.cpp b/src/scripts/eastern_kingdoms/hinterlands/hinterlands.cpp index 8813194e9..5aeeaf873 100644 --- a/src/scripts/eastern_kingdoms/hinterlands/hinterlands.cpp +++ b/src/scripts/eastern_kingdoms/hinterlands/hinterlands.cpp @@ -164,7 +164,7 @@ struct npc_rinjiAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { //Check if we have a current target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) { diff --git a/src/scripts/eastern_kingdoms/ironforge/ironforge.cpp b/src/scripts/eastern_kingdoms/ironforge/ironforge.cpp index 6d9c57a6b..1978ef486 100644 --- a/src/scripts/eastern_kingdoms/ironforge/ironforge.cpp +++ b/src/scripts/eastern_kingdoms/ironforge/ironforge.cpp @@ -39,7 +39,7 @@ EndContentData */ bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) @@ -88,7 +88,7 @@ bool GossipSelect_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCre bool GossipHello_npc_magni_bronzebeard(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); @@ -101,7 +101,7 @@ bool GossipHello_npc_magni_bronzebeard(Player* pPlayer, Creature* pCreature) bool GossipHello_npc_tinker_mekkatorque(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); @@ -150,20 +150,20 @@ public: void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) override { if (pSpell->Id == SPELL_KNOCK_AWAY) - if (m_creature->getThreatManager().getThreat(pTarget)) - m_creature->getThreatManager().modifyThreatPercent(pTarget, -25); + if (m_creature->GetThreatManager().getThreat(pTarget)) + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -25); } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiStormBoltTimer <= uiDiff) { if (m_bHasStormBolted) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STORM_BOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STORM_BOLT) == CAST_OK) { m_bHasStormBolted = false; m_uiStormBoltTimer = 10000; @@ -207,7 +207,7 @@ public: if (m_uiChargeTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHARGE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHARGE) == CAST_OK) m_uiChargeTimer = 5000; } else diff --git a/src/scripts/eastern_kingdoms/loch_modan/loch_modan.cpp b/src/scripts/eastern_kingdoms/loch_modan/loch_modan.cpp index e8abc6efc..0ffbb8d2a 100644 --- a/src/scripts/eastern_kingdoms/loch_modan/loch_modan.cpp +++ b/src/scripts/eastern_kingdoms/loch_modan/loch_modan.cpp @@ -197,7 +197,7 @@ CreatureAI* GetAI_npc_saean(Creature* pCreature) bool AreaTrigger_at_huldar_miran(Player* pPlayer, AreaTriggerEntry const* /*pAt*/) { // If player is dead, GM mode is ON, quest complete or no quest - if (!pPlayer->isAlive() || pPlayer->IsGameMaster() || + if (!pPlayer->IsAlive() || pPlayer->IsGameMaster() || pPlayer->GetQuestStatus(QUEST_RESUPPLYING_THE_EXCAVATION) == QUEST_STATUS_COMPLETE || pPlayer->GetQuestStatus(QUEST_RESUPPLYING_THE_EXCAVATION) == QUEST_STATUS_NONE) return false; @@ -212,7 +212,7 @@ bool AreaTrigger_at_huldar_miran(Player* pPlayer, AreaTriggerEntry const* /*pAt* Creature* huldar = GetClosestCreatureWithEntry(pPlayer, NPC_HULDAR, 60.0f); if (huldar) { - if (!huldar->isAlive()) + if (!huldar->IsAlive()) return false; } else @@ -222,7 +222,7 @@ bool AreaTrigger_at_huldar_miran(Player* pPlayer, AreaTriggerEntry const* /*pAt* Creature* miran = GetClosestCreatureWithEntry(pPlayer, NPC_MIRAN, 60.0f); if (miran) { - if (!miran->isAlive()) + if (!miran->IsAlive()) return false; else { @@ -241,14 +241,14 @@ bool AreaTrigger_at_huldar_miran(Player* pPlayer, AreaTriggerEntry const* /*pAt* // minor optimization: Quest NPCs are already in combat with someone, so skip further checks. - if (miran->isInCombat() || huldar->isInCombat()) + if (miran->IsInCombat() || huldar->IsInCombat()) return true; // Check if Saean is available. Creature* saean = GetClosestCreatureWithEntry(pPlayer, NPC_SAEAN, 60.0f); if (saean) { - if (saean->isAlive()) + if (saean->IsAlive()) { npc_saeanAI* saeanAI = dynamic_cast(saean->AI()); if (saeanAI) diff --git a/src/scripts/eastern_kingdoms/redridge_mountains/redridge_mountains.cpp b/src/scripts/eastern_kingdoms/redridge_mountains/redridge_mountains.cpp index 25642f2e5..1108b27f2 100644 --- a/src/scripts/eastern_kingdoms/redridge_mountains/redridge_mountains.cpp +++ b/src/scripts/eastern_kingdoms/redridge_mountains/redridge_mountains.cpp @@ -93,12 +93,12 @@ struct npc_corporal_keeshan_escortAI : npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { //Combat check - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiMockingBlowTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MOCKING_BLOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MOCKING_BLOW); m_uiMockingBlowTimer = 5000; } else @@ -106,7 +106,7 @@ struct npc_corporal_keeshan_escortAI : npc_escortAI if (m_uiShieldBashTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH); m_uiShieldBashTimer = 8000; } else diff --git a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp index 13495d906..21d1a92d3 100644 --- a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp +++ b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp @@ -34,7 +34,7 @@ EndContentData */ bool GossipHello_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) @@ -51,7 +51,7 @@ bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature, uin { pPlayer->CLOSE_GOSSIP_MENU(); if (pPlayer->TeleportTo(409, 1096.0f, -467.0f, -104.6f, 3.64f)) - if (!pPlayer->isAlive()) + if (!pPlayer->IsAlive()) { pPlayer->ResurrectPlayer(0.5f, false); pPlayer->SpawnCorpseBones(); @@ -134,7 +134,7 @@ struct npc_dorius_stonetenderAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -239,7 +239,7 @@ struct npc_obsidionAI : public ScriptedAI void SummonedCreatureDespawn(Creature* creature) override { - if (creature->GetEntry() == NPC_LATHORIC_THE_BLACK && (!m_creature->isAlive() || !m_creature->isInCombat())) + if (creature->GetEntry() == NPC_LATHORIC_THE_BLACK && (!m_creature->IsAlive() || !m_creature->IsInCombat())) Reset(); } @@ -254,7 +254,7 @@ struct npc_obsidionAI : public ScriptedAI return; // talking, only if not in combat - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) { if (m_nextText == SAY_LATHORIC1) { @@ -299,12 +299,12 @@ struct npc_obsidionAI : public ScriptedAI } // fighting - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiGroundSmashTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_GROUND_SMASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_GROUND_SMASH) == CAST_OK) m_uiGroundSmashTimer = 8000; } else @@ -313,7 +313,7 @@ struct npc_obsidionAI : public ScriptedAI if (m_uiKnockAwayTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = 12000; } else @@ -344,7 +344,7 @@ bool QuestAccept_npc_dying_archaeologist(Player* pPlayer, Creature* pCreature, c { if (npc_obsidionAI* pObsidionAI = dynamic_cast(Obsidion->AI())) { - if (pObsidionAI->m_IsEventRunning || !Obsidion->isAlive()) + if (pObsidionAI->m_IsEventRunning || !Obsidion->IsAlive()) return false; pObsidionAI->StartEvent(); pObsidionAI->m_playerList.push_back(pPlayer->GetObjectGuid()); diff --git a/src/scripts/eastern_kingdoms/silverpine_forest/shadowfang_keep/instance_shadowfang_keep.cpp b/src/scripts/eastern_kingdoms/silverpine_forest/shadowfang_keep/instance_shadowfang_keep.cpp index 0f613ac62..953607446 100644 --- a/src/scripts/eastern_kingdoms/silverpine_forest/shadowfang_keep/instance_shadowfang_keep.cpp +++ b/src/scripts/eastern_kingdoms/silverpine_forest/shadowfang_keep/instance_shadowfang_keep.cpp @@ -143,14 +143,14 @@ struct instance_shadowfang_keep : public ScriptedInstance if (pCreature->GetRespawnDelay() == 7201) { pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); } /** Initialize 4278 Patrol */ if (pCreature->GetRespawnDelay() == 7202) { pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); } } @@ -208,7 +208,7 @@ struct instance_shadowfang_keep : public ScriptedInstance if ((*it)->GetRespawnDelay() == 7201) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); } @@ -230,7 +230,7 @@ struct instance_shadowfang_keep : public ScriptedInstance if ((*it)->GetRespawnDelay() == 7202) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); } diff --git a/src/scripts/eastern_kingdoms/silverpine_forest/silverpine_forest.cpp b/src/scripts/eastern_kingdoms/silverpine_forest/silverpine_forest.cpp index 83979e048..bb1479219 100644 --- a/src/scripts/eastern_kingdoms/silverpine_forest/silverpine_forest.cpp +++ b/src/scripts/eastern_kingdoms/silverpine_forest/silverpine_forest.cpp @@ -42,12 +42,12 @@ struct npc_astor_hadrenAI : public ScriptedAI void Reset() override { - m_creature->setFaction(68); + m_creature->SetFactionTemplateId(68); } void JustDied(Unit *who) override { - m_creature->setFaction(68); + m_creature->SetFactionTemplateId(68); } }; @@ -76,7 +76,7 @@ bool GossipSelect_npc_astor_hadren(Player* pPlayer, Creature* pCreature, uint32 break; case GOSSIP_ACTION_INFO_DEF + 2: pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(21); + pCreature->SetFactionTemplateId(21); ((npc_astor_hadrenAI*)pCreature->AI())->AttackStart(pPlayer); break; } @@ -402,7 +402,7 @@ struct npc_deathstalker_faerleiaAI : ScriptedAI m_uiWaveTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -621,7 +621,7 @@ struct npc_human_worgenAI : public ScriptedAI m_uiWolfSound_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; switch (m_creature->GetEntry()) @@ -666,7 +666,7 @@ struct npc_human_worgenAI : public ScriptedAI case PYREWOOD_TAILOR: if (m_uiBackstab_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACKSTAB) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACKSTAB) == CAST_OK) m_uiBackstab_Timer = 8100; } else @@ -674,7 +674,7 @@ struct npc_human_worgenAI : public ScriptedAI if (m_uiDisarm_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISARM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISARM) == CAST_OK) m_uiDisarm_Timer = 7100; } else @@ -682,7 +682,7 @@ struct npc_human_worgenAI : public ScriptedAI if (m_uiExposeWeakness_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_EXPOSE_WEAKNESS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_EXPOSE_WEAKNESS) == CAST_OK) m_uiExposeWeakness_Timer = 9100; } else diff --git a/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp b/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp index a6d903618..790bbde4f 100644 --- a/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp +++ b/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp @@ -212,7 +212,7 @@ uint32 GetRandomGuardText() void npc_reginald_windsorAI::MoveInLineOfSight(Unit* Victim) { - if (Victim && Victim->isAlive()) + if (Victim && Victim->IsAlive()) { if (Victim->GetEntry() == NPC_STORMWIND_CITY_GUARD || Victim->GetEntry() == NPC_STORMWIND_ROYAL_GUARD || @@ -289,7 +289,7 @@ void npc_reginald_windsorAI::UpdateAI(const uint32 uiDiff) if (Creature* pMercutio = m_creature->FindNearestCreature(NPC_MERCUTIO, 10.0f)) { pMercutio->SetSpeedRate(MOVE_WALK, 2.5f); - pMercutio->setFaction(m_creature->getFaction()); + pMercutio->SetFactionTemplateId(m_creature->GetFactionTemplateId()); pMercutio->GetMotionMaster()->MovePoint(0, -9148.395508f, 371.322174f, 90.543655f); pMercutio->ForcedDespawn(12000); m_creature->SetFacingToObject(pMercutio); @@ -659,7 +659,7 @@ void npc_reginald_windsorAI::UpdateAI(const uint32 uiDiff) { Creature* crea = me->GetMap()->GetCreature(DragsGUIDs[Var]); crea->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - crea->getThreatManager().addThreatDirectly(Bolvar, 5000.0f); + crea->GetThreatManager().addThreatDirectly(Bolvar, 5000.0f); crea->SetTargetGuid(Bolvar->GetGUID()); Bolvar->AddThreat(crea); Bolvar->SetInCombatWith(crea); @@ -741,7 +741,7 @@ void npc_reginald_windsorAI::UpdateAI(const uint32 uiDiff) { if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { - if (!Bolvar->isInCombat()) + if (!Bolvar->IsInCombat()) { if (!CombatJustEnded) { @@ -786,7 +786,7 @@ bool GossipHello_npc_reginald_windsor(Player* pPlayer, Creature* pCreature) { if (pPlayer == pWindsorEventAI->GetPlayer() && pWindsorEventAI->QuestAccepted) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, 8256, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - else if (pCreature->isQuestGiver()) + else if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(5633, pCreature->GetGUID()); @@ -982,7 +982,7 @@ bool AreaTrigger_at_stormwind_gates(Player* pPlayer, AreaTriggerEntry const* /*p return false; // If player is dead, GM mode is ON, quest complete or no quest. - if (!pPlayer || !pPlayer->isAlive() || pPlayer->IsGameMaster() || + if (!pPlayer || !pPlayer->IsAlive() || pPlayer->IsGameMaster() || !(pPlayer->IsCurrentQuest(QUEST_STORMWIND_RENDEZVOUS) || (pPlayer->GetQuestRewardStatus(QUEST_STORMWIND_RENDEZVOUS) && !pPlayer->GetQuestRewardStatus(QUEST_THE_GREAT_MASQUERADE) && !pPlayer->IsCurrentQuest(QUEST_THE_GREAT_MASQUERADE)))) return false; diff --git a/src/scripts/eastern_kingdoms/stormwind_city/stormwind_city.cpp b/src/scripts/eastern_kingdoms/stormwind_city/stormwind_city.cpp index d9bf5d6c6..901648d4d 100644 --- a/src/scripts/eastern_kingdoms/stormwind_city/stormwind_city.cpp +++ b/src/scripts/eastern_kingdoms/stormwind_city/stormwind_city.cpp @@ -44,7 +44,7 @@ struct npc_bartlebyAI : public ScriptedAI { npc_bartlebyAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_uiNormalFaction = pCreature->getFaction(); + m_uiNormalFaction = pCreature->GetFactionTemplateId(); Reset(); } @@ -52,13 +52,13 @@ struct npc_bartlebyAI : public ScriptedAI void Reset() override { - if (m_creature->getFaction() != m_uiNormalFaction) - m_creature->setFaction(m_uiNormalFaction); + if (m_creature->GetFactionTemplateId() != m_uiNormalFaction) + m_creature->SetFactionTemplateId(m_uiNormalFaction); } void AttackedBy(Unit* pAttacker) override { - if (!pAttacker || m_creature->getVictim() || m_creature->IsFriendlyTo(pAttacker)) + if (!pAttacker || m_creature->GetVictim() || m_creature->IsFriendlyTo(pAttacker)) return; AttackStart(pAttacker); @@ -88,7 +88,7 @@ bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, const Quest* if (pQuest->GetQuestId() == QUEST_BEAT) { - pCreature->setFaction(FACTION_ENEMY); + pCreature->SetFactionTemplateId(FACTION_ENEMY); ((npc_bartlebyAI*)pCreature->AI())->AttackStart(pPlayer); } return true; @@ -170,7 +170,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI // Prevent Reset() call after Dashel has been defeated. void AttackedBy(Unit* pAttacker) override { - if (!pAttacker || m_creature->getVictim() || m_creature->IsFriendlyTo(pAttacker)) + if (!pAttacker || m_creature->GetVictim() || m_creature->IsFriendlyTo(pAttacker)) return; AttackStart(pAttacker); @@ -188,7 +188,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI // remove thugs for (ptrdiff_t i = 0; i < 2; ++i) { - if (m_thugs[i] && m_thugs[i]->isAlive()) + if (m_thugs[i] && m_thugs[i]->IsAlive()) { static_cast(m_thugs[i])->UnSummon(); } @@ -207,7 +207,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI // restore some flags m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); // restore faction - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); // reset player guid m_playerGuid.Clear(); } @@ -224,7 +224,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI DoScriptText(SAY_PROGRESS_2_DAS, m_creature); m_creature->RemoveAllAuras(); - m_creature->setFaction(FACTION_FRIENDLY_TO_ALL); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY_TO_ALL); m_creature->DeleteThreatList(); m_creature->CombatStop(); @@ -234,13 +234,13 @@ struct npc_dashel_stonefistAI : public ScriptedAI // check if thugs are alive for (ptrdiff_t i = 0; i < 2; ++i) { - if (m_thugs[i] && m_thugs[i]->isAlive()) + if (m_thugs[i] && m_thugs[i]->IsAlive()) { m_thugs[i]->RemoveAllAuras(); m_thugs[i]->DeleteThreatList(); m_thugs[i]->CombatStop(); - m_thugs[i]->setFaction(FACTION_FRIENDLY_TO_ALL); + m_thugs[i]->SetFactionTemplateId(FACTION_FRIENDLY_TO_ALL); if (MotionMaster* pMotionMaster = m_thugs[i]->GetMotionMaster()) pMotionMaster->MoveTargetedHome(); @@ -281,7 +281,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI if (m_nextPhaseDelayTimer < uiDiff) { // recheck for safety, thugs can be killed by gm command, etc. - if (m_thugs[0] && m_thugs[0]->isAlive()) + if (m_thugs[0] && m_thugs[0]->IsAlive()) { DoScriptText(SAY_PROGRESS_4_THU, m_thugs[0]); } @@ -298,7 +298,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI if (m_nextPhaseDelayTimer < uiDiff) { // recheck for safety, thugs can be killed by gm command, etc. - if (m_thugs[1] && m_thugs[1]->isAlive()) + if (m_thugs[1] && m_thugs[1]->IsAlive()) { DoScriptText(SAY_PROGRESS_5_THU, m_thugs[1]); } @@ -357,7 +357,7 @@ struct npc_dashel_stonefistAI : public ScriptedAI if (thug >= 2) return; - if (m_thugs[thug] && m_thugs[thug]->isAlive()) + if (m_thugs[thug] && m_thugs[thug]->IsAlive()) { m_thugs[thug]->GetMotionMaster()->MovePoint(0, aThugResetPosition[thug][0], aThugResetPosition[thug][1], aThugResetPosition[thug][2], MOVE_WALK_MODE); m_thugs[thug]->ForcedDespawn(3000); @@ -430,7 +430,7 @@ bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, cons // Dashel says: Now you're gonna get it good, "PlayerName". DoScriptText(SAY_PROGRESS_1_DAS, pCreature, pPlayer); - pCreature->setFaction(FACTION_NEUTRAL); + pCreature->SetFactionTemplateId(FACTION_NEUTRAL); pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); dashelStonefistAI->m_playerGuid = pPlayer->GetObjectGuid(); @@ -477,7 +477,7 @@ CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) bool GossipHello_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) @@ -625,11 +625,11 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI void JustDied(Unit* /*pKiller*/) override { - if (m_creature->getFaction() == FACTION_ENEMYY) - m_creature->setFaction(FACTION_NORMAL_LESCOVAR); + if (m_creature->GetFactionTemplateId() == FACTION_ENEMYY) + m_creature->SetFactionTemplateId(FACTION_NORMAL_LESCOVAR); if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - if (!pMarzon->isAlive()) + if (!pMarzon->IsAlive()) { if (Creature* pGuard1 = m_creature->GetMap()->GetCreature(m_guidGuard1)) { @@ -658,7 +658,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI if (pSummoned->GetEntry() != NPC_MARZON_THE_SILENT_BLADE) return; - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) { if (Creature* pGuard1 = m_creature->GetMap()->GetCreature(m_guidGuard1)) { @@ -733,10 +733,10 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI case 13: SetEscortPaused(false); if (Creature* pGuard1 = m_creature->GetMap()->GetCreature(m_guidGuard1)) - if (pGuard1->isAlive()) + if (pGuard1->IsAlive()) pGuard1->SetFacingToObject(m_creature); if (Creature* pGuard2 = m_creature->GetMap()->GetCreature(m_guidGuard2)) - if (pGuard2->isAlive()) + if (pGuard2->IsAlive()) pGuard2->SetFacingToObject(m_creature); DoScriptText(SAY_GREGOR_2, m_creature); m_uiEventPhase = 1; @@ -749,7 +749,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI SetEscortPaused(true); break; case 20: - m_creature->setFaction(FACTION_NORMAL_LESCOVAR); + m_creature->SetFactionTemplateId(FACTION_NORMAL_LESCOVAR); if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) { pMarzon->CastSpell(pMarzon, SPELL_STEALTH, true); @@ -778,7 +778,7 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI } if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - if (!pMarzon->isInCombat()) + if (!pMarzon->IsInCombat()) pMarzon->ForcedDespawn(0); } } @@ -793,13 +793,13 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI { case 1: if (Creature* pGuard1 = m_creature->GetMap()->GetCreature(m_guidGuard1)) - if (pGuard1->isAlive() && !pGuard1->getVictim()) + if (pGuard1->IsAlive() && !pGuard1->GetVictim()) { DoScriptText(SAY_ROYAL_GUARD_2, pGuard1); pGuard1->GetMotionMaster()->MovePoint(0, -8364.07f, 406.775f, 122.274f, MOVE_PATHFINDING); } if (Creature* pGuard2 = m_creature->GetMap()->GetCreature(m_guidGuard2)) - if (pGuard2->isAlive() && !pGuard2->getVictim()) + if (pGuard2->IsAlive() && !pGuard2->GetVictim()) { DoScriptText(SAY_ROYAL_GUARD_2, pGuard2); pGuard2->GetMotionMaster()->MovePoint(0, -8353.91f, 415.318f, 122.274f, MOVE_PATHFINDING); @@ -861,38 +861,38 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI if (Creature* pTyrion = m_creature->GetMap()->GetCreature(m_guidTyrion)) DoScriptText(SAY_TYRION_2, pTyrion); if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - pMarzon->setFaction(FACTION_ENEMYY); - m_creature->setFaction(FACTION_ENEMYY); + pMarzon->SetFactionTemplateId(FACTION_ENEMYY); + m_creature->SetFactionTemplateId(FACTION_ENEMYY); m_uiEventTimer = 5000; ++m_uiEventPhase; break; case 11: if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) pMarzon->GetMotionMaster()->MovePoint(0, -8419.00f, 486.26f, 123.75f, MOVE_PATHFINDING); - else if (m_creature->getVictim()) - pMarzon->AI()->AttackStart(m_creature->getVictim()); + else if (m_creature->GetVictim()) + pMarzon->AI()->AttackStart(m_creature->GetVictim()); } ++m_uiEventPhase; SetEscortPaused(false); break; case 12: if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - if (pMarzon->isInCombat() && pMarzon->getVictim() && !m_creature->isInCombat()) - m_creature->AI()->AttackStart(pMarzon->getVictim()); + if (pMarzon->IsInCombat() && pMarzon->GetVictim() && !m_creature->IsInCombat()) + m_creature->AI()->AttackStart(pMarzon->GetVictim()); break; case 13: if (Player* pPlayer = GetPlayerForEscort()) - if (pPlayer->isDead()) + if (pPlayer->IsDead()) { SetEscortPaused(false); - m_creature->setFaction(FACTION_NORMAL_LESCOVAR); + m_creature->SetFactionTemplateId(FACTION_NORMAL_LESCOVAR); if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - if (!pMarzon->isDead() && pMarzon->getFaction() == FACTION_ENEMYY) - pMarzon->setFaction(FACTION_NORMAL_MARZON); + if (!pMarzon->IsDead() && pMarzon->GetFactionTemplateId() == FACTION_ENEMYY) + pMarzon->SetFactionTemplateId(FACTION_NORMAL_MARZON); } - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) SetEscortPaused(false); break; } @@ -902,12 +902,12 @@ struct npc_lord_gregor_lescovarAI : public npc_escortAI } if (Creature* pMarzon = m_creature->GetMap()->GetCreature(m_guidMarzon)) - if (pMarzon && pMarzon->isDead() && pMarzon->getFaction() == FACTION_ENEMYY) - pMarzon->setFaction(FACTION_NORMAL_MARZON); + if (pMarzon && pMarzon->IsDead() && pMarzon->GetFactionTemplateId() == FACTION_ENEMYY) + pMarzon->SetFactionTemplateId(FACTION_NORMAL_MARZON); npc_escortAI::UpdateAI(uiDiff); - if (m_creature->SelectHostileTarget() || m_creature->getVictim()) + if (m_creature->SelectHostileTarget() || m_creature->GetVictim()) DoMeleeAttackIfReady(); } }; @@ -1002,7 +1002,7 @@ struct npc_tyrion_spybotAI : public npc_escortAI { if (!pGregor) return false; - else if (!pGregor->isAlive()) + else if (!pGregor->IsAlive()) pGregor->Respawn(); m_guidLordGregor = pGregor->GetObjectGuid(); } @@ -1018,7 +1018,7 @@ struct npc_tyrion_spybotAI : public npc_escortAI for (std::list::iterator iter = lGardenStormwindRoyalGuards.begin(); iter != lGardenStormwindRoyalGuards.end(); ++iter) { Creature* GardenStormwindRoyalGuard = (*iter); - if (GardenStormwindRoyalGuard->isDead() || !GardenStormwindRoyalGuard->isAlive()) + if (GardenStormwindRoyalGuard->IsDead() || !GardenStormwindRoyalGuard->IsAlive()) GardenStormwindRoyalGuard->Respawn(); if (m_uiGardenGuardsCounter == 0) @@ -1070,13 +1070,13 @@ struct npc_tyrion_spybotAI : public npc_escortAI DoScriptText(SAY_TYRIONA_1, m_creature); if (Creature* pGuard1 = m_creature->GetMap()->GetCreature(m_guidGuard1)) { - if (pGuard1 && pGuard1->isAlive() && !pGuard1->getVictim()) + if (pGuard1 && pGuard1->IsAlive() && !pGuard1->GetVictim()) pGuard1->SetFacingToObject(m_creature); } if (Creature* pGuard2 = m_creature->GetMap()->GetCreature(m_guidGuard2)) { - if (pGuard2 && pGuard2->isAlive() && !pGuard2->getVictim()) + if (pGuard2 && pGuard2->IsAlive() && !pGuard2->GetVictim()) pGuard2->SetFacingToObject(m_creature); } @@ -1190,7 +1190,7 @@ bool GossipHello_npc_tyrion(Player* pPlayer, Creature* pCreature) } else { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid()); pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetObjectGuid()); @@ -1251,7 +1251,7 @@ struct npc_master_woodAI : public ScriptedAI void ReceiveEmote(Player* pPlayer, uint32 emote) override { - if (pPlayer && (pPlayer->GetTeam() == ALLIANCE) && !m_creature->isInCombat() && m_creature->IsWithinLOSInMap(pPlayer)) + if (pPlayer && (pPlayer->GetTeam() == ALLIANCE) && !m_creature->IsInCombat() && m_creature->IsWithinLOSInMap(pPlayer)) { switch (emote) { diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp index 046a4ffc6..655a1c7b9 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/stranglethorn_vale.cpp @@ -58,7 +58,7 @@ struct mob_yennikuAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); m_creature->CombatStop(); //stop combat m_creature->DeleteThreatList(); //unsure of this - m_creature->setFaction(83); //horde generic + m_creature->SetFactionTemplateId(83); //horde generic bReset = true; Reset_Timer = 60000; @@ -77,14 +77,14 @@ struct mob_yennikuAI : public ScriptedAI { EnterEvadeMode(); bReset = false; - m_creature->setFaction(28); //troll, bloodscalp + m_creature->SetFactionTemplateId(28); //troll, bloodscalp } else Reset_Timer -= diff; } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -274,7 +274,7 @@ struct npc_molthorAI : public npc_escortAI m_uiTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -440,7 +440,7 @@ struct npc_servant_of_the_handAI : public ScriptedAI m_uiSpawnOutTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -550,7 +550,7 @@ struct npc_witch_doctor_unbagwaAI : ScriptedAI void SummonedCreatureDespawn(Creature* pCreature) override { - if (!m_bStartEvent || !pCreature->isAlive()) + if (!m_bStartEvent || !pCreature->IsAlive()) return; m_bResetEvent = true; @@ -634,7 +634,7 @@ struct npc_witch_doctor_unbagwaAI : ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp index 8010e2262..ae1d5e423 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_arlokk.cpp @@ -183,7 +183,7 @@ struct boss_arlokkAI : public ScriptedAI { if (Unit* pUnit = m_creature->GetMap()->GetUnit(m_uiMarkedGUID)) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pSummoned->AI()->AttackStart(pUnit); ++m_uiSummonCount; @@ -203,14 +203,14 @@ struct boss_arlokkAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_bIsPhaseTwo && !m_bIsVanished) //P1 { if (m_uiShadowWordPain_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWWORDPAIN) == CAST_OK) m_uiShadowWordPain_Timer = 15000; } else @@ -218,7 +218,7 @@ struct boss_arlokkAI : public ScriptedAI if (m_uiBackstab_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACKSTAB) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACKSTAB) == CAST_OK) m_uiBackstab_Timer = urand(6000, 12000); } else @@ -257,7 +257,7 @@ struct boss_arlokkAI : public ScriptedAI { if (m_uiThrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ROSSER) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ROSSER) == CAST_OK) m_uiThrash_Timer = urand(5000, 9000); } else @@ -266,7 +266,7 @@ struct boss_arlokkAI : public ScriptedAI // Ravage Timer if (m_uiRavage_Timer <= uiDiff) { - if (DoCastSpellIfCan(me->getVictim(), SPELL_RAVAGE) == CAST_OK) + if (DoCastSpellIfCan(me->GetVictim(), SPELL_RAVAGE) == CAST_OK) m_uiRavage_Timer = 16000; } else @@ -275,10 +275,10 @@ struct boss_arlokkAI : public ScriptedAI //Gouge_Timer if (m_uiGouge_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_GOUGE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_GOUGE) == CAST_OK) { - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -80); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -80); m_uiGouge_Timer = urand(17000, 27000); } @@ -288,7 +288,7 @@ struct boss_arlokkAI : public ScriptedAI if (m_uiTourbillon_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TOURBILLON) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TOURBILLON) == CAST_OK) m_uiTourbillon_Timer = 16000; } else @@ -390,7 +390,7 @@ struct mob_prowlerAI : public ScriptedAI m_uiArlokkGuid = pArlokk->GetGUID(); if (Creature* pArlokk = m_creature->GetMap()->GetCreature(m_uiArlokkGuid)) - if (pArlokk->isAlive()) + if (pArlokk->IsAlive()) return CAST_AI(boss_arlokkAI, pArlokk->AI()); return nullptr; } @@ -419,8 +419,8 @@ struct mob_prowlerAI : public ScriptedAI m_creature->AddObjectToRemoveList(); return; } - if (DoGetThreat(m_creature->getVictim())) - DoModifyThreatPercent(m_creature->getVictim(), -100); + if (DoGetThreat(m_creature->GetVictim())) + DoModifyThreatPercent(m_creature->GetVictim(), -100); if (pMarkedTarget) { diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_gahzranka.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_gahzranka.cpp index 91f0d2b32..d031979b5 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_gahzranka.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_gahzranka.cpp @@ -110,13 +110,13 @@ struct boss_gahzrankaAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Frostbreath_Timer if (Frostbreath_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROSTBREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROSTBREATH) == CAST_OK) Frostbreath_Timer = urand(8000, 20000); } else Frostbreath_Timer -= diff; @@ -138,7 +138,7 @@ struct boss_gahzrankaAI : public ScriptedAI //Slam_Timer if (Slam_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SLAM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SLAM) == CAST_OK) Slam_Timer = urand(12000, 20000); } else Slam_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp index 18997ca4c..d2f8f4a5d 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_grilek.cpp @@ -46,7 +46,7 @@ struct boss_grilekAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Avartar_Timer @@ -58,8 +58,8 @@ struct boss_grilekAI : public ScriptedAI target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -50); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -50); if (target) AttackStart(target); @@ -70,7 +70,7 @@ struct boss_grilekAI : public ScriptedAI //GroundTremor_Timer if (GroundTremor_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_GROUNDTREMOR); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_GROUNDTREMOR); GroundTremor_Timer = urand(12000, 16000); } else GroundTremor_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hakkar.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hakkar.cpp index 8de0dc8b5..2ae9e38ad 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hakkar.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hakkar.cpp @@ -134,7 +134,7 @@ struct boss_hakkarAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; /** Prevent exploit */ @@ -152,8 +152,8 @@ struct boss_hakkarAI : public ScriptedAI { if (!pTarget->HasAura(SPELL_CAUSEINSANITY)) { - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); - m_creature->getThreatManager().addThreatDirectly(pTarget, InsanePlayerAggro); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().addThreatDirectly(pTarget, InsanePlayerAggro); InsanePlayerGuid = 0; InsanePlayerAggro = 0; @@ -198,12 +198,12 @@ struct boss_hakkarAI : public ScriptedAI // CAUSEINSANITY if (CauseInsanity_Timer < diff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { InsanePlayerGuid = pTarget->GetGUID(); - InsanePlayerAggro = m_creature->getThreatManager().getThreat(pTarget); + InsanePlayerAggro = m_creature->GetThreatManager().getThreat(pTarget); - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CAUSEINSANITY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CAUSEINSANITY) == CAST_OK) { CCDelayInsanity_Timer = 4000; //DoScriptText(SAY_FLEEING, m_creature); @@ -229,7 +229,7 @@ struct boss_hakkarAI : public ScriptedAI { if (AspectOfJeklik_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ASPECT_OF_JEKLIK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ASPECT_OF_JEKLIK) == CAST_OK) AspectOfJeklik_Timer = urand(10000, 14000); } else @@ -241,7 +241,7 @@ struct boss_hakkarAI : public ScriptedAI { if (AspectOfVenoxis_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ASPECT_OF_VENOXIS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ASPECT_OF_VENOXIS) == CAST_OK) AspectOfVenoxis_Timer = 8000; } else @@ -253,7 +253,7 @@ struct boss_hakkarAI : public ScriptedAI { if (AspectOfMarli_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ASPECT_OF_MARLI) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ASPECT_OF_MARLI) == CAST_OK) AspectOfMarli_Timer = 10000; } else diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hazzarah.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hazzarah.cpp index 2cf5f3af5..84ea5da11 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hazzarah.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_hazzarah.cpp @@ -47,13 +47,13 @@ struct boss_hazzarahAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ManaBurn_Timer if (ManaBurn_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MANABURN); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MANABURN); ManaBurn_Timer = urand(8000, 16000); } else ManaBurn_Timer -= diff; @@ -61,10 +61,10 @@ struct boss_hazzarahAI : public ScriptedAI //Sleep_Timer if (Sleep_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SLEEP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SLEEP); Sleep_Timer = urand(12000, 20000); - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { 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 eaf27d153..4a64975de 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jeklik.cpp @@ -102,7 +102,7 @@ struct boss_jeklikAI : public ScriptedAI PhaseTwo = false; skillStarted = false; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) m_pInstance->SetData(TYPE_JEKLIK, FAIL); m_creature->SetObjectScale(1.5f); @@ -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_STAT_IGNORE_PATHFINDING); DoScriptText(SAY_AGGRO, m_creature); m_creature->AddAura(SPELL_BAT_FORM); m_creature->SetFly(true); @@ -146,7 +146,7 @@ struct boss_jeklikAI : public ScriptedAI void UpdateAI(const uint32 lastDiff) override { - if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_pInstance || !m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!PhaseTwo && m_creature->GetHealthPercent() < 50.0f) @@ -244,7 +244,7 @@ struct boss_jeklikAI : public ScriptedAI { if (!skillStarted) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SCREECH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SCREECH) == CAST_OK) { skillStarted = true; Screech_Timer = 30000; @@ -262,7 +262,7 @@ struct boss_jeklikAI : public ScriptedAI { if (!skillStarted) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SONICBURST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SONICBURST) == CAST_OK) { skillStarted = true; SonicBurst_Timer = urand(20000, 24000); @@ -278,7 +278,7 @@ struct boss_jeklikAI : public ScriptedAI { if (!skillStarted) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SWOOP) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SWOOP) == CAST_OK) { skillStarted = true; Swoop_Timer = urand(12000, 15000); @@ -294,7 +294,7 @@ struct boss_jeklikAI : public ScriptedAI { if (!skillStarted) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PIERCEARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PIERCEARMOR) == CAST_OK) { skillStarted = true; PierceArmor_Timer = urand(16000, 18000); @@ -511,7 +511,7 @@ struct npc_guru_bat_riderAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!GoingToExplose && m_creature->GetHealthPercent() < 40.0f) @@ -535,7 +535,7 @@ struct npc_guru_bat_riderAI : public ScriptedAI if (InfectedBite_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_INFECTED_BITE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_INFECTED_BITE) == CAST_OK) InfectedBite_Timer = 15000; } else @@ -543,7 +543,7 @@ struct npc_guru_bat_riderAI : public ScriptedAI if (Thrash_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THRASH) == CAST_OK) Thrash_Timer = 6000; } else 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 310ec30cc..545280359 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_jindo.cpp @@ -124,9 +124,9 @@ struct boss_jindoAI : public ScriptedAI return; HexGuid = pCaster->GetGUID(); - HexAggro = m_creature->getThreatManager().getThreat(pCaster); + HexAggro = m_creature->GetThreatManager().getThreat(pCaster); - m_creature->getThreatManager().modifyThreatPercent(pCaster, -100); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -100); } } @@ -153,7 +153,7 @@ struct boss_jindoAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (HexGuid) @@ -161,7 +161,7 @@ struct boss_jindoAI : public ScriptedAI Player* hexPlayer = m_creature->GetMap()->GetPlayer(HexGuid); if (hexPlayer && !hexPlayer->HasAura(SPELL_HEX)) { - m_creature->getThreatManager().addThreatDirectly(hexPlayer, HexAggro); + m_creature->GetThreatManager().addThreatDirectly(hexPlayer, HexAggro); HexGuid = 0; HexAggro = 0; } @@ -194,10 +194,10 @@ struct boss_jindoAI : public ScriptedAI { if (Player* pTarget = m_creature->GetMap()->GetPlayer((*itr))) { - if ((pTarget->isAlive() && !pTarget->HasAura(24261, EFFECT_INDEX_0)) || pTarget->isDead()) // SPELL_BRAINWASH 24261 + if ((pTarget->IsAlive() && !pTarget->HasAura(24261, EFFECT_INDEX_0)) || pTarget->IsDead()) // SPELL_BRAINWASH 24261 { PlayerBrainWashedGuid = *itr; - if (pTarget->isDead()) + if (pTarget->IsDead()) PlayerDead = true; else AuraRemoved = true; @@ -215,8 +215,8 @@ struct boss_jindoAI : public ScriptedAI Player* playerBrainWashed = m_creature->GetMap()->GetPlayer(PlayerBrainWashedGuid); if (AuraRemoved) { - m_creature->getThreatManager().modifyThreatPercent(playerBrainWashed, -100); - m_creature->getThreatManager().addThreatDirectly(playerBrainWashed, (*Iter)); + m_creature->GetThreatManager().modifyThreatPercent(playerBrainWashed, -100); + m_creature->GetThreatManager().addThreatDirectly(playerBrainWashed, (*Iter)); } BrainWashedPlayerGuid.remove(PlayerBrainWashedGuid); @@ -243,7 +243,7 @@ struct boss_jindoAI : public ScriptedAI //Hex_Timer if (Hex_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_HEX) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HEX) == CAST_OK) Hex_Timer = urand(12000, 20000); } else @@ -313,16 +313,16 @@ struct mob_shade_of_jindoAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (m_creature->getVictim()->HasAura(SPELL_HEX)) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + if (m_creature->GetVictim()->HasAura(SPELL_HEX)) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); //ShadowShock_Timer if (ShadowShock_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWSHOCK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWSHOCK); ShadowShock_Timer = 2000; } else @@ -351,27 +351,27 @@ struct mob_brain_wash_totemAI : public ScriptedAI CheckTimer = 0; m_creature->AddAura(23198, ADD_AURA_PERMANENT); // Avoidance : pas touché par les AOE - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); SetCombatMovement(false); } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || !m_pInstance) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || !m_pInstance) { m_creature->DisappearAndDie(); return; } - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) m_creature->SetInCombatWithZone(); // Deja en train de CM le joueur if (PlayerMCGuid) if (Player* pPlayer = m_creature->GetMap()->GetPlayer(PlayerMCGuid)) - if (pPlayer->isAlive() && pPlayer->HasAura(24261, EFFECT_INDEX_0)) + if (pPlayer->IsAlive() && pPlayer->HasAura(24261, EFFECT_INDEX_0)) return; @@ -381,12 +381,12 @@ struct mob_brain_wash_totemAI : public ScriptedAI if (pJindo->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1)) { Unit* pTarget = pJindo ? pJindo->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0) : nullptr; - if (pTarget && pTarget->isAlive() && pTarget->IsPlayer() && !pTarget->HasAura(SPELL_HEX) && !pTarget->HasAura(SPELL_BRAINWASH)) + if (pTarget && pTarget->IsAlive() && pTarget->IsPlayer() && !pTarget->HasAura(SPELL_HEX) && !pTarget->HasAura(SPELL_BRAINWASH)) { if (boss_jindoAI* pJindoAI = dynamic_cast(pJindo->AI())) { pJindoAI->BrainWashedPlayerGuid.push_back(pTarget->GetGUID()); - pJindoAI->BrainWashedPlayerAggro.push_back(pJindo->getThreatManager().getThreat(pTarget)); + pJindoAI->BrainWashedPlayerAggro.push_back(pJindo->GetThreatManager().getThreat(pTarget)); if (DoCastSpellIfCan(pTarget, SPELL_BRAINWASH) == CAST_OK) { PlayerMCGuid = pTarget->GetGUID(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp index ff7f517f9..d1d50e01f 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_mandokir.cpp @@ -201,7 +201,7 @@ struct boss_mandokirAI : public ScriptedAI if (pVictim->GetTypeId() == TYPEID_PLAYER) { DoCastSpellIfCan(m_creature, SPELL_LEVEL_UP, true); - m_creature->SetLevel(m_creature->getLevel() + 1); + m_creature->SetLevel(m_creature->GetLevel() + 1); m_uiPlayerToRez = pVictim->GetGUID(); DoScriptText(SAY_DING_KILL, m_creature); @@ -213,7 +213,7 @@ struct boss_mandokirAI : public ScriptedAI { if (Creature* jTemp = m_creature->GetMap()->GetCreature(m_pInstance->GetData64(DATA_JINDO))) { - if (jTemp->isAlive()) + if (jTemp->IsAlive()) DoScriptText(SAY_GRATS_JINDO, jTemp); } else @@ -257,7 +257,7 @@ struct boss_mandokirAI : public ScriptedAI // If Vilebranch dies and group wipes, boss should start at the bottom of the stairs // Video: https://www.youtube.com/watch?v=joaWY0wjOXI Creature* vileBranch = m_creature->FindNearestCreature(11391, 100.0f, true); - bool isVilebranchDead = !vileBranch || !vileBranch->isAlive(); + bool isVilebranchDead = !vileBranch || !vileBranch->IsAlive(); if (reset || m_VilebranchDead != isVilebranchDead) { if (isVilebranchDead) @@ -282,7 +282,7 @@ struct boss_mandokirAI : public ScriptedAI { Unit* pWatchTarget = m_creature->GetMap()->GetUnit(m_uiWatchTarget); - if (pWatchTarget && pWatchTarget->isAlive()) + if (pWatchTarget && pWatchTarget->IsAlive()) { // Pendant le debuff if (pWatchTarget->HasAura(SPELL_WATCH)) @@ -302,7 +302,7 @@ struct boss_mandokirAI : public ScriptedAI } // Ni attaquer. - if ((!m_bTargetActed) && (m_creature->getThreatManager().getThreat(pWatchTarget) > m_fTargetThreat)) + if ((!m_bTargetActed) && (m_creature->GetThreatManager().getThreat(pWatchTarget) > m_fTargetThreat)) m_bTargetActed = true; } // Le debuff est termine @@ -325,7 +325,7 @@ struct boss_mandokirAI : public ScriptedAI for (std::vector::iterator it = m_lSpirits.begin(); it != m_lSpirits.end(); ++it) { if (Creature* pSpirit = m_creature->GetMap()->GetCreature(*it)) - if (pSpirit->isAlive()) + if (pSpirit->IsAlive()) pSpirit->AddObjectToRemoveList(); } } @@ -351,7 +351,7 @@ struct boss_mandokirAI : public ScriptedAI if (!m_uiRaptorGUID.IsEmpty()) { if (Creature* pRaptor = m_creature->GetMap()->GetCreature(m_uiRaptorGUID)) - if (pRaptor->isAlive()) + if (pRaptor->IsAlive()) pRaptor->AddObjectToRemoveList(); } m_uiRaptorGUID.Clear(); @@ -370,16 +370,16 @@ struct boss_mandokirAI : public ScriptedAI void JustSummoned(Creature* pSummoned) override { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) return; if (pSummoned->GetEntry() == NPC_OHGAN) - pSummoned->AI()->AttackStart(m_creature->getVictim()); + pSummoned->AI()->AttackStart(m_creature->GetVictim()); } void MoveInLineOfSight(Unit *pWho) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (Player* pPlayer = pWho->ToPlayer()) @@ -398,7 +398,7 @@ struct boss_mandokirAI : public ScriptedAI m_fTargetY = pTarget->GetPositionY(); m_bTargetMoved = false; m_bTargetActed = false; - m_fTargetThreat = m_creature->getThreatManager().getThreat(pTarget); + m_fTargetThreat = m_creature->GetThreatManager().getThreat(pTarget); } } @@ -407,7 +407,7 @@ struct boss_mandokirAI : public ScriptedAI if (!m_VilebranchDead) CheckVilebranchState(); - if (!m_VilebranchDead || !m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_VilebranchDead || !m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; CheckRaptor(); @@ -417,7 +417,7 @@ struct boss_mandokirAI : public ScriptedAI { if (Player* killedPlayer = m_creature->GetMap()->GetPlayer(m_uiPlayerToRez)) { - if (killedPlayer->getDeathState() == CORPSE && !killedPlayer->IsRessurectRequested()) + if (killedPlayer->GetDeathState() == CORPSE && !killedPlayer->IsRessurectRequested()) { // Find nearest spirit ready to resurrect Creature* spirit = nullptr; @@ -492,16 +492,16 @@ struct boss_mandokirAI : public ScriptedAI { if (Unit* pTargetToKill = m_creature->GetMap()->GetUnit(m_uiTargetToKill)) { - if (pTargetToKill->isAlive()) + if (pTargetToKill->IsAlive()) { bool bTargetKilled = false; float addAggro = 0; - if (float agro = m_creature->getThreatManager().getThreat(m_creature->getVictim())) + if (float agro = m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) { - m_creature->getThreatManager().modifyThreatPercent(pTargetToKill, -100); + m_creature->GetThreatManager().modifyThreatPercent(pTargetToKill, -100); addAggro = agro; } - m_creature->getThreatManager().addThreat(pTargetToKill, (addAggro + 2000)); + m_creature->GetThreatManager().addThreat(pTargetToKill, (addAggro + 2000)); m_creature->SelectHostileTarget(); @@ -513,7 +513,7 @@ struct boss_mandokirAI : public ScriptedAI } if (!bTargetKilled) m_creature->DoKillUnit(pTargetToKill); - if(pTargetToKill->isAlive()) + if(pTargetToKill->IsAlive()) m_creature->DoKillUnit(pTargetToKill); m_uiGlobalCooldown = 1000; m_uiTargetToKill = 0; @@ -557,7 +557,7 @@ struct boss_mandokirAI : public ScriptedAI if (m_uiChargeCasted_Timer < diff) { m_bChargeCasted = false; - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); } } } @@ -572,7 +572,7 @@ struct boss_mandokirAI : public ScriptedAI { if (Player* player = m_creature->GetMap()->GetPlayer(m_uiChargedPlayerGUID)) { - if (player->isAlive()) + if (player->IsAlive()) { if(m_creature->GetDistance(player) < 4.0f) { @@ -618,9 +618,9 @@ struct boss_mandokirAI : public ScriptedAI // MORTAL STRIKE if (m_uiMortalStrike_Timer < diff) { - if ((m_uiGlobalCooldown == 0) && (m_creature->getVictim()->GetHealthPercent() < 50.0f)) + if ((m_uiGlobalCooldown == 0) && (m_creature->GetVictim()->GetHealthPercent() < 50.0f)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) { m_uiMortalStrike_Timer = 15000; m_uiGlobalCooldown = 500; @@ -665,20 +665,20 @@ struct mob_ohganAI : public ScriptedAI void KilledUnit(Unit* pVictim) override { if (pVictim->GetTypeId() == TYPEID_PLAYER) - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) if (Creature* pMandokir = pVictim->FindNearestCreature(NPC_MANDOKIR, 100.0f)) pMandokir->AI()->KilledUnit(pVictim); } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // SunderArmor_Timer if (SunderArmor_Timer <= diff) { - DoCast(me->getVictim(), SPELL_SUNDERARMOR); + DoCast(me->GetVictim(), SPELL_SUNDERARMOR); SunderArmor_Timer = 10000 + rand() % 5000; } else @@ -694,11 +694,11 @@ struct mob_ohganAI : public ScriptedAI Thrash_Timer -= diff; // Execute_Timer - if (me->getVictim()->GetHealth() <= me->getVictim()->GetMaxHealth() * 0.2f) // check health first + if (me->GetVictim()->GetHealth() <= me->GetVictim()->GetMaxHealth() * 0.2f) // check health first { if (Execute_Timer <= diff) { - DoCast(me->getVictim(), SPELL_EXECUTE); + DoCast(me->GetVictim(), SPELL_EXECUTE); Execute_Timer = 10000; } else @@ -778,7 +778,7 @@ struct mob_chainedSpiritsAI : public ScriptedAI { // Attempt to rez player Player* target = m_creature->GetMap()->GetPlayer(m_uiTargetRezGUID); - if (target && target->getDeathState() == CORPSE && !target->IsRessurectRequested()) + if (target && target->GetDeathState() == CORPSE && !target->IsRessurectRequested()) m_creature->CastSpell(target, SPELL_REVIVE, true); // Will despawn at SpellHit else m_creature->AddObjectToRemoveList(); @@ -813,7 +813,7 @@ struct mob_vilebrancheAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp index 2de726f02..f2049c017 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_marli.cpp @@ -201,13 +201,13 @@ struct boss_marliAI : public ScriptedAI if (pCaster->GetTypeId() != TYPEID_PLAYER) return; - m_creature->getThreatManager().modifyThreatPercent(pCaster, -100); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -100); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Troll @@ -215,7 +215,7 @@ struct boss_marliAI : public ScriptedAI { if (m_uiPoisonVolley_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_POISONVOLLEY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POISONVOLLEY); m_uiPoisonVolley_Timer = urand(10000, 20000); } else @@ -223,7 +223,7 @@ struct boss_marliAI : public ScriptedAI if (m_uiDrainLife_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DRAIN_LIFE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DRAIN_LIFE); m_uiDrainLife_Timer = urand(20000, 50000); } else @@ -262,7 +262,7 @@ struct boss_marliAI : public ScriptedAI { if (!m_bHasWebbed && m_uiWebs_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_ENVELOPINGWEBS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ENVELOPINGWEBS); m_uiWebs_Timer = urand(10000, 15000); m_uiCharge_Timer = 1000; m_bHasWebbed = true; @@ -287,7 +287,7 @@ struct boss_marliAI : public ScriptedAI { ++i; //not aggro leader pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0); - if (pTarget && pTarget->getPowerType() == POWER_MANA) + if (pTarget && pTarget->GetPowerType() == POWER_MANA) i=5; } */ @@ -299,7 +299,7 @@ struct boss_marliAI : public ScriptedAI if (m_uiCorrosivePoison_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CORROSIVE_POISON); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CORROSIVE_POISON); m_uiCorrosivePoison_Timer = urand(25000, 35000); } else @@ -349,7 +349,7 @@ struct boss_marliAI : public ScriptedAI if (m_uiTrash_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH); m_uiTrash_Timer = urand(10000, 20000); } else @@ -378,13 +378,13 @@ struct mob_spawn_of_marliAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiLevelUp_Timer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_LEVELUP); - m_creature->SetLevel(m_creature->getLevel() + 1); + m_creature->SetLevel(m_creature->GetLevel() + 1); m_uiLevelUp_Timer = 3000; } else diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp index 89fb81526..3fb16692c 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_renataki.cpp @@ -78,7 +78,7 @@ struct boss_renatakiAI : public ScriptedAI m_creature->CastSpell(m_creature, SPELL_RED_LIGHTNING, true); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->GetHealthPercent() < 30) @@ -124,8 +124,8 @@ struct boss_renatakiAI : public ScriptedAI Unit* target = nullptr; target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1); - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -50); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -50); if (target) AttackStart(target); @@ -136,12 +136,12 @@ struct boss_renatakiAI : public ScriptedAI if (ThousandBlades_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_THOUSANDBLADES); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THOUSANDBLADES); ThousandBlades_Timer = urand(7000, 12000); } else ThousandBlades_Timer -= diff; - if (m_creature->isAttackReady() && !urand(0, 2)) + if (m_creature->IsAttackReady() && !urand(0, 2)) m_creature->CastSpell(m_creature, SPELL_TRASH, true); DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp index ae9f65b3c..8422d1dc3 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_thekal.cpp @@ -156,7 +156,7 @@ struct zg_rez_add : public ScriptedAI { if (Unit* pRezzeur = m_pInstance->instance->GetUnit(m_uiRezzeurGUID)) { - if (pRezzeur->isAlive()) + if (pRezzeur->IsAlive()) { pRezzeur->InterruptNonMeleeSpells(true); pRezzeur->CastSpell(m_creature, SPELL_RESURRECT, false); @@ -169,7 +169,7 @@ struct zg_rez_add : public ScriptedAI { if (Unit* pRezzeur = m_pInstance->instance->GetUnit(m_uiRezzeurGUID)) { - if (!pRezzeur->isAlive()) + if (!pRezzeur->IsAlive()) { m_uiRessurectTimer = 8000; m_uiRezzeurGUID = 0; @@ -179,7 +179,7 @@ struct zg_rez_add : public ScriptedAI } if (Unit* pFriend = m_pInstance->Thekal_GetUnitThatCanRez()) - DoRessurectUnit(m_creature, pFriend->getVictim()); + DoRessurectUnit(m_creature, pFriend->GetVictim()); else { // Apres les 10 sec sans rez : @@ -403,7 +403,7 @@ struct boss_thekalAI : public zg_rez_add void CheckTiger(uint64& guid) { Creature* pTiger = m_creature->GetMap()->GetCreature(guid); - if (!pTiger || !pTiger->isAlive()) + if (!pTiger || !pTiger->IsAlive()) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { @@ -415,10 +415,10 @@ struct boss_thekalAI : public zg_rez_add void UpdateAI(const uint32 diff) override { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return; zg_rez_add::UpdateAI(diff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (PhaseTwo) { @@ -434,7 +434,7 @@ struct boss_thekalAI : public zg_rez_add float nearestDist = 200.0f; Player* target = nullptr; for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (m_creature->canAttack(itr->getSource())) + if (m_creature->CanAttack(itr->getSource())) if (itr->getSource()->GetDistance(m_creature) < nearestDist) { nearestDist = itr->getSource()->GetDistance(m_creature); @@ -452,7 +452,7 @@ struct boss_thekalAI : public zg_rez_add { if (MortalCleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALCLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALCLEAVE); MortalCleave_Timer = urand(15000, 20000); } else @@ -477,7 +477,7 @@ struct boss_thekalAI : public zg_rez_add if (Unit* target = selector->GetUnit()) { DoResetThreat(); - m_creature->getThreatManager().modifyThreatPercent(target, 100); + m_creature->GetThreatManager().modifyThreatPercent(target, 100); DoCastSpellIfCan(target, SPELL_CHARGE); Charge_Timer = urand(15000, 22000); } @@ -498,7 +498,7 @@ struct boss_thekalAI : public zg_rez_add if (ForcePunch_Timer < diff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_FORCEPUNCH, true); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_FORCEPUNCH, true); ForcePunch_Timer = urand(16000, 21000); } else @@ -571,7 +571,7 @@ struct mob_zealot_lorkhanAI : public zg_rez_add void UpdateAI(const uint32 diff) override { zg_rez_add::UpdateAI(diff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Shield_Timer @@ -611,7 +611,7 @@ struct mob_zealot_lorkhanAI : public zg_rez_add //Disarm_Timer if (Disarm_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISARM); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISARM); Disarm_Timer = urand(15000, 25000); } else Disarm_Timer -= diff; @@ -669,13 +669,13 @@ struct mob_zealot_zathAI : public zg_rez_add void UpdateAI(const uint32 diff) override { zg_rez_add::UpdateAI(diff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //SweepingStrikes_Timer if (SweepingStrikes_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SWEEPINGSTRIKES); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SWEEPINGSTRIKES); SweepingStrikes_Timer = urand(22000, 26000); } else SweepingStrikes_Timer -= diff; @@ -683,7 +683,7 @@ struct mob_zealot_zathAI : public zg_rez_add //SinisterStrike_Timer if (SinisterStrike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SINISTERSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SINISTERSTRIKE); SinisterStrike_Timer = urand(8000, 16000); } else SinisterStrike_Timer -= diff; @@ -691,10 +691,10 @@ struct mob_zealot_zathAI : public zg_rez_add //Gouge_Timer if (Gouge_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_GOUGE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_GOUGE); - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); Gouge_Timer = urand(17000, 27000); } @@ -703,9 +703,9 @@ struct mob_zealot_zathAI : public zg_rez_add //Kick_Timer if (Kick_Timer < diff) { - if(m_creature->getVictim()->IsNonMeleeSpellCasted(false)) + if(m_creature->GetVictim()->IsNonMeleeSpellCasted(false)) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_KICK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KICK); Kick_Timer = urand(15000, 25000); } } @@ -714,7 +714,7 @@ struct mob_zealot_zathAI : public zg_rez_add //Blind_Timer if (Blind_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLIND); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BLIND); Blind_Timer = urand(10000, 20000); } else Blind_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_venoxis.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_venoxis.cpp index a98bc6160..4fa9290d4 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_venoxis.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_venoxis.cpp @@ -145,7 +145,7 @@ struct boss_venoxisAI : public ScriptedAI for (auto iter = cobras.cbegin(); iter != cobras.cend(); ++iter) { auto cobra = *iter; - if (cobra && !cobra->isAlive()) + if (cobra && !cobra->IsAlive()) cobra->Respawn(); } } @@ -167,7 +167,7 @@ struct boss_venoxisAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) return; @@ -213,7 +213,7 @@ struct boss_venoxisAI : public ScriptedAI if (m_uiHolyFire_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_HOLY_FIRE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HOLY_FIRE); m_uiHolyFire_Timer = urand(8000, 12000); } else @@ -229,7 +229,7 @@ struct boss_venoxisAI : public ScriptedAI if (m_uiHolyWrath_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_HOLY_WRATH); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HOLY_WRATH); m_uiHolyWrath_Timer = urand(15000, 25000); } else @@ -241,7 +241,7 @@ struct boss_venoxisAI : public ScriptedAI if (m_uiPoisonCloud_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_POISON_CLOUD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POISON_CLOUD) == CAST_OK) m_uiPoisonCloud_Timer = urand(7000, 10000); } else @@ -249,7 +249,7 @@ struct boss_venoxisAI : public ScriptedAI if (m_uiTrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) m_uiTrash_Timer = urand(10000, 20000); } else diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp index dd9694e5e..b776593b3 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/boss_wushoolay.cpp @@ -45,13 +45,13 @@ struct boss_wushoolayAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //LightningCloud_Timer if (LightningCloud_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_LIGHTNINGCLOUD); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_LIGHTNINGCLOUD); LightningCloud_Timer = urand(15000, 20000); } else LightningCloud_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp index 7742486a0..1e87bf9ee 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/instance_zulgurub.cpp @@ -51,7 +51,7 @@ void instance_zulgurub::LowerHakkarHitPoints() { if (Creature* pHakkar = instance->GetCreature(m_uiHakkarGUID)) { - if (pHakkar->isAlive()) + if (pHakkar->IsAlive()) { pHakkar->SetMaxHealth(pHakkar->GetMaxHealth() - 50000); pHakkar->SetHealth(pHakkar->GetHealth() - 50000); @@ -151,11 +151,11 @@ void instance_zulgurub::SetData(uint32 uiType, uint32 uiData) if (uiData == IN_PROGRESS) { Creature *Marli = instance->GetCreature(m_uiMarliGUID); - Unit* pVictim = Marli->getVictim(); + Unit* pVictim = Marli->GetVictim(); for (std::list::const_iterator itr = m_lMarliTrashGUIDList.begin(); itr != m_lMarliTrashGUIDList.end(); itr++) { if (Creature* MarliTrash = instance->GetCreature(*itr)) - if (MarliTrash->isAlive() && !MarliTrash->isInCombat()) + if (MarliTrash->IsAlive() && !MarliTrash->IsInCombat()) if (MarliTrash->GetMapId() == 309 && MarliTrash->GetZoneId() == 1977 && MarliTrash->GetAreaId() == 3379) MarliTrash->AI()->AttackStart(pVictim); } @@ -344,13 +344,13 @@ void instance_zulgurub::SpawnRandomBoss() Unit* instance_zulgurub::Thekal_GetUnitThatCanRez() { if (Unit *pLorKhan = instance->GetUnit(GetData64(DATA_LORKHAN))) - if (pLorKhan->isAlive()) + if (pLorKhan->IsAlive()) return pLorKhan; if (Unit *pZath = instance->GetUnit(GetData64(DATA_ZATH))) - if (pZath->isAlive()) + if (pZath->IsAlive()) return pZath; if (Unit *pThekal = instance->GetUnit(GetData64(DATA_THEKAL))) - if (pThekal->isAlive()) + if (pThekal->IsAlive()) return pThekal; return nullptr; } 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 e36924de2..1e2ded820 100644 --- a/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp +++ b/src/scripts/eastern_kingdoms/stranglethorn_vale/zulgurub/zulgurub_trash.cpp @@ -37,14 +37,14 @@ struct GurubashiAxeThrowerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiAxeFlurry_Timer < uiDiff) { if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AXE_FLURRY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AXE_FLURRY) == CAST_OK) m_uiAxeFlurry_Timer = urand(14000, 19000); } } @@ -53,7 +53,7 @@ struct GurubashiAxeThrowerAI : public ScriptedAI if (m_uiThrow_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THROW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THROW) == CAST_OK) m_uiThrow_Timer = urand(4000, 7000); } else @@ -112,12 +112,12 @@ struct GurubashiBerserkerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiKnockBack_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKBACK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKBACK) == CAST_OK) { DoResetThreat(); m_uiKnockBack_Timer = 10000; @@ -128,7 +128,7 @@ struct GurubashiBerserkerAI : public ScriptedAI if (m_uiThunderClap_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCLAP) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCLAP) == CAST_OK) m_uiThunderClap_Timer = urand(14000, 16000); } else @@ -136,7 +136,7 @@ struct GurubashiBerserkerAI : public ScriptedAI if (m_uiFear_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FEAR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FEAR) == CAST_OK) { m_uiFear_Timer = urand(25000, 30000); DoResetThreat(); @@ -199,7 +199,7 @@ struct npc_hakkari_doctor : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiMaleficeTimer < uiDiff) @@ -278,7 +278,7 @@ struct npc_esprit_vaudou : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) { if (pVictim->GetDistance(m_creature) < 5.0f) { @@ -314,7 +314,7 @@ struct npc_fils_hakkar : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiTrashTimer < uiDiff) @@ -327,7 +327,7 @@ struct npc_fils_hakkar : public ScriptedAI if (m_uiKnockDownTimer < uiDiff) { - m_creature->CastSpell(m_creature->getVictim(), 16790, true); + m_creature->CastSpell(m_creature->GetVictim(), 16790, true); m_uiKnockDownTimer = urand(5000, 10000); } else @@ -360,14 +360,14 @@ 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_STAT_ROOT); Map::PlayerList const& players = Guru->GetMap()->GetPlayers(); bool OtherPlayerFound = false; for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive() && pUser->IsWithinDistInMap(pPlayer, 60.0f) && pUser->IsWithinLOSInMap(pPlayer) && + if (pPlayer && pPlayer->IsAlive() && pUser->IsWithinDistInMap(pPlayer, 60.0f) && pUser->IsWithinLOSInMap(pPlayer) && pPlayer != pUser->ToPlayer() && !pPlayer->IsGameMaster()) { Guru->AddThreat(pPlayer); @@ -412,22 +412,22 @@ struct go_pile_dechetsAI: public GameObjectAI for (std::list::iterator itr = MobList.begin(); itr != MobList.end(); ++itr) { - if (pUser->IsWithinLOSInMap(*itr) && pUser->IsWithinDistInMap((*itr), 45.0f) && (*itr)->isAlive()) + if (pUser->IsWithinLOSInMap(*itr) && pUser->IsWithinDistInMap((*itr), 45.0f) && (*itr)->IsAlive()) { if (Player* pPlay = pUser->ToPlayer()) { if (pPlay->GetTeam() == HORDE) - Guru->setFaction(1); // Human + Guru->SetFactionTemplateId(1); // Human else if (pPlay->GetTeam() == ALLIANCE) - Guru->setFaction(2); // Orc + Guru->SetFactionTemplateId(2); // Orc Guru->AddThreat(*itr); Guru->SetInCombatWith(*itr); Guru->CastSpell(pUser, 24178, true); - Guru->addUnitState(UNIT_STAT_ROOT); + Guru->AddUnitState(UNIT_STAT_ROOT); Guru->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Guru->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Guru->setFaction(14); // Troll Bloodscalp + Guru->SetFactionTemplateId(14); // Troll Bloodscalp break; } } diff --git a/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/instance_sunken_temple.cpp b/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/instance_sunken_temple.cpp index 2a16352f9..35d5e98d2 100644 --- a/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/instance_sunken_temple.cpp +++ b/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/instance_sunken_temple.cpp @@ -360,7 +360,7 @@ struct instance_sunken_temple : public ScriptedInstance { if (Creature *shade = GetMap()->GetCreature(m_uiShadeHakkarGUID)) { - if (!shade->isAlive() || !shade->AI()) + if (!shade->IsAlive() || !shade->AI()) return; if (npc_shade_hakkarAI *ai = dynamic_cast(shade->AI())) @@ -436,7 +436,7 @@ struct instance_sunken_temple : public ScriptedInstance { if (Creature* pProt = instance->GetCreature(m_luiProtectorGUIDs[i])) { - if (pProt->isAlive()) + if (pProt->IsAlive()) { bAllDead = false; break; @@ -508,7 +508,7 @@ struct instance_sunken_temple : public ScriptedInstance if (!curr->GetDBTableGUIDLow()) continue; - if (curr->isAlive()) + if (curr->IsAlive()) curr->SetInCombatWithZone(); } } @@ -604,7 +604,7 @@ struct instance_sunken_temple : public ScriptedInstance if (!curr->GetDBTableGUIDLow()) continue; - if (curr->isAlive()) + if (curr->IsAlive()) curr->SetInCombatWithZone(); } } diff --git a/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/sunken_temple.cpp b/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/sunken_temple.cpp index 09898f893..ecf40608c 100644 --- a/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/sunken_temple.cpp +++ b/src/scripts/eastern_kingdoms/swamp_of_sorrows/sunken_temple/sunken_temple.cpp @@ -148,7 +148,7 @@ CreatureAI* GetAI_npc_malfurion(Creature* pCreature) // Summon Malfurion trigger (AQ scepter quest) bool AreaTrigger_at_shade_of_eranikus(Player* pPlayer, AreaTriggerEntry const* pAt) { - if (!pPlayer || !pPlayer->isAlive() || !pAt) + if (!pPlayer || !pPlayer->IsAlive() || !pAt) return false; if (pAt->id != AREATRIGGER_MALFURION) @@ -397,7 +397,7 @@ void npc_shade_hakkarAI::JustSummoned(Creature* summoned) void npc_shade_hakkarAI::SummonedMovementInform(Creature* pSummoned, uint32 uiMotionType, uint32 uiPointId) { - if (uiMotionType != POINT_MOTION_TYPE || !pSummoned->isAlive()) + if (uiMotionType != POINT_MOTION_TYPE || !pSummoned->IsAlive()) return; if (pSummoned->GetEntry() == NPC_HAKKARI_MINION) @@ -460,7 +460,7 @@ void npc_shade_hakkarAI::SummonedMovementInform(Creature* pSummoned, uint32 uiMo { case 0: pSummoned->GetMotionMaster()->MoveIdle(); - if (pSummoned->isAlive()) + if (pSummoned->IsAlive()) if (Creature* Shade = pSummoned->FindNearestCreature(8440, 150.0f)) // NPC_SHADE_OF_HAKKAR pSummoned->CastSpell(Shade, SPELL_SUPPRESSION, false); break; @@ -484,7 +484,7 @@ void npc_shade_hakkarAI::UpdateAI(const uint32 uiDiff) else CheckTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || !m_pInstance) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || !m_pInstance) return; if (m_creature->HasAura(SPELL_SUPPRESSION)) diff --git a/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp b/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp index 1d38d1bfd..a3468f38c 100644 --- a/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp +++ b/src/scripts/eastern_kingdoms/swamp_of_sorrows/swamp_of_sorrows.cpp @@ -125,7 +125,7 @@ struct npc_galen_goodwardAI : public npc_escortAI else m_uiPeriodicSay -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -140,7 +140,7 @@ bool QuestAccept_npc_galen_goodward(Player* pPlayer, Creature* pCreature, const if (npc_galen_goodwardAI* pEscortAI = dynamic_cast(pCreature->AI())) { pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); - //pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); + //pCreature->SetFactionTemplateId(FACTION_ESCORT_N_NEUTRAL_ACTIVE); pCreature->SetFactionTemporary(495, TEMPFACTION_RESTORE_RESPAWN);//231 //250 DoScriptText(SAY_QUEST_ACCEPTED, pCreature); } diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_arcanist_doan.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_arcanist_doan.cpp index 0fa224415..bd4c9de27 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_arcanist_doan.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_arcanist_doan.cpp @@ -64,7 +64,7 @@ struct boss_arcanist_doanAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (bShielded && bCanDetonate) @@ -102,7 +102,7 @@ struct boss_arcanist_doanAI : public ScriptedAI //AoESilence_Timer if (AoESilence_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_AOESILENCE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AOESILENCE); AoESilence_Timer = urand(15000, 20000); } else AoESilence_Timer -= diff; @@ -110,7 +110,7 @@ struct boss_arcanist_doanAI : public ScriptedAI //ArcaneExplosion_Timer if (ArcaneExplosion_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEEXPLOSION); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEEXPLOSION); ArcaneExplosion_Timer = 8000; } else ArcaneExplosion_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_azshir_the_sleepless.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_azshir_the_sleepless.cpp index d5bca339b..6c4cb0b3c 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_azshir_the_sleepless.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_azshir_the_sleepless.cpp @@ -47,7 +47,7 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //If we are <50% hp cast Soul Siphon rank 1 @@ -56,7 +56,7 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI //SoulSiphon_Timer if (SoulSiphon_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SOULSIPHON); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SOULSIPHON); return; SoulSiphon_Timer = 20000; @@ -67,7 +67,7 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI //CallOfTheGrave_Timer if (CallOftheGrave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CALLOFTHEGRAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CALLOFTHEGRAVE); CallOftheGrave_Timer = 30000; } else CallOftheGrave_Timer -= diff; @@ -75,7 +75,7 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI //Terrify_Timer if (Terrify_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_TERRIFY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TERRIFY); Terrify_Timer = 20000; } else Terrify_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_bloodmage_thalnos.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_bloodmage_thalnos.cpp index 1ed488139..8b0a07b35 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_bloodmage_thalnos.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_bloodmage_thalnos.cpp @@ -69,7 +69,7 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //If we are <35% hp @@ -82,7 +82,7 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI //FlameShock_Timer if (FlameShock_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAMESHOCK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAMESHOCK); FlameShock_Timer = urand(10000, 15000); } else FlameShock_Timer -= diff; @@ -90,7 +90,7 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI //FlameSpike_Timer if (FlameSpike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAMESPIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAMESPIKE); FlameSpike_Timer = 30000; } else FlameSpike_Timer -= diff; @@ -98,7 +98,7 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI //FireNova_Timer if (FireNova_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIRENOVA); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIRENOVA); FireNova_Timer = 40000; } else FireNova_Timer -= diff; @@ -106,7 +106,7 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI //ShadowBolt_Timer if (ShadowBolt_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLT); ShadowBolt_Timer = 2000; } else ShadowBolt_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_headless_horseman.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_headless_horseman.cpp index 6448407ad..de6783d4a 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_headless_horseman.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_headless_horseman.cpp @@ -70,7 +70,7 @@ struct boss_headless_horsemanAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); 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 321a6a359..be0e5c9f3 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 @@ -110,9 +110,9 @@ struct boss_herodAI : ScriptedAI { if (auto pMyrmidon = m_creature->GetMap()->GetCreature(*itr)) { - if (!pMyrmidon->isAlive() || pMyrmidon->getVictim()) + if (!pMyrmidon->IsAlive() || pMyrmidon->GetVictim()) continue; - if (victim->isAlive()) + if (victim->IsAlive()) pMyrmidon->SetInCombatWith(victim); } } @@ -137,7 +137,7 @@ struct boss_herodAI : ScriptedAI { if (auto pMyrmidon = m_creature->GetMap()->GetCreature(*itr)) { - if (pMyrmidon->isAlive() && !pMyrmidon->getVictim()) + if (pMyrmidon->IsAlive() && !pMyrmidon->GetVictim()) pMyrmidon->ForcedDespawn(); } } @@ -148,7 +148,7 @@ struct boss_herodAI : ScriptedAI void EnterEvadeMode() override { - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); DespawnMyrmidons(); ScriptedAI::EnterEvadeMode(); } @@ -170,7 +170,7 @@ struct boss_herodAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // check if the target is still inside the room @@ -178,7 +178,7 @@ struct boss_herodAI : ScriptedAI { if (!m_creature->IsWithinDist2d(RoomCenter.x, RoomCenter.y, 32.0f)) { - EngageMyrmidons(me->getVictim()); + EngageMyrmidons(me->GetVictim()); } uiRoomCheck = 500; } @@ -188,7 +188,7 @@ struct boss_herodAI : ScriptedAI { if (m_uiRootTimer < diff) { - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); m_bWhirlwind = false; } else @@ -212,7 +212,7 @@ struct boss_herodAI : ScriptedAI // Rushing Charge if (RushingCharge_Timer < diff) { - auto pVictim = m_creature->getVictim(); + auto pVictim = m_creature->GetVictim(); if (pVictim && !pVictim->IsInRange(m_creature, 0.0f, MELEE_RANGE + 10.0f)) { @@ -226,7 +226,7 @@ struct boss_herodAI : ScriptedAI // Cleave if (Cleave_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) Cleave_Timer = 12000; } else @@ -235,9 +235,9 @@ struct boss_herodAI : ScriptedAI // Whirlwind if (Whirlwind_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WHIRLWIND) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WHIRLWIND) == CAST_OK) { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_bWhirlwind = true; m_uiRootTimer = 11000; DoScriptText(SAY_WHIRLWIND, m_creature); @@ -291,7 +291,7 @@ struct mob_scarlet_traineeAI : ScriptedAI Start_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp index b2d656e08..8c179e5cc 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp @@ -75,7 +75,7 @@ struct boss_high_inquisitor_fairbanksAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //If we are <25% hp cast Heal @@ -126,7 +126,7 @@ struct boss_high_inquisitor_fairbanksAI : public ScriptedAI //CurseOfBlood_Timer if (CurseOfBlood_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFBLOOD); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFBLOOD); CurseOfBlood_Timer = 25000; } else CurseOfBlood_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_houndmaster_loksey.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_houndmaster_loksey.cpp index 9cf382f4e..cda999915 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_houndmaster_loksey.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_houndmaster_loksey.cpp @@ -52,7 +52,7 @@ struct boss_houndmaster_lokseyAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (BloodLust_Timer < diff) diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_interrogator_vishas.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_interrogator_vishas.cpp index 64afb9899..cd0fd44b6 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_interrogator_vishas.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_interrogator_vishas.cpp @@ -78,7 +78,7 @@ struct boss_interrogator_vishasAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //If we are low on hp Do sayings @@ -97,7 +97,7 @@ struct boss_interrogator_vishasAI : public ScriptedAI //ShadowWordPain_Timer if (ShadowWordPain_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWWORDPAIN); ShadowWordPain_Timer = urand(5000, 15000); } else ShadowWordPain_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp index 3807451d7..699b86196 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_mograine_and_whitemane.cpp @@ -100,7 +100,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI // { // if (Creature* pWhitemane = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_WHITEMANE))) // { -// if (m_creature->isAlive() && !pWhitemane->isAlive()) +// if (m_creature->IsAlive() && !pWhitemane->IsAlive()) // pWhitemane->Respawn(); // } // } @@ -123,7 +123,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI { for (std::list::iterator itr = mograinesAssist.begin(); itr != mograinesAssist.end(); ++itr) { - if ((*itr)->isAlive() && (*itr)->AI()) + if ((*itr)->IsAlive() && (*itr)->AI()) (*itr)->AI()->AttackStart(pWho); } } @@ -172,7 +172,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI { if (Creature* pWhitemane = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_WHITEMANE))) { - if (pWhitemane->isAlive()) + if (pWhitemane->IsAlive()) FakeDeath(); } @@ -185,7 +185,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI //On first death, fake death and open door, as well as initiate whitemane if exist if (Creature* pWhitemane = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_WHITEMANE))) { - if (pWhitemane->isAlive()) + if (pWhitemane->IsAlive()) { m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); @@ -217,7 +217,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) @@ -230,8 +230,8 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI m_uiCrusaderStrike_Timer = 10000; m_uiHammerOfJustice_Timer = 15000; - if (m_creature->getVictim()) - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + if (m_creature->GetVictim()) + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); m_bHeal = true; } @@ -244,7 +244,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI //m_uiCrusaderStrike_Timer if (m_uiCrusaderStrike_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CRUSADERSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CRUSADERSTRIKE); m_uiCrusaderStrike_Timer = 10000; } else @@ -253,7 +253,7 @@ struct boss_scarlet_commander_mograineAI : public ScriptedAI //m_uiHammerOfJustice_Timer if (m_uiHammerOfJustice_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_HAMMEROFJUSTICE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HAMMEROFJUSTICE); m_uiHammerOfJustice_Timer = 45000; } else @@ -306,7 +306,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI if (Creature* pMograine = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_MOGRAINE))) { - if (m_creature->isAlive() && !pMograine->isAlive()) + if (m_creature->IsAlive() && !pMograine->IsAlive()) pMograine->Respawn(); } } @@ -375,7 +375,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if ((!m_creature->SelectHostileTarget() || !m_creature->getVictim()) && !m_bStopAttack) + if ((!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) && !m_bStopAttack) return; if (m_bCanResurrect) @@ -400,7 +400,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI if (m_creature->IsNonMeleeSpellCasted(false)) m_creature->InterruptNonMeleeSpells(false); - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DEEPSLEEP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DEEPSLEEP); m_bCanResurrectCheck = true; m_bCanResurrect = true; m_bStopAttack = true; @@ -442,7 +442,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI { if (Creature* pMograine = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_MOGRAINE))) { - if (pMograine->isAlive() && pMograine->GetHealthPercent() <= 75.0f) + if (pMograine->IsAlive() && pMograine->GetHealthPercent() <= 75.0f) pTarget = pMograine; } } @@ -467,7 +467,7 @@ struct boss_high_inquisitor_whitemaneAI : public ScriptedAI //m_uiHolySmite_Timer if (m_uiHolySmite_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_HOLYSMITE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_HOLYSMITE); m_uiHolySmite_Timer = 6000; } else diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_scorn.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_scorn.cpp index 3f75fb968..9bd7ba9e3 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_scorn.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/boss_scorn.cpp @@ -71,7 +71,7 @@ struct boss_scornAI : public ScriptedAI } void MovementInform(uint32 uiType, uint32 uiPointId) override { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { m_creature->SetWalk(true); if (uiPointId < 9) @@ -84,13 +84,13 @@ struct boss_scornAI : public ScriptedAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //LichSlap_Timer if (LichSlap_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_LICHSLAP); + DoCast(m_creature->GetVictim(), SPELL_LICHSLAP); LichSlap_Timer = 45000; } else LichSlap_Timer -= diff; @@ -98,7 +98,7 @@ struct boss_scornAI : public ScriptedAI //FrostboltVolley_Timer if (FrostboltVolley_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_FROSTBOLTVOLLEY); + DoCast(m_creature->GetVictim(), SPELL_FROSTBOLTVOLLEY); FrostboltVolley_Timer = 20000; } else FrostboltVolley_Timer -= diff; @@ -106,7 +106,7 @@ struct boss_scornAI : public ScriptedAI //MindFlay_Timer if (MindFlay_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_MINDFLAY); + DoCast(m_creature->GetVictim(), SPELL_MINDFLAY); MindFlay_Timer = 20000; } else MindFlay_Timer -= diff; @@ -114,7 +114,7 @@ struct boss_scornAI : public ScriptedAI //FrostNova_Timer if (FrostNova_Timer < diff) { - DoCast(m_creature->getVictim(), SPELL_FROSTNOVA); + DoCast(m_creature->GetVictim(), SPELL_FROSTNOVA); FrostNova_Timer = 15000; } else FrostNova_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp index 8f7872e72..c9c7815a3 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp @@ -195,7 +195,7 @@ struct instance_scarlet_monastery : ScriptedInstance return; if (!pCaster->IsPlayer() || spell->Id != 28441) // AB Effect 000 return; - if (receiver->isDead()) + if (receiver->IsDead()) return; switch (receiver->GetEntry()) @@ -218,7 +218,7 @@ struct instance_scarlet_monastery : ScriptedInstance receiver->StopMoving(true); receiver->SetFacingToObject(pCaster); receiver->SetStandState(UNIT_STAND_STATE_KNEEL); - receiver->addUnitState(UNIT_STAT_ROOT); + receiver->AddUnitState(UNIT_STAT_ROOT); if (!m_ashbringerSayTimer && urand(0,1)) { m_ashbringerSayTimer = 2000; @@ -376,7 +376,7 @@ struct instance_scarlet_monastery : ScriptedInstance for (Creature* pCreature : ScarletList) { - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); if (pCreature->GetEntry() == NPC_COMMANDER_MOGRAINE) pCreature->SetCharmerGuid(pPlayer->GetObjectGuid()); } diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/tirisfal_glades.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/tirisfal_glades.cpp index 88beefcb2..da3cf2649 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/tirisfal_glades.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/tirisfal_glades.cpp @@ -52,7 +52,7 @@ bool GOHello_go_mausoleum_door(Player* pPlayer, GameObject* pGo) pTrigger->SetGoState(GO_STATE_READY); Creature* ulag = pPlayer->FindNearestCreature(NPC_ULAG, 100.0f); - if (!ulag || ulag->isDead()) + if (!ulag || ulag->IsDead()) pPlayer->SummonCreature(NPC_ULAG, 2390.26f, 336.47f, 40.01f, 2.26f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); return false; } diff --git a/src/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp b/src/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp index aa6049452..78efa8d1d 100644 --- a/src/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp +++ b/src/scripts/eastern_kingdoms/uldaman/boss_archaedas.cpp @@ -158,7 +158,7 @@ struct boss_archaedasAI : public ScriptedAI // check if the target is still inside the room if (uiRoomCheck <= uiDiff) { - if (UnitIsOutside(me) || UnitIsOutside(me->getVictim())) + if (UnitIsOutside(me) || UnitIsOutside(me->GetVictim())) { EnterEvadeMode(); return; @@ -194,13 +194,13 @@ struct boss_archaedasAI : public ScriptedAI // fix factions now or they'll look green for a brief moment if (Creature* target = instance->GetMap()->GetCreature(instance->GetData64(1))) { - target->setFaction(FACTION_AWAKE); + target->SetFactionTemplateId(FACTION_AWAKE); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); target->CastSpell(target, SPELL_STONE_DWARF_AWAKEN, false); } if (Creature* target = instance->GetMap()->GetCreature(instance->GetData64(2))) { - target->setFaction(FACTION_AWAKE); + target->SetFactionTemplateId(FACTION_AWAKE); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); target->CastSpell(target, SPELL_STONE_DWARF_AWAKEN, false); } @@ -212,7 +212,7 @@ struct boss_archaedasAI : public ScriptedAI if (uiTremorTimer <= uiDiff) { //Cast - DoCast(me->getVictim(), SPELL_GROUND_TREMOR); + DoCast(me->GetVictim(), SPELL_GROUND_TREMOR); //45 seconds until we should cast this agian uiTremorTimer = 45000; } @@ -294,7 +294,7 @@ struct mob_archaedas_minionsAI : public ScriptedAI { if (Unit* archaedas = Unit::GetUnit(*me, instance->GetData64(11))) { - target = archaedas->getVictim(); + target = archaedas->GetVictim(); } } if (target) @@ -393,7 +393,7 @@ struct mob_archaedas_minionsAI : public ScriptedAI if (m_creature->GetEntry() == NPC_VAULT_WARDER && uiTrample_Timer <= uiDiff) { - DoCast(me->getVictim(), SPELL_TRAMPLE); + DoCast(me->GetVictim(), SPELL_TRAMPLE); uiTrample_Timer = 10000; } else uiTrample_Timer -= uiDiff; diff --git a/src/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp b/src/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp index d4b147245..347b63d42 100644 --- a/src/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp +++ b/src/scripts/eastern_kingdoms/uldaman/boss_ironaya.cpp @@ -59,7 +59,7 @@ struct boss_ironayaAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (m_creature->getFaction() == FACTION_AWAKE && !hasMoved) + if (m_creature->GetFactionTemplateId() == FACTION_AWAKE && !hasMoved) { if (Unit* target = Unit::GetUnit(*me, instance->GetData64(0))) { @@ -69,7 +69,7 @@ struct boss_ironayaAI : public ScriptedAI } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } @@ -77,12 +77,12 @@ struct boss_ironayaAI : public ScriptedAI //If we are <50% hp do knockaway ONCE if (!hasCastedKnockaway && m_creature->GetHealthPercent() < 50.0f) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_KNOCKAWAY, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_KNOCKAWAY, false); // current aggro target is knocked away pick new target Unit* Target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); - if (!Target || Target == m_creature->getVictim()) + if (!Target || Target == m_creature->GetVictim()) { Target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 1); } diff --git a/src/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp b/src/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp index efcf5d30f..d9a3d565f 100644 --- a/src/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp +++ b/src/scripts/eastern_kingdoms/uldaman/instance_uldaman.cpp @@ -180,7 +180,7 @@ struct instance_uldaman : public ScriptedInstance void SetFrozenState(Creature* creature) { - creature->setFaction(FACTION_STONED); + creature->SetFactionTemplateId(FACTION_STONED); creature->RemoveAllAuras(); creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (!creature->HasAura(SPELL_STONED)) @@ -191,13 +191,13 @@ struct instance_uldaman : public ScriptedInstance void SetUnFrozenState(Creature* creature) { - creature->setFaction(FACTION_AWAKE); + creature->SetFactionTemplateId(FACTION_AWAKE); if (creature->HasAura(SPELL_STONED)) { creature->RemoveAurasDueToSpell(SPELL_STONED); } creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //creature->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT); + //creature->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_PENDING_ROOT); //creature->RemoveFlag(UNIT_FIELD_FLAGS, // UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); } @@ -205,21 +205,21 @@ struct instance_uldaman : public ScriptedInstance void RespawnMinion(uint64 guid) { Creature* target = instance->GetCreature(guid); - if (!target || (target->isAlive() && target->getFaction() == FACTION_STONED)) + if (!target || (target->IsAlive() && target->GetFactionTemplateId() == FACTION_STONED)) return; - if (target->isAlive()) + if (target->IsAlive()) { target->SetDeathState(JUST_DIED); target->RemoveCorpse(); } target->Respawn(); - target->setFaction(FACTION_STONED); + target->SetFactionTemplateId(FACTION_STONED); } void DespawnMinion(uint64 guid) { Creature* target = instance->GetCreature(guid); - if (!target || target->isDead()) + if (!target || target->IsDead()) return; target->SetDeathState(JUST_DIED); target->RemoveCorpse(); @@ -309,14 +309,14 @@ struct instance_uldaman : public ScriptedInstance Creature* current = instance->GetCreature(it); /* Do nothing if one is already alive and awaken */ - if (current && current->isAlive() && current->getFaction() == FACTION_AWAKE) + if (current && current->IsAlive() && current->GetFactionTemplateId() == FACTION_AWAKE) { target = nullptr; encounterDone = false; break; } /* Save a creature that can be awaken for later */ - if (!target && current && current->isAlive() && current->getFaction() != FACTION_AWAKE) + if (!target && current && current->IsAlive() && current->GetFactionTemplateId() != FACTION_AWAKE) { target = current; } @@ -348,12 +348,12 @@ struct instance_uldaman : public ScriptedInstance { continue; } - if (target->isDead()) + if (target->IsDead()) { target->Respawn(); SetFrozenState(target); } - else if (target->getFaction() == FACTION_AWAKE) + else if (target->GetFactionTemplateId() == FACTION_AWAKE) { target->SetDeathState(JUST_DIED); target->RemoveCorpse(); @@ -415,7 +415,7 @@ struct instance_uldaman : public ScriptedInstance SetData(DATA_ANCIENT_DOOR, IN_PROGRESS); if (archaedas) { - if (archaedas->isAlive() && archaedas->getFaction() != FACTION_AWAKE) + if (archaedas->IsAlive() && archaedas->GetFactionTemplateId() != FACTION_AWAKE) { archaedas->CastSpell(archaedas, SPELL_ARCHAEDAS_AWAKEN, false); SetUnFrozenState(archaedas); @@ -427,12 +427,12 @@ struct instance_uldaman : public ScriptedInstance for (const auto& i : vArchaedasWallMinions) { Creature* target = instance->GetCreature(i); - if (!target || !target->isAlive() || target->getFaction() == FACTION_AWAKE) + if (!target || !target->IsAlive() || target->GetFactionTemplateId() == FACTION_AWAKE) { continue; } archaedas->CastSpell(target, SPELL_AWAKEN_EARTHEN_DWARF, false); - target->setFaction(FACTION_AWAKE); + target->SetFactionTemplateId(FACTION_AWAKE); break; // only want the first one we find } } diff --git a/src/scripts/eastern_kingdoms/uldaman/uldaman.cpp b/src/scripts/eastern_kingdoms/uldaman/uldaman.cpp index 1f1b3eda1..d7d7fd378 100644 --- a/src/scripts/eastern_kingdoms/uldaman/uldaman.cpp +++ b/src/scripts/eastern_kingdoms/uldaman/uldaman.cpp @@ -104,13 +104,13 @@ struct mob_stone_keeperAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } if (m_uiTrample_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRAMPLE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRAMPLE) == CAST_OK) { m_uiTrample_Timer = urand(4000, 10000); } @@ -148,7 +148,7 @@ struct mob_jadespine_basiliskAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } @@ -157,15 +157,15 @@ struct mob_jadespine_basiliskAI : public ScriptedAI if (Cslumber_Timer < diff) { //Cast - // DoCastSpellIfCan(m_creature->getVictim(),SPELL_CRYSTALLINE_SLUMBER); - m_creature->CastSpell(m_creature->getVictim(), SPELL_CRYSTALLINE_SLUMBER, false); + // DoCastSpellIfCan(m_creature->GetVictim(),SPELL_CRYSTALLINE_SLUMBER); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_CRYSTALLINE_SLUMBER, false); //Stop attacking target thast asleep and pick new target Cslumber_Timer = 28000; Unit* Target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0); - if (!Target || Target == m_creature->getVictim()) + if (!Target || Target == m_creature->GetVictim()) { Target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); } @@ -281,7 +281,7 @@ struct AnnoraAI : public ScriptedAI AnnoraAI(Creature* pCreature) : ScriptedAI(pCreature) { m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->setFaction(FACTION_STONED); + m_creature->SetFactionTemplateId(FACTION_STONED); m_uiNbScorpion = 0; isSpawned = false; Reset(); @@ -308,7 +308,7 @@ struct AnnoraAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_EscortList, m_creature, 7078, 30.0f); for (const auto& it : m_EscortList) { - if (it->isAlive()) + if (it->IsAlive()) { m_uiNbScorpion++; } @@ -323,7 +323,7 @@ struct AnnoraAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } diff --git a/src/scripts/eastern_kingdoms/undercity/undercity.cpp b/src/scripts/eastern_kingdoms/undercity/undercity.cpp index ec3a19ea4..adf43afd6 100644 --- a/src/scripts/eastern_kingdoms/undercity/undercity.cpp +++ b/src/scripts/eastern_kingdoms/undercity/undercity.cpp @@ -75,7 +75,7 @@ public: m_creature->GetMotionMaster()->Clear(); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSummSkelTimer <= uiDiff) @@ -90,7 +90,7 @@ public: { if (DoCastSpellIfCan(m_creature, SPELL_FADE) == CAST_OK) { - m_creature->GetMotionMaster()->MoveFollow(m_creature->getVictim(), 30.0f, m_creature->GetAngle(m_creature->getVictim())); + m_creature->GetMotionMaster()->MoveFollow(m_creature->GetVictim(), 30.0f, m_creature->GetAngle(m_creature->GetVictim())); m_uiFadeTimer = 50000; m_uiBlackArrowTimer = 0; m_uiMultiShotTimer = 0; @@ -125,7 +125,7 @@ public: if (m_uiShootTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT) == CAST_OK) m_uiShootTimer = 10000; } else diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_darkmaster_gandling.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_darkmaster_gandling.cpp index ac6bbc16f..c5f316ba0 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_darkmaster_gandling.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_darkmaster_gandling.cpp @@ -98,13 +98,13 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ArcaneMissiles_Timer if (ArcaneMissiles_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEMISSILES) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEMISSILES) == CAST_OK) ArcaneMissiles_Timer = urand(10000, 16000); } else ArcaneMissiles_Timer -= diff; @@ -120,7 +120,7 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI //Curse_Timer if (Curse_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSE) == CAST_OK) Curse_Timer = urand(15000, 27000); } else Curse_Timer -= diff; @@ -146,11 +146,11 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI } else if (Unit* target = m_creature->GetMap()->GetUnit(ShadowPortalTargetGUID)) { - m_creature->getThreatManager().modifyThreatPercent(target, -100); + m_creature->GetThreatManager().modifyThreatPercent(target, -100); ShadowPortalTargetGUID = 0; bShadowPortalCasted = false; - if (target->isAlive()) + if (target->IsAlive()) { switch (urand(0, 5)) { @@ -160,19 +160,19 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30000, 229.229f, 5.39118f, 85.2283f, 0.0961165f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30000, 229.503f, 0.00814369f, 85.2283f, 0.0961165f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30000, 229.727f, -4.39616f, 85.2283f, 0.0961165f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; @@ -182,25 +182,25 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30001, 186.217f, -50.0985f, 85.2283f, 4.75432f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30001, 181.568f, -56.2009f, 84.841f, 4.75432f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30001, 188.325f, -55.6766f, 85.2283f, 4.75432f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30001, 173.013f, -56.4198f, 85.2283f, 4.75432f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; @@ -210,19 +210,19 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30002, 128.205f, 5.00569f, 85.2283f, 3.09949f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30002, 128.06f, -6.1269f, 85.2283f, 3.09949f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30002, 128.124f, -1.71736f, 85.3764f, 3.09949f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; @@ -232,19 +232,19 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30003, 235.598f, 0.588147f, 72.6727f, 2.92513f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30003, 235.51f, -5.92126f, 72.6727f, 0.331743f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30003, 229.127f, -3.10989f, 72.6727f, 3.17017f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; @@ -254,25 +254,25 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30004, 170.96f, -56.9603f, 75.3971f, 3.75058f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30004, 182.708f, -55.8739f, 75.3971f, 1.88447f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30004, 175.353f, -55.9977f, 75.3971f, 0.461331f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30004, 191.41f, -55.4289f, 75.3971f, 3.75058f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; @@ -282,19 +282,19 @@ struct boss_darkmaster_gandlingAI : public ScriptedAI if (Creature* Summoned = m_creature->SummonCreature(30005, 138.599f, 4.62909f, 75.397f, 0.065487f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30005, 136.525f, -1.6351f, 75.397f, 0.065487f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } if (Creature* Summoned = m_creature->SummonCreature(30005, 139.392f, -7.35632f, 75.397f, 0.039568f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) { Summoned->SetInCombatWith(target); - Summoned->getThreatManager().addThreatDirectly(target, 100000.0f); + Summoned->GetThreatManager().addThreatDirectly(target, 100000.0f); Summoned->GetMotionMaster()->MoveChase(target); } break; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_doctor_theolen_krastinov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_doctor_theolen_krastinov.cpp index 808f97fda..5d5657839 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_doctor_theolen_krastinov.cpp @@ -59,13 +59,13 @@ struct boss_theolenkrastinovAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Rend_Timer if (m_uiRend_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_REND); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_REND); m_uiRend_Timer = 10000; } else @@ -74,8 +74,8 @@ struct boss_theolenkrastinovAI : public ScriptedAI //m_uiBackhand_Timer if (m_uiBackhand_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACKHAND); - DoModifyThreatPercent(m_creature->getVictim(), -100); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACKHAND); + DoModifyThreatPercent(m_creature->GetVictim(), -100); m_uiBackhand_Timer = 10000; } else diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp index cd3f67fda..029dc5778 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_illucia_barov.cpp @@ -57,13 +57,13 @@ struct boss_illuciabarovAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //CurseOfAgony_Timer if (CurseOfAgony_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFAGONY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFAGONY); CurseOfAgony_Timer = 30000; } else CurseOfAgony_Timer -= diff; @@ -82,7 +82,7 @@ struct boss_illuciabarovAI : public ScriptedAI //Silence_Timer if (Silence_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SILENCE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SILENCE); Silence_Timer = 14000; } else Silence_Timer -= diff; @@ -90,7 +90,7 @@ struct boss_illuciabarovAI : public ScriptedAI //Fear_Timer if (Fear_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FEAR); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FEAR); Fear_Timer = 30000; } else Fear_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp index fbf3ffa9c..510dde44a 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_instructor_malicia.cpp @@ -64,13 +64,13 @@ struct boss_instructormaliciaAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //CallOfGraves_Timer if (CallOfGraves_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CALLOFGRAVES); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CALLOFGRAVES); CallOfGraves_Timer = 65000; } else CallOfGraves_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp index 0521abe7c..666c5e23f 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_jandice_barov.cpp @@ -117,7 +117,7 @@ struct boss_jandicebarovAI : public ScriptedAI if (Invisible && Invisible_Timer < diff) { //Become visible again - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetVisibility(VISIBILITY_ON); Invisible = false; @@ -132,13 +132,13 @@ struct boss_jandicebarovAI : public ScriptedAI } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //CurseOfBlood_Timer if (CurseOfBlood_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSEOFBLOOD); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSEOFBLOOD); CurseOfBlood_Timer = 30000; } else @@ -149,9 +149,9 @@ struct boss_jandicebarovAI : public ScriptedAI { //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -99); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -99); m_creature->SetVisibility(VISIBILITY_OFF); damageTaken = 0; @@ -196,13 +196,13 @@ struct mob_illusionofjandicebarovAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Cleave_Timer if (Cleave_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) Cleave_Timer = urand(5000, 15000); } else diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_kormok.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_kormok.cpp index c3913df4e..bceb83474 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_kormok.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_kormok.cpp @@ -64,13 +64,13 @@ struct boss_kormokAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ShadowVolley_Timer if (ShadowVolley_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLTVOLLEY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLTVOLLEY) == CAST_OK) ShadowVolley_Timer = 15000; } else @@ -79,7 +79,7 @@ struct boss_kormokAI : public ScriptedAI //BoneShield_Timer if (BoneShield_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BONESHIELD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BONESHIELD) == CAST_OK) BoneShield_Timer = 45000; } else @@ -90,7 +90,7 @@ struct boss_kormokAI : public ScriptedAI { //Cast for (int i = 0; i < 4; ++i) - SummonMinion(m_creature->getVictim()); + SummonMinion(m_creature->GetVictim()); Minion_Timer = 12000; } @@ -101,8 +101,8 @@ struct boss_kormokAI : public ScriptedAI if (!Mages && m_creature->GetHealthPercent() < 26.0f) { //Cast - SummonMages(m_creature->getVictim()); - SummonMages(m_creature->getVictim()); + SummonMages(m_creature->GetVictim()); + SummonMages(m_creature->GetVictim()); Mages = true; } diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp index 7ced53d83..8654259c9 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_alexei_barov.cpp @@ -53,7 +53,7 @@ struct boss_lordalexeibarovAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Immolate_Timer @@ -70,7 +70,7 @@ struct boss_lordalexeibarovAI : public ScriptedAI //VeilofShadow_Timer if (VeilofShadow_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_VEILOFSHADOW); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VEILOFSHADOW); VeilofShadow_Timer = 20000; } else VeilofShadow_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_blackwood.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_blackwood.cpp index c16620e44..b9fd4b5d5 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_blackwood.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lord_blackwood.cpp @@ -13,7 +13,7 @@ EndScriptData */ //18651 //20735 //coup de bouclier 11972 -//summoned->addUnitState(UNIT_STAT_ROOT); +//summoned->AddUnitState(UNIT_STAT_ROOT); /* enum { @@ -38,15 +38,15 @@ struct boss_lordblackwoodAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if(!m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if(!m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { m_creature->MonsterSay("pas au cac!"); if (MultiShot_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MULTI_SHOT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MULTI_SHOT) == CAST_OK) MultiShot_Timer=2000; } MultiShot_Timer-=diff; @@ -54,7 +54,7 @@ struct boss_lordblackwoodAI : public ScriptedAI if (ShieldBash_Timer < diff) { m_creature->MonsterSay("yo"); - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH) == CAST_OK) ShieldBash_Timer=8000; } ShieldBash_Timer -=diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lorekeeper_polkelt.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lorekeeper_polkelt.cpp index 2379ebb28..b76a942a0 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_lorekeeper_polkelt.cpp @@ -61,13 +61,13 @@ struct boss_lorekeeperpolkeltAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //VolatileInfection_Timer if (VolatileInfection_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_VOLATILEINFECTION); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VOLATILEINFECTION); VolatileInfection_Timer = 32000; } else VolatileInfection_Timer -= diff; @@ -75,7 +75,7 @@ struct boss_lorekeeperpolkeltAI : public ScriptedAI //CorrosiveAcid_Timer if (CorrosiveAcid_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CORROSIVEACID); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CORROSIVEACID); CorrosiveAcid_Timer = 25000; } else CorrosiveAcid_Timer -= diff; @@ -83,7 +83,7 @@ struct boss_lorekeeperpolkeltAI : public ScriptedAI //NoxiousCatalyst_Timer if (NoxiousCatalyst_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_NOXIOUSCATALYST); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_NOXIOUSCATALYST); NoxiousCatalyst_Timer = 38000; } else NoxiousCatalyst_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp index 375301c16..849a1b86e 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_ras_frostwhisper.cpp @@ -58,7 +58,7 @@ struct boss_rasfrostAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //IceArmor_Timer @@ -83,7 +83,7 @@ struct boss_rasfrostAI : public ScriptedAI //Freeze_Timer if (Freeze_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FREEZE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FREEZE); Freeze_Timer = 24000; } else Freeze_Timer -= diff; @@ -91,7 +91,7 @@ struct boss_rasfrostAI : public ScriptedAI //Fear_Timer if (Fear_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FEAR); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FEAR); Fear_Timer = 30000; } else Fear_Timer -= diff; @@ -99,7 +99,7 @@ struct boss_rasfrostAI : public ScriptedAI //ChillNova_Timer if (ChillNova_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHILLNOVA); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHILLNOVA); ChillNova_Timer = 14000; } else ChillNova_Timer -= diff; @@ -107,7 +107,7 @@ struct boss_rasfrostAI : public ScriptedAI //FrostVolley_Timer if (FrostVolley_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROSTVOLLEY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROSTVOLLEY); FrostVolley_Timer = 15000; } else FrostVolley_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_the_ravenian.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_the_ravenian.cpp index ac9a233f6..16e969639 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_the_ravenian.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_the_ravenian.cpp @@ -59,13 +59,13 @@ struct boss_theravenianAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Trample_Timer if (Trample_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRAMPLE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRAMPLE); Trample_Timer = 10000; } else Trample_Timer -= diff; @@ -73,7 +73,7 @@ struct boss_theravenianAI : public ScriptedAI //Cleave_Timer if (Cleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); Cleave_Timer = 7000; } else Cleave_Timer -= diff; @@ -81,7 +81,7 @@ struct boss_theravenianAI : public ScriptedAI //SunderingCleave_Timer if (SunderingCleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDERINCLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDERINCLEAVE); SunderingCleave_Timer = 20000; } else SunderingCleave_Timer -= diff; @@ -89,7 +89,7 @@ struct boss_theravenianAI : public ScriptedAI //KnockAway_Timer if (KnockAway_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKAWAY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKAWAY); KnockAway_Timer = 12000; } else KnockAway_Timer -= diff; diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp index 685573207..367b13fab 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp @@ -119,7 +119,7 @@ struct boss_vectusAI : public ScriptedAI Creature* Marduck = m_creature->FindNearestCreature(NPC_MARDUK_BLACKPOOL, 100.0f); if (Marduck) { - Marduck->setFaction(14); + Marduck->SetFactionTemplateId(14); Marduck->SetReactState(REACT_AGGRESSIVE); Marduck->AIM_Initialize(); } @@ -135,13 +135,13 @@ struct boss_vectusAI : public ScriptedAI (*it)->SetCreatureGroup(nullptr); } - (*it)->setFaction(14); + (*it)->SetFactionTemplateId(14); (*it)->SetReactState(REACT_AGGRESSIVE); (*it)->AIM_Initialize(); } m_creature->MonsterYell(VECTUS_SPEECH_GAMBIT_EVENT_START, 0, 0); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->SetReactState(REACT_AGGRESSIVE); m_creature->AIM_Initialize(); @@ -152,7 +152,7 @@ struct boss_vectusAI : public ScriptedAI m_uiGambitEvent_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // NOSTALRIUS: Aggro toute la salle lorsqu'il est pull. @@ -162,8 +162,8 @@ struct boss_vectusAI : public ScriptedAI m_creature->GetCreatureListWithEntryInGrid(creatures, NPC_STUDENT, 100.0f); for (std::list::iterator it = creatures.begin(); it != creatures.end(); ++it) { - (*it)->setFaction(14); - (*it)->AI()->AttackStart(m_creature->getVictim()); + (*it)->SetFactionTemplateId(14); + (*it)->AI()->AttackStart(m_creature->GetVictim()); } _fullAggroDone = true; } @@ -180,7 +180,7 @@ struct boss_vectusAI : public ScriptedAI //BlastWave_Timer if (m_uiBlastWave_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLAST_WAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BLAST_WAVE); m_uiBlastWave_Timer = 12000; } else @@ -245,13 +245,13 @@ struct npc_scholomance_studentAI : public ScriptedAI std::list creatures; m_creature->GetCreatureListWithEntryInGrid(creatures, NPC_STUDENT, 100.0f); for (std::list::iterator it = creatures.begin(); it != creatures.end(); ++it) - (*it)->setFaction(14); + (*it)->SetFactionTemplateId(14); if (Creature* pMarduck = m_creature->FindNearestCreature(NPC_MARDUK_BLACKPOOL, 100.0f)) - pMarduck->setFaction(14); + pMarduck->SetFactionTemplateId(14); if (Creature* pVectus = m_creature->FindNearestCreature(NPC_VECTUS, 100.0f)) - pVectus->setFaction(14); + pVectus->SetFactionTemplateId(14); } void JustDied(Unit* Killer) override @@ -301,7 +301,7 @@ struct npc_scholomance_studentAI : public ScriptedAI if (isTransformed) m_creature->AddAura(SPELL_VIEWING_ROOM_STUDENT_TRANSFORM_EFFECT, ADD_AURA_NO_OPTION, m_creature); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->SetLootRecipient(nullptr); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/instance_scholomance.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/instance_scholomance.cpp index b3c892ae6..993969f19 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/instance_scholomance.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/instance_scholomance.cpp @@ -435,7 +435,7 @@ struct boss_lordblackwoodAI : public ScriptedAI void MovementInform(uint32 uiType, uint32 uiPointId) override { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { m_creature->SetWalk(true); if (uiPointId < 3) @@ -449,14 +449,14 @@ struct boss_lordblackwoodAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (!m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { if (MultiShot_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MULTI_SHOT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MULTI_SHOT) == CAST_OK) MultiShot_Timer = 2000; } else @@ -464,7 +464,7 @@ struct boss_lordblackwoodAI : public ScriptedAI } if (ShieldBash_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH) == CAST_OK) ShieldBash_Timer = 8000; } else diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/scholo_trash.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/scholo_trash.cpp index 9ff8347dc..87efa4f25 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/scholo_trash.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/scholo_trash.cpp @@ -37,7 +37,7 @@ struct npc_unstable_corpseAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -120,7 +120,7 @@ struct npc_reanimated_corpseAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp index 27578fc01..905bc3286 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/western_plaguelands.cpp @@ -19,9 +19,9 @@ EndContentData */ bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) + if (pCreature->IsVendor()) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) @@ -84,7 +84,7 @@ enum bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && @@ -256,7 +256,7 @@ struct npc_highprotectorlorikAI : public ScriptedAI m_creature->CastSpell(m_creature, SPELL_RETRIBUTIONAURA, true); // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // GlobalCD non ecoule. @@ -290,7 +290,7 @@ struct npc_highprotectorlorikAI : public ScriptedAI { if (!m_uiGlobalCooldown) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEBLAST) == CAST_OK) { m_uiArcaneBlastTimer = urand(10000, 12000); m_uiGlobalCooldown = 1000; @@ -318,9 +318,9 @@ struct npc_highprotectorlorikAI : public ScriptedAI // SHIELDSLAM if (m_uiShieldSlamTimer < uiDiff) { - if (!m_uiGlobalCooldown && m_creature->getVictim()->IsNonMeleeSpellCasted(false)) + if (!m_uiGlobalCooldown && m_creature->GetVictim()->IsNonMeleeSpellCasted(false)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELDSLAM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELDSLAM) == CAST_OK) { m_uiShieldSlamTimer = 9000; m_uiGlobalCooldown = 1000; diff --git a/src/scripts/eastern_kingdoms/westfall/deadmines/boss_mr_smite.cpp b/src/scripts/eastern_kingdoms/westfall/deadmines/boss_mr_smite.cpp index 9ca2026c4..eee62bee7 100644 --- a/src/scripts/eastern_kingdoms/westfall/deadmines/boss_mr_smite.cpp +++ b/src/scripts/eastern_kingdoms/westfall/deadmines/boss_mr_smite.cpp @@ -77,7 +77,7 @@ struct boss_mr_smiteAI : public ScriptedAI void AttackedBy(Unit* pAttacker) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (m_uiPhase > PHASE_3) @@ -114,7 +114,7 @@ struct boss_mr_smiteAI : public ScriptedAI { if (uiMotionType == POINT_MOTION_TYPE) { - if (Unit* target = m_creature->getVictim()) + if (Unit* target = m_creature->GetVictim()) m_creature->GetMotionMaster()->MoveChase(target); } return; @@ -206,7 +206,7 @@ struct boss_mr_smiteAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - Unit * target = m_creature->getVictim(); + Unit * target = m_creature->GetVictim(); if (!m_creature->SelectHostileTarget() || !target) { if (m_uiEquipTimer) @@ -263,7 +263,7 @@ struct boss_mr_smiteAI : public ScriptedAI { if (m_uiThrashTimer < uiDiff)//instead of the aura, because the aura procs too much { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THRASH) == CAST_OK) m_uiThrashTimer = urand(1500, 4000); } else @@ -291,7 +291,7 @@ struct boss_mr_smiteAI : public ScriptedAI { if (m_uiSlamTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE_SLAM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SMITE_SLAM) == CAST_OK) m_uiSlamTimer = 11000; } else diff --git a/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp b/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp index b349f880b..d9ba7ee39 100644 --- a/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp +++ b/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp @@ -87,14 +87,14 @@ struct instance_deadmines : public ScriptedInstance if (pCreature->GetRespawnDelay() == 43199) { pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); } /** Initialize Gilnid Patrol */ if (pCreature->GetRespawnDelay() == 43201) { pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); } } @@ -215,7 +215,7 @@ struct instance_deadmines : public ScriptedInstance if ((*it)->GetRespawnDelay() == 43199) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); @@ -224,7 +224,7 @@ struct instance_deadmines : public ScriptedInstance if ((*it)->GetRespawnDelay() == 43199) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); } @@ -246,7 +246,7 @@ struct instance_deadmines : public ScriptedInstance if ((*it)->GetRespawnDelay() == 43201) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); @@ -255,7 +255,7 @@ struct instance_deadmines : public ScriptedInstance if ((*it)->GetRespawnDelay() == 43201) { (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); + (*it)->SetFactionTemplateId(17); } m_EscortList.clear(); } diff --git a/src/scripts/eastern_kingdoms/westfall/westfall.cpp b/src/scripts/eastern_kingdoms/westfall/westfall.cpp index afa7fccc0..80f12add2 100644 --- a/src/scripts/eastern_kingdoms/westfall/westfall.cpp +++ b/src/scripts/eastern_kingdoms/westfall/westfall.cpp @@ -151,15 +151,15 @@ struct npc_daphne_stilwellAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiShootTimer < uiDiff) { m_uiShootTimer = 1000; - if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT); + if (!m_creature->IsWithinMeleeRange(m_creature->GetVictim())) + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT); } else diff --git a/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp b/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp index 55bae9399..f50b17874 100644 --- a/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp +++ b/src/scripts/eastern_kingdoms/wetlands/wetlands.cpp @@ -90,7 +90,7 @@ public: void AttackedBy(Unit* pAttacker) override { - if (!pAttacker || m_creature->getVictim()) + if (!pAttacker || m_creature->GetVictim()) return; if (m_creature->GetCharmInfo() && m_creature->CanReachWithMeleeAutoAttack(pAttacker)) @@ -102,7 +102,7 @@ public: // slowing poison timer if (m_slowingPoisonTimer < uiDiff) { - CanCastResult castResult = DoCastSpellIfCan(m_creature->getVictim(), SPELL_SLOWING_POISON, CF_AURA_NOT_PRESENT); + CanCastResult castResult = DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SLOWING_POISON, CF_AURA_NOT_PRESENT); if (castResult == CAST_OK) m_slowingPoisonTimer = urand(8400, 15300); } @@ -112,7 +112,7 @@ public: // backstab timer if (m_backstabTimer < uiDiff) { - CanCastResult castResult = DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACKSTAB); + CanCastResult castResult = DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACKSTAB); if (castResult == CAST_OK) m_backstabTimer = urand(2100, 5600); } @@ -125,7 +125,7 @@ public: void UpdateAI(const uint32 uiDiff) override { - Unit* pTarget = m_creature->getVictim(); + Unit* pTarget = m_creature->GetVictim(); if (pTarget) // in combat { // update when in combat @@ -138,9 +138,9 @@ public: if (!pOwner) return; - if (pOwner->isInCombat()) + if (pOwner->IsInCombat()) { - Unit* pTarget = pOwner->getAttackerForHelper(); + Unit* pTarget = pOwner->GetAttackerForHelper(); if (pTarget) { AttackStart(pTarget); @@ -149,7 +149,7 @@ public: else // not in combat { // if not following, start follow - if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW)) + if (!m_creature->HasUnitState(UNIT_STAT_FOLLOW)) m_creature->GetMotionMaster()->MoveFollow(pOwner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } } @@ -222,7 +222,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI // restore original respawn delay. m_creature->SetRespawnDelay(m_respawnDelay); // restore faction, which usually getting restored automatically, but in rare cases it still can fail. - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); // "announce" that Tapoke Slim Jahn is back and event is ready to start. // distance between Mikhail and Tapoke "Slim" Jahn is about 16 yards, 20 used for "safety". Creature* npcMikhail = GetClosestCreatureWithEntry(m_creature, NPC_MIKHAIL, 20.0f); @@ -239,7 +239,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI { SetRun(); // change faction, which makes him attackable. - m_creature->setFaction(FACTION_NEUTRAL); + m_creature->SetFactionTemplateId(FACTION_NEUTRAL); }break; case WAYPOINT_GATE: { @@ -268,7 +268,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI void AttackedBy(Unit* pAttacker) override { - if (!pAttacker || m_creature->getVictim() || m_creature->IsFriendlyTo(pAttacker)) + if (!pAttacker || m_creature->GetVictim() || m_creature->IsFriendlyTo(pAttacker)) return; AttackStart(pAttacker); @@ -300,7 +300,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI if (Pet *slimsFriend = m_creature->FindGuardianWithEntry(NPC_SLIMS_FRIEND)) { - if (slimsFriend->isAlive()) + if (slimsFriend->IsAlive()) slimsFriend->SetFacingToObject(player); } } @@ -348,13 +348,13 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI } else { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Pummel timer if (m_pummelTimer < uiDiff) { - CanCastResult castResult = DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL); + CanCastResult castResult = DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PUMMEL); if (castResult == CAST_OK) m_pummelTimer = urand(7300, 15000); } @@ -394,7 +394,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI SetEscortPaused(true); - m_creature->setFaction(FACTION_FRIENDLY_TO_ALL); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY_TO_ALL); m_creature->RemoveAllAuras(); m_creature->DeleteThreatList(); m_creature->CombatStop(true); diff --git a/src/scripts/kalimdor/ashenvale/ashenvale.cpp b/src/scripts/kalimdor/ashenvale/ashenvale.cpp index a942804c8..1172f44d6 100644 --- a/src/scripts/kalimdor/ashenvale/ashenvale.cpp +++ b/src/scripts/kalimdor/ashenvale/ashenvale.cpp @@ -194,7 +194,7 @@ struct npc_muglashAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasEscortState(STATE_ESCORT_PAUSED)) { @@ -268,7 +268,7 @@ bool QuestAccept_npc_muglash(Player* pPlayer, Creature* pCreature, const Quest* if (npc_muglashAI* pEscortAI = dynamic_cast(pCreature->AI())) { DoScriptText(SAY_MUG_START1, pCreature); - pCreature->setFaction(FACTION_ESCORT_H_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_H_PASSIVE); pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); } @@ -367,7 +367,7 @@ bool QuestAccept_npc_ruul_snowhoof(Player* pPlayer, Creature* pCreature, const Q { if (pQuest->GetQuestId() == QUEST_FREEDOM_TO_RUUL) { - pCreature->setFaction(106);//supposed to be able to get killed by alliance players. + pCreature->SetFactionTemplateId(106);//supposed to be able to get killed by alliance players. pCreature->SetStandState(UNIT_STAND_STATE_STAND); if (npc_ruul_snowhoofAI* pEscortAI = dynamic_cast(pCreature->AI())) @@ -471,12 +471,12 @@ struct npc_torekAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiRend_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_REND); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_REND); m_uiRend_Timer = 20000; } else @@ -682,7 +682,7 @@ bool QuestAccept_npc_feero_ironhand(Player* pPlayer, Creature* pCreature, const if (pQuest->GetQuestId() == QUEST_SUPPLIES_TO_AUBERDINE) { DoScriptText(SAY_QUEST_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_A_NEUTRAL_PASSIVE); if (npc_feero_ironhandAI* pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(true, pPlayer->GetGUID(), pQuest); @@ -879,7 +879,7 @@ struct npc_enraged_foulwealdAI : public ScriptedAI return; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (timer < uiDiff) { diff --git a/src/scripts/kalimdor/ashenvale/blackfathom_deeps/instance_blackfathom_deeps.cpp b/src/scripts/kalimdor/ashenvale/blackfathom_deeps/instance_blackfathom_deeps.cpp index 1bd656130..6d0e4022e 100644 --- a/src/scripts/kalimdor/ashenvale/blackfathom_deeps/instance_blackfathom_deeps.cpp +++ b/src/scripts/kalimdor/ashenvale/blackfathom_deeps/instance_blackfathom_deeps.cpp @@ -332,7 +332,7 @@ struct instance_blackfathom_deeps : public ScriptedInstance for (std::list::const_iterator itr = m_lWaveMobsGUIDList.begin(); itr != m_lWaveMobsGUIDList.end(); itr++) { if (Creature* WaveMob = instance->GetCreature(*itr)) - if (WaveMob->isAlive()) + if (WaveMob->IsAlive()) return false; } return true; diff --git a/src/scripts/kalimdor/azshara/azshara.cpp b/src/scripts/kalimdor/azshara/azshara.cpp index 9b8031ef4..c1cb7317f 100644 --- a/src/scripts/kalimdor/azshara/azshara.cpp +++ b/src/scripts/kalimdor/azshara/azshara.cpp @@ -94,7 +94,7 @@ struct mobs_spitelashesAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //TODO: add abilities for the different creatures @@ -113,7 +113,7 @@ CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) bool GossipHello_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) @@ -235,7 +235,7 @@ struct mob_mawsAI : public ScriptedAI { if (InCombat) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || LeaveCombatTimer < uiDiff) // m_creature->getThreatManager().isThreatListEmpty() ? + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || LeaveCombatTimer < uiDiff) // m_creature->GetThreatManager().isThreatListEmpty() ? { InCombat = 0; Reset(); @@ -255,7 +255,7 @@ struct mob_mawsAI : public ScriptedAI } if (SaccagerTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SACCAGER); + DoCastSpellIfCan(m_creature->GetVictim(), SACCAGER); if (!PhaseTwo) SaccagerTimerMax = urand(20, 120) * 1000; SaccagerTimer = SaccagerTimerMax; @@ -281,12 +281,12 @@ struct mob_mawsAI : public ScriptedAI } if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); LeaveCombatTimer -= uiDiff; DoMeleeAttackIfReady(); } } - else if (m_creature->getVictim()) + else if (m_creature->GetVictim()) InCombat = 1; } void DamageTaken(Unit *done_by, uint32 &damage) override// l'empecher d'etre kittable infini. s'applique pas aux dégats de la charge. diff --git a/src/scripts/kalimdor/darkshore/darkshore.cpp b/src/scripts/kalimdor/darkshore/darkshore.cpp index c3070b6e9..8d5789b21 100644 --- a/src/scripts/kalimdor/darkshore/darkshore.cpp +++ b/src/scripts/kalimdor/darkshore/darkshore.cpp @@ -79,7 +79,7 @@ struct npc_kerlonianAI : public FollowerAI { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) + if (!m_creature->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE * 5)) { @@ -151,7 +151,7 @@ struct npc_kerlonianAI : public FollowerAI void UpdateFollowerAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) return; @@ -311,7 +311,7 @@ bool QuestAccept_npc_prospector_remtravel(Player* pPlayer, Creature* pCreature, { if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) { - pCreature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_A_NEUTRAL_PASSIVE); if (npc_prospector_remtravelAI* pEscortAI = dynamic_cast(pCreature->AI())) { @@ -352,7 +352,7 @@ struct npc_threshwackonatorAI : public FollowerAI { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) + if (!m_creature->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { @@ -364,7 +364,7 @@ struct npc_threshwackonatorAI : public FollowerAI void DoAtEnd() { - m_creature->setFaction(FACTION_HOSTILE); + m_creature->SetFactionTemplateId(FACTION_HOSTILE); if (Player* pHolder = GetLeaderForFollower()) m_creature->AI()->AttackStart(pHolder); @@ -818,12 +818,12 @@ struct npc_rabid_thistle_bearAI : public FollowerAI Captured_Timer -= SignedDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (Rage_Timer < SignedDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_RAGE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_RAGE) == CAST_OK) Rage_Timer = 60000; } else @@ -967,7 +967,7 @@ struct npc_tharnariun_treetenderAI : public ScriptedAI } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1175,14 +1175,14 @@ struct npc_sentinel_aynashaAI : public Scripted_NoMovementAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (WaveNB < 4) { if (m_uiSpell_AynashasBowTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AYNASHAS_BOW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AYNASHAS_BOW) == CAST_OK) m_uiSpell_AynashasBowTimer = 2000; } else @@ -1351,7 +1351,7 @@ struct npc_murkdeepAI : public ScriptedAI if (!bonfire) return nullptr; - if (player->IsInRange(bonfire, 0.0f, 50.0f) && player->isAlive()) + if (player->IsInRange(bonfire, 0.0f, 50.0f) && player->IsAlive()) return player; return nullptr; @@ -1395,10 +1395,10 @@ struct npc_murkdeepAI : public ScriptedAI if (m_uiSunderArmorTimer < uiDiff) { - SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(SPELL_SUNDER_ARMOR); + SpellAuraHolder* holder = m_creature->GetVictim()->GetSpellAuraHolder(SPELL_SUNDER_ARMOR); if (!holder || holder->GetStackAmount() < 5) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) m_uiSunderArmorTimer = urand(5000, 9000); } else @@ -1409,7 +1409,7 @@ struct npc_murkdeepAI : public ScriptedAI if (m_uiNetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_NET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_NET) == CAST_OK) m_uiNetTimer = urand(9000, 15000); } else @@ -1420,7 +1420,7 @@ struct npc_murkdeepAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (!m_uiEventPhase && m_bEventState && m_creature->GetVisibility() == VISIBILITY_OFF) { @@ -1489,13 +1489,13 @@ bool at_murloc_camp(Player* pPlayer, AreaTriggerEntry const *pAt) { if (pAt->id == AREATRIGGER_MURKDEEP) { - if (pPlayer->IsGameMaster() || pPlayer->isDead()) + if (pPlayer->IsGameMaster() || pPlayer->IsDead()) return false; if (pPlayer && pPlayer->GetQuestStatus(QUEST_WANTED_MURKDEEP) == QUEST_STATUS_INCOMPLETE) { Creature *pCreature = GetClosestCreatureWithEntry(pPlayer, NPC_MURKDEEP, DEFAULT_VISIBILITY_DISTANCE); - if (pCreature && pCreature->isAlive()) + if (pCreature && pCreature->IsAlive()) return false; pCreature = pPlayer->SummonCreature(NPC_MURKDEEP, diff --git a/src/scripts/kalimdor/desolace/desolace.cpp b/src/scripts/kalimdor/desolace/desolace.cpp index 1f83083c5..c1c94a65c 100644 --- a/src/scripts/kalimdor/desolace/desolace.cpp +++ b/src/scripts/kalimdor/desolace/desolace.cpp @@ -140,7 +140,7 @@ struct npc_aged_dying_ancient_kodoAI : ScriptedAI if (m_creature->GetEntry() == NPC_TAMED_KODO) return; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -358,7 +358,7 @@ struct npc_melizza_brimbuzzleAI : public npc_escortAI { Dialogue(uiDiff); npc_escortAI::UpdateAI(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -640,22 +640,22 @@ struct npc_magrami_spetreAI : public ScriptedAI { m_creature->RemoveAurasDueToSpell(SPELL_BLUE_AURA); m_creature->AddAura(SPELL_GREEN_AURA); - m_creature->setFaction(FACTION_ENNEMY); + m_creature->SetFactionTemplateId(FACTION_ENNEMY); isGreen=true; } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if ( curseTimer < uiDiff) { - if(m_creature->getVictim()->HasAura(SPELL_CURSE_OF_THE_FALLEN_MAGRAM)) + if(m_creature->GetVictim()->HasAura(SPELL_CURSE_OF_THE_FALLEN_MAGRAM)) curseTimer = 5000; else { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSE_OF_THE_FALLEN_MAGRAM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSE_OF_THE_FALLEN_MAGRAM) == CAST_OK) curseTimer = urand(15000, 21000); } } @@ -722,7 +722,7 @@ struct go_demon_portalAI: public GameObjectAI if (_demonGuid) { demon = me->GetMap()->GetCreature(_demonGuid); - if (demon && demon->isAlive()) + if (demon && demon->IsAlive()) return true; } demon = me->SummonCreature(NPC_PORTAL_DEMON_DEMON, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), caster ? me->GetAngle(caster) : 0.0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp index d190fcac6..01e2eabb8 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_celebras_the_cursed.cpp @@ -77,7 +77,7 @@ struct celebras_the_cursedAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Wrath @@ -94,7 +94,7 @@ struct celebras_the_cursedAI : public ScriptedAI //EntanglingRoots if (EntanglingRoots_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_ENTANGLINGROOTS); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ENTANGLINGROOTS); EntanglingRoots_Timer = 20000; } else EntanglingRoots_Timer -= diff; @@ -223,7 +223,7 @@ struct celebrasSpiritAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (Event_Timer && !m_creature->getVictim()) + if (Event_Timer && !m_creature->GetVictim()) { if (Event_Timer <= uiDiff) { @@ -282,7 +282,7 @@ struct celebrasSpiritAI : public npc_escortAI Event_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_landslide.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_landslide.cpp index 60d2d4efe..2840a027c 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_landslide.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_landslide.cpp @@ -47,13 +47,13 @@ struct boss_landslideAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //KnockAway_Timer if (KnockAway_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKAWAY); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKAWAY); KnockAway_Timer = 15000; } else KnockAway_Timer -= diff; diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_noxxion.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_noxxion.cpp index 310f99b42..33be07025 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_noxxion.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_noxxion.cpp @@ -60,7 +60,7 @@ struct boss_noxxionAI : public ScriptedAI if (Invisible && Invisible_Timer < diff) { //Become visible again - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //Noxxion model m_creature->SetDisplayId(11172); @@ -75,13 +75,13 @@ struct boss_noxxionAI : public ScriptedAI } //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //ToxicVolley_Timer if (ToxicVolley_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TOXICVOLLEY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TOXICVOLLEY) == CAST_OK) ToxicVolley_Timer = 9000; } else @@ -90,7 +90,7 @@ struct boss_noxxionAI : public ScriptedAI //Uppercut_Timer if (Uppercut_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT) == CAST_OK) Uppercut_Timer = 12000; } else @@ -101,12 +101,12 @@ struct boss_noxxionAI : public ScriptedAI { //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // Invisible Model m_creature->SetDisplayId(11686); for (int i = 0; i < 5; ++i) - SummonAdds(m_creature->getVictim()); + SummonAdds(m_creature->GetVictim()); Invisible = true; Invisible_Timer = 15000; diff --git a/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp b/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp index fddcb8fbf..39050d9ad 100644 --- a/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/boss_princess_theradras.cpp @@ -57,7 +57,7 @@ struct boss_ptheradrasAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Restore target after casting Boulder @@ -65,7 +65,7 @@ struct boss_ptheradrasAI : public ScriptedAI { if (RestoreTargetTimer <= diff) { - if (Unit *pTarget = m_creature->getVictim()) + if (Unit *pTarget = m_creature->GetVictim()) { m_creature->SetInFront(pTarget); m_creature->SetTargetGuid(pTarget->GetObjectGuid()); @@ -103,7 +103,7 @@ struct boss_ptheradrasAI : public ScriptedAI //RepulsiveGaze_Timer if (RepulsiveGaze_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_REPULSIVEGAZE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_REPULSIVEGAZE); RepulsiveGaze_Timer = 20000; } else RepulsiveGaze_Timer -= diff; diff --git a/src/scripts/kalimdor/desolace/maraudon/maraudon.cpp b/src/scripts/kalimdor/desolace/maraudon/maraudon.cpp index f45fae195..fa06167a1 100644 --- a/src/scripts/kalimdor/desolace/maraudon/maraudon.cpp +++ b/src/scripts/kalimdor/desolace/maraudon/maraudon.cpp @@ -34,10 +34,10 @@ struct npc_primordial_behemothAI : ScriptedAI void UpdateAI(uint32 const uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - auto pMainTarget = m_creature->getVictim(); + auto pMainTarget = m_creature->GetVictim(); if (pMainTarget->IsWithinMeleeRange(m_creature) && pMainTarget->IsWithinLOSInMap(m_creature)) { diff --git a/src/scripts/kalimdor/dustwallow_marsh/dustwallow_marsh.cpp b/src/scripts/kalimdor/dustwallow_marsh/dustwallow_marsh.cpp index cf3c4efbe..4025fe0f8 100644 --- a/src/scripts/kalimdor/dustwallow_marsh/dustwallow_marsh.cpp +++ b/src/scripts/kalimdor/dustwallow_marsh/dustwallow_marsh.cpp @@ -78,7 +78,7 @@ struct npc_morokkAI : public npc_escortAI void AttackedBy(Unit* pAttacker) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (m_creature->IsFriendlyTo(pAttacker)) @@ -96,7 +96,7 @@ struct npc_morokkAI : public npc_escortAI if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_CHALLENGE_MOROKK, m_creature); - m_creature->setFaction(FACTION_MOR_RUNNING); + m_creature->SetFactionTemplateId(FACTION_MOR_RUNNING); m_bIsSuccess = true; EnterEvadeMode(); @@ -108,7 +108,7 @@ struct npc_morokkAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasEscortState(STATE_ESCORT_PAUSED)) { @@ -116,7 +116,7 @@ struct npc_morokkAI : public npc_escortAI { m_bIsSuccess = false; DoScriptText(SAY_MOR_CHALLENGE, m_creature, pPlayer); - m_creature->setFaction(FACTION_MOR_HOSTILE); + m_creature->SetFactionTemplateId(FACTION_MOR_HOSTILE); AttackStart(pPlayer); } @@ -294,13 +294,13 @@ struct npc_private_hendelAI : public ScriptedAI // reset player guid m_playerGuid.Clear(); // reset private hendel's faction - m_creature->setFaction(FACTION_THERAMORE); // theramore faction + m_creature->SetFactionTemplateId(FACTION_THERAMORE); // theramore faction // reset his guards faction for (ptrdiff_t i = 0; i < 2; ++i) { - if (m_guards[i] && m_guards[i]->isAlive()) + if (m_guards[i] && m_guards[i]->IsAlive()) { - m_guards[i]->setFaction(FACTION_THERAMORE); // theramore faction + m_guards[i]->SetFactionTemplateId(FACTION_THERAMORE); // theramore faction } } // reset phase flags @@ -318,7 +318,7 @@ struct npc_private_hendelAI : public ScriptedAI void AttackedBy(Unit* pAttacker) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) return; if (m_creature->IsFriendlyTo(pAttacker)) @@ -398,7 +398,7 @@ struct npc_private_hendelAI : public ScriptedAI { Creature* guard = m_guards[guardIndex]; // if guard is valid - if (guard && guard->isAlive()) + if (guard && guard->IsAlive()) { if (first) DoScriptText(guardTexts[0], guard); @@ -470,7 +470,7 @@ struct npc_private_hendelAI : public ScriptedAI { if (m_guards[i]) { - if (m_guards[i]->isAlive()) + if (m_guards[i]->IsAlive()) continue; else static_cast(m_guards[i])->UnSummon(); @@ -497,7 +497,7 @@ struct npc_private_hendelAI : public ScriptedAI DoScriptText(EMOTE_SURRENDER, m_creature); m_creature->RemoveAllAuras(); - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); m_creature->DeleteThreatList(); m_creature->CombatStop(); @@ -735,7 +735,7 @@ bool QuestAccept_npc_private_hendel(Player* pPlayer, Creature* pCreature, const if (privateHendelAI) { // set npc_private_hendel's faction to hostile - pCreature->setFaction(FACTION_HOSTILE); + pCreature->SetFactionTemplateId(FACTION_HOSTILE); // prevents random player pick up a quest during event pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); // save player guid for later use(trigger quest completed) @@ -752,11 +752,11 @@ bool QuestAccept_npc_private_hendel(Player* pPlayer, Creature* pCreature, const if (guard) { // if guard is alive, set his faction to hostile and make them attack player - if (guard->isAlive()) + if (guard->IsAlive()) { - guard->setFaction(FACTION_HOSTILE); + guard->SetFactionTemplateId(FACTION_HOSTILE); // rare case: players from opposite faction and hostile creatures can be used to distract guards before event starts - if (!guard->isInCombat()) + if (!guard->IsInCombat()) guard->AI()->AttackStart(pPlayer); } } @@ -874,7 +874,7 @@ struct npc_archmage_tervoshAI : public ScriptedAI // make guards face private hendel for (auto const& g : guards) { - if (!g->isInCombat() && g->isAlive()) + if (!g->IsInCombat() && g->IsAlive()) { g->StopMoving(); // Movement will be restored automatically in the core g->SetFacingToObject(m_creature); @@ -949,7 +949,7 @@ CreatureAI* GetAI_npc_archmage_tervosh(Creature* pCreature) bool AreaTrigger_at_sentry_point(Player* pPlayer, AreaTriggerEntry const* /*pAt*/) { - if (!pPlayer || !pPlayer->isAlive() || pPlayer->IsGameMaster() || + if (!pPlayer || !pPlayer->IsAlive() || pPlayer->IsGameMaster() || pPlayer->GetQuestStatus(QUEST_MISSING_DIPLO_PT14) == QUEST_STATUS_COMPLETE || pPlayer->GetQuestStatus(QUEST_MISSING_DIPLO_PT14) == QUEST_STATUS_NONE) return false; @@ -1046,7 +1046,7 @@ struct npc_lady_jaina_proudmooreAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->IsNonMeleeSpellCasted()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || m_creature->IsNonMeleeSpellCasted()) return; if (m_uiSpecialTimer < uiDiff) @@ -1058,7 +1058,7 @@ struct npc_lady_jaina_proudmooreAI : public ScriptedAI } else { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_JAINA_TELEPORT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_JAINA_TELEPORT) == CAST_OK) { m_uiSpecialTimer = urand(10, 30)*IN_MILLISECONDS; @@ -1066,9 +1066,9 @@ struct npc_lady_jaina_proudmooreAI : public ScriptedAI { // If we don't remove target from threat list after teleporting, // Jaina will try to chase him and evade despite having other targets. - Unit* pOldVictim = m_creature->getVictim(); + Unit* pOldVictim = m_creature->GetVictim(); m_creature->_removeAttacker(pOldVictim); - m_creature->getThreatManager().modifyThreatPercent(pOldVictim, -101.0f); + m_creature->GetThreatManager().modifyThreatPercent(pOldVictim, -101.0f); } } } @@ -1083,14 +1083,14 @@ struct npc_lady_jaina_proudmooreAI : public ScriptedAI case 0: case 1: { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_JAINA_FIREBALL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_JAINA_FIREBALL) == CAST_OK) m_uiSpellTimer = urand(3, 10)*IN_MILLISECONDS; break; } case 2: case 3: { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_JAINA_FIREBLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_JAINA_FIREBLAST) == CAST_OK) m_uiSpellTimer = urand(3, 10)*IN_MILLISECONDS; break; } @@ -1119,7 +1119,7 @@ CreatureAI* GetAI_npc_lady_jaina_proudmoore(Creature* pCreature) bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) @@ -1252,7 +1252,7 @@ struct npc_stinky_ignatzAI : public npc_escortAI } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (timer < 20000) { @@ -1301,7 +1301,7 @@ bool QuestAccept_npc_stinky_ignatz(Player* pPlayer, Creature* pCreature, const Q { if (pQuest->GetQuestId() == QUEST_STINKYS_ESCAPE_A || pQuest->GetQuestId() == QUEST_STINKYS_ESCAPE_H) { - pCreature->setFaction(113); + pCreature->SetFactionTemplateId(113); pCreature->SetStandState(UNIT_STAND_STATE_STAND); if (npc_stinky_ignatzAI* pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); @@ -1397,7 +1397,7 @@ struct npc_tabethaAI : ScriptedAI if (manaSurges.empty()) return; for (auto itr = manaSurges.begin(); itr != manaSurges.end(); ++itr) - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) (*itr)->ForcedDespawn(); } @@ -1520,7 +1520,7 @@ struct npc_emberstrifeAI : ScriptedAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_bWeakened && m_creature->GetHealthPercent() < 11) @@ -1532,7 +1532,7 @@ struct npc_emberstrifeAI : ScriptedAI // Cleave if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(6000, 8000); } else @@ -1541,7 +1541,7 @@ struct npc_emberstrifeAI : ScriptedAI // Flame Breath if (m_uiFlameBreathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BREATH) == CAST_OK) m_uiFlameBreathTimer = urand(8000, 12000); } else 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 98867ce98..e88977bd2 100644 --- a/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp +++ b/src/scripts/kalimdor/dustwallow_marsh/onyxias_lair/boss_onyxia.cpp @@ -235,14 +235,14 @@ struct boss_onyxiaAI : public ScriptedAI return; } - if (!m_creature->isInCombat() && !m_creature->IsInEvadeMode()) + if (!m_creature->IsInCombat() && !m_creature->IsInEvadeMode()) { Map::PlayerList const& lPlayers = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { - if (m_creature->IsWithinDistInMap(pPlayer, ONYXIA_AGGRO_RANGE) && pPlayer->isTargetableForAttack()) + if (m_creature->IsWithinDistInMap(pPlayer, ONYXIA_AGGRO_RANGE) && pPlayer->IsTargetableForAttack()) { pPlayer->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); m_creature->AI()->AttackStart(pPlayer); @@ -279,7 +279,7 @@ struct boss_onyxiaAI : public ScriptedAI } /** Teleport victim to the center of the chamber if too far away from Onyxia */ - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) { if (isOnyxiaFlying() && !m_creature->IsMoving()) { @@ -307,7 +307,7 @@ struct boss_onyxiaAI : public ScriptedAI std::list WarderList; GetCreatureListWithEntryInGrid(WarderList, m_creature, NPC_ONYXIAN_WARDER, 200.0f); for (std::list::iterator itr = WarderList.begin(); itr != WarderList.end(); ++itr) - if (!(*itr)->isAlive()) + if (!(*itr)->IsAlive()) (*itr)->Respawn(); } @@ -381,7 +381,7 @@ struct boss_onyxiaAI : public ScriptedAI if (m_uiFlameBreathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAMEBREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAMEBREATH) == CAST_OK) { DelayCastEvents(2000); // 2sec de cast m_uiFlameBreathTimer = urand(10000, 20000); @@ -392,7 +392,7 @@ struct boss_onyxiaAI : public ScriptedAI if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(2000, 5000); } else @@ -400,9 +400,9 @@ struct boss_onyxiaAI : public ScriptedAI if (m_uiWingBuffetTimer < uiDiff) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WINGBUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WINGBUFFET) == CAST_OK) { DelayCastEvents(1500); m_uiWingBuffetTimer = urand(15000, 30000); @@ -414,12 +414,12 @@ struct boss_onyxiaAI : public ScriptedAI if (m_uiKnockAwayTimer < uiDiff) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) { - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -25); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -25); DelayCastEvents(1500); m_uiKnockAwayTimer = urand(15000, 30000); @@ -476,12 +476,12 @@ struct boss_onyxiaAI : public ScriptedAI { if (m_uiMovementTimer > 3500 && m_creature->IsStopped() && !m_bDeepBreathIsCasting) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { if (DoCastSpellIfCan(pTarget, SPELL_FIREBALL) == CAST_OK) { - if (m_creature->getThreatManager().getThreat(pTarget)) - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + if (m_creature->GetThreatManager().getThreat(pTarget)) + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); m_uiFireballTimer = 3000; } } @@ -613,7 +613,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_STAT_MELEE_ATTACKING); /** P2 Event to take off */ if (m_uiPhase == PHASE_TWO) @@ -688,11 +688,11 @@ struct boss_onyxiaAI : public ScriptedAI /** Landed. Restore target and start combat movement.*/ else if (m_uiTransTimer < uiDiff && m_uiTransCount == 4) { - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) m_creature->SetTargetGuid(pVictim->GetObjectGuid()); SetCombatMovement(true); - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); m_bTransition = false; m_uiTransTimer = 0; @@ -717,7 +717,7 @@ struct boss_onyxiaAI : public ScriptedAI // restore Onyxia's target after movement in Phase 2 if (uiPointId == m_pPointData->uiLocId) { - if (Unit* pVictim = m_creature->getVictim()) + if (Unit* pVictim = m_creature->GetVictim()) m_creature->SetTargetGuid(pVictim->GetObjectGuid()); } @@ -748,7 +748,7 @@ struct boss_onyxiaAI : public ScriptedAI { CheckForTargetsInAggroRadius(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; /** whenever Onyxia is moving to a waypoint or casting Deep Breath, clear her target */ @@ -832,7 +832,7 @@ struct OnyxianWhelpAI: public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/kalimdor/felwood/felwood.cpp b/src/scripts/kalimdor/felwood/felwood.cpp index 1bb94012a..abe9382dc 100644 --- a/src/scripts/kalimdor/felwood/felwood.cpp +++ b/src/scripts/kalimdor/felwood/felwood.cpp @@ -73,7 +73,7 @@ struct npc_kittenAI : public FollowerAI void MoveInLineOfSight(Unit* pWho) override { //should not have npc_flags by default, so set when expected - if (!m_creature->getVictim() && !m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && HasFollowState(STATE_FOLLOW_INPROGRESS) && pWho->GetEntry() == NPC_WINNA) + if (!m_creature->GetVictim() && !m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && HasFollowState(STATE_FOLLOW_INPROGRESS) && pWho->GetEntry() == NPC_WINNA) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -82,7 +82,7 @@ struct npc_kittenAI : public FollowerAI void UpdateFollowerAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasFollowState(STATE_FOLLOW_PAUSED)) { @@ -176,7 +176,7 @@ enum bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); switch (pCreature->GetEntry()) @@ -355,7 +355,7 @@ struct npc_cursed_oozeAI : public ScriptedAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (SpellTimer < diff) { @@ -392,7 +392,7 @@ struct npc_tainted_oozeAI : public ScriptedAI } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (SpellTimer < diff) { @@ -559,14 +559,14 @@ struct npc_captured_arkonarinAI : npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_bCanAttack) { if (m_uiMortalStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrikeTimer = urand(7000, 10000); } else @@ -574,7 +574,7 @@ struct npc_captured_arkonarinAI : npc_escortAI if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(3000, 6000); } else @@ -688,7 +688,7 @@ struct npc_areiAI : public npc_escortAI switch (dialogueStep) { case 1: - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WITHER_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WITHER_STRIKE) == CAST_OK) { if (Player* pPlayer = GetPlayerForEscort()) DoScriptText(SAY_ASHENVALE, m_creature, pPlayer); @@ -770,12 +770,12 @@ struct npc_areiAI : public npc_escortAI { Dialogue(uiDiff); npc_escortAI::UpdateAI(uiDiff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiWitherStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WITHER_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WITHER_STRIKE) == CAST_OK) m_uiWitherStrikeTimer = urand(3000, 6000); } else @@ -916,7 +916,7 @@ bool AreaTrigger_at_irontree_wood(Player* pPlayer, AreaTriggerEntry const* pAt) { if (pAt->id == AT_IRONTREE_WOOD) { - if (pPlayer->getClass() == CLASS_HUNTER && pPlayer->GetQuestStatus(QUEST_THE_ANCIENT_LEAF) == QUEST_STATUS_COMPLETE) + if (pPlayer->GetClass() == CLASS_HUNTER && pPlayer->GetQuestStatus(QUEST_THE_ANCIENT_LEAF) == QUEST_STATUS_COMPLETE) { Creature* pAncient = GetClosestCreatureWithEntry(pPlayer, NPC_HASTAT_THE_ANCIENT, 100.0f); if (!pAncient) diff --git a/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp b/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp index 4f9c07c10..a23266b6c 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/boss_gordok_king.cpp @@ -52,13 +52,13 @@ struct boss_king_gordokAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Sunder Armor if (m_uiSunderArmor_Timer < uiDiff) { - Unit* pTarget = m_creature->getVictim(); + Unit* pTarget = m_creature->GetVictim(); if (pTarget) { DoCastSpellIfCan(pTarget, SPELL_SUNDER_ARMOR); @@ -79,7 +79,7 @@ struct boss_king_gordokAI : public ScriptedAI // Mortal Strike if (m_uiMortalStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrike_Timer = urand(12000, 20000); } else @@ -112,8 +112,8 @@ struct boss_king_gordokAI : public ScriptedAI { if (Creature* pChorush = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_CHORUSH))) { - if (pChorush->isAlive() && !pChorush->isInCombat()) - pChorush->AI()->AttackStart(m_creature->getVictim()); + if (pChorush->IsAlive() && !pChorush->IsInCombat()) + pChorush->AI()->AttackStart(m_creature->GetVictim()); } m_uiLinkCheckTimer = 2500; } @@ -210,7 +210,7 @@ struct boss_chorushAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; switch (m_uiEquipment) @@ -235,8 +235,8 @@ struct boss_chorushAI : public ScriptedAI { if (Creature* pKing = m_creature->GetMap()->GetCreature(pInstance->GetData64(NPC_KING_GORDOK))) { - if (!pKing->isInCombat()) - pKing->AI()->AttackStart(m_creature->getVictim()); + if (!pKing->IsInCombat()) + pKing->AI()->AttackStart(m_creature->GetVictim()); } m_uiLinkCheckTimer = 2500; } @@ -252,7 +252,7 @@ void boss_chorushAI::UpdateAIMage(const uint32 uiDiff) // Fireball if (m_uiSpellTimers[0] < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIREBALL) == CAST_OK) m_uiSpellTimers[0] = (m_bInMeele ? urand(7000, 10000) : urand(3000, 4000)); } else @@ -281,7 +281,7 @@ void boss_chorushAI::UpdateAIMage(const uint32 uiDiff) if (m_uiSpellTimers[1] < uiDiff) { bool m_bMeleeAttackers = false; - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) if (Unit* attacker = m_creature->GetMap()->GetUnit((*itr)->GetGUID())) if (m_creature->IsInRange(attacker, 0.0f, 8.0f, false)) @@ -301,7 +301,7 @@ void boss_chorushAI::UpdateAIMage(const uint32 uiDiff) if (m_uiSpellTimers[2] < uiDiff) { bool m_bMeleeAttackers = false; - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) if (Unit* attacker = m_creature->GetMap()->GetUnit((*itr)->GetGUID())) if (m_creature->IsInRange(attacker, 0.0f, 8.0f, false)) @@ -318,23 +318,23 @@ void boss_chorushAI::UpdateAIMage(const uint32 uiDiff) if (!IsCombatMovementEnabled()) { //Melee - if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 30.0f - || !m_creature->IsWithinLOSInMap(m_creature->getVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) + if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->GetVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->GetVictim()) > 30.0f + || !m_creature->IsWithinLOSInMap(m_creature->GetVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) { SetCombatMovement(true); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); m_bInMeele = true; return; } } else { //Range - if (m_bInMeele && m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 30.0f - && m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) + if (m_bInMeele && m_creature->GetDistance2d(m_creature->GetVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->GetVictim()) <= 30.0f + && m_creature->IsWithinLOSInMap(m_creature->GetVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) { SetCombatMovement(false); m_bInMeele = false; - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); return; } } @@ -347,7 +347,7 @@ void boss_chorushAI::UpdateAIShaman(const uint32 uiDiff) if (m_uiSpellTimers[2] < uiDiff) { bool m_bMeleeAttackers = false; - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) if (Unit* attacker = m_creature->GetMap()->GetUnit((*itr)->GetGUID())) if (m_creature->IsInRange(attacker, 0.0f, 6.0f, false)) @@ -380,7 +380,7 @@ void boss_chorushAI::UpdateAIShaman(const uint32 uiDiff) // Lightning Bolt if (m_uiSpellTimers[0] < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_LIGHTNING_BOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_LIGHTNING_BOLT) == CAST_OK) m_uiSpellTimers[0] = (m_bInMeele ? urand(7000, 10000) : urand(3000, 4000)); } else @@ -389,7 +389,7 @@ void boss_chorushAI::UpdateAIShaman(const uint32 uiDiff) // Chain Lightning if (m_uiSpellTimers[1] < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) m_uiSpellTimers[1] = urand(15000, 25000); } else @@ -397,23 +397,23 @@ void boss_chorushAI::UpdateAIShaman(const uint32 uiDiff) if (!IsCombatMovementEnabled()) { //Melee - if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 30.0f - || !m_creature->IsWithinLOSInMap(m_creature->getVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) + if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->GetVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->GetVictim()) > 30.0f + || !m_creature->IsWithinLOSInMap(m_creature->GetVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) { SetCombatMovement(true); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); m_bInMeele = true; return; } } else { //Range - if (m_bInMeele && m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 30.0f - && m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) + if (m_bInMeele && m_creature->GetDistance2d(m_creature->GetVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->GetVictim()) <= 30.0f + && m_creature->IsWithinLOSInMap(m_creature->GetVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) { SetCombatMovement(false); m_bInMeele = false; - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); return; } } @@ -440,7 +440,7 @@ void boss_chorushAI::UpdateAIPrist(const uint32 uiDiff) // Mind Blast if (m_uiSpellTimers[0] < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_BLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_BLAST) == CAST_OK) m_uiSpellTimers[0] = (m_bInMeele ? urand(7000, 10000) : urand(2000, 3000)); } else @@ -462,7 +462,7 @@ void boss_chorushAI::UpdateAIPrist(const uint32 uiDiff) if (m_uiSpellTimers[2] < uiDiff) { bool m_bMeleeAttackers = false; - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) if (Unit* attacker = m_creature->GetMap()->GetUnit((*itr)->GetGUID())) if (m_creature->IsInRange(attacker, 0.0f, 8.0f, false)) @@ -479,23 +479,23 @@ void boss_chorushAI::UpdateAIPrist(const uint32 uiDiff) if (!IsCombatMovementEnabled()) { //Melee - if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 30.0f - || !m_creature->IsWithinLOSInMap(m_creature->getVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) + if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->GetVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->GetVictim()) > 30.0f + || !m_creature->IsWithinLOSInMap(m_creature->GetVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) { SetCombatMovement(true); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); m_bInMeele = true; return; } } else { //Range - if (m_bInMeele && m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 30.0f - && m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) + if (m_bInMeele && m_creature->GetDistance2d(m_creature->GetVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->GetVictim()) <= 30.0f + && m_creature->IsWithinLOSInMap(m_creature->GetVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) { SetCombatMovement(false); m_bInMeele = false; - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); return; } } diff --git a/src/scripts/kalimdor/feralas/dire_maul/boss_immol_thar.cpp b/src/scripts/kalimdor/feralas/dire_maul/boss_immol_thar.cpp index 1fab8291b..4575842bd 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/boss_immol_thar.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/boss_immol_thar.cpp @@ -75,7 +75,7 @@ struct boss_immol_tharAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { // En cas de bug pathfinding CheckBug_Timer += uiDiff; @@ -97,7 +97,7 @@ struct boss_immol_tharAI : public ScriptedAI DoCastSpellIfCan(m_creature, SPELL_TRAMPLE); if (ManageTimer(uiDiff, &m_uiInfectedBiteTimer, urand(8000, 12000))) - DoCastSpellIfCan(m_creature->getVictim(), SPELL_INFECTED_BITE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_INFECTED_BITE); if (ManageTimer(uiDiff, &m_uiEyeOfImmolTharTimer, urand(15000, 22000))) { @@ -109,7 +109,7 @@ struct boss_immol_tharAI : public ScriptedAI TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { m_creature->SendSpellGo(tmp, 25681); - tmp->Attack(m_creature->getVictim(), true); + tmp->Attack(m_creature->GetVictim(), true); } } @@ -124,7 +124,7 @@ struct boss_immol_tharAI : public ScriptedAI float orientation = pTarget->GetOrientation(); m_creature->SendSpellGo(pTarget, 25681); pTarget->NearTeleportTo(x, y, z, orientation); - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); } } if (m_uiEnrageTimer < uiDiff) diff --git a/src/scripts/kalimdor/feralas/dire_maul/boss_tendris_warpwood.cpp b/src/scripts/kalimdor/feralas/dire_maul/boss_tendris_warpwood.cpp index 446a682fe..8cf9c229e 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/boss_tendris_warpwood.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/boss_tendris_warpwood.cpp @@ -69,7 +69,7 @@ struct boss_tendris_warpwoodAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_AggroList, m_creature, NPC_IRONBARK_PROTECTOR, 1800.0f); for (std::list::iterator it = m_AggroList.begin(); it != m_AggroList.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) (*it)->SetInCombatWithZone(); } } @@ -96,14 +96,14 @@ struct boss_tendris_warpwoodAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->IsNonMeleeSpellCasted(false)) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || m_creature->IsNonMeleeSpellCasted(false)) return; if (ManageTimer(uiDiff, &m_uiTrampleTimer, urand(9000, 14000))) DoCastSpellIfCan(m_creature, SPELL_TRAMPLE); if (ManageTimer(uiDiff, &m_uiUppercutTimer, urand(12000, 15000))) - DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT); if (ManageTimer(uiDiff, &m_uiGraspingVinesTimer, urand(17000, 22000))) DoCastSpellIfCan(m_creature, SPELL_GRASPING_VINES); @@ -114,7 +114,7 @@ struct boss_tendris_warpwoodAI : public ScriptedAI /** Invoque player in front of him */ if (m_uiInvocation_Timer < uiDiff) { - Unit* pUnit = m_creature->getVictim(); + Unit* pUnit = m_creature->GetVictim(); if (m_creature->GetDistance(pUnit) > 7.0f) { float x = m_creature->GetPositionX(); diff --git a/src/scripts/kalimdor/feralas/dire_maul/boss_zevrim.cpp b/src/scripts/kalimdor/feralas/dire_maul/boss_zevrim.cpp index d2bd921d9..2efa443cf 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/boss_zevrim.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/boss_zevrim.cpp @@ -39,7 +39,7 @@ struct boss_zevrimAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->IsNonMeleeSpellCasted(false)) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim() || m_creature->IsNonMeleeSpellCasted(false)) return; if (m_uiIntensePainTimer < uiDiff) diff --git a/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp b/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp index 4d5aba928..4b9cb19a0 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/dreadsteed_ritual.cpp @@ -174,14 +174,14 @@ struct go_pedestal_of_immol_tharAI: public GameObjectAI me->GetCreatureListWithEntryInGrid(lCrea, NPC_XOROTHIAN_IMP, 30.0f); for (std::list::iterator it = lCrea.begin(); it != lCrea.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) DoScriptText(SAY_IMP_DESPAWN, (*it)); (*it)->DisappearAndDie(); } me->GetCreatureListWithEntryInGrid(lCrea, NPC_DREAD_GUARD, 30.0f); for (std::list::iterator it = lCrea.begin(); it != lCrea.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) DoScriptText(SAY_DREAD_GUARD_DESPAWN, (*it)); (*it)->DisappearAndDie(); } @@ -220,14 +220,14 @@ struct go_pedestal_of_immol_tharAI: public GameObjectAI me->GetCreatureListWithEntryInGrid(lCrea, NPC_XOROTHIAN_IMP, 30.0f); for (std::list::iterator it = lCrea.begin(); it != lCrea.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) DoScriptText(SAY_IMP_DESPAWN, (*it)); (*it)->DisappearAndDie(); } me->GetCreatureListWithEntryInGrid(lCrea, NPC_DREAD_GUARD, 30.0f); for (std::list::iterator it = lCrea.begin(); it != lCrea.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) DoScriptText(SAY_DREAD_GUARD_DESPAWN, (*it)); (*it)->DisappearAndDie(); } @@ -838,12 +838,12 @@ struct boss_lordHelNurathAI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiShadowWord_Timer < uiDiff) { //penser à vérifier qu'il change de target si la cible est sleep - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_WORD) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_WORD) == CAST_OK) m_uiShadowWord_Timer = urand(10000, 30000); } else @@ -851,7 +851,7 @@ struct boss_lordHelNurathAI : public ScriptedAI if (m_uiVielOfShadow_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_VEIL_OF_SHADOW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VEIL_OF_SHADOW) == CAST_OK) m_uiVielOfShadow_Timer = urand(20000, 85000); } else @@ -865,7 +865,7 @@ struct boss_lordHelNurathAI : public ScriptedAI m_uiSleep_Timer -= uiDiff; if (m_uiKnockAway_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAway_Timer = urand(6000, 10000); } else @@ -894,7 +894,7 @@ struct boss_xorothianDreadsteedAI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCharge_Timer < uiDiff) { @@ -907,7 +907,7 @@ struct boss_xorothianDreadsteedAI : public ScriptedAI if (m_uiFlameBuffet_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BUFFET) == CAST_OK) m_uiFlameBuffet_Timer = urand(7000, 12000); } else diff --git a/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp b/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp index 60e646338..0cc57721a 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/instance_dire_maul.cpp @@ -194,7 +194,7 @@ void instance_dire_maul::OnCreatureDeath(Creature* pCreature) if (Creature* pChorush = instance->GetCreature(m_uiChoRushTheObserverGUID)) { - if (pChorush->isAlive()) + if (pChorush->IsAlive()) { pChorush->SetFactionTemporary(FACTION_FRIENDLY, 0); pChorush->m_Events.AddLambdaEventAtOffset([pChorush]() { DoScriptText(SAY_KING_DEAD, pChorush); }, 5000); @@ -247,7 +247,7 @@ void instance_dire_maul::OnCreatureCreate(Creature* pCreature) if (GetData(TYPE_GORDOK_TRIBUTE) == DONE) { - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); pCreature->SetStandState(UNIT_STAND_STATE_SIT); } break; @@ -279,14 +279,14 @@ void instance_dire_maul::SetData(uint32 uiType, uint32 uiData) if (Creature* pCreature = instance->GetCreature(*itr)) { // Ne pas non plus aggro toute l'instance. - if (pCreature->isAlive()) + if (pCreature->IsAlive()) { EnableCreature(pCreature); if (pCreature->GetDistance(pImmolThar) > 100.0f) continue; - pCreature->setFaction(100); + pCreature->SetFactionTemplateId(100); if (!bHasYelled) { @@ -559,7 +559,7 @@ void instance_dire_maul::DoSortCristalsEventMobs() { if (Creature* pCreature = instance->GetCreature(*itr)) { - if (pCreature->isAlive() && pCreature->GetDistance(pRune) < 20.0f) + if (pCreature->IsAlive() && pCreature->GetDistance(pRune) < 20.0f) m_alCristalsEventtMobGUIDSorted[i].push_back(*itr); } } @@ -611,7 +611,7 @@ struct npc_reste_manaAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) @@ -619,7 +619,7 @@ struct npc_reste_manaAI : public ScriptedAI if (m_uiBlink_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLINK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BLINK); m_uiBlink_Timer = 6000; return; } @@ -628,7 +628,7 @@ struct npc_reste_manaAI : public ScriptedAI if (m_uiChainLighting_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAINLIGHTNING); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAINLIGHTNING); m_uiChainLighting_Timer = 6000; return; } @@ -689,7 +689,7 @@ struct npc_arcane_aberrationAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) @@ -697,7 +697,7 @@ struct npc_arcane_aberrationAI : public ScriptedAI if (m_uiArcaneBoltTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEBOLT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEBOLT); m_uiArcaneBoltTimer = urand(2400, 3800); return; } @@ -747,7 +747,7 @@ struct npc_residual_montruosityAI : public ScriptedAI void UpdateFormationSpeed() { float newspeed = 1.79f; - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { float closestbefore = 45.0f; @@ -787,7 +787,7 @@ struct npc_residual_montruosityAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { UpdateFormationSpeed(); return; @@ -798,7 +798,7 @@ struct npc_residual_montruosityAI : public ScriptedAI if (m_uiArcaneBoltTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEBOLT2); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANEBOLT2); m_uiArcaneBoltTimer = urand(2400, 3800); return; } @@ -934,7 +934,7 @@ bool GossipSelect_npc_mizzle_the_crafty(Player* pPlayer, Creature* pCreature, ui } } else - if (!pPlayer->isInCombat()) + if (!pPlayer->IsInCombat()) pCreature->CastSpell(pPlayer, SPELL_KING_OF_GORDOK, true); } return true; @@ -1030,7 +1030,7 @@ CreatureAI* GetAI_npc_knot_thimblejack(Creature* pCreature) bool GossipHello_npc_knot_thimblejack(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid()); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Why should I bother fixing the trap? Why not just eliminate the guard the old fashioned way?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); @@ -1144,14 +1144,14 @@ struct GordokBruteAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; /** Spell above 30% of life */ if (m_uiBruisingBlow_Timer < uiDiff) { if(m_creature->GetHealthPercent() > 30.0f) - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BRUISING_BLOW) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BRUISING_BLOW) == CAST_OK) m_uiBruisingBlow_Timer = urand(3000, 8000); } else @@ -1159,8 +1159,8 @@ struct GordokBruteAI : public ScriptedAI if (m_uiPummel_Timer < uiDiff) { - if(m_creature->GetHealthPercent() > 30.0f && m_creature->getVictim()->IsNonMeleeSpellCasted(true)) - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL) == CAST_OK) + if(m_creature->GetHealthPercent() > 30.0f && m_creature->GetVictim()->IsNonMeleeSpellCasted(true)) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PUMMEL) == CAST_OK) m_uiPummel_Timer = urand(8000, 10000); } else @@ -1182,7 +1182,7 @@ struct GordokBruteAI : public ScriptedAI { if (m_uiBackhand_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BACK_HAND) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BACK_HAND) == CAST_OK) m_uiBackhand_Timer = urand(5000, 9000); } else @@ -1191,7 +1191,7 @@ struct GordokBruteAI : public ScriptedAI if (m_uiUppercut_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT) == CAST_OK) m_uiUppercut_Timer = urand(6000, 10000); } else @@ -1275,7 +1275,7 @@ struct boss_guardsAI : public ScriptedAI void SpellHitTarget(Unit* pCaster, const SpellEntry* pSpell) override { if (pSpell->Id == SPELL_KNOCK_AWAY) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -50); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -50); } void UpdateAI(const uint32 uiDiff) override @@ -1285,7 +1285,7 @@ struct boss_guardsAI : public ScriptedAI { if (m_uiCombatBugTimer <= uiDiff) { - if (m_creature->isInCombat() && m_creature->HasAura(SPELL_ICE_LOCK)) + if (m_creature->IsInCombat() && m_creature->HasAura(SPELL_ICE_LOCK)) { m_creature->CombatStop(true); m_creature->DeleteThreatList(); @@ -1296,7 +1296,7 @@ struct boss_guardsAI : public ScriptedAI m_uiCombatBugTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shield Charge @@ -1315,9 +1315,9 @@ struct boss_guardsAI : public ScriptedAI // Shield Bash if (m_uiShieldBash_Timer < uiDiff) { - if (m_creature->getVictim()->IsNonMeleeSpellCasted(true)) + if (m_creature->GetVictim()->IsNonMeleeSpellCasted(true)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH) == CAST_OK) m_uiShieldBash_Timer = urand(10000, 15000); } } @@ -1327,7 +1327,7 @@ struct boss_guardsAI : public ScriptedAI // Strike if (m_uiStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE) == CAST_OK) m_uiStrike_Timer = urand(10000, 15000); } else @@ -1336,7 +1336,7 @@ struct boss_guardsAI : public ScriptedAI // Knock Away if (m_uiKnockAway_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAway_Timer = urand(20000, 30000); } else @@ -1590,13 +1590,13 @@ struct boss_kromcrushAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Mortal Cleave if (m_uiMortalCleave_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_CLEAVE) == CAST_OK) m_uiMortalCleave_Timer = urand(15000, 20000); } else @@ -1605,7 +1605,7 @@ struct boss_kromcrushAI : public ScriptedAI // Intimidating Shout if (m_uiIntimidatingShout_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_INTIMIDATING_SHOUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_INTIMIDATING_SHOUT) == CAST_OK) m_uiIntimidatingShout_Timer = urand(30000, 35000); } else @@ -1633,7 +1633,7 @@ struct boss_kromcrushAI : public ScriptedAI bool GossipHello_boss_kromcrush(Player* pPlayer, Creature * pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid()); if (instance_dire_maul* pInstance = (instance_dire_maul*)pCreature->GetInstanceData()) @@ -1726,13 +1726,13 @@ struct boss_prince_tortheldrinAI:public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Summon if (summonTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUMMON) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUMMON) == CAST_OK) summonTimer = urand(13000, 20000); } else @@ -1742,7 +1742,7 @@ struct boss_prince_tortheldrinAI:public ScriptedAI if (whirlwindTimer < uiDiff) { bool m_bMeleeAttackers = false; - Unit::AttackerSet attackers = m_creature->getAttackers(); + Unit::AttackerSet attackers = m_creature->GetAttackers(); for (Unit::AttackerSet::iterator itr = attackers.begin(); itr != attackers.end(); ++itr) { if (Unit* attacker = m_creature->GetMap()->GetUnit((*itr)->GetGUID())) @@ -1764,7 +1764,7 @@ struct boss_prince_tortheldrinAI:public ScriptedAI // Arcane Blast if (arcaneBlastTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_BLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANE_BLAST) == CAST_OK) { DoResetThreat(); arcaneBlastTimer = urand(10000, 15000); @@ -1919,7 +1919,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI m_fCoordMinions[i][2], m_fCoordMinions[i][3], TEMPSUMMON_MANUAL_DESPAWN, 20 * IN_MILLISECONDS)) { - pAdds->AI()->AttackStart(m_creature->getVictim()); + pAdds->AI()->AttackStart(m_creature->GetVictim()); } ++m_uiImpCount; @@ -1934,7 +1934,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI { for (auto iter = m_lHelpers.begin(); iter != m_lHelpers.end(); ++iter) { - if (*iter && !(*iter)->isAlive()) + if (*iter && !(*iter)->IsAlive()) static_cast(*iter)->UnSummon(); } m_lHelpers.clear(); @@ -2043,7 +2043,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI m_uiThornsTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (!m_uiOOCTimer) return; @@ -2104,7 +2104,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI // Wither if (m_uiWitherTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WITHER, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WITHER, CF_AURA_NOT_PRESENT) == CAST_OK) m_uiWitherTimer = urand(8000, 10000); } else @@ -2125,7 +2125,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI // Mangle if (m_uiMangleTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MANGLE, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MANGLE, CF_AURA_NOT_PRESENT) == CAST_OK) m_uiMangleTimer = urand(8000, 10000); } else @@ -2134,7 +2134,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI // Vicious Bite if (m_uiViciousBiteTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_VICIOUS_BITE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_VICIOUS_BITE) == CAST_OK) m_uiViciousBiteTimer = urand(8000, 15000); } else @@ -2146,7 +2146,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI // Knock Away if (m_uiKnockAwayTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = urand(16000, 20000); } else @@ -2155,7 +2155,7 @@ struct boss_alzzin_the_wildshaperAI : ScriptedAI // Disarm if (m_uiDisarmTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISARM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISARM) == CAST_OK) m_uiDisarmTimer = urand(16000, 20000); } else @@ -2190,16 +2190,16 @@ struct npc_alzzins_minionAI : ScriptedAI { if (Unit* pSummoner = m_creature->GetMap()->GetUnit(((TemporarySummon*)m_creature)->GetSummonerGuid())) { - if (pSummoner->isAlive()) + if (pSummoner->IsAlive()) m_creature->GetMotionMaster()->MoveFollow(pSummoner, PET_FOLLOW_DIST, frand(0.0f, 6.2832f)); } } void MoveInLineOfSight(Unit *pWho) override { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) { - if (pWho->IsPlayer() && pWho->isTargetableForAttack() && m_creature->IsWithinDistInMap(pWho, 30.0f) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsPlayer() && pWho->IsTargetableForAttack() && m_creature->IsWithinDistInMap(pWho, 30.0f) && m_creature->IsWithinLOSInMap(pWho)) m_creature->AttackedBy(pWho); } } @@ -2208,7 +2208,7 @@ struct npc_alzzins_minionAI : ScriptedAI { if (Unit* pSummoner = m_creature->GetMap()->GetUnit(((TemporarySummon*)m_creature)->GetSummonerGuid())) { - if (!pSummoner->isAlive() || !pSummoner->isInCombat()) + if (!pSummoner->IsAlive() || !pSummoner->IsInCombat()) ((TemporarySummon*)m_creature)->UnSummon(); } } @@ -2253,10 +2253,10 @@ struct boss_ferraAI : public ScriptedAI void MoveInLineOfSight(Unit *pWho) override { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) { if (pWho->IsPlayer() && m_creature->IsWithinDistInMap(pWho, 80.0f) && m_creature->IsWithinLOSInMap(pWho) - && pWho->isTargetableForAttack()) + && pWho->IsTargetableForAttack()) { // don't aggro people through the floor, ever! if ((m_creature->GetPositionZ() - pWho->GetPositionZ()) < 10.0f) @@ -2267,13 +2267,13 @@ struct boss_ferraAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Maul if (m_uiMaul_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MAUL) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MAUL) == CAST_OK) m_uiMaul_Timer = urand(15000, 20000); } else @@ -2282,7 +2282,7 @@ struct boss_ferraAI : public ScriptedAI // Charge if (m_uiCharge_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHARGE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHARGE) == CAST_OK) m_uiCharge_Timer = urand(6000, 10000); } else @@ -2342,13 +2342,13 @@ struct boss_magister_kalendrisAI:public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Shadow Word Pain if (m_uiShadowWordPainTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_WORD_PAIN, CF_AURA_NOT_PRESENT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_WORD_PAIN, CF_AURA_NOT_PRESENT) == CAST_OK) m_uiShadowWordPainTimer = urand(9000, 11000); } else @@ -2357,7 +2357,7 @@ struct boss_magister_kalendrisAI:public ScriptedAI // MindFlay if (m_uiMindFlayTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_FLAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_FLAY) == CAST_OK) m_uiMindFlayTimer = urand(18000, 23000); } else @@ -2366,7 +2366,7 @@ struct boss_magister_kalendrisAI:public ScriptedAI // Mind Blast if (m_uiMindBlastTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_BLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_BLAST) == CAST_OK) m_uiMindBlastTimer = (m_bInMeele ? urand(7000, 10000) : urand(2000, 3000)); } else @@ -2390,21 +2390,21 @@ struct boss_magister_kalendrisAI:public ScriptedAI if (!IsCombatMovementEnabled()) { //Melee - if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 30.0f || !m_creature->IsWithinLOSInMap(m_creature->getVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) + if (!m_bInMeele && (m_creature->GetDistance2d(m_creature->GetVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->GetVictim()) > 30.0f || !m_creature->IsWithinLOSInMap(m_creature->GetVictim()) || m_creature->GetPowerPercent(POWER_MANA) < 5.0f)) { SetCombatMovement(true); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); m_bInMeele = true; return; } } else { //Range - if (m_bInMeele && m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 30.0f && m_creature->IsWithinLOSInMap(m_creature->getVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) + if (m_bInMeele && m_creature->GetDistance2d(m_creature->GetVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->GetVictim()) <= 30.0f && m_creature->IsWithinLOSInMap(m_creature->GetVictim()) && m_creature->GetPowerPercent(POWER_MANA) >= 5.0f) { SetCombatMovement(false); m_bInMeele = false; - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); return; } } diff --git a/src/scripts/kalimdor/feralas/dire_maul/npc_pusillin.cpp b/src/scripts/kalimdor/feralas/dire_maul/npc_pusillin.cpp index e525f12cf..358c45e88 100644 --- a/src/scripts/kalimdor/feralas/dire_maul/npc_pusillin.cpp +++ b/src/scripts/kalimdor/feralas/dire_maul/npc_pusillin.cpp @@ -31,7 +31,7 @@ struct npc_pusillinAI : public ScriptedAI { m_pInstance = (instance_dire_maul*) pCreature->GetInstanceData(); ME->SetObjectScale(0.5f); - ME->setFaction(35); + ME->SetFactionTemplateId(35); uiStep = 0; bInCombat = false; Reset(); @@ -57,10 +57,10 @@ struct npc_pusillinAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!ME->SelectHostileTarget() || !ME->getVictim()) + if (!ME->SelectHostileTarget() || !ME->GetVictim()) return; -// if (!ME->getVictim()) +// if (!ME->GetVictim()) // return; if (uiGlobalCD < uiDiff) @@ -68,15 +68,15 @@ struct npc_pusillinAI : public ScriptedAI switch (urand(1, 3)) { case 1: // Boule de feu - ME->CastSpell(ME->getVictim(), 15228, false); + ME->CastSpell(ME->GetVictim(), 15228, false); uiGlobalCD = 6000; break; case 2: // Trait de feu - ME->CastSpell(ME->getVictim(), 14145, false); + ME->CastSpell(ME->GetVictim(), 14145, false); uiGlobalCD = 4000; break; case 3: // Vague explosive - ME->CastSpell(ME->getVictim(), 22424, false); + ME->CastSpell(ME->GetVictim(), 22424, false); uiGlobalCD = 9000; break; } @@ -135,7 +135,7 @@ struct npc_pusillinAI : public ScriptedAI case 4: ME->SetHomePosition(18.19f, -701.15f, -12.64f, 0); ME->MonsterSay(TEXT_5, 0, 0); - ME->setFaction(14); + ME->SetFactionTemplateId(14); ME->SetObjectScale(0.7f); ME->CastSpell(ME, 22735, false); // Spirit of Runn Tum bInCombat = true; diff --git a/src/scripts/kalimdor/feralas/feralas.cpp b/src/scripts/kalimdor/feralas/feralas.cpp index 8852fc688..ffe636a94 100644 --- a/src/scripts/kalimdor/feralas/feralas.cpp +++ b/src/scripts/kalimdor/feralas/feralas.cpp @@ -29,10 +29,10 @@ EndScriptData */ bool GossipHello_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) + if (pCreature->IsVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Buy somethin', will ya?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); @@ -188,7 +188,7 @@ struct npc_shay_leafrunnerAI : public FollowerAI m_uiDespawnTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (m_uiWanderTimer) { @@ -242,7 +242,7 @@ bool QuestAccept_npc_shay_leafrunner(Player* pPlayer, Creature* pCreature, const { DoScriptText(SAY_ESCORT_START, pCreature); if (npc_shay_leafrunnerAI* leafrunnerAI = dynamic_cast(pCreature->AI())) - leafrunnerAI->BeforeStartFollow(pPlayer, pPlayer->getFaction(), pQuest); + leafrunnerAI->BeforeStartFollow(pPlayer, pPlayer->GetFactionTemplateId(), pQuest); } return true; } @@ -306,7 +306,7 @@ struct MushgogAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_AggroList, m_creature, 14395, 1800.0f); for (std::list::iterator it = m_AggroList.begin(); it != m_AggroList.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) (*it)->MonsterYell("Leaf him alone Mushgog!"); } m_bAggro = true; @@ -330,7 +330,7 @@ struct MushgogAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSporeCloud_Timer < uiDiff) @@ -344,7 +344,7 @@ struct MushgogAI : public ScriptedAI if (m_uiRoots_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ROOTS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ROOTS) == CAST_OK) m_uiRoots_Timer = urand(8000, 12000); } else @@ -352,7 +352,7 @@ struct MushgogAI : public ScriptedAI if (m_uiThornVolley_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THORN_VOLLEY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THORN_VOLLEY) == CAST_OK) m_uiThornVolley_Timer = urand(5000, 9000); } else @@ -424,7 +424,7 @@ struct TheRazzaAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_AggroList, m_creature, 14395, 1800.0f); for (std::list::iterator it = m_AggroList.begin(); it != m_AggroList.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) (*it)->MonsterYell("Woohoo! They are into it now!"); } m_bAggro = true; @@ -433,12 +433,12 @@ struct TheRazzaAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiPoisonBolt_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_POISON_BOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POISON_BOLT) == CAST_OK) m_uiPoisonBolt_Timer = 6000; } else @@ -446,7 +446,7 @@ struct TheRazzaAI : public ScriptedAI if (m_uiChainLightning_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) m_uiChainLightning_Timer = urand(4000, 7000); } else @@ -516,7 +516,7 @@ struct SkarrTheUnbreakableAI : public ScriptedAI GetCreatureListWithEntryInGrid(m_AggroList, m_creature, 14395, 1800.0f); for (std::list::iterator it = m_AggroList.begin(); it != m_AggroList.end(); ++it) { - if ((*it)->isAlive()) + if ((*it)->IsAlive()) (*it)->MonsterYell("Looks like Skarr has found his next challenger! Wouldn't want to be in that poor fool's shoes!"); } m_bAggro = true; @@ -525,12 +525,12 @@ struct SkarrTheUnbreakableAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCleave_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleave_Timer = urand(7000,10000); } else @@ -538,7 +538,7 @@ struct SkarrTheUnbreakableAI : public ScriptedAI if (m_uiMortalStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrike_Timer = urand(9000, 15000); } else @@ -546,7 +546,7 @@ struct SkarrTheUnbreakableAI : public ScriptedAI if (m_uiKnockdown_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKDOWN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKDOWN) == CAST_OK) m_uiKnockdown_Timer = urand(10000, 13000); } else @@ -720,7 +720,7 @@ struct npc_captured_sprite_darterAI : public ScriptedAI void JustDied(Unit* /*pWho*/) override { - if (m_creature->isDead()) + if (m_creature->IsDead()) { if (Creature * pKindal = m_creature->GetMap()->GetCreature(m_uiKindalGUID)) { @@ -734,7 +734,7 @@ struct npc_captured_sprite_darterAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (!m_uiKindalGUID || !m_uiGateGUID) return; @@ -793,11 +793,11 @@ struct npc_captured_sprite_darterAI : public ScriptedAI return; } - if (m_creature->getVictim()->getPowerType() == POWER_MANA) + if (m_creature->GetVictim()->GetPowerType() == POWER_MANA) { if (m_uiManaBurnTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MANA_BURN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MANA_BURN) == CAST_OK) m_uiManaBurnTimer = urand(7000, 10000); } else diff --git a/src/scripts/kalimdor/moonglade/boss_omen.cpp b/src/scripts/kalimdor/moonglade/boss_omen.cpp index 544b19745..ce50726a7 100644 --- a/src/scripts/kalimdor/moonglade/boss_omen.cpp +++ b/src/scripts/kalimdor/moonglade/boss_omen.cpp @@ -22,12 +22,12 @@ void boss_omenAI::Reset() void boss_omenAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCleaveTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(8000, 12000); } else diff --git a/src/scripts/kalimdor/moonglade/moonglade.cpp b/src/scripts/kalimdor/moonglade/moonglade.cpp index 2e0f74724..de21baf02 100644 --- a/src/scripts/kalimdor/moonglade/moonglade.cpp +++ b/src/scripts/kalimdor/moonglade/moonglade.cpp @@ -46,7 +46,7 @@ enum bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) { - if (pPlayer->getClass() != CLASS_DRUID) + if (pPlayer->GetClass() != CLASS_DRUID) pPlayer->SEND_GOSSIP_MENU(4916, pCreature->GetGUID()); else if (pPlayer->GetTeam() != HORDE) { @@ -55,7 +55,7 @@ bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + else if (pPlayer->GetClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -74,7 +74,7 @@ bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, u case GOSSIP_ACTION_INFO_DEF + 1: pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + if (pPlayer->GetClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE, 0, true); break; @@ -147,7 +147,7 @@ bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, ui bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) { - if (pPlayer->getClass() != CLASS_DRUID) + if (pPlayer->GetClass() != CLASS_DRUID) pPlayer->SEND_GOSSIP_MENU(4913, pCreature->GetGUID()); else if (pPlayer->GetTeam() != ALLIANCE) { @@ -156,7 +156,7 @@ bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + else if (pPlayer->GetClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); @@ -175,7 +175,7 @@ bool GossipSelect_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature, uint case GOSSIP_ACTION_INFO_DEF + 1: pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + if (pPlayer->GetClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY, 0, true); break; @@ -508,7 +508,7 @@ struct npc_keeper_remulosAI : public npc_escortAI m_creature->SetWalk(true); break; case 1: - m_creature->setFaction(1254); //Alita stop Remulos from healing shades. + m_creature->SetFactionTemplateId(1254); //Alita stop Remulos from healing shades. //1254 is a cenarian circle faction(609), belonging to group 1, has group 8 as ennemies, and is friendly with other cenarian circle guys DoScriptText(SAY_REMULOS_INTRO_2, m_creature); break; @@ -730,7 +730,7 @@ struct npc_keeper_remulosAI : public npc_escortAI } // Combat spells - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiHealTimer < uiDiff) @@ -1211,7 +1211,7 @@ struct boss_eranikusAI : public ScriptedAI // redeem eranikus m_uiEventTimer = 5000; - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); } else @@ -1259,7 +1259,7 @@ struct boss_eranikusAI : public ScriptedAI m_creature->GetRandomPoint(aTyrandeLocations[1].m_fX, aTyrandeLocations[1].m_fY, aTyrandeLocations[1].m_fZ, 10.0f, fX, fY, fZ); //pSummoned->GetMotionMaster()->MovePoint(POINT_ID_TYRANDE_HEAL, fX, fY, fZ); pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ, MOVE_PATHFINDING | MOVE_RUN_MODE); - pSummoned->setFaction(495);//Alita : works out ^^'. 495 is an escort faction + pSummoned->SetFactionTemplateId(495);//Alita : works out ^^'. 495 is an escort faction break; } } @@ -1409,19 +1409,19 @@ struct boss_eranikusAI : public ScriptedAI } // Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Alita : make sure he prefers targets he can hit. TO REMOVE WHEN AGGRO MECANICS WILL DO THE JOB. - Unit* pTarget = m_creature->getVictim(); + Unit* pTarget = m_creature->GetVictim(); if (!m_creature->IsWithinMeleeRange(pTarget)) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { if (Unit* pAttacker = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) if (m_creature->IsWithinMeleeRange(pAttacker)) - m_creature->getThreatManager().modifyThreatPercent(pAttacker, 5); + m_creature->GetThreatManager().modifyThreatPercent(pAttacker, 5); } } // Move Tyrande after she is summoned diff --git a/src/scripts/kalimdor/mulgore/mulgore.cpp b/src/scripts/kalimdor/mulgore/mulgore.cpp index a41437429..401e7b8d5 100644 --- a/src/scripts/kalimdor/mulgore/mulgore.cpp +++ b/src/scripts/kalimdor/mulgore/mulgore.cpp @@ -33,7 +33,7 @@ EndContentData */ bool GossipHello_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (!pPlayer->GetQuestRewardStatus(770)) @@ -78,7 +78,7 @@ struct plainVisionAI : public npc_escortAI Start(false, 0, nullptr, false); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp b/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp index 4275d6ec2..5fbf18f85 100644 --- a/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp +++ b/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp @@ -98,7 +98,7 @@ struct npc_shenthulAI : public ScriptedAI else Salute_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -122,7 +122,7 @@ bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, const Quest* bool GossipHello_npc_eitrigg(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(4941) == QUEST_STATUS_INCOMPLETE) 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 75e539f87..e8506725c 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ayamiss.cpp @@ -127,13 +127,13 @@ struct boss_ayamissAI : public ScriptedAI GetCreatureListWithEntryInGrid(GardiensListe, m_creature, NPC_HIVEZARA_HORNET, 300.0f); for (std::list::iterator itr = GardiensListe.begin(); itr != GardiensListe.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) (*itr)->AddObjectToRemoveList(); } GetCreatureListWithEntryInGrid(GardiensListe, m_creature, NPC_HIVEZARA_SWARMER, 300.0f); for (std::list::iterator itr = GardiensListe.begin(); itr != GardiensListe.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) (*itr)->AddObjectToRemoveList(); } @@ -163,8 +163,8 @@ struct boss_ayamissAI : public ScriptedAI // DoTeleportPlayer(pCaster, -9717.2, 1517.81, 27.4683, pCaster->GetOrientation()); m_uiSacrificeGuid = pCaster->GetObjectGuid(); - m_fSacrificeAggro = m_creature->getThreatManager().getThreat(pCaster); - m_creature->getThreatManager().modifyThreatPercent(pCaster, -100); + m_fSacrificeAggro = m_creature->GetThreatManager().getThreat(pCaster); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -100); m_bPhaseTwoBeforeTeleport = m_bIsInPhaseTwo; } } @@ -176,7 +176,7 @@ struct boss_ayamissAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_bRelocated && m_uiRelocate_Timer < uiDiff && !m_bIsInPhaseTwo) @@ -198,18 +198,18 @@ struct boss_ayamissAI : public ScriptedAI if (!m_bIsInPhaseTwo && ((m_creature->GetHealth() * 100) / m_creature->GetMaxHealth()) < 70) { SetCombatMovement(true); - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); - m_creature->AttackerStateUpdate(m_creature->getVictim(), BASE_ATTACK, true); - m_creature->addUnitState(UNIT_STAT_IGNORE_PATHFINDING); //pathfinding desactivation + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); + m_creature->AttackerStateUpdate(m_creature->GetVictim(), BASE_ATTACK, true); + m_creature->AddUnitState(UNIT_STAT_IGNORE_PATHFINDING); //pathfinding desactivation m_bIsInPhaseTwo = true; /** Aggro list reset */ - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = tList.begin(); i != tList.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()); if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - m_creature->getThreatManager().modifyThreatPercent(pUnit, -100); + m_creature->GetThreatManager().modifyThreatPercent(pUnit, -100); } } @@ -235,7 +235,7 @@ struct boss_ayamissAI : public ScriptedAI std::list SwarmerList; GetCreatureListWithEntryInGrid(SwarmerList, m_creature, NPC_HIVEZARA_SWARMER, 300.0f); for (std::list::iterator itr = SwarmerList.begin(); itr != SwarmerList.end(); ++itr) - (*itr)->addUnitState(UNIT_STAT_IGNORE_PATHFINDING); + (*itr)->AddUnitState(UNIT_STAT_IGNORE_PATHFINDING); m_uiSummonSwarmer_Timer = 60000; } @@ -268,8 +268,8 @@ struct boss_ayamissAI : public ScriptedAI { if (!m_bPhaseTwoBeforeTeleport) if (Player* player = m_creature->GetMap()->GetPlayer(m_uiSacrificeGuid)) - if (player->isAlive()) - m_creature->getThreatManager().addThreatDirectly(player, m_fSacrificeAggro); + if (player->IsAlive()) + m_creature->GetThreatManager().addThreatDirectly(player, m_fSacrificeAggro); m_uiSacrificeGuid.Clear(); m_fSacrificeAggro = 0; } @@ -281,7 +281,7 @@ struct boss_ayamissAI : public ScriptedAI { if (m_uiPoisonStinger_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_POISONSTINGER) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_POISONSTINGER) == CAST_OK) m_uiPoisonStinger_Timer = 3000; } else @@ -289,7 +289,7 @@ struct boss_ayamissAI : public ScriptedAI if (m_uiStingerSpray_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STINGERSPRAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STINGERSPRAY) == CAST_OK) m_uiStingerSpray_Timer = urand(10000, 15000); } else @@ -300,7 +300,7 @@ struct boss_ayamissAI : public ScriptedAI { if (m_uiStingerSpray_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STINGERSPRAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STINGERSPRAY) == CAST_OK) m_uiStingerSpray_Timer = urand(10000, 15000); } else @@ -308,7 +308,7 @@ struct boss_ayamissAI : public ScriptedAI if (m_uiLash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_LASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_LASH) == CAST_OK) m_uiLash_Timer = 10000 + rand() % 10000; } else @@ -316,7 +316,7 @@ struct boss_ayamissAI : public ScriptedAI if (m_uiTrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) m_uiTrash_Timer = 10000 + rand() % 10000; } else @@ -389,7 +389,7 @@ struct mob_zara_larvaAI : public ScriptedAI ++m_waypoint; m_victim = i->getSource(); m_creature->AI()->AttackStart(m_victim); - m_creature->getThreatManager().addThreat(m_victim, 5000000000); + m_creature->GetThreatManager().addThreat(m_victim, 5000000000); } else if (m_victim) { diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp index 17c97b2b4..1bf4529b2 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_buru.cpp @@ -146,7 +146,7 @@ struct boss_buruAI : public ScriptedAI if (Creature* egg = m_creature->SummonCreature(NPC_BURU_EGG, Eggs[i].x, Eggs[i].y, Eggs[i].z, 0)) m_eggsGUID[i] = egg->GetGUID(); } - else if (!egg->isAlive()) + else if (!egg->IsAlive()) { if (m_uiRespawnEgg_Timer[i] < uiDiff) { @@ -178,7 +178,7 @@ struct boss_buruAI : public ScriptedAI } m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Si il n'est pas enrage et qu'il n'a plus de threat list, il choisi une personne a focus au hasard @@ -206,8 +206,8 @@ struct boss_buruAI : public ScriptedAI m_creature->RemoveAurasDueToSpell(SPELL_GAIN_SPEED); m_creature->UpdateSpeed(MOVE_RUN, true, 1.0f); - if (m_creature->getVictim()) - m_creature->SetFacingToObject(m_creature->getVictim()); + if (m_creature->GetVictim()) + m_creature->SetFacingToObject(m_creature->GetVictim()); // Despawn des oeufs lors de l'enrage for (int i = 0 ; i < 6 ; i++) @@ -221,18 +221,18 @@ struct boss_buruAI : public ScriptedAI } } } - else if (m_creature->getThreatManager().getThreat(m_creature->getVictim()) < (THREAT_LOCK / 1000)) + else if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim()) < (THREAT_LOCK / 1000)) { uint64 GUIDs[40]; for (int i = 0; i < 40; i++) GUIDs[i] = 0; int var = 0; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Player* pPlayer = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid()); - if (pPlayer && pPlayer->isAlive()) + if (pPlayer && pPlayer->IsAlive()) { GUIDs[var] = (*itr)->getUnitGuid(); ++var; @@ -247,7 +247,7 @@ struct boss_buruAI : public ScriptedAI DoScriptText(EMOTE_TARGET, m_creature, pTarget); // Pour verouiller la cible, on applique une menace tres elevee - m_creature->getThreatManager().addThreat(pTarget, THREAT_LOCK); + m_creature->GetThreatManager().addThreat(pTarget, THREAT_LOCK); m_creature->RemoveAurasDueToSpell(SPELL_GAIN_SPEED); m_creature->UpdateSpeed(MOVE_RUN, true, 0.5f); @@ -260,7 +260,7 @@ struct boss_buruAI : public ScriptedAI // Dismember - A stacking bleed effect that does 1248 damage every 2 second. Buru will use this if he catches up to whoever he is targeting. if (m_uiDismember_Timer < uiDiff && !m_bIsEnraged) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISMEMBER) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISMEMBER) == CAST_OK) m_uiDismember_Timer = 6000; } else @@ -326,7 +326,7 @@ struct mob_buru_eggAI : public ScriptedAI // Aggro de Buru quand on tape un oeuf if (Creature* pBuru = m_pInstance->GetCreature(m_pInstance->GetData64(DATA_BURU))) { - if (!pBuru->isInCombat()) + if (!pBuru->IsInCombat()) pBuru->SetInCombatWithZone(); } } @@ -348,9 +348,9 @@ struct mob_buru_eggAI : public ScriptedAI // Si Buru est a portee, il inflige des degats a celui-ci et changement de cible if (Creature* pBuru = m_pInstance->GetCreature(m_pInstance->GetData64(DATA_BURU))) { - if (pBuru->isAlive() && pBuru->GetDistance2d(m_creature) < 5.0f && pBuru->GetHealthPercent() >= 20) + if (pBuru->IsAlive() && pBuru->GetDistance2d(m_creature) < 5.0f && pBuru->GetHealthPercent() >= 20) { - pBuru->getThreatManager().modifyThreatPercent(pBuru->getVictim(), -100); + pBuru->GetThreatManager().modifyThreatPercent(pBuru->GetVictim(), -100); pBuru->SetHealth(pBuru->GetHealth() - 45000); } diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp index 8b9abb0c3..30affa7be 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_kurinnaxx.cpp @@ -91,7 +91,7 @@ struct boss_kurinnaxxAI : public ScriptedAI { if (!m_bHasEnraged && ((m_creature->GetHealth() * 100) / m_creature->GetMaxHealth()) <= 30 && !m_creature->IsNonMeleeSpellCasted(false)) { - DoCast(m_creature->getVictim(), SPELL_ENRAGE); + DoCast(m_creature->GetVictim(), SPELL_ENRAGE); m_bHasEnraged = true; } } @@ -110,13 +110,13 @@ struct boss_kurinnaxxAI : public ScriptedAI else m_uiCleanSandTrap_Timer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; /* Moral wound */ if (m_uiMortalWound_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTALWOUND) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTALWOUND) == CAST_OK) m_uiMortalWound_Timer = 9000; } else @@ -139,7 +139,7 @@ struct boss_kurinnaxxAI : public ScriptedAI /* WideSlash */ if (m_uiWideSlash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WIDE_SLASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WIDE_SLASH) == CAST_OK) m_uiWideSlash_Timer = 10000 + (rand() % 10000); } else @@ -166,7 +166,7 @@ struct boss_kurinnaxxAI : public ScriptedAI /* Trash */ if (m_uiTrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) m_uiTrash_Timer = 10000 + (rand() % 10000); } else diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp index 4aecad2de..3894f5091 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_moam.cpp @@ -109,7 +109,7 @@ struct boss_moamAI : public ScriptedAI { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_TOPAGGRO, 0)) { - if (pTarget->isAlive()) + if (pTarget->IsAlive()) { pSummoned->AI()->AttackStart(pTarget); if (pSummoned->GetEntry() == NPC_MANA_FIEND) @@ -119,7 +119,7 @@ struct boss_moamAI : public ScriptedAI } } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { pSummoned->AddObjectToRemoveList(); return; @@ -133,14 +133,14 @@ struct boss_moamAI : public ScriptedAI Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { - if (i->getSource()->isAlive() && i->getSource()->getPowerType() == POWER_MANA) + if (i->getSource()->IsAlive() && i->getSource()->GetPowerType() == POWER_MANA) PlayerList.push_back(i->getSource()); } } void UpdateAI(const uint32 uiDiff) override { - if ((!m_creature->SelectHostileTarget() || !m_creature->getVictim()) && !m_creature->HasAura(SPELL_ENERGIZE)) + if ((!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) && !m_creature->HasAura(SPELL_ENERGIZE)) return; // Once Moam got 100% mana, take back last target and launch arcane eruption @@ -159,7 +159,7 @@ struct boss_moamAI : public ScriptedAI m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0); m_creature->RemoveAurasDueToSpell(SPELL_ENERGIZE); - DoCast(m_creature->getVictim(), SPELL_ARCANEERUPTION); + DoCast(m_creature->GetVictim(), SPELL_ARCANEERUPTION); DoScriptText(EMOTE_MANA_FULL, m_creature); m_creature->SetArmor(m_uiArmorValue); } @@ -171,7 +171,7 @@ struct boss_moamAI : public ScriptedAI // Cast arcane eruption spell if not in energize mode and if mana is at 100% if (m_creature->GetPower(POWER_MANA) == m_creature->GetMaxPower(POWER_MANA)) { - DoCast(m_creature->getVictim(), SPELL_ARCANEERUPTION); + DoCast(m_creature->GetVictim(), SPELL_ARCANEERUPTION); DoScriptText(EMOTE_MANA_FULL, m_creature); } @@ -198,7 +198,7 @@ struct boss_moamAI : public ScriptedAI m_uiSummonManaFiend_Timer = 90000; m_uiTurnBackFromStone_Timer = 90000; - m_OGvictim = m_creature->getVictim()->GetObjectGuid(); /** Memorize actual target to take it back, + m_OGvictim = m_creature->GetVictim()->GetObjectGuid(); /** Memorize actual target to take it back, once the end of SPELL_ENERGIZE */ m_creature->AttackStop(); DoScriptText(EMOTE_DRAIN, m_creature); @@ -211,7 +211,7 @@ struct boss_moamAI : public ScriptedAI //m_uiTrample_Timer if (m_uiTrample_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRAMPLE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRAMPLE) == CAST_OK) m_uiTrample_Timer = 10000; } else @@ -228,7 +228,7 @@ struct boss_moamAI : public ScriptedAI Player *Plr = 0; if ((Plr = PlayerList[Rand])) { - if (Plr->isAlive()) + if (Plr->IsAlive()) { m_uiDrainCount++; uint32 Mana = Plr->GetPower(POWER_MANA); diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ossirian.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ossirian.cpp index 9ce51f6b0..35f1f003d 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ossirian.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_ossirian.cpp @@ -137,9 +137,9 @@ struct boss_ossirianAI : public ScriptedAI { if (pSpell->Id == SPELL_ENVELOPING_WINDS) { - TmpThreatVal.push_back(m_creature->getThreatManager().getThreat(pCaster)); + TmpThreatVal.push_back(m_creature->GetThreatManager().getThreat(pCaster)); TmpThreatList.push_back(pCaster->GetObjectGuid()); - m_creature->getThreatManager().modifyThreatPercent(pCaster, -100); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -100); } } @@ -180,7 +180,7 @@ struct boss_ossirianAI : public ScriptedAI { pCreature->CastSpell(pCreature, SPELL_SANDSTORM, true); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->AI()->AttackStart(m_creature->getVictim()); + pCreature->AI()->AttackStart(m_creature->GetVictim()); TornadoGUIDs.push_back(pCreature->GetGUID()); } } @@ -223,12 +223,12 @@ struct boss_ossirianAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCurseOfTongues_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSE_OF_TONGUES) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CURSE_OF_TONGUES) == CAST_OK) m_uiCurseOfTongues_Timer = 10000 + rand() % 10000; } else @@ -260,7 +260,7 @@ struct boss_ossirianAI : public ScriptedAI if (m_uiEnvelopingWinds_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ENVELOPING_WINDS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ENVELOPING_WINDS) == CAST_OK) m_uiEnvelopingWinds_Timer = 15000; } else @@ -273,11 +273,11 @@ struct boss_ossirianAI : public ScriptedAI { if (Unit* unit = m_creature->GetMap()->GetUnit(TmpThreatList[i])) { - if (unit->isAlive()) + if (unit->IsAlive()) { if (unit->HasAura(SPELL_ENVELOPING_WINDS)) continue; - m_creature->getThreatManager().addThreat(unit, TmpThreatVal[i]); + m_creature->GetThreatManager().addThreat(unit, TmpThreatVal[i]); } } TmpThreatList.erase(TmpThreatList.begin() + i); @@ -375,7 +375,7 @@ struct ossirian_crystalAI : public GameObjectAI } // Encounter not started - if (!ossirian->SelectHostileTarget() || !ossirian->getVictim()) + if (!ossirian->SelectHostileTarget() || !ossirian->GetVictim()) return true; Creature* triggerCrystalPylons = me->SummonCreature(CRYSTAL_TRIGGER, diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp index 7b2e63ddf..99befe544 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp @@ -88,7 +88,7 @@ struct RespawnAndEvadeHelper explicit RespawnAndEvadeHelper(Creature* _pCreature) : pCreature(_pCreature) {} void operator()() const { - if (!pCreature->isAlive()) + if (!pCreature->IsAlive()) pCreature->Respawn(); pCreature->AI()->EnterEvadeMode(); } @@ -128,7 +128,7 @@ struct boss_rajaxxAI : public ScriptedAI m_uiNextWave_Timer = 0; m_uiNextWaveIndex = 0; - if (m_pInstance && m_creature->isAlive()) + if (m_pInstance && m_creature->IsAlive()) { for (uint8 waveIndex = 0; waveIndex < WAVE_MAX; ++waveIndex) ResetWave(waveIndex); @@ -138,7 +138,7 @@ struct boss_rajaxxAI : public ScriptedAI void ResetWave(uint8 waveIndex) { - if (!m_pInstance || !m_creature->isAlive()) + if (!m_pInstance || !m_creature->IsAlive()) return; if (waveIndex >= WAVE_MAX) return; @@ -163,7 +163,7 @@ struct boss_rajaxxAI : public ScriptedAI uint64 leaderGUID = GetLeaderGuidFromWaveIndex(waveInd); if (Creature* pLeader = m_pInstance->GetCreature(leaderGUID)) { - if (pLeader->isAlive()) + if (pLeader->IsAlive()) pLeader->SetInCombatWithZone(); } } @@ -251,7 +251,7 @@ struct boss_rajaxxAI : public ScriptedAI void KilledUnit(Unit *pKilled) override { -// if (!m_creature->isInCombat()) +// if (!m_creature->IsInCombat()) // DoScriptText(SAY_DEAGGRO, m_creature, pKilled); } @@ -294,7 +294,7 @@ struct boss_rajaxxAI : public ScriptedAI return; int alive = 0; for (auto it : helpers) - if (it->isAlive()) ++alive; + if (it->IsAlive()) ++alive; if (Player* pLootRecepient = m_creature->GetLootRecipient()) { if (Group* pGroup = pLootRecepient->GetGroup()) { @@ -347,16 +347,16 @@ struct boss_rajaxxAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // ThunderCrash if (m_uiThunderCrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCRASH) == CAST_OK) { m_uiThunderCrash_Timer = urand(18000, 22000); - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); if (Unit* victim = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) m_creature->AI()->AttackStart(victim); } @@ -368,8 +368,8 @@ struct boss_rajaxxAI : public ScriptedAI if (m_uiResetAggro_Timer < uiDiff) { m_uiResetAggro_Timer = urand(15000, 17000); - DoScriptText(SAY_DEAGGRO, m_creature, m_creature->getVictim()); - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + DoScriptText(SAY_DEAGGRO, m_creature, m_creature->GetVictim()); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); } else m_uiResetAggro_Timer -= uiDiff; @@ -377,7 +377,7 @@ struct boss_rajaxxAI : public ScriptedAI /* Trash */ if (m_uiTrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) m_uiTrash_Timer = urand(19000, 23000); } else @@ -386,7 +386,7 @@ struct boss_rajaxxAI : public ScriptedAI // Disarm if (m_uiDisarm_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISARM) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DISARM) == CAST_OK) m_uiDisarm_Timer = 15000; } else @@ -448,7 +448,7 @@ struct npc_andorovAI : public ScriptedAI if (Creature* pRajaxx = m_pInstance->GetCreature(m_pInstance->GetData64(DATA_RAJAXX))) { - if (pRajaxx->isAlive()) + if (pRajaxx->IsAlive()) DoScriptText(SAY_KILLS_ANDOROV, pRajaxx); } @@ -516,13 +516,13 @@ struct npc_andorovAI : public ScriptedAI m_pInstance->GetData(TYPE_GENERAL_ANDOROV) == NOT_STARTED) StartEvent(); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Bash if (m_uiBash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_BASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BASH) == CAST_OK) m_uiBash_Timer = 30000; } else @@ -531,7 +531,7 @@ struct npc_andorovAI : public ScriptedAI // Strike if (m_uiStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE) == CAST_OK) m_uiStrike_Timer = 15000; } else diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp index c292daa19..5c6c09476 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp @@ -212,7 +212,7 @@ void instance_ruins_of_ahnqiraj::OnCreatureEvade(Creature* pCreature) case NPC_KALDOREI_ELITE: if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) { - if (pAndorov->isInCombat()) + if (pAndorov->IsInCombat()) { pCreature->AddThreatsOf(pAndorov); break; @@ -597,14 +597,14 @@ void instance_ruins_of_ahnqiraj::SetAndorovSquadRespawnTime(uint32 nextRespawnDe { if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) { - if (!pAndorov->isAlive()) + if (!pAndorov->IsAlive()) pAndorov->SetRespawnTime(nextRespawnDelay); } for (std::list::iterator it = m_lKaldoreiElites.begin(); it != m_lKaldoreiElites.end(); ++it) { if (Creature* pElite = instance->GetCreature(*it)) { - if (!pElite->isAlive()) + if (!pElite->IsAlive()) pElite->SetRespawnTime(nextRespawnDelay); } } @@ -614,14 +614,14 @@ void instance_ruins_of_ahnqiraj::SetAndorovSquadFaction(uint32 faction) { if (Creature* pAndorov = instance->GetCreature(m_uiAndorovGUID)) { - pAndorov->setFaction(faction); + pAndorov->SetFactionTemplateId(faction); pAndorov->SetPvP(true); } for (std::list::iterator it = m_lKaldoreiElites.begin(); it != m_lKaldoreiElites.end(); ++it) { if (Creature* pElite = instance->GetCreature(*it)) { - pElite->setFaction(faction); + pElite->SetFactionTemplateId(faction); pElite->SetPvP(true); } } diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/npc_sandstalker.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/npc_sandstalker.cpp index 20993904b..f24ab518b 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/npc_sandstalker.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/npc_sandstalker.cpp @@ -42,7 +42,7 @@ struct npc_sandstalkerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->isInCombat()) + if (!m_creature->IsInCombat()) EnterVanish(); if (m_uiBurrow_Timer < uiDiff) diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp index 73ffba8f0..376bac1dc 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp @@ -105,7 +105,7 @@ struct mob_anubisath_guardianAI : public ScriptedAI void JustSummoned(Creature* pSummoned) override { - pSummoned->AI()->AttackStart(m_creature->getVictim()); + pSummoned->AI()->AttackStart(m_creature->GetVictim()); ++m_uiSummonCount; } @@ -120,7 +120,7 @@ struct mob_anubisath_guardianAI : public ScriptedAI { if (m_uiSpell4 == SPELL_ENRAGE) { - DoCast(m_creature->getVictim(), m_uiSpell4); + DoCast(m_creature->GetVictim(), m_uiSpell4); DoScriptText(EMOTE_FRENZY, m_creature); m_bIsEnraged = true; } @@ -135,7 +135,7 @@ struct mob_anubisath_guardianAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiExplode_Timer < uiDiff && m_bIsExploding == true) @@ -167,7 +167,7 @@ struct mob_anubisath_guardianAI : public ScriptedAI if (m_uiSpell2_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), m_uiSpell2) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), m_uiSpell2) == CAST_OK) m_uiSpell2_Timer = 15000; } else @@ -220,7 +220,7 @@ struct OssirianTornadoAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -299,7 +299,7 @@ struct mob_flesh_hunterAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiPoisonBolt_Timer < uiDiff) @@ -339,7 +339,7 @@ struct mob_flesh_hunterAI : public ScriptedAI //m_creature->GetMotionMaster()->MoveCaster(pConsumeTarget, 320.0f); m_creature->GetMotionMaster()->Initialize(); m_creature->StopMoving(); - m_creature->getThreatManager().modifyThreatPercent(pConsumeTarget, -100); + m_creature->GetThreatManager().modifyThreatPercent(pConsumeTarget, -100); m_uiConsumeDamage_Timer = 1000; m_bPlayerConsumedCharged = true; pConsumeTarget->SetHealth(pConsumeTarget->GetHealth() - pConsumeTarget->GetMaxHealth() / 10.0f); @@ -348,7 +348,7 @@ struct mob_flesh_hunterAI : public ScriptedAI else m_uiConsumeDamage_Timer -= uiDiff; - if (!pConsumeTarget->isAlive()) + if (!pConsumeTarget->IsAlive()) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) m_creature->GetMotionMaster()->MoveChase(pTarget); @@ -357,12 +357,12 @@ struct mob_flesh_hunterAI : public ScriptedAI } else { - if (pConsumeTarget->isAlive() && m_bPlayerConsumedCharged) + if (pConsumeTarget->IsAlive() && m_bPlayerConsumedCharged) { if (DoCastSpellIfCan(pConsumeTarget, SPELL_SPLIT) == CAST_OK) { m_bPlayerConsumedCharged = false; - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); } } } @@ -370,7 +370,7 @@ struct mob_flesh_hunterAI : public ScriptedAI if (m_uiTrash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRASH) == CAST_OK) m_uiTrash_Timer = 5000 + rand() % 2000; } else @@ -428,14 +428,14 @@ struct ObsidianDestroyerAI : public ScriptedAI Map::PlayerList const &liste = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = liste.begin(); i != liste.end(); ++i) { - if (i->getSource()->isAlive() && i->getSource()->getPowerType() == POWER_MANA) + if (i->getSource()->IsAlive() && i->getSource()->GetPowerType() == POWER_MANA) PlayerList.push_back(i->getSource()->GetObjectGuid()); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //m_uiDrainMana_Timer @@ -449,7 +449,7 @@ struct ObsidianDestroyerAI : public ScriptedAI Player *Plr = m_creature->GetMap()->GetPlayer(PlayerList[Rand]); if (Plr) { - if (Plr->isAlive()) + if (Plr->IsAlive()) { m_uiDrainCount++; uint32 Mana = Plr->GetPower(POWER_MANA); @@ -517,7 +517,7 @@ struct HiveZaraSoldierAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiVenomSpit_Timer < uiDiff) @@ -563,7 +563,7 @@ struct SilicateFeederAI : public ScriptedAI void Reset() override { - m_creature->setFaction(7); + m_creature->SetFactionTemplateId(7); m_bIsAttacked = false; } @@ -574,12 +574,12 @@ struct SilicateFeederAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_bIsAttacked == false) { - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->SetInCombatWithZone(); m_bIsAttacked = true; } @@ -618,12 +618,12 @@ struct QirajiSwarmguardAI : public ScriptedAI if (m_creature->IsWalking()) m_creature->SetWalk(false); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSunder_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDERING_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDERING_CLEAVE) == CAST_OK) m_uiSunder_Timer = urand(8000, 12000); } else @@ -679,7 +679,7 @@ struct QirajiGladiatorAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_pInstance && m_pInstance->GetData(TYPE_QIRAJI_GLADIATOR) > 0 && !m_bIsEnraged) @@ -690,7 +690,7 @@ struct QirajiGladiatorAI : public ScriptedAI if (m_uiTrample_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRAMPLE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TRAMPLE) == CAST_OK) m_uiTrample_Timer = urand(4000, 6000); } else @@ -698,7 +698,7 @@ struct QirajiGladiatorAI : public ScriptedAI if (m_uiUppercut_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT2) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT2) == CAST_OK) m_uiUppercut_Timer = urand(10000, 15000); } else @@ -734,7 +734,7 @@ struct HiveZaraStingerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCharge_Timer < uiDiff) @@ -757,12 +757,12 @@ struct HiveZaraStingerAI : public ScriptedAI if (m_uiChargeCasted_Timer < uiDiff) { m_bChargeCasted = false; - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); + m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); } } } -// m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); +// m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim()); DoMeleeAttackIfReady(); } }; @@ -798,7 +798,7 @@ struct TuubidAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiAttackOrder_Timer < uiDiff) @@ -829,7 +829,7 @@ struct TuubidAI : public ScriptedAI if (m_uiCleave_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE_T) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE_T) == CAST_OK) m_uiCleave_Timer = 10000; } else @@ -877,7 +877,7 @@ struct QirajiWarriorAI : public ScriptedAI m_uiTuubidGuid = pTuubid->GetGUID(); if (Creature* pTuubid = m_creature->GetMap()->GetCreature(m_uiTuubidGuid)) - if (pTuubid->isAlive()) + if (pTuubid->IsAlive()) return CAST_AI(TuubidAI, pTuubid->AI()); return nullptr; } @@ -901,7 +901,7 @@ struct QirajiWarriorAI : public ScriptedAI { if (!m_bHasEnraged && ((m_creature->GetHealth() * 100) / m_creature->GetMaxHealth()) <= 20 && !m_creature->IsNonMeleeSpellCasted(false)) { - DoCast(m_creature->getVictim(), SPELL_ENRAGE_QW); + DoCast(m_creature->GetVictim(), SPELL_ENRAGE_QW); m_bHasEnraged = true; } } @@ -917,7 +917,7 @@ struct QirajiWarriorAI : public ScriptedAI if (!m_creature->SelectHostileTarget()) return; } - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) return; if (m_uiUpdateTarget_Timer < uiDiff) @@ -942,7 +942,7 @@ struct QirajiWarriorAI : public ScriptedAI { if (m_creature->GetDistance2d(m_creature) < 5.0f) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCLAP) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCLAP) == CAST_OK) m_uiThunderclap_Timer = 6000; } } @@ -951,7 +951,7 @@ struct QirajiWarriorAI : public ScriptedAI if (m_uiUppercut_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT) == CAST_OK) m_uiUppercut_Timer = 10000; } else @@ -985,7 +985,7 @@ struct SwarmguardNeedlerAI : public ScriptedAI m_uiTuubidGuid = pTuubid->GetGUID(); if (Creature* pTuubid = m_creature->GetMap()->GetCreature(m_uiTuubidGuid)) - if (pTuubid->isAlive()) + if (pTuubid->IsAlive()) return CAST_AI(TuubidAI, pTuubid->AI()); return nullptr; } @@ -1014,7 +1014,7 @@ struct SwarmguardNeedlerAI : public ScriptedAI if (!m_creature->SelectHostileTarget()) return; } - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) return; if (m_uiUpdateTarget_Timer < uiDiff) @@ -1036,7 +1036,7 @@ struct SwarmguardNeedlerAI : public ScriptedAI if (m_uiCleave_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleave_Timer = 8000; } else diff --git a/src/scripts/kalimdor/silithus/silithus.cpp b/src/scripts/kalimdor/silithus/silithus.cpp index 490150d47..37cc43f93 100644 --- a/src/scripts/kalimdor/silithus/silithus.cpp +++ b/src/scripts/kalimdor/silithus/silithus.cpp @@ -66,7 +66,7 @@ enum bool GossipHello_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(QUEST_EXAMINE_THE_VESSEL) == QUEST_STATUS_NONE && @@ -241,7 +241,7 @@ struct go_pierre_ventsAI: public GameObjectAI void UseFailed(Unit* user) { - if (user->isAlive()) + if (user->IsAlive()) { user->CastSpell(user, SPELL_RED_LIGHTNING, true); user->DealDamage(user, user->GetHealth() > 1000 ? 1000 : user->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); @@ -514,7 +514,7 @@ struct npc_solenorAI : public ScriptedAI /** Solenor the Slayer */ void Aggro(Unit* pWho) override { - if (pWho->getClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) + if (pWho->GetClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) { m_hunterGuid = pWho->GetObjectGuid(); } @@ -531,8 +531,8 @@ struct npc_solenorAI : public ScriptedAI void JustSummoned(Creature* pSummoned) override { - if (m_creature->getVictim()) - pSummoned->AI()->AttackStart(m_creature->getVictim()); + if (m_creature->GetVictim()) + pSummoned->AI()->AttackStart(m_creature->GetVictim()); } void JustDied(Unit* /*pKiller*/) override @@ -561,13 +561,13 @@ struct npc_solenorAI : public ScriptedAI Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 20*MINUTE*IN_MILLISECONDS); if (pCleaner) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); @@ -621,7 +621,7 @@ struct npc_solenorAI : public ScriptedAI { if (m_uiDespawn_Timer <= uiDiff) { - if (m_creature->isAlive() && !m_creature->isInCombat()) + if (m_creature->IsAlive() && !m_creature->IsInCombat()) DemonDespawn(false); } else @@ -640,13 +640,13 @@ struct npc_solenorAI : public ScriptedAI m_uiCastSoulFlame_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->HasAura(SPELL_SOUL_FLAME) && m_creature->HasAura(SPELL_FROST_TRAP)) m_creature->RemoveAurasDueToSpell(SPELL_SOUL_FLAME); - if (m_creature->getThreatManager().getThreatList().size() > 1 /*|| pHunter->isDead()*/) + if (m_creature->GetThreatManager().getThreatList().size() > 1 /*|| pHunter->IsDead()*/) DemonDespawn(); if (m_uiCreepingDoom_Timer < uiDiff) @@ -659,7 +659,7 @@ struct npc_solenorAI : public ScriptedAI if (m_uiDreadfulFright_Timer < uiDiff) { - if (Unit* pUnit = m_creature->getVictim()) + if (Unit* pUnit = m_creature->GetVictim()) { if (m_creature->GetDistance2d(pUnit) > 5.0f) { @@ -759,7 +759,7 @@ struct npc_prince_thunderaanAI : public ScriptedAI return; if (pSpell->Id == SPELL_TENDRILS_OF_AIR) - m_creature->getThreatManager().modifyThreatPercent(pCaster, -100); + m_creature->GetThreatManager().modifyThreatPercent(pCaster, -100); } void Aggro(Unit* pWho) override @@ -779,7 +779,7 @@ struct npc_prince_thunderaanAI : public ScriptedAI emerged = true; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiTendrilsTimer < uiDiff) @@ -878,7 +878,7 @@ struct npc_colossusAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiColossalSmashTimer < uiDiff) @@ -1349,7 +1349,7 @@ struct npc_Emissary_RomankhanAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiSchockTimer < uiDiff) @@ -1408,7 +1408,7 @@ struct npc_Emissary_RomankhanAI : public ScriptedAI if (Unit* pTarget = m_creature->GetMap()->GetUnit(PlayerGuids[i])) { pTarget->SetInCombatWith(m_creature); - if (pTarget->isDead()) + if (pTarget->IsDead()) { // + 2% MP at each death float currMana = m_creature->GetPower(POWER_MANA); @@ -1816,7 +1816,7 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI case NPC_QIRAJI_WASP: case NPC_QIRAJI_DRONE: case NPC_QIRAJI_TANK: - pSummoned->setFaction(14); + pSummoned->SetFactionTemplateId(14); //pSummoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_lQirajiWarriorsList.push_back(pSummoned->GetObjectGuid()); @@ -1838,7 +1838,7 @@ struct npc_anachronos_the_ancientAI : public ScriptedAI break; case NPC_KALDOREI_INFANTRY: - pSummoned->setFaction(1608); + pSummoned->SetFactionTemplateId(1608); m_lQirajiWarriorsList.push_back(pSummoned->GetObjectGuid()); break; } @@ -2711,7 +2711,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI m_bReachedCamp = false; m_uiMoveTimer = 0; m_uiWaypoint = 0; - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); } uint32 m_uiThunderClapTimer; @@ -2734,7 +2734,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI Unit* GetVictimInRangePlayerOnly(float min, float max) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { if (ObjectGuid uiTargetGuid = (*itr)->getUnitGuid()) @@ -2757,7 +2757,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI { if (m_uiWaypoint == HUNTERKILLER_WAYPOINTS_NUMBER) { - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); if (Creature* krug = GetClosestCreatureWithEntry(m_creature, NPC_KRUG_SKULLSPLIT, 50.0f)) AttackStart(krug); @@ -2782,7 +2782,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) @@ -2791,7 +2791,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI // THUNDERCLAP if (m_uiThunderClapTimer <= uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_THUNDERCLAP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_THUNDERCLAP); m_uiThunderClapTimer = 20000; } else @@ -2812,7 +2812,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI // CLEAVE if (m_uiCleaveTimer <= uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE); m_uiCleaveTimer = urand(5000, 12000); } else @@ -2821,7 +2821,7 @@ struct mob_HiveRegal_HunterKillerAI : public ScriptedAI // FEAR if (m_uiFearTimer <= uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FEAR); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FEAR); m_uiFearTimer = urand(58000, 63000); } else @@ -2926,7 +2926,7 @@ struct npc_Krug_SkullSplitAI : public ScriptedAI m_bAlreadyMoved = false; m_uiHunterKillerGUID = pHunterKiller->GetObjectGuid(); InitOtherNPCsGuids(); - pHunterKiller->setFaction(35); + pHunterKiller->SetFactionTemplateId(35); } m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); @@ -3072,7 +3072,7 @@ struct npc_Krug_SkullSplitAI : public ScriptedAI { for (std::list::iterator itr = gruntList.begin(); itr != gruntList.end(); ++itr) { - if ((*itr)->isAlive()) + if ((*itr)->IsAlive()) DoScriptText(SAY_LINE_9, (*itr)); } } @@ -3100,7 +3100,7 @@ struct npc_Krug_SkullSplitAI : public ScriptedAI } /* Start of combat script */ - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -3132,7 +3132,7 @@ bool GossipHello_npc_Krug_SkullSplit(Player* pPlayer, Creature* pCreature) else if ((pPlayer->GetQuestStatus(QUEST_FIELD_DUTY) == QUEST_STATUS_INCOMPLETE) && (eEventStatus == EVENT_COMPLETE)) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } @@ -3175,7 +3175,7 @@ struct npc_MerokAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) @@ -3221,7 +3221,7 @@ struct npc_ShaiAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_creature->IsNonMeleeSpellCasted(false)) @@ -3292,7 +3292,7 @@ struct boss_vamAI : public ScriptedAI void UpdateAI(const uint32 diff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //Charge_Timer 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 bb47e3107..0feb456e6 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 @@ -79,7 +79,7 @@ struct boss_bug_trioAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // The bug trio have a larger than normal aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 60.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 60.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -124,7 +124,7 @@ struct boss_bug_trioAI : public ScriptedAI void TriggerDevour(Unit* pWho) { - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { m_uiDevourTimer = 4000; m_bIsEating = true; @@ -141,21 +141,21 @@ struct boss_bug_trioAI : public ScriptedAI // Force evade all 3 bugs and respawn any that are already dead. We have to do this manually or linked bugs don't evade/respawn on region triggered EnterEvadeMode. if (Creature* pKri = m_pInstance->GetSingleCreatureFromStorage(NPC_KRI)) { - if (pKri->isDead()) + if (pKri->IsDead()) pKri->Respawn(); else pKri->AI()->EnterEvadeMode(); } if (Creature* pYauj = m_pInstance->GetSingleCreatureFromStorage(NPC_PRINCESS_YAUJ)) { - if (pYauj->isDead()) + if (pYauj->IsDead()) pYauj->Respawn(); else pYauj->AI()->EnterEvadeMode(); } if (Creature* pVem = m_pInstance->GetSingleCreatureFromStorage(NPC_VEM)) { - if (pVem->isDead()) + if (pVem->IsDead()) pVem->Respawn(); else pVem->AI()->EnterEvadeMode(); @@ -166,7 +166,7 @@ struct boss_bug_trioAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_bIsEating) @@ -177,9 +177,9 @@ struct boss_bug_trioAI : public ScriptedAI DoResetThreat(); m_bIsEating = false; m_creature->SetHealth(m_creature->GetMaxHealth()); - m_creature->SetTargetGuid(m_creature->getVictim()->GetObjectGuid()); + m_creature->SetTargetGuid(m_creature->GetVictim()->GetObjectGuid()); m_creature->UpdateSpeed(MOVE_RUN, false); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); } else { @@ -237,7 +237,7 @@ struct boss_kriAI : public boss_bug_trioAI // Cleave if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(5000, 12000); } else @@ -352,7 +352,7 @@ struct boss_yaujAI : public boss_bug_trioAI // Ravage if (m_uiRavageTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_RAVAGE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_RAVAGE) == CAST_OK) m_uiRavageTimer = urand(12000, 20000); } else @@ -392,8 +392,8 @@ struct boss_vemAI : public boss_bug_trioAI { if ((pSpell->Id == SPELL_KNOCKBACK) && pTarget->GetTypeId() == TYPEID_PLAYER) { - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -80); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -80); } } @@ -415,9 +415,9 @@ struct boss_vemAI : public boss_bug_trioAI // Knock Away if (m_uiKnockBackTimer < uiDiff) { - if (m_creature->IsWithinMeleeRange(m_creature->getVictim()) && !m_creature->getVictim()->hasUnitState(UNIT_STAT_STUNNED)) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim()) && !m_creature->GetVictim()->HasUnitState(UNIT_STAT_STUNNED)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKBACK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKBACK) == CAST_OK) m_uiKnockBackTimer = urand(10000, 14000); } } @@ -429,7 +429,7 @@ struct boss_vemAI : public boss_bug_trioAI { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_KNOCKDOWN, SELECT_FLAG_IN_MELEE_RANGE)) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKDOWN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKDOWN) == CAST_OK) m_uiKnockdownTimer = urand(15000, 20000); } } 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 2ae5175eb..ec6ffac8b 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_cthun.cpp @@ -235,7 +235,7 @@ static Player* SelectRandomAliveNotStomach(instance_temple_of_ahnqiraj* instance { if (Player* player = itr->getSource()) { - if (!player->isDead() && !player->IsGameMaster() && player->isInCombat() && !instance->PlayerInStomach(player)) { + if (!player->IsDead() && !player->IsGameMaster() && player->IsInCombat() && !instance->PlayerInStomach(player)) { temp.push_back(player); } } @@ -259,7 +259,7 @@ static Unit* selectSelfFunc(Creature* c) { return c; } static Unit* selectTargetFunc(Creature* c) { - return c->getVictim(); + return c->GetVictim(); } // ================== PHASE 1 CONSTANTS ================== @@ -354,7 +354,7 @@ struct cthunTentacle : public ScriptedAI void Reset() override { - m_creature->addUnitState(UNIT_STAT_ROOT); + m_creature->AddUnitState(UNIT_STAT_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); m_creature->SetInCombatWithZone(); @@ -385,7 +385,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_STAT_ROOT); m_creature->StopMoving(); m_creature->SetRooted(true); return true; @@ -413,7 +413,7 @@ struct cthunTentacle : public ScriptedAI // Returns true when the creature has a target. bool SelectHostileTargetMelee() { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return false; // If we're casting something its sort-of counter intuitive to return true, @@ -424,7 +424,7 @@ struct cthunTentacle : public ScriptedAI return true; } - Unit* oldTarget = m_creature->getVictim(); + Unit* oldTarget = m_creature->GetVictim(); Unit* target = nullptr; // First checking if we have some taunt on us @@ -433,14 +433,14 @@ struct cthunTentacle : public ScriptedAI Unit* caster = (*it)->GetCaster(); if (!caster) continue; - if (caster->IsInMap(m_creature) && caster->isTargetableForAttack() && m_creature->CanReachWithMeleeAutoAttack(caster)) + if (caster->IsInMap(m_creature) && caster->IsTargetableForAttack() && m_creature->CanReachWithMeleeAutoAttack(caster)) { target = caster; break; } else { // Target is not in melee and reset his threat - m_creature->getThreatManager().modifyThreatPercent(caster, -100); + m_creature->GetThreatManager().modifyThreatPercent(caster, -100); } } // So far so good. If we have a target after this loop it means we have a valid target in melee range. @@ -450,7 +450,7 @@ struct cthunTentacle : public ScriptedAI { Unit* tmpTarget = nullptr; if (m_creature->CanHaveThreatList()) { - ThreatList const& threatlist = m_creature->getThreatManager().getThreatList(); + ThreatList const& threatlist = m_creature->GetThreatManager().getThreatList(); ThreatList::const_iterator itr = threatlist.begin(); // Implementing this loop manually instead of using Creature::SelectAttackingTarget @@ -458,7 +458,7 @@ struct cthunTentacle : public ScriptedAI // because melee ranges are fucked up. todo: fix melee ranges.... for (; itr != threatlist.end(); ++itr) { if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pTarget->isTargetableForAttack() + if (pTarget->IsTargetableForAttack() && pTarget->CanReachWithMeleeAutoAttack(m_creature) && pTarget->IsWithinLOSInMap(m_creature)) { tmpTarget = pTarget; @@ -471,12 +471,12 @@ struct cthunTentacle : public ScriptedAI // Resetting threat of old target if it has left melee range if (oldTarget && tmpTarget != oldTarget && !oldTarget->CanReachWithMeleeAutoAttack(m_creature)) { //if (oldTarget && tmpTarget != oldTarget && !m_creature->IsWithinMeleeRange(oldTarget)) { - m_creature->getThreatManager().modifyThreatPercent(oldTarget, -100); + m_creature->GetThreatManager().modifyThreatPercent(oldTarget, -100); } if (tmpTarget) { // Need to call getHostileTarget to force an update of the threatlist, bleh - target = m_creature->getThreatManager().getHostileTarget(); + target = m_creature->GetThreatManager().getHostileTarget(); } } @@ -484,7 +484,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_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING) + if (!m_creature->HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_PENDING_STUNNED | UNIT_STAT_DIED | UNIT_STAT_CONFUSED | UNIT_STAT_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); @@ -1051,7 +1051,7 @@ struct eye_of_cthunAI : public ScriptedAI { // Just in case someone manages to get through the AggroRadius logic in C'thuns AI // we make sure the proper pull-sequence is initiated by calling C'thuns attackstart. - if (!m_creature->isInCombat()) { + if (!m_creature->IsInCombat()) { if (Creature* pCthun = m_pInstance->GetSingleCreatureFromStorage(NPC_CTHUN)) { pCthun->AI()->AttackStart(puller); } @@ -1276,7 +1276,7 @@ struct cthunAI : public ScriptedAI void AttackStart(Unit* who) override { - if (!m_creature->isInCombat()) { + if (!m_creature->IsInCombat()) { Creature* pEye = m_pInstance->GetCreature(eyeGuid); if (!pEye) { sLog.outError("cthunAI::AggroRadius could not find pEye"); @@ -1356,14 +1356,14 @@ struct cthunAI : public ScriptedAI } } - //if (m_pInstance && m_creature->isAlive()) + //if (m_pInstance && m_creature->IsAlive()) // m_pInstance->SetData(TYPE_CTHUN, NOT_STARTED); } void CheckRespawnEye() { Creature* pEye = nullptr; - if (m_creature->isDead()) { + if (m_creature->IsDead()) { // Despawning the eye if something weird has happened and C'thun is dead. if (pEye = m_pInstance->GetCreature(eyeGuid)) { pEye->ForcedDespawn(); @@ -1374,7 +1374,7 @@ struct cthunAI : public ScriptedAI // Otherwise attempting to spawn a new eye if (pEye = m_pInstance->GetCreature(eyeGuid)) { eye_of_cthunAI* eyeAI = (eye_of_cthunAI*)pEye->AI(); - if (!pEye->isAlive()) { + if (!pEye->IsAlive()) { pEye->Respawn(); eyeAI->Reset(); // todo: remove if we KNOW that creature::respawn() calls Reset() } @@ -1568,7 +1568,7 @@ struct cthunAI : public ScriptedAI for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive() && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsGameMaster()) { if (UnitShouldPull(pPlayer)) { AttackStart(pPlayer); diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_fankriss.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_fankriss.cpp index a0ea566ff..b84c6f4aa 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_fankriss.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_fankriss.cpp @@ -98,7 +98,7 @@ struct creature_spawn_fankrissAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } @@ -177,7 +177,7 @@ struct creature_vekniss_hatchlingAI : public ScriptedAI if (m_creature->GetDistance(pTarget) > 200) { return; //avoid running after people far off in the instance somewhere } - m_creature->getThreatManager().addThreat(pTarget, 1); + m_creature->GetThreatManager().addThreat(pTarget, 1); AttackStart(pTarget); } @@ -188,7 +188,7 @@ struct creature_vekniss_hatchlingAI : public ScriptedAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } DoMeleeAttackIfReady(); @@ -267,7 +267,7 @@ struct boss_fankrissAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // Fankriss has an extremely large aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 100.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 100.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -425,12 +425,12 @@ struct boss_fankrissAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->isInCombat()) { + if (!m_creature->IsInCombat()) { Map::PlayerList const &PlayerList = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive() && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsGameMaster()) { // cheap way of quickly disgarding the check most of the time. No point // where he can be pulled should be higher than this point (he is at roughly -100) @@ -446,7 +446,7 @@ struct boss_fankrissAI : public ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } @@ -454,7 +454,7 @@ struct boss_fankrissAI : public ScriptedAI // Mortal Wound if (m_uiMortalWoundTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_WOUND) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_WOUND) == CAST_OK) m_uiMortalWoundTimer = urand(4000, 8000); } else diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_huhuran.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_huhuran.cpp index bc16fbe24..ff8e17268 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_huhuran.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_huhuran.cpp @@ -60,8 +60,8 @@ struct boss_huhuranAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { - if (m_creature->canAttack(pWho) - && !m_creature->isInCombat() + if (m_creature->CanAttack(pWho) + && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 80.0f) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { @@ -102,7 +102,7 @@ struct boss_huhuranAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; //m_uiFrenzyTimer @@ -120,7 +120,7 @@ struct boss_huhuranAI : public ScriptedAI // Wyvern Timer if (m_uiWyvernTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WYVERNSTING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WYVERNSTING) == CAST_OK) m_uiWyvernTimer = urand(15000, 32000); } else @@ -129,7 +129,7 @@ struct boss_huhuranAI : public ScriptedAI //Spit Timer if (m_uiSpitTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ACIDSPIT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ACIDSPIT) == CAST_OK) m_uiSpitTimer = urand(5000, 10000); } else 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 18596a28e..eedd956e7 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_ouro.cpp @@ -182,8 +182,8 @@ struct boss_ouroAI : public Scripted_NoMovementAI { if (pSpell->Id == SPELL_SANDBLAST && pTarget) { - if (m_creature->getThreatManager().getThreat(pTarget)) - m_creature->getThreatManager().modifyThreatPercent(pTarget, -100); + if (m_creature->GetThreatManager().getThreat(pTarget)) + m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100); } } @@ -222,20 +222,20 @@ struct boss_ouroAI : public Scripted_NoMovementAI void SetNewTarget(Unit &pNewTarget) { - const uint32 uiMaxThreat = m_creature->getThreatManager().getThreat(m_creature->getVictim()); + const uint32 uiMaxThreat = m_creature->GetThreatManager().getThreat(m_creature->GetVictim()); // erase current target's threat as soon as we switch the target now - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); // give the new target aggro - m_creature->getThreatManager().addThreat(&pNewTarget, uiMaxThreat); + m_creature->GetThreatManager().addThreat(&pNewTarget, uiMaxThreat); } bool CheckForMelee() { // at first we check for the current player-type target - Unit* pMainTarget = m_creature->getVictim(); + Unit* pMainTarget = m_creature->GetVictim(); if (pMainTarget->GetTypeId() == TYPEID_PLAYER && !pMainTarget->ToPlayer()->IsGameMaster() && m_creature->IsWithinMeleeRange(pMainTarget) && m_creature->IsWithinLOSInMap(pMainTarget)) { @@ -272,7 +272,7 @@ struct boss_ouroAI : public Scripted_NoMovementAI void UpdateAI(const uint32 uiDiff) override { // Return since we have no pTarget - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!m_bSubmerged) @@ -299,7 +299,7 @@ struct boss_ouroAI : public Scripted_NoMovementAI // Sand Blast if (m_uiSandBlastTimer < uiDiff) { - auto target = m_creature->getThreatManager().getHostileTarget(); + auto target = m_creature->GetThreatManager().getHostileTarget(); if (target && DoCastSpellIfCan(target, SPELL_SANDBLAST) == CAST_OK) { @@ -348,7 +348,7 @@ struct boss_ouroAI : public Scripted_NoMovementAI } // If we are within range melee the target - if (m_creature->CanReachWithMeleeAutoAttack(m_creature->getVictim())) + if (m_creature->CanReachWithMeleeAutoAttack(m_creature->GetVictim())) { DoMeleeAttackIfReady(); } @@ -391,7 +391,7 @@ struct boss_ouroAI : public Scripted_NoMovementAI m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); std::list lGroundRuptureTargets; - ThreatList const& lThreat = m_creature->getThreatManager().getThreatList(); + ThreatList const& lThreat = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = lThreat.begin(); i != lThreat.end(); ++i) { Unit* pUnit = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()); @@ -524,7 +524,7 @@ struct npc_dirt_moundAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { Unit *pTarget = m_creature->GetMap()->GetUnit(m_CurrentTargetGUID); - const bool bForceChangeTarget = !pTarget || pTarget->isDead() + const bool bForceChangeTarget = !pTarget || pTarget->IsDead() || pTarget->IsImmuneToDamage(SPELL_SCHOOL_MASK_NATURE); if (bForceChangeTarget || m_uiChangeTargetTimer < uiDiff) @@ -576,7 +576,7 @@ struct npc_ouro_scarabAI : public ScriptedAI void MoveInLineOfSight(Unit *who) override { - if (who->GetTypeId() == TYPEID_PLAYER && !m_creature->getVictim() && !urand(0, 5)) + if (who->GetTypeId() == TYPEID_PLAYER && !m_creature->GetVictim() && !urand(0, 5)) { AttackStart(who); } @@ -584,7 +584,7 @@ struct npc_ouro_scarabAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) DoMeleeAttackIfReady(); if (m_uiDespawnTimer < uiDiff) diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_sartura.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_sartura.cpp index bdd3ad3db..7fca6da66 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_sartura.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_sartura.cpp @@ -95,7 +95,7 @@ struct boss_sarturaAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // Sartura has a very large aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 85.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 85.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -143,7 +143,7 @@ struct boss_sarturaAI : public ScriptedAI if (m_creature->IsWithinDist(pTarget, VISIBLE_RANGE)) { DoResetThreat(); - m_creature->getThreatManager().addThreatDirectly(pTarget, urand(1000, 2000)); + m_creature->GetThreatManager().addThreatDirectly(pTarget, urand(1000, 2000)); } } } @@ -156,14 +156,14 @@ struct boss_sarturaAI : public ScriptedAI { if (Creature* pRoyalGuard = m_creature->GetMap()->GetCreature(*itr)) { - if (pRoyalGuard->isDead()) pRoyalGuard->Respawn(); else pRoyalGuard->AI()->EnterEvadeMode(); + if (pRoyalGuard->IsDead()) pRoyalGuard->Respawn(); else pRoyalGuard->AI()->EnterEvadeMode(); } } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiWhirlWindEndTimer) // Is in Whirlwind @@ -185,7 +185,7 @@ struct boss_sarturaAI : public ScriptedAI m_uiAggroResetTimer = urand(3000, 7000); // Remove the negative haste modifier from Whirlwind to restore Sartura's auto attack m_creature->ApplyAttackTimePercentMod(BASE_ATTACK, 0, true); - m_creature->setAttackTimer(BASE_ATTACK, 100); + m_creature->SetAttackTimer(BASE_ATTACK, 100); m_creature->RemoveAurasByCasterSpell(TAUNT_IMMUNE, m_creature->GetObjectGuid()); } else @@ -220,7 +220,7 @@ struct boss_sarturaAI : public ScriptedAI // Sundering Cleave if (m_uiCleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = urand(3000, 4000); } else @@ -310,7 +310,7 @@ struct mob_sartura_royal_guardAI : public ScriptedAI if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { DoResetThreat(); - m_creature->getThreatManager().addThreatDirectly(pTarget, urand(1000, 2000)); + m_creature->GetThreatManager().addThreatDirectly(pTarget, urand(1000, 2000)); } } @@ -318,7 +318,7 @@ struct mob_sartura_royal_guardAI : public ScriptedAI { if (Creature* pSartura = m_pInstance->GetSingleCreatureFromStorage(NPC_BATTLEGUARD_SARTURA)) { - if (pSartura->isAlive()) + if (pSartura->IsAlive()) { pSartura->AI()->EnterEvadeMode(); @@ -328,7 +328,7 @@ struct mob_sartura_royal_guardAI : public ScriptedAI { if (Creature* pRoyalGuard = m_creature->GetMap()->GetCreature(*itr)) { - if (pRoyalGuard->isDead()) pRoyalGuard->Respawn(); else pRoyalGuard->AI()->EnterEvadeMode(); + if (pRoyalGuard->IsDead()) pRoyalGuard->Respawn(); else pRoyalGuard->AI()->EnterEvadeMode(); } } } @@ -337,7 +337,7 @@ struct mob_sartura_royal_guardAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; @@ -389,8 +389,8 @@ struct mob_sartura_royal_guardAI : public ScriptedAI // Knockback if (m_uiKnockbackTimer < uiDiff) { - if(m_creature->IsWithinMeleeRange(m_creature->getVictim())) - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCKBACK) == CAST_OK) + if(m_creature->IsWithinMeleeRange(m_creature->GetVictim())) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCKBACK) == CAST_OK) m_uiKnockbackTimer = urand(8000, 14000); } else @@ -471,7 +471,7 @@ struct mob_vekniss_guardianAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // Increased aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 50.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 50.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -498,7 +498,7 @@ struct mob_vekniss_guardianAI : public ScriptedAI DoCastSpellIfCan(m_creature, SPELL_IMPALE); m_creature->UpdateSpeed(MOVE_RUN, false); - DoStartMovement(m_creature->getVictim()); + DoStartMovement(m_creature->GetVictim()); } void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) override @@ -515,7 +515,7 @@ struct mob_vekniss_guardianAI : public ScriptedAI if ((*itr)->GetObjectGuid() == m_creature->GetObjectGuid()) continue; - if ((*itr)->isAlive() && m_creature->IsWithinLOSInMap((*itr))) + if ((*itr)->IsAlive() && m_creature->IsWithinLOSInMap((*itr))) { if (m_bIsAlone) m_bIsAlone = false; @@ -530,7 +530,7 @@ struct mob_vekniss_guardianAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiEvadeCheckTimer < uiDiff) @@ -538,7 +538,7 @@ struct mob_vekniss_guardianAI : public ScriptedAI m_uiEvadeCheckTimer = 2500; if (m_creature->IsInEvadeMode()) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) m_creature->Relocate(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); } } 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 b8ebe7927..432687d8b 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_skeram.cpp @@ -100,7 +100,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_STAT_ALLOW_INCOMPLETE_PATH | UNIT_STAT_ALLOW_LOS_ATTACK); m_creature->SetMeleeZReach(74.0f); } @@ -118,7 +118,7 @@ struct boss_skeramAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // The bug trio have a larger than normal aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 28.0f, true) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 28.0f, true) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -191,7 +191,7 @@ struct boss_skeramAI : public ScriptedAI m_creature->DoKillUnit(); //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (ArcaneExplosion_Timer < diff) @@ -202,21 +202,21 @@ struct boss_skeramAI : public ScriptedAI if (players.size() > 4) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ARCANE_EXPLOSION) == CAST_OK) ArcaneExplosion_Timer = urand(6000, 14000); } } else ArcaneExplosion_Timer -= diff; //If we are within range, melee the target - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsWithinMeleeRange(m_creature->GetVictim())) DoMeleeAttackIfReady(); else // Target not in melee range. Spam Earthshock { if (EarthShock_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_EARTH_SHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_EARTH_SHOCK) == CAST_OK) EarthShock_Timer = 1000; } else 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 850bbd23c..39f2b8aa6 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_twinemperors.cpp @@ -141,7 +141,7 @@ struct mob_TwinsBug : public ScriptedAI { void GoBeBadBug(uint32 whatKindOfbad) { m_creature->AddAura(whatKindOfbad); - m_creature->setFaction(14); + m_creature->SetFactionTemplateId(14); m_creature->SetInCombatWithZone(); if (whatKindOfbad == SPELL_MUTATE_BUG) { m_creature->SetFullHealth(); @@ -150,13 +150,13 @@ struct mob_TwinsBug : public ScriptedAI { void JustDied(Unit* Killer) override { - m_creature->setFaction(7); + m_creature->SetFactionTemplateId(7); m_creature->RemoveAllAuras(); } void Reset() override { - m_creature->setFaction(7); + m_creature->SetFactionTemplateId(7); m_creature->RemoveAllAuras(); pierceArmorTimer = 5000; acidSpitTimer = 6000; @@ -165,18 +165,18 @@ struct mob_TwinsBug : public ScriptedAI { void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (pierceArmorTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PIERCE_ARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_PIERCE_ARMOR) == CAST_OK) pierceArmorTimer = urand(5000, 9000); } else pierceArmorTimer -= diff; if (acidSpitTimer < diff) { - if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_ACID_SPIT) == CAST_OK) + if(DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ACID_SPIT) == CAST_OK) acidSpitTimer = urand(6000, 12000); } else @@ -238,16 +238,16 @@ struct boss_twinemperorsAI : public ScriptedAI justTeleported = false; didPullDialogue = false; killSayCooldown = 0; - m_creature->clearUnitState(UNIT_STAT_STUNNED); + m_creature->ClearUnitState(UNIT_STAT_STUNNED); } void MoveInLineOfSight(Unit *who) override { // Only want to run this if we are not in combat - if (!who || m_creature->getVictim() || m_creature->isInCombat()) + if (!who || m_creature->GetVictim() || m_creature->IsInCombat()) return; - if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) + if (who->IsTargetableForAttack() && who->IsInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) { float attackRadius = m_creature->GetAttackDistance(who); if (attackRadius < PULL_RANGE) @@ -321,7 +321,7 @@ struct boss_twinemperorsAI : public ScriptedAI for (auto it = lst.begin(); it != lst.end(); it++) { Creature* pC = *it; - if (pC->isDead()) continue; + if (pC->IsDead()) continue; pC->SetActiveObjectState(true); pC->SetInCombatWithZone(); pC->AI()->AttackStart(pWho); @@ -381,7 +381,7 @@ struct boss_twinemperorsAI : public ScriptedAI //todo: any potential issues with using GetNearestVictimInRange and 300 maxrange? if (Unit* closestPlayer = m_creature->GetNearestVictimInRange(0, 300.0f)) { closestTargetAfterTP = closestPlayer->GetGUID(); - m_creature->getThreatManager().addThreat(closestPlayer, AFTER_TELEPORT_THREAT); + m_creature->GetThreatManager().addThreat(closestPlayer, AFTER_TELEPORT_THREAT); } else { sLog.outBasic("Twins unable to select closest target during TP stun"); @@ -397,7 +397,7 @@ struct boss_twinemperorsAI : public ScriptedAI } else { // Not attempting to get a hostile target during teleport-idle - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { return; } } @@ -479,7 +479,7 @@ struct boss_twinemperorsAI : public ScriptedAI std::list::iterator iter; for (iter = lUnitList.begin(); iter != lUnitList.end();) { - if ((*iter)->isDead()) { + if ((*iter)->IsDead()) { iter = lUnitList.erase(iter); } // Ignoring bugs that has already been affected by a spell @@ -531,7 +531,7 @@ struct boss_twinemperorsAI : public ScriptedAI // simply center-to-center Player* GetPlayerInP2PRange(float min, float max, bool skipTopAggro) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); if (tList.size() == 0) return nullptr; @@ -753,7 +753,7 @@ struct boss_veklorAI : public boss_twinemperorsAI UpdateBlizzard(diff); updateArcaneBurst(diff); - Unit* victim = m_creature->getVictim(); + Unit* victim = m_creature->GetVictim(); if (!victim) return; @@ -777,11 +777,11 @@ struct boss_veklorAI : public boss_twinemperorsAI } else if (!m_creature->IsMoving()) { - if(m_creature->getStandState() != UNIT_STAND_STATE_STAND) + if(m_creature->GetStandState() != UNIT_STAND_STATE_STAND) m_creature->SetStandState(UNIT_STAND_STATE_STAND); if (shadowBoltTimer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOWBOLT) == CAST_OK) { timeSinceLastSB = 0; if (isMelee) @@ -854,7 +854,7 @@ struct boss_veknilashAI : public boss_twinemperorsAI { std::list candidates; - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); if (tList.size() < 1) return nullptr; @@ -888,7 +888,7 @@ struct boss_veknilashAI : public boss_twinemperorsAI //UnbalancingStrike_Timer if (UnbalancingStrike_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UNBALANCING_STRIKE) == CAST_OK) { + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UNBALANCING_STRIKE) == CAST_OK) { UnbalancingStrike_Timer = urand(UNBALANCING_STRIKE_MIN_CD, UNBALANCING_STRIKE_MAX_CD); } } 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 0c7af84dc..ed4c6ec06 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/boss_viscidus.cpp @@ -159,7 +159,7 @@ struct mob_viscidus_triggerAI : public ScriptedAI if (!m_spellCasted) { // set faction and flags before toxin cloud, so it won't damage a boss. - m_creature->setFaction(14); // 14 is a hostile faction + m_creature->SetFactionTemplateId(14); // 14 is a hostile faction m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); m_spellCasted = true; @@ -238,7 +238,7 @@ struct boss_viscidusAI : public ScriptedAI void MoveInLineOfSight(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER && !m_creature->getVictim() && m_creature->IsWithinDistInMap(who, 95.0f, true)) + if (who->GetTypeId() == TYPEID_PLAYER && !m_creature->GetVictim() && m_creature->IsWithinDistInMap(who, 95.0f, true)) { AttackStart(who); } @@ -302,7 +302,7 @@ struct boss_viscidusAI : public ScriptedAI DoResetThreat(); m_creature->SetVisibility(VISIBILITY_ON); - m_creature->clearUnitState(UNIT_STAT_DIED); + m_creature->ClearUnitState(UNIT_STAT_DIED); m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiPhase = PHASE_NORMAL; @@ -462,7 +462,7 @@ struct boss_viscidusAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; HackyScaleUpdate(); @@ -503,7 +503,7 @@ struct boss_viscidusAI : public ScriptedAI { if (m_uiRestoreTargetTimer <= uiDiff) { - if (Unit* pTarget = m_creature->getVictim()) + if (Unit* pTarget = m_creature->GetVictim()) { m_creature->SetInFront(pTarget); m_creature->SetTargetGuid(pTarget->GetObjectGuid()); diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp index 8a0199ab2..53ffcebe6 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp @@ -472,7 +472,7 @@ void instance_temple_of_ahnqiraj::UpdateCThunWhisper(uint32 diff) { if (Player* player = itr->getSource()) { - if (!player->isDead()) { + if (!player->IsDead()) { auto find_it = std::find_if(cthunWhisperMutes.begin(), cthunWhisperMutes.end(), [player](const std::pair& e) {return e.first == player->GetObjectGuid(); }); if (find_it == cthunWhisperMutes.end()) { @@ -529,7 +529,7 @@ bool AreaTrigger_at_temple_ahnqiraj(Player* pPlayer, const AreaTriggerEntry* pAt { if (pAt->id == AREATRIGGER_TWIN_EMPERORS || pAt->id == AREATRIGGER_SARTURA) { - if (pPlayer->IsGameMaster() || !pPlayer->isAlive()) + if (pPlayer->IsGameMaster() || !pPlayer->IsAlive()) return false; if (instance_temple_of_ahnqiraj* pInstance = (instance_temple_of_ahnqiraj*)pPlayer->GetInstanceData()) @@ -607,7 +607,7 @@ bool instance_temple_of_ahnqiraj::PlayerInStomach(Unit * unit) void instance_temple_of_ahnqiraj::HandleStomachTriggers(Player * pPlayer, const AreaTriggerEntry * pAt) { if (!pPlayer) return; - if (pPlayer->IsGameMaster() || !pPlayer->isAlive()) + if (pPlayer->IsGameMaster() || !pPlayer->IsAlive()) return; if (pAt->id == AREATRIGGER_STOMACH_GROUND) { @@ -651,7 +651,7 @@ bool instance_temple_of_ahnqiraj::KillPlayersInStomach() continue; } - if (p->isAlive()) { + if (p->IsAlive()) { p->DealDamage(p, p->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } if (p->HasAura(SPELL_DIGESTIVE_ACID)) { @@ -792,14 +792,14 @@ struct AI_QirajiMindslayer : public ScriptedAI { return; // finding closest player and casting manaburn on that target. - // todo: should we add a player->getPowerType() == POWER_MANA check too when choosing valid target? + // todo: should we add a player->GetPowerType() == POWER_MANA check too when choosing valid target? Player* closestPlayer = nullptr; float closestDist = std::numeric_limits::max(); MapRefManager const &list = m_creature->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = list.begin(); i != list.end(); ++i) { if (Player* player = i->getSource()) { - if (player->isAlive()) { + if (player->IsAlive()) { float dist = m_creature->GetDistance(player); if (dist < closestDist) { closestPlayer = player; @@ -816,7 +816,7 @@ struct AI_QirajiMindslayer : public ScriptedAI { void UpdateAI(const uint32 diff) override { if (!m_creature->IsNonMeleeSpellCasted()) { // prevents re-targetting of topaggro from happening while channeling mindflay - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; } diff --git a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp index 1a2d0ac8a..fe3d8ec04 100644 --- a/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp +++ b/src/scripts/kalimdor/silithus/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp @@ -112,7 +112,7 @@ struct aqsentinelAI : public ScriptedAI void MoveInLineOfSight(Unit* pWho) override { // Increase aggro radius - if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->isInCombat() && m_creature->IsWithinDistInMap(pWho, 45.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) + if (pWho->GetTypeId() == TYPEID_PLAYER && !m_creature->IsInCombat() && m_creature->IsWithinDistInMap(pWho, 45.0f) && m_creature->IsWithinLOSInMap(pWho) && !pWho->HasAuraType(SPELL_AURA_FEIGN_DEATH)) { AttackStart(pWho); } @@ -169,7 +169,7 @@ struct aqsentinelAI : public ScriptedAI { if (Creature* creature = m_creature->GetMap()->GetCreature(*iter)) { - if (creature->isInCombat()) + if (creature->IsInCombat()) continue; creature->SetNoCallAssistance(true); @@ -235,13 +235,13 @@ struct aqsentinelAI : public ScriptedAI void Reset() override { - if (!m_creature->isDead()) + if (!m_creature->IsDead()) { for (auto iter = nearby.cbegin(); iter != nearby.cend(); ++iter) { if (Creature* buddy = m_creature->GetMap()->GetCreature(*iter)) { - if (buddy->isDead()) + if (buddy->IsDead()) buddy->Respawn(); } } @@ -263,8 +263,8 @@ struct aqsentinelAI : public ScriptedAI { if ((pSpell->Id == SPELL_KNOCK) && pTarget->GetTypeId() == TYPEID_PLAYER) { - if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -20); + if (m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -20); } } @@ -286,7 +286,7 @@ struct aqsentinelAI : public ScriptedAI { if (Creature* buddy = m_creature->GetMap()->GetCreature(*iter)) { - if (buddy->isDead()) + if (buddy->IsDead()) continue; m_bAlone = false; @@ -308,14 +308,14 @@ struct aqsentinelAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { //Return since we have no target - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_abilitySpellId == SPELL_KNOCK_BUFF) { if (m_uiKnock_Timer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_KNOCK); m_uiKnock_Timer = 13000; } else diff --git a/src/scripts/kalimdor/stonetalon_mountains/stonetalon_mountains.cpp b/src/scripts/kalimdor/stonetalon_mountains/stonetalon_mountains.cpp index 1b7e3c0e5..30581758c 100644 --- a/src/scripts/kalimdor/stonetalon_mountains/stonetalon_mountains.cpp +++ b/src/scripts/kalimdor/stonetalon_mountains/stonetalon_mountains.cpp @@ -84,7 +84,7 @@ struct npc_piznikAI : public ScriptedAI } void UpdateAI(const uint32 uiDiff) override { - if (m_creature->SelectHostileTarget() || m_creature->getVictim()) + if (m_creature->SelectHostileTarget() || m_creature->GetVictim()) DoMeleeAttackIfReady(); else if(InEvent) { diff --git a/src/scripts/kalimdor/tanaris/tanaris.cpp b/src/scripts/kalimdor/tanaris/tanaris.cpp index a9d2ca17e..35cc6c4d6 100644 --- a/src/scripts/kalimdor/tanaris/tanaris.cpp +++ b/src/scripts/kalimdor/tanaris/tanaris.cpp @@ -58,7 +58,7 @@ struct mob_aquementasAI : public ScriptedAI { SendItem_Timer = 0; SwitchFaction_Timer = 10000; - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); isFriendly = true; AquaJet_Timer = 5000; @@ -90,21 +90,21 @@ struct mob_aquementasAI : public ScriptedAI { if (SwitchFaction_Timer < diff) { - m_creature->setFaction(91); + m_creature->SetFactionTemplateId(91); isFriendly = false; } else SwitchFaction_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (!isFriendly) { if (SendItem_Timer < diff) { - if (m_creature->getVictim()->GetTypeId() == TYPEID_PLAYER) - SendItem(m_creature->getVictim()); + if (m_creature->GetVictim()->GetTypeId() == TYPEID_PLAYER) + SendItem(m_creature->GetVictim()); SendItem_Timer = 5000; } else SendItem_Timer -= diff; @@ -112,7 +112,7 @@ struct mob_aquementasAI : public ScriptedAI if (FrostShock_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_SHOCK); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROST_SHOCK); FrostShock_Timer = 15000; } else FrostShock_Timer -= diff; @@ -262,7 +262,7 @@ CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature) bool GossipHello_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) @@ -364,7 +364,7 @@ struct npc_toogaAI : public FollowerAI { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) + if (!m_creature->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) { @@ -393,7 +393,7 @@ struct npc_toogaAI : public FollowerAI void UpdateFollowerAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { //we are doing the post-event, or... if (HasFollowState(STATE_FOLLOW_POSTEVENT)) @@ -403,7 +403,7 @@ struct npc_toogaAI : public FollowerAI m_uiPostEventTimer = 5000; Unit* pTorta = m_creature->GetMap()->GetCreature(m_tortaGuid); - if (!pTorta || !pTorta->isAlive()) + if (!pTorta || !pTorta->IsAlive()) { //something happened, so just complete SetFollowComplete(); diff --git a/src/scripts/kalimdor/tanaris/zulfarrak/instance_zulfarrak.cpp b/src/scripts/kalimdor/tanaris/zulfarrak/instance_zulfarrak.cpp index 7f9b4fbd7..8d1a71cf3 100644 --- a/src/scripts/kalimdor/tanaris/zulfarrak/instance_zulfarrak.cpp +++ b/src/scripts/kalimdor/tanaris/zulfarrak/instance_zulfarrak.cpp @@ -332,7 +332,7 @@ public: { if (Creature* npc = instance->GetCreature(GetData64(entry))) { - if (npc->isAlive()) + if (npc->IsAlive()) { npc->GetMotionMaster()->MovePoint(1, x, y, z, MOVE_PATHFINDING | MOVE_WALK_MODE); npc->SetCombatStartPosition(x, y, z); @@ -360,7 +360,7 @@ public: { if (Creature* add = instance->GetCreature((*itr))) { - if (add->isAlive()) + if (add->IsAlive()) return false; } } @@ -368,7 +368,7 @@ public: { if (Creature* add = instance->GetCreature(((*itr)))) { - if (add->isAlive()) + if (add->IsAlive()) return false; } } @@ -382,7 +382,7 @@ public: { if (Creature* add = instance->GetCreature(*addsAtBase.begin())) { - if (add->isAlive()) + if (add->IsAlive()) { add->GetMotionMaster()->MovePoint(0, 1880 + urand(0, 10), 1274, 42, MOVE_PATHFINDING | MOVE_RUN_MODE); add->SetWalk(false); diff --git a/src/scripts/kalimdor/tanaris/zulfarrak/zulfarrak.cpp b/src/scripts/kalimdor/tanaris/zulfarrak/zulfarrak.cpp index a33593066..4af684a00 100644 --- a/src/scripts/kalimdor/tanaris/zulfarrak/zulfarrak.cpp +++ b/src/scripts/kalimdor/tanaris/zulfarrak/zulfarrak.cpp @@ -74,7 +74,7 @@ struct npc_sergeant_blyAI : public ScriptedAI uint32 postGossipStep; uint32 Text_Timer; uint32 ShieldBash_Timer; - uint32 Revenge_Timer; //this is wrong, spell should never be used unless m_creature->getVictim() dodge, parry or block attack. Trinity support required. + uint32 Revenge_Timer; //this is wrong, spell should never be used unless m_creature->GetVictim() dodge, parry or block attack. Trinity support required. uint64 PlayerGUID; void Reset() override @@ -82,7 +82,7 @@ struct npc_sergeant_blyAI : public ScriptedAI ShieldBash_Timer = 5000; Revenge_Timer = 8000; -// m_creature->setFaction(FACTION_FRIENDLY); +// m_creature->SetFactionTemplateId(FACTION_FRIENDLY); } void UpdateAI(const uint32 diff) override @@ -105,7 +105,7 @@ struct npc_sergeant_blyAI : public ScriptedAI Text_Timer = 5000; break; case 3: - m_creature->setFaction(FACTION_HOSTILE); + m_creature->SetFactionTemplateId(FACTION_HOSTILE); if (Player* pTarget = ((Player*)Unit::GetUnit(*m_creature, PlayerGUID))) AttackStart(pTarget); //weegli doesn't fight - he goes & blows up the door @@ -125,12 +125,12 @@ struct npc_sergeant_blyAI : public ScriptedAI Text_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (ShieldBash_Timer <= diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH); ShieldBash_Timer = 15000; } else @@ -138,7 +138,7 @@ struct npc_sergeant_blyAI : public ScriptedAI if (Revenge_Timer <= diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_REVENGE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_REVENGE); Revenge_Timer = 10000; } else @@ -156,8 +156,8 @@ struct npc_sergeant_blyAI : public ScriptedAI void switchFactionIfAlive(InstanceData* pInstance, uint32 entry) { if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) - if (crew->isAlive()) - crew->setFaction(FACTION_HOSTILE); + if (crew->IsAlive()) + crew->SetFactionTemplateId(FACTION_HOSTILE); } }; @@ -224,7 +224,7 @@ void initBlyCrewMember(InstanceData* pInstance, uint32 entry, float x, float y, crew->SetCombatStartPosition(x, y, z); crew->SetHomePosition(x, y, z, 4.7f); crew->GetMotionMaster()->MovePoint(1, x, y, z, MOVE_PATHFINDING | MOVE_WALK_MODE); - crew->setFaction(FACTION_FREED); + crew->SetFactionTemplateId(FACTION_FREED); } } @@ -322,56 +322,56 @@ struct npc_weegli_blastfuseAI : public ScriptedAI regen = true; Creature* pOro = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_ORO)); - if (pOro->isAlive()) + if (pOro->IsAlive()) pOro->SetHealthPercent(100.0f); Creature* pMurta = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_MURTA)); - if (pMurta->isAlive()) + if (pMurta->IsAlive()) pMurta->SetHealthPercent(100.0f); Creature* pBly = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_BLY)); - if (pBly->isAlive()) + if (pBly->IsAlive()) pBly->SetHealthPercent(100.0f); Creature* pRaven = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_RAVEN)); - if (pRaven->isAlive()) + if (pRaven->IsAlive()) pRaven->SetHealthPercent(100.0f); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->SetHealthPercent(100.0f); } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (pInstance->GetData(EVENT_PYRAMID) != PYRAMID_KILLED_ALL_TROLLS) { Creature* pOro = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_ORO)); - if (!pOro->SelectHostileTarget() || !pOro->getVictim()) - ((CreatureAI*)pOro->AI())->AttackStart(m_creature->getVictim()); + if (!pOro->SelectHostileTarget() || !pOro->GetVictim()) + ((CreatureAI*)pOro->AI())->AttackStart(m_creature->GetVictim()); Creature* pMurta = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_MURTA)); - if (!pMurta->SelectHostileTarget() || !pMurta->getVictim()) - ((CreatureAI*)pMurta->AI())->AttackStart(m_creature->getVictim()); + if (!pMurta->SelectHostileTarget() || !pMurta->GetVictim()) + ((CreatureAI*)pMurta->AI())->AttackStart(m_creature->GetVictim()); Creature* pBly = m_creature->GetMap()->GetCreature(pInstance->GetData64(ENTRY_BLY)); - if (!pBly->SelectHostileTarget() || !pBly->getVictim()) - ((CreatureAI*)pBly->AI())->AttackStart(m_creature->getVictim()); + if (!pBly->SelectHostileTarget() || !pBly->GetVictim()) + ((CreatureAI*)pBly->AI())->AttackStart(m_creature->GetVictim()); } if (Bomb_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_BOMB); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BOMB); Bomb_Timer = 10000; } else Bomb_Timer -= diff; - if (m_creature->isAttackReady() && !m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (m_creature->IsAttackReady() && !m_creature->IsWithinMeleeRange(m_creature->GetVictim())) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHOOT); m_creature->SetSheath(SHEATH_STATE_RANGED); } else @@ -441,9 +441,9 @@ struct npc_weegli_blastfuseAI : public ScriptedAI void DestroyDoor() { - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->SetWalk(false); m_creature->GetMotionMaster()->MovePoint(0, 1858.57f, 1146.35f, 14.745f); m_creature->SetCombatStartPosition(1858.57f, 1146.35f, 14.745f); // in case he gets interrupted @@ -454,7 +454,7 @@ struct npc_weegli_blastfuseAI : public ScriptedAI void RunAfterExplosion1() { - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { m_creature->GetMotionMaster()->MovePoint(1, 1863.77f, 1176.99f, 9.993f); m_creature->SetCombatStartPosition(1863.77f, 1176.99f, 9.993f); // in case he gets interrupted @@ -465,7 +465,7 @@ struct npc_weegli_blastfuseAI : public ScriptedAI void RunAfterExplosion2() { - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { m_creature->GetMotionMaster()->MovePoint(2, 1827.1f, 1184.0f, 8.993f); m_creature->SetCombatStartPosition(1827.1f, 1184.0f, 8.993f); // in case he gets interrupted @@ -580,9 +580,9 @@ bool OnTrigger_at_zumrah(Player* pPlayer, const AreaTriggerEntry *at) if (!pZumrah) return false; - if (pZumrah->getFaction() != ZUMRAH_HOSTILE_FACTION) + if (pZumrah->GetFactionTemplateId() != ZUMRAH_HOSTILE_FACTION) { - pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); + pZumrah->SetFactionTemplateId(ZUMRAH_HOSTILE_FACTION); DoScriptText(SAY_ZUMRAH_TRIGGER, pZumrah); } diff --git a/src/scripts/kalimdor/teldrassil/teldrassil.cpp b/src/scripts/kalimdor/teldrassil/teldrassil.cpp index c26c9a771..1ed0098f0 100644 --- a/src/scripts/kalimdor/teldrassil/teldrassil.cpp +++ b/src/scripts/kalimdor/teldrassil/teldrassil.cpp @@ -53,7 +53,7 @@ struct npc_mistAI : public FollowerAI { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) + if (!m_creature->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { @@ -80,7 +80,7 @@ struct npc_mistAI : public FollowerAI //call not needed here, no known abilities /*void UpdateFollowerAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -116,7 +116,7 @@ struct npc_sethirAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -173,12 +173,12 @@ public: void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiWrathTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_WRATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_WRATH) == CAST_OK) m_uiWrathTimer = urand(1, 5) * 1000; } else diff --git a/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp b/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp index 7a3b952ba..f91ee91a4 100644 --- a/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp +++ b/src/scripts/kalimdor/the_barrens/razorfen_downs/razorfen_downs.cpp @@ -97,19 +97,19 @@ struct boss_ladyFaltheressAI : public ScriptedAI void TransformIntoHostile() { - m_creature->setFaction(FACTION_SCOURGE); + m_creature->SetFactionTemplateId(FACTION_SCOURGE); //TODO : find the humain appearance she transforms out of. m_creature->SetDisplayId(MODEL_ID_UNDEAD); } void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (MindBlast_Timer < diff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MIND_BLAST) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MIND_BLAST) == CAST_OK) MindBlast_Timer = 8000; } else @@ -350,12 +350,12 @@ struct npc_belnistraszAI : public npc_escortAI return; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFireballTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIREBALL); m_uiFireballTimer = urand(2000, 3000); } else @@ -363,7 +363,7 @@ struct npc_belnistraszAI : public npc_escortAI if (m_uiFrostNovaTimer < uiDiff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_NOVA); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROST_NOVA); m_uiFrostNovaTimer = urand(10000, 15000); } else @@ -388,7 +388,7 @@ bool QuestAccept_npc_belnistrasz(Player* pPlayer, Creature* pCreature, const Que { pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); DoScriptText(SAY_BELNISTRASZ_READY, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_N_NEUTRAL_ACTIVE); } } return true; @@ -447,7 +447,7 @@ struct npc_tomb_creatureAI : public ScriptedAI { if (uiWebTimer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_WEB); + DoCast(m_creature->GetVictim(), SPELL_WEB); uiWebTimer = urand(7000, 16000); } else uiWebTimer -= uiDiff; diff --git a/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp b/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp index cc482603c..5eacfb91e 100644 --- a/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp +++ b/src/scripts/kalimdor/the_barrens/razorfen_kraul/razorfen_kraul.cpp @@ -197,7 +197,7 @@ struct npc_snufflenose_gopherAI : public FollowerAI void Reset() override { - m_creature->setFaction(35); + m_creature->SetFactionTemplateId(35); m_bIsMovementActive = false; m_followPausedTimer = 3000; } @@ -376,12 +376,12 @@ struct RazorfenDefenderAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiShieldBash_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHIELD_BASH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH) == CAST_OK) m_uiShieldBash_Timer = 8100; } else diff --git a/src/scripts/kalimdor/the_barrens/the_barrens.cpp b/src/scripts/kalimdor/the_barrens/the_barrens.cpp index 7e77b42d6..9b97b7826 100644 --- a/src/scripts/kalimdor/the_barrens/the_barrens.cpp +++ b/src/scripts/kalimdor/the_barrens/the_barrens.cpp @@ -241,7 +241,7 @@ bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest { if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) { - pCreature->setFaction(FACTION_ESCORT_H_NEUTRAL_ACTIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_H_NEUTRAL_ACTIVE); pCreature->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_GIL_START, pCreature, pPlayer); @@ -267,7 +267,7 @@ struct npc_taskmaster_fizzuleAI : public ScriptedAI { npc_taskmaster_fizzuleAI(Creature* pCreature) : ScriptedAI(pCreature) { - factionNorm = pCreature->getFaction(); + factionNorm = pCreature->GetFactionTemplateId(); Reset(); } @@ -281,7 +281,7 @@ struct npc_taskmaster_fizzuleAI : public ScriptedAI IsFriend = false; Reset_Timer = 120000; FlareCount = 0; - m_creature->setFaction(factionNorm); + m_creature->SetFactionTemplateId(factionNorm); } void DoFriend() @@ -293,7 +293,7 @@ struct npc_taskmaster_fizzuleAI : public ScriptedAI m_creature->StopMoving(); m_creature->GetMotionMaster()->MoveIdle(); - m_creature->setFaction(FACTION_FRIENDLY_F); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY_F); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); } @@ -317,7 +317,7 @@ struct npc_taskmaster_fizzuleAI : public ScriptedAI else Reset_Timer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -329,7 +329,7 @@ struct npc_taskmaster_fizzuleAI : public ScriptedAI { if (FlareCount >= 2) { - if (m_creature->getFaction() == FACTION_FRIENDLY_F) + if (m_creature->GetFactionTemplateId() == FACTION_FRIENDLY_F) return; DoFriend(); @@ -430,7 +430,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI continue; } - pCreature->setFaction(35); + pCreature->SetFactionTemplateId(35); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); AffrayChallenger[i] = pCreature->GetGUID(); @@ -442,7 +442,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI pUnit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pUnit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pUnit->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - pUnit->setFaction(14); + pUnit->SetFactionTemplateId(14); } void UpdateAI(const uint32 diff) override @@ -457,7 +457,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI for (uint8 i = 0; i < 6; ++i) { Creature *challenger = m_creature->GetMap()->GetCreature(AffrayChallenger[i]); - if (challenger && !challenger->isAlive() && challenger->isDead()) + if (challenger && !challenger->IsAlive() && challenger->IsDead()) { DoScriptText(SAY_TWIGGY_DOWN, m_creature); challenger->RemoveCorpse(); @@ -473,7 +473,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI { Player* pPlayer = m_creature->GetMap()->GetPlayer(PlayerGUID); - if (!pPlayer || pPlayer->isDead()) + if (!pPlayer || pPlayer->IsDead()) Reset(); switch (Step) @@ -498,7 +498,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI if (Unit *temp = m_creature->SummonCreature(NPC_BIG_WILL, -1713.79f, -4342.09f, 6.05f, 6.15f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000)) { BigWillGUID = temp->GetGUID(); - temp->setFaction(35); + temp->SetFactionTemplateId(35); temp->GetMotionMaster()->MovePoint(0, -1682.31f, -4329.68f, 2.78f); } Event_Timer = 15000; @@ -507,7 +507,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI case 3: if (Unit *will = m_creature->GetMap()->GetUnit(BigWillGUID)) { - will->setFaction(32); + will->SetFactionTemplateId(32); DoScriptText(SAY_BIG_WILL_READY, will, pPlayer); } Event_Timer = 5000; @@ -515,7 +515,7 @@ struct npc_twiggy_flatheadAI : public ScriptedAI break; case 4: Unit *will = m_creature->GetMap()->GetUnit(BigWillGUID); - if (will && will->isDead()) + if (will && will->IsDead()) { DoScriptText(SAY_TWIGGY_OVER, m_creature); Reset(); @@ -565,7 +565,7 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) bool AreaTrigger_at_twiggy_flathead(Player* pPlayer, const AreaTriggerEntry* pAt) { - if (!pPlayer->isDead() && pPlayer->GetQuestStatus(QUEST_AFFRAY) == QUEST_STATUS_INCOMPLETE) + if (!pPlayer->IsDead() && pPlayer->GetQuestStatus(QUEST_AFFRAY) == QUEST_STATUS_INCOMPLETE) { Creature* pCreature = GetClosestCreatureWithEntry(pPlayer, NPC_TWIGGY, 30.0f); @@ -619,7 +619,7 @@ struct npc_wizzlecranks_shredderAI : public npc_escortAI { if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) + if (m_creature->GetStandState() == UNIT_STAND_STATE_DEAD) m_creature->SetStandState(UNIT_STAND_STATE_STAND); m_bIsPostEvent = false; @@ -679,7 +679,7 @@ struct npc_wizzlecranks_shredderAI : public npc_escortAI void UpdateEscortAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (m_bIsPostEvent) { @@ -724,7 +724,7 @@ bool QuestAccept_npc_wizzlecranks_shredder(Player* pPlayer, Creature* pCreature, if (pQuest->GetQuestId() == QUEST_ESCAPE) { DoScriptText(SAY_START, pCreature); - pCreature->setFaction(FACTION_RATCHET); + pCreature->SetFactionTemplateId(FACTION_RATCHET); if (npc_wizzlecranks_shredderAI* pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(true, pPlayer->GetGUID(), pQuest); @@ -1072,7 +1072,7 @@ struct npc_regthar_deathgateAI : public ScriptedAI else phaseTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1168,7 +1168,7 @@ struct npc_kolkar_invaderAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { // if (torchTimer < uiDiff) // { @@ -1185,9 +1185,9 @@ struct npc_kolkar_invaderAI : public ScriptedAI if (chargeTimer < uiDiff) { - if (m_creature->GetDistance(m_creature->getVictim()) > 12) + if (m_creature->GetDistance(m_creature->GetVictim()) > 12) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHARGE, false) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHARGE, false) == CAST_OK) { chargeTimer = 15000; DoScriptText(EMOTE_CHARGE, m_creature); @@ -1198,14 +1198,14 @@ struct npc_kolkar_invaderAI : public ScriptedAI chargeTimer -= uiDiff; if (strikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE, false) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE, false) == CAST_OK) strikeTimer = urand(4000, 9000); } else strikeTimer -= uiDiff; if (tetanosTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TETANOS, false) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TETANOS, false) == CAST_OK) tetanosTimer = 30000; } else @@ -1237,12 +1237,12 @@ struct npc_axe_throwerAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (throwTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AXE_THROW, false) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_AXE_THROW, false) == CAST_OK) throwTimer = 1000; } else @@ -1274,12 +1274,12 @@ struct npc_warlord_kromzarAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (strikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRIKE, false) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE, false) == CAST_OK) strikeTimer = urand(5000, 8000); } else @@ -1319,12 +1319,12 @@ struct npc_razormane_stalkerAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (SinisterStrike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SINISTERSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SINISTERSTRIKE); SinisterStrike_Counter += 1; if (SinisterStrike_Counter == 1) SinisterStrike_Timer = 15000; else if (SinisterStrike_Counter == 2) SinisterStrike_Timer = 12000; @@ -1445,7 +1445,7 @@ struct npc_sarilus_foulborneAI : ScriptedAI void UpdateAI(uint32 const uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiElementalsTimer < uiDiff) @@ -1458,7 +1458,7 @@ struct npc_sarilus_foulborneAI : ScriptedAI if (m_uiFrostboltTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROSTBOLT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROSTBOLT) == CAST_OK) m_uiFrostboltTimer = urand(3500, 4500); } else diff --git a/src/scripts/kalimdor/the_barrens/wailing_caverns/instance_wailing_caverns.cpp b/src/scripts/kalimdor/the_barrens/wailing_caverns/instance_wailing_caverns.cpp index b93e39c69..a0352789d 100644 --- a/src/scripts/kalimdor/the_barrens/wailing_caverns/instance_wailing_caverns.cpp +++ b/src/scripts/kalimdor/the_barrens/wailing_caverns/instance_wailing_caverns.cpp @@ -84,7 +84,7 @@ struct instance_wailing_caverns : public ScriptedInstance break;*/ } if ((pCreature->GetCreatureType() != CREATURE_TYPE_CRITTER) && - pCreature->getFaction() != 35 && // the 2 druids + pCreature->GetFactionTemplateId() != 35 && // the 2 druids pCreature->GetEntry() != 3653) // Kresh is cool vNightmareMonsters.push_back(pCreature->GetGUID()); } @@ -120,16 +120,16 @@ struct instance_wailing_caverns : public ScriptedInstance if (uiData == DONE && !Assaulted) { if (Creature* pSerpentis = instance->GetCreature(m_uiSerpentisGUID)) - if (pSerpentis->isAlive()) + if (pSerpentis->IsAlive()) DoScriptText(SERPENTIS_YELL, pSerpentis); Assaulted = true; } if (uiData == SPECIAL) { if (Creature* pAna = instance->GetCreature(m_uiAnacondraGUID)) - if (pAna->isAlive()) + if (pAna->IsAlive()) if (Creature* pDruid = GetClosestCreatureWithEntry(pAna, 3840, INTERACTION_DISTANCE)) - if (pDruid->isAlive()) + if (pDruid->IsAlive()) pDruid->DisappearAndDie(); } break; @@ -138,7 +138,7 @@ struct instance_wailing_caverns : public ScriptedInstance if (uiData == DONE && !Assaulted) { if (Creature* pSerpentis = instance->GetCreature(m_uiSerpentisGUID)) - if (pSerpentis->isAlive()) + if (pSerpentis->IsAlive()) DoScriptText(SERPENTIS_YELL, pSerpentis); Assaulted = true; } @@ -148,7 +148,7 @@ struct instance_wailing_caverns : public ScriptedInstance if (uiData == DONE && !Assaulted) { if (Creature* pSerpentis = instance->GetCreature(m_uiSerpentisGUID)) - if (pSerpentis->isAlive()) + if (pSerpentis->IsAlive()) DoScriptText(SERPENTIS_YELL, pSerpentis); Assaulted = true; } @@ -162,7 +162,7 @@ struct instance_wailing_caverns : public ScriptedInstance { if (Creature* pCreature = instance->GetCreature(*it)) { - if (pCreature->isAlive() || pCreature->loot.empty()) + if (pCreature->IsAlive() || pCreature->loot.empty()) pCreature->ForcedDespawn(); } it = vNightmareMonsters.erase(it); 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 306cc54cc..01e8b8758 100644 --- a/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp +++ b/src/scripts/kalimdor/the_barrens/wailing_caverns/wailing_caverns.cpp @@ -273,7 +273,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI while (it != vSummoned.end()) { if (Creature* pSummon = m_pInstance->GetCreature(*it)) - if (pSummon->isAlive()) + if (pSummon->IsAlive()) pSummon->ForcedDespawn(); it = vSummoned.erase(it); } @@ -339,7 +339,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI { if (Creature* pSummon = m_pInstance->GetCreature(it)) { - if (!pSummon->getVictim() && m_creature->isAlive()) + if (!pSummon->GetVictim() && m_creature->IsAlive()) { //the summon has reached the disciple, attack him if (pSummon->GetDistance2d(m_creature) < ATTACK_DISTANCE) @@ -370,7 +370,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (i->getSource()->isAlive() && (i->getSource()->GetDistance(m_creature) < 30)) + if (i->getSource()->IsAlive() && (i->getSource()->GetDistance(m_creature) < 30)) m_creature->CastSpell(i->getSource(), SPELL_MARK, false); } } @@ -416,7 +416,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_STAT_ROOT); Subevent_Phase = 2; Event_Timer = 15000; break; @@ -429,7 +429,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_STAT_ROOT); Subevent_Phase = 4; } Event_Timer = 1000; @@ -437,7 +437,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI case 4: { Player* eventStarter = m_creature->GetMap()->GetPlayer(m_playerGuid); - if (!m_creature->isInCombat() && eventStarter && !eventStarter->isInCombat()) + if (!m_creature->IsInCombat() && eventStarter && !eventStarter->IsInCombat()) { DoScriptText(SAY_AFTER_CIRCLE, m_creature); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); @@ -522,8 +522,8 @@ struct npc_disciple_of_naralexAI : public npc_escortAI else Event_Timer = 2000; break; case 8: - if (m_creature->isAlive() && - !m_creature->getVictim()) + if (m_creature->IsAlive() && + !m_creature->GetVictim()) { m_creature->DeleteThreatList(); m_creature->CombatStop(true); @@ -576,7 +576,7 @@ struct npc_disciple_of_naralexAI : public npc_escortAI if (OnCastWaypoint()) return; - if (m_creature->SelectHostileTarget() && m_creature->getVictim()) + if (m_creature->SelectHostileTarget() && m_creature->GetVictim()) { if (Sleep_Timer < diff) { @@ -597,7 +597,7 @@ bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) pCreature->CastSpell(pPlayer, SPELL_MARK, false); - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (m_pInstance && m_pInstance->GetData(TYPE_DISCIPLE) == SPECIAL) { @@ -623,7 +623,7 @@ bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, { pEscortAI->Start(false, /*pPlayer->GetGUID()*/ 0);//we don't want the out of range check. pEscortAI->m_playerGuid = pPlayer->GetObjectGuid(); - pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_N_NEUTRAL_ACTIVE); } pPlayer->CLOSE_GOSSIP_MENU(); } @@ -709,7 +709,7 @@ struct EvolvingEctoplasmAI : public ScriptedAI else m_uiImmuneTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); diff --git a/src/scripts/kalimdor/thousand_needles/thousand_needles.cpp b/src/scripts/kalimdor/thousand_needles/thousand_needles.cpp index 9551666cd..882fa4576 100644 --- a/src/scripts/kalimdor/thousand_needles/thousand_needles.cpp +++ b/src/scripts/kalimdor/thousand_needles/thousand_needles.cpp @@ -186,7 +186,7 @@ bool QuestAccept_npc_lakota_windsong(Player* pPlayer, Creature* pCreature, const if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) { DoScriptText(SAY_LAKO_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORT_H_NEUTRAL_ACTIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_H_NEUTRAL_ACTIVE); if (npc_lakota_windsongAI* pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); @@ -261,7 +261,7 @@ bool QuestAccept_npc_paoka_swiftmountain(Player* pPlayer, Creature* pCreature, c if (pQuest->GetQuestId() == QUEST_HOMEWARD) { DoScriptText(SAY_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORT_H_NEUTRAL_ACTIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_H_NEUTRAL_ACTIVE); if (npc_paoka_swiftmountainAI* pEscortAI = dynamic_cast(pCreature->AI())) pEscortAI->Start(false, pPlayer->GetGUID(), pQuest); @@ -287,7 +287,7 @@ struct npc_plucky_johnsonAI : public ScriptedAI { npc_plucky_johnsonAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_uiNormFaction = pCreature->getFaction(); + m_uiNormFaction = pCreature->GetFactionTemplateId(); Reset(); } @@ -298,8 +298,8 @@ struct npc_plucky_johnsonAI : public ScriptedAI { m_uiResetTimer = 120000; - if (m_creature->getFaction() != m_uiNormFaction) - m_creature->setFaction(m_uiNormFaction); + if (m_creature->GetFactionTemplateId() != m_uiNormFaction) + m_creature->SetFactionTemplateId(m_uiNormFaction); if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -313,7 +313,7 @@ struct npc_plucky_johnsonAI : public ScriptedAI { if (uiTextEmote == TEXTEMOTE_BECKON) { - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); m_creature->CastSpell(m_creature, SPELL_PLUCKY_HUMAN, false); } @@ -325,7 +325,7 @@ struct npc_plucky_johnsonAI : public ScriptedAI return; else { - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); m_creature->CastSpell(m_creature, SPELL_PLUCKY_HUMAN, false); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); @@ -339,7 +339,7 @@ struct npc_plucky_johnsonAI : public ScriptedAI { if (m_uiResetTimer < uiDiff) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) EnterEvadeMode(); else m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); @@ -350,7 +350,7 @@ struct npc_plucky_johnsonAI : public ScriptedAI m_uiResetTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -474,7 +474,7 @@ struct npc_grenka_bloodscreechAI : ScriptedAI { if (auto pPlayer = m_creature->GetMap()->GetPlayer(m_PlayerGuid)) { - if (pPlayer->isAlive()) + if (pPlayer->IsAlive()) pSummoned->AI()->AttackStart(pPlayer); } } @@ -508,7 +508,7 @@ struct npc_grenka_bloodscreechAI : ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); if (auto pPlayer = m_creature->GetMap()->GetPlayer(m_PlayerGuid)) { - if (pPlayer->isAlive()) + if (pPlayer->IsAlive()) m_creature->AI()->AttackStart(pPlayer); } ++m_uiWave; diff --git a/src/scripts/kalimdor/thunder_bluff/thunder_bluff.cpp b/src/scripts/kalimdor/thunder_bluff/thunder_bluff.cpp index a519cbfa1..f84c4fb02 100644 --- a/src/scripts/kalimdor/thunder_bluff/thunder_bluff.cpp +++ b/src/scripts/kalimdor/thunder_bluff/thunder_bluff.cpp @@ -63,12 +63,12 @@ public: void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiCleaveTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) m_uiCleaveTimer = 10000; } else @@ -76,7 +76,7 @@ public: if (m_uiMortalStrikeTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK) m_uiMortalStrikeTimer = 15000; } else @@ -84,7 +84,7 @@ public: if (m_uiUppercutTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_UPPERCUT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_UPPERCUT) == CAST_OK) m_uiUppercutTimer = 20000; } else @@ -131,7 +131,7 @@ CreatureAI* GetAI_boss_cairne_bloodhoof(Creature* pCreature) bool GossipHello_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I know this is rather silly but a young ward who is a bit shy would like your hoofprint.", GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); diff --git a/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp b/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp index 73eaa010c..2522d939d 100644 --- a/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp +++ b/src/scripts/kalimdor/ungoro_crater/ungoro_crater.cpp @@ -77,7 +77,7 @@ struct npc_ame01AI : public npc_escortAI if (Player* pPlayer = GetPlayerForEscort()) { - if (pPlayer->getVictim() && pPlayer->getVictim() == pWho) + if (pPlayer->GetVictim() && pPlayer->GetVictim() == pWho) return; switch (urand(0, 2)) @@ -105,9 +105,9 @@ bool QuestAccept_npc_ame01(Player* pPlayer, Creature* pCreature, const Quest* pQ pCreature->SetStandState(UNIT_STAND_STATE_STAND); if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORT_A_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_A_PASSIVE); else if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORT_H_PASSIVE); + pCreature->SetFactionTemplateId(FACTION_ESCORT_H_PASSIVE); pAmeAI->Start(false, pPlayer->GetGUID(), pQuest); } @@ -178,7 +178,7 @@ struct npc_ringoAI : public FollowerAI { FollowerAI::MoveInLineOfSight(pWho); - if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) + if (!m_creature->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) { if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) { @@ -255,13 +255,13 @@ struct npc_ringoAI : public FollowerAI void UpdateFollowerAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { if (m_uiEndEventTimer < uiDiff) { - if (!pSpraggle || !pSpraggle->isAlive()) + if (!pSpraggle || !pSpraggle->IsAlive()) { SetFollowComplete(); return; @@ -381,7 +381,7 @@ struct ungoro_eggs_triggerAI : public ScriptedAI { Player* currPlayer = it->getSource(); if (currPlayer && m_creature->GetAreaId() == myArea && m_creature->IsWithinDist(currPlayer, maxDist, false)) - if (currPlayer->isAlive()) + if (currPlayer->IsAlive()) return currPlayer; } return nullptr; @@ -509,7 +509,7 @@ struct npc_precious_the_devourerAI : public ScriptedAI { if (Creature* pSimone = m_creature->GetMap()->GetCreature(m_simoneGuid)) { - if (pSimone->isAlive()) + if (pSimone->IsAlive()) { pSimone->AI()->AttackStart(pWho); } @@ -520,7 +520,7 @@ struct npc_precious_the_devourerAI : public ScriptedAI { if (Creature* pSimone = m_creature->GetMap()->GetCreature(m_simoneGuid)) { - if (!pSimone->isAlive()) + if (!pSimone->IsAlive()) { m_creature->ForcedDespawn(); } @@ -533,21 +533,21 @@ struct npc_precious_the_devourerAI : public ScriptedAI { if (Creature* pSimone = m_creature->GetMap()->GetCreature(m_simoneGuid)) { - if (pSimone->isAlive()) + if (pSimone->IsAlive()) pSimone->ResetLastDamageTakenTime(); } } void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (m_uiSplitCheck_Timer < uiDiff) { m_uiSplitCheck_Timer = 2500; if (Creature* pSimone = m_creature->GetMap()->GetCreature(m_simoneGuid)) { - if (pSimone->isInCombat()) + if (pSimone->IsInCombat()) pSimone->AI()->EnterEvadeMode(); } } @@ -605,7 +605,7 @@ struct npc_simone_seductressAI : public ScriptedAI { if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - if (!pPrecious->isAlive()) + if (!pPrecious->IsAlive()) { pPrecious->ForcedDespawn(); Creature* pPreciousNew = m_creature->SummonCreature(NPC_PRECIOUS_THE_DEVOURER, @@ -641,14 +641,14 @@ struct npc_simone_seductressAI : public ScriptedAI { if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - if (pPrecious->isAlive()) + if (pPrecious->IsAlive()) { if (pWho) pPrecious->AI()->AttackStart(pWho); } } - if (pWho->getClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) + if (pWho->GetClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) { m_hunterGuid = pWho->GetObjectGuid(); } @@ -685,13 +685,13 @@ struct npc_simone_seductressAI : public ScriptedAI Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 20*MINUTE*IN_MILLISECONDS); if (pCleaner) { - ThreatList const& SimonetList = m_creature->getThreatManager().getThreatList(); + ThreatList const& SimonetList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = SimonetList.begin();itr != SimonetList.end(); ++itr) { if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); @@ -702,13 +702,13 @@ struct npc_simone_seductressAI : public ScriptedAI if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - ThreatList const& PrecioustList = pPrecious->getThreatManager().getThreatList(); + ThreatList const& PrecioustList = pPrecious->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = PrecioustList.begin();itr != PrecioustList.end(); ++itr) { if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); @@ -736,7 +736,7 @@ struct npc_simone_seductressAI : public ScriptedAI { if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - if (pPrecious->isAlive()) + if (pPrecious->IsAlive()) pPrecious->ResetLastDamageTakenTime(); } } @@ -754,20 +754,20 @@ struct npc_simone_seductressAI : public ScriptedAI { if (m_uiDespawn_Timer < uiDiff) { - if (m_creature->isAlive() && !m_creature->isInCombat()) + if (m_creature->IsAlive() && !m_creature->IsInCombat()) DemonDespawn(false); } else m_uiDespawn_Timer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (m_uiSplitCheck_Timer < uiDiff) { m_uiSplitCheck_Timer = 2500; if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - if (pPrecious->isInCombat()) + if (pPrecious->IsInCombat()) pPrecious->AI()->EnterEvadeMode(); } } @@ -777,7 +777,7 @@ struct npc_simone_seductressAI : public ScriptedAI return; } - if (m_creature->getThreatManager().getThreatList().size() > 1) + if (m_creature->GetThreatManager().getThreatList().size() > 1) { DemonDespawn(); } @@ -786,7 +786,7 @@ struct npc_simone_seductressAI : public ScriptedAI m_uiThreatCheck_Timer = 2000; if (Creature* pPrecious = m_creature->GetMap()->GetCreature(m_preciousGuid)) { - if (pPrecious->getThreatManager().getThreatList().size() > 1 /*|| pHunter->isDead()*/) + if (pPrecious->GetThreatManager().getThreatList().size() > 1 /*|| pHunter->IsDead()*/) DemonDespawn(); } } @@ -795,7 +795,7 @@ struct npc_simone_seductressAI : public ScriptedAI if (m_uiTemptressKiss_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TEMPTRESS_KISS) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_TEMPTRESS_KISS) == CAST_OK) m_uiTemptressKiss_Timer = 45000; } else @@ -803,7 +803,7 @@ struct npc_simone_seductressAI : public ScriptedAI if (m_uiLightingBolt_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CHAIN_LIGHTNING) == CAST_OK) m_uiLightingBolt_Timer = urand(8000, 12000); } else @@ -930,12 +930,12 @@ struct npc_simone_the_inconspicuousAI : public ScriptedAI m_uiTransform_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (m_uiFoolsPlight_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FOOLS_PLIGHT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FOOLS_PLIGHT) == CAST_OK) m_uiFoolsPlight_Timer = urand(5000, 10000); } else diff --git a/src/scripts/kalimdor/winterspring/winterspring.cpp b/src/scripts/kalimdor/winterspring/winterspring.cpp index df3571ec3..65fee7d28 100644 --- a/src/scripts/kalimdor/winterspring/winterspring.cpp +++ b/src/scripts/kalimdor/winterspring/winterspring.cpp @@ -35,7 +35,7 @@ EndContentData */ bool GossipHello_npc_lorax(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) @@ -84,10 +84,10 @@ bool GossipSelect_npc_lorax(Player* pPlayer, Creature* pCreature, uint32 uiSende bool GossipHello_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor() && pPlayer->GetReputationRank(589) >= REP_FRIENDLY) + if (pCreature->IsVendor() && pPlayer->GetReputationRank(589) >= REP_FRIENDLY) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); @@ -109,7 +109,7 @@ bool GossipSelect_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature, uin bool GossipHello_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->GetQuestRewardStatus(975)) @@ -234,7 +234,7 @@ struct npc_artoriusAI : public ScriptedAI /** Artorius the Doombringer */ void Aggro(Unit* pWho) override { - if (pWho->getClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) + if (pWho->GetClass() == CLASS_HUNTER && (m_hunterGuid.IsEmpty() || m_hunterGuid == pWho->GetObjectGuid())/*&& pWho->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE*/) { m_hunterGuid = pWho->GetObjectGuid(); } @@ -268,13 +268,13 @@ struct npc_artoriusAI : public ScriptedAI Creature* pCleaner = m_creature->SummonCreature(NPC_THE_CLEANER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetAngle(m_creature), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 20*MINUTE*IN_MILLISECONDS); if (pCleaner) { - ThreatList const& tList = m_creature->getThreatManager().getThreatList(); + ThreatList const& tList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) { if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { - if (pUnit->isAlive()) + if (pUnit->IsAlive()) { pCleaner->SetInCombatWith(pUnit); pCleaner->AddThreat(pUnit); @@ -327,17 +327,17 @@ struct npc_artoriusAI : public ScriptedAI { if (m_uiDespawn_Timer <= uiDiff) { - if (m_creature->isAlive() && !m_creature->isInCombat()) + if (m_creature->IsAlive() && !m_creature->IsInCombat()) DemonDespawn(false); } else m_uiDespawn_Timer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (m_creature->getThreatManager().getThreatList().size() > 1 /*|| pHunter->isDead()*/) + if (m_creature->GetThreatManager().getThreatList().size() > 1 /*|| pHunter->IsDead()*/) DemonDespawn(); if (m_uiDemonic_Frenzy_Timer < uiDiff) @@ -353,8 +353,8 @@ struct npc_artoriusAI : public ScriptedAI m_uiDemonic_Doom_Timer = 7500; // only attempt to cast this once every 7.5 seconds to give the hunter some leeway // LOWER max range for lag... - if (m_creature->IsWithinDistInMap(m_creature->getVictim(), 25)) - DoCastSpellIfCan(m_creature->getVictim(), SPELL_DEMONIC_DOOM); + if (m_creature->IsWithinDistInMap(m_creature->GetVictim(), 25)) + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_DEMONIC_DOOM); } else m_uiDemonic_Doom_Timer -= uiDiff; @@ -483,7 +483,7 @@ struct npc_ranshallaAI : public npc_escortAI SetEscortPaused(1); //STATE_ESCORT_PAUSED pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); - //if(DoCastSpellIfCan(m_creature, 18955)) //Ranshalla's Torch Trap: 18955 DoCastSpellIfCan(Unit*, uint32, uint32, ObjectGuid) //incant sort DoCastSpellIfCan(m_creature->getVictim(), TRAIT_FOUDRE + //if(DoCastSpellIfCan(m_creature, 18955)) //Ranshalla's Torch Trap: 18955 DoCastSpellIfCan(Unit*, uint32, uint32, ObjectGuid) //incant sort DoCastSpellIfCan(m_creature->GetVictim(), TRAIT_FOUDRE //{ // SetEscortPaused(0); //} @@ -800,7 +800,7 @@ struct npc_ranshallaAI : public npc_escortAI { wpInvoqueAtteint = 0; pretressesInvoque = 0; - //m_creature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE); + //m_creature->SetFactionTemplateId(FACTION_ESCORT_A_NEUTRAL_PASSIVE); guidPriestess1 = 0; guidPriestess2 = 0; guidMoonkin = 0; diff --git a/src/scripts/world/dragons_of_nightmare/boss_dragon_of_nightmare.cpp b/src/scripts/world/dragons_of_nightmare/boss_dragon_of_nightmare.cpp index 095b7b7dd..254a2fa2f 100644 --- a/src/scripts/world/dragons_of_nightmare/boss_dragon_of_nightmare.cpp +++ b/src/scripts/world/dragons_of_nightmare/boss_dragon_of_nightmare.cpp @@ -66,7 +66,7 @@ void boss_dragon_of_nightmareAI::UpdateAI(const uint32 uiDiff) else m_uiAuraOfNatureTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; EnterEvadeIfOutOfHomeArea(); @@ -77,7 +77,7 @@ void boss_dragon_of_nightmareAI::UpdateAI(const uint32 uiDiff) if (!UpdateDragonAI(uiDiff)) return; - auto pTarget = m_creature->getVictim(); + auto pTarget = m_creature->GetVictim(); if (!m_creature->CanReachWithMeleeAutoAttack(pTarget) || !m_creature->IsWithinLOSInMap(pTarget)) { @@ -158,7 +158,7 @@ struct npc_dream_fogAI : ScriptedPetAI { if (Unit* pTarget = ((Creature*)pOwner)->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER_NOT_GM)) { - if (pTarget != m_creature->getVictim()) + if (pTarget != m_creature->GetVictim()) return pTarget; } } @@ -171,8 +171,8 @@ struct npc_dream_fogAI : ScriptedPetAI { if (Unit* pTarget = GetNextTarget()) { - if (m_creature->getVictim() && m_creature->getThreatManager().getThreat(m_creature->getVictim())) - m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(), -100); + if (m_creature->GetVictim() && m_creature->GetThreatManager().getThreat(m_creature->GetVictim())) + m_creature->GetThreatManager().modifyThreatPercent(m_creature->GetVictim(), -100); AttackStart(pTarget); m_uiChangeTargetTimer = urand(6000, 10000); @@ -186,7 +186,7 @@ struct npc_dream_fogAI : ScriptedPetAI else m_uiChangeTargetTimer -= uiDiff; - if (m_creature->IsWithinDistInMap(m_creature->getVictim(), CONTACT_DISTANCE)) + if (m_creature->IsWithinDistInMap(m_creature->GetVictim(), CONTACT_DISTANCE)) m_uiChangeTargetTimer = urand(4000, 8000); } }; diff --git a/src/scripts/world/dragons_of_nightmare/boss_taerar.cpp b/src/scripts/world/dragons_of_nightmare/boss_taerar.cpp index 333f3ffb9..b9bca53ca 100644 --- a/src/scripts/world/dragons_of_nightmare/boss_taerar.cpp +++ b/src/scripts/world/dragons_of_nightmare/boss_taerar.cpp @@ -158,7 +158,7 @@ void npc_shade_of_taerarAI::UpdatePetAI(const uint32 uiDiff) { if (m_uiAcidBreathTimer <= uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ACID_BREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ACID_BREATH) == CAST_OK) m_uiAcidBreathTimer = urand(10000, 15000); } else diff --git a/src/scripts/world/dragons_of_nightmare/boss_ysondre.cpp b/src/scripts/world/dragons_of_nightmare/boss_ysondre.cpp index ddb9d0bb5..df03f2fa0 100644 --- a/src/scripts/world/dragons_of_nightmare/boss_ysondre.cpp +++ b/src/scripts/world/dragons_of_nightmare/boss_ysondre.cpp @@ -56,13 +56,13 @@ void boss_ysondreAI::JustSummoned(Creature* pSummoned) bool boss_ysondreAI::DoSpecialAbility() { - auto const& attackers = m_creature->getThreatManager().getThreatList(); + auto const& attackers = m_creature->GetThreatManager().getThreatList(); uint8 attackersCount = 0; for (auto itr = attackers.begin(); itr != attackers.end(); ++itr) { Player* pPlayer = m_creature->GetMap()->GetPlayer((*itr)->getUnitGuid()); - if (pPlayer && pPlayer->isAlive() && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsGameMaster()) ++attackersCount; } @@ -113,7 +113,7 @@ void npc_demented_druidAI::Reset() void npc_demented_druidAI::UpdateAI(const uint32 uiDiff) { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Curse of Thorns @@ -133,7 +133,7 @@ void npc_demented_druidAI::UpdateAI(const uint32 uiDiff) // MoonFire if (m_uiMoonFireTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MOONFIRE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MOONFIRE) == CAST_OK) m_uiMoonFireTimer = urand(3000, 6000); } else diff --git a/src/scripts/world/elemental_invasions.cpp b/src/scripts/world/elemental_invasions.cpp index 45229d366..c2de452eb 100644 --- a/src/scripts/world/elemental_invasions.cpp +++ b/src/scripts/world/elemental_invasions.cpp @@ -75,7 +75,7 @@ public: invader->SetRespawnRadius(30.f); invader->SetDefaultMovementType(RANDOM_MOTION_TYPE); - if (!invader->isInCombat()) + if (!invader->IsInCombat()) { invader->GetMotionMaster()->Clear(false, true); invader->GetMotionMaster()->MoveRandom(true, 30.0f); @@ -206,7 +206,7 @@ struct npc_invaderAI : ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; switch (m_uiEventIndex) @@ -222,7 +222,7 @@ struct npc_invaderAI : ScriptedAI if (m_uiBlastWaveTimer < uiDiff) { - auto pVictim = m_creature->getVictim(); + auto pVictim = m_creature->GetVictim(); if (pVictim && m_creature->IsInRange(pVictim, 0.0f, 10.0f)) if (DoCastSpellIfCan(m_creature, SPELL_BLAST_WAVE) == CAST_OK) @@ -243,7 +243,7 @@ struct npc_invaderAI : ScriptedAI if (m_uiWhirlwindTimer < uiDiff) { - auto pVictim = m_creature->getVictim(); + auto pVictim = m_creature->GetVictim(); if (pVictim && m_creature->IsInRange(pVictim, 0.0f, 8.0f)) if (DoCastSpellIfCan(m_creature, SPELL_WHIRLWIND) == CAST_OK) @@ -256,7 +256,7 @@ struct npc_invaderAI : ScriptedAI case EVENT_IND_EARTH: if (m_uiKnockdownTimer < uiDiff) { - auto pVictim = m_creature->getVictim(); + auto pVictim = m_creature->GetVictim(); if (pVictim && m_creature->IsInRange(pVictim, 0.0f, 5.0f)) if (DoCastSpellIfCan(pVictim, SPELL_KNOCKDOWN) == CAST_OK) @@ -267,7 +267,7 @@ struct npc_invaderAI : ScriptedAI if (m_uiShockTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_EARTH_SHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_EARTH_SHOCK) == CAST_OK) m_uiShockTimer = urand(9000, 13000); } else @@ -277,7 +277,7 @@ struct npc_invaderAI : ScriptedAI case EVENT_IND_WATER: if (m_uiChilledTimer < uiDiff) { - auto pVictim = m_creature->getVictim(); + auto pVictim = m_creature->GetVictim(); if (pVictim && m_creature->IsInRange(pVictim, 0.0f, 5.0f)) if (DoCastSpellIfCan(pVictim, SPELL_CHILLED) == CAST_OK) @@ -288,7 +288,7 @@ struct npc_invaderAI : ScriptedAI if (m_uiShockTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_SHOCK) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FROST_SHOCK) == CAST_OK) m_uiShockTimer = urand(8000, 15000); } else diff --git a/src/scripts/world/event_scourge_invasion.cpp b/src/scripts/world/event_scourge_invasion.cpp index cf04d3394..72eb3c941 100644 --- a/src/scripts/world/event_scourge_invasion.cpp +++ b/src/scripts/world/event_scourge_invasion.cpp @@ -63,7 +63,7 @@ struct npc_flameshocker_spawn_pointAI : public ScriptedAI if (_checkTimer < diff) { Creature* myMonster = m_creature->GetMap()->GetCreature(_myMonster); - if (!myMonster || !myMonster->isAlive()) + if (!myMonster || !myMonster->IsAlive()) if (Creature* spawn = m_creature->SummonCreature(NPC_FLAMESHOCKER, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0, true)) _myMonster = spawn->GetObjectGuid(); _checkTimer = urand(2 * 60, 3 * 60) * 1000; @@ -105,7 +105,7 @@ struct npc_horror_pallid_spawn_pointAI : public ScriptedAI { uint32 entry = urand(0, 1) ? NPC_PATCHWORK_TERROR : NPC_PALLID_HORROR; Creature* myMonster = m_creature->GetMap()->GetCreature(_myMonster); - if (!myMonster || !myMonster->isAlive()) + if (!myMonster || !myMonster->IsAlive()) if (Creature* spawn = m_creature->SummonCreature(entry, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0, true)) _myMonster = spawn->GetObjectGuid(); _checkTimer = urand(15 * 60, 17 * 60) * 1000; @@ -172,9 +172,9 @@ public: { if (!u->IsGuard()) return false; - if (!u->isAlive()) + if (!u->IsAlive()) return false; - if (u->getLevel() < 40) + if (u->GetLevel() < 40) return false; if (!u->IsWithinDistInMap(&i_obj, 30.0f)) return false; @@ -215,10 +215,10 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI if (who->GetTypeId() == TYPEID_PLAYER) return; // Mais on defend nos copains si on n'a que ca a faire ! - if (!m_creature->getVictim() && m_creature->CanInitiateAttack()) - if (Unit* victim = who->getVictim()) + if (!m_creature->GetVictim() && m_creature->CanInitiateAttack()) + if (Unit* victim = who->GetVictim()) if (victim->GetEntry() == m_creature->GetEntry()) - if (who->isTargetableForAttack()) + if (who->IsTargetableForAttack()) if (!who->IsWithinDistInMap(m_creature, 20.0f)) AttackStart(who); return; @@ -262,7 +262,7 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI _checksTimer -= diff; m_creature->SelectHostileTarget(); - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) { if (!_enableAutoMove) return; @@ -288,7 +288,7 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI return; } - if (Creature* c = m_creature->getVictim()->ToCreature()) + if (Creature* c = m_creature->GetVictim()->ToCreature()) c->ResetLastDamageTakenTime(); DoMeleeAttackIfReady(); } @@ -299,7 +299,7 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI void EnterCombat(Unit* who) override { // Riposte ! - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(who); ScriptedAI::AttackedBy(who); if (!who) @@ -351,7 +351,7 @@ struct ScourgeInvasion_RandomAttackerAI : public ScriptedAI { for (std::set::iterator it = _guards.begin(); it != _guards.end(); ++it) if (Creature* c = m_creature->GetMap()->GetCreature(*it)) - if (!c->isInCombat()) + if (!c->IsInCombat()) c->AddObjectToRemoveList(); } }; @@ -384,17 +384,17 @@ struct FlameshockerAI : public ScourgeInvasion_RandomAttackerAI void UpdateAI(const uint32 diff) override { ScourgeInvasion_RandomAttackerAI::UpdateAI(diff); - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) { if (!_enableAutoMove) { if (Creature* pallid = m_creature->GetMap()->GetCreature(_pallidHorror)) { - if (!pallid->isAlive()) + if (!pallid->IsAlive()) _enableAutoMove = true; - else if (pallid->getVictim()) - AttackStart(pallid->getVictim()); + else if (pallid->GetVictim()) + AttackStart(pallid->GetVictim()); else if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE) m_creature->GetMotionMaster()->MoveFollow(pallid, rand_norm_f() * 5.0f, PET_FOLLOW_ANGLE); } @@ -405,7 +405,7 @@ struct FlameshockerAI : public ScourgeInvasion_RandomAttackerAI } if (_touchTimer < diff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_FLAMESHOCKERS_TOUCH, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_FLAMESHOCKERS_TOUCH, false); _touchTimer = urand(5000, 10000); } else @@ -416,7 +416,7 @@ struct FlameshockerAI : public ScourgeInvasion_RandomAttackerAI { if (_revengeTimer < diff) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_FLAMESHOCKERS_REVENGE, false); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_FLAMESHOCKERS_REVENGE, false); _revengeTimer = urand(12000, 15000); } else diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index d2599614f..c92ec25e6 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -66,7 +66,7 @@ struct npc_chicken_cluckAI : public ScriptedAI { m_uiResetFlagTimer = 120000; - m_creature->setFaction(FACTION_CHICKEN); + m_creature->SetFactionTemplateId(FACTION_CHICKEN); m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } @@ -79,7 +79,7 @@ struct npc_chicken_cluckAI : public ScriptedAI if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE) { m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); DoScriptText(EMOTE_A_HELLO, m_creature); @@ -98,7 +98,7 @@ struct npc_chicken_cluckAI : public ScriptedAI if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) { m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); + m_creature->SetFactionTemplateId(FACTION_FRIENDLY); DoScriptText(EMOTE_CLUCK_TEXT2, m_creature); } } @@ -115,7 +115,7 @@ struct npc_chicken_cluckAI : public ScriptedAI m_uiResetFlagTimer -= uiDiff; } - if (m_creature->SelectHostileTarget() && m_creature->getVictim()) + if (m_creature->SelectHostileTarget() && m_creature->GetVictim()) DoMeleeAttackIfReady(); } }; @@ -317,7 +317,7 @@ struct npc_injured_patientAI : public ScriptedAI void SpellHit(Unit *caster, const SpellEntry *spell) override { - if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->isAlive() && spell->Id == 20804) + if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->IsAlive() && spell->Id == 20804) { if ((((Player*)caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (((Player*)caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) { @@ -377,7 +377,7 @@ struct npc_injured_patientAI : public ScriptedAI return; } _healthModTimer = 2000; // TODO: Timer ? - if (!m_creature->isAlive() || !Pvloss) + if (!m_creature->IsAlive() || !Pvloss) return; if (m_creature->GetHealth() <= 100) @@ -645,7 +645,7 @@ struct npc_garments_of_questsAI : public npc_escortAI if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) { //not while in combat - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) return; //nothing to be done now @@ -756,7 +756,7 @@ struct npc_garments_of_questsAI : public npc_escortAI void UpdateEscortAI(const uint32 diff) override { - if (bCanRun && !m_creature->isInCombat()) + if (bCanRun && !m_creature->IsInCombat()) { if (RunAwayTimer <= diff) { @@ -791,7 +791,7 @@ struct npc_garments_of_questsAI : public npc_escortAI else RunAwayTimer -= diff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -823,13 +823,13 @@ struct npc_guardianAI : public ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (m_creature->isAttackReady()) + if (m_creature->IsAttackReady()) { - m_creature->CastSpell(m_creature->getVictim(), SPELL_DEATHTOUCH, true); - m_creature->resetAttackTimer(); + m_creature->CastSpell(m_creature->GetVictim(), SPELL_DEATHTOUCH, true); + m_creature->ResetAttackTimer(); } } }; @@ -1028,7 +1028,7 @@ bool GossipSelect_npc_lunaclaw_spirit(Player* pPlayer, Creature* pCreature, uint bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) { - if (pCreature->isQuestGiver()) + if (pCreature->IsQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->HasSpellCooldown(SPELL_INT) || @@ -1281,12 +1281,12 @@ struct npc_felhound_minionAI : public ScriptedPetAI void UpdateAI(const uint32 uiDiff) override { - if (m_creature->getVictim()) + if (m_creature->GetVictim()) { if (m_uiManaBurnTimer < uiDiff) { - if (m_creature->getVictim()->getPowerType() == POWER_MANA) - DoCastSpellIfCan(m_creature->getVictim(), 15980); + if (m_creature->GetVictim()->GetPowerType() == POWER_MANA) + DoCastSpellIfCan(m_creature->GetVictim(), 15980); m_uiManaBurnTimer = urand(9800, 15200); return; } @@ -1420,7 +1420,7 @@ struct npc_arcanite_dragonlingAI : ScriptedPetAI { if (m_firebuffetTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BUFFET) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BUFFET) == CAST_OK) m_firebuffetTimer = 22500; } else @@ -1428,7 +1428,7 @@ struct npc_arcanite_dragonlingAI : ScriptedPetAI if (m_flamebreathTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FLAME_BREATH) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FLAME_BREATH) == CAST_OK) m_flamebreathTimer = urand(10000, 60000); } else @@ -1477,7 +1477,7 @@ struct npc_emerald_dragon_whelpAI : ScriptedPetAI { if (m_uiAcidSpitTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ACID_SPIT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_ACID_SPIT) == CAST_OK) m_uiAcidSpitTimer = 2000; } else @@ -1512,7 +1512,7 @@ struct npc_cannonball_runnerAI : ScriptedPetAI if (m_creature->GetOwner()) m_creature->SetOrientation(m_creature->GetOwner()->GetOrientation()); - m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); + m_creature->AddUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); npc_cannonball_runnerAI::Reset(); } @@ -1571,13 +1571,13 @@ struct npc_the_cleanerAI : public ScriptedAI { if (m_uiDespawnTimer < uiDiff) { - if (m_creature->getThreatManager().getThreatList().empty()) + if (m_creature->GetThreatManager().getThreatList().empty()) m_creature->ForcedDespawn(); } else m_uiDespawnTimer -= uiDiff; - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -1956,7 +1956,7 @@ struct npc_riggle_bassbaitAI : ScriptedAI // yells should not be repeatable, quest credit should go to a single person per week if (sGameEventMgr.IsActiveEvent(EVENT_TOURNAMENT)) { - if (!m_creature->isQuestGiver()) + if (!m_creature->IsQuestGiver()) { auto prevWinTime = sObjectMgr.GetSavedVariable(VAR_TOURNAMENT); @@ -1976,7 +1976,7 @@ struct npc_riggle_bassbaitAI : ScriptedAI } else { - if (m_creature->isQuestGiver()) + if (m_creature->IsQuestGiver()) { m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); sObjectMgr.SetSavedVariable(VAR_TOURN_GOES, 0, true); @@ -2207,7 +2207,7 @@ struct npc_shahramAI : ScriptedPetAI shahramSpell = SPELL_MIGHT_OF_SHAHRAM; } - Unit* victim = m_creature->getVictim(); + Unit* victim = m_creature->GetVictim(); if (!victim || !m_creature->IsInRange(victim, 0, 10.0f)) shahramSpell = 0; @@ -2338,7 +2338,7 @@ struct npc_goblin_land_mineAI : ScriptedAI if (m_bDetonation && !m_bDespawn) { - DoStartNoMovement(m_creature->getVictim()); + DoStartNoMovement(m_creature->GetVictim()); if (m_uiDetonationTimer < uiDiff) { @@ -2420,7 +2420,7 @@ struct npc_critterAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (m_creature->isInCombat()) + if (m_creature->IsInCombat()) { if (m_uiCombatTimer <= diff) { @@ -3495,7 +3495,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_STAT_ROOT); m_uiReturnTimer = 3000; } } @@ -3507,7 +3507,7 @@ struct npc_oozeling_jubjubAI : public ScriptedPetAI if (m_uiReturnTimer <= uiDiff) { m_uiReturnTimer = 0; - m_creature->clearUnitState(UNIT_STAT_ROOT); + m_creature->ClearUnitState(UNIT_STAT_ROOT); if (GameObject* pMug = m_creature->FindNearestGameObject(OBJECT_DARK_IRON_MUG, 1.0f)) { diff --git a/src/scripts/world/world_event_naxxramas.cpp b/src/scripts/world/world_event_naxxramas.cpp index 9c85cfb9d..c7550e6d6 100644 --- a/src/scripts/world/world_event_naxxramas.cpp +++ b/src/scripts/world/world_event_naxxramas.cpp @@ -229,7 +229,7 @@ struct npc_necrotic_shard : public ScriptedAI Reset(); eliteSpawnTimer = urand(ELITE_SPAWN_MINIMUM, ELITE_SPAWN_MAXIMUM); - if(m_creature->isAlive()) + if(m_creature->IsAlive()) me->SetVisibility(VISIBILITY_ON); } @@ -545,13 +545,13 @@ struct ShadowOfDoomAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Fear if (m_uiFear_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FEAR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FEAR) == CAST_OK) m_uiFear_Timer = 10000; } else @@ -560,7 +560,7 @@ struct ShadowOfDoomAI : public ScriptedAI // Mind Flay if (m_uiMindFlay_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDFLAY) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MINDFLAY) == CAST_OK) m_uiMindFlay_Timer = 10000; } else @@ -569,7 +569,7 @@ struct ShadowOfDoomAI : public ScriptedAI // Scourge Strike if (m_uiScourgeStrike_Timer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) m_uiScourgeStrike_Timer = 120000; } else @@ -625,12 +625,12 @@ struct GhoulBerserker : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (_plagueTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CONTAGION_OF_ROT) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CONTAGION_OF_ROT) == CAST_OK) _plagueTimer = 8000; } else @@ -689,7 +689,7 @@ struct SpectralSoldierAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (_shoutTimer < uiDiff) @@ -702,7 +702,7 @@ struct SpectralSoldierAI : public ScriptedAI if (_sunderArmorTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SUNDER_ARMOR) == CAST_OK) _sunderArmorTimer = 8000; } else @@ -751,7 +751,7 @@ struct SkeletalShocktrooperAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (_boneShardsTimer < uiDiff) @@ -764,7 +764,7 @@ struct SkeletalShocktrooperAI : public ScriptedAI if (_cleaveTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK) _cleaveTimer = 10000; } else @@ -812,12 +812,12 @@ struct SkeletalTrooperAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (_ShadowWordPainTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOW_WORD_PAIN) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHADOW_WORD_PAIN) == CAST_OK) _ShadowWordPainTimer = 30000; // 30 sec } else @@ -825,7 +825,7 @@ struct SkeletalTrooperAI : public ScriptedAI if (_ScourgeStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) _ScourgeStrikeTimer = 120000; // 2 min } else @@ -869,7 +869,7 @@ struct SpectralSpiritAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; DoMeleeAttackIfReady(); @@ -913,12 +913,12 @@ struct SpectralApparitionAI : public ScriptedAI void UpdateAI(const uint32 uiDiff) override { - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; if (_ScourgeStrikeTimer < uiDiff) { - if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) + if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SCOURGE_STRIKE) == CAST_OK) _ScourgeStrikeTimer = 120000; } else diff --git a/src/scripts/world/world_event_wareffort.cpp b/src/scripts/world/world_event_wareffort.cpp index 618abc8f3..16a7c3ad5 100644 --- a/src/scripts/world/world_event_wareffort.cpp +++ b/src/scripts/world/world_event_wareffort.cpp @@ -297,7 +297,7 @@ struct npc_AQwar_collectorAI : CreatureAI { resourceType = WAREFFORT_BAR; - switch (creature->getFaction()) + switch (creature->GetFactionTemplateId()) { case 57: case 11: @@ -564,7 +564,7 @@ bool GossipHello_npc_AQwar_collector(Player* pPlayer, Creature* pCreature) pCreature->HandleEmote(EMOTE_ONESHOT_BOW); } - else if (pCreature->isQuestGiver()) + else if (pCreature->IsQuestGiver()) { pPlayer->PrepareQuestMenu(pCreature->GetGUID()); pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetObjectGuid()); @@ -802,7 +802,7 @@ struct npc_resonating_CrystalAI : public ScriptedAI if (who->GetTypeId() != TYPEID_PLAYER || who->ToPlayer()->IsGameMaster()) return; - if (!who->isAlive()) + if (!who->IsAlive()) return; playerDetected = m_creature->IsWithinDistInMap(who, MAX_SIGHT_DISTANCE) ? true : false; @@ -815,7 +815,7 @@ struct npc_resonating_CrystalAI : public ScriptedAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive() && m_creature->IsWithinDistInMap(pPlayer, MAX_SIGHT_DISTANCE) && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && m_creature->IsWithinDistInMap(pPlayer, MAX_SIGHT_DISTANCE) && !pPlayer->IsGameMaster()) ++var; if (var > 1) @@ -830,7 +830,7 @@ struct npc_resonating_CrystalAI : public ScriptedAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && pPlayer->isAlive() && m_creature->IsWithinDistInMap(pPlayer, MAX_SIGHT_DISTANCE) && !pPlayer->IsGameMaster()) + if (pPlayer && pPlayer->IsAlive() && m_creature->IsWithinDistInMap(pPlayer, MAX_SIGHT_DISTANCE) && !pPlayer->IsGameMaster()) { m_creature->AddThreat(pPlayer); m_creature->SetInCombatWith(pPlayer); @@ -854,7 +854,7 @@ struct npc_resonating_CrystalAI : public ScriptedAI m_uiCheckTimer -= uiDiff; } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; // Whisperings of C'Thun (MC) @@ -912,11 +912,11 @@ struct npc_infantrymanAI : ScriptedAI void MoveInLineOfSight(Unit *pWho) override { - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); } } @@ -945,7 +945,7 @@ struct npc_infantrymanAI : ScriptedAI m_creature->CombatStop(true); m_creature->LoadCreatureAddon(true); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) { if (m_followingSaurfang) FollowSaurfang(); @@ -1018,7 +1018,7 @@ struct npc_infantrymanAI : ScriptedAI double orientation = m_creature->GetHomePositionO() + (m_clockwiseRotation ? -1 : 1) * M_PI / 2; m_creature->SetHomePosition(newPos.x, newPos.y, newPos.z, orientation); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); } @@ -1195,7 +1195,7 @@ struct npc_priestessAI : npc_infantrymanAI position.z = height; m_creature->SetHomePosition(position.x, position.y, position.z, 2.62f); - if (m_creature->isAlive()) + if (m_creature->IsAlive()) m_creature->GetMotionMaster()->MoveTargetedHome(); } @@ -1388,11 +1388,11 @@ struct npc_aqwar_saurfangAI : ScriptedAI void MoveInLineOfSight(Unit *pWho) override { - if (m_creature->CanInitiateAttack() && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (m_creature->CanInitiateAttack() && pWho->IsTargetableForAttack() && m_creature->IsHostileTo(pWho)) { - if (pWho->isInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) + if (pWho->IsInAccessablePlaceFor(m_creature) && m_creature->IsWithinLOSInMap(pWho)) { - if (!m_creature->getVictim()) + if (!m_creature->GetVictim()) AttackStart(pWho); } } @@ -1419,7 +1419,7 @@ struct npc_aqwar_saurfangAI : ScriptedAI void UpdateAI(const uint32 diff) override { - if (!m_creature->isAlive()) + if (!m_creature->IsAlive()) return; if (!m_CenarionHoldAttackWarn && sGameEventMgr.IsActiveEvent(EVENT_WAR_EFFORT_CH_ATTACK)) @@ -1479,14 +1479,14 @@ struct npc_aqwar_saurfangAI : ScriptedAI } } - if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) return; - if (m_creature->getVictim()->GetHealth() <= m_creature->getVictim()->GetMaxHealth() * 0.2f) + if (m_creature->GetVictim()->GetHealth() <= m_creature->GetVictim()->GetMaxHealth() * 0.2f) { if (m_uiExecute_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_EXECUTE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_EXECUTE); m_uiExecute_Timer = 2000; } else @@ -1495,7 +1495,7 @@ struct npc_aqwar_saurfangAI : ScriptedAI if (m_uiMortalStrike_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_MORTALSTRIKE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_MORTALSTRIKE); m_uiMortalStrike_Timer = 13000; } else @@ -1503,17 +1503,17 @@ struct npc_aqwar_saurfangAI : ScriptedAI if (m_uiCleave_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_CLEAVE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_CLEAVE); m_uiCleave_Timer = 7000; } else m_uiCleave_Timer -= diff; - if (m_uiCharge_Timer < diff && m_creature->GetDistance(m_creature->getVictim()->GetPositionX(), - m_creature->getVictim()->GetPositionY(), - m_creature->getVictim()->GetPositionZ()) >= 8.0f) + if (m_uiCharge_Timer < diff && m_creature->GetDistance(m_creature->GetVictim()->GetPositionX(), + m_creature->GetVictim()->GetPositionY(), + m_creature->GetVictim()->GetPositionZ()) >= 8.0f) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_CHARGE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_CHARGE); m_uiCharge_Timer = 9000; } else @@ -1521,7 +1521,7 @@ struct npc_aqwar_saurfangAI : ScriptedAI if (m_uiThunderClap_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_THUNDERCLAP); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_THUNDERCLAP); m_uiThunderClap_Timer = 9000; } else @@ -1529,7 +1529,7 @@ struct npc_aqwar_saurfangAI : ScriptedAI if (m_uiSaurfangRage_Timer < diff) { - DoCastSpellIfCan(m_creature->getVictim(), SPELL_SF_SAURFANGRAGE); + DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SF_SAURFANGRAGE); m_uiSaurfangRage_Timer = 8000; } else