Fixed colors.
Added last player.
This commit is contained in:
parent
e5064f0e0e
commit
9b8ba57e68
7 changed files with 35 additions and 23 deletions
|
@ -13,8 +13,8 @@ import java.util.Date;
|
||||||
* Annotation Processor</a>
|
* Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class ReleaseInfo {
|
public final class ReleaseInfo {
|
||||||
private final static String buildmeta = "006";
|
private final static String buildmeta = "007";
|
||||||
private final static Date date = new Date(1467010048201L);
|
private final static Date date = new Date(1467054540566L);
|
||||||
private final static int major = 0;
|
private final static int major = 0;
|
||||||
private final static int minor = 6;
|
private final static int minor = 6;
|
||||||
private final static int patch = 1;
|
private final static int patch = 1;
|
||||||
|
|
|
@ -68,7 +68,7 @@ final class Dice
|
||||||
final int playerTotal = i + y;
|
final int playerTotal = i + y;
|
||||||
|
|
||||||
bot.send(bot.getChannel(),
|
bot.send(bot.getChannel(),
|
||||||
sender + " rolled two dice: " + Utils.reverseColor(i) + " and " + Utils.reverseColor(y) + " for a total of " + Utils
|
sender + " rolled two dice: " + Utils.bold(i) + " and " + Utils.bold(y) + " for a total of " + Utils
|
||||||
.bold(playerTotal));
|
.bold(playerTotal));
|
||||||
|
|
||||||
i = r.nextInt(6) + 1;
|
i = r.nextInt(6) + 1;
|
||||||
|
@ -76,7 +76,7 @@ final class Dice
|
||||||
final int total = i + y;
|
final int total = i + y;
|
||||||
|
|
||||||
bot.action(
|
bot.action(
|
||||||
"rolled two dice: " + Utils.reverseColor(i) + " and " + Utils.reverseColor(y) + " for a total of " + Utils.bold(total));
|
"rolled two dice: " + Utils.bold(i) + " and " + Utils.bold(y) + " for a total of " + Utils.bold(total));
|
||||||
|
|
||||||
if (playerTotal < total)
|
if (playerTotal < total)
|
||||||
{
|
{
|
||||||
|
@ -91,4 +91,4 @@ final class Dice
|
||||||
bot.action("tied.");
|
bot.action("tied.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Joke implements Runnable
|
||||||
|
|
||||||
bot.send(bot.getChannel(),
|
bot.send(bot.getChannel(),
|
||||||
Colors.CYAN + json.getJSONObject("value").get("joke").toString().replaceAll("\\'", "'")
|
Colors.CYAN + json.getJSONObject("value").get("joke").toString().replaceAll("\\'", "'")
|
||||||
.replaceAll("\\\"", "\"") + Colors.CYAN);
|
.replaceAll("\\\"", "\"") + Colors.NORMAL);
|
||||||
|
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
@ -109,4 +109,4 @@ class Joke implements Runnable
|
||||||
bot.send(sender, "An error has occurred: " + e.getMessage());
|
bot.send(sender, "An error has occurred: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,6 +267,11 @@ public class Mobibot extends PircBot
|
||||||
*/
|
*/
|
||||||
private String identMsg = "";
|
private String identMsg = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last player.
|
||||||
|
*/
|
||||||
|
private String lastPlayer = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ident nick.
|
* The ident nick.
|
||||||
*/
|
*/
|
||||||
|
@ -1359,8 +1364,8 @@ public class Mobibot extends PircBot
|
||||||
{
|
{
|
||||||
send(sender, "The op commands are:");
|
send(sender, "The op commands are:");
|
||||||
send(sender,
|
send(sender,
|
||||||
helpIndent(Commands.CYCLE_CMD + " " + Commands.ME_CMD + " " + Commands.MSG_CMD + " "
|
helpIndent(Commands.CYCLE_CMD + " " + Commands.INFO_CMD + " " + Commands.ME_CMD + " "
|
||||||
+ Commands.SAY_CMD + " " + Commands.VERSION_CMD));
|
+ Commands.MSG_CMD + " " + Commands.SAY_CMD + " " + Commands.VERSION_CMD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1814,14 +1819,22 @@ public class Mobibot extends PircBot
|
||||||
// mobibot: dice
|
// mobibot: dice
|
||||||
else if (cmd.equals(Commands.DICE_CMD))
|
else if (cmd.equals(Commands.DICE_CMD))
|
||||||
{
|
{
|
||||||
send(channel, SHALL_WE_PLAY_A_GAME);
|
if (!lastPlayer.equalsIgnoreCase(sender))
|
||||||
|
{
|
||||||
|
send(channel, SHALL_WE_PLAY_A_GAME);
|
||||||
|
lastPlayer = sender;
|
||||||
|
}
|
||||||
|
|
||||||
Dice.roll(this, sender);
|
Dice.roll(this, sender);
|
||||||
}
|
}
|
||||||
// mobibot: war
|
// mobibot: war
|
||||||
else if (cmd.equals(Commands.WAR_CMD))
|
else if (cmd.equals(Commands.WAR_CMD))
|
||||||
{
|
{
|
||||||
send(channel, SHALL_WE_PLAY_A_GAME);
|
if (!lastPlayer.equalsIgnoreCase(sender))
|
||||||
|
{
|
||||||
|
send(channel, SHALL_WE_PLAY_A_GAME);
|
||||||
|
lastPlayer = sender;
|
||||||
|
}
|
||||||
|
|
||||||
War.play(this, sender);
|
War.play(this, sender);
|
||||||
}
|
}
|
||||||
|
@ -2384,8 +2397,8 @@ public class Mobibot extends PircBot
|
||||||
if (!isMessage)
|
if (!isMessage)
|
||||||
{
|
{
|
||||||
send(nickname,
|
send(nickname,
|
||||||
Utils.bold("You") + " wanted me to remind you: " + Colors.REVERSE + message
|
Utils.bold("You") + " wanted me to remind you: " + Utils.reverseColor(message
|
||||||
.getMessage() + Colors.NORMAL, true);
|
.getMessage()), true);
|
||||||
|
|
||||||
message.setIsReceived();
|
message.setIsReceived();
|
||||||
message.setIsNotified();
|
message.setIsNotified();
|
||||||
|
@ -2396,8 +2409,7 @@ public class Mobibot extends PircBot
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send(nickname,
|
send(nickname,
|
||||||
message.getSender() + " wanted me to tell you: " + Colors.REVERSE + message.getMessage()
|
message.getSender() + " wanted me to tell you: " + Utils.reverseColor(message.getMessage()),
|
||||||
+ Colors.NORMAL,
|
|
||||||
true);
|
true);
|
||||||
|
|
||||||
message.setIsReceived();
|
message.setIsReceived();
|
||||||
|
@ -2409,7 +2421,7 @@ public class Mobibot extends PircBot
|
||||||
.isNotified())
|
.isNotified())
|
||||||
{
|
{
|
||||||
send(nickname,
|
send(nickname,
|
||||||
"Your message " + Colors.REVERSE + "[ID " + message.getId() + ']' + Colors.NORMAL
|
"Your message " + Utils.reverseColor("[ID " + message.getId() + ']')
|
||||||
+ " was sent to " + Utils.bold(message.getRecipient()) + " on " + Utils.UTC_SDF
|
+ " was sent to " + Utils.bold(message.getRecipient()) + " on " + Utils.UTC_SDF
|
||||||
.format(message.getReceived()),
|
.format(message.getReceived()),
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -85,7 +85,7 @@ final class Utils
|
||||||
*/
|
*/
|
||||||
public static String bold(final int i)
|
public static String bold(final int i)
|
||||||
{
|
{
|
||||||
return Colors.BOLD + i + Colors.BOLD;
|
return bold(Integer.toString(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +163,7 @@ final class Utils
|
||||||
*/
|
*/
|
||||||
public static String bold(final String s)
|
public static String bold(final String s)
|
||||||
{
|
{
|
||||||
return Colors.BOLD + s + Colors.NORMAL;
|
return Colors.BOLD + s + Colors.BOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -387,7 +387,7 @@ final class Utils
|
||||||
*/
|
*/
|
||||||
public static String reverseColor(final int i)
|
public static String reverseColor(final int i)
|
||||||
{
|
{
|
||||||
return Colors.REVERSE + i + Colors.REVERSE;
|
return reverseColor(Integer.toString(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -83,8 +83,8 @@ final class War
|
||||||
y = r.nextInt(WAR_DECK.length);
|
y = r.nextInt(WAR_DECK.length);
|
||||||
|
|
||||||
bot.send(bot.getChannel(),
|
bot.send(bot.getChannel(),
|
||||||
sender + " drew the " + Utils.reverseColor(WAR_DECK[i]) + " of " + WAR_SUITS[r.nextInt(WAR_SUITS.length)]);
|
sender + " drew the " + Utils.bold(WAR_DECK[i]) + " of " + WAR_SUITS[r.nextInt(WAR_SUITS.length)]);
|
||||||
bot.action("drew the " + Utils.reverseColor(WAR_DECK[y]) + " of " + WAR_SUITS[r.nextInt(WAR_SUITS.length)]);
|
bot.action("drew the " + Utils.bold(WAR_DECK[y]) + " of " + WAR_SUITS[r.nextInt(WAR_SUITS.length)]);
|
||||||
|
|
||||||
if (i != y)
|
if (i != y)
|
||||||
{
|
{
|
||||||
|
@ -107,4 +107,4 @@ final class War
|
||||||
bot.action("tied.");
|
bot.action("tied.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@ version.major=0
|
||||||
version.minor=6
|
version.minor=6
|
||||||
version.patch=1
|
version.patch=1
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.buildmeta=006
|
version.buildmeta=007
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue