Gorilla.Utils.Inventory
Unit Gorilla.Utils.Inventory.pasClasses
- TGorillaInventoryCustomIngredientList = class ( {System.Generics.Collections}TObjectList<Gorilla.Utils.Inventory.TGorillaInventoryIngredient> )
- TGorillaInventoryIngredientList = class ( TGorillaInventoryCustomIngredientList )
- TGorillaInventoryDependencyList = class ( TGorillaInventoryCustomIngredientList )
- TGorillaInventoryResultItemList = class ( TGorillaInventoryCustomIngredientList )
- TGorillaInventoryLanguageMap = class ( TGorillaLanguageMap )
- TGorillaInventoryParameters = class ( TGorillaParametersMap )
- TGorillaInventoryLoadingCache = class ( TObject )
- TGorillaInventoryCustomItem = class ( TCollectionItem )
- TGorillaInventoryCustomCollection = class ( TOwnedCollection )
- TGorillaInventoryItem = class ( TGorillaInventoryCustomItem )
- TGorillaInventoryItemTemplate = class ( TGorillaInventoryItem )
- TGorillaInventoryCollectable = class ( TGorillaInventoryItem )
- TGorillaInventoryItemCollection = class ( TGorillaInventoryCustomCollection )
- TGorillaInventoryCollectablesCollection = class ( TGorillaInventoryItemCollection )
- TGorillaInventoryGroup = class ( TGorillaInventoryCustomItem )
- TGorillaInventoryGroupCollection = class ( TGorillaInventoryCustomCollection )
- TGorillaInventoryIngredient = class ( TObject )
- TGorillaInventoryManufacturingProcess = class ( TObject )
- TGorillaInventoryManufacturingProcessList = class ( {System.Generics.Collections}TObjectList<Gorilla.Utils.Inventory.TGorillaInventoryManufacturingProcess> )
- TGorillaInventoryManufacturer = class ( TGorillaInventoryCustomItem )
- TGorillaInventoryManufacturerCollection = class ( TGorillaInventoryCustomCollection )
- TGorillaInventoryVisualItem = class ( TCollectionItem )
- TGorillaInventoryVisualItemCollection = class ( TOwnedCollection )
- TGorillaInventory = class ( TComponent )
Enumerations
- enum TGorillaInventoryCollectState = ( None, Allowed, Collected, QuantityExceeded, Disabled, NotFound, Missing ) ;
- enum TGorillaInventoryManufacturingState = ( Undefined, Processing, Completed, Failed ) ;
- enum TManufacturingProcessKind = ( NewItem, Upgrading, Downgrading ) ;
- enum TManufacturingNotificationType = ( mntStarted, mntPaused, mntAborted, mntCompleted, mntProcessing ) ;
Constants
- const GORILLA_INVENTORY_VISUALITEM_RESOURCE_IMGLOD0 : Integer = $0;
- const GORILLA_INVENTORY_VISUALITEM_RESOURCE_IMGLOD1 : Integer = $1;
- const GORILLA_INVENTORY_VISUALITEM_RESOURCE_IMGLOD2 : Integer = $2;
- const GORILLA_INVENTORY_VISUALITEM_RESOURCE_MODEL : Integer = $3;
TGorillaInventoryCustomIngredientList
TGorillaInventoryLanguageMap
TGorillaInventoryParameters
TGorillaInventoryLoadingCache
InventoryLoadingCache is needed for circular loading references. f.e.: sometimes templates are not loaded yet, when they are referenced.
Ancestors
Members
Fields
- protected FInventory :
TGorillaInventory
- protected FReferences :
TLoadingCacheMap
- protected FUpgrade :
TLoadingCacheMap
- protected FDowngrade :
TLoadingCacheMap
Methods
- public constructor Create ( const AInventory : TGorillaInventory ) ;
- public destructor Destroy ( ) ;
- public procedure Resolve
(
)
;
virtual;
Resolves all open references.
Properties
TGorillaInventoryCustomItem
The custom class for all item classes.
Ancestors
Members
Fields
- protected FId :
string
- protected FName :
TGorillaInventoryLanguageMap
- protected FEnabled :
Boolean
- protected FData :
TValue
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected function GetInventory ( ) : TGorillaInventory ;
- protected procedure DefineProperties ( Filer : TFiler ) ; override;
- protected procedure ReadName ( Reader : TReader ) ;
- protected procedure WriteName ( Writer : TWriter ) ;
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function GetIdentifier ( ) : string ; class abstract virtual;
- public function GetCurrentName ( ) : string ; virtual;
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; virtual;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; virtual;
Properties
TGorillaInventoryCustomCollection
Custom inventory collection with a connection to the inventory component.
Ancestors
Members
TGorillaInventoryItem
Abstract basic class for item templates and collectables
Ancestors
Members
Fields
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected procedure SetParameters ( const AValue : TGorillaInventoryParameters ) ; virtual;
- protected procedure DefineProperties ( Filer : TFiler ) ; override;
- protected procedure ReadParameters ( Reader : TReader ) ;
- protected procedure WriteParameters ( Writer : TWriter ) ;
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function GetIdentifier ( ) : string ; class override;
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; override;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; override;
Properties
- published Parameters : TGorillaInventoryParameters
A list of parameters with variant values. Every parameter is identified by a unique name. The value is a TValue record with variable content.
read FParameters
write SetParameters
TGorillaInventoryItemTemplate
Is a kind of prototype for all collectable items. Need to be pre-instanciated when creating the inventory.
Ancestors
Members
Fields
- protected FGroup :
TGorillaInventoryGroup
- protected FMaxQuantity :
Integer
- protected FWeight :
Single
- protected FMaxWeight :
Single
- protected FIsPooled :
Boolean
- protected FDependency :
TGorillaInventoryDependencyList
- protected FUpgradeItem :
TGorillaInventoryItemTemplate
- protected FDowngradeItem :
TGorillaInventoryItemTemplate
- protected FImageIndex :
Integer
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected procedure SetDependency ( const AValue : TGorillaInventoryDependencyList ) ; virtual;
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function GetIdentifier ( ) : string ; class override;
- public function Build
(
)
: TGorillaInventoryCollectable
;
virtual;
Build a collectable item on basis of this template.
- public function AddDependency
(
const
ATemplateId :
string; const
AQuantity :
Integer
)
: TGorillaInventoryIngredient
;
overload virtual;
Adds a new dependency for this template id. Dependencies are check on collecting process.
- public function AddDependency
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
AQuantity :
Integer
)
: TGorillaInventoryIngredient
;
overload virtual;
Adds a new dependency for this template. Dependencies are check on collecting process.
- public procedure RemoveDependency
(
const
ATemplateId :
string
)
;
overload virtual;
Removes a template dependency by template id
- public procedure RemoveDependency
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
;
overload virtual;
Removes a template dependency by a specific template
- public procedure ClearDependencies
(
)
;
virtual;
Clears the complete dependency list. Afterwards no more dependencies are available in the specific template.
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; override;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; override;
Properties
- published Group : TGorillaInventoryGroup
- published MaxQuantity : Integer
- published Weight : Single
- published MaxWeight : Single
- published IsPooled : Boolean
- published Dependency : TGorillaInventoryDependencyList
dependency settings, f.e. only if you have collected an ax, you can pick up wood
read FDependency
write SetDependency - published UpgradeItem : TGorillaInventoryItemTemplate
upgrade system, to make an item to another item you can define an item to upgrade to
read FUpgradeItem
write FUpgradeItem - published DowngradeItem : TGorillaInventoryItemTemplate
upgrade system, to make an item to another item you can define an item to downgrade to
read FDowngradeItem
write FDowngradeItem - published ImageIndex : Integer
Defines an index inside of a TImageList. The instanciated collectable will load automatically an image from that list, if ImageIndex > -1
read FImageIndex
write FImageIndex
TGorillaInventoryCollectable
Represents collected items with a reference to the item template
Ancestors
Members
Fields
- protected FTemplate :
TGorillaInventoryItemTemplate
- protected FQuantity :
Integer
- protected FWeight :
Single
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- public function GetIdentifier ( ) : string ; class override;
- public function GetCurrentName ( ) : string ; override;
- public function IsUpgradable
(
)
: Boolean
;
virtual;
Checks if a collected item is upgradable
- public function IsDowngradable
(
)
: Boolean
;
virtual;
Checks if a collected item is downgradable
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; override;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; override;
Properties
TGorillaInventoryItemCollection
The basic collection for item-templates and collectables
Ancestors
TGorillaInventoryCollectablesCollection
This is an extended collection of TGorillaInventoryItemCollection. We now have a "ToArray" function to easily return an array of all collectables to submit it to the manufacture() method.
Ancestors
Members
TGorillaInventoryGroup
An inventory group represents a categorization of specific items, f.e. weapons, keys, diary, notes, ...
Ancestors
Members
Fields
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function GetIdentifier ( ) : string ; class override;
- public function CountCollectables
(
)
: Integer
;
virtual;
Counts all currently available collected items belonging to this group.
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; override;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; override;
Properties
TGorillaInventoryGroupCollection
Collection of inventory item groups
Ancestors
TGorillaInventoryIngredient
An inventory ingredient is used f.e. for manufacturing multiple items to a single item, f.e. you have 1 bough + 1 elastic band = 1 slingshot For every ingredient you can set a quantity to define how many of this specific item is needed. By default this value is 1.
Ancestors
Members
Fields
Methods
- public constructor Create ( const ATemplate : TGorillaInventoryItemTemplate; const AQuantity : Integer = $1 ) ;
- public destructor Destroy ( ) ;
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; virtual;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; virtual;
Properties
TGorillaInventoryManufacturingProcess
For every manufacturing process inside of the manufacturer a new instance will be created to manage multiple processing on the same manufacturer. For example: You want to build 5 cars from ingredients parallel.
Ancestors
Members
Fields
- protected FManufacturer :
TGorillaInventoryManufacturer
- protected FKind :
TManufacturingProcessKind
- protected FIsInTimer :
Boolean
- protected FManufacturingProgress :
Integer
- protected FManufacturingTimer :
TTimer
- protected FCollectables :
TGorillaInventoryCollectablesCollection
Methods
- public constructor Create ( const AManufacturer : TGorillaInventoryManufacturer; const AKind : TManufacturingProcessKind ) ;
- public destructor Destroy ( ) ;
- protected function GetProgress ( ) : Integer ;
- protected procedure DoOnManufacturingProcess ( ASender : TObject ) ;
- protected procedure MoveItemsToLocalList
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
;
This method will move all necessary items from the input array to a local collectable list. On process destruction these items will be destroyed. If AItemList contains more items than necessary, those will not be moved!
- public procedure Start
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
;
Start manufacturing process
- public procedure Pause
(
)
;
virtual;
Pause manufacturing process
- public procedure Abort
(
const
ADestroyOnFinish :
Boolean
)
;
virtual;
Abort manufacturing process
- public procedure Complete
(
)
;
virtual;
Completes the manufacturing process
Properties
TGorillaInventoryManufacturingProcessList
TGorillaInventoryManufacturer
Used to combine a specific number of items to a new item. The component offers a timespan to simulate a manufacturing process. If TimeNeeded > 0: a timer-event will be started When this event is thrown, the new item will be available. If TimeNeeded <= 0: the manufacturing process will be executed immediatly
Ancestors
Members
Fields
- protected FIngredients :
TGorillaInventoryIngredientList
- protected FDependency :
TGorillaInventoryDependencyList
- protected FResultItems :
TGorillaInventoryResultItemList
- protected FKind :
TManufacturingProcessKind
- protected FTimeNeeded :
Integer
- protected FProcesses :
TGorillaInventoryManufacturingProcessList
- protected FOnNotify :
TOnManufacturingNotify
- protected FOnProduced :
TOnManufacturingProduced
Methods
- public constructor Create ( ACollection : TCollection ) ;
- public destructor Destroy ( ) ;
- protected function GetIngredientsInfoMap ( ) : TGorillaInventoryManufacturer.TIngredientsMap ;
- protected function GetCollectablesInfoMap ( const AItemList : TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable> ) : TGorillaInventoryManufacturer.TIngredientsMap ;
- protected procedure SetIngredients ( const AValue : TGorillaInventoryIngredientList ) ; virtual;
- protected procedure SetDependency ( const AValue : TGorillaInventoryDependencyList ) ; virtual;
- protected procedure SetResultItems ( const AValue : TGorillaInventoryResultItemList ) ; virtual;
- protected procedure RemoveProcess
(
const
AProcess :
TGorillaInventoryManufacturingProcess
)
;
virtual;
Removes a manufacturing process from manufacturer. This method will automatically be executed by the process itself.
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function GetIdentifier ( ) : string ; class override;
- public function CheckDependency
(
)
: Boolean
;
virtual;
Only checks if set item dependency is valid and the expected number is already collected. The method will automatically be called by Verify().
- public function Verify
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: Boolean
;
virtual;
Verifies if this manufacturer is suitable with this array of collected items and given dependencies. TRUE, if all ingredients are give by the array and dependencies are valid. FALSE, if the number of ingredients is not correct or a specific ingredient is missing, or at least one dependency is not given.
- public procedure AddIngredient
(
const
ATemplateId :
string; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Adds an existing template as ingredient with a quantity, which defines how many of those items are needed.
- public procedure AddIngredient
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Adds an existing template as ingredient with a quantity, which defines how many of those items are needed.
- public procedure RemoveIngredient
(
const
ATemplateId :
string
)
;
overload virtual;
Removes an ingredient from manufacturer by template id.
- public procedure RemoveIngredient
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
;
overload virtual;
Removes an ingredient from manufacturer by template.
- public procedure AddDependency
(
const
ATemplateId :
string; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Add a specific template item as condition to allow manufacturing.
- public procedure AddDependency
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Add a specific template item as condition to allow manufacturing.
- public procedure RemoveDependency
(
const
ATemplateId :
string
)
;
overload virtual;
Removes a dependency from manufacturer by template id.
- public procedure RemoveDependency
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
;
overload virtual;
Removes an ingredient from manufacturer by template.
- public procedure AddResultItem
(
const
ATemplateId :
string; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Adds an existing template as result item with a quantity, which defines how many of those items are needed.
- public procedure AddResultItem
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
AQuantity :
Integer
=
$1
)
;
overload virtual;
Adds an existing template as result item with a quantity, which defines how many of those items are needed.
- public procedure RemoveResultItem
(
const
ATemplateId :
string
)
;
overload virtual;
Removes a result item from manufacturer by template id.
- public procedure RemoveResultItem
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
;
overload virtual;
Removes a result item from manufacturer by template.
- public procedure ClearIngredients
(
)
;
virtual;
Clears all added ingredients
- public procedure ClearDependencies
(
)
;
virtual;
Clears all added dependencies
- public procedure ClearResultItems
(
)
;
virtual;
Clears all added result items
- public function Produce
(
)
: TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
;
virtual;
Will produce the result items immediatly. This method will automatically be called by Complete()
- public function Start
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TGorillaInventoryManufacturingProcess
;
virtual;
Starts and returns a manufacturing process instance. This is a handle on which you should request the progress or pause, abort, ...
- public function GetDescriptionString
(
)
: string
;
virtual;
This method builds a string, describing which ingredients and quantities needed, and what item will be created. f.e.: Wood(3) + Stone(2) + Grass(1) => Campfire(1)
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; override;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; override;
Properties
- published Ingredients : TGorillaInventoryIngredientList
- published Dependency : TGorillaInventoryDependencyList
Declare dependencies to collected items. For example, if you want a manufacturer only be executable if you have collected a knife.
read FDependency
write SetDependency - published ResultItems : TGorillaInventoryResultItemList
Item templates which will be build by this manufacturer, if all necessary ingredients are available. Multiple results are possible.
read FResultItems
write SetResultItems - published Kind : TManufacturingProcessKind
- published TimeNeeded : Integer
Time needed to build the result item in milliseconds. If this value is > 0, a timer will be started. At the end, the result item will be produced. The default value is 3000 (= 3 second)
read FTimeNeeded
write FTimeNeeded
TGorillaInventoryManufacturerCollection
Collection of manufacturing processes
Ancestors
TGorillaInventoryVisualItem
A single predefined visual representation of a inventory item/template/... A visual representation can be set an image at different levels of detail, or a mesh file.
Ancestors
Members
Fields
Methods
- protected function GetDisplayName ( ) : string ; override;
- protected procedure SetDisplayName ( const AValue : string ) ; override;
- protected function GetResource ( AIndex : Integer ) : string ; virtual;
- protected procedure SetResource ( AIndex : Integer; const AValue : string ) ; virtual;
- public procedure Assign ( ASrc : TPersistent ) ; override;
- public function ToXml ( const AParent : TMz_XmlElement ) : TMz_XmlElement ; virtual;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; virtual;
Properties
TGorillaInventoryVisualItemCollection
A collection of predefined visual representations to be linked by "ImageIndex" to a specific item.
Ancestors
Members
Fields
Methods
- protected function GetImageLODSize ( AIndex : Integer ) : TPoint ; virtual;
- protected procedure SetImageLODSize ( AIndex : Integer; const AValue : TPoint ) ; virtual;
- protected procedure PresetImageLODSizes ( ) ;
- public procedure ToXml ( const AParent : TMz_XmlElement ) ; virtual;
- public procedure FromXml ( const ANode : TMz_XmlElement; const ACache : TGorillaInventoryLoadingCache ) ; virtual;
- public procedure Exchange ( AIdx1 : Integer; AIdx2 : Integer ) ;
Properties
TGorillaInventory
Inventory component for managing templates, collected items, groups and manufacturing processes.
Ancestors
Members
Fields
- protected FItemTemplates :
TGorillaInventoryItemCollection
- protected FGroups :
TGorillaInventoryGroupCollection
- protected FManufacturers :
TGorillaInventoryManufacturerCollection
- protected FCollectedItems :
TGorillaInventoryCollectablesCollection
- protected FVisualItems :
TGorillaInventoryVisualItemCollection
- protected FFileName :
string
- protected FLanguage :
Integer
- protected FImageLists :
- protected FImageListsModified :
- protected FOnItemNotify :
TOnInventoryItemNotify
- protected FOnAddManufacturing :
TOnInventoryAddManufacturing
- protected FOnLoadResource :
TOnInventoryLoadResource
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected procedure SetItemTemplates ( const AValue : TGorillaInventoryItemCollection ) ;
- protected procedure SetGroups ( const AValue : TGorillaInventoryGroupCollection ) ;
- protected procedure SetManufacturers ( const AValue : TGorillaInventoryManufacturerCollection ) ;
- protected procedure SetCollectedItems ( const AValue : TGorillaInventoryCollectablesCollection ) ;
- protected procedure SetVisualItems ( const AValue : TGorillaInventoryVisualItemCollection ) ;
- protected function GetImageList ( AIndex : Integer ) : TImageList ; virtual;
- protected function DoManufactureUnverified
(
const
AManufacturer :
TGorillaInventoryManufacturer; const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TGorillaInventoryManufacturingProcess
;
virtual;
Creates a manufacturing process without previous manufactuer verification of ingredients and submitted items.
- public function Clone
(
)
: TGorillaInventory
;
virtual;
Creates a cloned instance of a specific inventory with all its components.
- public procedure Clear
(
)
;
virtual;
Destroys all templates, groups, manufacturers and collected items
- public function GetCurrentLanguageName
(
)
: string
;
virtual;
Get the current language locale code, f.e. "en-us", "de-de"
- public function AddVisualItem ( const AIndex : Integer; const AName : string; const ALOD0 : string; const ALOD1 : string; const ALOD2 : string; const AModelFile : string ) : TGorillaInventoryVisualItem ;
- public procedure RemoveVisualItem
(
const
AName :
string
)
;
virtual;
Removes a specific visual item representation by its display name. If not visual item with this name can be found, the method will ignore the call.
- public procedure ClearVisualItems
(
)
;
virtual;
Clears all registered visual item representations from inventory. Eventually linked items will be invalid at this moment.
- public function GetVisualItemByName ( const AName : string ) : TGorillaInventoryVisualItem ; virtual;
- public function AddItemTemplate
(
const
ATemplateId :
string
)
: TGorillaInventoryItemTemplate
;
virtual;
Adds a new and empty item template.
- public procedure RemoveItemTemplate
(
const
ATemplateId :
string
)
;
overload virtual;
Removes an item templates by id and destroys all collected items using this specific template. Also all dependencies are check and eventually removed from those.
- public procedure RemoveItemTemplate
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
;
overload virtual;
Removes an item templates and destroys all collected items using this specific template. Also all dependencies are check and eventually removed from those.
- public function FindItemTemplate
(
const
ATemplateId :
string
)
: TGorillaInventoryItemTemplate
;
virtual;
Searches for an item template by its id
- public function FindCollectedItems
(
const
AId :
string
)
: TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
;
overload virtual;
Searches for all collected items inherited by this specific template
- public function FindCollectedItems
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
: TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
;
overload virtual;
Searches for all collected items inherited by this specific template
- public function FindFirstCollectedItem
(
const
AId :
string
)
: TGorillaInventoryCollectable
;
overload virtual;
Searches for the first collected item inherited by a specific template. This method is used for pooled items, so we don't have to scan the complete list.
- public function FindFirstCollectedItem
(
const
ATemplate :
TGorillaInventoryItemTemplate
)
: TGorillaInventoryCollectable
;
overload virtual;
Searches for the first collected item inherited by a specific template. This method is used for pooled items, so we don't have to scan the complete list.
- public function AddGroup
(
const
AGroupId :
string
)
: TGorillaInventoryGroup
;
Adds a new group with a submitted id.
- public procedure RemoveGroup
(
const
AGroupId :
string
)
;
overload virtual;
Removes a group by id and unlinks it from all templates.
- public procedure RemoveGroup
(
const
AGroup :
TGorillaInventoryGroup
)
;
overload virtual;
Removes a group and unlinks it from all templates.
- public function FindGroup
(
const
AGroupId :
string
)
: TGorillaInventoryGroup
;
Searches for a specific item group by its id
- public function AddManufacturer
(
const
AManId :
string
)
: TGorillaInventoryManufacturer
;
Adds and returns a new manufacturer to the inventory system. Afterwards you need to add ingredients, result-type and time-needed.
- public procedure RemoveManufacturer
(
const
AManId :
string
)
;
overload virtual;
Removes a specific manufacturer by id from inventory.
- public procedure RemoveManufacturer
(
const
AMan :
TGorillaInventoryManufacturer
)
;
overload virtual;
Removes a specific manufacturer from inventory.
- public function FindManufacturer
(
const
AId :
string
)
: TGorillaInventoryManufacturer
;
Searches for a specific manufacturer by its id
- public function IsCollectable
(
const
ATemplateId :
string; const
ACount :
Cardinal
=
$1
)
: TGorillaInventoryCollectState
;
overload;
Checks if an item is collectable, specified by its template. The method checks if it's allowed to pick up an item. It will return a collection state.
- public function IsCollectable
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
ACount :
Cardinal
=
$1
)
: TGorillaInventoryCollectState
;
overload;
Checks if an item is collectable, specified by its template. The method checks if it's allowed to pick up an item. It will return a collection state.
- public function Collect
(
const
ATemplateId :
string
)
: TGorillaInventoryCollectable
;
overload virtual;
Trys to collect an item, specified by its template. The method will execute the IsCollectable() routine to check if it is allowed to pick it up. The method returns a state of collection, f.e. QuantityExceeded, Collected, ... in the out-parameter AState The method will return a collectable item instance, if AState = "Collected"
- public function Collect
(
const
ATemplate :
TGorillaInventoryItemTemplate; out
AState :
TGorillaInventoryCollectState
)
: TGorillaInventoryCollectable
;
overload virtual;
Trys to collect an item, specified by its template. The method will execute the IsCollectable() routine to check if it is allowed to pick it up. The method returns a state of collection, f.e. QuantityExceeded, Collected, ... in the out-parameter AState The method will return a collectable item instance, if AState = "Collected"
- public function Collect
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
ACount :
Cardinal; out
AState :
TGorillaInventoryCollectState
)
: TGorillaInventoryCollectable
;
overload virtual;
Trys to collect an item, specified by its template. The method will execute the IsCollectable() routine to check if it is allowed to pick it up. The method expects a number of items to be selected. The method returns a state of collection, f.e. QuantityExceeded, Collected, ... in the out-parameter AState The method will return a collectable item instance, if AState = "Collected"
- public procedure DropCollectedItem
(
const
AItem :
string; const
ADropAll :
Boolean
)
;
overload virtual;
Removes a collected item from inventory.
- public procedure DropCollectedItem
(
const
AItem :
TGorillaInventoryCollectable; const
ACount :
Integer
=
$FFFFFFFF
)
;
overload virtual;
Removes a collected item from inventory.
- public procedure DropCollectedItem
(
const
ATemplate :
TGorillaInventoryItemTemplate; const
ADropAll :
Boolean
)
;
overload virtual;
Removes a collected item from inventory.
- public function GetSuitableManufacturer
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TGorillaInventoryManufacturer
;
virtual;
Depending on the given list of collected items - the method tries to find a suitable manufacturer. It will only return the first suitable manufacturer! If you're using multiple manufacturers with equivalent ingredients use GetSuitableManufacturers() method to get all suitable instances.
- public function GetSuitableManufacturers
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TList<Gorilla.Utils.Inventory.TGorillaInventoryManufacturer>
;
virtual;
Depending on the given list of collected items - the method tries to find all suitable manufacturers.
- public function Manufacture
(
const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TGorillaInventoryManufacturingProcess
;
overload virtual;
Use this method if you only have a number of collected items. The method will try to find a suitable manufacturer and will automatically execute manufacturing process. The result is the manufacturing process instance.
- public function Manufacture
(
const
AManufacturer :
TGorillaInventoryManufacturer; const
AItemList :
TArray<Gorilla.Utils.Inventory.TGorillaInventoryCollectable>
)
: TGorillaInventoryManufacturingProcess
;
overload virtual;
Use this method if you have a specific manufacturer. The method will check for you, if your collected items suits the conditions (including quantities). It will automatically execute manufacturing process. The result is the manufacturing process instance.
- public function Upgrade
(
const
AItem :
TGorillaInventoryCollectable
)
: TGorillaInventoryManufacturingProcess
;
virtual;
Level up a specific collectable item.
- public function Downgrade
(
const
AItem :
TGorillaInventoryCollectable
)
: TGorillaInventoryManufacturingProcess
;
virtual;
Level down a specific collectable item.
- public procedure SaveToFile
(
const
AFilename :
string
)
;
virtual;
Store inventory including templates, groups, manufacturers, collected items to xml file.
- public procedure SaveToStream
(
const
AStream :
TStream
)
;
virtual;
Store inventory including templates, groups, manufacturers, collected items to xml stream.
- public procedure LoadFromFile
(
const
AFilename :
string
)
;
virtual;
Load an inventory from xml file format. all components will be added to the current inventory.
- public procedure LoadFromStream
(
const
AStream :
TStream
)
;
virtual;
Load an inventory from xml file format. all components will be added to the current inventory.
- public procedure SetImageListsModified
(
)
;
Set all cached image lists as modified to refresh those. This will load up all images again.
- public procedure UnsetImageListsModified
(
)
;
Mark all image lists as not-modified. This will prevent the inventory from refreshing cached image lists.
- public procedure SetImageListModified
(
AIndex :
Integer
)
;
Set a specific cached list as modified to refresh it. This will load up all images again.
- public procedure UnsetImageListModified
(
AIndex :
Integer
)
;
Mark a specific cached image list as not-modified. This will prevent the inventory from refreshing cached image lists.
Properties
- public FileName : stringread FFileName
- public ImageLists[Index] : TImageListread GetImageList
- public ImageListLOD0 : TImageListread GetImageList
- public ImageListLOD1 : TImageListread GetImageList
- public ImageListLOD2 : TImageListread GetImageList
- published ItemTemplates : TGorillaInventoryItemCollection
add here all possibly available items this represents NOT the collected items of the user.
read FItemTemplates
write SetItemTemplates - published Groups : TGorillaInventoryGroupCollection
- published Manufacturers : TGorillaInventoryManufacturerCollection
add here all possibly available item combinations. f.e. you have 1 bough + 1 elastic band = 1 slingshot
read FManufacturers
write SetManufacturers - published CollectedItems : TGorillaInventoryCollectablesCollection
add here all collected items the user should see these items will be displayed as inventory items.
read FCollectedItems
write SetCollectedItems - published VisualItems : TGorillaInventoryVisualItemCollection
Get or set a collection of visual representations for items. Each visual item has an index set, which is the identification for linking to a specific item/template.
read FVisualItems
write SetVisualItems - published Language : Integer