Skip to content

Commit e4001e9

Browse files
author
Julien Pardons
committed
Fix backup round
1 parent 8ba7ce6 commit e4001e9

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/eBot/Application/Application.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function run()
9898
);
9999

100100
$time = time();
101+
$timePub = time();
101102
while (true) {
102103
$ip = "";
103104

@@ -304,7 +305,10 @@ public function run()
304305
}
305306

306307
//if ($nbMessage < 100) {
307-
\eBot\Manager\MatchManager::getInstance()->sendPub();
308+
if ($timePub + 1 < time()) {
309+
$timePub = time();
310+
\eBot\Manager\MatchManager::getInstance()->sendPub();
311+
}
308312
\eTools\Task\TaskManager::getInstance()->runTask();
309313
//}
310314
}

src/eBot/Match/Match.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ public function taskExecute($name)
582582
{
583583
if ($name == self::SET_LIVE) {
584584
$this->addLog("Setting live.");
585+
$this->pendingContinueMatch = false;
585586
$this->enable = true;
586587
} else if ($name == self::TASK_ENGAGE_MAP) {
587588
$tvTimeRemaining = $this->rcon->send("tv_time_remaining");
@@ -718,7 +719,7 @@ private function isMatchRound()
718719
public function sendRotateMessage()
719720
{
720721
// This is to send to players the status
721-
if ($this->isMatchRound() && !$this->enable) {
722+
if ($this->isMatchRound() && !$this->enable && !$this->pendingContinueMatch) {
722723
if (time() - $this->lastMessage >= 8) {
723724
$this->say("Match is paused, write !continue to continue the match.");
724725
$teamA = strtoupper($this->side['team_a']);
@@ -1755,7 +1756,7 @@ private function processRoundScored(\eBot\Message\Type\RoundScored $message)
17551756
}
17561757

17571758
$data = $this->rcon->send("mp_backup_round_file_last");
1758-
if (preg_match('!"mp_backup_round_file_last" = "(?<backup>[a-zA-Z0-9\-_\.]+)"!', $data, $match)) {
1759+
if (preg_match('!mp_backup_round_file_last = (?<backup>[a-zA-Z0-9\-_\.]+)!', $data, $match)) {
17591760
$backupFile = "'" . $match["backup"] . "'";
17601761
} else {
17611762
$backupFile = 'NULL';
@@ -2778,7 +2779,7 @@ private function continueMatch()
27782779
if ($this->continue["ct"] && $this->continue["t"]) {
27792780
$this->continue["ct"] = false;
27802781
$this->continue["t"] = false;
2781-
2782+
$this->pendingContinueMatch = true;
27822783
$this->addMatchLog("Getting back to the match.");
27832784
$this->addLog("Getting back to the match.");
27842785

@@ -3369,9 +3370,12 @@ public function adminStopBack()
33693370
}
33703371
}
33713372

3373+
private $pendingContinueMatch = false;
3374+
33723375
public function adminGoBackRounds($round)
33733376
{
33743377
$this->enable = false;
3378+
$this->pendingContinueMatch = true;
33753379
$sql = mysqli_query(Application::getInstance()->db, "SELECT * FROM round_summary WHERE match_id = '" . $this->match_id . "' AND map_id = '" . $this->currentMap->getMapId() . "' AND round_id = $round");
33763380
$req = mysqli_fetch_array($sql);
33773381

0 commit comments

Comments
 (0)