Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
yannis | aed0f2be96 | |
yannis | ee755219d4 | |
yannis | 3d5e3eaa25 | |
yannis | 9f8f8d1f75 | |
MrBesen | b88f8d0a12 | |
Daniel Ceballos | 3d24e8e0f3 | |
Daniel Ceballos | 020f260129 |
|
@ -4,4 +4,3 @@ export.jardesc
|
|||
.classpath
|
||||
.profile
|
||||
/default.profile
|
||||
target/
|
||||
|
|
46
pom.xml
46
pom.xml
|
@ -1,46 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.mrbesen</groupId>
|
||||
<artifactId>clashroyalebot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>clashroyalebot</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>de.mrbesen.cr.auto.clicker.Main</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Class-Path>.</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
|
||||
public class Main {
|
||||
|
||||
private static Main main;
|
||||
public UI ui;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Main();
|
||||
}
|
||||
|
||||
public Main() {
|
||||
main = this;
|
||||
new UI();
|
||||
}
|
||||
|
||||
public static Main get() {
|
||||
return main;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class Overlay {
|
||||
|
||||
JFrame frame;
|
||||
Point spawn;
|
||||
Point cards[];
|
||||
Point ok;
|
||||
Point battle;
|
||||
Point arenaview;
|
||||
|
||||
public Overlay() {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(frame != null) {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}, "Shutdownhook-Overlaycloser"));
|
||||
}
|
||||
|
||||
void set(Point spawn, Point[] cards, Point ok, Point battle, Point arenaview) {
|
||||
this.spawn = spawn;
|
||||
this.cards = cards;
|
||||
this.ok = ok;
|
||||
this.battle = battle;
|
||||
this.arenaview = arenaview;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
frame = new JFrame("Bot Overlay");
|
||||
frame.setUndecorated(true);
|
||||
frame.setOpacity(0.5f);
|
||||
|
||||
int width=0, height=0;
|
||||
int x=spawn.x,y=spawn.y;
|
||||
for(Point p : getlist()) {
|
||||
if(p != null) {
|
||||
if(p.x < x) {
|
||||
width += (x-p.x);//umsoviel weiter machen, wie nach links verschoben wird
|
||||
x = p.x;
|
||||
}
|
||||
if(x+width < p.x) {
|
||||
width += x+width-p.x;
|
||||
}
|
||||
if(p.y < y) {
|
||||
height += (y-p.y);
|
||||
y = p.y;
|
||||
}
|
||||
if(y+height < p.y) {
|
||||
height += y+height-p.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frame.setSize(width, height);
|
||||
frame.setLocation(x, y);
|
||||
|
||||
frame.setVisible(true);
|
||||
|
||||
Graphics gra = frame.getGraphics();
|
||||
gra.setColor(new Color(255, 0, 0));//red
|
||||
for(Point p : cards) {
|
||||
if(p != null) {
|
||||
gra.drawRect(p.x-1, p.y-1, 300, 300);
|
||||
}
|
||||
}
|
||||
System.out.println("Overlay is da!");
|
||||
}
|
||||
|
||||
public void close() {
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
|
||||
private Point[] getlist() {
|
||||
return new Point[] {spawn,ok,battle,arenaview, cards[0],cards[1],cards[2],cards[3]};
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Color;
|
||||
|
@ -34,7 +34,7 @@ public class Clicker implements Runnable{
|
|||
private int randomness = 15;
|
||||
private boolean paused = false;
|
||||
private boolean backfocus = false;
|
||||
private final int waittime = 250;//time between mouse teleports and clicks
|
||||
private final int waittime = 50;//time between mouse teleports and clicks
|
||||
|
||||
private int mincolordistance = 35;
|
||||
private Overlay ov = null;
|
||||
|
@ -72,11 +72,16 @@ public class Clicker implements Runnable{
|
|||
}
|
||||
|
||||
public void stop() {
|
||||
if(ov != null)
|
||||
ov.close();
|
||||
|
||||
should_run = false;
|
||||
skipbattle = true;
|
||||
System.out.println("interupting!");
|
||||
while(running) {
|
||||
thread.interrupt();//stop that shit (its maybe sleeping)
|
||||
}
|
||||
System.out.println("Bot stopped!");
|
||||
}
|
||||
|
||||
public void skip() {
|
||||
|
@ -396,7 +401,7 @@ public class Clicker implements Runnable{
|
|||
try {
|
||||
ov = new Overlay();
|
||||
ov.set(playout, cardslots, end, battle, arena_switch);
|
||||
ov.init();
|
||||
//ov.init();
|
||||
} catch(Exception e) {
|
||||
System.out.println("Catched Exception, while inflateing Overlay: ");
|
||||
e.printStackTrace();
|
|
@ -0,0 +1,42 @@
|
|||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsDevice.WindowTranslucency;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
|
||||
public class Main {
|
||||
|
||||
private static Main main;
|
||||
public UI ui;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Main();
|
||||
}
|
||||
|
||||
public Main() {
|
||||
|
||||
GraphicsEnvironment ge =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice gd = ge.getDefaultScreenDevice();
|
||||
|
||||
//If translucent windows aren't supported, exit.
|
||||
if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
|
||||
System.err.println(
|
||||
"Translucency is not supported");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
main = this;
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
new UI();
|
||||
}
|
||||
|
||||
public static Main get() {
|
||||
return main;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class Overlay extends JFrame {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4305002876609279070L;
|
||||
|
||||
// JFrame frame;
|
||||
Point spawn;
|
||||
Point cards[];
|
||||
Point ok;
|
||||
Point battle;
|
||||
Point arenaview;
|
||||
|
||||
public Overlay() {
|
||||
/*Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// if(frame != null) {
|
||||
dispose();
|
||||
// }
|
||||
}
|
||||
}, "Shutdownhook-Overlaycloser"));*/
|
||||
init();
|
||||
}
|
||||
|
||||
void set(Point spawn, Point[] cards, Point ok, Point battle, Point arenaview) {
|
||||
this.spawn = spawn;
|
||||
this.cards = cards;
|
||||
this.ok = ok;
|
||||
this.battle = battle;
|
||||
this.arenaview = arenaview;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setTitle("Bot Overlay");
|
||||
setUndecorated(true);
|
||||
setBackground(new Color(0, 0, 0, 0));
|
||||
setOpacity(.5f);
|
||||
setAlwaysOnTop(true);
|
||||
// frame.setOpacity(0.5f);
|
||||
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int width=screenSize.width, height=screenSize.height;
|
||||
int x=0, y=0;
|
||||
System.out.println("x: " + x + " y: " + y + " size: " + width + ", " + height);
|
||||
//
|
||||
// for(Point p : getlist()) {
|
||||
// if(p != null) {
|
||||
// if(p.x < x) {
|
||||
// width += (x-p.x);//umsoviel weiter machen, wie nach links verschoben wird
|
||||
// x = p.x;
|
||||
// }
|
||||
// if(x+width < p.x) {
|
||||
// width += x+width-p.x;
|
||||
// }
|
||||
// if(p.y < y) {
|
||||
// height += (y-p.y);
|
||||
// y = p.y;
|
||||
// }
|
||||
// if(y+height < p.y) {
|
||||
// height += y+height-p.y;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
setSize(width, height);
|
||||
setLocation(x, y);
|
||||
|
||||
setVisible(true);
|
||||
|
||||
// frame.invalidate();
|
||||
System.out.println("Overlay is da!");
|
||||
}
|
||||
/* @Override
|
||||
public void paint(Graphics gra) {
|
||||
// gra.setPaintMode();
|
||||
gra.setColor(new Color(255, 255, 255, 0));
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
// gra.fillRect(0, 0, screenSize.width, screenSize.height);
|
||||
gra.setColor(new Color(255, 0, 0, 255));//red
|
||||
// gra.setColor(new Color(1, 0, 0,0.5f));
|
||||
for(Point p : getlist()) {
|
||||
if(p != null) {
|
||||
gra.fillRect(p.x-2, p.y-2, 25, 25);
|
||||
System.out.println("draw: " + p.x +", " + p.y);
|
||||
}
|
||||
}
|
||||
System.out.println("paint!");
|
||||
}*/
|
||||
|
||||
public void close() {
|
||||
/*if (frame != null) {
|
||||
frame.dispose();
|
||||
System.out.println("Closed Overlay");
|
||||
}*/
|
||||
dispose();
|
||||
}
|
||||
|
||||
|
||||
private Point[] getlist() {
|
||||
return new Point[] {spawn,ok,battle,arenaview, cards[0],cards[1],cards[2],cards[3]};
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.util.Random;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Color;
|
|
@ -1,4 +1,4 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
|
@ -16,10 +16,13 @@ public class PosSelector implements Runnable {
|
|||
return required;
|
||||
}
|
||||
|
||||
public PosSelector(UI ui, String text, boolean required, int num) {
|
||||
this.ui = ui; this.required = required;this.num = num;
|
||||
PosSelector(UI ui, String text, boolean required, int num) {
|
||||
this.ui = ui;
|
||||
this.required = required;
|
||||
this.num = num;
|
||||
button = new JButton(text);
|
||||
button.addActionListener(ui);
|
||||
button.setOpaque(true);
|
||||
red();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.mrbesen.cr.auto.clicker;
|
||||
package mrbesen.cr.auto.clicker;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
@ -26,6 +26,8 @@ import javax.swing.event.ChangeEvent;
|
|||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import com.sun.istack.internal.Nullable;
|
||||
|
||||
public class UI implements ActionListener {
|
||||
|
||||
private boolean isSelectionRunning = false; //true if an selection Thread is working,
|
||||
|
@ -92,7 +94,7 @@ public class UI implements ActionListener {
|
|||
|
||||
//init screen
|
||||
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
frame.setSize(830,( System.getProperty("os.name").toLowerCase().contains("win") ? 220 : 180));//extra large for windows
|
||||
frame.setSize(830, ( System.getProperty("os.name").toLowerCase().contains("nux") ? 180 : 220));
|
||||
|
||||
save.setText("Save");
|
||||
save.addActionListener(this);
|
||||
|
@ -129,7 +131,7 @@ public class UI implements ActionListener {
|
|||
middle.add(skip);
|
||||
middle.add(pause);
|
||||
middle.add(exit);
|
||||
//middle.add(overlay);//added later
|
||||
middle.add(overlay);//added later
|
||||
middle.add(autoplay);
|
||||
middle.add(doubleplace);
|
||||
middle.add(backfocus);
|
||||
|
@ -482,7 +484,7 @@ public class UI implements ActionListener {
|
|||
* @param startvalue inital value
|
||||
* @param komma 10^x offset for komma digits
|
||||
*/
|
||||
public Slider(String prefix, String sufix, int minvalue, int maxvalue, int startvalue, int komma, ChangeListener cl, Updater upd, boolean enabled) {//ChangeListener or Updater could be Null!
|
||||
public Slider(String prefix, String sufix, int minvalue, int maxvalue, int startvalue, int komma, @Nullable ChangeListener cl,@Nullable Updater upd, boolean enabled) {//ChangeListener or Updater could be Null!
|
||||
slider = new JSlider(minvalue, maxvalue, startvalue);
|
||||
slider.addChangeListener(this);
|
||||
if(prefix != null)
|
||||
|
@ -535,4 +537,4 @@ public class UI implements ActionListener {
|
|||
setValue(defaultvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue