/**
  * @see AbstractStatGenerator::createTemporaryEntry()
  */
 protected function createTemporaryEntry($relationalID)
 {
     $sql = "SELECT MAX(rank)\n\t\t\t\t\tAS rank\n\t\t\t\tFROM ugml_stat_entry\n\t\t\t\tWHERE statTypeID = " . $this->statTypeID;
     $row = WCF::getDB()->getFirstRow($sql);
     $rank = $row['rank'] + 1;
     $sql = "INSERT INTO ugml_stat_entry\n\t\t\t\t(statTypeID, relationalID, rank, points)\n\t\t\t\tVALUES\n\t\t\t\t(" . $this->statTypeID . ", " . $relationalID . ", " . $rank . ", 1000)";
     WCF::getDB()->sendQuery($sql);
     StatGeneratorFactory::init();
     WCF::getCache()->clearResource('statTypes-' . PACKAGE_ID, true);
 }
Esempio n. 2
0
 /**
  * Creates a new StatRefresher object.
  */
 public function __construct()
 {
     StatGeneratorFactory::init();
     $cache = WCF::getCache()->get('statTypes-' . PACKAGE_ID, 'byStatTypeID');
     foreach ($cache as $statTypeID => $row) {
         $statGenerator = StatGeneratorFactory::getByStatTypeID($statTypeID);
         $statGenerator->generate();
     }
     $sql = "TRUNCATE wcf" . WCF_N . "_session";
     WCF::getDB()->sendQuery($sql);
 }
 /**
  * Searches for the stat type id of base stat type (pointsAvg => points)
  * 
  * @return	int		stat type id
  */
 protected function searchBasicStatType()
 {
     $basicStatGenerator = StatGeneratorFactory::getByTypeName('alliance', $this->basicStatType);
     return $basicStatGenerator->statTypeID;
 }
 /**
  * Adds points to the user attack stats.
  */
 protected function saveDataPoints()
 {
     if ($this->formationID == 7028) {
         return;
     }
     $results = $this->saveDataPointsGetWeightedResults();
     $userData = array();
     $this->saveDataPointsCalcUserPoints($this->navalFormationFleets, $results['attacker'], $this->preCombatAttackerUnits, $userData);
     $this->saveDataPointsCalcUserPoints($this->standByFleets, $results['defender'], $this->preCombatDefenderUnits, $userData);
     $generator = StatGeneratorFactory::getByTypeName('user', 'attack');
     //$this->log .= print_r($results, true);
     foreach ($userData as $userID => $change) {
         echo 'CHANGE!!!	' . $userID . ':' . $change;
         $this->log .= 'CHANGE!!!	' . $userID . ':' . $change . "\n";
         $generator->changePoints($userID, $change);
     }
     // *angst*
     /*$objStr = escapeString(print_r((array)$this, true));
     		$sql = "REPLACE INTO ugml_log_biggerattack
     				(fleetID, obj)
     				VALUES
     				(".$this->fleetID.", '".$objStr."')";
     		WCF::getDB()->sendQuery($sql);*/
 }
 /**
  * Returns the 'real' the name that should be selected in the select-field.
  * 
  * @return	string	real option
  */
 public function getOptionName()
 {
     StatGeneratorFactory::init();
     $cache = WCF::getCache()->get('statTypes-' . PACKAGE_ID, 'byStatTypeID');
     $name = $cache[$this->statTypeID]['name'];
     return $name;
 }
 /**
  * Searches for the stat type id of the equivalent user statistics
  * 
  * @return	int		stat type id
  */
 protected function searchUserStatPendant()
 {
     $userStatGenerator = StatGeneratorFactory::getByTypeName('user', $this->userPendant);
     return $userStatGenerator->statTypeID;
 }
Esempio n. 7
0
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->statGenerator = StatGeneratorFactory::getByTypeName($this->type, $this->name);
     if (!$this->relationalID) {
         $this->rows = $this->statGenerator->getRows($this->start, $this->rowCount);
     } else {
         $this->rows = $this->statGenerator->getRows(0, $this->rowCount, $this->relationalID);
     }
     $optionName = $this->statGenerator->getOptionName();
     $cache = WCF::getCache()->get('statTypes-' . PACKAGE_ID);
     foreach ($cache['types'] as $type) {
         if (StatGeneratorFactory::checkTypeName($type, $optionName)) {
             $this->types[] = $type;
         }
     }
     foreach ($cache['names'] as $name) {
         if (StatGeneratorFactory::checkTypeName($this->type, $name)) {
             $this->names[] = $name;
         }
     }
 }