From 620cb0ff152bf4b4cc1bfcda430cb9c583f9e833 Mon Sep 17 00:00:00 2001 From: 55Honey <71938210+55Honey@users.noreply.github.com> Date: Sat, 13 Mar 2021 20:55:25 +0100 Subject: [PATCH] new approach: multiple variables Return the guid of items created by SendMail for Azerothcore. Syntax: item1, item2, item3, ... = SendMail(subject, text, receiverGUIDLow, senderGUIDLow, stationary, delay, money, cod, entry1, amount1, entry2, amount2, entry3, amount3...) --- GlobalMethods.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index 3ee9fbd..125285f 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -2128,7 +2128,6 @@ 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); @@ -2157,17 +2156,9 @@ namespace LuaGlobalFunctions item->SaveToDB(); #endif draft.AddItem(item); - - - if (mailGUID <= 0) - { #if defined AZEROTHCORE - mailGUID = item->GetGUIDLow(); -#elif defined TRINITY - mailGUID = item->GetGUID(); + Eluna::Push(L, item->GetGUIDLow()); #endif - Eluna::Push(L, mailGUID); - } ++addedItems; } } @@ -2179,8 +2170,8 @@ namespace LuaGlobalFunctions #else draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender); #endif -#if defined TRINITY || AZEROTHCORE - return 1; +#if defined AZEROTHCORE + return addedItems; #else return 0; #endif