*Fixes in pet levelup spell system-pets no longer learn triggered spells and can cow learn 2 spells for 1 level.
--HG-- branch : trunk
This commit is contained in:
+6
-10
@@ -1309,18 +1309,14 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||||||
|
|
||||||
void Pet::learnLevelupSpells()
|
void Pet::learnLevelupSpells()
|
||||||
{
|
{
|
||||||
PetLevelupSpellSet const *levelupSpells = spellmgr.GetPetLevelupSpellList(GetCreatureInfo()->family);
|
PetLevelupSpellMap const * spell_map = spellmgr.GetPetLevelupSpellMap();
|
||||||
if(!levelupSpells)
|
int8 level = getLevel();
|
||||||
return;
|
for(PetLevelupSpellMap::const_iterator itr = spell_map->lower_bound(GetCreatureInfo()->family); itr != spell_map->upper_bound(GetCreatureInfo()->family); ++itr)
|
||||||
|
|
||||||
uint32 level = getLevel();
|
|
||||||
|
|
||||||
for(PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
|
|
||||||
{
|
{
|
||||||
if(itr->first <= level)
|
if(itr->second.first <= level)
|
||||||
learnSpell(itr->second);
|
learnSpell(itr->second.second);
|
||||||
else
|
else
|
||||||
unlearnSpell(itr->second);
|
unlearnSpell(itr->second.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2500,7 +2500,9 @@ void SpellMgr::LoadPetLevelupSpellMap()
|
|||||||
continue;
|
continue;
|
||||||
if (!spell->spellLevel)
|
if (!spell->spellLevel)
|
||||||
continue;
|
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++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-11
@@ -617,8 +617,8 @@ typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap;
|
|||||||
|
|
||||||
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
||||||
|
|
||||||
typedef std::map<uint32, uint32> PetLevelupSpellSet;
|
typedef std::multimap<uint32, std::pair < uint32,uint32 > >PetLevelupSpellMap;
|
||||||
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
//typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
||||||
|
|
||||||
inline bool IsPrimaryProfessionSkill(uint32 skill)
|
inline bool IsPrimaryProfessionSkill(uint32 skill)
|
||||||
{
|
{
|
||||||
@@ -923,15 +923,6 @@ class SpellMgr
|
|||||||
SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
|
SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
|
||||||
SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
|
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);
|
SpellCastResult GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL);
|
||||||
|
|
||||||
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const
|
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const
|
||||||
@@ -962,6 +953,11 @@ class SpellMgr
|
|||||||
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id));
|
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PetLevelupSpellMap const * GetPetLevelupSpellMap() const
|
||||||
|
{
|
||||||
|
return &mPetLevelupSpellMap;
|
||||||
|
}
|
||||||
|
|
||||||
// Modifiers
|
// Modifiers
|
||||||
public:
|
public:
|
||||||
static SpellMgr& Instance();
|
static SpellMgr& Instance();
|
||||||
|
|||||||
Reference in New Issue
Block a user