/**
  * 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;
 }
 /**
  * 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;
 }
示例#3
0
 /**
  * Creates a new instance of a Day of Defeat: Source weapon based on the
  * given XML data
  *
  * @param \SimpleXMLElement $weaponData The XML data of the class
  */
 public function __construct(\SimpleXMLElement $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 instance of an explosivve based on the given XML data
  *
  * @param \SimpleXMLElement $weaponData The XML data of this explosive
  */
 public function __construct(\SimpleXMLElement $weaponData)
 {
     parent::__construct($weaponData);
     $this->id = $weaponData->getName();
     $this->shots = (int) $weaponData->thrown;
 }