mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
6aa90ad5b2
* Breakout rest of the enums from dcommonvars so we don't have to deal with merge conflicts ePlayerFlags is not a scoped enum, yet, due to it's complexity * address feedback * make player flag types consistent * fix typo
24 lines
950 B
C++
24 lines
950 B
C++
#include "AmTeapotServer.h"
|
|
#include "InventoryComponent.h"
|
|
#include "GameMessages.h"
|
|
#include "Item.h"
|
|
#include "eTerminateType.h"
|
|
|
|
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
|
|
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
|
if (!inventoryComponent) return;
|
|
|
|
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(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
|
}
|