From 679f0777724503591ad6d619d3c55a61fa658771 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 6 Feb 2022 20:33:07 -0800 Subject: [PATCH 1/2] updated comment --- dGame/dComponents/InventoryComponent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/InventoryComponent.h b/dGame/dComponents/InventoryComponent.h index 7082cfff..aaf9d23a 100644 --- a/dGame/dComponents/InventoryComponent.h +++ b/dGame/dComponents/InventoryComponent.h @@ -399,8 +399,8 @@ private: std::vector FindProxies(LWOOBJID parent); /** - * Returns if the provided ID is a valid proxy item (e.g. we have children for it) - * @param parent the parent item to check for + * Returns true if the provided LWOOBJID is the parent of this Item. + * @param parent the parent item to check for proxies * @return if the provided ID is a valid proxy item */ bool IsValidProxy(LWOOBJID parent); From a6ed4350381ec857a35853c3637cd2fef92aae39 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 6 Feb 2022 20:53:45 -0800 Subject: [PATCH 2/2] Added bounds check for proxies --- dGame/dComponents/InventoryComponent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 922b2de3..e7183da2 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -1010,7 +1010,7 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) UpdateSlot(item->GetInfo().equipLocation, { item->GetId(), item->GetLot(), item->GetCount(), item->GetSlot() }); - ApplyBuff(item->GetLot()); + if (item->GetParent() == LWOOBJID_EMPTY) ApplyBuff(item->GetLot()); AddItemSkills(item->GetLot()); @@ -1038,7 +1038,7 @@ void InventoryComponent::UnEquipItem(Item* item) set->OnUnEquip(lot); } - RemoveBuff(item->GetLot()); + if (item->GetParent() == LWOOBJID_EMPTY) RemoveBuff(item->GetLot()); RemoveItemSkills(item->GetLot()); @@ -1498,7 +1498,7 @@ std::vector InventoryComponent::GenerateProxies(Item* parent) auto* inventory = GetInventory(ITEM_SETS); - auto* proxy = new Item(lot, inventory, inventory->FindEmptySlot(), 1, {}, parent->GetId(), false); + auto* proxy = new Item(lot, inventory, inventory->FindEmptySlot(), 1, {}, parent->GetId(), false, parent->GetId()); EquipItem(proxy);