Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.KeyEvent;
- import org.tribot.bot.ClientContext;
- import org.tribot.input.MouseHandler;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- import org.tribot.script.methods.General;
- import org.tribot.script.methods.Timing;
- @ScriptManifest(
- authors = { "TheBat"},
- name = "BatCombat",
- version = 1.0,
- description = "Kills ghouls",
- category = "Combat")
- public class BatCombat extends Script implements Painting {
- final private static Rectangle VIEWPORT = new Rectangle(4,4,513,335);
- final private static Rectangle VIEWPORT1 = new Rectangle(4,4,209,282);
- final private static Rectangle VIEWPORT2 = new Rectangle(209,57,80,282);
- final private static Rectangle VIEWPORT3 = new Rectangle(289,4,224,282);
- final private static Rectangle COMCECK = new Rectangle(215,115,85,35);
- final private static Rectangle MINIMAP = new Rectangle(565,34,115,126);
- private final static Point CENTER = new Point(255,165);
- //dtm for a goul
- Point[] F_CRAWLER_DTM_PTS = { new Point( 198, 197), new Point( 203, 193), new Point( 200, 197)};
- Color[] F_CRAWLER_DTM_RGB = { new Color( 50, 47, 15), new Color( 118, 98, 37), new Color( 53, 49, 16)};
- DTM dtmFCrawler1 = new DTM(F_CRAWLER_DTM_PTS, F_CRAWLER_DTM_RGB);
- Point[] RAT_DTM_PTS = { new Point( 320, 224), new Point( 332, 224)};
- Color[] RAT_DTM_RGB = { new Color( 116, 112, 101), new Color( 83, 79, 72)};
- DTM dtmRat1 = new DTM(RAT_DTM_PTS, RAT_DTM_RGB);
- Point[] GOUL1_DTM_PTS = { new Point( 214, 152), new Point( 215, 154)};
- Color[] GOUL1_DTM_RGB = { new Color( 186, 185, 160), new Color( 168, 167, 144)};
- DTM dtmGoul1 = new DTM(GOUL1_DTM_PTS, GOUL1_DTM_RGB);
- //dtm for green
- Point[] GREEN1_DTM_PTS = { new Point( 286, 146)};
- Color[] GREEN1_DTM_RGB = { new Color( 156, 216, 0)};
- DTM dtmGreen1 = new DTM(GREEN1_DTM_PTS, GREEN1_DTM_RGB);
- //dtm for red
- Point[] RED1_DTM_PTS = { new Point( 188, 110)};
- Color[] RED1_DTM_RGB = { new Color( 185, 0, 8)};
- DTM dtmRed1 = new DTM(RED1_DTM_PTS, RED1_DTM_RGB);
- //dtm for the yellow dots
- Point[] YELLOW1_DTM_PTS = { new Point( 656, 72)};
- Color[] YELLOW1_DTM_RGB = { new Color( 237, 234, 9)};
- DTM dtmYellow1 = new DTM(YELLOW1_DTM_PTS, YELLOW1_DTM_RGB);
- //dtm for a fully red health bar.
- Point[] RED_BAR1_DTM_PTS = { new Point( 232, 126), new Point( 238, 126), new Point( 282, 125), new Point( 285, 126)};
- Color[] RED_BAR1_DTM_RGB = { new Color( 108, 0, 0), new Color( 138, 0, 1), new Color( 225, 16, 8), new Color( 171, 0, 8)};
- DTM dtmRedBar1 = new DTM(RED_BAR1_DTM_PTS, RED_BAR1_DTM_RGB);
- //dtm for players bar
- Point[] PLAY_BAR1_DTM_PTS = { new Point( 229, 143), new Point( 244, 143)};
- Color[] PLAY_BAR1_DTM_RGB = { new Color( 131, 197, 0), new Color( 136, 198, 0)};
- DTM dtmPlayerBar1 = new DTM(PLAY_BAR1_DTM_PTS, PLAY_BAR1_DTM_RGB);
- private Rectangle rect = new Rectangle();
- private long TIME = 0;
- private static int KILLED = 0;
- private String userName = "hotskater89";
- private String password = "dragondyce";
- private MouseHandler mos = new MouseHandler(ClientContext.get().client);
- @Override
- public void run() {
- if(onStart())while(loop() > 0 && !Thread.interrupted());
- }
- public boolean onStart(){
- TIME = System.currentTimeMillis();
- mos.clickMouse(new Point(543,26),1);
- sleep(200);
- ClientContext.get().client.getKeyboardHandler().sendPressEvent((char)KeyEvent.VK_UP);
- sleep(800);
- ClientContext.get().client.getKeyboardHandler().sendReleaseEvent((char)KeyEvent.VK_UP);
- return true;
- }
- public int loop() {
- //mos.mouseSpeed = 500;
- General.setMouseSpeed(General.random(160,180));
- if(dtmGoul1.findDTMS(10, VIEWPORT)){
- int i = General.random(0,dtmGoul1.getList().size()-1);
- Point Pt = dtmGoul1.getDTM(i);
- if(isDistance(Pt, CENTER, 55))return 100;
- rect = new Rectangle(Pt.x-30, Pt.y-30,60,30);
- if(dtmGreen1.findDTMS(20, rect) || dtmRed1.findDTMS(20, rect))return 100;
- mos.clickMouse(Pt,1);
- sleep(3100);
- int k = 0;
- while(k <= 1200 &&!(dtmRedBar1.findDTMS(20, VIEWPORT1) || dtmRedBar1.findDTMS(20, VIEWPORT2) || dtmRedBar1.findDTMS(20, VIEWPORT3))){
- if(k > 300 && !dtmGreen1.findDTMS(30, COMCECK)){
- return 100;
- }
- sleep(10);
- k++;
- }
- if(k < 1200){
- KILLED++;
- }
- sleep(800);
- }else if(dtmYellow1.findDTMS(20, MINIMAP)){
- int i = General.random(0,dtmYellow1.getList().size()-1);
- Point Pt = new Point((int)dtmYellow1.getList().get(i).getCenterX(),(int)dtmYellow1.getList().get(i).getCenterY());
- mos.clickMouse(Pt,1);
- sleep(4000);
- }
- return 100;
- }
- public void onPaint(Graphics g){
- g.setColor(Color.YELLOW);
- g.drawLine(General.getMousePos().x,0,General.getMousePos().x,2100);
- g.drawLine(0,General.getMousePos().y,2100,General.getMousePos().y);
- int kph = (int) ((3600000*(long)KILLED)/(long)(System.currentTimeMillis() - TIME));
- g.drawString("Time Running: " + Timing.msToString(System.currentTimeMillis() - TIME), 11, 30);
- g.drawString("Total Killed: " + KILLED ,11,42);
- try{
- g.drawString("Kills/Hour: " + kph,11,54);
- }catch(ArithmeticException e){}
- g.drawRect(rect.x,rect.y,rect.width,rect.height);
- g.setColor(Color.RED);
- g.drawRect(COMCECK.x,COMCECK.y,COMCECK.width,COMCECK.height);
- }
- private boolean isDistance(Point pt1, Point pt2, int tolerance) {
- int distance = 0;
- distance = (int)Point.distance(pt1.x, pt1.y, pt2.x, pt2.y);
- if(distance < tolerance) return true;
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement