diff options
author | QAston <none@none> | 2009-04-06 14:54:56 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-04-06 14:54:56 +0200 |
commit | 276084e2942ff861120a890c5726da31b5a4c25b (patch) | |
tree | 8745be2eae802d7e296300e733483eb3db1c7f54 /src | |
parent | beabe1fabac86773a2cc091102ca5e7d0519ce6b (diff) |
*Fixes in pet levelup spell system-pets no longer learn triggered spells and can cow learn 2 spells for 1 level.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Pet.cpp | 16 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 4 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 18 |
3 files changed, 16 insertions, 22 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index f5e0d5ad7fc..35222ca6ec5 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1309,18 +1309,14 @@ bool Pet::learnSpell(uint32 spell_id) void Pet::learnLevelupSpells() { - PetLevelupSpellSet const *levelupSpells = spellmgr.GetPetLevelupSpellList(GetCreatureInfo()->family); - if(!levelupSpells) - return; - - uint32 level = getLevel(); - - for(PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr) + PetLevelupSpellMap const * spell_map = spellmgr.GetPetLevelupSpellMap(); + int8 level = getLevel(); + for(PetLevelupSpellMap::const_iterator itr = spell_map->lower_bound(GetCreatureInfo()->family); itr != spell_map->upper_bound(GetCreatureInfo()->family); ++itr) { - if(itr->first <= level) - learnSpell(itr->second); + if(itr->second.first <= level) + learnSpell(itr->second.second); else - unlearnSpell(itr->second); + unlearnSpell(itr->second.second); } } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 6a670d8c97a..64415e2c4ed 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2500,7 +2500,9 @@ void SpellMgr::LoadPetLevelupSpellMap() continue; if (!spell->spellLevel) continue; - mPetLevelupSpellMap[creatureFamily->ID][spell->spellLevel] = spell->Id; + if (!spell->SpellFamilyName) + continue; + mPetLevelupSpellMap.insert(PetLevelupSpellMap::value_type(creatureFamily->ID, std::make_pair(spell->spellLevel , spell->Id ))); count++; } } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 170162a0d5d..5c55d9b93a2 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -617,8 +617,8 @@ typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap; typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap; -typedef std::map<uint32, uint32> PetLevelupSpellSet; -typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap; +typedef std::multimap<uint32, std::pair < uint32,uint32 > >PetLevelupSpellMap; +//typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap; inline bool IsPrimaryProfessionSkill(uint32 skill) { @@ -923,15 +923,6 @@ class SpellMgr SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS]; SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS]; - PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const - { - PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily); - if(itr != mPetLevelupSpellMap.end()) - return &itr->second; - else - return NULL; - } - SpellCastResult GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL); SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const @@ -962,6 +953,11 @@ class SpellMgr return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id)); } + PetLevelupSpellMap const * GetPetLevelupSpellMap() const + { + return &mPetLevelupSpellMap; + } + // Modifiers public: static SpellMgr& Instance(); |