feat(Core): Another way to get talent points (#3773)

This commit is contained in:
zxdhe121
2020-12-21 09:26:00 +08:00
committed by GitHub
parent b6ec66eebd
commit ab8967c638
2 changed files with 22 additions and 1 deletions

View File

@@ -732,6 +732,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
m_usedTalentCount = 0;
m_questRewardTalentCount = 0;
m_extraBonusTalentCount = 0;
m_regenTimer = 0;
m_regenTimerCount = 0;
@@ -7286,6 +7287,14 @@ void Player::RewardReputation(Quest const* quest)
}
}
void Player::RewardExtraBonusTalentPoints(uint32 bonusTalentPoints)
{
if (bonusTalentPoints)
{
m_extraBonusTalentCount += bonusTalentPoints;
}
}
void Player::UpdateHonorFields()
{
/// called when rewarding honor and at each save
@@ -25426,6 +25435,7 @@ uint32 Player::CalculateTalentsPoints() const
if (talentPointsForLevel > base_talent)
talentPointsForLevel = base_talent;
talentPointsForLevel += m_extraBonusTalentCount;
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
}

View File

@@ -2169,6 +2169,16 @@ public:
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
/**
* A talent point boost.
* Usage:
* 1). Hot update situation (occurred when character is online, like PlayerScript:OnAchiComplete):
* Right after calling this function, character can reward talent points by calling function player->InitTalentForLevel().
*
* 2). Data initing situation (like PlayerScript:OnLoadFromDB)
*/
void RewardExtraBonusTalentPoints(uint32 bonusTalentPoints);
/*********************************************************/
/*** PVP SYSTEM ***/
/*********************************************************/
@@ -2918,6 +2928,7 @@ protected:
time_t m_resetTalentsTime;
uint32 m_usedTalentCount;
uint32 m_questRewardTalentCount;
uint32 m_extraBonusTalentCount;
// Social
PlayerSocial* m_social;