Include map times in Map-Structure and update them when necessary

This commit is contained in:
Alexander Nell 2020-02-28 19:54:47 +01:00
parent ae3d1d69da
commit 14f0d9b20c
2 changed files with 12 additions and 0 deletions

View File

@ -33,6 +33,8 @@ class Map implements Dumpable, UsageInformationAble {
public $environment = null;
public $authorTime = -1;
public $goldTime = -1;
public $silverTime = -1;
public $bronzeTime = -1;
public $copperPrice = -1;
public $mapType = null;
public $mapStyle = null;
@ -69,6 +71,8 @@ class Map implements Dumpable, UsageInformationAble {
$this->environment = $mpMap->environnement;
$this->authorTime = $mpMap->authorTime;
$this->goldTime = $mpMap->goldTime;
$this->silverTime = $mpMap->silverTime;
$this->bronzeTime = $mpMap->bronzeTime;
$this->copperPrice = $mpMap->copperPrice;
$this->mapType = $mpMap->mapType;
$this->mapStyle = $mpMap->mapStyle;

View File

@ -681,6 +681,10 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
if (array_key_exists($rpcMap->uId, $this->maps)) {
$this->currentMap = $this->maps[$rpcMap->uId];
$this->currentMap->authorTime = $rpcMap->authorTime;
$this->currentMap->goldTime = $rpcMap->goldTime;
$this->currentMap->silverTime = $rpcMap->silverTime;
$this->currentMap->bronzeTime = $rpcMap->bronzeTime;
$this->currentMap->nbCheckpoints = $rpcMap->nbCheckpoints;
$this->currentMap->nbLaps = $rpcMap->nbLaps;
return $this->currentMap;
@ -835,6 +839,10 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform
$this->currentMap = $this->maps[$uid];
if (!$this->currentMap->nbCheckpoints || !$this->currentMap->nbLaps) {
$rpcMap = $this->maniaControl->getClient()->getCurrentMapInfo();
$this->currentMap->authorTime = $rpcMap->authorTime;
$this->currentMap->goldTime = $rpcMap->goldTime;
$this->currentMap->silverTime = $rpcMap->silverTime;
$this->currentMap->bronzeTime = $rpcMap->bronzeTime;
$this->currentMap->nbLaps = $rpcMap->nbLaps;
$this->currentMap->nbCheckpoints = $rpcMap->nbCheckpoints;
}