improve dedimania plugin
This commit is contained in:
		
				
					committed by
					
						
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							6a42a3d6f3
						
					
				
				
					commit
					bcd8a9de67
				
			@@ -39,14 +39,14 @@ class Database {
 | 
				
			|||||||
		$port = (int) $port[0];
 | 
							$port = (int) $port[0];
 | 
				
			||||||
		$user = (string) $user[0];
 | 
							$user = (string) $user[0];
 | 
				
			||||||
		$pass = (string) $pass[0];
 | 
							$pass = (string) $pass[0];
 | 
				
			||||||
		
 | 
					
 | 
				
			||||||
		// Open database connection
 | 
							// Open database connection
 | 
				
			||||||
		$this->mysqli = new \mysqli($host, $user, $pass, null, $port);
 | 
							$this->mysqli = new \mysqli($host, $user, $pass, null, $port);
 | 
				
			||||||
		if ($this->mysqli->connect_error) {
 | 
							if ($this->mysqli->connect_error) {
 | 
				
			||||||
			trigger_error($this->mysqli->connect_error, E_USER_ERROR);
 | 
								trigger_error($this->mysqli->connect_error, E_USER_ERROR);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$this->mysqli->set_charset("utf8");
 | 
							$this->mysqli->set_charset("utf8");
 | 
				
			||||||
		
 | 
					
 | 
				
			||||||
		$this->initDatabase();
 | 
							$this->initDatabase();
 | 
				
			||||||
		$this->optimizeTables();
 | 
							$this->optimizeTables();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
namespace Dedimania;
 | 
					namespace Dedimania;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once "DedimaniaData.php";
 | 
					 | 
				
			||||||
use FML\Controls\Control;
 | 
					use FML\Controls\Control;
 | 
				
			||||||
use FML\Controls\Frame;
 | 
					use FML\Controls\Frame;
 | 
				
			||||||
use FML\Controls\Label;
 | 
					use FML\Controls\Label;
 | 
				
			||||||
@@ -16,7 +15,6 @@ use ManiaControl\Maps\MapManager;
 | 
				
			|||||||
use ManiaControl\Players\Player;
 | 
					use ManiaControl\Players\Player;
 | 
				
			||||||
use ManiaControl\Players\PlayerManager;
 | 
					use ManiaControl\Players\PlayerManager;
 | 
				
			||||||
use ManiaControl\Plugins\Plugin;
 | 
					use ManiaControl\Plugins\Plugin;
 | 
				
			||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Base64;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
					class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -75,6 +73,10 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	public function load(ManiaControl $maniaControl) {
 | 
						public function load(ManiaControl $maniaControl) {
 | 
				
			||||||
		$this->maniaControl = $maniaControl;
 | 
							$this->maniaControl = $maniaControl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!extension_loaded('xmlrpc')) {
 | 
				
			||||||
 | 
								throw new \Exception("You need to activate the PHP extension xmlrpc to run this Plugin!");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_TITLE, 'Dedimania');
 | 
							$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_TITLE, 'Dedimania');
 | 
				
			||||||
		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -139);
 | 
							$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -139);
 | 
				
			||||||
		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 7);
 | 
							$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 7);
 | 
				
			||||||
@@ -86,7 +88,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
		$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'handleBeginMap');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'handleBeginMap');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_ENDMAP, $this, 'handleMapEnd');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_ENDMAP, $this, 'handleMapEnd');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerDisconnect');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERCHECKPOINT, $this, 'handlePlayerCheckpoint');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERCHECKPOINT, $this, 'handlePlayerCheckpoint');
 | 
				
			||||||
		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this, 'handlePlayerFinished');
 | 
							$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this, 'handlePlayerFinished');
 | 
				
			||||||
		$this->maniaControl->timerManager->registerTimerListening($this, 'updateEverySecond', 1000);
 | 
							$this->maniaControl->timerManager->registerTimerListening($this, 'updateEverySecond', 1000);
 | 
				
			||||||
