Esempio n. 1
0
 /**
  *
  * @param string $user the username
  * @param string|char $message the guess
  * @return the answer
  */
 public function onGuess($user, $message)
 {
     $message = trim($message);
     if ($this->finish) {
         if ($message === 'false') {
             $this->CONFIG['solution_allowed_everytime'] = false;
         }
         $iso = Common::substrFrom($message, ' ', Dog::getChannel()->getLangISO());
         $this->onStartGame($iso);
     } elseif ($message === '') {
         $this->sendOutput('The game has already started');
     } else {
         if (GWF_String::strlen($message) !== 1) {
             $this->trySolution($user, $message);
         } else {
             $this->tryChar($user, $message);
         }
         if (GWF_String::toLower($this->grid) === GWF_String::tolower($this->solution)) {
             $this->winGame($nick);
         }
     }
     return $this->clearOutput();
 }