protected function getAveragePlayerLadder() { $logins = $this->matchMakingService->getPlayersPlaying($this->storage->serverLogin); $points = array(); foreach ($logins as $login) { $player = Services\PlayerInfo::Get($login); if ($player) { $points[] = $player->ladderPoints; } } foreach (array_merge($this->storage->players, $this->storage->spectators) as $player) { $points[] = $player->ladderStats['PlayerRankings'][0]['Score']; } return count($points) == 0 ? 0.0 : array_sum($points) / count($points); }
protected function registerRankings($rankings) { foreach ($rankings as $ranking) { $this->matchMakingService->updatePlayerRank($ranking['Login'], $this->matchId, $ranking['Rank']); } }