Request item definitions from the server
requestItemList(tags, callback)

Requesting Item Definitions

The non-dynamic item definitions for a game can be retrieved using the requestItemList method. This function takes an array of tags to filter on (pass an empty array for all items), and a callback function to call when retrieval is complete:

NameTypeDescription
tagsArrayAn array of strings containing tags to filter items with. Use an empty array or undefined for no filter
callbackFunctionA callback function to be called with the results of the operation

The callback function is passed a single object with the following fields:

NameTypeDescription
successBooleanA flag indicating whether or not the operation was successful
dataArrayAn array of item definitions, if successful

Each item definition in the data array contains the following fields:

NameTypeDescription
idIntegerThe unique ID of the item
identifierStringThe item identifier
nameStringThe name of the item
descriptionStringThe item description
priceIntegerThe price of the item in Kreds
tagsArrayAn array of strings containing the tags for the item
image_urlStringThe image for the item

Example: Request all items:

kongregate.mtx.requestItemList([], onItemList);

function onItemList(result){
  console.log("Item list result, success: " + result.success);
  if(result.success) {
    for(var i = 0; i < result.data.length; i++) {
      var item = result.data[i];
      console.log((i+1) + ". " + item.identifier + ", " + 
                  item.id + "," + item.name);
    }
  }
}