From df1b97e7349a6f73924826d0d7014ae2f194e9c7 Mon Sep 17 00:00:00 2001 From: manstfu <33990720+manstfu@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:38:24 +0100 Subject: [PATCH] Update PlayerMethods.h --- src/LuaEngine/methods/PlayerMethods.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 5501182704..aff4c7427b 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -2281,12 +2281,22 @@ namespace LuaPlayer * Sends a trainer window to the [Player] from the [Creature] specified * * @param [Creature] sender + * @param uint32 entry : trainer entry */ + int SendTrainerList(lua_State* L, Player* player) { - Creature* obj = Eluna::CHECKOBJ(L, 2); + uint32 entry = Eluna::CHECKVAL(L, 3, 0); + + if (!entry) { + Creature* obj = Eluna::CHECKOBJ(L, 2); + player->GetSession()->SendTrainerList(obj->GET_GUID()); + } + else { + WorldObject* obj = Eluna::CHECKOBJ(L, 2); + player->GetSession()->SendTrainerList(obj->GET_GUID(), entry); + } - player->GetSession()->SendTrainerList(obj->GET_GUID()); return 0; }