Implement 49220 and ranks

This commit is contained in:
Laise 2010-06-15 15:26:29 +03:00
parent 16ae6a2f85
commit 9811858d44
3 changed files with 28 additions and 1 deletions

View file

@ -21209,6 +21209,15 @@ void Player::UpdateAchievementCriteria( AchievementCriteriaTypes type, uint32 mi
GetAchievementMgr().UpdateAchievementCriteria(type, miscvalue1,miscvalue2,unit,time);
}
PlayerTalent const* Player::GetTalentById(int32 talentId) const
{
PlayerTalentMap::const_iterator itr = m_talents[m_activeSpec].find(talentId);
if (itr != m_talents[m_activeSpec].end())
return &itr->second;
else
NULL;
}
void Player::LearnTalent(uint32 talentId, uint32 talentRank)
{
uint32 CurTalentPoints = GetFreeTalentPoints();

View file

@ -1664,6 +1664,8 @@ class MANGOS_DLL_SPEC Player : public Unit
SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; }
PlayerTalent const* GetTalentById(int32 talentId) const;
void AddSpellMod(SpellModifier* mod, bool apply);
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL);
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL);

View file

@ -8925,7 +8925,23 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const *spellProto, int32 total, int3
// apply ap bonus at done part calculation only (it flat total mod so common with taken)
if (donePart && bonus->ap_bonus)
total += int32(bonus->ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + ap_benefit));
{
float ap_bonus = bonus->ap_bonus;
// Impurity
if (GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
{
PlayerTalent const* talent = ((Player*)this)->GetTalentById(2005);
if (talent && talent->state != PLAYERSPELL_REMOVED)
{
SpellEntry const* spell = sSpellStore.LookupEntry(talent->m_talentEntry->RankID[talent->currentRank]);
if (spell)
ap_bonus += ((spell->CalculateSimpleValue(EFFECT_INDEX_0) * ap_bonus) / 100.0f);
}
}
total += int32(ap_bonus * (GetTotalAttackPowerValue(BASE_ATTACK) + ap_benefit));
}
}
// Default calculation
else if (benefit)