/**
  * @param string $host
  * @param int $port
  * @return RuleDisplayable[]
  */
 function getDedicatedMatchRules(\Maniaplanet\DedicatedServer\Connection $connection)
 {
     $gameInfo = $connection->getNextGameInfo();
     $matchRules = array();
     switch ($gameInfo->gameMode) {
         case GameInfos::GAMEMODE_SCRIPT:
             $info = $connection->getModeScriptInfo();
             $settings = $connection->getModeScriptSettings();
             foreach ($info->paramDescs as $value) {
                 $rule = new RuleDisplayable();
                 $rule->name = $value->name;
                 $rule->value = $settings[$value->name];
                 $rule->label = $value->name;
                 $rule->documentation = $value->desc;
                 if ($value->type == 'boolean') {
                     $rule->value = $rule->value == 'True';
                     $rule->inputType = 'switch';
                     $rule->inputValues = array(array('label' => _('No'), 'value' => 0), array('label' => _('Yes'), 'value' => 1));
                 }
                 $matchRules[] = $rule;
             }
             break;
         case GameInfos::GAMEMODE_ROUNDS:
             $rule = new RuleDisplayable();
             $rule->name = 'roundsPointsLimit';
             $rule->value = (int) $gameInfo->roundsPointsLimit;
             $rule->label = _('Points limit');
             $rule->documentation = _('Limit of points required to win the match.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'roundsPointsLimitNewRules';
             $rule->value = (int) $gameInfo->roundsPointsLimitNewRules;
             $rule->label = _('Points limit with new rules');
             $rule->documentation = _('Limit of points required to win the match.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'roundsUseNewRules';
             $rule->value = (int) $gameInfo->roundsUseNewRules;
             $rule->label = _('Use new rules');
             $rule->inputType = 'switch';
             $rule->inputValues = array(array('label' => _('No'), 'value' => 0), array('label' => _('Yes'), 'value' => 1));
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'roundsForcedLaps';
             $rule->value = (int) $gameInfo->roundsForcedLaps;
             $rule->label = _('Forced laps');
             $rule->documentation = _('Force the number of lap for mutlilaps maps.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'roundCustomPoints';
             $rule->value = implode(',', $connection->getRoundCustomPoints());
             $rule->label = _('Custom points');
             $rule->documentation = _('Points that will be given to players in order of arrival.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'allWarmUpDuration';
             $rule->value = (int) $gameInfo->allWarmUpDuration;
             $rule->label = _('Warm up duration');
             $rule->documentation = _('0 will disable warm-up, otherwise it\'s the number of rounds.');
             $matchRules[] = $rule;
             break;
         case GameInfos::GAMEMODE_TIMEATTACK:
             $rule = new RuleDisplayable();
             $rule->name = 'timeAttackLimit';
             $rule->value = (int) $gameInfo->timeAttackLimit;
             $rule->label = _('Time limit in millisecs');
             $rule->documentation = _('Map duration.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'timeAttackSynchStartPeriod';
             $rule->value = (int) $gameInfo->timeAttackSynchStartPeriod;
             $rule->label = _('Synchronisation period at start in millisecs');
             $rule->documentation = _('Time of player synchronisation at the beginning of the map.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'allWarmUpDuration';
             $rule->value = (int) $gameInfo->allWarmUpDuration;
             $rule->label = _('Warm up duration');
             $rule->documentation = _('0 will disable warm-up, otherwise it\'s the number of times the gold medal time).');
             $matchRules[] = $rule;
             break;
         case GameInfos::GAMEMODE_TEAM:
             $rule = new RuleDisplayable();
             $rule->name = 'teamPointsLimit';
             $rule->value = (int) $gameInfo->teamPointsLimit;
             $rule->label = _('Points limit');
             $rule->documentation = _('Limit of points required to win the match.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'teamPointsLimitNewRules';
             $rule->value = (int) $gameInfo->teamPointsLimitNewRules;
             $rule->label = _('Points limit with new rules');
             $rule->documentation = _('Limit of points required to win the match.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'teamMaxPoints';
             $rule->value = (int) $gameInfo->teamMaxPoints;
             $rule->label = _('Max points');
             $rule->documentation = _('Maximum points that a team can win.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'teamUseNewRules';
             $rule->value = (int) $gameInfo->teamUseNewRules;
             $rule->label = _('Max points');
             $rule->inputType = 'switch';
             $rule->inputValues = array(array('label' => _('No'), 'value' => 0), array('label' => _('Yes'), 'value' => 1));
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'allWarmUpDuration';
             $rule->value = (int) $gameInfo->allWarmUpDuration;
             $rule->label = _('Warm up duration');
             $rule->documentation = _('0 will disable warm-up, otherwise it\'s the number of rounds.');
             $matchRules[] = $rule;
             break;
         case GameInfos::GAMEMODE_LAPS:
             $rule = new RuleDisplayable();
             $rule->name = 'lapsNbLaps';
             $rule->value = (int) $gameInfo->lapsNbLaps;
             $rule->label = _('Laps number');
             $rule->documentation = _('Number of laps to do before finishing the race, or 0 to use map default.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'lapsTimeLimit';
             $rule->value = (int) $gameInfo->lapsTimeLimit;
             $rule->label = _('Time limit in millisecs');
             $rule->documentation = _('Time allowed for player to do this number of laps.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'allWarmUpDuration';
             $rule->value = (int) $gameInfo->allWarmUpDuration;
             $rule->label = _('Warm up duration');
             $rule->documentation = _('0 will disable warm-up, otherwise it\'s the number of times the gold medal time.');
             $matchRules[] = $rule;
             break;
         case GameInfos::GAMEMODE_CUP:
             $rule = new RuleDisplayable();
             $rule->name = 'cupPointsLimit';
             $rule->value = (int) $gameInfo->cupPointsLimit;
             $rule->label = _('Points limit');
             $rule->documentation = _('Number of point to earn before reaching the finalist status.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'cupRoundsPerMap';
             $rule->value = (int) $gameInfo->cupRoundsPerMap;
             $rule->label = _('Rounds per map');
             $rule->documentation = _('Number of rounds played per map.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'cupNbWinners';
             $rule->value = (int) $gameInfo->cupNbWinners;
             $rule->label = _('Number of winner');
             $rule->documentation = _('Number of player who has to win before the match is complete.');
             $matchRules[] = $rule;
             $rule = new RuleDisplayable();
             $rule->name = 'cupWarmUpDuration';
             $rule->value = (int) $gameInfo->cupWarmUpDuration;
             $rule->label = _('Warm up duration');
             $rule->documentation = _('0 will disable warm-up, otherwise it\'s the number of rounds.');
             $matchRules[] = $rule;
             break;
     }
     return $matchRules;
 }