/**
  * Creates a new instance of a TF2Item with the given data
  *
  * @param $inventory The inventory this item is contained in
  * @param $itemData The data specifying this item
  * @throws WebApiException on Web API errors
  */
 public function __construct(TF2Inventory $inventory, $itemData)
 {
     parent::__construct($inventory, $itemData);
     $this->equipped = array();
     foreach (self::$CLASSES as $classId => $className) {
         $this->equipped[$className] = $itemData->inventory & 1 << 16 + $classId != 0;
     }
 }
 /**
  * Creates a new instance of a Portal2Item with the given data
  *
  * @param Portal2Inventory $inventory The inventory this item is contained
  *        in
  * @param array $itemData The data specifying this item
  * @throws WebApiException on Web API errors
  */
 public function __construct(Portal2Inventory $inventory, $itemData)
 {
     parent::__construct($inventory, $itemData);
     $this->equipped = array();
     for ($botId = 0; $botId < sizeof(self::$BOTS); $botId++) {
         $this->equipped[self::$BOTS[$botId]] = ($itemData->inventory & 1 << 16 + $botId) != 0;
     }
 }
Example #3
0
 /**
  * Constructor
  *
  * @param int $id ID of the item
  * @param object $DI Instance of IDependencyInjectionContainer
  * @param bool $noLoad If set to true, prevents loading of soldier data. Defaults to false
  */
 public function __construct($id, IDependencyInjectionContainer $DI, $noLoad = false)
 {
     parent::__construct($id, $DI);
     if (!$noLoad) {
         $data = $this->_db->fetchFirstRequest('getSoldierInfos', array(':id' => $this->ID));
         foreach ($data as $key => $value) {
             $this->{$key} = $value;
         }
     }
 }
 /**
  * Creates a new instance of a DotA2Item with the given data
  *
  * @param DotA2Inventory $inventory The inventory this item is contained
  *        in
  * @param array $itemData The data specifying this item
  * @throws WebApiException on Web API errors
  */
 public function __construct(DotA2Inventory $inventory, $itemData)
 {
     parent::__construct($inventory, $itemData);
     $this->equipped = property_exists($itemData, 'equipped') && sizeof($itemData->equipped) > 0;
 }