示例#1
0
 public function run()
 {
     $game = MafiaGame::getInstance();
     $server = Server::getInstance();
     $user = $this->parameters(1);
     /**
      if (self::$lastValidateTime == 0) {
      $user = $this->findUser($user);
      if (!$user)
      return;
      UserManager::remove($user);
      $server->whois($user);
      self::$lastValidateTime = time();
      self::$lastValidateUser = $user;
      }
     */
     //     if (time() - self::$lastValidateTime > 60) {
     $who = $this->findUser($user);
     //if (!$who) {
     //    $game->removeNick($who);
     // }
     $server->act($this->senderNick, "Validation of user {$user} done!");
     //    self::$lastValidateTime = 0;
     //     self::$lastValidateUser = '';
     //    }
     //    if (strtolower($user) == strtolower(self::$lastValidateUser) && self::$lastValidateUser != '') {
     //        $server->act($this->senderNick, "Another validate of user " . self::$lastValidateUser . " in progress! wait please.");
     //    }
 }
示例#2
0
文件: MafiaVote.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     $game->whosVote($I);
 }
示例#3
0
文件: MafiaOpt.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $opt = $this->parameters(1);
     if (!$opt) {
         $this->showStates();
         return;
     }
     $value = $this->parameters(2, true);
     switch (strtoupper($opt)) {
         case "SHOW-MAFIA":
             MafiaGame::$SHOW_MAFIA_COUNT = $value;
             break;
         case "MAFIA-STATE":
             MafiaGame::$WON_STATE_NORMAL = $value;
             break;
         case "DEAD-TALK":
             MafiaGame::$DEAD_IS_TALKING = $value;
             break;
         case "NIGHT-TIME":
             MafiaGame::$NIGHT_TIMEOUT = intval($value);
             if (MafiaGame::$NIGHT_TIMEOUT < 100) {
                 MafiaGame::$NIGHT_TIMEOUT = 100;
             }
             break;
         case "DAY-TIME":
             MafiaGame::$DAY_TIMEOUT = intval($value);
             if (MafiaGame::$DAY_TIMEOUT < 100) {
                 MafiaGame::$DAY_TIMEOUT = 100;
             }
             break;
     }
 }
示例#4
0
 public function run()
 {
     $game = MafiaGame::getInstance();
     $server = Server::getInstance();
     //if ($game->getState() != MAFIA_TURN) return;
     $server->act(MafiaGame::$LOBBY_ROOM, "Checking time out. please wait! request from : " . $this->senderNick);
     $game->checkNightTimeout();
 }
示例#5
0
文件: MafiaNick.php 项目: numb95/pmg
 public function run()
 {
     $line = new ReceivedLine($this->runMessage);
     $line->parse();
     $game = MafiaGame::getInstance();
     //ChannelManager::rename($this->senderNick, $this->targetNick);
     //UserManager::rename($this->senderNick, $line->targetNick, $line->senderIdent, $line->senderHost);
     $game->changeNick($this->senderNick, $this->targetNick);
 }
示例#6
0
 public function run()
 {
     if ($this->getLevel($this->senderNick) < 10) {
         return;
     }
     $server = Server::getInstance();
     $game = MafiaGame::getInstance(true);
     $server->message(MafiaGame::$LOBBY_ROOM, "Game restarted!");
 }
示例#7
0
文件: MafiaDrop.php 项目: numb95/pmg
 public function run()
 {
     if ($this->getLevel($this->senderNick) < 10) {
         return;
     }
     $game = MafiaGame::getInstance();
     $user = $this->parameters(1);
     $game->removeNick($user);
 }
示例#8
0
文件: MafiaName.php 项目: numb95/pmg
 public function run()
 {
     if ($this->getLevel($this->senderNick) < 10) {
         return;
     }
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $name = $this->parameters(1, true);
     MafiaGame::setGameName($name);
 }
示例#9
0
 public function run()
 {
     if ($this->getLevel($this->senderNick) < 10) {
         return;
     }
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $mafia = intval($this->parameters(1));
     $dr = intval($this->parameters(2));
     $det = intval($this->parameters(3));
     $no = intval($this->parameters(4));
     $game->start($mafia, $dr, $det, $no);
 }
示例#10
0
文件: MafiaWish.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     if ($game->getState() == MAFIA_TURN) {
         $server->message($I, "A wish in night? you are crazy!");
         return;
     }
     if (!$game->isIn($I)) {
         $server->message($I, "You are not in game ;) may be next time");
         return;
     }
     $wish = $this->parameters(1, true);
     $game->thisIsMyLastWish($I, $wish);
 }
