# Conflicts:
#	src/server/game/AI/CoreAI/PetAI.cpp
#	src/server/game/Battlegrounds/Battleground.cpp
#	src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
#	src/server/game/DungeonFinding/LFGMgr.h
#	src/server/game/DungeonFinding/LFGQueue.h
#	src/server/game/Entities/Creature/Creature.h
#	src/server/game/Entities/Pet/Pet.cpp
#	src/server/game/Entities/Player/Player.cpp
#	src/server/game/Entities/Player/Player.h
#	src/server/game/Entities/Unit/Unit.h
#	src/server/game/Globals/ObjectMgr.h
#	src/server/game/Groups/Group.cpp
#	src/server/game/Groups/Group.h
#	src/server/game/Guilds/Guild.cpp
#	src/server/game/Guilds/Guild.h
#	src/server/game/Handlers/GuildHandler.cpp
#	src/server/game/Handlers/LFGHandler.cpp
#	src/server/game/Handlers/MiscHandler.cpp
#	src/server/game/Handlers/NPCHandler.cpp
#	src/server/game/Instances/InstanceScript.cpp
#	src/server/game/Maps/Map.cpp
#	src/server/game/Maps/Map.h
#	src/server/game/Maps/ZoneScript.cpp
#	src/server/game/Server/WorldSession.cpp
#	src/server/game/Spells/SpellEffects.cpp
#	src/server/game/Weather/Weather.cpp
#	src/server/game/Weather/WeatherMgr.cpp
#	src/server/scripts/Commands/cs_reload.cpp
#	src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
#	src/server/scripts/EasternKingdoms/Deadmines/deadmines.h
#	src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
#	src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
#	src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
#	src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
#	src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.h
#	src/server/scripts/Spells/spell_dk.cpp
#	src/server/scripts/Spells/spell_druid.cpp
#	src/server/scripts/Spells/spell_generic.cpp
#	src/server/scripts/Spells/spell_hunter.cpp
#	src/server/scripts/Spells/spell_mage.cpp
#	src/server/scripts/Spells/spell_pet.cpp
#	src/server/scripts/Spells/spell_shaman.cpp
#	src/server/scripts/Spells/spell_warrior.cpp
This commit is contained in:
Ovahlord committed 2018-03-28 12:35:52 +02:00
commit 2cfdd3cbe0
1450 files changed
+72503 -36529

No files matched your search

