Also.. I haven't had the chance to even run this yet -- but I think it'll work..
Config:
Code: Select all
plug-ins.load = nocturne\TA_AutoTimer
; TA Track Timer equation: (author_time X multiplier) + adjustment
;plugins.nocturne\TA_AutoTimer.debug = false ; enable/disable debug reporting
;plugins.nocturne\TA_AutoTimer.multiplier = 6 ; set the track time multiplier
;plugins.nocturne\TA_AutoTimer.adjustment = 60 ; set the track time adjustment (+/-)
;plugins.nocturne\TA_AutoTimer.min_time = 180 ; set the max track time
;plugins.nocturne\TA_AutoTimer.max_time = 360 ; set the min track time
Code: Select all
<?php
/*
TA Auto Track Timer v.anchiote for ML2 r27x+
-by -nocturne=- www.letsrock-tm.com
*no licensing BS, no warranty*
credits: Nobody really... kind of common sense. But props go to Mistral, I believe,
who made the first version back in TMN
*/
namespace ManiaLivePlugins\nocturne\TA_AutoTimer;
use ManiaLive\Config\Loader;
use ManiaLive\Data\Storage; //dunno if this is needed
use ManiaLive\DedicatedApi\Connection;
use ManiaLive\Utilities\Console;
use ManiaLive\Event\Dispatcher;
class TA_AutoTimer extends \ManiaLive\PluginHandler\Plugin {
static $debug = false;
static $multiplier = 6;
static $adjustment = 60;
static $min_time = 180;
static $max_time = 360;
function onEndMap () {
if ($this->connection->getNextGameInfo()->gameMode == 2) {
$nextChallenge = $this->connection->getNextMapInfo();
$authorTime = $nextChallenge->authorTime;
if ($authorTime){
$authorTime = $authorTime * 1000; // think we need this... ms->secs
$time = round(($this->multiplier * $authorTime) + $adjustment);
if ($time < $this->min_time) {
$time = $this->min_time;
}
if ($time > $this->max_time) {
$time = $this->max_time;
}
if ($this->debug) Console::println('['.date('H:i:s').'] [TA_AutoTimer] Timer active: AT: '.$authorTime.'secs ; Computed TimeLimit: '.$time.'secs...');
$this->connection->setTimeAttackLimit($time);
}
} else {
if ($this->debug) Console::println('['.date('H:i:s').'] [TA_AutoTimer] Timer inactive: Not in TimeAttack mode...');
}
}
}
?>
Code: Select all
function onEndMap () {
if ($this->connection->getNextGameInfo()->gameMode == 2) {
$nextChallenge = $this->connection->getNextMapInfo();
Code: Select all
function onEndChallenge () {
if ($this->connection->getNextGameInfo()->gameMode ==1) {
$nextChallenge = $this->connection->getNextChallengeInfo();
To devs, what events come after EndChallenge before the end of the challenge, if any (I'm sure there's a StatusChanged event that would fit the bill)..? Is there anything equivalent to the old 'onPlayerWins'?