use of tel.discord.rtab.GameController in project RtaB6 by Telnaior.
the class MinesweeperCommand method execute.
@Override
protected void execute(CommandEvent event) {
for (GameController game : RaceToABillionBot.game) {
if (game.channel.equals(event.getChannel())) {
int player = game.findPlayerInGame(event.getAuthor().getId());
String rawSpace = event.getArgs();
// Check that it's valid (the game is running, the space is legit, they're alive, and they have the command)
if (game.gameStatus != GameStatus.IN_PROGRESS || player == -1 || !game.checkValidNumber(rawSpace) || game.players.get(player).status != PlayerStatus.ALIVE || game.players.get(player).hiddenCommand != HiddenCommand.MINESWEEP)
event.reply("You can't do this right now.");
else // Cool, we're good, pass it over
{
int space = Integer.parseInt(rawSpace) - 1;
if (game.pickedSpaces[space])
event.reply("That space has already been picked.");
else
game.useMinesweeper(player, space);
}
return;
}
}
// We aren't in a game channel? Uh...
event.reply("This is not a game channel.");
}
use of tel.discord.rtab.GameController in project RtaB6 by Telnaior.
the class ViewBombsCommand method execute.
@Override
protected void execute(CommandEvent event) {
for (GameController game : RaceToABillionBot.game) {
if (game.channel.equals(event.getChannel())) {
if (game.findPlayerInGame(event.getAuthor().getId()) != -1)
event.reply("You can't view bombs for a game you're in!");
else {
StringBuilder output = new StringBuilder();
for (Player nextPlayer : game.players) {
output.append(nextPlayer.printBombs() + "\n");
}
event.replyInDm(output.toString());
}
// We found the right channel, so
return;
}
}
}
use of tel.discord.rtab.GameController in project RtaB6 by Telnaior.
the class DemoCommand method execute.
@Override
protected void execute(CommandEvent event) {
for (GameController game : RaceToABillionBot.game) {
if (game.channel.equals(event.getChannel())) {
if (game.runDemo != 0)
game.demoMode.cancel(true);
if (!event.getArgs().equals("")) {
int playerCount = Integer.parseInt(event.getArgs());
for (int i = 0; i < playerCount; i++) {
game.addRandomBot();
}
game.startTheGameAlready();
} else
game.runDemo();
// We found the right channel, so
return;
}
}
}
use of tel.discord.rtab.GameController in project RtaB6 by Telnaior.
the class HiddenCommandCommand method execute.
@Override
protected void execute(CommandEvent event) {
// Start by checking to see if they're in-game, and read from their player-file instead
Player player = null;
// Find the channel
GameController controller = null;
for (GameController next : RaceToABillionBot.game) if (next.channel.equals(event.getChannel())) {
controller = next;
break;
}
if (controller == null) {
event.reply("This command must be used in a game channel.");
return;
}
for (Player next : controller.players) if (next.uID.equals(event.getAuthor().getId())) {
player = next;
break;
}
// If they aren't in-game, get their data by generating their player object
if (player == null) {
player = new Player(event.getMember(), controller, null);
}
// At this point we've found them, so just prompt the reminder method
player.remindHiddenCommand();
}
Aggregations