mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/Player): add OnCalculateTalentsPoints hook (#19749)
* playerTalentsHook * oeps :# * :# * does this work? * make reference --------- Co-authored-by: Amy Fang <amy@cavemail.ddns.net>
This commit is contained in:
@@ -13584,6 +13584,7 @@ uint32 Player::CalculateTalentsPoints() const
|
||||
}
|
||||
|
||||
talentPointsForLevel += m_extraBonusTalentCount;
|
||||
sScriptMgr->OnCalculateTalentsPoints(this, talentPointsForLevel);
|
||||
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,11 @@ void ScriptMgr::OnPlayerJustDied(Player* player)
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_PLAYER_JUST_DIED, script->OnPlayerJustDied(player));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnCalculateTalentsPoints(Player const* player, uint32& talentPointsForLevel)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_CALCULATE_TALENTS_POINTS, script->OnCalculateTalentsPoints(player, talentPointsForLevel));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerReleasedGhost(Player* player)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_PLAYER_RELEASED_GHOST, script->OnPlayerReleasedGhost(player));
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
enum PlayerHook
|
||||
{
|
||||
PLAYERHOOK_ON_PLAYER_JUST_DIED,
|
||||
PLAYERHOOK_ON_CALCULATE_TALENTS_POINTS,
|
||||
PLAYERHOOK_ON_PLAYER_RELEASED_GHOST,
|
||||
PLAYERHOOK_ON_SEND_INITIAL_PACKETS_BEFORE_ADD_TO_MAP,
|
||||
PLAYERHOOK_ON_BATTLEGROUND_DESERTION,
|
||||
@@ -213,6 +214,9 @@ public:
|
||||
// Called when a player dies
|
||||
virtual void OnPlayerJustDied(Player* /*player*/) { }
|
||||
|
||||
// Called player talent points are calculated
|
||||
virtual void OnCalculateTalentsPoints(Player const* /*player*/, uint32& /*talentPointsForLevel*/) { }
|
||||
|
||||
// Called when clicking the release button
|
||||
virtual void OnPlayerReleasedGhost(Player* /*player*/) { }
|
||||
|
||||
|
||||
@@ -298,6 +298,7 @@ public: /* PlayerScript */
|
||||
void OnPlayerUpdate(Player* player, uint32 p_time);
|
||||
void OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data);
|
||||
void OnPlayerJustDied(Player* player);
|
||||
void OnCalculateTalentsPoints(Player const* player, uint32& talentPointsForLevel);
|
||||
void OnPlayerReleasedGhost(Player* player);
|
||||
void OnPVPKill(Player* killer, Player* killed);
|
||||
void OnPlayerPVPFlagChange(Player* player, bool state);
|
||||
|
||||
Reference in New Issue
Block a user