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
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

View File

@@ -464,6 +464,7 @@ public: /* PlayerScript */
void OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
bool OnPlayerCanResurrect(Player* player);
bool OnPlayerCanGiveLevel(Player* player, uint8 newLevel);
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
// Anti cheat
void AnticheatSetCanFlybyServer(Player* player, bool apply);