Merge pull request #347 from 55Honey/master

Global:SendMail should return the GUIDs of the created items
This commit is contained in:
Rochet2
2021-03-19 21:45:02 +02:00
committed by GitHub

View File

@@ -2093,6 +2093,7 @@ namespace LuaGlobalFunctions
* @param uint32 cod = 0 : cod money amount * @param uint32 cod = 0 : cod money amount
* @param uint32 entry = 0 : entry of an [Item] to send with mail * @param uint32 entry = 0 : entry of an [Item] to send with mail
* @param uint32 amount = 0 : amount of the [Item] to send with mail * @param uint32 amount = 0 : amount of the [Item] to send with mail
* @return uint32 itemGUIDlow : low GUID of the item. Up to 12 values returned, returns nil if no further items are sent
*/ */
int SendMail(lua_State* L) int SendMail(lua_State* L)
{ {
@@ -2156,6 +2157,11 @@ namespace LuaGlobalFunctions
item->SaveToDB(); item->SaveToDB();
#endif #endif
draft.AddItem(item); draft.AddItem(item);
#if defined TRINITY
Eluna::Push(L, item->GetGUID().GetCounter());
#else
Eluna::Push(L, item->GetGUIDLow());
#endif
++addedItems; ++addedItems;
} }
} }
@@ -2167,7 +2173,7 @@ namespace LuaGlobalFunctions
#else #else
draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender); draft.SendMailTo(MailReceiver(receiverPlayer, MAKE_NEW_GUID(receiverGUIDLow, 0, HIGHGUID_PLAYER)), sender);
#endif #endif
return 0; return addedItems;
} }
/** /**