Skip to content

Commit

Permalink
Implemented ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL
Browse files Browse the repository at this point in the history
Fixed typo in my previous commit
  • Loading branch information
arrai committed Oct 31, 2008
1 parent a5ce729 commit ea5bd62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/game/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if(!miscvalue1)
continue;
if(GetPlayer()->GetMapID() != achievementCriteria->complete_battleground.mapID)
if(GetPlayer()->GetMapId() != achievementCriteria->complete_battleground.mapID)
continue;
SetCriteriaProgress(achievementCriteria, miscvalue1, true);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
SetCriteriaProgress(achievementCriteria, 1);
break;

}
if(IsCompletedCriteria(achievementCriteria))
Expand Down Expand Up @@ -312,6 +316,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
// just used as a counter - return false
return false;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
return progress->counter >= 1;
}
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2773,6 +2773,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool loading,
}
}

if(!loading)
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL);

// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell
return active && !disabled && !superceded_old;
}
Expand Down

0 comments on commit ea5bd62

Please sign in to comment.