/** * Create a clean new game to apply the test to * * @var string $testID The test ID */ function __construct($testID) { global $DB, $Game, $Variant; /* * Create a clean new game to apply the test to */ $this->testID = $testID; list($id) = $DB->sql_row("SELECT id FROM wD_Games WHERE name='DATC-Adjudicator-Test'"); if ($id) { $DB->sql_put("UPDATE wD_Games SET phase = 'Diplomacy', turn = " . $testID . ", gameOver = 'No' WHERE id = " . $id); } else { $Game = processGame::create(1, 'DATC-Adjudicator-Test', '', 5, 'Winner-takes-all', 30, 30, 'No', 'Regular'); $id = $Game->id; $DB->sql_put("UPDATE wD_Games SET phase = 'Diplomacy', turn = " . $testID . " WHERE id = " . $id); } if (!isset($_REQUEST['DATCResults'])) { self::wipe($id); $countries = array(); for ($i = 1; $i <= count($Variant->countries); $i++) { $countries[] = $i; } $DB->sql_put("INSERT INTO wD_Members (gameID, userID, countryID, bet, timeLoggedIn)\r\n\t\t\t\t\tVALUES " . Database::packArray("(" . $id . ", 2, ", $countries, ", 5, " . time() . ")", ",")); } parent::__construct($id); $GLOBALS['Game'] = $this; $Game = $this; }
$input['drawType'] = 'draw-votes-hidden'; break; default: $input['drawType'] = 'draw-votes-public'; break; } $input['minimumReliabilityRating'] = (int) $input['minimumReliabilityRating']; if ($input['minimumReliabilityRating'] < 0 or $input['minimumReliabilityRating'] > 100) { throw new Exception(l_t("The reliability rating threshold must range from 0-100")); } if ($input['minimumReliabilityRating'] > $User->reliabilityRating) { throw new Exception(l_t("Your reliability rating is %s%%, so you can't create a game which requires players to have a RR of %s%% or greater.", $User->reliabilityRating, $input['minimumReliabilityRating'])); } // Create Game record & object require_once l_r('gamemaster/game.php'); $Game = processGame::create($input['variantID'], $input['name'], $input['password'], $input['bet'], $input['potType'], $input['phaseMinutes'], $input['joinPeriod'], $input['anon'], $input['pressType'], $input['missingPlayerPolicy'], $input['drawType'], $input['minimumReliabilityRating']); // Create first Member record & object processMember::create($User->id, $input['bet']); $Game->Members->joinedRedirect(); } catch (Exception $e) { print '<div class="content">'; print '<p class="notice">' . $e->getMessage() . '</p>'; print '</div>'; } } if ($User->points >= 5) { $roundedDefault = round($User->points / 7 / 10) * 10; if ($roundedDefault > 5) { $defaultPoints = $roundedDefault; } else { $defaultPoints = 5;