+140 -121
View File
@@ -17,57 +17,59 @@
*/
#include "Unit.h"
#include "CharacterCache.h"
#include "Common.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "BattlegroundScore.h"
#include "CellImpl.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "ChatTextBuilder.h"
#include "Common.h"
#include "ConditionMgr.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h"
#include "CreatureGroups.h"
#include "Creature.h"
#include "Formulas.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "MotionMaster.h"
#include "MovementStructures.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvP.h"
#include "PassiveAI.h"
#include "PetAI.h"
#include "Pet.h"
#include "PetAI.h"
#include "PhasingHandler.h"
#include "Player.h"
#include "PlayerAI.h"
#include "QuestDef.h"
#include "ReputationMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "Spell.h"
#include "SpellInfo.h"
#include "SpellHistory.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
#include "Transport.h"
#include "Totem.h"
#include "Transport.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.h"
#include "MovementStructures.h"
#include "WorldSession.h"
#include <cmath>
float baseMoveSpeed[MAX_MOVE_TYPE] =
@@ -263,13 +265,26 @@ SpellSchoolMask ProcEventInfo::GetSchoolMask() const
return SPELL_SCHOOL_MASK_NONE;
}
DispelableAura::DispelableAura(Aura* aura, int32 dispelChance, uint8 dispelCharges) :
_aura(aura), _chance(dispelChance), _charges(dispelCharges)
{
}
DispelableAura::~DispelableAura() = default;
bool DispelableAura::RollDispel() const
{
return roll_chance_i(_chance);
}
Unit::Unit(bool isWorldObject) :
WorldObject(isWorldObject), m_playerMovingMe(NULL), m_lastSanctuaryTime(0),
WorldObject(isWorldObject), m_playerMovingMe(nullptr), m_lastSanctuaryTime(0),
IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(),
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0),
i_AI(nullptr), i_disabledAI(nullptr), m_AutoRepeatFirstCast(false), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
m_vehicle(nullptr), m_vehicleKit(nullptr), m_unitTypeMask(UNIT_MASK_NONE), m_Diminishing(),
m_HostileRefManager(this), _lastDamagedTime(0), m_spellHistory(new SpellHistory(this))
{
m_objectType |= TYPEMASK_UNIT;
@@ -293,7 +308,7 @@ Unit::Unit(bool isWorldObject) :
m_deathState = ALIVE;
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
m_currentSpells[i] = NULL;
m_currentSpells[i] = nullptr;
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i].Clear();
@@ -353,7 +368,7 @@ Unit::Unit(bool isWorldObject) :
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
_lastLiquid = NULL;
_lastLiquid = nullptr;
_oldFactionId = 0;
_isWalkingBeforeCharm = false;
@@ -539,7 +554,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
m_attackTimer[type] = uint32(GetAttackTime(type) * m_modAttackSpeedPct[type]);
}
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinCombatRange(Unit const* obj, float dist2compare) const
{
if (!obj || !IsInMap(obj) || !IsInPhase(obj))
return false;
@@ -586,7 +601,7 @@ bool Unit::IsWithinBoundaryRadius(const Unit* obj) const
return IsInDist(obj, objBoundaryRadius);
}
void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
void Unit::GetRandomContactPoint(Unit const* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
{
float combat_reach = GetCombatReach();
if (combat_reach < 0.1f) // sometimes bugged for players
@@ -655,7 +670,7 @@ bool Unit::HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura) const
bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) const
{
uint32 excludeAura = 0;
if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : NULL)
if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
return ( HasBreakableByDamageAuraType(SPELL_AURA_MOD_CONFUSE, excludeAura)
@@ -769,8 +784,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
uint32 share = CalculatePct(damage, (*i)->GetAmount());
/// @todo check packets if damage is done by victim, or by attacker of victim
DealDamageMods(shareDamageTarget, share, NULL);
DealDamage(shareDamageTarget, share, NULL, NODAMAGE, spell->GetSchoolMask(), spell, false);
DealDamageMods(shareDamageTarget, share, nullptr);
DealDamage(shareDamageTarget, share, nullptr, NODAMAGE, spell->GetSchoolMask(), spell, false);
}
}
@@ -946,7 +961,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
ASSERT(he && he->duel);
if (duel_wasMounted) // In this case victim==mount
if (duel_wasMounted) // In this case victim == mount
victim->SetHealth(1);
else
he->SetHealth(1);
@@ -1140,7 +1155,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
uint32 crit_bonus = damage;
// Apply crit_damage bonus for melee spells
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_CRIT_DAMAGE_BONUS>(spellInfo->Id, crit_bonus);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
damage += crit_bonus;
// Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
@@ -1232,7 +1247,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
return;
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID);
if (spellProto == NULL)
if (spellProto == nullptr)
{
TC_LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID);
return;
@@ -1306,7 +1321,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
// Calculate armor reduction
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
{
damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage, NULL, damageInfo->attackType);
damageInfo->damage = CalcArmorReducedDamage(damageInfo->target, damage, nullptr, damageInfo->attackType);
damageInfo->cleanDamage += damage - damageInfo->damage;
}
else
@@ -1472,7 +1487,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
// Call default DealDamage
CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, damageInfo->attackType, damageInfo->hitOutCome);
DealDamage(victim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damageSchoolMask), NULL, durabilityLoss);
DealDamage(victim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damageSchoolMask), nullptr, durabilityLoss);
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
@@ -1568,7 +1583,7 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
SendMessageToSet(&data, true);
}
bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo, uint8 effIndex)
bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo /*= nullptr*/, int8 effIndex /*= -1*/)
{
// only physical spells damage gets reduced by armor
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
@@ -1580,7 +1595,7 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* s
return false;
// bleeding effects are not reduced by armor
if (effIndex != MAX_SPELL_EFFECTS)
if (effIndex != -1)
{
if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
@@ -1608,7 +1623,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
if (spellInfo)
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_IGNORE_ARMOR>(spellInfo->Id, armor);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
AuraEffectList const& resIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = resIgnoreAuras.begin(); j != resIgnoreAuras.end(); ++j)
@@ -2578,7 +2593,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_RESIST_MISS_CHANCE>(spellInfo->Id, modHitChance);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects
if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))
@@ -2849,7 +2864,7 @@ void Unit::_UpdateSpells(uint32 time)
if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
{
m_currentSpells[i]->SetReferencedFromCurrent(false);
m_currentSpells[i] = NULL; // remove pointer
m_currentSpells[i] = nullptr; // remove pointer
}
}
@@ -2898,7 +2913,7 @@ void Unit::_UpdateSpells(uint32 time)
void Unit::_UpdateAutoRepeatSpell()
{
const SpellInfo* autoRepeatSpellInfo = m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo;
SpellInfo const* autoRepeatSpellInfo = m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo;
// check "realtime" interrupts
// don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
@@ -2943,7 +2958,7 @@ void Unit::_UpdateAutoRepeatSpell()
void Unit::SetCurrentCastSpell(Spell* pSpell)
{
ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
@@ -3108,7 +3123,7 @@ Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id == spell_id)
return m_currentSpells[i];
return NULL;
return nullptr;
}
int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const
@@ -3312,7 +3327,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask)
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() &&
(GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
return NULL;
return nullptr;
Unit* caster = aura->GetCaster();
@@ -3605,7 +3620,7 @@ Aura* Unit::GetOwnedAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemC
return itr->second;
}
}
return NULL;
return nullptr;
}
void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
@@ -4269,7 +4284,7 @@ AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caste
return itr->second->GetBase()->GetEffect(effIndex);
}
}
return NULL;
return nullptr;
}
AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid caster) const
@@ -4281,7 +4296,7 @@ AuraEffect* Unit::GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, Obj
return aurEff;
rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
}
return NULL;
return nullptr;
}
AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
@@ -4295,7 +4310,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 ico
if (spell->SpellIconID == iconId && spell->SpellFamilyName == uint32(name) && !spell->SpellFamilyFlags)
return *itr;
}
return NULL;
return nullptr;
}
AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID) const
@@ -4311,7 +4326,7 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 f
return (*i);
}
}
return NULL;
return nullptr;
}
AuraEffect* Unit::GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
@@ -4335,13 +4350,13 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, ObjectGuid casterGUID
return app;
}
}
return NULL;
return nullptr;
}
Aura* Unit::GetAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
return aurApp ? aurApp->GetBase() : nullptr;
}
AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask, AuraApplication* except) const
@@ -4353,13 +4368,13 @@ AuraApplication * Unit::GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGu
return aurApp;
rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
}
return NULL;
return nullptr;
}
Aura* Unit::GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemCasterGUID, uint8 reqEffMask) const
{
AuraApplication * aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp ? aurApp->GetBase() : NULL;
return aurApp ? aurApp->GetBase() : nullptr;
}
void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelChargesList& dispelList, bool isReflect /*= false*/) const
@@ -4540,7 +4555,7 @@ AuraEffect* Unit::IsScriptOverriden(SpellInfo const* spell, int32 script) const
if ((*i)->IsAffectingSpell(spell))
return (*i);
}
return NULL;
return nullptr;
}
uint32 Unit::GetDiseasesByCaster(ObjectGuid casterGUID, bool remove)
@@ -5734,7 +5749,7 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply)
if (!spellInfo || !spellInfo->IsPassive())
continue;
if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, NULL);
CastSpell(this, itr->first, true, nullptr);
}
}
else if (Pet* pet = ToCreature()->ToPet())
@@ -5747,7 +5762,7 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply)
if (!spellInfo || !spellInfo->IsPassive())
continue;
if (spellInfo->CasterAuraState == uint32(flag))
CastSpell(this, itr->first, true, NULL);
CastSpell(this, itr->first, true, nullptr);
}
}
}
@@ -5839,7 +5854,7 @@ Unit* Unit::GetOwner() const
if (ObjectGuid ownerGUID = GetOwnerGUID())
return ObjectAccessor::GetUnit(*this, ownerGUID);
return NULL;
return nullptr;
}
Unit* Unit::GetCharmer() const
@@ -5867,7 +5882,7 @@ Player* Unit::GetAffectingPlayer() const
if (Unit* owner = GetCharmerOrOwner())
return owner->GetCharmerOrOwnerPlayerOrPlayerItself();
return NULL;
return nullptr;
}
Minion* Unit::GetFirstMinion() const
@@ -5882,7 +5897,7 @@ Minion* Unit::GetFirstMinion() const
const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
}
return NULL;
return nullptr;
}
Guardian* Unit::GetGuardianPet() const
@@ -5897,7 +5912,7 @@ Guardian* Unit::GetGuardianPet() const
const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
}
return NULL;
return nullptr;
}
Unit* Unit::GetCharm() const
@@ -5911,7 +5926,7 @@ Unit* Unit::GetCharm() const
const_cast<Unit*>(this)->SetGuidValue(UNIT_FIELD_CHARM, ObjectGuid::Empty);
}
return NULL;
return nullptr;
}
Unit* Unit::GetCharmerOrOwner() const
@@ -6332,7 +6347,7 @@ bool Unit::isPossessing() const
Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
{
Player* player = NULL;
Player* player = nullptr;
if (GetTypeId() == TYPEID_PLAYER)
player = ToPlayer();
// Should we enable this also for charmed units?
@@ -6340,27 +6355,27 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
player = GetOwner()->ToPlayer();
if (!player)
return NULL;
return nullptr;
Group* group = player->GetGroup();
// When there is no group check pet presence
if (!group)
{
// We are pet now, return owner
if (player != this)
return IsWithinDistInMap(player, radius) ? player : NULL;
return IsWithinDistInMap(player, radius) ? player : nullptr;
Unit* pet = GetGuardianPet();
// No pet, no group, nothing to return
if (!pet)
return NULL;
return nullptr;
// We are owner now, return pet
return IsWithinDistInMap(pet, radius) ? pet : NULL;
return IsWithinDistInMap(pet, radius) ? pet : nullptr;
}
std::vector<Unit*> nearMembers;
// reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
nearMembers.reserve(group->GetMembersCount() * 2);
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
if (Player* Target = itr->GetSource())
{
// IsHostileTo check duel and controlled by enemy
@@ -6374,7 +6389,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
}
if (nearMembers.empty())
return NULL;
return nullptr;
uint32 randTarget = urand(0, nearMembers.size()-1);
return nearMembers[randTarget];
@@ -6584,7 +6599,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod<SPELLMOD_BONUS_MULTIPLIER>(spellProto->Id, coeff);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
coeff /= 100.0f;
}
DoneTotal += int32(DoneAdvertisedBenefit * coeff * stack);
@@ -6600,7 +6615,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// apply spellmod to Done damage (flat and pct)
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_DAMAGE>(spellProto->Id, tmpDamage);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
}
return uint32(std::max(tmpDamage, 0.0f));
@@ -6881,7 +6896,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod<SPELLMOD_BONUS_MULTIPLIER>(spellProto->Id, coeff);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
coeff /= 100.0f;
}
TakenTotal += int32(TakenAdvertisedBenefit * coeff * stack);
@@ -7189,7 +7204,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
// percent done
// only players use intelligence for critical chance computations
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_CRITICAL_CHANCE>(spellProto->Id, crit_chance);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
// for this types the bonus was already added in GetUnitCriticalChance, do not add twice
if (spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE && spellProto->DmgClass != SPELL_DAMAGE_CLASS_RANGED)
@@ -7241,7 +7256,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
{
// adds additional damage to critBonus (from talents)
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_CRIT_DAMAGE_BONUS>(spellProto->Id, crit_bonus);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
}
crit_bonus += damage;
@@ -7356,7 +7371,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod<SPELLMOD_BONUS_MULTIPLIER>(spellProto->Id, coeff);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
coeff /= 100.0f;
}
@@ -7387,7 +7402,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
// apply spellmod to Done amount
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_DAMAGE>(spellProto->Id, heal);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, heal);
}
return uint32(std::max(heal, 0.0f));
@@ -7532,7 +7547,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
modOwner->ApplySpellMod<SPELLMOD_BONUS_MULTIPLIER>(spellProto->Id, coeff);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
coeff /= 100.0f;
}
@@ -7878,7 +7893,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
// apply spellmod to Done damage
if (spellProto)
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_DAMAGE>(spellProto->Id, tmpDamage);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
// bonus result can be negative
return uint32(std::max(tmpDamage, 0.0f));
@@ -8034,7 +8049,7 @@ float Unit::GetWeaponProcChance() const
return 0;
}
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spellProto) const
{
// proc per minute chance calculation
if (PPM <= 0)
@@ -8043,7 +8058,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spe
// Apply chance modifer aura
if (spellProto)
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_PROC_PER_MINUTE>(spellProto->Id, PPM);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
@@ -8414,7 +8429,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath) const
bool Unit::IsValidAttackTarget(Unit const* target) const
{
return _IsValidAttackTarget(target, NULL);
return _IsValidAttackTarget(target, nullptr);
}
// function based on function Unit::CanAttack from 13850 client
@@ -8545,7 +8560,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
bool Unit::IsValidAssistTarget(Unit const* target) const
{
return _IsValidAssistTarget(target, NULL);
return _IsValidAssistTarget(target, nullptr);
}
// function based on function Unit::CanAssist from 13850 client
@@ -9308,17 +9323,17 @@ float Unit::ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index
{
if (Player* modOwner = GetSpellModOwner())
{
modOwner->ApplySpellMod<SPELLMOD_ALL_EFFECTS>(spellProto->Id, value);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
switch (effect_index)
{
case EFFECT_0:
modOwner->ApplySpellMod<SPELLMOD_EFFECT1>(spellProto->Id, value);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
break;
case EFFECT_1:
modOwner->ApplySpellMod<SPELLMOD_EFFECT2>(spellProto->Id, value);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
break;
case EFFECT_2:
modOwner->ApplySpellMod<SPELLMOD_EFFECT3>(spellProto->Id, value);
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
break;
}
}
@@ -9447,7 +9462,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell*
// called from caster
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_CASTING_TIME>(spellInfo->Id, castTime, spell);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
float castSpeedMod = 1;
castSpeedMod = castSpeedMod - GetTotalAuraMultiplier(SPELL_AURA_HASTE_SPELLS) + 1.0f;
@@ -9471,7 +9486,7 @@ void Unit::ModSpellDurationTime(SpellInfo const* spellInfo, int32 & duration, Sp
// called from caster
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_CASTING_TIME>(spellInfo->Id, duration, spell);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, duration, spell);
if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) &&
((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
@@ -9582,8 +9597,8 @@ void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply)
void Unit::ClearDiminishings()
{
for (uint32 i = 0; i < DIMINISHING_MAX; ++i)
m_Diminishing[i].Clear();
for (DiminishingReturn& dim : m_Diminishing)
dim.Clear();
}
float Unit::GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const
@@ -10266,7 +10281,7 @@ void Unit::DeleteCharmInfo()
m_charmInfo->RestoreState();
delete m_charmInfo;
m_charmInfo = NULL;
m_charmInfo = nullptr;
}
CharmInfo::CharmInfo(Unit* unit)
@@ -10820,7 +10835,7 @@ void Unit::SendPetActionFeedback(uint8 msg)
WorldPacket data(SMSG_PET_ACTION_FEEDBACK, 1);
data << uint8(msg);
owner->ToPlayer()->GetSession()->SendPacket(&data);
owner->ToPlayer()->SendDirectMessage(&data);
}
void Unit::SendPetTalk(uint32 pettalk)
@@ -10832,7 +10847,7 @@ void Unit::SendPetTalk(uint32 pettalk)
WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4);
data << uint64(GetGUID());
data << uint32(pettalk);
owner->ToPlayer()->GetSession()->SendPacket(&data);
owner->ToPlayer()->SendDirectMessage(&data);
}
void Unit::SendPetAIReaction(ObjectGuid guid)
@@ -10844,11 +10859,16 @@ void Unit::SendPetAIReaction(ObjectGuid guid)
WorldPacket data(SMSG_AI_REACTION, 8 + 4);
data << uint64(guid);
data << uint32(AI_REACTION_HOSTILE);
owner->ToPlayer()->GetSession()->SendPacket(&data);
owner->ToPlayer()->SendDirectMessage(&data);
}
///----------End of Pet responses methods----------
void Unit::PropagateSpeedChange()
{
GetMotionMaster()->PropagateSpeedChange();
}
void Unit::StopMoving()
{
ClearUnitState(UNIT_STATE_MOVING);
@@ -10889,7 +10909,7 @@ void Unit::SetStandState(uint8 state)
{
WorldPacket data(SMSG_STANDSTATE_UPDATE, 1);
data << (uint8)state;
ToPlayer()->GetSession()->SendPacket(&data);
ToPlayer()->SendDirectMessage(&data);
}
}
@@ -11048,7 +11068,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const
// no appropriate targets
if (targets.empty())
return NULL;
return nullptr;
// select random
return Trinity::Containers::SelectRandomContainerElement(targets);
@@ -11432,7 +11452,7 @@ void Unit::SendDurabilityLoss(Player* receiver, uint32 percent)
{
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 4);
data << uint32(percent);
receiver->GetSession()->SendPacket(&data);
receiver->SendDirectMessage(&data);
}
void Unit::PlayOneShotAnimKitId(uint16 animKitId)
@@ -11458,7 +11478,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
{
isRewardAllowed = creature->IsDamageEnoughForLootingAndReward();
if (!isRewardAllowed)
creature->SetLootRecipient(NULL);
creature->SetLootRecipient(nullptr);
}
if (isRewardAllowed && creature && creature->GetLootRecipient())
@@ -11528,7 +11548,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (hasLooterGuid)
group->SendLooter(creature, looter);
else
group->SendLooter(creature, NULL);
group->SendLooter(creature, nullptr);
// Update round robin looter only if the creature had loot
if (!loot->empty())
@@ -11598,7 +11618,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
{
// remember victim PvP death for corpse type and corpse reclaim delay
// at original death (not at SpiritOfRedemtionTalent timeout)
plrVictim->SetPvPDeath(player != NULL);
plrVictim->SetPvPDeath(player != nullptr);
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
@@ -11895,13 +11915,13 @@ void Unit::SetFeared(bool apply)
{
SetTarget(ObjectGuid::Empty);
Unit* caster = NULL;
Unit* caster = nullptr;
Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR);
if (!fearAuras.empty())
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
if (!caster)
caster = getAttackerForHelper();
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster == NULL processed in MoveFleeing
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster == nullptr processed in MoveFleeing
}
else
{
@@ -12087,7 +12107,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
// if charmed two demons the same session, the 2nd gets the 1st one's name
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
}
}
playerCharmer->CharmSpellInitialize();
@@ -12234,7 +12254,7 @@ void Unit::RestoreFaction()
Unit* Unit::GetRedirectThreatTarget()
{
return _redirectThreadInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL;
return _redirectThreadInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : nullptr;
}
bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry)
@@ -12257,21 +12277,21 @@ void Unit::RemoveVehicleKit()
m_vehicleKit->Uninstall();
delete m_vehicleKit;
m_vehicleKit = NULL;
m_vehicleKit = nullptr;
m_updateFlag &= ~UPDATEFLAG_VEHICLE;
m_unitTypeMask &= ~UNIT_MASK_VEHICLE;
RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK | UNIT_NPC_FLAG_PLAYER_VEHICLE);
}
bool Unit::IsOnVehicle(const Unit* vehicle) const
bool Unit::IsOnVehicle(Unit const* vehicle) const
{
return m_vehicle && m_vehicle == vehicle->GetVehicleKit();
}
Unit* Unit::GetVehicleBase() const
{
return m_vehicle ? m_vehicle->GetBase() : NULL;
return m_vehicle ? m_vehicle->GetBase() : nullptr;
}
Creature* Unit::GetVehicleCreatureBase() const
@@ -12280,7 +12300,7 @@ Creature* Unit::GetVehicleCreatureBase() const
if (Creature* c = veh->ToCreature())
return c;
return NULL;
return nullptr;
}
ObjectGuid Unit::GetTransGUID() const
@@ -12341,7 +12361,7 @@ bool Unit::IsInRaidWith(Unit const* unit) const
void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap)
{
Unit* owner = GetCharmerOrOwnerOrSelf();
Group* group = NULL;
Group* group = nullptr;
if (owner->GetTypeId() == TYPEID_PLAYER)
group = owner->ToPlayer()->GetGroup();
@@ -12349,7 +12369,7 @@ void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap)
{
uint8 subgroup = owner->ToPlayer()->GetSubGroup();
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
{
Player* Target = itr->GetSource();
@@ -12394,14 +12414,14 @@ void Unit::SetPvP(bool state)
Aura* Unit::AddAura(uint32 spellId, Unit* target)
{
if (!target)
return NULL;
return nullptr;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return NULL;
return nullptr;
if (!target->IsAlive() && !spellInfo->IsPassive() && !spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_DEAD))
return NULL;
return nullptr;
return AddAura(spellInfo, MAX_EFFECT_MASK, target);
}
@@ -12409,10 +12429,10 @@ Aura* Unit::AddAura(uint32 spellId, Unit* target)
Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target)
{
if (!spellInfo)
return NULL;
return nullptr;
if (target->IsImmunedToSpell(spellInfo, this))
return NULL;
return nullptr;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
@@ -12427,7 +12447,7 @@ Aura* Unit::AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target)
aura->ApplyForTargets();
return aura;
}
return NULL;
return nullptr;
}
void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 stack)
@@ -12477,7 +12497,7 @@ void Unit::ApplyResilience(Unit const* victim, int32* damage) const
if (!GetCharmerOrOwnerPlayerOrPlayerItself())
return;
Unit const* target = NULL;
Unit const* target = nullptr;
if (victim->GetTypeId() == TYPEID_PLAYER)
target = victim;
else if (victim->GetTypeId() == TYPEID_UNIT && victim->GetOwner() && victim->GetOwner()->GetTypeId() == TYPEID_PLAYER)
@@ -12506,7 +12526,7 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, u
if (spellId)
{
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_RESIST_MISS_CHANCE>(spellId, hitChance);
modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
}
missChance += hitChance - 100.0f;
@@ -12607,7 +12627,7 @@ void Unit::SendMoveKnockBack(Player* player, float speedXY, float speedZ, float
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[0]);
player->GetSession()->SendPacket(&data);
player->SendDirectMessage(&data);
}
void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
@@ -12619,7 +12639,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
{
player = charmer->ToPlayer();
if (player && player->m_unitMovedByMe != this)
player = NULL;
player = nullptr;
}
}
@@ -13177,7 +13197,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
}
if (IsInMap(caster))
caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId + 1, target, flags, NULL, NULL, origCasterGUID);
caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId + 1, target, flags, nullptr, nullptr, origCasterGUID);
else // This can happen during Player::_LoadAuras
{
int32 bp0[MAX_SPELL_EFFECTS];
@@ -13185,15 +13205,15 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
bp0[j] = spellEntry->Effects[j].BasePoints;
bp0[i] = seatId;
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, NULL, origCasterGUID);
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
}
}
else
{
if (IsInMap(caster))
caster->CastSpell(target, spellEntry, flags, NULL, NULL, origCasterGUID);
caster->CastSpell(target, spellEntry, flags, nullptr, nullptr, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID);
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
}
result = true;
@@ -13266,7 +13286,7 @@ void Unit::ChangeSeat(int8 seatId, bool next)
if (seat == m_vehicle->Seats.end() || !seat->second.IsEmpty())
return;
AuraEffect* rideVehicleEffect = NULL;
AuraEffect* rideVehicleEffect = nullptr;
AuraEffectList const& vehicleAuras = m_vehicle->GetBase()->GetAuraEffectsByType(SPELL_AURA_CONTROL_VEHICLE);
for (AuraEffectList::const_iterator itr = vehicleAuras.begin(); itr != vehicleAuras.end(); ++itr)
{
@@ -13305,7 +13325,7 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/)
void Unit::_ExitVehicle(Position const* exitPosition)
{
/// It's possible m_vehicle is NULL, when this function is called indirectly from @VehicleJoinEvent::Abort.
/// It's possible m_vehicle is nullptr, when this function is called indirectly from @VehicleJoinEvent::Abort.
/// In that case it was not possible to add the passenger to the vehicle. The vehicle aura has already been removed
/// from the target in the aforementioned function and we don't need to do anything else at this point.
if (!m_vehicle)
@@ -13386,7 +13406,7 @@ void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
}
}
void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusElement* extras /*= NULL*/)
void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusElement* extras /*= nullptr*/)
{
MovementInfo const& mi = m_movementInfo;
@@ -13727,7 +13747,7 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
return (relocated || turn);
}
bool Unit::UpdatePosition(const Position &pos, bool teleport)
bool Unit::UpdatePosition(Position const& pos, bool teleport)
{
return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport);
}
@@ -13758,7 +13778,7 @@ void Unit::SendThreatListUpdate()
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID();
data << uint32(count);
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
ThreatContainer::StorageType const& tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
@@ -13779,7 +13799,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count);
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
ThreatContainer::StorageType const& tlist = getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
@@ -14276,7 +14296,6 @@ bool Unit::IsSplineEnabled() const
return movespline->Initialized() && !movespline->Finalized();
}
void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const
{
if (!target)
@@ -14449,7 +14468,7 @@ void Unit::DestroyForPlayer(Player* target) const
{
WorldPacket data(SMSG_ARENA_UNIT_DESTROYED, 8);
data << GetGUID();
target->GetSession()->SendPacket(&data);
target->SendDirectMessage(&data);
}
}
@@ -14488,7 +14507,7 @@ void Unit::UpdateLastDamagedTime(SpellInfo const* spellProto)
if (spellProto && spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD))
return;
SetLastDamagedTime(time(NULL));
SetLastDamagedTime(time(nullptr));
}
bool Unit::IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications /*= false*/)