feat(Core/Entities): Add OnPlayerSendListInventory script hook (#21676)

This commit is contained in:
Vincent Vanclef 2025-03-11 15:01:55 +01:00 committed by GitHub
parent d4b1c795c8
commit dd42f7a673
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 0 deletions

View file

@ -920,6 +920,11 @@ bool ScriptMgr::OnPlayerCanGiveLevel(Player* player, uint8 newLevel)
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_ON_CAN_GIVE_LEVEL, !script->OnPlayerCanGiveLevel(player, newLevel));
}
void ScriptMgr::OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry)
{
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_SEND_LIST_INVENTORY, script->OnPlayerSendListInventory(player, vendorGuid, vendorEntry));
}
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
: ScriptObject(name, PLAYERHOOK_END)
{

View file

@ -209,6 +209,7 @@ enum PlayerHook
PLAYERHOOK_ON_UPDATE_SKILL,
PLAYERHOOK_CAN_RESURRECT,
PLAYERHOOK_ON_CAN_GIVE_LEVEL,
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
PLAYERHOOK_END
};
@ -793,6 +794,15 @@ public:
* @return true if player is allowed to gain the new level
*/
virtual bool OnPlayerCanGiveLevel(Player* /*player*/, uint8 /*newLevel*/) { return true; }
/**
* @brief This hook is called whenever a player interacts with a vendor, and is then shown the vendor list
*
* @param player Contains information about the Player
* @param vendorGuid Guid of the vendor player is interacting with
* @param vendorEntry Entry of the vendor player is interacting with
*/
virtual void OnPlayerSendListInventory(Player* /*player*/, ObjectGuid /*vendorGuid*/, uint32& /*vendorEntry*/) {}
};
#endif