Class Factories.ItemFactory
Creates item instances from multiple sources.
This factory is responsible for being able to instantiate item objects from different sources, such as item links, item ids, item names, complex strings containing item information and any other source that's available in the game that can be used to identify an item.
Methods
factories.itemfactory:createFromContainerItemInfo (containerItemInfo) | Creates an item instance from container item information, which is a table with lots of item properties that usually comes from the game API functions like C_Container.GetContainerItemInfo(). |
Metamethods
factories.itemfactory:__construct () | ItemFactory constructor. |
Methods
- factories.itemfactory:createFromContainerItemInfo (containerItemInfo)
-
Creates an item instance from container item information, which is a table
with lots of item properties that usually comes from the game API
functions like C_Container.GetContainerItemInfo().
Of course, this method extracts only the properties mapped in the Item model, and it will be improved to cover more of them in the future in case they are needed.
The properties accepted in this method can be dumped from the game using a slash command like "/dump C_Container.GetContainerItemInfo(0, 1)" and making sure there's an item in the first slot of the backpack.
Parameters:
- containerItemInfo table[string] A table containing item information
Returns:
-
Models.Item
The item instance created from the container item