Esempio n. 1
0
 public function status()
 {
     $channel = $this->event->getRequest()->getSource();
     if (!$this->current_game) {
         $this->event->addResponse(Response::notice($channel, 'There is no game active.'));
         return;
     }
     $this->event->addResponse(Response::notice($channel, 'There is a game active, started by ' . $this->current_game->getGameOwner()->getName() . '.'));
     $player_names = $this->getCurrentGamePlayerNames();
     if (!$this->current_game->hasStarted()) {
         $this->event->addResponse(Response::notice($channel, 'The game hasn\'t started yet, and we\'re still in the joining phase.'));
         $this->event->addResponse(Response::notice($channel, 'So far, ' . join(', ', $player_names) . ' have joined the game.'));
         return;
     }
     $player = $this->current_game->getCurrentPlayer();
     $this->event->addResponse(Response::notice($channel, 'The game has started, and we\'re waiting on  ' . $player->getName() . ' to ' . ($player->alreadyRolled() ? 'select dice to keep' : 'roll') . '.'));
     if ($this->current_game->getTieCounter() > 1) {
         $message = 'This is a continuation of a tied game.  So, far there\'ve been ' . $this->current_game->getTieCounter() . ' tied games before this one.';
         $this->event->addResponse(Response::notice($channel, $message));
     } else {
         if ($this->current_game->getTieCounter() > 0) {
             $message = 'This is a continuation of a tied game.  So, far there\'s been ' . $this->current_game->getTieCounter() . ' tied game before this one.';
             $this->event->addResponse(Response::notice($channel, $message));
         }
     }
 }