示例#11
0
文件: MafiaHeal.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     if ($game->getState() != MAFIA_TURN) {
         $server->message($I, "Not healing time!");
         return;
     }
     if (!$game->isIn($I)) {
         $server->message($I, "You are not in game ;) may be next time");
         return;
     }
     $you = $this->parameters(1);
     if (!$game->isIn($you) && $you != "*" && $you != "-") {
         $server->message($I, "{$you} is not in game ;) are you in love with him/her?");
         return;
     }
     $game->iSayHealYou($I, $you);
 }
示例#12
0
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     if ($game->getState() != DAY_TURN) {
         $server->message($I, "Not punish time!");
         return;
     }
     $I = $this->senderNick;
     if (!$game->isIn($I)) {
         $server->message($I, "You are not in game ;) may be next time");
         return;
     }
     $you = $this->parameters(1);
     if (!$game->isIn($you) && $you != '-') {
         $server->message($I, "{$you} is not in game ;) so why hate him/her this much?");
         return;
     }
     $game->iSayPunishYou($I, $you);
 }
示例#13
0
文件: MafiaWhois.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     if ($game->getState() != MAFIA_TURN) {
         $server->message($I, "Not a good time!");
         return;
     }
     if (!$game->isIn($I)) {
         $server->message($I, "You are not in game ;) may be next time");
         return;
     }
     $you = $this->parameters(1);
     if (!$game->isIn($you) && $you != "*") {
         $server->message($I, "{$you} is not in game ;) why so suspicious about him/her?");
         return;
     }
     $game->iSayWhoAreYou($I, $you);
 }
示例#14
0
文件: MafiaMafia.php 项目: numb95/pmg
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     if (!$game->isIn($I)) {
         $server->message($I, "You are not in game ;)");
         return;
     }
     if (!MafiaGame::$DEAD_IS_TALKING) {
         if ($game->isAlive($I)) {
             $server->message($I, "You are alive, In dead IS dead mode, you can not use emots if you are alive. say it your self!!");
             return;
         }
     }
     $target = $this->parameters(1);
     if (!$game->isIn($target)) {
         $server->message($I, "{$target} is not in game ;) so why hate him/her this much?");
         return;
     }
     $cleareString = $this->ParseString($this->parameters(2, true));
     $server->message(MafiaGame::$LOBBY_ROOM, "{$I} think " . $target . ' is Mafia ' . $cleareString);
 }
示例#15
0
 public function run()
 {
     $game = MafiaGame::getInstance();
     $I = $this->senderNick;
     $game->whoAmI($I);
 }
示例#16
0
文件: MafiaCount.php 项目: numb95/pmg
 public function run()
 {
     $game = MafiaGame::getInstance();
     $server = Server::getInstance();
     $server->message($this->senderNick, "Player count : " . $game->getCount());
 }
示例#17
0
 public function run()
 {
     $server = Server::getInstance();
     $game = MafiaGame::getInstance();
     $game->removeNick($this->senderNick);
 }
示例#18
0
文件: MafiaList.php 项目: numb95/pmg
 public function run()
 {
     $game = MafiaGame::getInstance();
     $game->listAllUsers($this->senderNick);
 }
示例#19
0
文件: MafiaGame.php 项目: numb95/pmg
 /**
  * Say the role to players
  * @param $I string
  */
 public function whoAmI($I)
 {
     if ($this->state != MAFIA_TURN && $this->state != DAY_TURN) {
         return;
     }
     if (!$this->isIn($I)) {
         $this->say($I, 'You are nobody :D');
         return;
     }
     $data = $this->inGamePart[strtolower($I)];
     if ($data['mode'] == MAFIA_PPL) {
         $this->say($I, MafiaGame::boco(9, "You are mafia!!"));
         $this->say($I, "You are mafia :D Please join " . self::$MAFIA_ROOM . " and " . self::$LOBBY_ROOM);
         $this->say($I, self::$MAFIA_ROOM . " Password : "******" and " . self::$LOBBY_ROOM);
         #. " Password : "******"Use this command : /join " . self::$MAFIA_ROOM . ' ' . $this->mafiaPass);
     } else {
         $this->say($I, MafiaGame::boco(9, "You are <NOT> mafia!"));
         $this->say($I, "The game begin, go to sleep! (Join " . self::$LOBBY_ROOM . " room please and " . "stay away from " . self::$MAFIA_ROOM . " its dangerous!)");
         $this->say($I, self::$LOBBY_ROOM);
         #. " Password : "******"You are docter!, use " . MafiaGame::colorize(2, "!heal") . " command in PRIVATE to heal one ppl in NIGHT!"));
     }
     if ($data['mode'] == DETECTIVE_PPL) {
         $this->say($I, MafiaGame::bold("You are detective!, use " . MafiaGame::colorize(2, "!whois") . " command in PRIVATE to identify one ppl each NIGHT!"));
     }
     if ($data['mode'] == NOHARM_PPL) {
         $this->say($I, MafiaGame::bold("You are Invulnerable! you die only with punish command! "));
     }
 }