Packet fixes, pet spells

This commit is contained in:
tomrus88 2008-11-04 04:35:28 +03:00
parent e5a597ea9f
commit b2d24ba0f7
18 changed files with 262 additions and 30 deletions

View file

@ -904,7 +904,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel)
case HUNTER_PET:
{
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((MaNGOS::XP::xp_to_level(petlevel))/4));
learnLevelupSpells();
//these formula may not be correct; however, it is designed to be close to what it should be
//this makes dps 0.5 of pets level
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
@ -1331,6 +1331,21 @@ bool Pet::learnSpell(uint16 spell_id)
return true;
}
void Pet::learnLevelupSpells()
{
PetLevelupSpellList const *levelupSpells = spellmgr.GetPetLevelupSpellList(GetCreatureInfo()->family);
if(!levelupSpells)
return;
for(PetLevelupSpellList::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
{
if(itr->ReqLevel <= getLevel())
learnSpell(itr->SpellId);
else
removeSpell(itr->SpellId);
}
}
void Pet::removeSpell(uint16 spell_id)
{
PetSpellMap::iterator itr = m_spells.find(spell_id);