aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Pet
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
commit85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch)
treedf3d2084ee2e35008903c03178039b9c986e2d08 /src/server/game/Entities/Pet
parent052fc24315ace866ea1cf610e85df119b68100c9 (diff)
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/game/Entities/Pet')
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index a1a0a44f822..20f9e57b666 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -16,28 +16,30 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Pet.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "Formulas.h"
+#include "Group.h"
#include "Log.h"
-#include "WorldPacket.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Pet.h"
-#include "Formulas.h"
-#include "SpellHistory.h"
-#include "SpellAuras.h"
+#include "Player.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "Unit.h"
#include "Util.h"
-#include "Group.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
#define PET_XP_FACTOR 0.05f
Pet::Pet(Player* owner, PetType type) :
- Guardian(NULL, owner, true), m_usedTalentCount(0), m_removed(false),
+ Guardian(nullptr, owner, true), m_usedTalentCount(0), m_removed(false),
m_happinessTimer(7500), m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false),
- m_declinedname(NULL)
+ m_declinedname(nullptr)
{
ASSERT(GetOwner());
@@ -196,7 +198,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
return false;
}
- map->AddToMap(this->ToCreature());
+ map->AddToMap(ToCreature());
return true;
}
@@ -235,7 +237,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
break;
}
- SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
+ SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped here
SetCreatorGUID(owner->GetGUID());
InitStatsForLevel(petlevel);
@@ -312,11 +314,11 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
}
owner->SetMinion(this, true);
- map->AddToMap(this->ToCreature());
+ map->AddToMap(ToCreature());
InitTalentForLevel(); // set original talents points before spell loading
- uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32());
+ uint32 timediff = uint32(time(nullptr) - fields[14].GetUInt32());
_LoadAuras(timediff);
// load action bar, if data broken will fill later by default spells.
@@ -544,7 +546,7 @@ void Pet::Update(uint32 diff)
{
case CORPSE:
{
- if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL))
+ if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(nullptr))
{
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
return;
@@ -764,7 +766,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner)
bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask)
{
TC_LOG_DEBUG("entities.pet", "Pet::CreateBaseForTamed");
- ObjectGuid::LowType guid=map->GenerateLowGuid<HighGuid::Pet>();
+ ObjectGuid::LowType guid = map->GenerateLowGuid<HighGuid::Pet>();
uint32 petId = sObjectMgr->GeneratePetNumber();
if (!Create(guid, map, phaseMask, cinfo->Entry, petId))
return false;
@@ -1201,7 +1203,7 @@ void Pet::_LoadAuras(uint32 timediff)
else
remaincharges = 0;
- if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
+ if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, nullptr, &baseDamage[0], nullptr, caster_guid))
{
if (!aura->CanBeSaved())
{
@@ -1405,7 +1407,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
int32 free_points = GetMaxTalentPointsForLevel(getLevel());
m_usedTalentCount += talentCost;
// update free talent points
- free_points-=m_usedTalentCount;
+ free_points -= m_usedTalentCount;
SetFreeTalentPoints(free_points > 0 ? free_points : 0);
}
return true;
@@ -1421,7 +1423,7 @@ bool Pet::learnSpell(uint32 spell_id)
{
WorldPacket data(SMSG_PET_LEARNED_SPELL, 4);
data << uint32(spell_id);
- GetOwner()->GetSession()->SendPacket(&data);
+ GetOwner()->SendDirectMessage(&data);
GetOwner()->PetSpellInitialize();
}
return true;
@@ -1431,7 +1433,7 @@ void Pet::InitLevelupSpellsForLevel()
{
uint8 level = getLevel();
- if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL)
+ if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : nullptr)
{
// PetLevelupSpellSet ordered by levels, process in reversed order
for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
@@ -1474,7 +1476,7 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
{
WorldPacket data(SMSG_PET_REMOVED_SPELL, 4);
data << uint32(spell_id);
- GetOwner()->GetSession()->SendPacket(&data);
+ GetOwner()->SendDirectMessage(&data);
}
return true;
}
@@ -1627,7 +1629,7 @@ bool Pet::resetTalents()
return true;
}
-void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= NULL*/)
+void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= nullptr*/)
{
// not need after this call
if (owner->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
@@ -1873,7 +1875,7 @@ void Pet::CastPetAura(PetAura const* aura)
if (auraId == 35696) // Demonic Knowledge
{
int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
- CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
+ CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
}
else
CastSpell(this, auraId, true);