[7692] Implement ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE and reimplement ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS.

Also correctly set this criteria at login.
This commit is contained in:
VladimirMangos 2009-04-20 22:44:25 +04:00
parent c4c093dac6
commit 35970244e5
4 changed files with 39 additions and 18 deletions

View file

@ -2891,6 +2891,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
SpellLearnSkillNode const* spellLearnSkill = spellmgr.GetSpellLearnSkill(spell_id);
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
if(spellLearnSkill)
{
uint32 skill_value = GetPureSkillValue(spellLearnSkill->skill);
@ -2909,9 +2912,6 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
else
{
// not ranked skills
SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(spell_id);
SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(spell_id);
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
{
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId);
@ -2958,10 +2958,16 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
}
if(IsInWorld())
if(!GetSession()->PlayerLoading())
{
// not ranked skills
for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
{
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE,_spell_idx->second->skillId);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS,_spell_idx->second->skillId);
}
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL,spell_id);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS,spell_id);
}
// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell