diff --git a/DivaBot/DivaBot.jar b/DivaBot/DivaBot.jar index 289fc09..0673004 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 94b7b1f..7e169a3 100644 --- a/DivaBot/calibration_data.txt +++ b/DivaBot/calibration_data.txt @@ -1,4 +1,4 @@ -533 -170 -1459 -693 +643 +365 +1491 +844 diff --git a/DivaBot/capture_1.png b/DivaBot/capture_1.png new file mode 100644 index 0000000..cfe68ab Binary files /dev/null and b/DivaBot/capture_1.png differ diff --git a/DivaBot/capture_2.png b/DivaBot/capture_2.png index 63869d4..ac5672b 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 61dd9cc..8ecbd95 100644 Binary files a/DivaBot/capture_3.png and b/DivaBot/capture_3.png differ diff --git a/DivaBot/changemonitor.png b/DivaBot/changemonitor.png new file mode 100644 index 0000000..f912732 Binary files /dev/null and b/DivaBot/changemonitor.png differ diff --git a/DivaBot/rectangle0.png b/DivaBot/rectangle0.png index d366e1e..c0f3d35 100644 Binary files a/DivaBot/rectangle0.png and b/DivaBot/rectangle0.png differ diff --git a/DivaBot/rectangle1.png b/DivaBot/rectangle1.png index efebd6b..e4aa383 100644 Binary files a/DivaBot/rectangle1.png and b/DivaBot/rectangle1.png differ diff --git a/DivaBot/rectangle2.png b/DivaBot/rectangle2.png index 866079e..414dab9 100644 Binary files a/DivaBot/rectangle2.png and b/DivaBot/rectangle2.png differ diff --git a/DivaBot/rectangle3.png b/DivaBot/rectangle3.png index b3e25a9..bc874c8 100644 Binary files a/DivaBot/rectangle3.png and b/DivaBot/rectangle3.png differ diff --git a/DivaBot/rectangle4.png b/DivaBot/rectangle4.png index 8958d01..1c5d014 100644 Binary files a/DivaBot/rectangle4.png and b/DivaBot/rectangle4.png differ diff --git a/DivaBot/src/sig/ColorRegion.java b/DivaBot/src/sig/ColorRegion.java new file mode 100644 index 0000000..6a2aa47 --- /dev/null +++ b/DivaBot/src/sig/ColorRegion.java @@ -0,0 +1,72 @@ +package sig; + +import java.awt.Color; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; + +public class ColorRegion { + Rectangle region; + BufferedImage img; + + ColorRegion(BufferedImage img, Rectangle region) { + this.region=region; + this.img=img; + } + + public boolean getRedRange(int min,int max) { + int avgRed = getRed(); + return avgRed>=min&&avgRed<=max; + } + public boolean getGreenRange(int min,int max) { + int avgGreen = getGreen(); + return avgGreen>=min&&avgGreen<=max; + } + public boolean getBlueRange(int min,int max) { + int avgBlue = getBlue(); + return avgBlue>=min&&avgBlue<=max; + } + + public boolean getAllRange(int min,int max) { + return getRedRange(min,max)&&getGreenRange(min,max)&&getBlueRange(min,max); + } + public boolean getAllRange(int minRed,int maxRed,int minGreen,int maxGreen,int minBlue,int maxBlue) { + return getRedRange(minRed,maxRed)&&getGreenRange(minGreen,maxGreen)&&getBlueRange(minBlue,maxBlue); + } + + public int getRed() { + int total = 0; + for (int x=0;x0) { if (args[0].equalsIgnoreCase("calibrate")) { + File f = new File("screenConfig.txt"); + if (f.exists()) { + String[] data= FileUtils.readFromFile("screenConfig.txt"); + try { + screen=Integer.parseInt(data[0]); + } catch (Exception e) { + System.err.println("Could not read from screenConfig.txt. It's invalid data, consider deleting the file and run the program again."); + } + } CALIBRATION_MODE=true; } if (args[0].equalsIgnoreCase("debug")) { @@ -535,8 +545,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()>=250 && c1.getGreen()>=250 && c1.getBlue()>=250 && c2.getRed()>=7 && c2.getRed()<=30 && c2.getGreen()>=200 && c2.getGreen()<=240 && c2.getBlue()>=180 && c2.getBlue()<=220 && - c3.getRed()>=160 && c3.getRed()<=255 && c3.getGreen()>=160 && c3.getGreen()<=255 && c3.getBlue()>=130 && c3.getBlue()<=220; + return c1.getRed()>=240 && c1.getGreen()>=240 && c1.getBlue()>=240 && c2.getRed()>=7 && c2.getRed()<=60 && c2.getGreen()>=180 && c2.getGreen()<=250 && c2.getBlue()>=150 && c2.getBlue()<=240 && + c3.getRed()>=140 && c3.getRed()<=255 && c3.getGreen()>=140 && c3.getGreen()<=255 && c3.getBlue()>=110 && c3.getBlue()<=240; } else { BufferedImage img2 = ImageUtils.toBufferedImage(MYROBOT.currentScreen.getScaledInstance(1280 , 720, Image.SCALE_SMOOTH)); Color ft_pixel1 = new Color(img2.getRGB(260, 38)); @@ -772,6 +782,7 @@ public class MyRobot{ selectedSong=new SongData("LIKE THE WIND",0,0,0); difficulty="H"; + RunTest("test56.png",405,105,17,8,41,63.72f,"EX","",109,453145,false,Mode.FUTURETONE); RunTest("test55.png",421,50,1,0,3,98.37f,"EXEX","",406,689821,false,Mode.FUTURETONE); RunTest("test54.png",448,129,20,6,35,74.89f,"EXEX","",247,678260,true,Mode.FUTURETONE); RunTest("test53.png",456,163,31,7,47,75.89f,"EXEX","",105,736989,false,Mode.FUTURETONE); @@ -935,8 +946,8 @@ 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()>=15 && c.getRed()<=45 && c.getGreen()>=75 && c.getGreen()<=90 && c.getBlue()>=200 && c.getBlue()<=230); + ColorRegion cr = new ColorRegion(MYROBOT.createScreenCapture(),new Rectangle(842,635,5,5)); + onSongSelect = cr.getAllRange(15,45,75,90,200,230); if (onSongSelect) { stillOnSongSelect++; @@ -948,8 +959,8 @@ public class MyRobot{ } } else { - c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0)); - if (!onSongSelect&&(c.getRed()>=160&&c.getRed()<=200&&c.getGreen()<=15&&c.getBlue()>=170&&c.getBlue()<=200)) { + cr = new ColorRegion(MYROBOT.createScreenCapture(),new Rectangle(741,171,5,5)); + if (!onSongSelect&&cr.getAllRange(160,200,0,15,170,200)) { stillOnSongSelect++; FUTURETONE=true; onSongSelect=true; diff --git a/DivaBot/src/sig/Overlay.java b/DivaBot/src/sig/Overlay.java index f0a4923..c5cee6c 100644 --- a/DivaBot/src/sig/Overlay.java +++ b/DivaBot/src/sig/Overlay.java @@ -8,6 +8,7 @@ import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; +import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -23,11 +24,13 @@ public class Overlay extends JPanel implements MouseMotionListener,MouseListener public static boolean started=false; BufferedImage setupWindowButton; BufferedImage finishButton; + BufferedImage changeMonitorButton; Font drawFont = new Font("Verdana",Font.PLAIN,32); Overlay() throws IOException { setupWindowButton = ImageIO.read(new File("setupwindow.png")); finishButton = ImageIO.read(new File("finish.png")); + changeMonitorButton = ImageIO.read(new File("changemonitor.png")); Thread t = new Thread() { public void run() { while (true) { @@ -95,6 +98,7 @@ public class Overlay extends JPanel implements MouseMotionListener,MouseListener } else { g.drawImage(setupWindowButton,MyRobot.screenSize.width-setupWindowButton.getWidth()+1,0,this); + //g.drawImage(changeMonitorButton,MyRobot.screenSize.width-changeMonitorButton.getWidth()+1,setupWindowButton.getHeight(),this); } } diff --git a/Release/DivaBot04B.zip b/Release/DivaBot04B.zip new file mode 100644 index 0000000..14aa0be Binary files /dev/null and b/Release/DivaBot04B.zip differ