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."); // } }
public function run() { $server = Server::getInstance(); $game = MafiaGame::getInstance(); $I = $this->senderNick; $game->whosVote($I); }
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; } }
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(); }
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); }
public function run() { if ($this->getLevel($this->senderNick) < 10) { return; } $server = Server::getInstance(); $game = MafiaGame::getInstance(true); $server->message(MafiaGame::$LOBBY_ROOM, "Game restarted!"); }
public function run() { if ($this->getLevel($this->senderNick) < 10) { return; } $game = MafiaGame::getInstance(); $user = $this->parameters(1); $game->removeNick($user); }
public function run() { if ($this->getLevel($this->senderNick) < 10) { return; } $server = Server::getInstance(); $game = MafiaGame::getInstance(); $name = $this->parameters(1, true); MafiaGame::setGameName($name); }
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); }
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); }
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); }
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); }
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); }
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); }
public function run() { $game = MafiaGame::getInstance(); $I = $this->senderNick; $game->whoAmI($I); }
public function run() { $game = MafiaGame::getInstance(); $server = Server::getInstance(); $server->message($this->senderNick, "Player count : " . $game->getCount()); }
public function run() { $server = Server::getInstance(); $game = MafiaGame::getInstance(); $game->removeNick($this->senderNick); }
public function run() { $game = MafiaGame::getInstance(); $game->listAllUsers($this->senderNick); }
/** * 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! ")); } }