improved map object
This commit is contained in:
parent
b04356670e
commit
ac1479c2df
@ -21,6 +21,7 @@ require_once __DIR__ . '/pluginHandler.php';
|
||||
require_once __DIR__ . '/server.php';
|
||||
require_once __DIR__ . '/settingManager.php';
|
||||
require_once __DIR__ . '/settingConfigurator.php';
|
||||
require_once __DIR__ . '/map.php';
|
||||
require_once __DIR__ . '/mapHandler.php';
|
||||
require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php';
|
||||
require_once __DIR__ . '/ManiaExchange/mxinfofetcher.inc.php';
|
||||
@ -76,8 +77,9 @@ class ManiaControl {
|
||||
$this->chat = new Chat($this);
|
||||
$this->callbacks = new Callbacks($this);
|
||||
$this->server = new Server($this);
|
||||
$this->playerHandler = new PlayerHandler($this);
|
||||
$this->authentication = new Authentication($this);
|
||||
$this->playerHandler = new PlayerHandler($this);
|
||||
$this->mapHandler = new MapHandler($this);
|
||||
$this->manialinkIdHandler = new ManialinkIdHandler();
|
||||
$this->commands = new Commands($this);
|
||||
$this->pluginHandler = new PluginHandler($this);
|
||||
|
@ -8,72 +8,72 @@ namespace ManiaControl;
|
||||
* @author kremsy & steeffeen
|
||||
*/
|
||||
|
||||
class map {
|
||||
class Map {
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
private $maniaControl = 0;
|
||||
|
||||
/**
|
||||
* Public properties
|
||||
*/
|
||||
public $mapFetcher = null;
|
||||
|
||||
public $id = 0;
|
||||
public $name = '';
|
||||
public $uid = 0;
|
||||
public $filename = '';
|
||||
public $fileName = '';
|
||||
public $environment = '';
|
||||
public $mood = '';
|
||||
public $bronzetime; //format?
|
||||
public $silvertime; //format?
|
||||
public $goldtime; //format?
|
||||
public $authortime; //format?
|
||||
public $copperprice = 0;
|
||||
public $laprace = 0;
|
||||
public $forcedlaps = 0;
|
||||
public $nblaps = 0;
|
||||
public $nbchecks = 0;
|
||||
public $score = 0;
|
||||
public $starttime = 0;
|
||||
public $maptype = '';
|
||||
public $mapstyle = '';
|
||||
public $titleuid = 0;
|
||||
// public $gbx; //needed? would be the whole gbx object
|
||||
public $goldTime; //format?
|
||||
public $copperPrice = 0;
|
||||
public $mapType = '';
|
||||
public $mapStyle = '';
|
||||
|
||||
public $mx = null;
|
||||
public $authorLogin = '';
|
||||
public $authorNick = '';
|
||||
public $authorZone = '';
|
||||
public $authorEInfo; //format?
|
||||
public $authorEInfo = '';
|
||||
public $comment = '';
|
||||
public $titleUid = '';
|
||||
|
||||
public $starttime = 0;
|
||||
|
||||
//Todo: check RPC infos
|
||||
// instantiates the map with an RPC response
|
||||
public function __construct($rpc_infos = null) {
|
||||
$this->id = 0;
|
||||
public function __construct(ManiaControl $maniaControl, $rpc_infos = null) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
if ($rpc_infos) {
|
||||
$this->name = stripNewlines($rpc_infos['Name']);
|
||||
$this->name = $rpc_infos['Name']; //in aseco stripped new lines on name
|
||||
$this->uid = $rpc_infos['UId'];
|
||||
$this->filename = $rpc_infos['FileName'];
|
||||
$this->fileName = $rpc_infos['FileName'];
|
||||
$this->authorLogin = $rpc_infos['Author'];
|
||||
$this->environment = $rpc_infos['Environnement'];
|
||||
$this->mood = $rpc_infos['Mood'];
|
||||
$this->bronzetime = $rpc_infos['BronzeTime'];
|
||||
$this->silvertime = $rpc_infos['SilverTime'];
|
||||
$this->goldtime = $rpc_infos['GoldTime'];
|
||||
$this->authortime = $rpc_infos['AuthorTime'];
|
||||
$this->copperprice = $rpc_infos['CopperPrice'];
|
||||
$this->laprace = $rpc_infos['LapRace'];
|
||||
$this->forcedlaps = 0;
|
||||
$this->nblaps = $rpc_infos['NbLaps'];
|
||||
$this->nbchecks = $rpc_infos['NbCheckpoints'];
|
||||
$this->maptype = $rpc_infos['MapType'];
|
||||
$this->mapstyle = $rpc_infos['MapStyle'];
|
||||
$this->goldTime = $rpc_infos['GoldTime'];
|
||||
$this->copperPrice = $rpc_infos['CopperPrice'];
|
||||
$this->mapType = $rpc_infos['MapType'];
|
||||
$this->mapStyle = $rpc_infos['MapStyle'];
|
||||
|
||||
$this->starttime = time();
|
||||
$this->mapFetcher = new \GBXChallMapFetcher(true);
|
||||
|
||||
try{
|
||||
$this->mapFetcher->processFile($this->maniaControl->server->getMapsDirectory() . $this->fileName);
|
||||
} catch (Exception $e){
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
}
|
||||
$this->authorNick = $this->mapFetcher->authorNick;
|
||||
$this->authorEInfo = $this->mapFetcher->authorEInfo;
|
||||
$this->authorZone = $this->mapFetcher->authorZone;
|
||||
$this->comment = $this->mapFetcher->comment;
|
||||
//additional properties anyway in the mapfetcher object
|
||||
|
||||
//TODO: change to SM to gameerkennung
|
||||
//TODO: define timeout if mx is down
|
||||
$this->mx = new \MXInfoFetcher('SM', $this->uid, false); //SM -> change to gameerkennung
|
||||
} else {
|
||||
$this->name = 'undefined';
|
||||
}
|
||||
|
||||
/* $mapFetcher = new \GBXChallMapFetcher(true);
|
||||
try{
|
||||
$mapFetcher->processFile($this->mc->server->mapdir . $this->filename);
|
||||
} catch (Exception $e){
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
}
|
||||
$this->authorNick = $mapFetcher->authorNick;
|
||||
$this->authorEInfo = $mapFetcher->authorEInfo;
|
||||
$this->authorZone = $mapFetcher->authorZone;
|
||||
*/
|
||||
$this->mx = new \MXInfoFetcher('SM', $this->uid, false); //SM -> change to gameerkennung
|
||||
$this->starttime = time();
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@ class mapHandler {
|
||||
$this->maniaControl->client->query('GetMapList', 300, 0);
|
||||
$mapList = $this->maniaControl->client->getResponse();
|
||||
foreach ($mapList as $map) {
|
||||
$map = new Map($this->maniaControl, $map);
|
||||
$this->addMap($map);
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class PlayerHandler {
|
||||
$player = $this->removePlayer($login);
|
||||
|
||||
if($this->maniaControl->settingManager->getSetting($this,"Leave Join Messages")){
|
||||
$played = timeFormatter::formatTime(time() - $player->joinTime);
|
||||
$played = TimeFormatter::formatTime(time() - $player->joinTime);
|
||||
$this->maniaControl->chat->sendChat($player->nickname . '$z $ff0has left the game. Played:$fff ' . $played);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class Server {
|
||||
if (!$dataDirectory) {
|
||||
return null;
|
||||
}
|
||||
return $dataDirectory . 'UserData/Maps/';
|
||||
return $dataDirectory . 'Maps/';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user