$turnstoday .= ", Haunted: -1"; } require_once "lib/extended-battle.php"; unsuspend_companions("allowinshades"); if (!getsetting("newdaycron", 0)) { //check last time we did this vs now to see if it was a different game day. $lastnewdaysemaphore = convertgametime(strtotime(getsetting("newdaySemaphore", "0000-00-00 00:00:00") . " +0000")); $gametoday = gametime(); if (gmdate("Ymd", $gametoday) != gmdate("Ymd", $lastnewdaysemaphore)) { // it appears to be a different game day, acquire semaphore and // check again. $sql = "LOCK TABLES " . db_prefix("settings") . " WRITE"; db_query($sql); clearsettings(); $lastnewdaysemaphore = convertgametime(strtotime(getsetting("newdaySemaphore", "0000-00-00 00:00:00") . " +0000")); $gametoday = gametime(); if (gmdate("Ymd", $gametoday) != gmdate("Ymd", $lastnewdaysemaphore)) { //we need to run the hook, update the setting, and unlock. savesetting("newdaySemaphore", gmdate("Y-m-d H:i:s")); $sql = "UNLOCK TABLES"; db_query($sql); require "lib/newday/newday_runonce.php"; } else { //someone else beat us to it, unlock. $sql = "UNLOCK TABLES"; db_query($sql); } } } $args = modulehook("newday", array("resurrection" => $resurrection, "turnstoday" => $turnstoday)); $turnstoday = $args['turnstoday'];
<?php require_once "common.php"; page_header("About The Dragon Saga"); $time = strtotime(date("1971-m-d H:i:s", strtotime("now -" . getsetting("gameoffsetseconds", 0) . " seconds"))) * getsetting("daysperday", 4) % strtotime("1971-01-01 00:00:00"); $time = gametime(); $tomorrow = strtotime(date("Y-m-d H:i:s", $time) . " + 1 day"); $tomorrow = strtotime(date("Y-m-d 00:00:00", $tomorrow)); $today = strtotime(date("Y-m-d 00:00:00", $time)); $dayduration = ($tomorrow - $today) / getsetting("daysperday", 4); $secstotomorrow = $tomorrow - $time; $secssofartoday = $time - $today; $realsecstotomorrow = $secstotomorrow / getsetting("daysperday", 4); $realsecssofartoday = $secssofartoday / getsetting("daysperday", 4); checkday(); if (!isset($_GET['op'])) { $_GET['op'] = ''; } if ($_GET['op'] == "") { $order = array("1", "2"); while (list($key, $val) = each($order)) { switch ($val) { case "2": // NOTICE // NOTICE Server admins may put their own information here, please leave the main about body untouched. // NOTICE output("<hr>", true); //output("Put your own information here and uncomment this line by removing the '/' marks."); break; case "1": // NOTICE
function getgametime() { return date("g:i a", gametime()); }
function gametimedetails() : array { $gameTime = gametime(); $today = strtotime(gmdate('Y-m-d 00:00:00 O'), $gameTime); $tomorrow = strtotime(gmdate('Y-m-d 00:00:00 O') . '+1 day', $gameTime); $daysPerDay = getsetting('daysperday', 4); $details = ['now' => date('Y-m-d H:i:s'), 'gametime' => $gameTime, 'daysperday' => $daysPerDay, 'secsperday' => 86400 / $daysPerDay, 'today' => $today, 'tomorrow' => $tomorrow, 'secssofartoday' => $gameTime - $today, 'secstotomorrow' => $tomorrow - $gameTime, 'realsecssofartoday' => ($gameTime - $today) / $daysPerDay, 'realsecstotomorrow' => ($tomorrow - $gameTime) / $daysPerDay, 'dayduration' => ($tomorrow - $today) / $daysPerDay]; return $details; }
function gametimedetails() { $ret = array(); $ret['now'] = date("Y-m-d 00:00:00"); $ret['gametime'] = gametime(); $ret['daysperday'] = getsetting("daysperday", 4); $ret['secsperday'] = 86400 / $ret['daysperday']; $ret['today'] = strtotime(gmdate("Y-m-d 00:00:00 O", $ret['gametime'])); $ret['tomorrow'] = strtotime(gmdate("Y-m-d H:i:s O", $ret['gametime']) . " + 1 day"); $ret['tomorrow'] = strtotime(gmdate("Y-m-d 00:00:00 O", $ret['tomorrow'])); // Why isn't this // $ret['tomorrow'] = // strtotime(gmdate("Y-m-d 00:00:00 O",$ret['gametime'])." + 1 day"); $ret['secssofartoday'] = $ret['gametime'] - $ret['today']; $ret['secstotomorrow'] = $ret['tomorrow'] - $ret['gametime']; $ret['realsecssofartoday'] = $ret['secssofartoday'] / $ret['daysperday']; $ret['realsecstotomorrow'] = $ret['secstotomorrow'] / $ret['daysperday']; $ret['dayduration'] = ($ret['tomorrow'] - $ret['today']) / $ret['daysperday']; return $ret; }