コード例 #1
0
ファイル: Dog_Timer.php プロジェクト: sinfocol/gwf3
 public static function sleepAndTrigger()
 {
     # Trigger
     self::trigger();
     # Sleep
     $elapsed = microtime(true) - self::$LAST_TIME;
     $elapsed *= 1000000;
     if ($elapsed < self::$MICROS) {
         usleep(self::$MICROS - $elapsed);
     }
     self::$LAST_TIME = microtime(true);
 }
コード例 #2
0
ファイル: DOGMOD_Slaylert.php プロジェクト: sinfocol/gwf3
 public function onInitTimers()
 {
     Dog_Timer::addTimer(array($this, 'pullTimer'), null, 10.0);
 }
コード例 #3
0
ファイル: flush_timers_Xb.php プロジェクト: sinfocol/gwf3
<?php

$lang = array('en' => array('help' => 'Usage: %CMD%. Restart all timers.', 'ok' => 'Timers have been successfully flushed. %BOT% is sleeping for %d milliseconds each loop.'));
$millis = Dog_Init::getSleepMillis();
Dog_Timer::flush();
Dog_Timer::init(Dog_Init::getSleepMillis());
Dog_Init::initTimers();
Dog::rply('ok', array($millis));
コード例 #4
0
ファイル: alert_Pb.php プロジェクト: sinfocol/gwf3
if (0 >= ($seconds = GWF_TimeConvert::humanToSeconds($seconds))) {
    return $plug->rply('err_seconds');
}
if (GWF_Time::ONE_DAY * 8 < $seconds) {
    return $plug->rply('err_too_long');
}
// Try to parse back duration from parsed seconds
if (false === ($delay = GWF_TimeConvert::humanDurationISO(Dog::getLangISO(), $seconds))) {
    return $plug->rply('err_seconds');
}
$user = Dog::getUser();
if (!isset($DOG_PLUG_ALERT_TIMERS[$user->getID()])) {
    $DOG_PLUG_ALERT_TIMERS[$user->getID()] = 0;
}
if ($DOG_PLUG_ALERT_TIMERS[$user->getID()] >= 3) {
    return $plug->rply('err_too_much');
}
if (!function_exists('dog_plugin_alert_func4')) {
    function dog_plugin_alert_func4(array $args)
    {
        global $DOG_PLUG_ALERT_TIMERS;
        $scope = $args[0];
        $scope instanceof Dog_Scope;
        Dog::setScope($scope);
        Dog::reply($args[1]);
        $DOG_PLUG_ALERT_TIMERS[$scope->getUser()->getID()]--;
    }
}
Dog_Timer::addTimer('dog_plugin_alert_func4', array(Dog::getScope(), $plug->argvMsgFrom(1)), $seconds, false);
$DOG_PLUG_ALERT_TIMERS[$user->getID()]++;
$plug->rply('msg_remember', array($delay));
コード例 #5
0
ファイル: Shadowrun4.php プロジェクト: sinfocol/gwf3
 public static function shadowTimer()
 {
     # 1 second over in the Shadowlamb world.
     self::$sr_timestamp = GWF_Counter::getAndCount('SR4_TIME', self::SECONDS_PER_TICK);
     # Execute Web Commands
     // 		self::shadowTimerWebcommands();
     if (defined('SL4_REALS')) {
         self::shadowTimerRealNPCs();
     }
     # All parties:
     $partyids = array_keys(self::$parties);
     shuffle($partyids);
     # Shuffle which party goes first to have evenly distributed winners in race conditions.
     foreach ($partyids as $id) {
         # still there?
         if (isset(self::$parties[$id])) {
             if (self::$parties[$id]->getTimestamp() < time() - self::KICK_IDLE_TIMEOUT) {
                 self::removeParty(self::$parties[$id]);
             } else {
                 self::$parties[$id] instanceof SR_Party;
                 self::$parties[$id]->timer(self::$sr_timestamp);
             }
         }
     }
     # Next tick in one second pls.
     Dog_Timer::addTimer(array(__CLASS__, 'shadowTimer'), NULL, self::TICKLEN, false);
 }
コード例 #6
0
ファイル: DOGMOD_Quote.php プロジェクト: sinfocol/gwf3
 public function onInitTimers()
 {
     Dog_Timer::addTimer(array($this, 'randomQuote'), NULL, 60);
 }
コード例 #7
0
ファイル: DOGMOD_Forum.php プロジェクト: sinfocol/gwf3
 public function onInitTimers()
 {
     Dog_Timer::addTimer(array($this, 'onTimer'), NULL, 60);
 }
コード例 #8
0
ファイル: Dog_Init.php プロジェクト: sinfocol/gwf3
 public static function initTimerTrig($entry, $fullpath, $data)
 {
     list($server, $repeat, $seconds) = $data;
     Dog_Timer::addTimer($fullpath, $server, $seconds, $repeat);
 }
コード例 #9
0
ファイル: SR_RealNPCBase.php プロジェクト: sinfocol/gwf3
 private function ai_idle($delay = 15)
 {
     Dog_Timer::addTimer(array($this, 'on_idled'), array(), $delay);
 }
コード例 #10
0
ファイル: Dog.php プロジェクト: sinfocol/gwf3
 public static function mainloop()
 {
     Dog_Log::debug('Dog::mainloop() - start');
     while (!Dog_Launcher::shouldRestart()) {
         foreach (self::$SERVERS as $server) {
             $server instanceof Dog_Server;
             if ($server->isActive()) {
                 self::processServer($server);
             }
         }
         Dog_Timer::sleepAndTrigger();
         self::$WORKER->executeCallbacks();
     }
     Dog_Launcher::cleanup();
     Dog_Log::debug('Dog::mainloop() - exited');
 }
コード例 #11
0
ファイル: DOGMOD_ClaimNick.php プロジェクト: sinfocol/gwf3
 public function onInitTimers()
 {
     Dog_Timer::addTimer(array($this, 'claim'), null, 120);
 }