From c04b0d1c4afc458492e03936cbf43ff42f739377 Mon Sep 17 00:00:00 2001 From: 55Honey <71938210+55Honey@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:46:46 +0100 Subject: [PATCH] added return of first sent items guid - get the guid of the first item generated in the mail and return it to lua - declaration of mailGUID to check if data was already pushed to lua in a previous walkthrough of the while loop, in case there are multiple items added --- GlobalMethods.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index 4dbf972..01e5bb9 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -2128,6 +2128,7 @@ namespace LuaGlobalFunctions SQLTransaction trans = CharacterDatabase.BeginTransaction(); #endif uint8 addedItems = 0; + uint32 mailGUID = 0; while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount) { uint32 entry = Eluna::CHECKVAL(L, ++i); @@ -2156,6 +2157,13 @@ namespace LuaGlobalFunctions item->SaveToDB(); #endif draft.AddItem(item); + + if (!mailGUID > 0) + { + mailGUID = item->GetGUIDLow(); + Eluna::Push(L, mailGUID); + } + ++addedItems; } } @@ -2167,7 +2175,7 @@ namespace LuaGlobalFunctions #else draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender); #endif - return 0; + return 1; } /**