Demo entry 6327312

Chatbox

   

Submitted by asfdasd on Nov 23, 2016 at 21:24
Language: Java. Code size: 6.2 kB.

package project.games.aion;

import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;

public class Button {

	private Color color = new Color();
	
	public void getLogginButton() throws AWTException{ //infinite loop until the game has start (because the load time can be different every time)
		Robot robot = new Robot();
		outerloop:
			while(true){
	
			BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
			for(int y = 0; y<1080; y++){
				for(int x = 0; x < 1920; x++){
					if(image.getRGB(x,y)==color.getoKButtonLoginBar()//middle letter O: 242 255 229
							&&image.getRGB(x+12,y+5)==color.getoKButtonLoginBar()
							&&image.getRGB(x+12,y-4)==color.getoKButtonLoginBar()
							&&image.getRGB(x+8,y)==color.getoKButtonLoginBar())
							{
						robot.mouseMove(x-128, y-13);
						break outerloop;
				}
			}
		}
	}
	}
	

	public void getButtonOne() throws AWTException{
		
		
		Robot robot = new Robot();
		BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
		for(int y = 0; y<1080; y++){
			for(int x = 0; x < 1920; x++){
				if(image.getRGB(x,y)==color.getButtonOne()
						&&image.getRGB(x-6,y)==color.getButtonOne()
						&&image.getRGB(x-3,y-5)==color.getButtonOne()
						&&image.getRGB(x-3,y-11)==color.getButtonOne())
						{
					robot.mouseMove(x, y);
				}
				
			}
		}
	
	}

	public void getButtonSeven() throws AWTException{
		
		
		Robot robot = new Robot();
		BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
		for(int y = 0; y<1080; y++){
			for(int x = 0; x < 1920; x++){
				if(image.getRGB(x,y)==color.getNumberSeven()
						&&image.getRGB(x+3,y-9)==color.getNumberSeven()
						&&image.getRGB(x-3,y-9)==color.getNumberSeven()
						&&image.getRGB(x+2,y-5)==color.getNumberSeven())
						{
					robot.mouseMove(x, y);				
				}
				
			}
		}
	
	}
	public void getOKButton() throws AWTException{
		
		
		Robot robot = new Robot();
		BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
		for(int y = 0; y<1080; y++){
			for(int x = 0; x < 1920; x++){
				/*take the cancelButton instead(next to the OKButton), because the pixels of the OKButton change in color if the pin-panel has certain positions*/
				if(image.getRGB(x,y)==color.getoKButton()) //take the middle of the K, first pixel from the right
//						&&image.getRGB(x+87,y-5)==color.getCancelButton())
//						&&image.getRGB(x+87,y+4)==color.getCancelButton())
						{
					robot.mouseMove(x, y);
				}
				
			}
		}
	
	}
	public void getLogoutButton() throws AWTException{
		
		outerloop:
			while(true){
			
		Robot robot = new Robot();
		BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
		for(int y = 0; y<1080; y++){
			for(int x = 0; x < 1920; x++){
					if(image.getRGB(x,y)==color.getLogoutButton()//take the L from Logout, pixel @ bottom-left corner: 242 255 229
						&&image.getRGB(x+4,y)==color.getLogoutButton()
						&&image.getRGB(x+37,y-1)==color.getLogoutButton())
//						&&image.getRGB(x+37,y-6)==color.getLogoutButton())
						{
					robot.mouseMove(x+20, y);
					break outerloop;
					}
				}
			}
		}	
	}
	
	public void getStartButton() throws AWTException{
		outerloop:
			while(true){
				
			BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
			for(int y = 0; y<1080; y++){
				for(int x = 0; x < 1920; x++){
					if(image.getRGB(x,y)==color.getStartButton()//letter S: 242 255 229
							&&image.getRGB(x+8,y)==color.getStartButton()
							&&image.getRGB(x+24,y)==color.getStartButton()
							&&image.getRGB(x+12,y+5)==color.getStartButton())
							{
						break outerloop;
							}
				}
			}
		}
	}
	
	public void getAcceptButton() throws AWTException{
		outerloop:
			while(true){
				BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
			for(int y = 0; y<1080; y++){
				for(int x = 0; x < 1920; x++){
					if(image.getRGB(x,y)==color.getAcceptButton())//letter S: 155 242 147
//							&&image.getRGB(x+8,y)==color.getAcceptButton()
//							&&image.getRGB(x+24,y)==color.getAcceptButton()
//							&&image.getRGB(x+12,y+5)==color.getAcceptButton())
							{
						break outerloop;
							}
				}
			}
		}
	}	
	public void getCharacterHealthbar() throws AWTException{ //so it knows you logged in
		outerloop:
			while(true){
				BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
			for(int y = 0; y<1080; y++){
				for(int x = 0; x < 1920; x++){
						if(image.getRGB(x,y)==color.getHealthButton())//letter S: 155 242 147
//							&&image.getRGB(x+8,y)==color.getAcceptButton()
//							&&image.getRGB(x+24,y)==color.getAcceptButton()
//							&&image.getRGB(x+12,y+5)==color.getAcceptButton())
							{
						break outerloop;
							}
				}
			}
		}
	}	
	public void getClient() throws AWTException{
			
			
			Robot robot = new Robot();
			BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
			for(int y = 0; y<1080; y++){
				for(int x = 0; x < 1920; x++){
					/*take the cancelButton instead(next to the OKButton), because the pixels of the OKButton changes if the pinpanel has certain positions*/
					if(image.getRGB(x,y)==color.getClientButton()) //take the middle of the K, first pixel from the right
	//						&&image.getRGB(x+87,y-5)==color.getCancelButton())
	//						&&image.getRGB(x+87,y+4)==color.getCancelButton())
							{
						robot.mouseMove(x, y);
						robot.mousePress(InputEvent.BUTTON1_MASK);
						robot.mouseRelease(InputEvent.BUTTON1_MASK);
						robot.delay(4000);
					}
					
				}
			}
		
		}
	
	
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).