From dfb792a32453cb82abebf4186834431149e93a58 Mon Sep 17 00:00:00 2001 From: kremsy Date: Wed, 29 Jan 2014 09:29:02 +0100 Subject: [PATCH] resolved todo --- application/core/Players/Player.php | 40 +++++++++---------- application/core/Players/PlayerDetailed.php | 2 +- .../core/Statistics/StatisticManager.php | 22 +++++----- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/application/core/Players/Player.php b/application/core/Players/Player.php index f105df80..d8bb4d64 100644 --- a/application/core/Players/Player.php +++ b/application/core/Players/Player.php @@ -35,7 +35,7 @@ class Player { public $downloadRate = -1; public $uploadRate = -1; public $skins = null; - public $maniaPlanetPlayDays = -1; + public $daysSinceZoneInscription = -1; //Flags details public $forcedSpectatorState = 0; @@ -67,25 +67,25 @@ class Player { return; } - $this->pid = $mpPlayer->playerId; - $this->login = $mpPlayer->login; - $this->nickname = Formatter::stripDirtyCodes($mpPlayer->nickName); - $this->path = $mpPlayer->path; - $this->language = $mpPlayer->language; - $this->avatar = $mpPlayer->avatar['FileName']; - $this->allies = $mpPlayer->allies; - $this->clubLink = $mpPlayer->clubLink; - $this->teamId = $mpPlayer->teamId; - $this->isOfficial = $mpPlayer->isInOfficialMode; - $this->ladderScore = $mpPlayer->ladderStats['PlayerRankings'][0]['Score']; - $this->ladderRank = $mpPlayer->ladderStats['PlayerRankings'][0]['Ranking']; - $this->ladderStats = $mpPlayer->ladderStats; - $this->maniaPlanetPlayDays = $mpPlayer->hoursSinceZoneInscription / 24; //TODO change - $this->ipAddress = $mpPlayer->iPAddress; - $this->clientVersion = $mpPlayer->clientVersion; - $this->downloadRate = $mpPlayer->downloadRate; - $this->uploadRate = $mpPlayer->uploadRate; - $this->skins = $mpPlayer->skins; + $this->pid = $mpPlayer->playerId; + $this->login = $mpPlayer->login; + $this->nickname = Formatter::stripDirtyCodes($mpPlayer->nickName); + $this->path = $mpPlayer->path; + $this->language = $mpPlayer->language; + $this->avatar = $mpPlayer->avatar['FileName']; + $this->allies = $mpPlayer->allies; + $this->clubLink = $mpPlayer->clubLink; + $this->teamId = $mpPlayer->teamId; + $this->isOfficial = $mpPlayer->isInOfficialMode; + $this->ladderScore = $mpPlayer->ladderStats['PlayerRankings'][0]['Score']; + $this->ladderRank = $mpPlayer->ladderStats['PlayerRankings'][0]['Ranking']; + $this->ladderStats = $mpPlayer->ladderStats; + $this->daysSinceZoneInscription = $mpPlayer->hoursSinceZoneInscription / 24; + $this->ipAddress = $mpPlayer->iPAddress; + $this->clientVersion = $mpPlayer->clientVersion; + $this->downloadRate = $mpPlayer->downloadRate; + $this->uploadRate = $mpPlayer->uploadRate; + $this->skins = $mpPlayer->skins; //Flag Details $this->forcedSpectatorState = $mpPlayer->forceSpectator; diff --git a/application/core/Players/PlayerDetailed.php b/application/core/Players/PlayerDetailed.php index 04c9ff41..f1607df1 100644 --- a/application/core/Players/PlayerDetailed.php +++ b/application/core/Players/PlayerDetailed.php @@ -182,7 +182,7 @@ class PlayerDetailed { $label = clone $mainLabel; $frame->add($label); $label->setY($y); - $label->setText(date("d M Y", time() - 3600 * 24 * $target->maniaPlanetPlayDays)); + $label->setText(date("d M Y", time() - 3600 * 24 * $target->daysSinceZoneInscription)); $quad = new Quad(); $frame->add($quad); diff --git a/application/core/Statistics/StatisticManager.php b/application/core/Statistics/StatisticManager.php index 53bf91b7..a733d0cd 100644 --- a/application/core/Statistics/StatisticManager.php +++ b/application/core/Statistics/StatisticManager.php @@ -10,8 +10,6 @@ use ManiaControl\Players\Player; * * @author steeffeen & kremsy */ -// TODO db reference between player index and statsitics playerId -// TODO db reference between metadata statId and statistics statId class StatisticManager { /** * Constants @@ -20,7 +18,7 @@ class StatisticManager { const TABLE_STATISTICS = 'mc_statistics'; const STAT_TYPE_INT = '0'; const STAT_TYPE_TIME = '1'; - const STAT_TYPE_FLOAT = '2'; + const STAT_TYPE_FLOAT = '2'; const SPECIAL_STAT_KD_RATIO = 'Kill Death Ratio'; //TODO dynamic later @@ -164,9 +162,9 @@ class StatisticManager { } $result->close(); - $stat = new \stdClass(); - $stat->name = self::SPECIAL_STAT_KD_RATIO; - $stat->type = self::STAT_TYPE_FLOAT; + $stat = new \stdClass(); + $stat->name = self::SPECIAL_STAT_KD_RATIO; + $stat->type = self::STAT_TYPE_FLOAT; $this->specialStats[self::SPECIAL_STAT_KD_RATIO] = $stat; } @@ -199,15 +197,17 @@ class StatisticManager { $playerStats[$stat->name] = array($stat, $value); } - foreach($this->specialStats as $stat){ - switch($stat->name){ + foreach($this->specialStats as $stat) { + switch($stat->name) { case self::SPECIAL_STAT_KD_RATIO: - if(!isset($playerStats[StatisticCollector::STAT_ON_KILL]) || !isset($playerStats[StatisticCollector::STAT_ON_DEATH])) + if (!isset($playerStats[StatisticCollector::STAT_ON_KILL]) || !isset($playerStats[StatisticCollector::STAT_ON_DEATH])) { continue; - $kills = intval($playerStats[StatisticCollector::STAT_ON_KILL]); + } + $kills = intval($playerStats[StatisticCollector::STAT_ON_KILL]); $deaths = intval($playerStats[StatisticCollector::STAT_ON_DEATH]); - if($deaths == 0) + if ($deaths == 0) { continue; + } $playerStats[$stat->name] = array($stat, $kills / $deaths); } }