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