Created
June 19, 2012 14:08
-
-
Save TheBatScripts/2954412 to your computer and use it in GitHub Desktop.
Random stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Rectangle VIEWPORT = new Rectangle(3, 3, 513, 334); | |
| Point cenPt = new Point((int)VIEWPORT.getCenterX(),(int)VIEWPORT.getCenterY()); | |
| private Point findBestPoint(DTM[] list, ScreenModel mod, String str, int range) { | |
| if(list.length < 1 || list == null || mod == null)return null; | |
| String upT = ""; | |
| int i = 0; | |
| int j = 0; | |
| boolean useSubPoint = false; | |
| while(i < list.length && (upT == null || !upT.contains(str))){ | |
| Mouse.move(list[i].main_point.point); | |
| sleep(20); | |
| upT = Game.getUptext(); | |
| j = 0; | |
| while(j < list[i].sub_points.length && (upT == null || !upT.contains(str))){ | |
| Mouse.move(list[i].sub_points[j].colourPoint.point); | |
| sleep(20); | |
| upT = Game.getUptext(); | |
| j++; | |
| } | |
| if(j > 0 && j < list[i].sub_points.length)useSubPoint = true; | |
| i++; | |
| } | |
| if(!useSubPoint)return list[i].main_point.point; | |
| else return list[i].sub_points[j].colourPoint.point; | |
| } | |
| private ScreenModel getClosest(ScreenModel[] mods, Point pt) { | |
| int k = -1; | |
| ScreenModel out = null; | |
| int trys = 0; | |
| while(k < 0){ | |
| try{ | |
| if(mods.length > 0 && mods[0] != null)out = mods[0]; | |
| else{ | |
| trys++; | |
| continue; | |
| } | |
| for(int i = 0; i < mods.length; i++){ | |
| ScreenModel test = mods[i]; | |
| if(test != null){ | |
| if(test.base_point.distance(pt) <= out.base_point.distance(pt)){ | |
| if(VIEWPORT.contains(test.base_point))out = test; | |
| } | |
| } | |
| } | |
| k = 3; | |
| }catch(NullPointerException e){ | |
| k = -1; | |
| trys++; | |
| } | |
| } | |
| if(trys >= 6)return null; | |
| return out; | |
| } | |
| private ScreenModel getPlayer(long [] exceptions) { | |
| int k = -1; | |
| ScreenModel ply = null; | |
| while(k < 0){ | |
| try{ | |
| ScreenModel [] allMods = ScreenModels.getAll(); | |
| if(allMods.length > 0 && allMods[0] != null)ply = allMods[0]; | |
| else continue; | |
| out: for(int i = 0; i < allMods.length; i++){ | |
| ScreenModel test = allMods[i]; | |
| for(int l = 0; l < exceptions.length; l++){ | |
| if(test.id == exceptions[l])continue out; | |
| } | |
| if(test != null){ | |
| if(Point.distance(test.base_point.x, test.base_point.y, cenPt.x, cenPt.y)< | |
| Point.distance(ply.base_point.x, ply.base_point.y, cenPt.x, cenPt.y)){ | |
| if(VIEWPORT.contains(test.base_point))ply = test; | |
| } | |
| } | |
| } | |
| k = 3; | |
| }catch(NullPointerException e){ | |
| k = -1; | |
| } | |
| } | |
| return ply; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment