Add S_RoundsPerMap to Champion gamemode & fix //matchsetpoints command with login

This commit is contained in:
Beu 2021-03-14 00:37:13 +01:00
parent e9c2b40023
commit ff850c58fe

View File

@ -235,7 +235,7 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
'default' => 6, 'default' => 6,
'description' => 'Number of rounds to play before finding a winner of the step' ], 'description' => 'Number of rounds to play before finding a winner of the step' ],
self::SETTING_MATCH_S_ROUNDSPERMAP => [ self::SETTING_MATCH_S_ROUNDSPERMAP => [
'gamemode' => ['Cup', 'Knockout', 'Teams', 'Rounds'], 'gamemode' => ['Champion', 'Cup', 'Knockout', 'Teams', 'Rounds'],
'type' => 'integer', 'type' => 'integer',
'default' => 5, 'default' => 5,
'description' => 'Number of rounds par map (0 = unlimited) (multiple maps doesn\'t work in KO)' ], 'description' => 'Number of rounds par map (0 = unlimited) (multiple maps doesn\'t work in KO)' ],
@ -1181,7 +1181,6 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
if ($current) { if ($current) {
$current = false; $current = false;
} elseif (($this->nbmaps + $i) <= ($this->settings_nbmapsbymatch)) { } elseif (($this->nbmaps + $i) <= ($this->settings_nbmapsbymatch)) {
Logger::log("i: " . $i);
if ($i > 0) { if ($i > 0) {
if ($i == 1) { if ($i == 1) {
$message = $this->chatprefix . '$<$o$iNext Maps:$>'; $message = $this->chatprefix . '$<$o$iNext Maps:$>';
@ -1212,7 +1211,7 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
Logger::log("scriptName: " . $scriptName); Logger::log("scriptName: " . $scriptName);
if ($scriptName == "Trackmania/TM_TimeAttack_Online.Script.txt") { if ($scriptName == "Trackmania/TM_TimeAttack_Online.Script.txt") {
$this->postmatch = false; $this->postmatch = false;
Logger::log("Load Script Settings"); Logger::log("Load Script Settings");
$postmatchsettings = [ $postmatchsettings = [
self::SETTING_MATCH_S_FORCELAPSNB => 0, self::SETTING_MATCH_S_FORCELAPSNB => 0,
@ -1221,14 +1220,13 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
self::SETTING_MATCH_S_TIMELIMIT => 600 self::SETTING_MATCH_S_TIMELIMIT => 600
]; ];
$this->maniaControl->getClient()->setModeScriptSettings($postmatchsettings); $this->maniaControl->getClient()->setModeScriptSettings($postmatchsettings);
Logger::log("Restarting Map for load settings"); Logger::log("Restarting Map for load settings");
$this->maniaControl->getClient()->restartMap(); $this->maniaControl->getClient()->restartMap();
} else { } else {
// Depending of the load of the server and the match gamemode, the script could be not loaded, this is a workaround to reload thhe script // Depending of the load of the server and the match gamemode, the script could be not loaded, this is a workaround to reload thhe script
$this->maniaControl->getClient()->restartMap(); $this->maniaControl->getClient()->restartMap();
} }
} }
} }
@ -1612,8 +1610,8 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
if (isset($array[0])) { if (isset($array[0])) {
$login = $array[0]; $login = $array[0];
} elseif (strlen($peopletoadd) == 22) { } elseif (strlen($text[1]) == 22) {
$login = $peopletoadd ; $login = $text[1] ;
} }
if ($mysqli->error) { if ($mysqli->error) {
trigger_error($mysqli->error, E_USER_ERROR); trigger_error($mysqli->error, E_USER_ERROR);
@ -1625,7 +1623,8 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
$this->maniaControl->getModeScriptEventManager()->setTrackmaniaPlayerPoints($player, "", "", $text[2]); $this->maniaControl->getModeScriptEventManager()->setTrackmaniaPlayerPoints($player, "", "", $text[2]);
$this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> now has ' . $text[2] . ' points!'); $this->maniaControl->getChat()->sendSuccess($this->chatprefix . 'Player $<$ff0' . $player->nickname . '$> now has ' . $text[2] . ' points!');
} else { } else {
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Player ' . $text[1] . " doesn't exist", $adminplayer); $this->maniaControl->getModeScriptEventManager()->setTrackmaniaPlayerPoints($player, "", "", $text[2]);
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Player ' . $text[1] . " isn't connected", $adminplayer);
} }
} else { } else {
$this->maniaControl->getChat()->sendError($this->chatprefix . 'Player ' . $text[1] . " doesn't exist", $adminplayer); $this->maniaControl->getChat()->sendError($this->chatprefix . 'Player ' . $text[1] . " doesn't exist", $adminplayer);
@ -1673,4 +1672,3 @@ class MatchManagerCore implements ManialinkPageAnswerListener, CallbackListener,
} }
} }
} }