diff --git a/DivaBot/DivaBot.jar b/DivaBot/DivaBot.jar index d133c2b..dd1e67c 100644 Binary files a/DivaBot/DivaBot.jar and b/DivaBot/DivaBot.jar differ diff --git a/DivaBot/calibration_data.txt b/DivaBot/calibration_data.txt index 7848f66..c58f228 100644 --- a/DivaBot/calibration_data.txt +++ b/DivaBot/calibration_data.txt @@ -1,4 +1,4 @@ -470 -198 -1529 -791 +768 +504 +1548 +940 diff --git a/DivaBot/capture.png b/DivaBot/capture.png index d3f15d0..52c4de3 100644 Binary files a/DivaBot/capture.png and b/DivaBot/capture.png differ diff --git a/DivaBot/capture_2.png b/DivaBot/capture_2.png index bf259ac..470f93d 100644 Binary files a/DivaBot/capture_2.png and b/DivaBot/capture_2.png differ diff --git a/DivaBot/capture_3.png b/DivaBot/capture_3.png index 545ceb3..4b6cd82 100644 Binary files a/DivaBot/capture_3.png and b/DivaBot/capture_3.png differ diff --git a/DivaBot/capture_4.png b/DivaBot/capture_4.png index cd10a82..4b6cd82 100644 Binary files a/DivaBot/capture_4.png and b/DivaBot/capture_4.png differ diff --git a/DivaBot/capture_5.png b/DivaBot/capture_5.png index 384aeea..aeec6b2 100644 Binary files a/DivaBot/capture_5.png and b/DivaBot/capture_5.png differ diff --git a/DivaBot/rectangle0.png b/DivaBot/rectangle0.png index 2a9f897..a0176db 100644 Binary files a/DivaBot/rectangle0.png and b/DivaBot/rectangle0.png differ diff --git a/DivaBot/rectangle1.png b/DivaBot/rectangle1.png index 476b6b3..77b864d 100644 Binary files a/DivaBot/rectangle1.png and b/DivaBot/rectangle1.png differ diff --git a/DivaBot/rectangle2.png b/DivaBot/rectangle2.png index 93c7d88..a79ff2b 100644 Binary files a/DivaBot/rectangle2.png and b/DivaBot/rectangle2.png differ diff --git a/DivaBot/rectangle3.png b/DivaBot/rectangle3.png index 39b6f95..3f6ec67 100644 Binary files a/DivaBot/rectangle3.png and b/DivaBot/rectangle3.png differ diff --git a/DivaBot/rectangle4.png b/DivaBot/rectangle4.png index 3880c3a..8e2a303 100644 Binary files a/DivaBot/rectangle4.png and b/DivaBot/rectangle4.png differ diff --git a/DivaBot/src/sig/Calibrator.java b/DivaBot/src/sig/Calibrator.java index 6374e66..e2bb0e1 100644 --- a/DivaBot/src/sig/Calibrator.java +++ b/DivaBot/src/sig/Calibrator.java @@ -165,9 +165,9 @@ public class Calibrator{ //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); - if (!(col.getRed()>=55&&col.getRed()<=90&& - col.getGreen()>=25&&col.getGreen()<=55&& - col.getBlue()>=55&&col.getBlue()<=90)) { + if (!(col.getRed()>=40&&col.getRed()<=90&& + col.getGreen()>=10&&col.getGreen()<=55&& + col.getBlue()>=40&&col.getBlue()<=90)) { //This is the max X. Calibration on this side good. MyRobot.ENDDRAG.x--; System.out.println("End at "+MyRobot.STARTDRAG.x); @@ -196,9 +196,9 @@ public class Calibrator{ //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); - if (!(col.getRed()>=55&&col.getRed()<=90&& - col.getGreen()>=25&&col.getGreen()<=55&& - col.getBlue()>=55&&col.getBlue()<=90)) { + if (!(col.getRed()>=40&&col.getRed()<=90&& + col.getGreen()>=10&&col.getGreen()<=55&& + col.getBlue()>=40&&col.getBlue()<=90)) { //This is the max Y. Calibration on this side good. MyRobot.ENDDRAG.y--; System.out.println("End at "+MyRobot.ENDDRAG.y); @@ -290,9 +290,9 @@ public class Calibrator{ //ImageIO.write(miniImg,"png",new File("capture_3_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); - if ((col.getRed()>=55&&col.getRed()<=90&& - col.getGreen()>=25&&col.getGreen()<=55&& - col.getBlue()>=55&&col.getBlue()<=90)) { + if ((col.getRed()>=40&&col.getRed()<=90&& + col.getGreen()>=10&&col.getGreen()<=55&& + col.getBlue()>=40&&col.getBlue()<=90)) { //This is the max X. Calibration on this side good. MyRobot.ENDDRAG.y=MyRobot.ENDDRAG.y-i; MyRobot.ENDDRAG.x++; @@ -323,9 +323,9 @@ public class Calibrator{ //ImageIO.write(miniImg,"png",new File("capture_4_"+System.nanoTime()+".png")); Color col = new Color(miniImg.getRGB(0, 0)); System.out.println("Checking "+col); - if ((col.getRed()>=55&&col.getRed()<=90&& - col.getGreen()>=25&&col.getGreen()<=55&& - col.getBlue()>=55&&col.getBlue()<=90)) { + if ((col.getRed()>=40&&col.getRed()<=90&& + col.getGreen()>=10&&col.getGreen()<=55&& + col.getBlue()>=40&&col.getBlue()<=90)) { MyRobot.ENDDRAG.x=MyRobot.ENDDRAG.x-i; //This is the max Y. Calibration on this side good. System.out.println("End at "+MyRobot.ENDDRAG.y); diff --git a/DivaBot/src/sig/DrawCanvas.java b/DivaBot/src/sig/DrawCanvas.java index d3e5ae4..dc29773 100644 --- a/DivaBot/src/sig/DrawCanvas.java +++ b/DivaBot/src/sig/DrawCanvas.java @@ -91,9 +91,9 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener, public void run() { while (true) { displayTimer++; - MyRobot.p.repaint(0, 0, MyRobot.p.getWidth(),MyRobot.p.getHeight()); + MyRobot.p.repaint(); try { - Thread.sleep(10000); + Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } @@ -126,7 +126,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener, artist = obj.getString("artist");*/ if (MyRobot.p.songname!=null) { SongInfo currentSong = SongInfo.getByTitle(MyRobot.p.songname); - FileUtils.writetoFile(new String[] {MyRobot.p.songname}, "testencode.txt"); + //FileUtils.writetoFile(new String[] {MyRobot.p.songname}, "testencode.txt"); if (currentSong!=null) { if (currentSong.rating.has(difficulty)) { difficultyRating = currentSong.rating.getDouble(difficulty); @@ -134,6 +134,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener, romanizedname = currentSong.romanized_name; englishname = currentSong.english_name; artist = currentSong.artist; + MyRobot.p.repaint(); JSONObject obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/bestplay/"+MyRobot.USERNAME+"/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")+"/"+difficulty); if (obj.has("cool")) { bestPlay = new Result(MyRobot.p.songname,difficulty,obj.getInt("cool"),obj.getInt("fine"),obj.getInt("safe"),obj.getInt("sad"),obj.getInt("worst"),(float)obj.getDouble("percent")); diff --git a/DivaBot/src/sig/MyRobot.java b/DivaBot/src/sig/MyRobot.java index 8af8213..8a85dea 100644 --- a/DivaBot/src/sig/MyRobot.java +++ b/DivaBot/src/sig/MyRobot.java @@ -129,7 +129,7 @@ public class MyRobot{ static Point STARTDRAG = null; static Point ENDDRAG = null; - int lastcool,lastfine,lastsafe,lastsad,lastworst,lastcombo,lastscore; + int lastcool=-1,lastfine=-1,lastsafe=-1,lastsad=-1,lastworst=-1,lastcombo=-1,lastscore=-1; float lastpercent; boolean lastfail; long lastSongSelectTime = System.currentTimeMillis(); @@ -294,7 +294,7 @@ public class MyRobot{ if (checkSongSelect()) { if (!overlayHidden) { overlayHidden=true; - p.repaint(0, 0, 1400, 1000); + MyRobot.p.repaint(); } GetCurrentSong(); GetCurrentDifficulty(); @@ -318,7 +318,7 @@ public class MyRobot{ } else { if (overlayHidden) { overlayHidden=false; - p.repaint(0, 0, 1400, 1000); + MyRobot.p.repaint(); } if ((selectedSong!=null && difficulty!=null)) { if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) { @@ -480,8 +480,8 @@ public class MyRobot{ Color c2 = new Color(MYROBOT.createScreenCapture(new Rectangle(31,196,40,40)).getRGB(0, 0)); Color c3 = new Color(MYROBOT.createScreenCapture(new Rectangle(483,256,40,40)).getRGB(0, 0)); //System.out.println(c1+"/"+c2+"/"+c3); - return c1.getRed()>=254 && c1.getGreen()>=254 && c1.getBlue()>=254 && c2.getRed()==16 && c2.getGreen()==222 && c2.getBlue()==202 && - c3.getRed()>=219 && c3.getRed()<=255 && c3.getGreen()>=213 && c3.getGreen()<=255 && c3.getBlue()>=160 && c3.getBlue()<=220; + return c1.getRed()>=250 && c1.getGreen()>=250 && c1.getBlue()>=250 && c2.getRed()>=10 && c2.getRed()<=25 && c2.getGreen()>=200 && c2.getGreen()<=240 && c2.getBlue()>=180 && c2.getBlue()<=220 && + c3.getRed()>=200 && c3.getRed()<=255 && c3.getGreen()>=200 && c3.getGreen()<=255 && c3.getBlue()>=140 && c3.getBlue()<=220; } private void GetCurrentDifficulty() { @@ -744,6 +744,7 @@ public class MyRobot{ RunTest("test29.png",354,112,4,3,43,67.73f,"EXEX","HS",55,331060,true); RunTest("test30.png",390,90,8,9,22,74.95f,"N","HS",82,326560,false); RunTest("test31.png",329,69,8,1,34,72.15f,"EX","HS",40,358760,false); + RunTest("test32.png",0,1,1,0,57,0.57f,"EX","HS",1,1890,true); RunTest("testimage.png",371,40,3,4,3,97.63f,"EX","HS",233,523750,false); RunTest("testimage2.png",942,71,1,0,3,97.02f,"EXEX","",714,951020,false); RunTest("testimage3.png",546,52,0,0,0,101.77f,"EX","",598,567430,false); @@ -842,14 +843,14 @@ public class MyRobot{ public static boolean checkSongSelect() throws IOException { Color c = new Color(MYROBOT.createScreenCapture(new Rectangle(845,638,1,1)).getRGB(0, 0)); - onSongSelect = (c.getRed()>=30 && c.getRed()<=45 && c.getGreen()>=85 && c.getGreen()<=90 && c.getBlue()>=205 && c.getBlue()<=230); + onSongSelect = (c.getRed()>=15 && c.getRed()<=45 && c.getGreen()>=75 && c.getGreen()<=90 && c.getBlue()>=200 && c.getBlue()<=230); if (onSongSelect) { FUTURETONE=false; } else { c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0)); - if (!onSongSelect&&(c.getRed()>=165&&c.getRed()<=185&&c.getGreen()<=10&&c.getBlue()>=185&&c.getBlue()<=200)) { + if (!onSongSelect&&(c.getRed()>=160&&c.getRed()<=185&&c.getGreen()<=15&&c.getBlue()>=170&&c.getBlue()<=200)) { FUTURETONE=true; onSongSelect=true; } diff --git a/DivaBot/typeface2.png b/DivaBot/typeface2.png index 8f9561d..912540d 100644 Binary files a/DivaBot/typeface2.png and b/DivaBot/typeface2.png differ