com.GameInterface.InventoryBase

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.

Summary
com.GameInterface.InventoryBaseOne instance of this class represent an inventory.
Variables
m_ItemsThis is the array of items in this inventory.
Properties
m_InventoryIDType of inventory.
Functions
InventoryBaseConstructor.
AddItemMove an item from an inventory to another or the same.
PreviewItem
PreviewCharacter
DeleteItemDelete an item from this inventory.
UseItemTries to use the given item.
CanAddItemToShortcuts
SplitItemTries to split a given item
MakeItemLinkTries to make a item link of the given item
GetFirstFreeItemSlot
GetMaxItems
GetInventoryID
IsInitialized
CreateItem
GetItemXPForLevel
CreateACGItemFromTemplate
Variables
SignalItemLoadedCalled from gamecode when an item is finished async loaded at the given pos.
SignalItemAddedCalled from gamecode when an item is added to this inventory at the given pos.
SignalItemMovedCalled from gamecode when an item is moved within this inventory.
SignalItemRemovedCalled from gamecode when an item is removed from this inventory, either as a move or as a delete.
SignalItemChangedCalled from gamecode when an item changed somehow.
SignalItemStatChangedCalled from gamecode when a stat on an item changes.
SignalInventoryExpandedCalled from gamecode when the inventory is expanded.
SignalItemCooldownCalled from gamecode when an item is on cooldown.
SignalItemCooldownRemovedCalled from gamecode when an item is removed from cooldown.

Variables

m_Items

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.

Properties

m_InventoryID

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

Functions

InventoryBase

public function InventoryBase(invID: ID32)

Constructor.

AddItem

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.

Parameters

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).

PreviewItem

public function PreviewItem(itemPos: Number) : Void

PreviewCharacter

public function PreviewCharacter(characterID: ID32) : Boolean

DeleteItem

public function DeleteItem(itemPos: Number) : Void

Delete an item from this inventory.  A confirmation dialog box will be shown from gamecode as a security meassure.

Parameters

itemPos[in] The item to delete.

UseItem

public function UseItem(itemPos: Number) : Void

Tries to use the given item.

Parameters

itemPos[in] The item to use.

CanAddItemToShortcuts

public function CanAddItemToShortcuts(itemPos: Number) : Boolean

SplitItem

public function SplitItem(srcInvID: com.Utils.ID32,
srcPos: Number,
dstPos: Number,
split: Number) : Boolean

Tries to split a given item

Parameters

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).

MakeItemLink

public function MakeItemLink(itemPos: Number) : Void

Tries to make a item link of the given item

Parameters

itemPos[in] The item to make item link of.

GetFirstFreeItemSlot

public function GetFirstFreeItemSlot():Number

GetMaxItems

public function GetMaxItems():Number

GetInventoryID

public function GetInventoryID():ID32

IsInitialized

public function IsInitialized():Boolean

CreateItem

private function CreateItem() : Void

GetItemXPForLevel

public static function GetItemXPForLevel(itemType: Number,
itemRank: Number,
itemLevel: Number):Number

CreateACGItemFromTemplate

public static function CreateACGItemFromTemplate(
   id1: Number,
   id2: Number,
   id3: Number,
   itemLevel: Number
):InventoryItem

Variables

SignalItemLoaded

public var SignalItemLoaded: Signal

Called from gamecode when an item is finished async loaded at the given pos.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] The position for this new item.

SignalItemAdded

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.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] The position for this new item.

SignalItemMoved

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.

Parameters

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.

SignalItemRemoved

public var SignalItemRemoved: Signal

Called from gamecode when an item is removed from this inventory, either as a move or as a delete.

Parameters

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.

SignalItemChanged

public var SignalItemChanged

Called from gamecode when an item changed somehow.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] The item in question.

SignalItemStatChanged

public var SignalItemStatChanged

Called from gamecode when a stat on an item changes.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] Item in question.
stat[in] The stat that changed.
newValue[in] The new value of for this stat.

SignalInventoryExpanded

public var SignalInventoryExpanded

Called from gamecode when the inventory is expanded.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
newSize[in] The new total size of the inventory.  The m_Items will already have the new size.

SignalItemCooldown

public var SignalItemCooldown

Called from gamecode when an item is on cooldown.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] The position in the inventory the item is
seconds[in] the number of seconds left in cooldown

SignalItemCooldownRemoved

public var SignalItemCooldownRemoved

Called from gamecode when an item is removed from cooldown.

Parameters

inventoryID:com.Utils.ID32 [] identity of the inventory sending the signal
itemPos[in] The position in the inventory the item is
public var m_Items: Array
This is the array of items in this inventory.
public function get m_InventoryID():ID32
Type of inventory.
public function InventoryBase(invID: ID32)
Constructor.
public function AddItem(srcInvID: com.Utils.ID32,
srcPos: Number,
dstPos: Number) : Number
Move an item from an inventory to another or the same.
public function PreviewItem(itemPos: Number) : Void
public function PreviewCharacter(characterID: ID32) : Boolean
public function DeleteItem(itemPos: Number) : Void
Delete an item from this inventory.
public function UseItem(itemPos: Number) : Void
Tries to use the given item.
public function CanAddItemToShortcuts(itemPos: Number) : Boolean
public function SplitItem(srcInvID: com.Utils.ID32,
srcPos: Number,
dstPos: Number,
split: Number) : Boolean
Tries to split a given item
public function MakeItemLink(itemPos: Number) : Void
Tries to make a item link of the given item
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
public var SignalItemLoaded: Signal
Called from gamecode when an item is finished async loaded at the given pos.
public var SignalItemAdded: Signal
Called from gamecode when an item is added to this inventory at the given pos.
public var SignalItemMoved: Signal
Called from gamecode when an item is moved within this inventory.
public var SignalItemRemoved: Signal
Called from gamecode when an item is removed from this inventory, either as a move or as a delete.
public var SignalItemChanged
Called from gamecode when an item changed somehow.
public var SignalItemStatChanged
Called from gamecode when a stat on an item changes.
public var SignalInventoryExpanded
Called from gamecode when the inventory is expanded.
public var SignalItemCooldown
Called from gamecode when an item is on cooldown.
public var SignalItemCooldownRemoved
Called from gamecode when an item is removed from cooldown.
Close