feat(Core/Scripting): Add Player skill based hook (#21273)

Co-authored-by: IntelligentQuantum <IntelligentQuantum@ProtonMail.Com>
Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
This commit is contained in:
iThorgrim
2025-02-15 23:10:38 +01:00
committed by GitHub
parent c96ff8a6dc
commit 971ebcae31
4 changed files with 37 additions and 4 deletions

View File

@@ -895,6 +895,21 @@ bool ScriptMgr::AnticheatCheckMovementInfo(Player* player, MovementInfo const& m
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_ANTICHEAT_CHECK_MOVEMENT_INFO, !script->AnticheatCheckMovementInfo(player, movementInfo, mover, jump));
}
bool ScriptMgr::CanPlayerUpdateSkill(Player* player, uint32 skillId)
{
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_ON_CAN_UPDATE_SKILL, !script->CanPlayerUpdateSkill(player, skillId));
}
void ScriptMgr::OnBeforePlayerUpdateSkill(Player* player, uint32 skillId, uint32& value, uint32 max, uint32 step)
{
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_UPDATE_SKILL, script->OnBeforePlayerUpdateSkill(player, skillId, value, max, step));
}
void ScriptMgr::OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue)
{
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_UPDATE_SKILL, script->OnPlayerUpdateSkill(player, skillId, value, max, step, newValue));
}
bool ScriptMgr::CanPlayerResurrect(Player* player)
{
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_CAN_RESURRECT, !script->CanPlayerResurrect(player));

View File

@@ -204,6 +204,9 @@ enum PlayerHook
PLAYERHOOK_CAN_SEND_ERROR_ALREADY_LOOTED,
PLAYERHOOK_ON_AFTER_CREATURE_LOOT,
PLAYERHOOK_ON_AFTER_CREATURE_LOOT_MONEY,
PLAYERHOOK_ON_CAN_UPDATE_SKILL,
PLAYERHOOK_ON_BEFORE_UPDATE_SKILL,
PLAYERHOOK_ON_UPDATE_SKILL,
PLAYERHOOK_CAN_RESURRECT,
PLAYERHOOK_END
};
@@ -767,6 +770,10 @@ public:
*/
virtual void OnAfterCreatureLootMoney(Player* /*player*/) { }
virtual bool CanPlayerUpdateSkill(Player* /*player*/, uint32 /*skillId*/) { return true; }
virtual void OnBeforePlayerUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32& /*value*/, uint32 /*max*/, uint32 /*step*/) { }
virtual void OnPlayerUpdateSkill(Player* /*player*/, uint32 /*skillId*/, uint32 /*value*/, uint32 /*max*/, uint32 /*step*/, uint32 /*newValue*/) { }
/**
* @brief This hook is called, to avoid player resurrect
*