Files
DarkflameServer/dScripts/02_server/Map/njhub/NjScrollChestServer.cpp
David Markowitz 6d2a21450b fix item exploits
Update VendorComponent.cpp

Update Mail.cpp
2025-09-01 13:17:44 -07:00

18 lines
603 B
C++

#include "NjScrollChestServer.h"
#include "InventoryComponent.h"
void NjScrollChestServer::OnUse(Entity* self, Entity* user) {
const auto keyLOT = self->GetVar<LOT>(u"KeyNum");
const auto rewardItemLOT = self->GetVar<LOT>(u"openItemID");
auto* playerInventory = user->GetComponent<InventoryComponent>();
if (playerInventory != nullptr && playerInventory->GetLotCount(keyLOT) == 1) {
// Check for the key and remove
playerInventory->RemoveItem(keyLOT, 1, eInventoryType::ALL);
// Reward the player with the item set
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::NONE);
}
}