diff --git a/DivaBot/rectangle0.png b/DivaBot/rectangle0.png index ce7972b..130d826 100644 Binary files a/DivaBot/rectangle0.png and b/DivaBot/rectangle0.png differ diff --git a/DivaBot/rectangle1.png b/DivaBot/rectangle1.png index 7c832fb..c506cde 100644 Binary files a/DivaBot/rectangle1.png and b/DivaBot/rectangle1.png differ diff --git a/DivaBot/rectangle2.png b/DivaBot/rectangle2.png index a3d64f1..5c3263b 100644 Binary files a/DivaBot/rectangle2.png and b/DivaBot/rectangle2.png differ diff --git a/DivaBot/rectangle3.png b/DivaBot/rectangle3.png index 100cfc5..188ab97 100644 Binary files a/DivaBot/rectangle3.png and b/DivaBot/rectangle3.png differ diff --git a/DivaBot/rectangle4.png b/DivaBot/rectangle4.png index 1ed3276..e6164df 100644 Binary files a/DivaBot/rectangle4.png and b/DivaBot/rectangle4.png differ diff --git a/DivaBot/src/sig/Calibrator2.java b/DivaBot/src/sig/Calibrator2.java index b82a437..a0753c3 100644 --- a/DivaBot/src/sig/Calibrator2.java +++ b/DivaBot/src/sig/Calibrator2.java @@ -104,8 +104,8 @@ public class Calibrator2 { Overlay.OVERLAY.setVisible(true); MyRobot.CALIBRATIONSTATUS="Calibration is complete! - X"+(MyRobot.STARTDRAG.x)+" Y"+(MyRobot.STARTDRAG.y)+" W"+(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)+" H"+(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y)+" R"+((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y)); - if (((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y))<=16/9f-0.04|| - ((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y))>=16/9f+0.04) { + if (((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y))<=16/9f-0.015|| + ((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y))>=16/9f+0.015) { int dialogResult = JOptionPane.showConfirmDialog (null, "Could not detect the game properly!\n\nYour calibration cut a bit "+((((float)(MyRobot.ENDDRAG.x-MyRobot.STARTDRAG.x)/(MyRobot.ENDDRAG.y-MyRobot.STARTDRAG.y))<=16/9f-0.04)?"more":"less")+" than expected. Do you want to try selecting a more accurate region?","Warning",JOptionPane.YES_NO_OPTION); if(dialogResult == JOptionPane.YES_OPTION){ MyRobot.STARTDRAG=null; diff --git a/DivaBot/src/sig/CustomRobot.java b/DivaBot/src/sig/CustomRobot.java index 6cd806a..0419fa7 100644 --- a/DivaBot/src/sig/CustomRobot.java +++ b/DivaBot/src/sig/CustomRobot.java @@ -57,6 +57,7 @@ public class CustomRobot extends Robot{ calibration_data[1]=Integer.parseInt(data[1]); calibration_data[2]=Integer.parseInt(data[2]); calibration_data[3]=Integer.parseInt(data[3]); + TypeFace2.deepCopyDefaultOfficialYPointers(); } private boolean CalibrationDataChanged() { diff --git a/DivaBot/src/sig/MyRobot.java b/DivaBot/src/sig/MyRobot.java index 536563c..cd96ef6 100644 --- a/DivaBot/src/sig/MyRobot.java +++ b/DivaBot/src/sig/MyRobot.java @@ -309,122 +309,32 @@ public class MyRobot{ private void RunMainLoop() { try { - if (CALIBRATION_MODE) { - if (MyRobot.calibrating) { - MyRobot.calibrating=false; - Overlay.OVERLAY.setVisible(false); - Thread.sleep(1000); - Calibrator2 c = new Calibrator2(); - } - } else { - //ImageIO.write(MYROBOT.createScreenCapture(),"png",new File("testscreen.png")); - if (checkSongSelect()) { - //System.out.println("On song select"); - if (!overlayHidden) { - overlayHidden=true; - MyRobot.p.repaint(); - } - GetCurrentSong(); - GetCurrentDifficulty(); - recordedResults=false; - if (selectedSong!=null && difficulty!=null) { - if (!prevSongTitle.equalsIgnoreCase(selectedSong.title) || !prevDifficulty.equalsIgnoreCase(difficulty)) { - System.out.println("On Song Select Screen: Current Song-"+selectedSong.title+" Diff:"+difficulty); - p.pullData(selectedSong.title,difficulty); - MyRobot.p.refreshAllLabels(); - prevSongTitle=selectedSong.title; - prevDifficulty=difficulty; - MyRobot.p.repaint(); - if (NEWSONGS.length==0) { - MYROBOT.keyPress(KeyEvent.VK_CONTROL); - MYROBOT.keyPress(KeyEvent.VK_SHIFT); - MYROBOT.keyPress(KeyEvent.VK_F11); - MYROBOT.keyRelease(KeyEvent.VK_F11); - MYROBOT.keyRelease(KeyEvent.VK_SHIFT); - MYROBOT.keyRelease(KeyEvent.VK_CONTROL); - } + if (CALIBRATION_MODE) { + if (MyRobot.calibrating) { + MyRobot.calibrating=false; + Overlay.OVERLAY.setVisible(false); + Thread.sleep(1000); + Calibrator2 c = new Calibrator2(); } - } - lastSongSelectTime = System.currentTimeMillis(); - } else { - MYROBOT.refreshScoreScreen(); - ImageIO.write(MYROBOT.createScoreScreenCapture(),"png",new File("scoreimage.png")); - if (overlayHidden) { - overlayHidden=false; - MyRobot.p.repaint(); - } - if ((selectedSong!=null && difficulty!=null)) { - if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) { - lastSongSelectTime=System.currentTimeMillis(); - MYROBOT.setAutoDelay(0); - if (NEWSONGS.length==0) { - MYROBOT.keyPress(KeyEvent.VK_CONTROL); - MYROBOT.keyPress(KeyEvent.VK_SHIFT); - MYROBOT.keyPress(KeyEvent.VK_F12); - MYROBOT.keyRelease(KeyEvent.VK_F12); - MYROBOT.keyRelease(KeyEvent.VK_SHIFT); - MYROBOT.keyRelease(KeyEvent.VK_CONTROL); - } - MYROBOT.refreshScoreScreen(); - ImageIO.write(MYROBOT.createScoreScreenCapture(),"png",new File("scoreimage.png")); - File tmp = new File("tmp"); - if (tmp.exists()) { - FileUtils.deleteFile(tmp); - } else { - tmp.mkdir(); + } else { + //ImageIO.write(MYROBOT.createScreenCapture(),"png",new File("testscreen.png")); + if (checkSongSelect()) { + //System.out.println("On song select"); + if (!overlayHidden) { + overlayHidden=true; + MyRobot.p.repaint(); } - try { - final Result data = typeface1.getAllData(MYROBOT.createScoreScreenCapture()); - //ImageIO.write(MYROBOT.,"png",new File("test.png")); - if (data.cool==-1 || data.fine==-1 || data.safe==-1 || data.sad==-1 || data.worst==-1 || data.percent<0f || data.percent>110f || data.combo==-1 || data.score==-1) { - if (lastData==null || (lastData.cool!=data.cool || data.fine!=lastData.fine || data.safe!=lastData.safe || data.sad!=lastData.sad || data.worst!=lastData.worst || data.percent!=lastData.percent || data.combo!=lastData.combo || data.score!=lastData.score)) { - System.out.println("Waiting for results to populate..."); - System.out.println(data); - } - if (lastData==null) { - lastData=new Result("","",-1,-1,-1,-1,-1,-1f); - } - lastData.cool=data.cool; - lastData.fine=data.fine; - lastData.safe=data.safe; - lastData.sad=data.sad; - lastData.worst=data.worst; - lastData.percent=data.percent; - lastData.combo=data.combo; - lastData.score=data.score; - } else - if ((data.combo!=lastcombo || data.fail!=lastfail || data.cool!=lastcool || lastfine!=data.fine || lastsafe!=data.safe || lastsad!=data.sad || lastworst!=data.worst) - && data.score!=lastscore /*|| lastpercent!=percent*/){ - //System.out.println("Results for "+selectedSong.title+" "+difficulty+": "+data.cool+"/"+data.fine+"/"+data.safe+"/"+data.sad+"/"+data.worst+" "+data.percent+"%"); - - System.out.println("Results for "+selectedSong.title+" "+data.difficulty+": "+data.display()); - File songFolder = new File(selectedSong.title+"/"+data.difficulty); - if (!songFolder.exists()) { - songFolder.mkdirs(); - } - File[] songFolderFiles = songFolder.listFiles(); - int playId = songFolderFiles.length; - final File playFolder = new File(selectedSong.title+"/"+data.difficulty+"/"+playId); - playFolder.mkdir(); - recordedResults=true; - lastcool=data.cool; - lastfine=data.fine; - lastsafe=data.safe; - lastsad=data.sad; - lastworst=data.worst; - lastpercent=data.percent; - lastcombo=data.combo; - lastscore=data.score; - lastfail=data.fail; - File resultImage=new File(playFolder,selectedSong.title+"_"+data.difficulty+"play_"+data.cool+"_"+data.fine+"_"+data.safe+"_"+data.sad+"_"+data.worst+"_"+data.percent+"" - + "_"+data.combo+"_"+data.score+".png"); - new File("scoreimage.png").renameTo(resultImage); - results.add(new Result(selectedSong.title,data.difficulty,data.cool,data.fine,data.safe,data.sad,data.worst,data.percent,data.mod,data.combo,data.score,data.fail,resultImage)); - SoundUtils.playSound("collect_item.wav"); - - //gotoxy(800,64); - //click(); - MYROBOT.setAutoDelay(0); + GetCurrentSong(); + GetCurrentDifficulty(); + recordedResults=false; + if (selectedSong!=null && difficulty!=null) { + if (!prevSongTitle.equalsIgnoreCase(selectedSong.title) || !prevDifficulty.equalsIgnoreCase(difficulty)) { + System.out.println("On Song Select Screen: Current Song-"+selectedSong.title+" Diff:"+difficulty); + p.pullData(selectedSong.title,difficulty); + MyRobot.p.refreshAllLabels(); + prevSongTitle=selectedSong.title; + prevDifficulty=difficulty; + MyRobot.p.repaint(); if (NEWSONGS.length==0) { MYROBOT.keyPress(KeyEvent.VK_CONTROL); MYROBOT.keyPress(KeyEvent.VK_SHIFT); @@ -434,105 +344,191 @@ public class MyRobot{ MYROBOT.keyRelease(KeyEvent.VK_CONTROL); } } - } catch (IOException|NumberFormatException|IndexOutOfBoundsException e) { - e.printStackTrace(); - System.out.println(e.getMessage()); } + lastSongSelectTime = System.currentTimeMillis(); } else { - if (results.size()>0) { - recordingResults=true; - for (final Result r : results) { - r.songName=r.songName.equalsIgnoreCase("恋ノート")?"恋ノート////":r.songName.equalsIgnoreCase("雨のちSweetDrops")?"雨のちSweet*Drops":r.songName.equalsIgnoreCase("Equation+")?"Equation+**":r.songName.equalsIgnoreCase("PIANOGIRL")?"PIANO*GIRL":(r.songName.equalsIgnoreCase("16 -out of the gravity-"))?"1/6 -out of the gravity-":r.songName; - HttpClient httpclient = HttpClients.createDefault(); - HttpPost httppost = new HttpPost("http://45.33.13.215:4501/submit"); - - // Request parameters and other properties. - List params = new ArrayList(); - params.add(new BasicNameValuePair("song", r.songName)); - params.add(new BasicNameValuePair("username", USERNAME)); - params.add(new BasicNameValuePair("authentication_token", AUTHTOKEN)); - params.add(new BasicNameValuePair("difficulty", r.difficulty)); - params.add(new BasicNameValuePair("cool", Integer.toString(r.cool))); - params.add(new BasicNameValuePair("fine", Integer.toString(r.fine))); - params.add(new BasicNameValuePair("safe", Integer.toString(r.safe))); - params.add(new BasicNameValuePair("sad", Integer.toString(r.sad))); - params.add(new BasicNameValuePair("worst", Integer.toString(r.worst))); - params.add(new BasicNameValuePair("percent", Float.toString(r.percent))); - params.add(new BasicNameValuePair("fail", Boolean.toString(r.fail))); - params.add(new BasicNameValuePair("mod", r.mod)); - params.add(new BasicNameValuePair("combo", Integer.toString(r.combo))); - params.add(new BasicNameValuePair("gameScore", Integer.toString(r.score))); - try { - httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + if (overlayHidden) { + overlayHidden=false; + MyRobot.p.repaint(); + } + if ((selectedSong!=null && difficulty!=null)) { + if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) { + lastSongSelectTime=System.currentTimeMillis(); + MYROBOT.setAutoDelay(0); + if (NEWSONGS.length==0) { + MYROBOT.keyPress(KeyEvent.VK_CONTROL); + MYROBOT.keyPress(KeyEvent.VK_SHIFT); + MYROBOT.keyPress(KeyEvent.VK_F12); + MYROBOT.keyRelease(KeyEvent.VK_F12); + MYROBOT.keyRelease(KeyEvent.VK_SHIFT); + MYROBOT.keyRelease(KeyEvent.VK_CONTROL); + } + MYROBOT.refreshScoreScreen(); + ImageIO.write(MYROBOT.createScoreScreenCapture(),"png",new File("scoreimage.png")); + File tmp = new File("tmp"); + if (tmp.exists()) { + FileUtils.deleteFile(tmp); + } else { + tmp.mkdir(); } - - //Execute and get the response. - HttpResponse response = null; try { - response = httpclient.execute(httppost); - } catch (IOException e) { + final Result data = typeface1.getAllData(MYROBOT.createScoreScreenCapture()); + if (data.cool==-1 || data.fine==-1 || data.safe==-1 || data.sad==-1 || data.worst==-1 || data.percent<0f || data.percent>110f || data.combo==-1 || data.score==-1) { + if (lastData==null || (lastData.cool!=data.cool || data.fine!=lastData.fine || data.safe!=lastData.safe || data.sad!=lastData.sad || data.worst!=lastData.worst || data.percent!=lastData.percent || data.combo!=lastData.combo || data.score!=lastData.score)) { + System.out.println("Waiting for results to populate..."); + System.out.println(data); + } + if (lastData==null) { + lastData=new Result("","",-1,-1,-1,-1,-1,-1f); + } + lastData.cool=data.cool; + lastData.fine=data.fine; + lastData.safe=data.safe; + lastData.sad=data.sad; + lastData.worst=data.worst; + lastData.percent=data.percent; + lastData.combo=data.combo; + lastData.score=data.score; + } else + if ((data.combo!=lastcombo || data.fail!=lastfail || data.cool!=lastcool || lastfine!=data.fine || lastsafe!=data.safe || lastsad!=data.sad || lastworst!=data.worst) + && data.score!=lastscore /*|| lastpercent!=percent*/){ + System.out.println("Results for "+selectedSong.title+" "+data.difficulty+": "+data.display()); + TypeFace2.deepCopyOfficialYPointersFromPointers(); + File songFolder = new File(selectedSong.title+"/"+data.difficulty); + if (!songFolder.exists()) { + songFolder.mkdirs(); + } + File[] songFolderFiles = songFolder.listFiles(); + int playId = songFolderFiles.length; + final File playFolder = new File(selectedSong.title+"/"+data.difficulty+"/"+playId); + playFolder.mkdir(); + recordedResults=true; + lastcool=data.cool; + lastfine=data.fine; + lastsafe=data.safe; + lastsad=data.sad; + lastworst=data.worst; + lastpercent=data.percent; + lastcombo=data.combo; + lastscore=data.score; + lastfail=data.fail; + File resultImage=new File(playFolder,selectedSong.title+"_"+data.difficulty+"play_"+data.cool+"_"+data.fine+"_"+data.safe+"_"+data.sad+"_"+data.worst+"_"+data.percent+"" + + "_"+data.combo+"_"+data.score+".png"); + new File("scoreimage.png").renameTo(resultImage); + results.add(new Result(selectedSong.title,data.difficulty,data.cool,data.fine,data.safe,data.sad,data.worst,data.percent,data.mod,data.combo,data.score,data.fail,resultImage)); + SoundUtils.playSound("collect_item.wav"); + + //gotoxy(800,64); + //click(); + MYROBOT.setAutoDelay(0); + if (NEWSONGS.length==0) { + MYROBOT.keyPress(KeyEvent.VK_CONTROL); + MYROBOT.keyPress(KeyEvent.VK_SHIFT); + MYROBOT.keyPress(KeyEvent.VK_F11); + MYROBOT.keyRelease(KeyEvent.VK_F11); + MYROBOT.keyRelease(KeyEvent.VK_SHIFT); + MYROBOT.keyRelease(KeyEvent.VK_CONTROL); + } + } + } catch (IOException|NumberFormatException|IndexOutOfBoundsException e) { e.printStackTrace(); + System.out.println(e.getMessage()); } - HttpEntity entity = response.getEntity(); - - JSONObject report = null; - - if (entity != null) { - try (InputStream instream = entity.getContent()) { - Scanner s = new Scanner(instream).useDelimiter("\\A"); - String result = s.hasNext() ? s.next() : ""; - report=new JSONObject(result); - instream.close(); - } catch (UnsupportedOperationException | IOException e) { + } else { + if (results.size()>0) { + recordingResults=true; + for (final Result r : results) { + r.songName=r.songName.equalsIgnoreCase("恋ノート")?"恋ノート////":r.songName.equalsIgnoreCase("雨のちSweetDrops")?"雨のちSweet*Drops":r.songName.equalsIgnoreCase("Equation+")?"Equation+**":r.songName.equalsIgnoreCase("PIANOGIRL")?"PIANO*GIRL":(r.songName.equalsIgnoreCase("16 -out of the gravity-"))?"1/6 -out of the gravity-":r.songName; + HttpClient httpclient = HttpClients.createDefault(); + HttpPost httppost = new HttpPost("http://45.33.13.215:4501/submit"); + + // Request parameters and other properties. + List params = new ArrayList(); + params.add(new BasicNameValuePair("song", r.songName)); + params.add(new BasicNameValuePair("username", USERNAME)); + params.add(new BasicNameValuePair("authentication_token", AUTHTOKEN)); + params.add(new BasicNameValuePair("difficulty", r.difficulty)); + params.add(new BasicNameValuePair("cool", Integer.toString(r.cool))); + params.add(new BasicNameValuePair("fine", Integer.toString(r.fine))); + params.add(new BasicNameValuePair("safe", Integer.toString(r.safe))); + params.add(new BasicNameValuePair("sad", Integer.toString(r.sad))); + params.add(new BasicNameValuePair("worst", Integer.toString(r.worst))); + params.add(new BasicNameValuePair("percent", Float.toString(r.percent))); + params.add(new BasicNameValuePair("fail", Boolean.toString(r.fail))); + params.add(new BasicNameValuePair("mod", r.mod)); + params.add(new BasicNameValuePair("combo", Integer.toString(r.combo))); + params.add(new BasicNameValuePair("gameScore", Integer.toString(r.score))); + try { + httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + //Execute and get the response. + HttpResponse response = null; + try { + response = httpclient.execute(httppost); + } catch (IOException e) { + e.printStackTrace(); + } + HttpEntity entity = response.getEntity(); + + JSONObject report = null; + + if (entity != null) { + try (InputStream instream = entity.getContent()) { + Scanner s = new Scanner(instream).useDelimiter("\\A"); + String result = s.hasNext() ? s.next() : ""; + report=new JSONObject(result); + instream.close(); + } catch (UnsupportedOperationException | IOException e) { + e.printStackTrace(); + } + } + + final JSONObject finalReport=report; + + System.out.println("Submitting screenshot for "+r.f); + Thread t = new Thread() { + public void run() { + HashMap s = new HashMap<>(); + s.put("username",USERNAME); + s.put("authentication_token",AUTHTOKEN); + s.put("playid",Integer.toString(finalReport.getInt("id"))); + WebUtils.POSTimage("http://projectdivar.com/upload", r.f, s); + } + }; + t.start(); + } + results.clear(); + + try { + JSONObject obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/rating/"+USERNAME); + JSONObject obj2 = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/bestplay/"+USERNAME+"/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")+"/"+difficulty); + p.lastRating = p.overallrating; + if (obj2.has("score")) { + double newScore = obj2.getDouble("score"); + if (newScore>p.lastScore) { + p.bestPlayTime=System.currentTimeMillis(); + } + p.lastScore = newScore; + } + p.overallrating = (int)obj.getDouble("rating"); + if (p.lastRating s = new HashMap<>(); - s.put("username",USERNAME); - s.put("authentication_token",AUTHTOKEN); - s.put("playid",Integer.toString(finalReport.getInt("id"))); - WebUtils.POSTimage("http://projectdivar.com/upload", r.f, s); - } - }; - t.start(); - } - results.clear(); - - try { - JSONObject obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/rating/"+USERNAME); - JSONObject obj2 = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/bestplay/"+USERNAME+"/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")+"/"+difficulty); - p.lastRating = p.overallrating; - if (obj2.has("score")) { - double newScore = obj2.getDouble("score"); - if (newScore>p.lastScore) { - p.bestPlayTime=System.currentTimeMillis(); - } - p.lastScore = newScore; + if (!OnResultsScreen() && recordedResults) { + recordedResults=false; } - p.overallrating = (int)obj.getDouble("rating"); - if (p.lastRating=0; + + if (startPointer) { + ypointer=officialypointers[iteration]; + //System.out.println("Found a saved ypointer of "+ypointer); + } + trialloop: while (ypointer0) { break trialloop; } - ypointer++; + if (startPointer) { + startPointer=false; + ypointer=FUTURETONE_RECT_SEARCH_PCT.y; + //System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); + } else { + ypointer++; + } + } + + startPointer=officialypointers[iteration]>=0; + + if (startPointer) { + ypointer=officialypointers[iteration]; + //System.out.println("Found a saved ypointer of "+ypointer); } xpointer=FUTURETONE_RECT_SEARCH_PCT2.x; @@ -484,7 +514,13 @@ public class TypeFace2 { if (integer.length()>0) { break trialloop; } - ypointer++; + if (startPointer) { + startPointer=false; + ypointer=FUTURETONE_RECT_SEARCH_PCT2.y; + //System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); + } else { + ypointer++; + } } if (integer.length()>0&&decimal.length()>0) { return Float.parseFloat(integer+"."+decimal); @@ -493,7 +529,7 @@ public class TypeFace2 { } } - public float extractPercentFromImage(BufferedImage img,boolean debug) throws IOException { + public float extractPercentFromImage(BufferedImage img,boolean debug,int iteration) throws IOException { //1180,167 //second part: 1123 String decimal = ""; @@ -502,6 +538,13 @@ public class TypeFace2 { ypointer=MEGAMIX_RECT_SEARCH_PCT.y; BufferedImage test = null; + boolean startPointer=officialypointers[iteration]>=0; + + if (startPointer) { + ypointer=officialypointers[iteration]; + //System.out.println("Found a saved ypointer of "+ypointer); + } + trialloop: while (ypointer0) { break trialloop; } - ypointer++; + if (startPointer) { + startPointer=false; + ypointer=MEGAMIX_RECT_SEARCH_PCT.y; + //System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); + } else { + ypointer++; + } + } + + startPointer=officialypointers[iteration]>=0; + + if (startPointer) { + ypointer=officialypointers[iteration]; + //System.out.println("Found a saved ypointer of "+ypointer); } xpointer=MEGAMIX_RECT_SEARCH_PCT2.x; @@ -605,29 +661,6 @@ public class TypeFace2 { for (int y=0;y<29;y++) { Color fontCol = new Color(percentfont.getRGB(x+i*24,y)); Color pixelCol = new Color(img.getRGB(xpointer-24+x+1, y+ypointer)); - /*if (fontCol.equals(Color.RED) && pixelCol.getRed()<50 - && pixelCol.getGreen()<150 && pixelCol.getBlue()>150) { - //Breaks a rule. - ruleBreak=true; - if (!debug) { - break colorloop; - } else { - test.setRGB(x, y, Color.RED.getRGB()); - } - } else - if (fontCol.equals(Color.GREEN) && (pixelCol.getRed()>50 - || pixelCol.getGreen()>170 || pixelCol.getBlue()<150)) { - //Breaks a rule. - ruleBreak=true; - if (!debug) { - break colorloop; - } else { - test.setRGB(x, y, Color.GREEN.getRGB()); - } - } else - if (debug) { - test.setRGB(x, y, pixelCol.getRGB()); - }*/ if (fontCol.equals(Color.RED)) { if (lightColorCheck(pixelCol)) { @@ -694,7 +727,13 @@ public class TypeFace2 { if (integer.length()>0) { break trialloop; } - ypointer++; + if (startPointer) { + startPointer=false; + ypointer=MEGAMIX_RECT_SEARCH_PCT2.y; + //System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); + } else { + ypointer++; + } } if (integer.length()>0&&decimal.length()>0) { return Float.parseFloat(integer+"."+decimal); @@ -726,11 +765,11 @@ public class TypeFace2 { ypointer=0; String total = ""; - boolean startPointer=ypointers[iteration]>=0; + boolean startPointer=officialypointers[iteration]>=0; if (startPointer) { - ypointer=ypointers[iteration]; - System.out.println("Found a saved ypointer of "+ypointer); + ypointer=officialypointers[iteration]; + //System.out.println("Found a saved ypointer of "+ypointer); } trialloop: @@ -808,7 +847,7 @@ public class TypeFace2 { if (startPointer) { startPointer=false; ypointer=0; - System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); + //System.out.println("Could not find with saved ypointer. Switching back to old ypointer."); } else { ypointer++; } @@ -828,10 +867,10 @@ public class TypeFace2 { ypointer=0; String total = ""; - boolean startPointer=ypointers[iteration]>=0; + boolean startPointer=officialypointers[iteration]>=0; if (startPointer) { - ypointer=ypointers[iteration]; + ypointer=officialypointers[iteration]; } trialloop: @@ -930,10 +969,10 @@ public class TypeFace2 { ypointer=0; String total = ""; - boolean startPointer=ypointers[iteration]>=0; + boolean startPointer=officialypointers[iteration]>=0; if (startPointer) { - ypointer=ypointers[iteration]; + ypointer=officialypointers[iteration]; } trialloop: diff --git a/DivaBot/typeface.png b/DivaBot/typeface.png index 80d602d..267e5d2 100644 Binary files a/DivaBot/typeface.png and b/DivaBot/typeface.png differ