Ok so i created this bot which auto alchs for me and logs out.
I'm really frustrated on how to make it use a 2nd mouse say to speak.
I've heard you can use reflection if you use the correct loaders but i'm not too familiar with reflection so...ye
Here is the code help will be appreciated
Code:
package com.xero.macros;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URL;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.UIManager;
import com.xero.Logger;
/**
*
* @author Tyler(Arravs flow , skrillex etc on diff forums)
*
*/
public class Alcher extends JFrame {
/**
*
*/
private static final long serialVersionUID = -8286155230324582877L;
public static int alchs = 0;
Graphics g1;
public int alchTo = 100;
private JPanel contentPane;
private JTextField textField;
public static Dimension size;
Robot robot = new Robot();
public boolean mageTab = false;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
Alcher frame = new Alcher();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
* @throws AWTException
* @throws IOException
*/
public Alcher() throws AWTException, IOException {
setResizable(false);
size = Toolkit.getDefaultToolkit().getScreenSize();
setTitle("Alcher Pro");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 174, 140);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
setLocation(
(int)(size.getWidth()-contentPane.getWidth())/2,
(int)(size.getHeight()-contentPane.getHeight())/2);
JLabel lblEnterAmount = new JLabel("Enter Amount:");
lblEnterAmount.setBounds(44, 11, 83, 27);
contentPane.add(lblEnterAmount);
textField = new JTextField();
textField.setBounds(0, 32, 166, 27);
contentPane.add(textField);
textField.setColumns(10);
JButton btnStartAlching = new JButton("Start Alching");
btnStartAlching.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Logger.log("Alcher Pro", "Alching Pro Started!");
try {
click();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
});
btnStartAlching.setBounds(0, 83, 166, 23);
contentPane.add(btnStartAlching);
JLabel lblRedemptionBotting = new JLabel("Redemption Botting");
lblRedemptionBotting.setBounds(30, 70, 136, 14);
contentPane.add(lblRedemptionBotting);
}
public void click() throws InterruptedException {
int many = Integer.parseInt(textField.getText());
if(alchs == many) {
ranOutOfAlchs();
Logger.log("Alcher Pro","---------------------");
Logger.log("Alcher", "Completed Alching, logging out!");
Logger.log("Alcher Pro","---------------------");
Thread.sleep(2000);
System.exit(0);
}
for (int i = 0; i < many; i++) {
try {
robot.mousePress(MouseEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mouseMove(866,400);
Thread.sleep(4000);
alchs++;
Logger.log("Alcher Pro", "Alch number: "+alchs);
} catch (InterruptedException e) {
e.printStackTrace();
System.exit(0);
}
}
}
public void SmoothMove(Point Destination, double Speed){
//Credits to Flaming Idiots for this as well, it was only converted to Java by SlashShot
try {
Robot robot = new Robot();
PointerInfo PInfo = MouseInfo.getPointerInfo();
Point origin = PInfo.getLocation();
Point Difference = new Point((int)(Destination.getX() - PInfo.getLocation().getX()),(int)(Destination.getY() - PInfo.getLocation().getY()));
for(double Current = 0; Current < 1; Current+= (Speed/Math.sqrt(Math.pow(Difference.getX(),2) + Math.pow(Difference.getY(),2)))){
PInfo = MouseInfo.getPointerInfo();
robot.mouseMove((int)origin.getX() + (int)(Difference.getX() * Current),(int)origin.getY() + (int)(Difference.getY() * Current));
robot.setAutoDelay(3);
}
}catch(java.awt.AWTException exc) {
System.out.println("error");
}
}
public Point FindPixelByColor(Rectangle Window, Color Colour)
{
try
{
Robot Robot = new Robot();
for(int x = Window.x; x < Window.width; x++)
for(int y = Window.y; y < Window.height; y++)
if(Robot.getPixelColor(x, y).getRGB() == Colour.getRGB())
return new Point(x, y);
}
catch(Exception Exception)
{
Exception.printStackTrace();
}
return null;
}
public void ranOutOfAlchs() throws InterruptedException {
robot.mouseMove(1060,35);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Thread.sleep(1500);
robot.mouseMove(900,380);
Thread.sleep(1500);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
}