stats fix for invalid custom callbacks
This commit is contained in:
parent
8b367e0834
commit
8d7f6bc62b
@ -270,11 +270,12 @@ class StatisticCollector implements CallbackListener {
|
|||||||
break;
|
break;
|
||||||
case 'EndTurn': //TODO make it for other modes working
|
case 'EndTurn': //TODO make it for other modes working
|
||||||
$paramsObject = json_decode($callback[1][1]);
|
$paramsObject = json_decode($callback[1][1]);
|
||||||
$durationTime = (int)(($paramsObject->EndTime - $paramsObject->StartTime) / 1000);
|
if ($paramsObject && is_array($paramsObject->ScoresTable)) {
|
||||||
$scoresTable = $paramsObject->ScoresTable;
|
$durationTime = (int)(($paramsObject->EndTime - $paramsObject->StartTime) / 1000);
|
||||||
foreach ($scoresTable as $score) {
|
foreach ($paramsObject->ScoresTable as $score) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($score->Login);
|
$player = $this->maniaControl->playerManager->getPlayer($score->Login);
|
||||||
$this->maniaControl->statisticManager->insertStat(self::STAT_PLAYTIME, $player, -1, $durationTime);
|
$this->maniaControl->statisticManager->insertStat(self::STAT_PLAYTIME, $player, -1, $durationTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user