/**
  * Abstract base constructor which parses common data for both, L4DWeapon
  * and L4D2Weapon
  *
  * @param $weaponData
  */
 public function __construct($weaponData)
 {
     parent::__construct($weaponData);
     $this->accuracy = (string) $weaponData->accuracy;
     $this->headshotsPercentage = (string) $weaponData->headshots;
     $this->id = $weaponData->getName();
     $this->shots = (int) $weaponData->shots;
 }
 /**
  * Creates a new instance of weapon from the given XML data and parses
  * common data for both, <var>L4DWeapon</var> and <var>L4D2Weapon</var>
  *
  * @param SimpleXMLElement $weaponData The XML data for this weapon
  */
 public function __construct(SimpleXMLElement $weaponData)
 {
     parent::__construct($weaponData);
     $this->accuracy = (double) $weaponData->accuracy * 0.01;
     $this->headshotsPercentage = (double) $weaponData->headshots * 0.01;
     $this->id = $weaponData->getName();
     $this->shots = (int) $weaponData->shots;
 }
Example #3
0
 public function __construct($weaponData)
 {
     parent::__construct($weaponData);
     $this->headshots = (int) $weaponData->headshots;
     $this->id = (string) $weaponData['key'];
     $this->name = (string) $weaponData->name;
     $this->shots = (int) $weaponData->shotsfired;
     $this->hits = (int) $weaponData->shotshit;
 }
 /**
  * Creates a new weapon instance based on the assigned weapon XML data
  *
  * @param SimpleXMLElement $weaponData The data representing this weapon
  */
 public function __construct(SimpleXMLElement $weaponData)
 {
     parent::__construct($weaponData);
     $this->accuracy = (double) $weaponData->accuracy;
     $this->damage = (int) $weaponData->damage;
     $this->friendlyFire = (int) $weaponData->friendlyfire;
     $this->name = (string) $weaponData->name;
     $this->shots = (int) $weaponData->shotsfired;
 }
 /**
  * Creates a new instance of L4DExplosive based on the assigned XML data
  * @param $weaponData
  */
 public function __construct($weaponData)
 {
     parent::__construct($weaponData);
     $this->id = $weaponData->getName();
     $this->shots = (int) $weaponData->thrown;
 }