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>
|
2018-03-27 20:11:40 +02:00
|
|
|
* @copyright 2014-2018 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 = '';
|
2017-05-21 23:11:52 +02:00
|
|
|
public $nickname = '';
|
2014-05-04 00:36:20 +02:00
|
|
|
public $best = -1;
|
|
|
|
public $rank = -1;
|
|
|
|
public $maxRank = -1;
|
|
|
|
public $checkpoints = '';
|
|
|
|
public $newRecord = false;
|
|
|
|
public $vReplay = '';
|
|
|
|
public $top1GReplay = '';
|
2018-07-03 18:12:47 +02:00
|
|
|
public $allCheckpoints = '';
|
2014-05-04 00:36:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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'];
|
2017-05-21 23:11:52 +02:00
|
|
|
$this->nickname = Formatter::stripDirtyCodes($record['NickName']);
|
2014-05-04 00:36:20 +02:00
|
|
|
$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
|
|
|
|
*/
|
2018-07-03 18:12:47 +02:00
|
|
|
public function constructNewRecord($login, $nickname, $best, $checkpoints, $newRecord = false, $allCPs = '') {
|
2014-05-04 00:36:20 +02:00
|
|
|
$this->nullRecord = false;
|
|
|
|
$this->login = $login;
|
2017-05-21 23:11:52 +02:00
|
|
|
$this->nickname = $nickname;
|
2014-05-04 00:36:20 +02:00
|
|
|
$this->best = $best;
|
|
|
|
$this->checkpoints = $checkpoints;
|
|
|
|
$this->newRecord = $newRecord;
|
2018-07-03 18:12:47 +02:00
|
|
|
$this->allCheckpoints = $allCPs;
|
2014-05-04 00:36:20 +02:00
|
|
|
}
|
|
|
|
}
|