mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
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...)
This commit is contained in:
@@ -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<uint32>(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
|
||||
|
||||
Reference in New Issue
Block a user