updated dedimania plugin namespace to MCTeam
This commit is contained in:
		| @@ -1,108 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Dedimania; | ||||
|  | ||||
| use ManiaControl\ManiaControl; | ||||
| use Maniaplanet\DedicatedServer\Structures\Version; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania Plugin DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class DedimaniaData { | ||||
| 	/* | ||||
| 	 * Constants | ||||
| 	 */ | ||||
| 	public $game; | ||||
| 	public $path; | ||||
| 	public $packmask; | ||||
| 	public $serverVersion; | ||||
| 	public $serverBuild; | ||||
| 	public $tool; | ||||
| 	public $version; | ||||
| 	public $login; | ||||
| 	public $code; | ||||
| 	public $sessionId = ''; | ||||
| 	public $records = array(); | ||||
| 	public $players = array(); | ||||
| 	public $directoryAccessChecked = false; | ||||
| 	public $serverMaxRank = 30; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Dedimania Data Model | ||||
| 	 * | ||||
| 	 * @param string  $serverLogin | ||||
| 	 * @param string  $dedimaniaCode | ||||
| 	 * @param string  $path | ||||
| 	 * @param string  $packmask | ||||
| 	 * @param Version $serverVersion | ||||
| 	 */ | ||||
| 	public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) { | ||||
| 		$this->game          = "TM2"; | ||||
| 		$this->login         = $serverLogin; | ||||
| 		$this->code          = $dedimaniaCode; | ||||
| 		$this->version       = ManiaControl::VERSION; | ||||
| 		$this->tool          = "ManiaControl"; | ||||
| 		$this->path          = $path; | ||||
| 		$this->packmask      = $packmask; | ||||
| 		$this->serverVersion = $serverVersion->version; | ||||
| 		$this->serverBuild   = $serverVersion->build; | ||||
| 	} | ||||
|  | ||||
| 	public function toArray() { | ||||
| 		$array = array(); | ||||
| 		foreach (get_object_vars($this) as $key => $value) { | ||||
| 			if ($key == 'records' || $key == 'sessionId' || $key == 'directoryAccessChecked' || $key == 'serverMaxRank' || $key == 'players') { | ||||
| 				continue; | ||||
| 			} | ||||
| 			$array[ucfirst($key)] = $value; | ||||
| 		} | ||||
| 		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]); | ||||
| 	} | ||||
| }  | ||||
| @@ -1,48 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Dedimania; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania-Plugin Player DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class DedimaniaPlayer { | ||||
| 	/* | ||||
| 	 * Public Properties | ||||
| 	 */ | ||||
| 	public $login = ''; | ||||
| 	public $maxRank = -1; | ||||
| 	public $banned = false; | ||||
| 	public $optionsEnabled = false; | ||||
| 	public $options = ''; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Dedimania Player Model | ||||
| 	 * @param mixed$player | ||||
| 	 */ | ||||
| 	public function __construct($player) { | ||||
| 		if (!$player) { | ||||
| 			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 string $login | ||||
| 	 * @param int $maxRank | ||||
| 	 */ | ||||
| 	public function constructNewPlayer($login, $maxRank) { | ||||
| 		$this->login   = $login; | ||||
| 		$this->maxRank = $maxRank; | ||||
| 	} | ||||
| }  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,65 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Dedimania; | ||||
|  | ||||
| use ManiaControl\Formatter; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania-Plugin Record DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class RecordData { | ||||
| 	/* | ||||
| 	 * Public Properties | ||||
| 	 */ | ||||
| 	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 array $record | ||||
| 	 */ | ||||
| 	public function __construct($record) { | ||||
| 		if (!$record) { | ||||
| 			$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']; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Record via its Properties | ||||
| 	 * | ||||
| 	 * @param string $login | ||||
| 	 * @param string $nickName | ||||
| 	 * @param float  $best | ||||
| 	 * @param int    $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; | ||||
| 	} | ||||
| } | ||||
|   | ||||
							
								
								
									
										0
									
								
								application/plugins/MCTeam/Dedimania/Dedimania.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								application/plugins/MCTeam/Dedimania/Dedimania.php
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										108
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaData.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaData.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | ||||
| <?php | ||||
|  | ||||
| namespace MCTeam\Dedimania; | ||||
|  | ||||
| use ManiaControl\ManiaControl; | ||||
| use Maniaplanet\DedicatedServer\Structures\Version; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania Plugin DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class DedimaniaData { | ||||
| 	/* | ||||
| 	 * Constants | ||||
| 	 */ | ||||
| 	public $game; | ||||
| 	public $path; | ||||
| 	public $packmask; | ||||
| 	public $serverVersion; | ||||
| 	public $serverBuild; | ||||
| 	public $tool; | ||||
| 	public $version; | ||||
| 	public $login; | ||||
| 	public $code; | ||||
| 	public $sessionId = ''; | ||||
| 	public $records = array(); | ||||
| 	public $players = array(); | ||||
| 	public $directoryAccessChecked = false; | ||||
| 	public $serverMaxRank = 30; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Dedimania Data Model | ||||
| 	 * | ||||
| 	 * @param string  $serverLogin | ||||
| 	 * @param string  $dedimaniaCode | ||||
| 	 * @param string  $path | ||||
| 	 * @param string  $packmask | ||||
| 	 * @param Version $serverVersion | ||||
| 	 */ | ||||
| 	public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) { | ||||
| 		$this->game          = "TM2"; | ||||
| 		$this->login         = $serverLogin; | ||||
| 		$this->code          = $dedimaniaCode; | ||||
| 		$this->version       = ManiaControl::VERSION; | ||||
| 		$this->tool          = "ManiaControl"; | ||||
| 		$this->path          = $path; | ||||
| 		$this->packmask      = $packmask; | ||||
| 		$this->serverVersion = $serverVersion->version; | ||||
| 		$this->serverBuild   = $serverVersion->build; | ||||
| 	} | ||||
|  | ||||
| 	public function toArray() { | ||||
| 		$array = array(); | ||||
| 		foreach (get_object_vars($this) as $key => $value) { | ||||
| 			if ($key == 'records' || $key == 'sessionId' || $key == 'directoryAccessChecked' || $key == 'serverMaxRank' || $key == 'players') { | ||||
| 				continue; | ||||
| 			} | ||||
| 			$array[ucfirst($key)] = $value; | ||||
| 		} | ||||
| 		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]); | ||||
| 	} | ||||
| }  | ||||
							
								
								
									
										48
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| <?php | ||||
|  | ||||
| namespace MCTeam\Dedimania; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania-Plugin Player DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class DedimaniaPlayer { | ||||
| 	/* | ||||
| 	 * Public Properties | ||||
| 	 */ | ||||
| 	public $login = ''; | ||||
| 	public $maxRank = -1; | ||||
| 	public $banned = false; | ||||
| 	public $optionsEnabled = false; | ||||
| 	public $options = ''; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Dedimania Player Model | ||||
| 	 * @param mixed$player | ||||
| 	 */ | ||||
| 	public function __construct($player) { | ||||
| 		if (!$player) { | ||||
| 			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 string $login | ||||
| 	 * @param int $maxRank | ||||
| 	 */ | ||||
| 	public function constructNewPlayer($login, $maxRank) { | ||||
| 		$this->login   = $login; | ||||
| 		$this->maxRank = $maxRank; | ||||
| 	} | ||||
| }  | ||||
							
								
								
									
										1182
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1182
									
								
								application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										65
									
								
								application/plugins/MCTeam/Dedimania/RecordData.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								application/plugins/MCTeam/Dedimania/RecordData.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| <?php | ||||
|  | ||||
| namespace MCTeam\Dedimania; | ||||
|  | ||||
| use ManiaControl\Formatter; | ||||
|  | ||||
| /** | ||||
|  * ManiaControl Dedimania-Plugin Record DataStructure | ||||
|  * | ||||
|  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||
|  * @copyright 2014 ManiaControl Team | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class RecordData { | ||||
| 	/* | ||||
| 	 * Public Properties | ||||
| 	 */ | ||||
| 	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 array $record | ||||
| 	 */ | ||||
| 	public function __construct($record) { | ||||
| 		if (!$record) { | ||||
| 			$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']; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Record via its Properties | ||||
| 	 * | ||||
| 	 * @param string $login | ||||
| 	 * @param string $nickName | ||||
| 	 * @param float  $best | ||||
| 	 * @param int    $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