diff --git a/d4dj_rankTracker.jar b/d4dj_rankTracker.jar index 7742e6b..4a200b9 100644 Binary files a/d4dj_rankTracker.jar and b/d4dj_rankTracker.jar differ diff --git a/src/main/java/d4dj/d4dj/App.java b/src/main/java/d4dj/d4dj/App.java index c513661..f4d2781 100644 --- a/src/main/java/d4dj/d4dj/App.java +++ b/src/main/java/d4dj/d4dj/App.java @@ -1,6 +1,7 @@ package d4dj.d4dj; import java.awt.Color; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; @@ -92,7 +93,8 @@ class SubmitThread implements Runnable{ try (InputStream instream = entity.getContent()) { Scanner s = new Scanner(instream).useDelimiter("\\A"); String result = s.hasNext() ? s.next() : ""; - System.out.println("Rank "+rank+": "+result+"("+points+")"); + //System.out.println("Rank "+rank+": "+result+"("+points+")"); + System.out.println(rank+": "+name+" ("+description+") - "+points); instream.close(); } catch (UnsupportedOperationException | IOException e) { e.printStackTrace(); @@ -106,6 +108,11 @@ public class App final static int EVENT = 14; public static int[] lastScores = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; public static int[] lastLowerTierScores = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + public static Font myFont = new Font("Courier", Font.BOLD, 26); + public static int[] ranks = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + 50,100,500,1000,2000,5000,10000,20000,30000,50000}; + public static int[] drawRanks = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + 50,100,500,1000,2000,5000,10000,20000,30000,100,500,1000,2000,5000,10000,20000,30000,50000}; public static void main( String[] args ) throws IOException { @@ -173,12 +180,11 @@ public class App Graphics2D g = cropped1.createGraphics(); //For comments: down by 40, width is 340. for (int i=0;i220,G>220,B>220 @@ -217,25 +223,30 @@ public class App int YOFFSET = YMarker+1; for (int i=0;i descriptions = new ArrayList(); List names = new ArrayList(); List scores = new ArrayList(); - int[] ranks = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 50,100,500,1000,2000,5000,10000,20000,30000,50000}; - String[] s = reader.toString().split("\n"); String[] data = new String[s.length]; int count=0; + int rankIndex=0; boolean scoreNext=false; - for (String ss : s) { - //System.out.println(ss.replaceFirst("A","").trim()); - //String newString = ss;//.replaceFirst("A","").trim(); - switch ((count++)%3) { - case 2:{ - AddScore(scores, ranks, ss); - - }break; - case 0:{ - if (ss.equalsIgnoreCase("A")||ss.equalsIgnoreCase("Α")) { - count--; - } else { - if (StringUtils.isNumeric(ss)) { - descriptions.add("?"); - names.add("?"); - //scores.add(Integer.parseInt(ss)); - AddScore(scores,ranks,ss); - count=0; - } else { - names.add(ss); - } + String[] orderedRanks= new String[] { + "00001","00002","00003","00004","00005","00006","00007","00008","00009","00010", + "00011","00012","00013","00014","00015","00016","00017","00018","00019","00020", + "00050","00100","00500","01000","02000","05000","10000","20000","30000","50000" + }; + List collection = new ArrayList(); + while (count mydata = new ArrayList(); + count++; + mydata.add(orderedRanks[rankIndex]); + while (count4) { + int marker=1; + boolean foundName=false; + boolean foundDesc=false; + boolean foundPoints=false; + String name = ""; + String desc = ""; + int points = 0; + boolean submitted=false; + while (marker0) { + foundName=true; + name = mydata.get(marker); + } else + if (!foundDesc&&mydata.get(marker).length()>0) { + foundDesc=true; + desc = mydata.get(marker); + } else + if (!foundPoints&&StringUtils.isNumeric(mydata.get(marker))&&mydata.get(marker).length()>0) { + foundPoints=true; + points = Integer.parseInt(mydata.get(marker)); } + marker++; } - }break; - } - } + if (foundName&&foundDesc&&foundPoints) { + new Thread( + new SubmitThread(name,desc,points,EVENT,Integer.parseInt(mydata.get(0)))) + .start(); + submitted=true; + } else + { + System.out.println("Could not make a template from this: "+mydata); + System.out.println("Name:"+foundName+"-"+name+", Description:"+foundDesc+"-"+desc+", Points:"+foundPoints+"-"+points); + } + } else { + System.out.println("Could not find a suitable format for:"+mydata); + } + rankIndex++; + } else { + count++; + } + } + for (int i=0;ii)?(descriptions.get(i).charAt(0)=='A'||descriptions.get(i).charAt(0)=='Α')?descriptions.get(i).substring(1):descriptions.get(i):""; @@ -395,9 +450,9 @@ public class App } if (i==0||(scores.get(i-1)>scores.get(i))) { - new Thread( + /* new Thread( new SubmitThread(name,desc,scores.get(i),EVENT,ranks[i])) - .start(); + .start();*/ } } /*System.out.println(scores); diff --git a/target/classes/d4dj/d4dj/App.class b/target/classes/d4dj/d4dj/App.class index db85ee1..38fbb10 100644 Binary files a/target/classes/d4dj/d4dj/App.class and b/target/classes/d4dj/d4dj/App.class differ diff --git a/target/classes/d4dj/d4dj/SubmitThread.class b/target/classes/d4dj/d4dj/SubmitThread.class index 867ed40..dc8da08 100644 Binary files a/target/classes/d4dj/d4dj/SubmitThread.class and b/target/classes/d4dj/d4dj/SubmitThread.class differ diff --git a/testing_leaderboardnames.png b/testing_leaderboardnames.png new file mode 100644 index 0000000..83f6c0f Binary files /dev/null and b/testing_leaderboardnames.png differ