2014-05-04 00:36:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MCTeam\Dedimania;
|
|
|
|
|
2014-05-13 14:32:30 +02:00
|
|
|
use ManiaControl\Utils\Formatter;
|
2014-05-04 00:36:20 +02:00
|
|
|
|
|
|
|
/**
|
2014-05-24 20:19:41 +02:00
|
|
|
* ManiaControl Dedimania Plugin Record Data Structure
|
2014-05-04 00:36:20 +02:00
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2016-05-04 09:57:31 +02:00
|
|
|
* @copyright 2014-2016 ManiaControl Team
|
2014-05-04 00:36:20 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
|
|
|
class RecordData {
|
|
|
|
/*
|
2014-08-02 22:31:46 +02:00
|
|
|
* Public properties
|
2014-05-04 00:36:20 +02:00
|
|
|
*/
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|