com.GameInterface.InventoryBase |
One instance of this class represent an inventory. First you create it, then you regsiter it, then you use it, and in the end when about to delete it, you unregister it. The idea is that you should extend/inherit from this class. Override the empty callback functions, like ItemAdded and such, to do your stuff.
| com. | One instance of this class represent an inventory. |
| Variables | |
| m_Items | This is the array of items in this inventory. |
| Properties | |
| m_InventoryID | Type of inventory. |
| Functions | |
| InventoryBase | Constructor. |
| AddItem | Move an item from an inventory to another or the same. |
| PreviewItem | |
| PreviewCharacter | |
| DeleteItem | Delete an item from this inventory. |
| UseItem | Tries to use the given item. |
| CanAddItemToShortcuts | |
| SplitItem | Tries to split a given item |
| MakeItemLink | Tries to make a item link of the given item |
| GetFirstFreeItemSlot | |
| GetMaxItems | |
| GetInventoryID | |
| IsInitialized | |
| CreateItem | |
| GetItemXPForLevel | |
| CreateACGItemFromTemplate | |
| Variables | |
| SignalItemLoaded | Called from gamecode when an item is finished async loaded at the given pos. |
| SignalItemAdded | Called from gamecode when an item is added to this inventory at the given pos. |
| SignalItemMoved | Called from gamecode when an item is moved within this inventory. |
| SignalItemRemoved | Called from gamecode when an item is removed from this inventory, either as a move or as a delete. |
| SignalItemChanged | Called from gamecode when an item changed somehow. |
| SignalItemStatChanged | Called from gamecode when a stat on an item changes. |
| SignalInventoryExpanded | Called from gamecode when the inventory is expanded. |
| SignalItemCooldown | Called from gamecode when an item is on cooldown. |
| SignalItemCooldownRemoved | Called from gamecode when an item is removed from cooldown. |
public var m_Items: Array
This is the array of items in this inventory. The arrays size represent the maxsize of this inventory. The size may change. Signals will be sent in that case. Gamecode handles the members and content will automaticaly change to reflect the GC inventory. Signals will be sent right after changes has occurred to the array. The array is populated with com.GameInterface.InventoryItem objects.
public function get m_InventoryID():ID32
Type of inventory. ex. Enums.InvType.e_Type_GC_WeaponContainer is what you wear. e_Type_GC_WeaponContainer e_Type_GC_BackpackContainer e_Type_GC_BankContainer e_Type_GC_ChestContainer e_Type_GC_TradeContainer e_Type_GC_GuildContainer e_Type_GC_OverflowContainer e_Type_GC_ShopContainer e_Type_GC_ResourceContainer e_Type_GC_QuestContainer e_Type_MailInventory e_Type_LootInventory e_Type_GC_BeltInventory e_Type_GC_TradepostContainer
public function AddItem( srcInvID: com.Utils.ID32, srcPos: Number, dstPos: Number ) : Number
Move an item from an inventory to another or the same. Note that when you add the item to the wear inventory (e_Type_GC_WeaponContainer) you can use dstPos = Enums.ItemEquipLocation.Wear_DefaultLocation to put the item at it’s default location.
| srcInv | [in] The inventory the move was done from. |
| srcPos | [in] The pos the item came from. |
| dstPos | [in] The position the item will have in this inventory. |
| param | [out] Returns an enum indicating if the move succeed or if it’s not done yet (it’s in a dialog). |
public function SplitItem( srcInvID: com.Utils.ID32, srcPos: Number, dstPos: Number, split: Number ) : Boolean
Tries to split a given item
| srcInvID | [in] The id of the source inventory |
| srcPos | [in] The item to split. |
| dstPos | [in] where to split it to. |
| itemPos | [in] How much to split (How big will the resulting stack be). |
public var SignalItemAdded: Signal
Called from gamecode when an item is added to this inventory at the given pos. This will be called both when you get an item and if an item is moved from a different inventory to this.
| inventoryID | :com.Utils.ID32 [] identity of the inventory sending the signal |
| itemPos | [in] The position for this new item. |
public var SignalItemMoved: Signal
Called from gamecode when an item is moved within this inventory. If the toPos contains an item, then the two items swap position.
| inventoryID | :com.Utils.ID32 [] identity of the inventory sending the signal |
| fromPos | [in] Where the item was moved from. |
| toPos | [in] The items new position. |
public var SignalItemRemoved: Signal
Called from gamecode when an item is removed from this inventory, either as a move or as a delete.
| inventoryID | :com.Utils.ID32 [] identity of the inventory sending the signal |
| itemPos | [in] Where the item was removed from. |
| moved | [in] True if the item moved to some other inventory. |
This is the array of items in this inventory.
public var m_Items: Array
Type of inventory.
public function get m_InventoryID():ID32
Constructor.
public function InventoryBase( invID: ID32 )
Move an item from an inventory to another or the same.
public function AddItem( srcInvID: com.Utils.ID32, srcPos: Number, dstPos: Number ) : Number
public function PreviewItem( itemPos: Number ) : Void
public function PreviewCharacter( characterID: ID32 ) : Boolean
Delete an item from this inventory.
public function DeleteItem( itemPos: Number ) : Void
Tries to use the given item.
public function UseItem( itemPos: Number ) : Void
public function CanAddItemToShortcuts( itemPos: Number ) : Boolean
Tries to split a given item
public function SplitItem( srcInvID: com.Utils.ID32, srcPos: Number, dstPos: Number, split: Number ) : Boolean
Tries to make a item link of the given item
public function MakeItemLink( itemPos: Number ) : Void
public function GetFirstFreeItemSlot():Number
public function GetMaxItems():Number
public function GetInventoryID():ID32
public function IsInitialized():Boolean
private function CreateItem() : Void
public static function GetItemXPForLevel( itemType: Number, itemRank: Number, itemLevel: Number ):Number
public static function CreateACGItemFromTemplate( id1: Number, id2: Number, id3: Number, itemLevel: Number ):InventoryItem
Called from gamecode when an item is finished async loaded at the given pos.
public var SignalItemLoaded: Signal
Called from gamecode when an item is added to this inventory at the given pos.
public var SignalItemAdded: Signal
Called from gamecode when an item is moved within this inventory.
public var SignalItemMoved: Signal
Called from gamecode when an item is removed from this inventory, either as a move or as a delete.
public var SignalItemRemoved: Signal
Called from gamecode when an item changed somehow.
public var SignalItemChanged
Called from gamecode when a stat on an item changes.
public var SignalItemStatChanged
Called from gamecode when the inventory is expanded.
public var SignalInventoryExpanded
Called from gamecode when an item is on cooldown.
public var SignalItemCooldown
Called from gamecode when an item is removed from cooldown.
public var SignalItemCooldownRemoved