[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_comboPoints = 0;
m_usedTalentCount = 0; m_usedTalentCount = 0;
m_questRewardTalentCount = 0;
m_regenTimer = 0; m_regenTimer = 0;
m_weaponChangeTimer = 0; m_weaponChangeTimer = 0;
@ -2243,7 +2244,8 @@ void Player::InitTalentForLevel()
} }
else else
{ {
uint32 talentPointsForLevel = uint32((level-9)*sWorld.getRate(RATE_TALENT)); uint32 talentPointsForLevel = CalculateTalentsPoints();
// if used more that have then reset // if used more that have then reset
if(m_usedTalentCount > talentPointsForLevel) 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()); CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(AT_LOGIN_RESET_TALENTS), GetGUIDLow());
} }
uint32 level = getLevel(); uint32 talentPointsForLevel = CalculateTalentsPoints();
uint32 talentPointsForLevel = level < 10 ? 0 : uint32((level-9)*sWorld.getRate(RATE_TALENT));
if (m_usedTalentCount == 0) if (m_usedTalentCount == 0)
{ {
@ -12679,6 +12680,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
SetTitle(titleEntry); SetTitle(titleEntry);
} }
if(pQuest->GetBonusTalents())
{
m_questRewardTalentCount+=pQuest->GetBonusTalents();
InitTalentForLevel();
}
// Send reward mail // Send reward mail
if(pQuest->GetRewMailTemplateId()) if(pQuest->GetRewMailTemplateId())
{ {
@ -14329,16 +14336,15 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadSpells(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSPELLS)); _LoadSpells(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSPELLS));
// after spell load
InitTalentForLevel();
learnSkillRewardedSpells();
learnDefaultSpells();
// after spell load, learn rewarded spell if need also // after spell load, learn rewarded spell if need also
_LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS)); _LoadQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
_LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS)); _LoadDailyQuestStatus(holder->GetResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
// after spell and quest load
InitTalentForLevel();
learnSkillRewardedSpells();
learnDefaultSpells();
_LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS)); _LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS));
// must be before inventory (some items required reputation check) // 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())) if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
SetTitle(titleEntry); 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()); 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); 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;
}

View file

@ -1494,6 +1494,8 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 resetTalentsCost() const; uint32 resetTalentsCost() const;
void InitTalentForLevel(); void InitTalentForLevel();
uint32 CalculateTalentsPoints() const;
void InitGlyphsForLevel(); void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); } void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); } uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
@ -2393,6 +2395,7 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 m_resetTalentsCost; uint32 m_resetTalentsCost;
time_t m_resetTalentsTime; time_t m_resetTalentsTime;
uint32 m_usedTalentCount; uint32 m_usedTalentCount;
uint32 m_questRewardTalentCount;
// Social // Social
PlayerSocial *m_social; PlayerSocial *m_social;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7143" #define REVISION_NR "7144"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__