Пример #1
0
define('FILE_PATH_hg', $game_path);
define('TICK_LOG_FILE_NPC', $game_path . 'logs/NPC_BOT_tick_' . date('d-m-Y', time()) . '.log');
include 'NPC_BOT.php';
include 'ferengi.php';
include 'borg.php';
include 'settlers.php';
$sdl->start_job('Ramona comes over - oh women are so wonderful');
$quark = new Ferengi($db, $sdl);
$quark->Execute(1, "Normal operation in the test round", 0, "#DEEB24");
$sdl->finish_job('Ramona comes over - oh women are so wonderful');
$sdl->start_job('SevenOfNine is coming - oh borg are not so beautiful');
$borg = new Borg($db, $sdl);
$borg->Execute(1);
$sdl->finish_job('SevenOfNine is coming - oh borg are not so beautiful');
$sdl->start_job('Mayflower is coming - settlers are the real workforce');
$settlers = new Settlers($db, $sdl);
$settlers->Execute(1);
$sdl->finish_job('Mayflower is coming - settlers are the real workforce');
// ########################################################################################
// ########################################################################################
// Update Tick-ID
// (here, everything is completed, which is based on the ticking ID)
if (substr($STARDATE, -1, 1) == '9') {
    $new_stardate = (string) ((double) $STARDATE + 0.1) . '.0';
} else {
    $new_stardate = (string) ((double) $STARDATE + 0.1);
}
if (!$db->query('UPDATE config SET tick_id = tick_id + 1, shipwreck_id=shipwreck_id+1, tick_securehash = "' . md5($ACTUAL_TICK) . '", stardate = "' . $new_stardate . '"')) {
    $sdl->log('<b>Error:</b> Could not update tick ID, Tick stopped, sent mail to admin@stfc.it');
    mail('*****@*****.**', 'STFC2: Tickstop', 'Tick ' . $ACTUAL_TICK . ' has been stopped.\\nError message:\\n' . $db->raise_error() . '\\n\\nGreetings, STGC Scheduler');
    $db->raise_error();
Пример #2
0
error_reporting(E_ERROR);
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
    echo 'The scheduler can only be called by CLI!';
    exit;
}
// ########################################################################################
// ########################################################################################
// Init
$starttime = microtime() + time();
$sdl = new scheduler();
$sdl->log('<br><b>-------------------------------------------------------------</b><br>' . '<b>Starting Install BOTs at ' . date('d.m.y H:i:s', time()) . '</b>', INSTALL_LOG_FILE_NPC);
// create sql-object for db-connection
$db = new sql($config['server'] . ":" . $config['port'], $config['game_database'], $config['user'], $config['password']);
$game = new game();
// Install Quark BOT
$quark = new Ferengi($db, $sdl);
$quark->Install();
// Install SevenOfNine BOT
$borg = new Borg($db, $sdl);
$borg->Install();
// Install Settlers BOT
$settlers = new Settlers($db, $sdl);
$settlers->Install();
// ########################################################################################
// ########################################################################################
// Quit and close log
$db->close();
$sdl->log('<b>Finished Install BOTs in <font color=#009900>' . round(microtime() + time() - $starttime, 4) . ' secs</font><br>Executed Queries: <font color=#ff0000>' . $db->i_query . '</font></b>', INSTALL_LOG_FILE_NPC);
?>