[DiscordArchive] Can anyone help me out with a small
[DiscordArchive] Can anyone help me out with a small
Archived author: Lucian Tudorache • Posted: 2023-06-17T22:37:04.776000+00:00
Original source
ush(L, item);
ush(L, player->StoreNewItemInInventorySlot(itemId, itemCount));Archived author: Lucian Tudorache • Posted: 2023-06-17T22:37:05.735000+00:00
Original source
int AddItem(lua_State* L, Player* player)
{
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1);
#if defined TRINITY || AZEROTHCORE
uint32 noSpaceForCount = 0;
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
if (msg != EQUIP_ERR_OK)
itemCount -= noSpaceForCount;
if (itemCount == 0 || dest.empty())
return;
Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
if (item)
player->SendNewItem(item, itemCount, true, false);
Eluna:
ush(L, item);
#else
Eluna:
ush(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
#endif
return 1;
}