Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LearnsetConverterTest {
- public static void main(String[] args) {
- String input = "";
- // You can run this code to turn valid spreadsheet data into a learnset!
- // (learnset is a lua dictionary where keys are mon names and values are movepools
- // movepools are lua arrays where items are arrays containing a string (movename) and number (level))
- // Paste the data into the google search bar (to make it all one line), then put it in the "" above.
- // Below is an example input if you just wanna try it out.
- // String input = "Bulbasaur $ Ivysaur Double-Edge 20 $ Venusaur Double-Edge 32 $ Charmander $ Charmeleon FireFang 16 $ Charizard FirePunch 40 FocusBlast 60 $ Wartortle Bubblebeam 20 $ Blastoise Bubblebeam 36 $ Beedrill Agility 12 X-Scissor 36 $ Mega Beedrill HyperBeam 2 $";
- String toPrintEventually = "local learnsets = {\n\t";
- int i=0, j=0;
- while(i<input.length()){
- // Index the name
- while(input.charAt(i)!='\t') i++;
- // toPrintEventually += "[\""+input.substring(j, i)+"\"] = {";
- toPrintEventually += input.substring(j, i)+" = {";
- while(input.charAt(i)=='\t') i++;
- j=i;
- // Index the moves
- while(input.charAt(i)!='$'){
- while(input.charAt(i)!='\t' && input.charAt(i)!='$') i++;
- if(input.charAt(i)=='\t'){
- toPrintEventually += "\n\t\t{\""+input.substring(j, i)+"\", ";
- while(input.charAt(i)=='\t') i++;
- j=i;
- while(input.charAt(i)!='\t') i++;
- toPrintEventually += input.substring(j, i)+"},";
- while(input.charAt(i)=='\t') i++;
- j=i;
- }
- }
- toPrintEventually = toPrintEventually.substring(0, toPrintEventually.length())+"\n\t},\n\t";
- j=i=i+2;
- }
- toPrintEventually += "}";
- System.out.println(toPrintEventually);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement