# InventoryItem
# Description
The InventoryItem class is used to retrieve and manage item-related properties in the game, such as item ID, charge count, and stack count.
# How to Use
// Get an item from a specific slot of the hero
InventoryItem* item = ObjectManager::Player()->GetItem(eSpellSlot::Item1);
if (item)
{
int itemId = item->Id();
Console::Add("Item ID: %d", itemId);
}
// Find an item with a specific ID
InventoryItem* foundItem = ObjectManager::Player()->FindItem(3070); // Tear of the Goddess
if (foundItem)
{
uint8_t stacks = foundItem->Stacks();
Console::Add("Tear of the Goddess stack count: %d", stacks);
}
# Id
int Id()
Gets the ID of the item.
InventoryItem* item = ObjectManager::Player()->GetItem(eSpellSlot::Item1);
int itemId = item->Id();
# Charges
uint8_t Charges()
Gets the number of charges of the item.
InventoryItem* item = ObjectManager::Player()->GetItem(eSpellSlot::Trinket);
uint8_t charges = item->Charges();
Console::Add("Ward charges: %d", charges);
# Stacks
uint8_t Stacks()
Gets the stack count of the item.
InventoryItem* item = ObjectManager::Player()->FindItem(2003); // Health Potion
if (item)
{
uint8_t stacks = item->Stacks();
Console::Add("Health potion count: %d", stacks);
}
← GameObject Menu →