From ce2e6f595b974ce534a695b50657a27d0998a691 Mon Sep 17 00:00:00 2001 From: Jett <55758076+Jettford@users.noreply.github.com> Date: Mon, 5 Sep 2022 23:28:32 +0100 Subject: [PATCH] Resolve incorrectly marked consumables being unusable (#770) A change was made in the mounts pull request that broke consumables without correctly marked types such as the picnic basket --- dGame/dInventory/Item.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dGame/dInventory/Item.cpp b/dGame/dInventory/Item.cpp index 695ab47b..4d4f2686 100644 --- a/dGame/dInventory/Item.cpp +++ b/dGame/dInventory/Item.cpp @@ -272,9 +272,12 @@ void Item::UseNonEquip() { if (databasePet.lot != LOT_NULL) { GetInventory()->GetComponent()->SpawnPet(this); } - } else if (type == eItemType::ITEM_TYPE_PACKAGE) { + } else { auto* compRegistryTable = CDClientManager::Instance()->GetTable("ComponentsRegistry"); const auto packageComponentId = compRegistryTable->GetByIDAndType(lot, COMPONENT_TYPE_PACKAGE); + + if (packageComponentId == 0) return; + auto* packCompTable = CDClientManager::Instance()->GetTable("PackageComponent"); auto packages = packCompTable->Query([=](const CDPackageComponent entry) {return entry.id == static_cast(packageComponentId); });