1pwny
2015-06-07, 07:32 PM
Hello everyone! So, I've participated in a few of the Homebrew class design competitions, and I got bored of making that table really quickly. You know, the one with the BAB and stuff/level? So, I wrote a java program to do it for me. Here's the code.
I know it looks ugly, but I had to use the noparse tag. Sorry!
import java.util.Scanner;
public class ClassWriter {
private static Scanner s = new Scanner(System.in);
private static String extraTitle="",extra="";
private static int l=1;
private static int[] stats = new int[4]; //BAB, fort, ref, will tracker
private static int[] improve = new int[4]; //rate at which the saves improve
private static int[] lt = {0,0,0,0}; //level tracker, DON'T CHANGE!
public static void main(String[] args) {
//extraTitle = "\n
{extra column's header} ";
String temp;
boolean isMed = false;
int maxlevel;
System.out.print("Welcome to somebody27else's class writer!"
+ "\nMake sure to type carefully, and good luck!"
+ "\n========================================"
+ "\nHow many levels does your class have? ");
maxlevel = s.nextInt();
System.out.print("Slow, medium, or fast BAB progression? ");
temp = s.next();
s.nextLine();
if(temp.equalsIgnoreCase("slow") || temp.equalsIgnoreCase("s")) {
stats[0] = 0;
improve[0] = 2;
} else if(temp.equalsIgnoreCase("medium") || temp.equalsIgnoreCase("m")) {
stats[0] = 0;
improve[0] = 1;
isMed = true;
} else if(temp.equalsIgnoreCase("fast") || temp.equalsIgnoreCase("f")) {
stats[0] = 0;
improve[0] = 1;
}
setSave(1,"Fort");
setSave(2,"Ref");
setSave(3,"Will");
char q = 0x22;
System.out.println("\n\n"
+ "\n"
+ "\n"
+ "\n"
+ "\n
Level"
+ "\n
BAB"
+ "\n
Fort"
+ "\n
Ref"
+ "\n
Will"
+ "\n
Special"
+ extraTitle
+ "\n\n");
String babstr;
for(l=1; l <= maxlevel; l++) {
for(int n=0; n<4; n++) {
lt[n]++;
if(lt[n]==improve[n]) {
lt[n] = 0;
stats[n]++;
}
}
if(((l-1)%4==0) && isMed) {
stats[0]--;
}
babstr="+"+stats[0];
if(stats[0]>5)
babstr += "/+"+(stats[0]-5);
if(stats[0]>10)
babstr += "/+"+(stats[0]-10);
if(stats[0]>15)
babstr += "/+"+(stats[0]-15);
setExtra();
System.out.println(""
+ "\n
"+l+" "
+ "\n
"+babstr+" "
+ "\n
+"+stats[1]+" "
+ "\n
+"+stats[2]+" "
+ "\n
+"+stats[3]+" "
+ "\n
"
+ extra
+ "\n\n");
}
System.out.println("");
}
public static void setSave(int stat,String sName) {
String temp;
System.out.print("Slow or fast " + sName + " save progression? ");
temp = s.nextLine();
if(temp.equalsIgnoreCase("slow") || temp.equalsIgnoreCase("s")) {
stats[stat] = 0;
improve[stat] = 3;
} else if(temp.equalsIgnoreCase("fast") || temp.equalsIgnoreCase("f")) {
stats[stat] = 2;
improve[stat] = 2;
}
}
public static void setExtra() {
/** place to write extra conditions/columns **/
//extra = "\n
"+ {insert whatever you want here} +"";
}
}
Most of this is self-explanatory. You can copy the code into an online compiler, or whatever java compiler you have on your computer. It runs from the terminal.
This will create the basic table with class level, BAB, fort, ref, and will. Yes, the program will ask you for those.
If you want to add extra columns, like for spells known or maneuvers or such, it gets a little more complicated. Either follow these instruction if you know some java, or just ask me if you don't.
Go to the first line in the main. The extraTitle line should be commented out. De-comment it.
You should get an error because, in fact, {extra column's header} is not valid java code. Replace that with what you want your new column to be named.
OPTIONAL: To add more columns, copy everything inside the quotes and paste it into the end of the quotes. Each paste will add a new line you can change the title of.
Go to the setExtra() method. The line which gives extra a value should be commented. De-comment it.
Do whatever shenanigans you want to put in the by-level extra data. Ex: If I want to give my class 1 maneuver every 4 levels, I could write this: extra = "\n
"+ (l/4 + 1) +"
";
This is the basic guide. Any questions on usage, problems, feedback, or anything in general, please reply!
I know it looks ugly, but I had to use the noparse tag. Sorry!
import java.util.Scanner;
public class ClassWriter {
private static Scanner s = new Scanner(System.in);
private static String extraTitle="",extra="";
private static int l=1;
private static int[] stats = new int[4]; //BAB, fort, ref, will tracker
private static int[] improve = new int[4]; //rate at which the saves improve
private static int[] lt = {0,0,0,0}; //level tracker, DON'T CHANGE!
public static void main(String[] args) {
//extraTitle = "\n
{extra column's header} ";
String temp;
boolean isMed = false;
int maxlevel;
System.out.print("Welcome to somebody27else's class writer!"
+ "\nMake sure to type carefully, and good luck!"
+ "\n========================================"
+ "\nHow many levels does your class have? ");
maxlevel = s.nextInt();
System.out.print("Slow, medium, or fast BAB progression? ");
temp = s.next();
s.nextLine();
if(temp.equalsIgnoreCase("slow") || temp.equalsIgnoreCase("s")) {
stats[0] = 0;
improve[0] = 2;
} else if(temp.equalsIgnoreCase("medium") || temp.equalsIgnoreCase("m")) {
stats[0] = 0;
improve[0] = 1;
isMed = true;
} else if(temp.equalsIgnoreCase("fast") || temp.equalsIgnoreCase("f")) {
stats[0] = 0;
improve[0] = 1;
}
setSave(1,"Fort");
setSave(2,"Ref");
setSave(3,"Will");
char q = 0x22;
System.out.println("\n\n"
+ "\n"
+ "\n"
+ "\n"
+ "\n
Level"
+ "\n
BAB"
+ "\n
Fort"
+ "\n
Ref"
+ "\n
Will"
+ "\n
Special"
+ extraTitle
+ "\n\n");
String babstr;
for(l=1; l <= maxlevel; l++) {
for(int n=0; n<4; n++) {
lt[n]++;
if(lt[n]==improve[n]) {
lt[n] = 0;
stats[n]++;
}
}
if(((l-1)%4==0) && isMed) {
stats[0]--;
}
babstr="+"+stats[0];
if(stats[0]>5)
babstr += "/+"+(stats[0]-5);
if(stats[0]>10)
babstr += "/+"+(stats[0]-10);
if(stats[0]>15)
babstr += "/+"+(stats[0]-15);
setExtra();
System.out.println(""
+ "\n
"+l+" "
+ "\n
"+babstr+" "
+ "\n
+"+stats[1]+" "
+ "\n
+"+stats[2]+" "
+ "\n
+"+stats[3]+" "
+ "\n
"
+ extra
+ "\n\n");
}
System.out.println("");
}
public static void setSave(int stat,String sName) {
String temp;
System.out.print("Slow or fast " + sName + " save progression? ");
temp = s.nextLine();
if(temp.equalsIgnoreCase("slow") || temp.equalsIgnoreCase("s")) {
stats[stat] = 0;
improve[stat] = 3;
} else if(temp.equalsIgnoreCase("fast") || temp.equalsIgnoreCase("f")) {
stats[stat] = 2;
improve[stat] = 2;
}
}
public static void setExtra() {
/** place to write extra conditions/columns **/
//extra = "\n
"+ {insert whatever you want here} +"";
}
}
Most of this is self-explanatory. You can copy the code into an online compiler, or whatever java compiler you have on your computer. It runs from the terminal.
This will create the basic table with class level, BAB, fort, ref, and will. Yes, the program will ask you for those.
If you want to add extra columns, like for spells known or maneuvers or such, it gets a little more complicated. Either follow these instruction if you know some java, or just ask me if you don't.
Go to the first line in the main. The extraTitle line should be commented out. De-comment it.
You should get an error because, in fact, {extra column's header} is not valid java code. Replace that with what you want your new column to be named.
OPTIONAL: To add more columns, copy everything inside the quotes and paste it into the end of the quotes. Each paste will add a new line you can change the title of.
Go to the setExtra() method. The line which gives extra a value should be commented. De-comment it.
Do whatever shenanigans you want to put in the by-level extra data. Ex: If I want to give my class 1 maneuver every 4 levels, I could write this: extra = "\n
"+ (l/4 + 1) +"
";
This is the basic guide. Any questions on usage, problems, feedback, or anything in general, please reply!