Prevent GUID from exhausting

This commit is contained in:
Yunfan Li
2023-05-26 01:02:22 +08:00
parent ec45b40cb9
commit f677900061
2 changed files with 4 additions and 3 deletions

View File

@@ -1086,7 +1086,7 @@ void Item::SendTimeUpdate(Player* owner)
owner->GetSession()->SendPacket(&data);
}
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clone, uint32 randomPropertyId)
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clone, uint32 randomPropertyId, bool temp)
{
if (count < 1)
return nullptr; //don't create item at zero count
@@ -1100,7 +1100,8 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, bool clo
ASSERT_NODEBUGINFO(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* pItem = NewItemOrBag(pProto);
if (pItem->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), item, player))
uint32 guid = temp ? 0xFFFFFFFF : sObjectMgr->GetGenerator<HighGuid::Item>().Generate();
if (pItem->Create(guid, item, player))
{
pItem->SetCount(count);
if (!clone)

View File

@@ -213,7 +213,7 @@ bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto);
class Item : public Object
{
public:
static Item* CreateItem(uint32 item, uint32 count, Player const* player = nullptr, bool clone = false, uint32 randomPropertyId = 0);
static Item* CreateItem(uint32 item, uint32 count, Player const* player = nullptr, bool clone = false, uint32 randomPropertyId = 0, bool temp = false);
Item* CloneItem(uint32 count, Player const* player = nullptr) const;
Item();