mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
17
dScripts/02_server/Map/njhub/NjScrollChestServer.cpp
Normal file
17
dScripts/02_server/Map/njhub/NjScrollChestServer.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#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);
|
||||
|
||||
// Reward the player with the item set
|
||||
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user