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:
ianmeesters
2024-08-30 14:06:07 +02:00
committed by GitHub
parent 6b7a61483b
commit a83cd03bfb
4 changed files with 11 additions and 0 deletions

View File

@@ -13584,6 +13584,7 @@ uint32 Player::CalculateTalentsPoints() const
}
talentPointsForLevel += m_extraBonusTalentCount;
sScriptMgr->OnCalculateTalentsPoints(this, talentPointsForLevel);
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
}

View File

@@ -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));

View File

@@ -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*/) { }

View File

@@ -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);