Gorilla.Utils.Inventory Unit Reference

Overview

The Gorilla.Utils.Inventory unit implements the Gorilla3D inventory system. It uses a template-instance pattern: groups organize item templates, templates define item blueprints, and collectables are runtime instances. The system supports crafting/manufacturing, upgrade/downgrade chains, dependencies, multi-language names, custom parameters, and XML serialization.

Class Hierarchy

TComponent
  └── TGorillaInventory

TCollectionItem
  └── TGorillaInventoryCustomItem
        └── TGorillaInventoryItem
              ├── TGorillaInventoryItemTemplate
              └── TGorillaInventoryCollectable
        └── TGorillaInventoryGroup

TObjectList<TGorillaInventoryIngredient>
  └── TGorillaInventoryCustomIngredientList
        ├── TGorillaInventoryIngredientList
        ├── TGorillaInventoryDependencyList
        └── TGorillaInventoryResultItemList

Enumerations

TGorillaInventoryCollectState

Value Description
None No action
Allowed Collection permitted
Collected Successfully collected
QuantityExceeded Max quantity reached
Disabled Item template is disabled
NotFound Template not found
Missing Missing dependency

TGorillaInventoryManufacturingState

Value Description
Undefined Not started
Processing Crafting in progress
Completed Crafting finished
Failed Crafting failed

TGorillaInventoryCustomItem

Base class for all inventory items.

Published Properties

Property Type Description
Id String Unique identifier
Enabled Boolean Whether the item can be used
Data TValue Runtime data (not serialized)
Name TGorillaInventoryLanguageMap Multi-language display name
ImageIndex Integer Icon index in TImageList

Public Properties

Property Type Description
Inventory TGorillaInventory Parent inventory component

TGorillaInventoryItem

Extends base item with custom parameters.

Published Properties

Property Type Description
Parameters TGorillaInventoryParameters Custom key-value parameters

TGorillaInventoryItemTemplate

Blueprint/prototype for collectible items.

Published Properties

Property Type Description
Group TGorillaInventoryGroup Category group
MaxQuantity Integer Maximum stack size
Weight Single Item weight
MaxWeight Single Maximum weight
IsPooled Boolean Whether instances are pooled
UpgradeItem TGorillaInventoryItemTemplate Next tier upgrade
DowngradeItem TGorillaInventoryItemTemplate Previous tier downgrade
Dependency TGorillaInventoryDependencyList Required items for collection

Public Methods

Method Description
Build() Create a TGorillaInventoryCollectable from this template
AddDependency(AId, AQuantity) Add a collection dependency

TGorillaInventoryCollectable

A runtime instance of a template in the player's inventory.

Published Properties

Inherits Id, Name, Parameters, Data from parent classes.

TGorillaInventoryGroup

Category for organizing item templates.

Published Properties

Property Type Description
Templates TGorillaInventoryItemCollection Item templates in this group

TGorillaInventoryManufacturer

Crafting system for combining items.

Classes

Class Description
TGorillaInventoryManufacturer Contains crafting processes
TGorillaInventoryManufacturingProcess A single recipe with ingredients and results
TGorillaInventoryIngredient An ingredient (template reference + quantity)

TGorillaInventory

Main inventory component.

Published Properties

Property Type Description
Groups TGorillaInventoryGroupCollection Item group categories
Manufacturers TGorillaInventoryManufacturerCollection Crafting recipes
Language String Current language for display names
ImageList TImageList Linked image list for icons

Serialization Methods

Method Description
ToXml(AParent) Serialize to XML element
FromXml(ANode, ACache) Deserialize from XML element

Helper Classes

TGorillaInventoryLanguageMap

Multi-language string map extending TGorillaLanguageMap with XML serialization.

TGorillaInventoryParameters

Custom key-value parameter map extending TGorillaParametersMap with XML serialization.

TGorillaInventoryLoadingCache

Resolves circular references during XML loading (templates referencing other templates for upgrade/downgrade chains).

See Also