@@ -207,9 +209,12 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			$data = $this->decode($data);
 | 
								$data = $this->decode($data);
 | 
				
			||||||
			if (is_array($data)) {
 | 
								if (is_array($data)) {
 | 
				
			||||||
				foreach($data as $methodResponse) {
 | 
									foreach($data as $index => $methodResponse) {
 | 
				
			||||||
					if (xmlrpc_is_fault($methodResponse)) {
 | 
										if (xmlrpc_is_fault($methodResponse)) {
 | 
				
			||||||
						$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERCONNECT);
 | 
											$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERCONNECT);
 | 
				
			||||||
 | 
										} else if ($index <= 0) {
 | 
				
			||||||
 | 
											$responseData = $methodResponse[0];
 | 
				
			||||||
 | 
											$this->dedimaniaData->addPlayer(new DedimaniaPlayer($responseData));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
@@ -232,6 +237,8 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	 * @param \ManiaControl\Players\Player $player
 | 
						 * @param \ManiaControl\Players\Player $player
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function handlePlayerDisconnect(Player $player) {
 | 
						public function handlePlayerDisconnect(Player $player) {
 | 
				
			||||||
 | 
							$this->dedimaniaData->removePlayer($player->login);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Send Dedimania request
 | 
							// Send Dedimania request
 | 
				
			||||||
		$data    = array($this->dedimaniaData->sessionId, $player->login, '');
 | 
							$data    = array($this->dedimaniaData->sessionId, $player->login, '');
 | 
				
			||||||
		$content = $this->encode_request(self::DEDIMANIA_PLAYERDISCONNECT, $data);
 | 
							$content = $this->encode_request(self::DEDIMANIA_PLAYERDISCONNECT, $data);
 | 
				
			||||||
@@ -282,27 +289,16 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
		$gameMode = $this->getGameModeString();
 | 
							$gameMode = $this->getGameModeString();
 | 
				
			||||||
		$times    = array();
 | 
							$times    = array();
 | 
				
			||||||
		$replays  = array();
 | 
							$replays  = array();
 | 
				
			||||||
		foreach($this->dedimaniaData->records['Records'] as $record) {
 | 
							foreach($this->dedimaniaData->records as $record) {
 | 
				
			||||||
			if (!isset($record['New']) || !$record['New']) {
 | 
								/** @var RecordData $record */
 | 
				
			||||||
 | 
								if ($record->newRecord == false) {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			array_push($times, array('Login' => $record['Login'], 'Best' => $record['Best'], 'Checks' => $record['Checks']));
 | 
								array_push($times, array('Login' => $record->login, 'Best' => $record->best, 'Checks' => $record->checkpoints));
 | 
				
			||||||
			if (!isset($replays['VReplay'])) {
 | 
								$replays['VReplay']       = $record->vReplay;
 | 
				
			||||||
				$replays['VReplay'] = $record['VReplay'];
 | 
								$replays['Top1GReplay']   = $record->top1GReplay;
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!isset($replays['Top1GReplay']) && isset($record['Top1GReplay'])) {
 | 
					 | 
				
			||||||
				$replays['Top1GReplay'] = $record['Top1GReplay'];
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// TODO: VReplayChecks
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (!isset($replays['VReplay'])) {
 | 
					 | 
				
			||||||
			$replays['VReplay'] = '';
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (!isset($replays['VReplayChecks'])) {
 | 
					 | 
				
			||||||
			$replays['VReplayChecks'] = '';
 | 
								$replays['VReplayChecks'] = '';
 | 
				
			||||||
		}
 | 
								// TODO: VReplayChecks
 | 
				
			||||||
		if (!isset($replays['Top1GReplay'])) {
 | 
					 | 
				
			||||||
			$replays['Top1GReplay'] = '';
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		xmlrpc_set_type($replays['VReplay'], 'base64');
 | 
							xmlrpc_set_type($replays['VReplay'], 'base64');
 | 
				
			||||||
@@ -422,20 +418,19 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$oldRecord = $this->getDedimaniaRecord($login);
 | 
							$oldRecord = $this->getDedimaniaRecord($login);
 | 
				
			||||||
		$save      = true;
 | 
					
 | 
				
			||||||
		if ($oldRecord) {
 | 
							if ($oldRecord->nullRecord || $oldRecord && $oldRecord->best > $time) {
 | 
				
			||||||
			if ($oldRecord['Best'] <= $time) {
 | 
					 | 
				
			||||||
				$save = false;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if ($save) {
 | 
					 | 
				
			||||||
			$player = $this->maniaControl->playerManager->getPlayer($login);
 | 
								$player = $this->maniaControl->playerManager->getPlayer($login);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Save time
 | 
								// Save time
 | 
				
			||||||
			$newRecord = array('Login' => $login, 'NickName' => $player->nickname, 'Best' => $data[2], 'Checks' => $this->getCheckpoints($login), 'New' => true);
 | 
								$newRecord = new RecordData(null);
 | 
				
			||||||
 | 
								$newRecord->constructNewRecord($login, $player->nickname, $data[2], $this->getCheckpoints($login), true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ($this->insertDedimaniaRecord($newRecord, $oldRecord)) {
 | 
								if ($this->insertDedimaniaRecord($newRecord, $oldRecord)) {
 | 
				
			||||||
				// Get newly saved record
 | 
									// Get newly saved record
 | 
				
			||||||
				foreach($this->dedimaniaData->records['Records'] as &$record) {
 | 
									foreach($this->dedimaniaData->records as &$record) {
 | 
				
			||||||
					if ($record['Login'] !== $newRecord['Login']) {
 | 
										/** @var RecordData $record */
 | 
				
			||||||
 | 
										if ($record->login !== $newRecord->login) {
 | 
				
			||||||
						continue;
 | 
											continue;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$newRecord = $record;
 | 
										$newRecord = $record;
 | 
				
			||||||
@@ -443,14 +438,14 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Announce record
 | 
									// Announce record
 | 
				
			||||||
				if (!$oldRecord || $newRecord['Rank'] < $oldRecord['Rank']) {
 | 
									if ($oldRecord->nullRecord || $newRecord->rank < $oldRecord->rank) {
 | 
				
			||||||
					// Gained rank
 | 
										// Gained rank
 | 
				
			||||||
					$improvement = 'gained the';
 | 
										$improvement = 'gained the';
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					// Only improved time
 | 
										// Only improved time
 | 
				
			||||||
					$improvement = 'improved her/his';
 | 
										$improvement = 'improved her/his';
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				$message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$o' . $newRecord['Rank'] . '.$> Dedimania Record: ' . Formatter::formatTime($newRecord['Best']);
 | 
									$message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Dedimania Record: ' . Formatter::formatTime($newRecord->best);
 | 
				
			||||||
				$this->maniaControl->chat->sendInformation($message);
 | 
									$this->maniaControl->chat->sendInformation($message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				$this->updateManialink = true;
 | 
									$this->updateManialink = true;
 | 
				
			||||||
@@ -497,8 +492,17 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
						$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GETRECORDS);
 | 
											$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GETRECORDS);
 | 
				
			||||||
						return false;
 | 
											return false;
 | 
				
			||||||
					} else if ($index <= 0) {
 | 
										} else if ($index <= 0) {
 | 
				
			||||||
						$responseData                 = $methodResponse[0];
 | 
											$responseData                       = $methodResponse[0];
 | 
				
			||||||
						$this->dedimaniaData->records = $responseData;
 | 
											$this->dedimaniaData->serverMaxRank = $responseData['ServerMaxRank'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											foreach($responseData['Players'] as $player) {
 | 
				
			||||||
 | 
												$dediPlayer = new DedimaniaPlayer(null);
 | 
				
			||||||
 | 
												$dediPlayer->constructNewPlayer($player['Login'], $player['MaxRank']);
 | 
				
			||||||
 | 
												$this->dedimaniaData->addPlayer($dediPlayer);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											foreach($responseData['Records'] as $key => $record) {
 | 
				
			||||||
 | 
												$this->dedimaniaData->records[$key] = new RecordData($record);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -550,36 +554,35 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	 * @param array $newRecord
 | 
						 * @param array $newRecord
 | 
				
			||||||
	 * @return bool
 | 
						 * @return bool
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function insertDedimaniaRecord(&$newRecord, $oldRecord) {
 | 
						private function insertDedimaniaRecord(RecordData &$newRecord, RecordData $oldRecord) {
 | 
				
			||||||
		if (!$newRecord || !$this->dedimaniaData->records || !isset($this->dedimaniaData->records['Records'])) {
 | 
							//if (!$newRecord || !$this->dedimaniaData->records || !isset($this->dedimaniaData->records['Records'])) {
 | 
				
			||||||
 | 
							if ($newRecord->nullRecord || !$this->dedimaniaData->getRecordCount() == 0) {
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$insert = false;
 | 
							$insert = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Get max possible rank
 | 
							// Get max possible rank
 | 
				
			||||||
		$maxRank = $this->getMaxRank($newRecord['Login']);
 | 
							$maxRank = $this->dedimaniaData->getPlayerMaxRank($newRecord->login);
 | 
				
			||||||
		if (!$maxRank) {
 | 
					 | 
				
			||||||
			$maxRank = 30;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Loop through existing records
 | 
							// Loop through existing records
 | 
				
			||||||
		foreach($this->dedimaniaData->records['Records'] as $key => &$record) {
 | 
							foreach($this->dedimaniaData->records as $key => &$record) {
 | 
				
			||||||
			if ($record['Login'] === $newRecord['Login']) {
 | 
								/** @var RecordData $record */
 | 
				
			||||||
 | 
								if ($record->login === $newRecord->login) {
 | 
				
			||||||
				// Old record of the same player
 | 
									// Old record of the same player
 | 
				
			||||||
				if ($record['Best'] <= $newRecord['Best']) {
 | 
									if ($record->best <= $newRecord->best) {
 | 
				
			||||||
					// It's better - Do nothing
 | 
										// It's better - Do nothing
 | 
				
			||||||
					return false;
 | 
										return false;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Replace old record
 | 
									// Replace old record
 | 
				
			||||||
				unset($this->dedimaniaData->records['Records'][$key]);
 | 
									unset($this->dedimaniaData->records[$key]);
 | 
				
			||||||
				$insert = true;
 | 
									$insert = true;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Other player's record
 | 
								// Other player's record
 | 
				
			||||||
			if ($record['Best'] <= $newRecord['Best']) {
 | 
								if ($record->best <= $newRecord->best) {
 | 
				
			||||||
				// It's better - Skip
 | 
									// It's better - Skip
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -588,32 +591,33 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
			$insert = true;
 | 
								$insert = true;
 | 
				
			||||||
			if ($oldRecord) {
 | 
								if ($oldRecord) {
 | 
				
			||||||
				// Remove old record
 | 
									// Remove old record
 | 
				
			||||||
				foreach($this->dedimaniaData->records['Records'] as $key2 => $record2) {
 | 
									foreach($this->dedimaniaData->records as $key2 => $record2) {
 | 
				
			||||||
					if ($record2['Login'] !== $oldRecord['Login']) {
 | 
										/** @var RecordData $record2 */
 | 
				
			||||||
 | 
										if ($record2->login !== $oldRecord->login) {
 | 
				
			||||||
						continue;
 | 
											continue;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					unset($this->dedimaniaData->records['Records'][$key2]);
 | 
										unset($this->dedimaniaData->records[$key2]);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$insert && count($this->dedimaniaData->records['Records']) < $maxRank) {
 | 
							if (!$insert && count($this->dedimaniaData->records) < $maxRank) {
 | 
				
			||||||
			// Records list not full - Append new record
 | 
								// Records list not full - Append new record
 | 
				
			||||||
			$insert = true;
 | 
								$insert = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($insert) {
 | 
							if ($insert) {
 | 
				
			||||||
			// Insert new record
 | 
								// Insert new record
 | 
				
			||||||
			array_push($this->dedimaniaData->records['Records'], $newRecord);
 | 
								array_push($this->dedimaniaData->records, $newRecord);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Update ranks
 | 
								// Update ranks
 | 
				
			||||||
			$this->updateDedimaniaRecordRanks();
 | 
								$this->updateDedimaniaRecordRanks();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Save replays
 | 
								// Save replays
 | 
				
			||||||
			foreach($this->dedimaniaData->records['Records'] as &$record) {
 | 
								foreach($this->dedimaniaData->records as &$record) {
 | 
				
			||||||
				if ($record['Login'] !== $newRecord['Login']) {
 | 
									if ($record->login !== $newRecord->login) {
 | 
				
			||||||
					continue;
 | 
										continue;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				$this->setRecordReplays($record);
 | 
									$this->setRecordReplays($record);
 | 
				
			||||||
@@ -630,17 +634,18 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	 * Update the sorting and the ranks of all dedimania records
 | 
						 * Update the sorting and the ranks of all dedimania records
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function updateDedimaniaRecordRanks() {
 | 
						private function updateDedimaniaRecordRanks() {
 | 
				
			||||||
		if (!$this->dedimaniaData->records || !isset($this->dedimaniaData->records['Records'])) {
 | 
							if ($this->dedimaniaData->getRecordCount() == 0) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							//TODO move into class dedimania data
 | 
				
			||||||
		// Sort records
 | 
							// Sort records
 | 
				
			||||||
		usort($this->dedimaniaData->records['Records'], array($this, 'compareRecords'));
 | 
							usort($this->dedimaniaData->records, array($this, 'compareRecords'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Update ranks
 | 
							// Update ranks
 | 
				
			||||||
		$rank = 1;
 | 
							$rank = 1;
 | 
				
			||||||
		foreach($this->dedimaniaData->records['Records'] as &$record) {
 | 
							foreach($this->dedimaniaData->records as &$record) {
 | 
				
			||||||
			$record['Rank'] = $rank;
 | 
								/** @var RecordData $record */
 | 
				
			||||||
 | 
								$record->rank = $rank;
 | 
				
			||||||
			$rank++;
 | 
								$rank++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -648,17 +653,18 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Compare function for sorting dedimania records
 | 
						 * Compare function for sorting dedimania records
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param array $first
 | 
						 * @param \Dedimania\RecordData $first
 | 
				
			||||||
	 * @param array $second
 | 
						 * @param \Dedimania\RecordData $second
 | 
				
			||||||
	 * @return int
 | 
						 * @return int
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function compareRecords($first, $second) {
 | 
						private function compareRecords(RecordData $first, RecordData $second) {
 | 
				
			||||||
		if ($first['Best'] < $second['Best']) {
 | 
							//TODO move into class dedimania data
 | 
				
			||||||
 | 
							if ($first->best < $second->best) {
 | 
				
			||||||
			return -1;
 | 
								return -1;
 | 
				
			||||||
		} else if ($first['Best'] > $second['Best']) {
 | 
							} else if ($first->best > $second->best) {
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if ($first['Rank'] < $second['Rank']) {
 | 
								if ($first->rank < $second->rank) {
 | 
				
			||||||
				return -1;
 | 
									return -1;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				return 1;
 | 
									return 1;
 | 
				
			||||||
@@ -671,15 +677,15 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param array $record
 | 
						 * @param array $record
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function setRecordReplays(&$record) {
 | 
						private function setRecordReplays(RecordData &$record) {
 | 
				
			||||||
		// Set validation replay
 | 
							// Set validation replay
 | 
				
			||||||
		$validationReplay = $this->maniaControl->server->getValidationReplay($record['Login']);
 | 
							$validationReplay = $this->maniaControl->server->getValidationReplay($record['Login']);
 | 
				
			||||||
		if ($validationReplay) {
 | 
							if ($validationReplay) {
 | 
				
			||||||
			$record['VReplay'] = $validationReplay;
 | 
								$record->vReplay = $validationReplay;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Set ghost replay
 | 
							// Set ghost replay
 | 
				
			||||||
		if ($record['Rank'] <= 1) {
 | 
							if ($record->rank <= 1) {
 | 
				
			||||||
			$dataDirectory = $this->maniaControl->server->getDataDirectory();
 | 
								$dataDirectory = $this->maniaControl->server->getDataDirectory();
 | 
				
			||||||
			if (!isset($this->dedimaniaData->directoryAccessChecked)) {
 | 
								if (!isset($this->dedimaniaData->directoryAccessChecked)) {
 | 
				
			||||||
				$access = $this->maniaControl->server->checkAccess($dataDirectory);
 | 
									$access = $this->maniaControl->server->checkAccess($dataDirectory);
 | 
				
			||||||
@@ -689,35 +695,14 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
				$this->dedimaniaData->directoryAccessChecked = $access;
 | 
									$this->dedimaniaData->directoryAccessChecked = $access;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if ($this->dedimaniaData->directoryAccessChecked) {
 | 
								if ($this->dedimaniaData->directoryAccessChecked) {
 | 
				
			||||||
				$ghostReplay = $this->maniaControl->server->getGhostReplay($record['Login']);
 | 
									$ghostReplay = $this->maniaControl->server->getGhostReplay($record->login);
 | 
				
			||||||
				if ($ghostReplay) {
 | 
									if ($ghostReplay) {
 | 
				
			||||||
					$record['Top1GReplay'] = $ghostReplay;
 | 
										$record->top1GReplay = $ghostReplay;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Get max rank for given login
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	private function getMaxRank($login) {
 | 
					 | 
				
			||||||
		if (!isset($this->dedimaniaData->records)) {
 | 
					 | 
				
			||||||
			return null;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		$records = $this->dedimaniaData->records;
 | 
					 | 
				
			||||||
		$maxRank = $records['ServerMaxRank'];
 | 
					 | 
				
			||||||
		foreach($records['Players'] as $player) {
 | 
					 | 
				
			||||||
			if ($player['Login'] === $login) {
 | 
					 | 
				
			||||||
				if ($player['MaxRank'] > $maxRank) {
 | 
					 | 
				
			||||||
					$maxRank = $player['MaxRank'];
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return $maxRank;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Build server info Structure for callbacks
 | 
						 * Build server info Structure for callbacks
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@@ -793,19 +778,22 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
	 * Get the dedimania record of the given login
 | 
						 * Get the dedimania record of the given login
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * @param string $login
 | 
						 * @param string $login
 | 
				
			||||||
	 * @return array $record
 | 
						 * @return RecordData $record
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private function getDedimaniaRecord($login) {
 | 
						private function getDedimaniaRecord($login) {
 | 
				
			||||||
		if (!$this->dedimaniaData->records) {
 | 
							if (!$this->dedimaniaData->records) {
 | 
				
			||||||
			return null;
 | 
								return new RecordData(null);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$records = $this->dedimaniaData->records['Records'];
 | 
							//TODO
 | 
				
			||||||
		foreach($records as $record) {
 | 
							$records = $this->dedimaniaData->records;
 | 
				
			||||||
			if ($record['Login'] === $login) {
 | 
							foreach($records as &$record) {
 | 
				
			||||||
 | 
								/** @var RecordData $record */
 | 
				
			||||||
 | 
								if ($record->login === $login) {
 | 
				
			||||||
				return $record;
 | 
									return $record;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return null;
 | 
					
 | 
				
			||||||
 | 
							return new RecordData(null);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -883,7 +871,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
		if (!$this->dedimaniaData->records) {
 | 
							if (!$this->dedimaniaData->records) {
 | 
				
			||||||
			return '';
 | 
								return '';
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$records = $this->dedimaniaData->records['Records'];
 | 
							$records = $this->dedimaniaData->records;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$title        = $this->maniaControl->settingManager->getSetting($this, self::SETTING_WIDGET_TITLE);
 | 
							$title        = $this->maniaControl->settingManager->getSetting($this, self::SETTING_WIDGET_TITLE);
 | 
				
			||||||
		$pos_x        = $this->maniaControl->settingManager->getSetting($this, self::SETTING_WIDGET_POSX);
 | 
							$pos_x        = $this->maniaControl->settingManager->getSetting($this, self::SETTING_WIDGET_POSX);
 | 
				
			||||||
@@ -918,6 +906,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
		$titleLabel->setTranslate(true);
 | 
							$titleLabel->setTranslate(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		foreach($records as $index => $record) {
 | 
							foreach($records as $index => $record) {
 | 
				
			||||||
 | 
								/** @var RecordData $record */
 | 
				
			||||||
			if ($index >= $lines) {
 | 
								if ($index >= $lines) {
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -941,7 +930,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
			$rankLabel->setSize($width * 0.06, $lineHeight);
 | 
								$rankLabel->setSize($width * 0.06, $lineHeight);
 | 
				
			||||||
			$rankLabel->setTextSize(1);
 | 
								$rankLabel->setTextSize(1);
 | 
				
			||||||
			$rankLabel->setTextPrefix('$o');
 | 
								$rankLabel->setTextPrefix('$o');
 | 
				
			||||||
			$rankLabel->setText($record['Rank']);
 | 
								$rankLabel->setText($record->rank);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//Name
 | 
								//Name
 | 
				
			||||||
			$nameLabel = new Label();
 | 
								$nameLabel = new Label();
 | 
				
			||||||
@@ -950,7 +939,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
			$nameLabel->setX($width * -0.4);
 | 
								$nameLabel->setX($width * -0.4);
 | 
				
			||||||
			$nameLabel->setSize($width * 0.6, $lineHeight);
 | 
								$nameLabel->setSize($width * 0.6, $lineHeight);
 | 
				
			||||||
			$nameLabel->setTextSize(1);
 | 
								$nameLabel->setTextSize(1);
 | 
				
			||||||
			$nameLabel->setText(Formatter::stripDirtyCodes($record['NickName']));
 | 
								$nameLabel->setText($record->nickName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//Time
 | 
								//Time
 | 
				
			||||||
			$timeLabel = new Label();
 | 
								$timeLabel = new Label();
 | 
				
			||||||
@@ -959,7 +948,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin {
 | 
				
			|||||||
			$timeLabel->setX($width * 0.47);
 | 
								$timeLabel->setX($width * 0.47);
 | 
				
			||||||
			$timeLabel->setSize($width * 0.25, $lineHeight);
 | 
								$timeLabel->setSize($width * 0.25, $lineHeight);
 | 
				
			||||||
			$timeLabel->setTextSize(1);
 | 
								$timeLabel->setTextSize(1);
 | 
				
			||||||
			$timeLabel->setText(Formatter::formatTime($record['Best']));
 | 
								$timeLabel->setText(Formatter::formatTime($record->best));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return $manialink->render()->saveXML();
 | 
							return $manialink->render()->saveXML();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,9 @@ class DedimaniaData {
 | 
				
			|||||||
	public $code;
 | 
						public $code;
 | 
				
			||||||
	public $sessionId = '';
 | 
						public $sessionId = '';
 | 
				
			||||||
	public $records = array();
 | 
						public $records = array();
 | 
				
			||||||
 | 
						public $players = array();
 | 
				
			||||||
	public $directoryAccessChecked = false;
 | 
						public $directoryAccessChecked = false;
 | 
				
			||||||
 | 
						public $serverMaxRank = 30;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) {
 | 
						public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) {
 | 
				
			||||||
		$this->game          = "TM2";
 | 
							$this->game          = "TM2";
 | 
				
			||||||
@@ -45,11 +47,54 @@ class DedimaniaData {
 | 
				
			|||||||
	public function toArray() {
 | 
						public function toArray() {
 | 
				
			||||||
		$array = array();
 | 
							$array = array();
 | 
				
			||||||
		foreach(get_object_vars($this) as $key => $value) {
 | 
							foreach(get_object_vars($this) as $key => $value) {
 | 
				
			||||||
			if ($key == 'records' || $key == 'sessionId' || $key == 'directoryAccessChecked') {
 | 
								if ($key == 'records' || $key == 'sessionId' || $key == 'directoryAccessChecked' || $key == 'serverMaxRank' || $key == 'players') {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			$array[ucfirst($key)] = $value;
 | 
								$array[ucfirst($key)] = $value;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return $array;
 | 
							return $array;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function getRecordCount() {
 | 
				
			||||||
 | 
							return count($this->records);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Get Max Rank for a certain Player
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @param $login
 | 
				
			||||||
 | 
						 * @return int
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function getPlayerMaxRank($login) {
 | 
				
			||||||
 | 
							$maxRank = $this->serverMaxRank;
 | 
				
			||||||
 | 
							foreach($this->players as $player) {
 | 
				
			||||||
 | 
								/** @var DedimaniaPlayer $player */
 | 
				
			||||||
 | 
								if ($player->login === $login) {
 | 
				
			||||||
 | 
									if ($player->maxRank > $maxRank) {
 | 
				
			||||||
 | 
										$maxRank = $player->maxRank;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return $maxRank;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Adds a Player to the Players array
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @param DedimaniaPlayer $player
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function addPlayer(DedimaniaPlayer $player) {
 | 
				
			||||||
 | 
							/** @var DedimaniaPlayer $player */
 | 
				
			||||||
 | 
							$this->players[$player->login] = $player;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Removes a Dedimania Player by its login
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @param string $player
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function removePlayer($login) {
 | 
				
			||||||
 | 
							unset($this->players[$login]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
							
								
								
									
										40
									
								
								application/plugins/Dedimania/DedimaniaPlayer.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								application/plugins/Dedimania/DedimaniaPlayer.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Created by PhpStorm.
 | 
				
			||||||
 | 
					 * User: Lukas
 | 
				
			||||||
 | 
					 * Date: 23.02.14
 | 
				
			||||||
 | 
					 * Time: 12:45
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Dedimania;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DedimaniaPlayer {
 | 
				
			||||||
 | 
						public $login = '';
 | 
				
			||||||
 | 
						public $maxRank = -1;
 | 
				
			||||||
 | 
						public $banned = false;
 | 
				
			||||||
 | 
						public $optionsEnabled = false;
 | 
				
			||||||
 | 
						public $options = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function __construct($player) {
 | 
				
			||||||
 | 
							if ($player == null) {
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$this->login          = $player['Login'];
 | 
				
			||||||
 | 
							$this->maxRank        = $player['MaxRank'];
 | 
				
			||||||
 | 
							$this->banned         = $player['Banned'];
 | 
				
			||||||
 | 
							$this->optionsEnabled = $player['OptionsEnabled'];
 | 
				
			||||||
 | 
							$this->options     = $player['Options'];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Construct a new Player by its login and maxRank
 | 
				
			||||||
 | 
						 * @param $login
 | 
				
			||||||
 | 
						 * @param $maxRank
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function constructNewPlayer($login, $maxRank){
 | 
				
			||||||
 | 
							$this->login = $login;
 | 
				
			||||||
 | 
							$this->maxRank = $maxRank;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					} 
 | 
				
			||||||
							
								
								
									
										60
									
								
								application/plugins/Dedimania/RecordData.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								application/plugins/Dedimania/RecordData.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Created by PhpStorm.
 | 
				
			||||||
 | 
					 * User: Lukas
 | 
				
			||||||
 | 
					 * Date: 23.02.14
 | 
				
			||||||
 | 
					 * Time: 11:31
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Dedimania;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use ManiaControl\Formatter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class RecordData {
 | 
				
			||||||
 | 
						public $nullRecord = false;
 | 
				
			||||||
 | 
						public $login = '';
 | 
				
			||||||
 | 
						public $nickName = '';
 | 
				
			||||||
 | 
						public $best = -1;
 | 
				
			||||||
 | 
						public $rank = -1;
 | 
				
			||||||
 | 
						public $maxRank = -1;
 | 
				
			||||||
 | 
						public $checkpoints = '';
 | 
				
			||||||
 | 
						public $newRecord = false;
 | 
				
			||||||
 | 
						public $vReplay = '';
 | 
				
			||||||
 | 
						public $top1GReplay = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Construct a Record by a given Record Array
 | 
				
			||||||
 | 
						 * @param $record
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function __construct($record) {
 | 
				
			||||||
 | 
							if ($record == null) {
 | 
				
			||||||
 | 
								$this->nullRecord = true;
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$this->login       = $record['Login'];
 | 
				
			||||||
 | 
							$this->nickName    = Formatter::stripDirtyCodes($record['NickName']);
 | 
				
			||||||
 | 
							$this->best        = $record['Best'];
 | 
				
			||||||
 | 
							$this->rank        = $record['Rank'];
 | 
				
			||||||
 | 
							$this->maxRank     = $record['MaxRank'];
 | 
				
			||||||
 | 
							$this->checkpoints = $record['Checks'];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Constructs a new Record via it's properties
 | 
				
			||||||
 | 
						 * @param      $login
 | 
				
			||||||
 | 
						 * @param      $nickName
 | 
				
			||||||
 | 
						 * @param      $best
 | 
				
			||||||
 | 
						 * @param      $checkpoints
 | 
				
			||||||
 | 
						 * @param bool $newRecord
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public function constructNewRecord($login, $nickName, $best, $checkpoints, $newRecord = false) {
 | 
				
			||||||
 | 
							$this->nullRecord = false;
 | 
				
			||||||
 | 
							$this->login       = $login;
 | 
				
			||||||
 | 
							$this->nickName    = $nickName;
 | 
				
			||||||
 | 
							$this->best        = $best;
 | 
				
			||||||
 | 
							$this->checkpoints = $checkpoints;
 | 
				
			||||||
 | 
							$this->newRecord   = $newRecord;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					} 
 | 
				
			||||||
		Reference in New Issue
	
	Block a user