Пример #1
0
 /**
  * A textual display of this user's last log-in time
  * @return string Last log-in time
  */
 function lastLoggedInTxt()
 {
     return libTime::timeLengthText(time() - $this->timeLoggedIn) . ' (' . libTime::text($this->timeLoggedIn) . ')';
 }
Пример #2
0
 function pausedInfo()
 {
     $buf = parent::pausedInfo();
     if (is_null($this->pauseTimeRemaining)) {
         $remaining = $this->phaseMinutes * 60;
     } else {
         $remaining = $this->pauseTimeRemaining;
     }
     return $buf . ' (' . l_t('%s left on unpause', libTime::timeLengthText($remaining)) . ')';
 }
Пример #3
0
		<input type="radio" name="newGame[drawType]" value="draw-votes-hidden">Hidden draw votes
	</li>
	<li class="formlistdesc">
		Whether or not draw votes can be seen by the other players. In both modes, the game will be drawn when all players have voted draw. However, if draw votes are 
		hidden then you are the only one who knows whether you have voted to draw or not. 
		<br /><br /><strong>Default:</strong>Public draw votes
	</li>

	<li class="formlisttitle">
		Joining pre-game period length: (5 minutes - 10 days)
	</li>
	<li class="formlistfield">
		<select id="wait" name="newGame[joinPeriod]">
		<?php 
foreach ($phaseList as $i) {
    $opt = libTime::timeLengthText($i * 60);
    print '<option value="' . $i . '"' . ($i == 1440 ? ' selected' : '') . '>' . $opt . '</option>';
}
?>
		</select>
	</li>
	<li class="formlistdesc">
		The amount of time to wait for people to join. For 5 minute games you may want to give players longer than 5 minutes to join.

		<br /><br /><strong>Default:</strong> The same as phase length
	</li>
	<li class="formlisttitle">
		Reliability Requirements
	</li>
	<li class="formlistfield">
		Reliability rating: <input id="minRating" type="text" name="newGame[minimumReliabilityRating]" size="2" value="0"
Пример #4
0
 public function changePhaseLength(array $params)
 {
     global $DB;
     require_once l_r('objects/game.php');
     $newPhaseMinutes = (int) $params['phaseMinutes'];
     if ($newPhaseMinutes < 5 || $newPhaseMinutes > 10 * 24 * 60) {
         throw new Exception(l_t("Given phase minutes out of bounds (5 minutes to 10 days)"));
     }
     $Variant = libVariant::loadFromGameID($params['gameID']);
     $Game = $Variant->Game($params['gameID']);
     if ($Game->processStatus != 'Not-processing' || $Game->phase == 'Finished') {
         throw new Exception(l_t("Game is either crashed/paused/finished/processing, and so the next-process time cannot be altered."));
     }
     $oldPhaseMinutes = $Game->phaseMinutes;
     $Game->phaseMinutes = $newPhaseMinutes;
     $Game->processTime = time() + $newPhaseMinutes * 60;
     $DB->sql_put("UPDATE wD_Games SET\r\n\t\t\tphaseMinutes = " . $Game->phaseMinutes . ",\r\n\t\t\tprocessTime = " . $Game->processTime . "\r\n\t\t\tWHERE id = " . $Game->id);
     return l_t('Process time changed from %s to %s. Next process time is %s.', libTime::timeLengthText($oldPhaseMinutes * 60), libTime::timeLengthText($Game->phaseMinutes * 60), libTime::text($Game->processTime));
 }
Пример #5
0
 /**
  * Hours per phase, whether the game is slow or fast etc
  * @return string
  */
 function gameHoursPerPhase()
 {
     $buf = l_t('<strong>%s</strong> /phase', libTime::timeLengthText($this->phaseMinutes * 60)) . ' <span class="gameTimeHoursPerPhaseText">(';
     if ($this->isLiveGame()) {
         $buf .= l_t('live');
     } elseif ($this->phaseMinutes < 6 * 60) {
         $buf .= l_t('very fast');
     } elseif ($this->phaseMinutes < 16 * 60) {
         $buf .= l_t('fast');
     } elseif ($this->phaseMinutes < 36 * 60) {
         $buf .= l_t('normal');
     } elseif ($this->phaseMinutes < 3 * 24 * 60) {
         $buf .= l_t('slow');
     } else {
         $buf .= l_t('very slow');
     }
     return $buf . ')</span>';
 }