aboutsummaryrefslogtreecommitdiff
path: root/src/game/Pet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Pet.cpp')
-rw-r--r--src/game/Pet.cpp47
1 files changed, 15 insertions, 32 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 6a39aeb6d3b..0da02b8fe14 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -41,25 +41,14 @@ char const* petTypeSuffix[MAX_PET_TYPE] =
"'s Companion" // MINI_PET
};
-Pet::Pet(PetType type) : Creature()
+Pet::Pet(PetType type) :
+Creature(), m_petType(type), m_removed(false), m_happinessTimer(7500), m_duration(0), m_bonusdamage(0),
+m_resetTalentsCost(0), m_resetTalentsTime(0), m_usedTalentCount(0), m_auraUpdateMask(0), m_loading(false),
+m_declinedname(NULL)
{
m_isPet = true;
m_name = "Pet";
- m_petType = type;
-
- m_removed = false;
m_regenTimer = 4000;
- m_happinessTimer = 7500;
- m_duration = 0;
- m_bonusdamage = 0;
-
- m_resetTalentsCost = 0;
- m_resetTalentsTime = 0;
- m_usedTalentCount = 0;
-
- m_auraUpdateMask = 0;
-
- m_loading = false;
// pets always have a charminfo, even if they are not actually charmed
CharmInfo* charmInfo = InitCharmInfo(this);
@@ -69,12 +58,6 @@ Pet::Pet(PetType type) : Creature()
else if(type == GUARDIAN_PET) // always aggressive
charmInfo->SetReactState(REACT_AGGRESSIVE);
- m_spells.clear();
- m_Auras.clear();
- m_CreatureSpellCooldowns.clear();
- m_CreatureCategoryCooldowns.clear();
- m_autospells.clear();
- m_declinedname = NULL;
m_isActive = true;
}
@@ -1117,7 +1100,7 @@ void Pet::_LoadSpells()
{
Field *fields = result->Fetch();
- addSpell(fields[0].GetUInt16(), fields[1].GetUInt16(), PETSPELL_UNCHANGED);
+ addSpell(fields[0].GetUInt32(), fields[1].GetUInt16(), PETSPELL_UNCHANGED);
}
while( result->NextRow() );
@@ -1270,7 +1253,7 @@ void Pet::_SaveAuras()
}
}
-bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpellType type)
+bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpellType type)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
if (!spellInfo)
@@ -1387,7 +1370,7 @@ bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, PetSpell
return true;
}
-bool Pet::learnSpell(uint16 spell_id)
+bool Pet::learnSpell(uint32 spell_id)
{
// prevent duplicated entires in spell book
if (!addSpell(spell_id))
@@ -1424,7 +1407,7 @@ void Pet::learnLevelupSpells()
}
}
-bool Pet::unlearnSpell(uint16 spell_id)
+bool Pet::unlearnSpell(uint32 spell_id)
{
if(removeSpell(spell_id))
{
@@ -1442,7 +1425,7 @@ bool Pet::unlearnSpell(uint16 spell_id)
return false;
}
-bool Pet::removeSpell(uint16 spell_id)
+bool Pet::removeSpell(uint32 spell_id)
{
PetSpellMap::iterator itr = m_spells.find(spell_id);
if (itr == m_spells.end())
@@ -1476,7 +1459,7 @@ bool Pet::removeSpell(uint16 spell_id)
return true;
}
-bool Pet::_removeSpell(uint16 spell_id)
+bool Pet::_removeSpell(uint32 spell_id)
{
PetSpellMap::iterator itr = m_spells.find(spell_id);
if (itr != m_spells.end())
@@ -1493,7 +1476,7 @@ void Pet::InitPetCreateSpells()
m_charmInfo->InitPetActionBar();
m_spells.clear();
- int32 petspellid;
+ uint32 petspellid;
PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry());
if(CreateSpells)
{
@@ -1513,7 +1496,7 @@ void Pet::InitPetCreateSpells()
if(owner->GetTypeId() == TYPEID_PLAYER && !((Player*)owner)->HasSpell(learn_spellproto->Id))
{
if(IsPassiveSpell(petspellid)) //learn passive skills when tamed, not sure if thats right
- ((Player*)owner)->learnSpell(learn_spellproto->Id);
+ ((Player*)owner)->learnSpell(learn_spellproto->Id,false);
else
AddTeachSpell(learn_spellproto->EffectTriggerSpell[0], learn_spellproto->Id);
}
@@ -1547,7 +1530,7 @@ void Pet::CheckLearning(uint32 spellid)
if(urand(0, 100) < 10)
{
- ((Player*)owner)->learnSpell(itr->second);
+ ((Player*)owner)->learnSpell(itr->second,false);
m_teachspells.erase(itr);
}
}
@@ -1693,7 +1676,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
// && tempSpell->EffectImplicitTargetA[0] != TARGET_CHAIN_DAMAGE)
// return;
- PetSpellMap::const_iterator itr = m_spells.find((uint16)spellid);
+ PetSpellMap::const_iterator itr = m_spells.find(spellid);
int i;
@@ -1747,7 +1730,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 pet_number)
bool Pet::HasSpell(uint32 spell) const
{
- PetSpellMap::const_iterator itr = m_spells.find((uint16)spell);
+ PetSpellMap::const_iterator itr = m_spells.find(spell);
return (itr != m_spells.end() && itr->second->state != PETSPELL_REMOVED );
}