Difference between revisions of "User:Ath/WebAPI Examples"

From Team Fortress Wiki
Jump to: navigation, search
m (Preliminary cleanup)
(Little more progress, basic outline/template done. Removed all code.)
Line 4: Line 4:
  
 
===inventory===
 
===inventory===
The inventory field contains a binary token encoded in denary form. The first 16 least significant bits denote an item's position within the backpack, the following 16 bits indicate which classes an item is currently equipped to. The first two most significant bits are unused.
+
Contains a binary token encoded in denary form. The first 16 least significant bits denote an item's position within the backpack, the following 16 bits indicate which classes an item is currently equipped to. The first two most significant bits are currently unused.
  
function is_equipped($inventory_token)
+
===contained_item===
{
+
Contains a sub-array with the id, defindex and quality of an giftwrapped item.
  return ($inventory_token & 0x0FFF0000) ? true : false;
+
 
}
+
===attributes===
function is_equipped_for_class($class, $inventory_token)
+
An array of arrays containing an attribute definition index and values. See the [[List_of_Item_Attributes|list]] for a complete overview of all attributes.
{
 
  return ($inventory_token & 0x80000000) && ($inventory_token & (0x00010000 << $class));
 
}
 
function extract_backpack_position($inventory_token)
 
{
 
  return $inventory_token & 0x0000FFFF;
 
}
 
  
 
==[[WebAPI/GetSchema|GetSchema]]==
 
==[[WebAPI/GetSchema|GetSchema]]==
TODO
+
 
 +
===proper_name===
 +
Indicates the presence of a language-specific prefix such as "The" when the [[quality]] is Unique; ignored on non-Unique qualities.
  
 
[[Category:WebAPI|Examples]]
 
[[Category:WebAPI|Examples]]

Revision as of 22:56, 13 February 2011

This page is intended as a quick reference for working with the WebAPI. As such, it is intended to provide basic examples of how to make use of certain fields, not act as a tutorial.

GetPlayerItems

inventory

Contains a binary token encoded in denary form. The first 16 least significant bits denote an item's position within the backpack, the following 16 bits indicate which classes an item is currently equipped to. The first two most significant bits are currently unused.

contained_item

Contains a sub-array with the id, defindex and quality of an giftwrapped item.

attributes

An array of arrays containing an attribute definition index and values. See the list for a complete overview of all attributes.

GetSchema

proper_name

Indicates the presence of a language-specific prefix such as "The" when the quality is Unique; ignored on non-Unique qualities.