=Fixed Bug #6 Roll improperly formats when providing single number
Edited roll function, array index had incorrect variable assigned
This commit is contained in:
@@ -22,7 +22,9 @@ public class CommandRoll extends Command
|
||||
{
|
||||
KittyEmbed embed = new KittyEmbed();
|
||||
embed.title = user.name +"'s roll!";
|
||||
System.out.println("HERE");
|
||||
embed.descriptionText = rollDice(input.args);
|
||||
System.out.println("THERE");
|
||||
Random numGen = new Random(user.name.hashCode());
|
||||
float hue = numGen.nextFloat();
|
||||
float sat = .7f;
|
||||
@@ -41,10 +43,11 @@ public class CommandRoll extends Command
|
||||
Stack<Integer> values = new Stack<Integer>();
|
||||
Stack<Character> operators = new Stack<Character>();
|
||||
String steps = "";
|
||||
|
||||
for(int i = 0; i < thing.length(); i ++)
|
||||
{
|
||||
char current = thing.charAt(i);
|
||||
|
||||
System.out.println("ROLLING");
|
||||
switch(current)
|
||||
{
|
||||
case '+':
|
||||
@@ -122,9 +125,12 @@ public class CommandRoll extends Command
|
||||
{
|
||||
steps += "\n" + calculate(values, operators);
|
||||
}
|
||||
|
||||
if(steps != "")
|
||||
{
|
||||
return "Roll```" + thing + "```" + "Steps```" + steps + "```" + "Final value ```" + values.pop() +"```";
|
||||
}
|
||||
return "That's not a roll that's just " + values.pop() +"!";
|
||||
}
|
||||
|
||||
|
||||
private String calculate(Stack<Integer> nums, Stack<Character> operators)
|
||||
@@ -173,7 +179,7 @@ public class CommandRoll extends Command
|
||||
int roll = 0;
|
||||
int dice = first;
|
||||
int sides = second;
|
||||
int [] rolls = new int [sides];
|
||||
int [] rolls = new int [dice];
|
||||
|
||||
if(dice < 1)
|
||||
return new int[0];
|
||||
|
||||
@@ -387,8 +387,11 @@ public class ObjectBuilderFactory
|
||||
// Determine token based on config. Default to test token.
|
||||
String tokenToUse = Ref.TestToken;
|
||||
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
|
||||
tokenToUse = Ref.Token;
|
||||
if(ConfigGlobals.getStartupMode() == KittyStartupMode.PoguRelease)
|
||||
tokenToUse = Ref.PoguToken;
|
||||
|
||||
|
||||
// Construct bot based on token
|
||||
kitty = new JDABuilder(AccountType.BOT)
|
||||
.setToken(tokenToUse).buildBlocking();
|
||||
|
||||
@@ -2,7 +2,7 @@ package dataStructures;
|
||||
|
||||
public enum KittyStartupMode
|
||||
{
|
||||
Dev(1), Release(2);
|
||||
Dev(1), Release(2), PoguRelease(3);
|
||||
|
||||
private final int value;
|
||||
private KittyStartupMode(int value)
|
||||
|
||||
Reference in New Issue
Block a user