From 48bf9d083a8ed2b9e91873e6ac9fd2bb6959ade0 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sat, 5 Aug 2023 23:23:56 +0800 Subject: [PATCH] reduce item instance guid consume --- src/PlayerbotFactory.cpp | 5 ++++- src/strategy/values/ItemUsageValue.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 3eedaf40..4a0491dc 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -1409,7 +1409,10 @@ void PlayerbotFactory::InitBags() for (uint8 slot = INVENTORY_SLOT_BAG_START; slot < INVENTORY_SLOT_BAG_END; ++slot) { uint32 newItemId = 23162; - + Item *old_bag = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); + if (old_bag && old_bag->GetTemplate()->ItemId == newItemId) { + continue; + } uint16 dest; if (!CanEquipUnseenItem(slot, dest, newItemId)) continue; diff --git a/src/strategy/values/ItemUsageValue.cpp b/src/strategy/values/ItemUsageValue.cpp index 598d321e..a2a40f6f 100644 --- a/src/strategy/values/ItemUsageValue.cpp +++ b/src/strategy/values/ItemUsageValue.cpp @@ -154,7 +154,7 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto) if (itemProto->InventoryType == INVTYPE_NON_EQUIP) return ITEM_USAGE_NONE; - Item* pItem = Item::CreateItem(itemProto->ItemId, 1, bot); + Item* pItem = Item::CreateItem(itemProto->ItemId, 1, bot, false, 0, true); if (!pItem) return ITEM_USAGE_NONE;