From 14f0d9b20cc2beddfe3ad95e08fa6a975cf60bab Mon Sep 17 00:00:00 2001 From: Alexander Nell Date: Fri, 28 Feb 2020 19:54:47 +0100 Subject: [PATCH] Include map times in Map-Structure and update them when necessary --- core/Maps/Map.php | 4 ++++ core/Maps/MapManager.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/core/Maps/Map.php b/core/Maps/Map.php index 6c0d0ddd..0e8a8b38 100644 --- a/core/Maps/Map.php +++ b/core/Maps/Map.php @@ -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; diff --git a/core/Maps/MapManager.php b/core/Maps/MapManager.php index 551f1f75..95fe83d6 100644 --- a/core/Maps/MapManager.php +++ b/core/Maps/MapManager.php @@ -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; }