From 7418e02365683baa8a0b7e6442ade907cb9dfb43 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 17 Jan 2023 04:07:34 -0800 Subject: [PATCH] Update AmTeapotServer.cpp (#949) --- dScripts/02_server/Map/AM/AmTeapotServer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dScripts/02_server/Map/AM/AmTeapotServer.cpp b/dScripts/02_server/Map/AM/AmTeapotServer.cpp index 32abafd6..1f47cb1a 100644 --- a/dScripts/02_server/Map/AM/AmTeapotServer.cpp +++ b/dScripts/02_server/Map/AM/AmTeapotServer.cpp @@ -1,14 +1,21 @@ #include "AmTeapotServer.h" #include "InventoryComponent.h" #include "GameMessages.h" - +#include "Item.h" void AmTeapotServer::OnUse(Entity* self, Entity* user) { auto* inventoryComponent = user->GetComponent(); if (!inventoryComponent) return; - if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10) { - inventoryComponent->RemoveItem(BLUE_FLOWER_LEAVES, 10); + auto* blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::ITEMS); + if (!blueFlowerItem) { + blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::VAULT_ITEMS); + if (!blueFlowerItem) return; + } + + // The client allows you to use the teapot only if you have a stack of 10 leaves in some inventory somewhere. + if (blueFlowerItem->GetCount() >= 10) { + blueFlowerItem->SetCount(blueFlowerItem->GetCount() - 10); inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1); } GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());