[7144] Implement DK specific way for talent points calculation.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
GriffonHeart 2009-01-22 06:33:56 +03:00 committed by VladimirMangos
parent 3afd542de2
commit 17916d3dc8
3 changed files with 39 additions and 10 deletions

View file

@ -297,6 +297,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
m_comboPoints = 0;
m_usedTalentCount = 0;
m_questRewardTalentCount = 0;
m_regenTimer = 0;
m_weaponChangeTimer = 0;
@ -2243,7 +2244,8 @@ void Player::InitTalentForLevel()
}
else
{
uint32 talentPointsForLevel = uint32((level-9)*sWorld.getRate(RATE_TALENT));
uint32 talentPointsForLevel = CalculateTalentsPoints();
// if used more that have then reset
if(m_usedTalentCount > talentPointsForLevel)
{
@ -3158,8 +3160,7 @@ bool Player::resetTalents(bool no_cost)
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(AT_LOGIN_RESET_TALENTS), GetGUIDLow());
}
uint32 level = getLevel();
uint32 talentPointsForLevel = level < 10 ? 0 : uint32((level-9)*sWorld.getRate(RATE_TALENT));
uint32 talentPointsForLevel = CalculateTalentsPoints();
if (m_usedTalentCount == 0)
{
@ -12679,6 +12680,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
SetTitle(titleEntry);
}
if(pQuest->GetBonusTalents())
{
m_questRewardTalentCount+=pQuest->GetBonusTalents();
InitTalentForLevel();
}
// Send reward mail
if(pQuest->GetRewMailTemplateId())
{
@ -14329,16 +14336,15 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadSpells(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSPELLS));
// after spell load
InitTalentForLevel();
learnSkillRewardedSpells();
learnDefaultSpells();
// after spell load, learn rewarded spell if need also
_LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
_LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
// after spell and quest load
InitTalentForLevel();
learnSkillRewardedSpells();
learnDefaultSpells();
_LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS));
// must be before inventory (some items required reputation check)
@ -15012,6 +15018,9 @@ void Player::_LoadQuestStatus(QueryResult *result)
if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
SetTitle(titleEntry);
}
if(pQuest->GetBonusTalents())
m_questRewardTalentCount+=pQuest->GetBonusTalents();
}
sLog.outDebug("Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow());
@ -19337,3 +19346,20 @@ void Player::AutoStoreLootItem(uint8 bag, uint8 slot, uint32 loot_id, LootStore
StoreNewItem (dest,lootItem->itemid,true,lootItem->randomPropertyId);
}
uint32 Player::CalculateTalentsPoints() const
{
uint32 base_talent = getLevel() < 10 ? 0 : uint32((getLevel()-9)*sWorld.getRate(RATE_TALENT));
if(getClass() != CLASS_DEATH_KNIGHT)
return base_talent;
uint32 talentPointsForLevel =
(getLevel() < 56 ? 0 : uint32((getLevel()-55)*sWorld.getRate(RATE_TALENT)))
+ m_questRewardTalentCount;
if(talentPointsForLevel > base_talent)
talentPointsForLevel = base_talent;
return talentPointsForLevel;
}