Resources
arcalet introduction
Example
Download
API usage instruction › Arcalet Item › Method

Method

Players
public static void GetItemInstance(ArcaletGame game,OnCallCompletionWithData cb, object token)
game      the ArcaletGame object created on login.

This method is used to obtain an object owned by a player in the game, also known as an object instance.

The type of the obj of cb(code,obj,token) is List. Each element of the List represents an item owned by the player.

'iguid'       The iguid of the object.
'name'      The name of the object.
'id'              The id of the object.
'now'         The server's system time, formatted: yyyy/mm/dd hh:mm:ss
'attr'           The data of attribute is key = value. The key here is set in the background when 
                   developers specify the object category. In addition to the default that is set when it 
                   is defined, its value can be changed.

Since there can be more than one attribute, the attributes here are recorded by
List. The element types of List are Hashtable, which contains three keys:

"name"        The attribute's name, which is also its key.
"value"         The attribute's value.
"stamp"       The time when the attribute is written.

If the object does not set the property, then Hashtable["attr”] = null

void cb(int code, object obj, object token)
code 0 means the setup succeeded. A code other than 0 means the setup failed.

Elements of List can be extracted one by one. The following is an example:
C#
public static void GetItemInstance(ArcaletGame game,string iguid,OnCallCompletionWithData cb, object token)
game      Game Login
iguid        Used to specify the iguid of the object to be obtained.

Use this method to obtain the specified object using iguid, owned by a player in the game, also known as an (instance). The type of the obj of cb(code,obj,token) is List. Each element of the List is the item (instance) owned by the player. There are 4 keys:

"iguid"       The iguid of the object
"name"      The name of the instance
"id"             The id of the object
"now"         The server's system time, formatted: yyyy/mm/dd hh:mm:ss
"attr"           The data of the "attr" attribute is key = value. The key here is set in the background 
                    when developers specify the object category. In addition to the default when it is 
                    defined, its value can be changed.

Since there can be more than one attribute, the attributes here are recorded by
List. The elements are type List containing Hashtable, which contains
three Keys:

"name"      The attribute's name, which is also its key
"value"       The attribute's value
"stamp"     The time when the attribute is written

If this item does not have any attributes set, then Hashtable[“attr”] = null

void cb(int code, object obj, object token)
code 0 means the setup succeeded. A code other than 0 means the setup failed.
public static void GetItemClass(ArcaletGame game,int option, OnCallCompletionWithData cb, object token)
game      Game Login
option      values mean the following:

0       Only obtain item types not sold in the mall (property)
1       Only obtain item types on sale in the mall (product)
2       All object categories (property + product)
3       Objects hidden to players (data)

Based on the value of the parameter option, obtain the items that the developers defined in the background, also known as the item category.

The type of the obj of cb(code,obj,token)is List, each element of which is defined by the developer. The Hashtable records the data of this instance. The keys of this instance are:

'iguid'       iguid of (string) item
'name'     The name of (string) item
'desc'       Description of (string) item
'type'         (int)Item types: 1: Product, 2: Nature, 3: Data
'price'       (int)Price
'image'    (string)URL of item image
'attr'           Attribute. Attribute data, key = value

Since there can be more than one attribute, the attributes here are recorded by
List. The element types of List are Hashtable, and contain two keys:

'name' is the attribute's name, which is also the key.

'value' is the attribute's value.

If this item does not set an attribute, then Hashtable[“attr”] = null

void cb(int code, object obj, object token)
code with a value of 0 means the setup succeeded. A code other than 0 means the setup failed.

Elements of List can be obtained one by one. The following code provides and
example of this:
C#
public static void GetItemClass(ArcaletGame game, string iguid, OnCallCompletionWithData cb, object token)
game      Game Login
iguid        Defines the specified object type.

Based on the iguid parameter, obtain the type of items that the developers define in the background,

cb(code,obj,token)the type of the obj is List, each element of which is defined by the developer. As this function only sends back one item, there is only one element sent back. The Hashtable records the data of this instance. The keys of this item are:

'iguid'      Identifier of (string) item
'name'    The name of (string) item
'desc'      Description of (string) item
'type'        (int)Item types: 1: Product, 2: Nature, 3: Data
'price'      (int)Price
'image'   (string)URL of item image
'attr'          Attribute. Attribute data, key = value

Since there can be more than one attribute, the attributes are recorded by List.
The element types of List are Hashtable, which contains two keys.

'name'      is the attribute's name, which is also the key
'value'       is the attribute's value

If this item does not set an attribute, then Hashtable[“attr”] = null
public static void NewItemInstance(ArcaletGame game,string iguid,OnCallCompletionWithData cb, object token)
game      Game login
iguid        The item type of the newly added instance

When the game is in progress, if players get an item for any reason, they can use this method to add an item instance.

void cb(int code, object id, object token)

code      with a value of 0 means adding a new instance succeeded. code with a value other 
               than 0 means adding a new instance failed.
id           Refers to the newly added instance, when it is added successfully. The parameter 
               has to be cast as an int.
public static void SetItemInstanceAttribute( ArcaletGame game, string iguid, int id, string attractive, string attrValue, OnCallCompletion cb, object token)
game          Game login
iguid            The item type
id                  The instance identifier owned by players; the attribute of instance id has to be set
attrName    The name of the attribute to be set
attrValue     The value of the attribute to be set

Set the value of the attribute in the item instance in the game for the players.

void cb(int code, object token)
code with a value of 0 means the setup succeeded. A code other than 0 means the setup failed.
public static void GetItemInstanceAttribute( ArcaletGame game,string iguid,int id,string attrName, OnCallCompletionWithData cb, object token)
game         Game login
iguid           The item type
id                 The instance identifier owned by players; the attribute of instance id has to be set
attrName    The name of the attribute

Use this method to obtain the attribute values of the object instance of the players in the game

The type of obj of cb(code,obj,token) is Hashtable. These are the keys:

'name'     is the attribute's name, which is also its key.
'value'      is the attribute's value.
'stamp'    is the time when the attribute is written.
'now'        is the server's system time, formatted: yyyy/mm/dd hh:mm:ss

void cb(int code, object obj, object token)
code with a value of 0 means the setup succeeded. A code other than 0 means the setup failed.
public static void DeleteItemInstance(ArcaletGame game,string iguid,int id, OnCallCompletion cb, object token)
game      Game login
iguid        The item iguid
id              The instance id owned by players. The attribute instance id has to be set.

This method will delete the item instance.

void cb(int code, object token)
code with a value of 0 means the setup succeeded. A code other than 0 means the setup failed.
public static void GetMallURL( ArcaletGame game, int type,string iguid, OnCallCompletionWithData cb, object token)
game      Game Login
type         Web page version; 0: action version, 1: general webpage version
iguid       The object type identifier. If an empty string is returned, then the URL will be the mall 
                 page of the game.

cb(code, obj,token) The obj type is string. There are two ways to send an Item back to the mall
URL: action version or general webpage version.

void cb(int code,object obj, object token)
code with a value of 0 means the setup succeeded. A code other than 0 means the setup failed.
Was this page helpful?
Yes No