Example #1
0
 private function replaceArgs($back, $args = NULL)
 {
     $t = Dog::getTrigger();
     $back = str_replace(array('%BOT%', '%CMD%', '%T%'), array(Dog::getNickname(), $t . $this->name, $t), $back);
     return $args === NULL ? $back : vsprintf($back, $args);
 }
Example #2
0
 private function scumInit(Dog_User $user)
 {
     if (false === ($slot = $this->getGameSlot())) {
         return $this->errorSlot();
     }
     if (!isset($this->games[$slot])) {
         $this->games[$slot] = new Dog_ScumGame(Dog::getChannel());
     }
     $game = $this->games[$slot];
     $game instanceof Dog_ScumGame;
     if ($game->isInited()) {
         return $this->errorInited();
     }
     if ($game->isRunning()) {
         return $this->errorRunning();
     }
     $game->init();
     $game->join($user);
     return $this->lang('msg_inited', array($this->getMaxPlayers() - 1, Dog::getTrigger()));
 }
Example #3
0
 private function replaceLang($text, $args, $trigger = '')
 {
     $t = Dog::getTrigger();
     $text = str_replace(array('%T%', '%CMD%', '%BOT%'), array($t, $t . $trigger, Dog::getNickname()), $text);
     return $args === NULL ? $text : vsprintf($text, $args);
 }
Example #4
0
 private function displayItem(Dog_Server $server)
 {
     $count = count($this->queue);
     // Display one
     if ($count > 0) {
         $this->displayItemB($server, array_shift($this->queue));
         $count--;
     }
     // Done?
     if ($count === 0) {
         return $this->onDone($server);
     }
     // We displayed one more
     $this->displaycount++;
     if ($this->displaycount === self::DISPLAYCOUNT_IDLE) {
         $this->runlevel = 5;
         # Idle a while
         $t = Dog::getTrigger();
         $this->response($server, sprintf('There are %d more news from %s in the queue. Type %snews to see them or %snews drop.', $count, $this->feed->getVar('lnf_name'), $t, $t));
     }
     return true;
 }