feat(Core/Entities): Add OnPlayerSendListInventory script hook (#21676)
This commit is contained in:
@@ -1036,6 +1036,8 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
|
|||||||
{
|
{
|
||||||
LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
|
LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
|
||||||
|
|
||||||
|
sScriptMgr->OnPlayerSendListInventory(GetPlayer(), vendorGuid, vendorEntry);
|
||||||
|
|
||||||
Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!vendor)
|
if (!vendor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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));
|
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)
|
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
|
||||||
: ScriptObject(name, PLAYERHOOK_END)
|
: ScriptObject(name, PLAYERHOOK_END)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ enum PlayerHook
|
|||||||
PLAYERHOOK_ON_UPDATE_SKILL,
|
PLAYERHOOK_ON_UPDATE_SKILL,
|
||||||
PLAYERHOOK_CAN_RESURRECT,
|
PLAYERHOOK_CAN_RESURRECT,
|
||||||
PLAYERHOOK_ON_CAN_GIVE_LEVEL,
|
PLAYERHOOK_ON_CAN_GIVE_LEVEL,
|
||||||
|
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
|
||||||
PLAYERHOOK_END
|
PLAYERHOOK_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -793,6 +794,15 @@ public:
|
|||||||
* @return true if player is allowed to gain the new level
|
* @return true if player is allowed to gain the new level
|
||||||
*/
|
*/
|
||||||
virtual bool OnPlayerCanGiveLevel(Player* /*player*/, uint8 /*newLevel*/) { return true; }
|
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
|
#endif
|
||||||
|
|||||||
@@ -464,6 +464,7 @@ public: /* PlayerScript */
|
|||||||
void OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
|
void OnPlayerUpdateSkill(Player* player, uint32 skillId, uint32 value, uint32 max, uint32 step, uint32 newValue);
|
||||||
bool OnPlayerCanResurrect(Player* player);
|
bool OnPlayerCanResurrect(Player* player);
|
||||||
bool OnPlayerCanGiveLevel(Player* player, uint8 newLevel);
|
bool OnPlayerCanGiveLevel(Player* player, uint8 newLevel);
|
||||||
|
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
|
||||||
|
|
||||||
// Anti cheat
|
// Anti cheat
|
||||||
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
void AnticheatSetCanFlybyServer(Player* player, bool apply);
|
||||||
|
|||||||
Reference in New Issue
Block a user