feat(Core): add OnPlayerQuestAccept hook to PlayerScript (#25875)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-05-17 08:06:40 -03:00
committed by GitHub
parent 5f5c287cd3
commit 8f293d00ee
4 changed files with 16 additions and 0 deletions

View File

@@ -422,6 +422,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver)
{
AddQuest(quest, questGiver);
sScriptMgr->OnPlayerQuestAccept(this, quest);
if (CanCompleteQuest(quest->GetQuestId()))
CompleteQuest(quest->GetQuestId());

View File

@@ -852,6 +852,11 @@ void ScriptMgr::OnPlayerQuestAbandon(Player* player, uint32 questId)
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_QUEST_ABANDON, script->OnPlayerQuestAbandon(player, questId));
}
void ScriptMgr::OnPlayerQuestAccept(Player* player, Quest const* quest)
{
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_PLAYER_QUEST_ACCEPT, script->OnPlayerQuestAccept(player, quest));
}
// Player anti cheat
void ScriptMgr::AnticheatSetCanFlybyServer(Player* player, bool apply)
{

View File

@@ -190,6 +190,7 @@ enum PlayerHook
PLAYERHOOK_ON_PLAYER_ENTER_COMBAT,
PLAYERHOOK_ON_PLAYER_LEAVE_COMBAT,
PLAYERHOOK_ON_QUEST_ABANDON,
PLAYERHOOK_ON_PLAYER_QUEST_ACCEPT,
PLAYERHOOK_ON_GET_QUEST_RATE,
PLAYERHOOK_ON_CAN_PLAYER_FLY_IN_ZONE,
PLAYERHOOK_ANTICHEAT_SET_CAN_FLY_BY_SERVER,
@@ -730,6 +731,14 @@ public:
*/
virtual void OnPlayerQuestAbandon(Player* /*player*/, uint32 /*questId*/) { }
/**
* @brief This hook called after a player accepts a quest, regardless of quest giver type
*
* @param player Contains information about the Player
* @param quest Contains information about the Quest
*/
virtual void OnPlayerQuestAccept(Player* /*player*/, Quest const* /*quest*/) { }
/**
* @brief This hook called before other CanFlyChecks are applied
*

View File

@@ -454,6 +454,7 @@ public: /* PlayerScript */
void OnPlayerEnterCombat(Player* player, Unit* enemy);
void OnPlayerLeaveCombat(Player* player);
void OnPlayerQuestAbandon(Player* player, uint32 questId);
void OnPlayerQuestAccept(Player* player, Quest const* quest);
bool OnPlayerCanSendErrorAlreadyLooted(Player* player);
void OnPlayerAfterCreatureLoot(Player* player);
void OnPlayerAfterCreatureLootMoney(Player* player);