diff --git a/.gradle/5.2.1/executionHistory/executionHistory.bin b/.gradle/5.2.1/executionHistory/executionHistory.bin
index d15920b2..a4dc6a98 100644
Binary files a/.gradle/5.2.1/executionHistory/executionHistory.bin and b/.gradle/5.2.1/executionHistory/executionHistory.bin differ
diff --git a/.gradle/5.2.1/executionHistory/executionHistory.lock b/.gradle/5.2.1/executionHistory/executionHistory.lock
index 7fee8692..f45eeb27 100644
Binary files a/.gradle/5.2.1/executionHistory/executionHistory.lock and b/.gradle/5.2.1/executionHistory/executionHistory.lock differ
diff --git a/.gradle/5.2.1/fileHashes/fileHashes.bin b/.gradle/5.2.1/fileHashes/fileHashes.bin
index 09962d01..dfb12744 100644
Binary files a/.gradle/5.2.1/fileHashes/fileHashes.bin and b/.gradle/5.2.1/fileHashes/fileHashes.bin differ
diff --git a/.gradle/5.2.1/fileHashes/fileHashes.lock b/.gradle/5.2.1/fileHashes/fileHashes.lock
index b117ab8b..4b95f882 100644
Binary files a/.gradle/5.2.1/fileHashes/fileHashes.lock and b/.gradle/5.2.1/fileHashes/fileHashes.lock differ
diff --git a/.gradle/5.2.1/javaCompile/classAnalysis.bin b/.gradle/5.2.1/javaCompile/classAnalysis.bin
index 8ec8a079..2f835d9e 100644
Binary files a/.gradle/5.2.1/javaCompile/classAnalysis.bin and b/.gradle/5.2.1/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/5.2.1/javaCompile/javaCompile.lock b/.gradle/5.2.1/javaCompile/javaCompile.lock
index d7428d19..882d0289 100644
Binary files a/.gradle/5.2.1/javaCompile/javaCompile.lock and b/.gradle/5.2.1/javaCompile/javaCompile.lock differ
diff --git a/.gradle/5.2.1/javaCompile/taskHistory.bin b/.gradle/5.2.1/javaCompile/taskHistory.bin
index dc9e242f..3ccb2874 100644
Binary files a/.gradle/5.2.1/javaCompile/taskHistory.bin and b/.gradle/5.2.1/javaCompile/taskHistory.bin differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 7ddf11e0..1ad06834 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
index 19cf081d..6ed6d667 100644
Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/.idea/artifacts/RSBBB_jar.xml b/.idea/artifacts/RSBBB_jar.xml
index a5874b75..cf356ccd 100644
--- a/.idea/artifacts/RSBBB_jar.xml
+++ b/.idea/artifacts/RSBBB_jar.xml
@@ -2,53 +2,56 @@
$PROJECT_DIR$/out/artifacts/RSBBB_jar
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
-
+
+
+
+
+
+
-
-
-
+
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
-
-
-
+
-
-
+
+
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c380d1c5..cbf6cc79 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,7 +9,427 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -102,7 +522,6 @@
-
@@ -112,12 +531,15 @@
-
+
+
+
+
@@ -126,9 +548,9 @@
-
+
-
+
@@ -136,7 +558,11 @@
-
+
+
+
+
+
@@ -239,7 +665,7 @@
false
-
+
@@ -250,7 +676,7 @@
@@ -262,11 +688,11 @@
-
+
+
-
@@ -366,7 +792,14 @@
1643158023003
-
+
+ 1643158453885
+
+
+
+ 1643158453885
+
+
@@ -382,6 +815,7 @@
+
@@ -394,7 +828,28 @@
-
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/rsb/plugin/AccountManager.java
+ 315
+
+
+
+ file://$PROJECT_DIR$/src/main/java/rsb/plugin/AccountManager.java
+ 311
+
+
+
+
diff --git a/README.md b/README.md
index a05e38f8..27981282 100644
--- a/README.md
+++ b/README.md
@@ -92,8 +92,8 @@ After entering the program arguments you wish to enable (one mode only --runelit
it is ready to run.
#### Building
-If you're actively working on the API you should generally know how to create artifacts in IntelliJ and use them
-to build jar files. If not check out the First Script Set Up link for details.
+The project uses Gradle so to build a jar just click on the Gradle task in the Gradle menu.
+
##### Changing the API used in your script environment
If you're developing in your script environment, and you decide you wish to make changes to the API it is fairly
manageable.
diff --git a/build.gradle b/build.gradle
index 14c700a4..a087c740 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,7 +16,7 @@ def runeLiteVersion = '1.8.9'
dependencies {
compile group: 'net.runelite', name: 'client', version: runeLiteVersion
- compileOnly 'org.projectlombok:lombok:1.18.22'
+ compile 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'junit:junit:4.13.2'
@@ -30,6 +30,36 @@ dependencies {
compile group: 'net.sf.jopt-simple', name:'jopt-simple', version: '5.0.4'
}
+sourceSets {
+ main {
+ java {
+ srcDirs= ["src/main/java"]
+ }
+ resources {
+ srcDirs= ["src/main/resources"]
+ }
+ }
+}
+
+project.configurations.implementation.setCanBeResolved(true)
+
+jar {
+ manifest {
+ attributes(
+ 'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
+ 'Main-Class': 'rsb.botLauncher.Application'
+ )
+
+ }
+ from{
+ configurations.runtimeClasspath.collect {it.isDirectory() ? it: zipTree(it)}
+ }
+
+ exclude 'META-INF/*.RSA'
+ exclude 'META-INF/*.SF'
+ exclude 'META-INF/*.DSA'
+}
+
group = 'rsb'
version = '1.0'
sourceCompatibility = '1.8'
diff --git a/build/classes/java/main/rsb/botLauncher/RuneLite.class b/build/classes/java/main/rsb/botLauncher/RuneLite.class
index e7d79e4b..949f566c 100644
Binary files a/build/classes/java/main/rsb/botLauncher/RuneLite.class and b/build/classes/java/main/rsb/botLauncher/RuneLite.class differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$1.class b/build/classes/java/main/rsb/gui/AccountManager$1.class
deleted file mode 100644
index 2e29d60c..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$AccountTableModel.class b/build/classes/java/main/rsb/gui/AccountManager$AccountTableModel.class
deleted file mode 100644
index 0b0def13..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$AccountTableModel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$PasswordCellEditor.class b/build/classes/java/main/rsb/gui/AccountManager$PasswordCellEditor.class
deleted file mode 100644
index 68b7427e..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$PasswordCellEditor.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$PasswordCellRenderer.class b/build/classes/java/main/rsb/gui/AccountManager$PasswordCellRenderer.class
deleted file mode 100644
index 3d863b1f..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$PasswordCellRenderer.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$RandomRewardEditor.class b/build/classes/java/main/rsb/gui/AccountManager$RandomRewardEditor.class
deleted file mode 100644
index 2c9ed205..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$RandomRewardEditor.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager$TableSelectionListener.class b/build/classes/java/main/rsb/gui/AccountManager$TableSelectionListener.class
deleted file mode 100644
index d78bcf56..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager$TableSelectionListener.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/AccountManager.class b/build/classes/java/main/rsb/gui/AccountManager.class
deleted file mode 100644
index afdd86f2..00000000
Binary files a/build/classes/java/main/rsb/gui/AccountManager.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$1.class b/build/classes/java/main/rsb/gui/BotGUI$1.class
deleted file mode 100644
index b30ce7a1..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$2.class b/build/classes/java/main/rsb/gui/BotGUI$2.class
deleted file mode 100644
index 8d59f903..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$2.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$3.class b/build/classes/java/main/rsb/gui/BotGUI$3.class
deleted file mode 100644
index 65f7a653..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$3.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$4.class b/build/classes/java/main/rsb/gui/BotGUI$4.class
deleted file mode 100644
index 9b11bef0..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$4.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$5.class b/build/classes/java/main/rsb/gui/BotGUI$5.class
deleted file mode 100644
index b120b521..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$5.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI$6.class b/build/classes/java/main/rsb/gui/BotGUI$6.class
deleted file mode 100644
index 27e738e1..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI$6.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotGUI.class b/build/classes/java/main/rsb/gui/BotGUI.class
deleted file mode 100644
index 743fbede..00000000
Binary files a/build/classes/java/main/rsb/gui/BotGUI.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotHome$1.class b/build/classes/java/main/rsb/gui/BotHome$1.class
deleted file mode 100644
index 2a36c95c..00000000
Binary files a/build/classes/java/main/rsb/gui/BotHome$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotHome.class b/build/classes/java/main/rsb/gui/BotHome.class
deleted file mode 100644
index 144a1c54..00000000
Binary files a/build/classes/java/main/rsb/gui/BotHome.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotMenuBar.class b/build/classes/java/main/rsb/gui/BotMenuBar.class
deleted file mode 100644
index d509b4bb..00000000
Binary files a/build/classes/java/main/rsb/gui/BotMenuBar.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel$1.class b/build/classes/java/main/rsb/gui/BotPanel$1.class
deleted file mode 100644
index 7f095b6a..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel$2.class b/build/classes/java/main/rsb/gui/BotPanel$2.class
deleted file mode 100644
index b6ec662f..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel$2.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel$3.class b/build/classes/java/main/rsb/gui/BotPanel$3.class
deleted file mode 100644
index 2b06a2c0..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel$3.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel$4.class b/build/classes/java/main/rsb/gui/BotPanel$4.class
deleted file mode 100644
index 762cf616..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel$4.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel$HomeUpdater.class b/build/classes/java/main/rsb/gui/BotPanel$HomeUpdater.class
deleted file mode 100644
index 8e4a58a0..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel$HomeUpdater.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotPanel.class b/build/classes/java/main/rsb/gui/BotPanel.class
deleted file mode 100644
index 734c1869..00000000
Binary files a/build/classes/java/main/rsb/gui/BotPanel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$1.class b/build/classes/java/main/rsb/gui/BotToolBar$1.class
deleted file mode 100644
index 144fc5ca..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$AddButton$1.class b/build/classes/java/main/rsb/gui/BotToolBar$AddButton$1.class
deleted file mode 100644
index e20cad8a..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$AddButton$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$AddButton.class b/build/classes/java/main/rsb/gui/BotToolBar$AddButton.class
deleted file mode 100644
index 5acec07c..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$AddButton.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$BotButton$1.class b/build/classes/java/main/rsb/gui/BotToolBar$BotButton$1.class
deleted file mode 100644
index 39055ab7..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$BotButton$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$BotButton$2.class b/build/classes/java/main/rsb/gui/BotToolBar$BotButton$2.class
deleted file mode 100644
index 3b6644fe..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$BotButton$2.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$BotButton.class b/build/classes/java/main/rsb/gui/BotToolBar$BotButton.class
deleted file mode 100644
index f5ce3f50..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$BotButton.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$HomeButton$1.class b/build/classes/java/main/rsb/gui/BotToolBar$HomeButton$1.class
deleted file mode 100644
index 01597b66..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$HomeButton$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar$HomeButton.class b/build/classes/java/main/rsb/gui/BotToolBar$HomeButton.class
deleted file mode 100644
index 1b672deb..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar$HomeButton.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/BotToolBar.class b/build/classes/java/main/rsb/gui/BotToolBar.class
deleted file mode 100644
index 6c57deef..00000000
Binary files a/build/classes/java/main/rsb/gui/BotToolBar.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ClientPanel.class b/build/classes/java/main/rsb/gui/ClientPanel.class
deleted file mode 100644
index b18c5ea6..00000000
Binary files a/build/classes/java/main/rsb/gui/ClientPanel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$1.class b/build/classes/java/main/rsb/gui/LogTextArea$1.class
deleted file mode 100644
index a2b15c58..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$2.class b/build/classes/java/main/rsb/gui/LogTextArea$2.class
deleted file mode 100644
index 5a0f9197..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$2.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$LogAreaListModel.class b/build/classes/java/main/rsb/gui/LogTextArea$LogAreaListModel.class
deleted file mode 100644
index b8745915..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$LogAreaListModel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$LogQueue.class b/build/classes/java/main/rsb/gui/LogTextArea$LogQueue.class
deleted file mode 100644
index ff4f3548..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$LogQueue.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$Renderer.class b/build/classes/java/main/rsb/gui/LogTextArea$Renderer.class
deleted file mode 100644
index d272a15d..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$Renderer.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea$WrappedLogRecord.class b/build/classes/java/main/rsb/gui/LogTextArea$WrappedLogRecord.class
deleted file mode 100644
index 7eda1a8e..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea$WrappedLogRecord.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/LogTextArea.class b/build/classes/java/main/rsb/gui/LogTextArea.class
deleted file mode 100644
index 45a2ce82..00000000
Binary files a/build/classes/java/main/rsb/gui/LogTextArea.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$1.class b/build/classes/java/main/rsb/gui/ScriptSelector$1.class
deleted file mode 100644
index 28ad8724..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$2.class b/build/classes/java/main/rsb/gui/ScriptSelector$2.class
deleted file mode 100644
index 6a4b49b9..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$2.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$3$1.class b/build/classes/java/main/rsb/gui/ScriptSelector$3$1.class
deleted file mode 100644
index af1460db..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$3$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$3.class b/build/classes/java/main/rsb/gui/ScriptSelector$3.class
deleted file mode 100644
index 0f3285ac..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$3.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$4.class b/build/classes/java/main/rsb/gui/ScriptSelector$4.class
deleted file mode 100644
index 4c08022e..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$4.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$5.class b/build/classes/java/main/rsb/gui/ScriptSelector$5.class
deleted file mode 100644
index 5b6d48dc..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$5.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$6.class b/build/classes/java/main/rsb/gui/ScriptSelector$6.class
deleted file mode 100644
index 8a15a10a..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$6.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$ScriptTableModel.class b/build/classes/java/main/rsb/gui/ScriptSelector$ScriptTableModel.class
deleted file mode 100644
index 5627cacb..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$ScriptTableModel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector$TableSelectionListener.class b/build/classes/java/main/rsb/gui/ScriptSelector$TableSelectionListener.class
deleted file mode 100644
index cf17a8d9..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector$TableSelectionListener.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/gui/ScriptSelector.class b/build/classes/java/main/rsb/gui/ScriptSelector.class
deleted file mode 100644
index 33e1a815..00000000
Binary files a/build/classes/java/main/rsb/gui/ScriptSelector.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/internal/TextAreaLogHandler.class b/build/classes/java/main/rsb/internal/TextAreaLogHandler.class
index 7df0e24b..21d05a7e 100644
Binary files a/build/classes/java/main/rsb/internal/TextAreaLogHandler.class and b/build/classes/java/main/rsb/internal/TextAreaLogHandler.class differ
diff --git a/build/classes/java/main/rsb/methods/Account.class b/build/classes/java/main/rsb/methods/Account.class
index ec4b0374..e14d3203 100644
Binary files a/build/classes/java/main/rsb/methods/Account.class and b/build/classes/java/main/rsb/methods/Account.class differ
diff --git a/build/classes/java/main/rsb/plugin/BasePanel$1.class b/build/classes/java/main/rsb/plugin/BasePanel$1.class
deleted file mode 100644
index c9250006..00000000
Binary files a/build/classes/java/main/rsb/plugin/BasePanel$1.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/plugin/BasePanel.class b/build/classes/java/main/rsb/plugin/BasePanel.class
deleted file mode 100644
index 099191b6..00000000
Binary files a/build/classes/java/main/rsb/plugin/BasePanel.class and /dev/null differ
diff --git a/build/classes/java/main/rsb/plugin/BotPanel.class b/build/classes/java/main/rsb/plugin/BotPanel.class
index d09d8ad2..70110d13 100644
Binary files a/build/classes/java/main/rsb/plugin/BotPanel.class and b/build/classes/java/main/rsb/plugin/BotPanel.class differ
diff --git a/build/classes/java/main/rsb/plugin/Botplugin.class b/build/classes/java/main/rsb/plugin/Botplugin.class
index cfa34bf1..c0a54dc9 100644
Binary files a/build/classes/java/main/rsb/plugin/Botplugin.class and b/build/classes/java/main/rsb/plugin/Botplugin.class differ
diff --git a/build/classes/java/main/rsb/plugin/ScriptPanel$1.class b/build/classes/java/main/rsb/plugin/ScriptPanel$1.class
index 221d9467..7d397a1f 100644
Binary files a/build/classes/java/main/rsb/plugin/ScriptPanel$1.class and b/build/classes/java/main/rsb/plugin/ScriptPanel$1.class differ
diff --git a/build/classes/java/main/rsb/plugin/ScriptPanel.class b/build/classes/java/main/rsb/plugin/ScriptPanel.class
index 8474cd8c..d5c42101 100644
Binary files a/build/classes/java/main/rsb/plugin/ScriptPanel.class and b/build/classes/java/main/rsb/plugin/ScriptPanel.class differ
diff --git a/build/classes/java/main/rsb/script/Script.class b/build/classes/java/main/rsb/script/Script.class
index ee5ae57b..ea78fd60 100644
Binary files a/build/classes/java/main/rsb/script/Script.class and b/build/classes/java/main/rsb/script/Script.class differ
diff --git a/build/classes/java/main/rsb/script/randoms/LoginBot.class b/build/classes/java/main/rsb/script/randoms/LoginBot.class
index 3d76a93f..996974b5 100644
Binary files a/build/classes/java/main/rsb/script/randoms/LoginBot.class and b/build/classes/java/main/rsb/script/randoms/LoginBot.class differ
diff --git a/build/classes/java/main/rsb/util/AccountStore$Account.class b/build/classes/java/main/rsb/util/AccountStore$Account.class
index b71f4058..8e227692 100644
Binary files a/build/classes/java/main/rsb/util/AccountStore$Account.class and b/build/classes/java/main/rsb/util/AccountStore$Account.class differ
diff --git a/build/classes/java/main/rsb/util/AccountStore.class b/build/classes/java/main/rsb/util/AccountStore.class
index bfc6994d..9f53ce20 100644
Binary files a/build/classes/java/main/rsb/util/AccountStore.class and b/build/classes/java/main/rsb/util/AccountStore.class differ
diff --git a/build/classes/java/main/rsb/util/StringUtil.class b/build/classes/java/main/rsb/util/StringUtil.class
index 89184885..95c37a6a 100644
Binary files a/build/classes/java/main/rsb/util/StringUtil.class and b/build/classes/java/main/rsb/util/StringUtil.class differ
diff --git a/src/main/java/rsb/botLauncher/RuneLite.java b/src/main/java/rsb/botLauncher/RuneLite.java
index dc37abf8..03709679 100644
--- a/src/main/java/rsb/botLauncher/RuneLite.java
+++ b/src/main/java/rsb/botLauncher/RuneLite.java
@@ -57,7 +57,7 @@
import rsb.event.EventManager;
import rsb.event.events.PaintEvent;
import rsb.event.events.TextPaintEvent;
-import rsb.gui.AccountManager;
+import rsb.plugin.AccountManager;
import rsb.internal.BreakHandler;
import rsb.internal.PassiveScriptHandler;
import rsb.internal.ScriptHandler;
diff --git a/src/main/java/rsb/gui/BotGUI.java b/src/main/java/rsb/gui/BotGUI.java
deleted file mode 100644
index 1de18435..00000000
--- a/src/main/java/rsb/gui/BotGUI.java
+++ /dev/null
@@ -1,571 +0,0 @@
-package rsb.gui;
-
-import net.runelite.api.Client;
-import rsb.botLauncher.RuneLite;
-import rsb.internal.PassiveScriptHandler;
-import rsb.internal.ScriptHandler;
-import rsb.internal.TextAreaLogHandler;
-import rsb.internal.listener.PassiveScriptListener;
-import rsb.internal.listener.ScriptListener;
-import rsb.methods.Environment;
-import rsb.script.PassiveScript;
-import rsb.script.Script;
-import rsb.script.ScriptManifest;
-import rsb.internal.globval.GlobalConfiguration;
-import rsb.util.ScreenshotUtil;
-import rsb.util.WindowUtil;
-
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.lang.reflect.Method;
-import java.util.*;
-import java.util.List;
-import java.util.logging.Logger;
-
-/**
- * @author GigiaJ
- */
-public class BotGUI extends JFrame implements ActionListener, ScriptListener, PassiveScriptListener {
- public static String[] args;
- public static final int PANEL_WIDTH = 765, PANEL_HEIGHT = 503, LOG_HEIGHT = 120;
- private static final long serialVersionUID = -5411033752001988794L;
- private static final Logger log = Logger.getLogger(BotGUI.class.getName());
- private BotPanel panel;
- private JScrollPane scrollableBotPanel;
- private BotToolBar toolBar;
- private BotMenuBar menuBar;
- private JScrollPane textScroll;
- private BotHome home;
- private final List bots = new ArrayList<>();
- private boolean showAds = true;
- private boolean disableConfirmations = false;
- //private static final ScriptDeliveryNetwork sdn = ScriptDeliveryNetwork.getInstance();
- private final List noModificationBots = new ArrayList();
-
- public BotGUI(String[] args) {
- init();
- pack();
- this.args = args;
- setTitle("RuneLite");
- setLocationRelativeTo(getOwner());
- setMinimumSize(getSize());
- setResizable(true);
- menuBar.loadPrefs();
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- JPopupMenu.setDefaultLightWeightPopupEnabled(false);
- ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
- }
- });
- }
-
- @Override
- public void setTitle(String title) {
- super.setTitle(title);
- }
-
- public void actionPerformed(ActionEvent evt) {
- String action = evt.getActionCommand();
- String menu, option;
- int z = action.indexOf('.');
- if (z == -1) {
- menu = action;
- option = "";
- } else {
- menu = action.substring(0, z);
- option = action.substring(z + 1);
- }
- if (menu.equals("Close")) {
- if (confirmRemoveBot()) {
- int idx = Integer.parseInt(option);
- removeBot(bots.get(idx - 1));
- }
- } else if (menu.equals("File")) {
- if (option.equals("New Bot")) {
- addBot(args);
- } else if (option.equals("Close Bot")) {
- if (confirmRemoveBot()) {
- removeBot(getCurrentBot());
- }
- } else if (option.equals("Run Script")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- showScriptSelector(current);
- }
- } else if (option.equals("Stop Script")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- showStopScript(current);
- }
- } else if (option.equals("Pause Script")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- pauseScript(current);
- }
- } else if (option.equals("Save Screenshot")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- ScreenshotUtil.saveScreenshot(current, current.getMethodContext().game.isLoggedIn());
- }
- } else if (option.equals("Exit")) {
- cleanExit();
- }
- } else if (menu.equals("Edit")) {
- if (option.equals("Accounts")) {
- AccountManager.getInstance().showGUI();
- } else if (option.equals("Disable Advertisements")) {
- showAds = !((JCheckBoxMenuItem) evt.getSource()).isSelected();
- } else if (option.equals("Disable Confirmations")) {
- disableConfirmations = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- } else {
- RuneLite current = getCurrentBot();
- if (current != null) {
- if (option.equals("Force Input")) {
- boolean selected = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- current.overrideInput = selected;
- toolBar.setOverrideInput(selected);
- } else if (option.equals("Disable Rendering")) {
- current.disableRendering = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- } else if (option.equals("Disable Canvas")) {
- current.disableCanvas = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- current.changeCanvasState();
- } else if (option.equals("Disable Anti-Randoms")) {
- current.disableRandoms = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- } else if (option.equals("Disable Auto Login")) {
- current.disableAutoLogin = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- }
- }
- }
- } else if (menu.equals("View")) {
- RuneLite current = getCurrentBot();
- boolean selected = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
- if (option.equals("Hide Toolbar")) {
- toggleViewState(toolBar, selected);
- } else if (option.equals("Hide Log Window")) {
- toggleViewState(textScroll, selected);
- } else if (current != null) {
- if (option.equals("All Debugging")) {
- for (String key : BotMenuBar.DEBUG_MAP.keySet()) {
- Class> el = BotMenuBar.DEBUG_MAP.get(key);
- boolean wasSelected = menuBar.getCheckBox(key).isSelected();
- menuBar.getCheckBox(key).setSelected(selected);
- if (selected) {
- if (!wasSelected) {
- current.addListener(el);
- }
- } else {
- if (wasSelected) {
- current.removeListener(el);
- }
- }
- }
- } else {
- Class> el = BotMenuBar.DEBUG_MAP.get(option);
- menuBar.getCheckBox(option).setSelected(selected);
- if (selected) {
- current.addListener(el);
- } else {
- menuBar.getCheckBox("All Debugging").setSelected(false);
- current.removeListener(el);
- }
- }
- }
- } else if (menu.equals("Help")) {
- if (option.equals("Site")) {
- openURL(GlobalConfiguration.Paths.URLs.SITE);
- } else if (option.equals("Project")) {
- openURL(GlobalConfiguration.Paths.URLs.PROJECT);
- } else if (option.equals("About")) {
- JOptionPane.showMessageDialog(this, new String[]{"An open source bot developed by the community.", "Visit " + GlobalConfiguration.Paths.URLs.SITE + "/ for more information."}, "About", JOptionPane.INFORMATION_MESSAGE);
- }
- } else if (menu.equals("Tab")) {
- RuneLite curr = getCurrentBot();
- menuBar.setBot(curr);
- panel.setBot(curr);
- panel.repaint();
- toolBar.setHome(curr == null);
- if (curr == null) {
- setTitle(null);
- toolBar.setScriptButton(BotToolBar.RUN_SCRIPT);
- toolBar.setOverrideInput(false);
- toolBar.setInputState(Environment.INPUT_KEYBOARD | Environment.INPUT_MOUSE);
- toolBar.updateInputButton();
- } else {
- setTitle(curr.getAccountName());
- Map scriptMap = curr.getScriptHandler().getRunningScripts();
- if (scriptMap.size() > 0) {
- if (scriptMap.values().iterator().next().isPaused()) {
- toolBar.setScriptButton(BotToolBar.RESUME_SCRIPT);
- } else {
- toolBar.setScriptButton(BotToolBar.PAUSE_SCRIPT);
- }
- } else {
- toolBar.setScriptButton(BotToolBar.RUN_SCRIPT);
- }
- toolBar.setOverrideInput(curr.overrideInput);
- toolBar.setInputState(curr.inputFlags);
- toolBar.updateInputButton();
- }
- } else if (menu.equals("Run")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- showScriptSelector(current);
- }
- } else if (menu.equals("Pause") || menu.equals("Resume")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- pauseScript(current);
- }
- } else if (menu.equals("Input")) {
- RuneLite current = getCurrentBot();
- if (current != null) {
- boolean override = !current.overrideInput;
- current.overrideInput = override;
- menuBar.setOverrideInput(override);
- toolBar.setOverrideInput(override);
- toolBar.updateInputButton();
- }
- }
- }
-
-
- public BotPanel getPanel() {
- return panel;
- }
-
- public RuneLite getBot(Object o) {
- ClassLoader cl = o.getClass().getClassLoader();
- for (RuneLite bot : bots) {
- if (cl == bot.getClass().getClassLoader()) {
- panel.offset();
- return bot;
- }
- }
- return null;
- }
-
- public void addBot(String[] args) {
- final int max = 6;
- if (bots.size() >= max && GlobalConfiguration.RUNNING_FROM_JAR) {
- log.warning("Cannot run more than " + Integer.toString(max) + " bots");
- return;
- }
-
- try {
- RuneLite bot = new RuneLite();
-
- new Thread(new Runnable() {
- public void run() {
- synchronized (bot) {
- try {
- //bot.launch(args);
- bot.setPanel(new ClientPanel(bot.getLoader()));
- bot.setMethodContext();
- bot.getScriptHandler().init();
- bots.add(bot);
- toolBar.addTab();
- bot.getScriptHandler().addScriptListener(BotGUI.this);
- bot.getPassiveScriptHandler().addScriptListener(BotGUI.this);
- home.setBots(bots);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
- }).start();
-
- } catch (Exception e) {
-
- }
- }
-
- public void removeBot(final RuneLite bot) {
- int idx = bots.indexOf(bot);
- if (idx >= 0) {
- toolBar.removeTab(idx + 1);
- }
-
- new Thread(new Runnable() {
- public void run() {
-
- bot.shutdown();
- System.gc();
-
- }
- }).start();
- bots.remove(idx);
- if (bots.size() > 0)
- panel.setBot(bots.get(0));
- toolBar.setSelection(5);
- bot.getScriptHandler().stopAllScripts();
- bot.getScriptHandler().removeScriptListener(this);
- bot.getPassiveScriptHandler().stopAllScripts();
- bot.getPassiveScriptHandler().removeScriptListener(this);
- home.setBots(bots);
- }
-
- void pauseScript(RuneLite bot) {
- ScriptHandler sh = bot.getScriptHandler();
- Map running = sh.getRunningScripts();
- if (running.size() > 0) {
- int id = running.keySet().iterator().next();
- sh.pauseScript(id);
- }
- }
-
- private RuneLite getCurrentBot() {
- int idx = toolBar.getCurrentTab() - 1;
- if (idx >= 0) {
- return bots.get(idx);
- }
- return null;
- }
-
- private void showScriptSelector(RuneLite bot) {
- if (AccountManager.getAccountNames() == null || AccountManager.getAccountNames().length == 0) {
- JOptionPane.showMessageDialog(this, "No accounts found! Please create one before using the bot.");
- AccountManager.getInstance().showGUI();
- } else if (bot.getMethodContext() == null) {
- JOptionPane.showMessageDialog(this, "The client is not currently loaded!");
- } else {
- new ScriptSelector(this, bot).showGUI();
- }
- }
-
- private void showStopScript(RuneLite bot) {
- ScriptHandler sh = bot.getScriptHandler();
- Map running = sh.getRunningScripts();
- if (running.size() > 0) {
- int id = running.keySet().iterator().next();
- Script s = running.get(id);
- ScriptManifest prop = s.getClass().getAnnotation(ScriptManifest.class);
- int result = JOptionPane.showConfirmDialog(this, "Would you like to stop the script " + prop.name() + "?", "Script", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
- if (result == JOptionPane.OK_OPTION) {
- sh.stopScript(id);
- toolBar.setScriptButton(BotToolBar.RUN_SCRIPT);
- }
- }
- }
-
- private void toggleViewState(Component component, boolean visible) {
- Dimension size = getSize();
- size.height += component.getSize().height * (visible ? -1 : 1);
- component.setVisible(!visible);
- setMinimumSize(size);
- if ((getExtendedState() & Frame.MAXIMIZED_BOTH) != Frame.MAXIMIZED_BOTH) {
- pack();
- }
- }
-
- private void lessCpu(final boolean enable) {
- if (enable) {
- noModificationBots.clear();
- for (final RuneLite bot : bots) {
- if (bot.disableCanvas || bot.disableRendering) {
- noModificationBots.add(bot);
- }
- }
- }
- for (final RuneLite bot : bots) {
- boolean restore = !enable && noModificationBots.contains(bot);
- int botIndex = noModificationBots.indexOf(bot);
- RuneLite rBot = restore ? noModificationBots.get(botIndex) : null;
- bot.disableCanvas = rBot != null ? rBot.disableCanvas : enable;
- bot.disableRendering = rBot != null ? rBot.disableRendering : enable;
- }
- }
-
- private void init() {
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- if (cleanExit()) {
- dispose();
- }
- }
- });
- addWindowStateListener(new WindowStateListener() {
- public void windowStateChanged(WindowEvent arg0) {
- switch (arg0.getID()) {
- case WindowEvent.WINDOW_ICONIFIED:
- lessCpu(true);
- break;
- case WindowEvent.WINDOW_DEICONIFIED:
- lessCpu(false);
- break;
- }
- }
- });
- setIconImage(GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON));
- JPopupMenu.setDefaultLightWeightPopupEnabled(false);
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (final Exception ignored) {
- }
- WindowUtil.setFrame(this);
- home = new BotHome();
- panel = new BotPanel(home);
- toolBar = new BotToolBar(this);
- menuBar = new BotMenuBar(this);
- panel.setFocusTraversalKeys(0, new HashSet());
- toolBar.setHome(true);
- menuBar.setBot(null);
- setJMenuBar(menuBar);
- textScroll = new JScrollPane(TextAreaLogHandler.TEXT_AREA, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- textScroll.setBorder(null);
- textScroll.setPreferredSize(new Dimension(PANEL_WIDTH, LOG_HEIGHT));
- textScroll.setVisible(true);
- scrollableBotPanel = new JScrollPane(panel);
- add(toolBar, BorderLayout.NORTH);
- add(scrollableBotPanel, BorderLayout.CENTER);
- add(textScroll, BorderLayout.SOUTH);
- }
-
- public void scriptStarted(final ScriptHandler handler, Script script) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- RuneLite bot = handler.getBot();
- if (bot == getCurrentBot()) {
- bot.inputFlags = Environment.INPUT_KEYBOARD;
- bot.overrideInput = false;
- toolBar.setScriptButton(BotToolBar.PAUSE_SCRIPT);
- toolBar.setInputState(bot.inputFlags);
- toolBar.setOverrideInput(false);
- menuBar.setOverrideInput(false);
- String acct = bot.getAccountName();
- toolBar.setTabLabel(bots.indexOf(bot) + 1, acct == null ? "RuneScape" : acct);
- toolBar.updateInputButton();
- setTitle(acct);
- }
- }
- });
- }
-
- public void scriptStopped(ScriptHandler handler, Script script) {
- RuneLite bot = handler.getBot();
- if (bot == getCurrentBot()) {
- bot.inputFlags = Environment.INPUT_KEYBOARD | Environment.INPUT_MOUSE;
- bot.overrideInput = false;
- toolBar.setScriptButton(BotToolBar.RUN_SCRIPT);
- toolBar.setInputState(bot.inputFlags);
- toolBar.setOverrideInput(false);
- menuBar.setOverrideInput(false);
- menuBar.setPauseScript(false);
- toolBar.setTabLabel(bots.indexOf(bot) + 1, "RuneScape");
- toolBar.updateInputButton();
- setTitle(null);
- }
- }
-
- public void scriptResumed(ScriptHandler handler, Script script) {
- if (handler.getBot() == getCurrentBot()) {
- toolBar.setScriptButton(BotToolBar.PAUSE_SCRIPT);
- menuBar.setPauseScript(false);
- }
- }
-
- public void scriptPaused(ScriptHandler handler, Script script) {
- if (handler.getBot() == getCurrentBot()) {
- toolBar.setScriptButton(BotToolBar.RESUME_SCRIPT);
- menuBar.setPauseScript(true);
- }
- }
-
- public void inputChanged(RuneLite bot, int mask) {
- bot.inputFlags = mask;
- toolBar.setInputState(mask);
- toolBar.updateInputButton();
- }
-
- public static void openURL(final String url) {
- GlobalConfiguration.OperatingSystem os = GlobalConfiguration.getCurrentOperatingSystem();
- try {
- if (os == GlobalConfiguration.OperatingSystem.MAC) {
- Class> fileMgr = Class.forName("com.apple.eio.FileManager");
- Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[]{String.class});
- openURL.invoke(null, url);
- } else if (os == GlobalConfiguration.OperatingSystem.WINDOWS) {
- Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
- } else {
- String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "google-chrome", "chromium-browser"};
- String browser = null;
- for (int count = 0; (count < browsers.length) && (browser == null); count++) {
- if (Runtime.getRuntime().exec(new String[]{"which", browsers[count]}).waitFor() == 0) {
- browser = browsers[count];
- }
- }
- if (browser == null) {
- throw new Exception("Could not find web browser");
- } else {
- Runtime.getRuntime().exec(new String[]{browser, url});
- }
- }
- } catch (Exception e) {
- log.warning("Unable to open " + url);
- }
- }
-
- private boolean confirmRemoveBot() {
- if (!disableConfirmations) {
- int result = JOptionPane.showConfirmDialog(this, "Are you sure you want to close this bot?", "Close Bot", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
- return (result == JOptionPane.OK_OPTION);
- } else {
- return true;
- }
- }
-
- public boolean cleanExit() {
- if (!disableConfirmations) {
- disableConfirmations = true;
- for (RuneLite bot : bots) {
- if (bot.getAccountName() != null) {
- disableConfirmations = true;
- break;
- }
- }
- }
- boolean doExit = true;
- if (!disableConfirmations) {
- final String message = "Are you sure you want to exit?";
- int result = JOptionPane.showConfirmDialog(this, message, "Exit", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
- if (result != JOptionPane.OK_OPTION) {
- doExit = false;
- }
- }
- setVisible(false);
-
- if (doExit) {
- menuBar.savePrefs();
- System.exit(0);
- } else {
- setVisible(true);
- }
- return doExit;
- }
-
- public void scriptStarted(PassiveScriptHandler handler, PassiveScript script) {
- }
-
- public void scriptStopped(PassiveScriptHandler handler, PassiveScript script) {
- }
-
- /**
- * Paint UI related overlays to target graphics
- * @param graphics target graphics
- */
- public static void paintOverlays(final Client client, final Graphics2D graphics)
- {
- if (!(client instanceof Client))
- {
- return;
- }
-
- //PaintDebugs()
- //PaintScriptVisuals
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/gui/BotHome.java b/src/main/java/rsb/gui/BotHome.java
deleted file mode 100644
index 9d108083..00000000
--- a/src/main/java/rsb/gui/BotHome.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package rsb.gui;
-
-import rsb.botLauncher.RuneLite;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.util.Collection;
-
-/**
- * @author GigiaJ
- */
-public class BotHome {
-
- private static final Font FONT = new Font("Helvetica", 1, 13);
- private int width;
- private int height;
- private RuneLite[] bots = new RuneLite[0];
-
- public void setBots(final Collection col) {
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- bots = col.toArray(new RuneLite[col.size()]);
- }
- });
- }
-
- public void setSize(int width, int height) {
- this.width = width;
- this.height = height;
- }
-
- // TODO: Replace; temporary preview.
- public void paint(Graphics g) {
- g.setColor(Color.black);
- g.fillRect(0, 0, width, height);
- int len = Math.min(bots.length, 6);
- if (len == 1) {
- draw(g, 0, 0, 0, width, height);
- } else if (len == 2) {
- draw(g, 0, 0, 0, width, height / 2);
- draw(g, 1, 0, height / 2, width, height / 2);
- } else if (len == 3) {
- draw(g, 0, 0, 0, width / 2, height / 2);
- draw(g, 1, width / 2, 0, width / 2, height / 2);
- draw(g, 2, 0, height / 2, width, height / 2);
- } else if (len == 4) {
- draw(g, 0, 0, 0, width / 2, height / 2);
- draw(g, 1, width / 2, 0, width / 2, height / 2);
- draw(g, 2, 0, height / 2, width / 2, height / 2);
- draw(g, 3, width / 2, height / 2, width / 2, height / 2);
- } else if (len == 5) {
- draw(g, 0, 0, 0, width / 3, height / 2);
- draw(g, 1, width / 3, 0, width / 3, height / 2);
- draw(g, 2, (width * 2) / 3, 0, width / 3, height / 2);
- draw(g, 3, 0, height / 2, width / 2, height / 2);
- draw(g, 4, width / 2, height / 2, width / 2, height / 2);
- } else if (len == 6) {
- draw(g, 0, 0, 0, width / 3, height / 2);
- draw(g, 1, width / 3, 0, width / 3, height / 2);
- draw(g, 2, (width * 2) / 3, 0, width / 3, height / 2);
- draw(g, 3, 0, height / 2, width / 3, height / 2);
- draw(g, 4, width / 3, height / 2, width / 3, height / 2);
- draw(g, 5, (width * 2) / 3, height / 2, width / 3, height / 2);
- } else {
- return;
- }
- FontMetrics metrics = g.getFontMetrics(FONT);
- g.setColor(new Color(0, 0, 0, 170));
- g.fillRect(0, height - 30, width, 30);
- g.setColor(Color.white);
- g.drawString("Spectating " + (bots.length == 1 ? "1 bot." : bots.length + " bots."), 5, height + metrics.getDescent() - 14);
- }
-
- public void draw(Graphics g, int idx, int x, int y, int width, int height) {
- BufferedImage img = bots[idx].getImage();
- if (img != null && img.getWidth() > 0) {
- int w_img = img.getWidth(), h_img = img.getHeight();
- float img_ratio = (float) w_img / (float) h_img;
- float bound_ratio = (float) width / (float) height;
- int w, h;
- if (img_ratio < bound_ratio) {
- h = height;
- w = (int) (((float) w_img / (float) h_img) * h);
- } else {
- w = width;
- h = (int) (((float) h_img / (float) w_img) * w);
- }
- g.drawImage(img.getScaledInstance(w, h, Image.SCALE_SMOOTH), x + width / 2 - w / 2, y + height / 2 - h / 2, null);
- g.setColor(Color.gray);
- g.drawRect(x, y, width - 1, height - 1);
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/gui/BotMenuBar.java b/src/main/java/rsb/gui/BotMenuBar.java
deleted file mode 100644
index 527b9790..00000000
--- a/src/main/java/rsb/gui/BotMenuBar.java
+++ /dev/null
@@ -1,269 +0,0 @@
-package rsb.gui;
-
-import rsb.botLauncher.RuneLite;
-import rsb.event.impl.*;
-import rsb.event.listener.PaintListener;
-import rsb.event.listener.TextPaintListener;
-import rsb.internal.globval.GlobalConfiguration;
-
-import javax.swing.*;
-import java.awt.event.ActionListener;
-import java.io.*;
-import java.util.*;
-import java.util.Map.Entry;
-
-public class BotMenuBar extends JMenuBar {
- private static final long serialVersionUID = 971579975301998332L;
- public static final Map> DEBUG_MAP = new LinkedHashMap>();
- public static final String[] TITLES;
- public static final String[][] ELEMENTS;
-
- static {
-
- // Text
- DEBUG_MAP.put("Game State", TLoginIndex.class);
- DEBUG_MAP.put("Current Tab", TTab.class);
- DEBUG_MAP.put("Camera", TCamera.class);
- DEBUG_MAP.put("Animation", TAnimation.class);
- DEBUG_MAP.put("Floor Height", TFloorHeight.class);
- DEBUG_MAP.put("Player Position", TPlayerPosition.class);
- DEBUG_MAP.put("Mouse Position", TMousePosition.class);
- DEBUG_MAP.put("User Input Allowed", TUserInputAllowed.class);
- DEBUG_MAP.put("Menu Actions", TMenuActions.class);
- DEBUG_MAP.put("Menu", TMenu.class);
- DEBUG_MAP.put("FPS", TFPS.class);
-
- // Paint
- DEBUG_MAP.put("Players", DrawPlayers.class);
- DEBUG_MAP.put("NPCs", DrawNPCs.class);
- DEBUG_MAP.put("Objects", DrawObjects.class);
- DEBUG_MAP.put("Models", DrawModel.class);
- DEBUG_MAP.put("Mouse", DrawMouse.class);
- DEBUG_MAP.put("Inventory", DrawInventory.class);
- DEBUG_MAP.put("Ground Items", DrawItems.class);
- DEBUG_MAP.put("Calc Test", DrawBoundaries.class);
- DEBUG_MAP.put("Settings", DrawSettings.class);
- DEBUG_MAP.put("Web", DrawWeb.class);
-
- // Other
- DEBUG_MAP.put("Log Messages", MessageLogger.class);
-
- TITLES = new String[]{"File", "Edit", "View", "Help"};
- ELEMENTS = new String[][]{
- {"New Bot", "Close Bot", "-",
- /*"Service Key", "-",*/
- "Run Script", "Stop Script", "Pause Script", "-",
- "Save Screenshot", "-",
- "Exit"},
- {"Accounts", "-",
- "ToggleF Force Input", "ToggleF Disable Rendering", "ToggleF Disable Canvas", "-",
- "ToggleF Disable Anti-Randoms", "ToggleF Disable Auto Login", "-",
- "ToggleF Disable Advertisements", "ToggleF Disable Confirmations"}, constructDebugs(),
- {"Site", "Project", "About"}};
- }
-
- private static String[] constructDebugs() {
- List debugItems = new ArrayList();
- debugItems.add("Hide Toolbar");
- debugItems.add("Hide Log Window");
- debugItems.add("All Debugging");
- debugItems.add("-");
- for (String key : DEBUG_MAP.keySet()) {
- Class> el = DEBUG_MAP.get(key);
- if (PaintListener.class.isAssignableFrom(el)) {
- debugItems.add(key);
- }
- }
- debugItems.add("-");
- for (String key : DEBUG_MAP.keySet()) {
- final Class> el = DEBUG_MAP.get(key);
- if (TextPaintListener.class.isAssignableFrom(el)) {
- debugItems.add(key);
- }
- }
- debugItems.add("-");
- for (String key : DEBUG_MAP.keySet()) {
- Class> el = DEBUG_MAP.get(key);
- if (!(TextPaintListener.class.isAssignableFrom(el)) && !(PaintListener.class.isAssignableFrom(el))) {
- debugItems.add(key);
- }
- }
- for (ListIterator it = debugItems.listIterator(); it.hasNext();) {
- String s = it.next();
- if (!s.equals("-")) {
- it.set("ToggleF " + s);
- }
- }
- return debugItems.toArray(new String[debugItems.size()]);
- }
-
- private final Map eventCheckMap = new HashMap();
- private final Map commandCheckMap = new HashMap();
- private final Map commandMenuItem = new HashMap();
- private final ActionListener listener;
-
- public BotMenuBar(ActionListener listener) {
- this.listener = listener;
- for (int i = 0; i < TITLES.length; i++) {
- String title = TITLES[i];
- String[] elems = ELEMENTS[i];
- add(constructMenu(title, elems));
- }
- }
-
- public void setOverrideInput(boolean force) {
- commandCheckMap.get("Force Input").setSelected(force);
- }
-
- public void setPauseScript(boolean pause) {
- commandMenuItem.get("Pause Script").setText(pause ? "Resume Script" : "Pause Script");
- }
-
- public void setBot(RuneLite bot) {
- if (bot == null) {
- commandMenuItem.get("Close Bot").setEnabled(false);
- commandMenuItem.get("Run Script").setEnabled(false);
- commandMenuItem.get("Stop Script").setEnabled(false);
- commandMenuItem.get("Pause Script").setEnabled(false);
- commandMenuItem.get("Save Screenshot").setEnabled(false);
- for (JCheckBoxMenuItem item : eventCheckMap.values()) {
- item.setSelected(false);
- item.setEnabled(false);
- }
- disable("All Debugging", "Force Input", "Disable Rendering", "Disable Canvas", "Disable Anti-Randoms", "Disable Auto Login");
- } else {
- commandMenuItem.get("Close Bot").setEnabled(true);
- commandMenuItem.get("Run Script").setEnabled(true);
- commandMenuItem.get("Stop Script").setEnabled(true);
- commandMenuItem.get("Pause Script").setEnabled(true);
- commandMenuItem.get("Save Screenshot").setEnabled(true);
- int selections = 0;
- for (Entry entry : eventCheckMap.entrySet()) {
- entry.getValue().setEnabled(true);
- boolean selected = bot.hasListener(DEBUG_MAP.get(entry.getKey()));
- entry.getValue().setSelected(selected);
- if (selected) {
- ++selections;
- }
- }
- enable("All Debugging", selections == eventCheckMap.size());
- enable("Force Input", bot.overrideInput);
- enable("Disable Rendering", bot.disableRendering);
- enable("Disable Canvas", bot.disableCanvas);
- enable("Disable Anti-Randoms", bot.disableRandoms);
- enable("Disable Auto Login", bot.disableAutoLogin);
- }
- }
-
- public JCheckBoxMenuItem getCheckBox(String key) {
- return commandCheckMap.get(key);
- }
-
- private void disable(String... items) {
- for (String item : items) {
- commandCheckMap.get(item).setSelected(false);
- commandCheckMap.get(item).setEnabled(false);
- }
- }
-
- public void enable(String item, boolean selected) {
- commandCheckMap.get(item).setSelected(selected);
- commandCheckMap.get(item).setEnabled(true);
- }
-
- public void loadPrefs() {
- String path = GlobalConfiguration.Paths.getMenuBarPrefs();
- if (!new File(path).exists()) {
- return;
- }
- FileReader freader = null;
- BufferedReader in = null;
- try {
- freader = new FileReader(path);
- in = new BufferedReader(freader);
- String line;
- while ((line = in.readLine()) != null) {
- line = line.trim();
- if (commandCheckMap.containsKey(line)) {
- commandCheckMap.get(line).doClick();
- }
- }
- } catch (IOException ioe) {
- try {
- if (in != null) {
- in.close();
- }
- if (freader != null) {
- freader.close();
- }
- } catch (IOException ioe1) {
- }
- }
- }
-
- public void savePrefs() {
- String path = GlobalConfiguration.Paths.getMenuBarPrefs();
- FileWriter fstream = null;
- BufferedWriter out = null;
- try {
- File f = new File(path);
- if (f.exists()) {
- f.delete();
- }
- fstream = new FileWriter(path);
- out = new BufferedWriter(fstream);
- for (Entry item : commandCheckMap.entrySet()) {
- boolean checked = item.getValue().isSelected();
- if (!checked) {
- continue;
- }
- out.write(item.getKey());
- out.newLine();
- }
- } catch (IOException ioe) {
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- if (fstream != null) {
- fstream.close();
- }
- } catch (IOException ioe1) {
- }
- }
- }
-
- private JMenu constructMenu(String title, String[] elems) {
- JMenu menu = new JMenu(title);
- for (String e : elems) {
- if (e.equals("-")) {
- menu.add(new JSeparator());
- } else {
- JMenuItem jmi;
- if (e.startsWith("Toggle")) {
- e = e.substring("Toggle".length());
- char state = e.charAt(0);
- e = e.substring(2);
- jmi = new JCheckBoxMenuItem(e);
- if ((state == 't') || (state == 'T')) {
- jmi.setSelected(true);
- }
- if (DEBUG_MAP.containsKey(e)) {
- JCheckBoxMenuItem ji = (JCheckBoxMenuItem) jmi;
- eventCheckMap.put(e, ji);
- }
- JCheckBoxMenuItem ji = (JCheckBoxMenuItem) jmi;
- commandCheckMap.put(e, ji);
- } else {
- jmi = new JMenuItem(e);
- commandMenuItem.put(e, jmi);
- }
- jmi.addActionListener(listener);
- jmi.setActionCommand(title + "." + e);
- menu.add(jmi);
- }
- }
- return menu;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/gui/BotPanel.java b/src/main/java/rsb/gui/BotPanel.java
deleted file mode 100644
index 848ba69c..00000000
--- a/src/main/java/rsb/gui/BotPanel.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package rsb.gui;
-
-import rsb.botLauncher.RuneLite;
-import rsb.event.EventManager;
-import rsb.methods.Mouse;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-
-import static rsb.methods.Environment.INPUT_KEYBOARD;
-import static rsb.methods.Environment.INPUT_MOUSE;
-
-
-/**
- * @author GigiaJ
- */
-public class BotPanel extends JPanel {
- private static final long serialVersionUID = 2269767882075468055L;
-
- private class HomeUpdater implements Runnable {
- private boolean running;
-
- public void run() {
- synchronized (this) {
- if (running) {
- throw new IllegalStateException("Already running!");
- }
- running = true;
- }
- while (true) {
- synchronized (this) {
- if (!running) {
- break;
- }
- }
- repaint();
- try {
- Thread.sleep(70);
- } catch (Exception ex) {
- break;
- }
- }
- synchronized (this) {
- running = false;
- }
- }
-
- public void stop() {
- synchronized (this) {
- running = false;
- }
- }
- }
-
- private RuneLite bot;
- private BotHome home;
- private HomeUpdater updater;
- private int offX;
- private boolean present;
-
- public BotPanel(BotHome home) {
- this.home = home;
- this.updater = new HomeUpdater();
- setSize(new Dimension(BotGUI.PANEL_WIDTH, BotGUI.PANEL_HEIGHT));
- setMinimumSize(new Dimension(BotGUI.PANEL_WIDTH, BotGUI.PANEL_HEIGHT));
- setPreferredSize(new Dimension(BotGUI.PANEL_WIDTH, BotGUI.PANEL_HEIGHT));
- setBackground(Color.black);
- home.setSize(getWidth(), getHeight());
-
- addMouseListener(new MouseListener() {
- public void mouseClicked(MouseEvent e) {
- redispatch(e);
- if (!hasFocus()) {
- requestFocus();
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- redispatch(e);
- }
-
- public void mousePressed(MouseEvent e) {
- redispatch(e);
- }
-
- public void mouseReleased(MouseEvent e) {
- redispatch(e);
- }
- });
- addMouseMotionListener(new MouseMotionListener() {
- public void mouseDragged(MouseEvent e) {
- redispatch(e);
- }
-
- public void mouseMoved(MouseEvent e) {
- redispatch(e);
- }
- });
- addMouseWheelListener(new MouseWheelListener() {
- public void mouseWheelMoved(MouseWheelEvent e) {
- redispatch(e);
- }
- });
- addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- redispatch(e);
- }
-
- public void keyReleased(KeyEvent e) {
- redispatch(e);
- }
-
- public void keyTyped(KeyEvent e) {
- redispatch(e);
- }
- });
- }
-
- public void offset() {
- if (bot.getCanvas() != null) {
- // center canvas horizontally if not filling container
- offX = (getWidth() - bot.getCanvas().getWidth()) / 2;
- }
- }
-
- public void setBot(RuneLite bot) {
- if (bot != null) {
- this.removeAll();
- this.revalidate();
- this.repaint();
- this.add(bot.getPanel());
- bot.getPanel().requestFocus();
- } else {
- new Thread(updater).start();
- }
- this.bot = bot;
- }
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- if (bot == null) {
- home.paint(g);
- } else if (!bot.disableCanvas) {
- g.drawImage(bot.getImage(), offX, 0, null);
- } else {
- Font font = new Font("Helvetica", 1, 13);
- FontMetrics fontMetrics = getFontMetrics(font);
- g.setColor(Color.black);
- g.fillRect(0, 0, 768, 503);
- g.setColor(new Color(150, 0, 0));
- g.drawRect(230, 233, 303, 33);
- String s = "Canvas disabled...";
- g.setFont(font);
- g.setColor(Color.WHITE);
- g.drawString(s, (768 - fontMetrics.stringWidth(s)) / 2, 255);
- }
- }
-
- private void redispatch(final MouseEvent e) {
- if (bot != null && bot.getLoader().getComponentCount() > 0) {
- Mouse mouse = bot.getMethodContext().mouse;
- if (mouse == null) {
- return; // client cannot currently accept events
- }
- boolean present = mouse.isPresent();
- Component c = bot.getLoader().getComponent(0);
- // account for horizontal offset
- e.translatePoint(-offX, 0);
- // fire human mouse event for scripts
- dispatchHuman(c, e);
- if (!bot.overrideInput && (bot.inputFlags & INPUT_MOUSE) == 0) {
- return;
- }
- if (e.getX() > 0 && e.getX() < c.getWidth() && e.getY() < c.getHeight() && e.getID() != MouseEvent.MOUSE_EXITED) {
- if (present) {
- if (e instanceof MouseWheelEvent) {
- MouseWheelEvent mwe = (MouseWheelEvent) e;
- c.dispatchEvent(new MouseWheelEvent(c, e.getID(), System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, e.isPopupTrigger(), mwe.getScrollType(), mwe.getScrollAmount(), mwe.getWheelRotation()));
- } else {
- c.dispatchEvent(new MouseEvent(c, e.getID(), System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, e.isPopupTrigger(), e.getButton()));
- }
- } else {
- c.dispatchEvent(new MouseEvent(c, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, false));
- }
- } else if (present) {
- c.dispatchEvent(new MouseEvent(c, MouseEvent.MOUSE_EXITED, System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, false));
- }
- }
-
- }
-
- private void redispatch(KeyEvent e) {
- if (bot != null) {
- EventManager m = bot.getEventManager();
- if (m != null) {
- m.dispatchEvent(e);
- }
- if ((bot.overrideInput || (bot.inputFlags & INPUT_KEYBOARD) != 0) && bot.getLoader().getComponentCount() > 0) {
- Component c = bot.getLoader().getComponent(0);
- c.dispatchEvent(e);
- }
- }
- }
-
- private void dispatchHuman(Component c, MouseEvent e) {
- if (e.getX() > 0 && e.getX() < c.getWidth() && e.getY() < c.getHeight() && e.getID() != MouseEvent.MOUSE_EXITED) {
- if (present) {
- bot.getEventManager().dispatchEvent(e);
- } else {
- present = true;
- bot.getEventManager().dispatchEvent(new MouseEvent(c, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, false));
- }
- } else if (present) {
- present = false;
- bot.getEventManager().dispatchEvent(new MouseEvent(c, MouseEvent.MOUSE_EXITED, System.currentTimeMillis(), 0, e.getX(), e.getY(), 0, false));
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/gui/BotToolBar.java b/src/main/java/rsb/gui/BotToolBar.java
deleted file mode 100644
index ec28f8b1..00000000
--- a/src/main/java/rsb/gui/BotToolBar.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package rsb.gui;
-
-import rsb.methods.Environment;
-import rsb.internal.globval.GlobalConfiguration;
-
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-import java.awt.*;
-import java.awt.event.*;
-
-public class BotToolBar extends JToolBar {
-
- private static final long serialVersionUID = -1861866523519184211L;
-
- public static final int RUN_SCRIPT = 0;
- public static final int PAUSE_SCRIPT = 1;
- public static final int RESUME_SCRIPT = 2;
-
- public static final ImageIcon ICON_HOME;
- public static final ImageIcon ICON_BOT;
-
- public static final Image IMAGE_CLOSE;
- public static final Image IMAGE_CLOSE_OVER;
-
- static {
- ICON_HOME = new ImageIcon(GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_HOME));
- ICON_BOT = new ImageIcon(GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_BOT));
- IMAGE_CLOSE = GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_CLOSE);
- IMAGE_CLOSE_OVER = GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_CLOSE_OVER);
- }
-
- private JButton userInputButton;
- private JButton runScriptButton;
-
- private ActionListener listener;
- private int idx;
- private int inputState = Environment.INPUT_KEYBOARD | Environment.INPUT_MOUSE;
- private boolean inputOverride = true;
-
- public BotToolBar(ActionListener listener) {
- this.listener = listener;
-
- userInputButton = new JButton("Input", new ImageIcon(getInputImage(inputOverride, inputState)));
- userInputButton.addActionListener(listener);
- userInputButton.setFocusable(false);
-
- runScriptButton = new JButton("Run", new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_PLAY)));
- runScriptButton.addActionListener(listener);
- runScriptButton.setFocusable(false);
-
- HomeButton home = new HomeButton(ICON_HOME);
-
- setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
- setFloatable(false);
- add(home);
- add(new AddButton(listener));
- add(Box.createHorizontalGlue());
- add(runScriptButton);
- add(userInputButton);
-
- updateSelection(false);
- }
-
- public void addTab() {
- int idx = getComponentCount() - 4;
- add(new BotButton("RuneScape", ICON_BOT), idx);
- validate();
- setSelection(idx);
- }
-
- public void removeTab(int idx) {
- remove(idx);
- revalidate();
- repaint();
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- setSelection(0);
- }
- });
- }
-
- public void setTabLabel(int idx, String label) {
- ((BotButton) getComponentAtIndex(idx)).setText(label);
- }
-
- public int getCurrentTab() {
- if (idx > -1 && idx < getComponentCount() - 3) {
- return idx;
- } else {
- return -1;
- }
- }
-
- public int getScriptButton() {
- String label = runScriptButton.getText();
- if (label.equals("Run")) {
- return RUN_SCRIPT;
- } else if (label.equals("Pause")) {
- return PAUSE_SCRIPT;
- } else if (label.equals("Resume")) {
- return RESUME_SCRIPT;
- } else {
- throw new IllegalStateException("Illegal script button state!");
- }
- }
-
- public void setHome(boolean home) {
- userInputButton.setEnabled(!home);
- runScriptButton.setEnabled(!home);
- }
-
- public void setInputState(int state) {
- inputState = state;
- }
-
- public void setOverrideInput(boolean selected) {
- inputOverride = selected;
- }
-
- public void updateInputButton() {
- userInputButton.setIcon(new ImageIcon(getInputImage(inputOverride, inputState)));
- }
-
- public void setScriptButton(int state) {
- String text, pathResource;
-
- if (state == RUN_SCRIPT) {
- text = "Run";
- pathResource = GlobalConfiguration.Paths.Resources.ICON_PLAY;
- } else if (state == PAUSE_SCRIPT) {
- text = "Pause";
- pathResource = GlobalConfiguration.Paths.Resources.ICON_PAUSE;
- } else if (state == RESUME_SCRIPT) {
- text = "Resume";
- pathResource = GlobalConfiguration.Paths.Resources.ICON_PLAY;
- } else {
- throw new IllegalArgumentException("Illegal button state: " + state + "!");
- }
-
- runScriptButton.setText(text);
- runScriptButton.setIcon(new ImageIcon(GlobalConfiguration.getImage(pathResource)));
- revalidate();
- }
-
- public void setSelection(int idx) {
- updateSelection(true);
- this.idx = idx;
- updateSelection(false);
- listener.actionPerformed(new ActionEvent(this, 0, "Tab"));
- }
-
- private void updateSelection(boolean enabled) {
- int idx = getCurrentTab();
- if (idx >= 0) {
- getComponent(idx).setEnabled(enabled);
- getComponent(idx).repaint();
- }
- }
-
- private Image getInputImage(boolean override, int state) {
- if (override || state == (Environment.INPUT_KEYBOARD | Environment.INPUT_MOUSE)) {
- return GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_TICK);
- } else if (state == Environment.INPUT_KEYBOARD) {
- return GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_KEYBOARD);
- } else if (state == Environment.INPUT_MOUSE) {
- return GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_MOUSE);
- } else {
- return GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_DELETE);
- }
- }
-
- /**
- * @author GigiaJ
- */
- private class HomeButton extends JPanel {
-
- private static final long serialVersionUID = 938456324328L;
-
- private Image image;
- private boolean hovered;
-
- public HomeButton(ImageIcon icon) {
- super(new BorderLayout());
- this.image = icon.getImage();
- setBorder(new EmptyBorder(3, 6, 2, 3));
- setPreferredSize(new Dimension(24, 22));
- setMaximumSize(new Dimension(24, 22));
- setFocusable(false);
- addMouseListener(new MouseAdapter() {
- public void mouseReleased(MouseEvent e) {
- setSelection(getComponentIndex(HomeButton.this));
- }
-
- public void mouseEntered(MouseEvent e) {
- hovered = true;
- repaint();
- }
-
- public void mouseExited(MouseEvent e) {
- hovered = false;
- repaint();
- }
- });
- }
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- if (getComponentIndex(this) == idx) {
- g.setColor(new Color(255, 255, 255, 200));
- g.fillRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- g.setColor(new Color(180, 180, 180, 200));
- g.drawRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- } else if (hovered) {
- g.setColor(new Color(255, 255, 255, 150));
- g.fillRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- g.setColor(new Color(180, 180, 180, 150));
- g.drawRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- }
- g.drawImage(image, 3, 3, null);
- }
-
- }
-
- /**
- * @author Tekk
- */
- private class BotButton extends JPanel {
-
- private static final long serialVersionUID = 329845763420L;
-
- private JLabel nameLabel;
- private boolean hovered;
- private boolean close;
-
- public BotButton(String text, Icon icon) {
- super(new BorderLayout());
- setBorder(new EmptyBorder(3, 6, 2, 3));
- nameLabel = new JLabel(text);
- nameLabel.setIcon(icon);
- nameLabel.setPreferredSize(new Dimension(85, 22));
- nameLabel.setMaximumSize(new Dimension(85, 22));
- add(nameLabel, BorderLayout.WEST);
-
- setPreferredSize(new Dimension(110, 22));
- setMaximumSize(new Dimension(110, 22));
- setFocusable(false);
- addMouseListener(new MouseAdapter() {
- public void mouseReleased(MouseEvent e) {
- if (hovered && close) {
- int idx = BotToolBar.this.getComponentIndex(BotButton.this);
- listener.actionPerformed(new ActionEvent(this,
- ActionEvent.ACTION_PERFORMED, "Close." + idx));
- } else {
- setSelection(getComponentIndex(BotButton.this));
- }
- }
-
- public void mouseEntered(MouseEvent e) {
- hovered = true;
- repaint();
- }
-
- public void mouseExited(MouseEvent e) {
- hovered = false;
- repaint();
- }
- });
- addMouseMotionListener(new MouseMotionAdapter() {
- public void mouseMoved(MouseEvent e) {
- close = e.getX() > 95;
- repaint();
- }
- });
- }
-
- public void setText(String label) {
- nameLabel.setText(label);
- }
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- int RGB = getComponentIndex(this) == idx ? 255 : hovered ? 230 : 215;
- g.setColor(new Color(RGB, RGB, RGB, 200));
- g.fillRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- g.setColor(new Color(180, 180, 180, 200));
- g.drawRoundRect(0, 0, getWidth() - 2, getHeight() - 1, 4, 4);
- g.drawImage(hovered && close ? IMAGE_CLOSE_OVER : IMAGE_CLOSE, 90, 3, null);
- repaint();
- }
- }
-
- private static class AddButton extends JComponent {
-
- private static final long serialVersionUID = 1L;
-
- private static final Image ICON;
- private static final Image ICON_OVER;
- private static final Image ICON_DOWN;
- private boolean hovered = false;
- private boolean pressed = false;
-
- static {
- ICON = GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_ADD);
- ICON_OVER = GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_ADD_OVER);
- ICON_DOWN = GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_ADD_DOWN);
- }
-
- public AddButton(final ActionListener listener) {
- setPreferredSize(new Dimension(20, 20));
- setMaximumSize(new Dimension(20, 20));
- setFocusable(false);
- addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- hovered = true;
- repaint();
- }
-
- public void mouseExited(MouseEvent e) {
- hovered = false;
- repaint();
- }
-
- public void mousePressed(MouseEvent e) {
- pressed = true;
- repaint();
- }
-
- public void mouseReleased(MouseEvent e) {
- pressed = false;
- repaint();
- listener.actionPerformed(new ActionEvent(this, e.getID(), "File.New Bot"));
- }
- });
- }
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- if (pressed) {
- g.drawImage(ICON_DOWN, 2, 2, null);
- } else if (hovered) {
- g.drawImage(ICON_OVER, 2, 2, null);
- } else {
- g.drawImage(ICON, 2, 2, null);
- }
- repaint();
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/gui/ClientPanel.java b/src/main/java/rsb/gui/ClientPanel.java
deleted file mode 100644
index c0766283..00000000
--- a/src/main/java/rsb/gui/ClientPanel.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-package rsb.gui;
-
-import java.applet.Applet;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import javax.annotation.Nullable;
-import javax.swing.JPanel;
-import net.runelite.api.Client;
-import net.runelite.api.Constants;
-
-final class ClientPanel extends JPanel
-{
- public ClientPanel(@Nullable Applet client)
- {
- setSize(Constants.GAME_FIXED_SIZE);
- setMinimumSize(Constants.GAME_FIXED_SIZE);
- setPreferredSize(Constants.GAME_FIXED_SIZE);
- setLayout(new BorderLayout());
- setBackground(Color.black);
-
- if (client == null)
- {
- return;
- }
-
- add(client, BorderLayout.CENTER);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/rsb/images/add.png b/src/main/java/rsb/images/add.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/add.png and /dev/null differ
diff --git a/src/main/java/rsb/images/add_down.png b/src/main/java/rsb/images/add_down.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/add_down.png and /dev/null differ
diff --git a/src/main/java/rsb/images/add_over.png b/src/main/java/rsb/images/add_over.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/add_over.png and /dev/null differ
diff --git a/src/main/java/rsb/images/bot.png b/src/main/java/rsb/images/bot.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/bot.png and /dev/null differ
diff --git a/src/main/java/rsb/images/close.png b/src/main/java/rsb/images/close.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/close.png and /dev/null differ
diff --git a/src/main/java/rsb/images/close_over.png b/src/main/java/rsb/images/close_over.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/close_over.png and /dev/null differ
diff --git a/src/main/java/rsb/images/connect.png b/src/main/java/rsb/images/connect.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/connect.png and /dev/null differ
diff --git a/src/main/java/rsb/images/control_pause.png b/src/main/java/rsb/images/control_pause.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/control_pause.png and /dev/null differ
diff --git a/src/main/java/rsb/images/control_play.png b/src/main/java/rsb/images/control_play.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/control_play.png and /dev/null differ
diff --git a/src/main/java/rsb/images/control_play_blue.png b/src/main/java/rsb/images/control_play_blue.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/control_play_blue.png and /dev/null differ
diff --git a/src/main/java/rsb/images/delete.png b/src/main/java/rsb/images/delete.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/delete.png and /dev/null differ
diff --git a/src/main/java/rsb/images/disconnect.png b/src/main/java/rsb/images/disconnect.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/disconnect.png and /dev/null differ
diff --git a/src/main/java/rsb/images/home.png b/src/main/java/rsb/images/home.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/home.png and /dev/null differ
diff --git a/src/main/java/rsb/images/icon.png b/src/main/java/rsb/images/icon.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/icon.png and /dev/null differ
diff --git a/src/main/java/rsb/images/keyboard.png b/src/main/java/rsb/images/keyboard.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/keyboard.png and /dev/null differ
diff --git a/src/main/java/rsb/images/mouse.png b/src/main/java/rsb/images/mouse.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/mouse.png and /dev/null differ
diff --git a/src/main/java/rsb/images/script_bdl.png b/src/main/java/rsb/images/script_bdl.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/script_bdl.png and /dev/null differ
diff --git a/src/main/java/rsb/images/script_drm.png b/src/main/java/rsb/images/script_drm.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/script_drm.png and /dev/null differ
diff --git a/src/main/java/rsb/images/script_pre.png b/src/main/java/rsb/images/script_pre.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/script_pre.png and /dev/null differ
diff --git a/src/main/java/rsb/images/script_src.png b/src/main/java/rsb/images/script_src.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/script_src.png and /dev/null differ
diff --git a/src/main/java/rsb/images/tick.png b/src/main/java/rsb/images/tick.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/tick.png and /dev/null differ
diff --git a/src/main/java/rsb/images/world_link.png b/src/main/java/rsb/images/world_link.png
deleted file mode 100644
index 254a95a3..00000000
Binary files a/src/main/java/rsb/images/world_link.png and /dev/null differ
diff --git a/src/main/java/rsb/internal/TextAreaLogHandler.java b/src/main/java/rsb/internal/TextAreaLogHandler.java
index 9b631bea..e073869d 100644
--- a/src/main/java/rsb/internal/TextAreaLogHandler.java
+++ b/src/main/java/rsb/internal/TextAreaLogHandler.java
@@ -1,6 +1,6 @@
package rsb.internal;
-import rsb.gui.LogTextArea;
+import rsb.plugin.LogTextArea;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
diff --git a/src/main/java/rsb/internal/globval/GlobalConfiguration.java b/src/main/java/rsb/internal/globval/GlobalConfiguration.java
index bcf5a3fa..68acf6f4 100644
--- a/src/main/java/rsb/internal/globval/GlobalConfiguration.java
+++ b/src/main/java/rsb/internal/globval/GlobalConfiguration.java
@@ -1,6 +1,5 @@
package rsb.internal.globval;
-import javax.swing.filechooser.FileSystemView;
import java.awt.*;
import java.io.*;
import java.net.HttpURLConnection;
@@ -18,31 +17,9 @@ public enum OperatingSystem {
public static class Paths {
public static class Resources {
- public static final String ROOT = "../../../rsb";//"runelite-client/src/main/java/net/runelite/client/rsb";
- public static final String ROOT_IMG = ROOT + "/images";
- public static final String ICON = ROOT_IMG + "/icon.png";
- public static final String ICON_DELETE = ROOT_IMG + "/delete.png";
- public static final String ICON_PLAY = ROOT_IMG + "/control_play_blue.png";
- public static final String ICON_PAUSE = ROOT_IMG + "/control_pause.png";
- public static final String ICON_ADD = ROOT_IMG + "/add.png";
- public static final String ICON_ADD_OVER = ROOT_IMG + "/add_over.png";
- public static final String ICON_ADD_DOWN = ROOT_IMG + "/add_down.png";
- public static final String ICON_HOME = ROOT_IMG + "/home.png";
- public static final String ICON_BOT = ROOT_IMG + "/bot.png";
- public static final String ICON_CLOSE = ROOT_IMG + "/close.png";
- public static final String ICON_CLOSE_OVER = ROOT_IMG + "/close_over.png";
- public static final String ICON_TICK = ROOT_IMG + "/tick.png";
- public static final String ICON_MOUSE = ROOT_IMG + "/mouse.png";
- public static final String ICON_KEYBOARD = ROOT_IMG + "/keyboard.png";
- public static final String ICON_CONNECT = ROOT_IMG + "/connect.png";
- public static final String ICON_DISCONNECT = ROOT_IMG + "/disconnect.png";
- public static final String ICON_START = ROOT_IMG + "/control_play.png";
- public static final String ICON_SCRIPT_BDL = ROOT_IMG + "/script_bdl.png";
- public static final String ICON_SCRIPT_DRM = ROOT_IMG + "/script_drm.png";
- public static final String ICON_SCRIPT_PRE = ROOT_IMG + "/script_pre.png";
- public static final String ICON_SCRIPT_SRC = ROOT_IMG + "/script_src.png";
- public static final String ICON_WEBLINK = ROOT_IMG + "/world_link.png";
-
+ public static final String ROOT = "../../../rsb";
+ public static final String ROOT_IMG = ROOT ;//+ "/images";
+ public static final String ICON = GlobalConfiguration.class.getResource("rsb/plugin/rsb.png").getPath();
public static final String VERSION = ROOT + "/version.txt";
}
diff --git a/src/main/java/rsb/methods/Account.java b/src/main/java/rsb/methods/Account.java
index 800aa09a..5c7cfda5 100644
--- a/src/main/java/rsb/methods/Account.java
+++ b/src/main/java/rsb/methods/Account.java
@@ -1,6 +1,6 @@
package rsb.methods;
-import rsb.gui.AccountManager;
+import rsb.plugin.AccountManager;
import java.util.logging.Logger;
diff --git a/src/main/java/rsb/gui/AccountManager.java b/src/main/java/rsb/plugin/AccountManager.java
similarity index 91%
rename from src/main/java/rsb/gui/AccountManager.java
rename to src/main/java/rsb/plugin/AccountManager.java
index 3d82d417..801b6cdd 100644
--- a/src/main/java/rsb/gui/AccountManager.java
+++ b/src/main/java/rsb/plugin/AccountManager.java
@@ -1,4 +1,4 @@
-package rsb.gui;
+package rsb.plugin;
import lombok.extern.slf4j.Slf4j;
import rsb.util.AccountStore;
@@ -192,29 +192,37 @@ public AccountManager() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JButton) {
String label = ((JButton) e.getSource()).getText();
- if (label.equals("Done")) {
- try {
- accountStore.save();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- log.info("Failed to save accounts... Please report this.");
- }
- dispose();
- } else if (label.equals("Add")) {
- String str = JOptionPane.showInputDialog(getParent(), "Enter the account username.", "New Account", JOptionPane.QUESTION_MESSAGE);
- if (str == null || str.isEmpty()) {
- return;
+ switch (label) {
+ case "Done":
+ try {
+ accountStore.save();
+ Botplugin.getScriptPanel().updateAccountList();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ log.info("Failed to save accounts... Please report this.");
+ }
+ dispose();
+
+ break;
+ case "Add": {
+ String str = JOptionPane.showInputDialog(getParent(), "Enter the account username.", "New Account", JOptionPane.QUESTION_MESSAGE);
+ if (str == null || str.isEmpty()) {
+ return;
+ }
+ accountStore.add(new AccountStore.Account(str));
+ accountStore.get(str).setAttribute("reward", RANDOM_REWARDS[0]);
+ int row = table.getRowCount();
+ ((AccountTableModel) table.getModel()).fireTableRowsInserted(row, row);
+ break;
}
- accountStore.add(new AccountStore.Account(str));
- accountStore.get(str).setAttribute("reward", RANDOM_REWARDS[0]);
- int row = table.getRowCount();
- ((AccountTableModel) table.getModel()).fireTableRowsInserted(row, row);
- } else if (label.equals("Remove")) {
- int row = table.getSelectedRow();
- String user = ((AccountTableModel) table.getModel()).userForRow(row);
- if (user != null) {
- accountStore.remove(user);
- ((AccountTableModel) table.getModel()).fireTableRowsDeleted(row, row);
+ case "Remove": {
+ int row = table.getSelectedRow();
+ String user = ((AccountTableModel) table.getModel()).userForRow(row);
+ if (user != null) {
+ accountStore.remove(user);
+ ((AccountTableModel) table.getModel()).fireTableRowsDeleted(row, row);
+ }
+ break;
}
}
}
diff --git a/src/main/java/rsb/plugin/BasePanel.java b/src/main/java/rsb/plugin/AccountPanel.java
similarity index 95%
rename from src/main/java/rsb/plugin/BasePanel.java
rename to src/main/java/rsb/plugin/AccountPanel.java
index fb1ecb34..94ce3009 100644
--- a/src/main/java/rsb/plugin/BasePanel.java
+++ b/src/main/java/rsb/plugin/AccountPanel.java
@@ -1,8 +1,6 @@
package rsb.plugin;
import rsb.botLauncher.RuneLite;
-import rsb.gui.AccountManager;
-import rsb.gui.ScriptSelector;
import rsb.internal.ScriptHandler;
import rsb.internal.listener.ScriptListener;
import rsb.script.Script;
@@ -20,7 +18,7 @@
/**
* @author GigiaJ
*/
-public class BasePanel extends PluginPanel implements ScriptListener {
+public class AccountPanel extends PluginPanel implements ScriptListener {
private JScrollPane scrollPane1;
private JTable table1;
@@ -28,7 +26,7 @@ public class BasePanel extends PluginPanel implements ScriptListener {
private JButton buttonScripts;
private RuneLite bot;
- public BasePanel(RuneLite bot) {
+ public AccountPanel(RuneLite bot) {
initComponents();
this.bot = bot;
bot.getScriptHandler().init();
diff --git a/src/main/java/rsb/plugin/BotPanel.java b/src/main/java/rsb/plugin/BotPanel.java
index 60baec73..41f5e7f5 100644
--- a/src/main/java/rsb/plugin/BotPanel.java
+++ b/src/main/java/rsb/plugin/BotPanel.java
@@ -26,11 +26,9 @@
package rsb.plugin;
-import lombok.Getter;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.game.ItemManager;
-import rsb.botLauncher.Application;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.materialtabs.MaterialTab;
@@ -67,7 +65,7 @@ private BotPanel(ClientThread clientThread, ItemManager itemManager, ScheduledEx
* @param basePanel
* @param scriptPanel
*/
- protected void associateBot(BasePanel basePanel, ScriptPanel scriptPanel) {
+ protected void associateBot(AccountPanel basePanel, ScriptPanel scriptPanel) {
MaterialTab baseTab = new MaterialTab("Bot", tabGroup, basePanel);
MaterialTab scriptTab = new MaterialTab("Scripts", tabGroup, scriptPanel);
diff --git a/src/main/java/rsb/plugin/Botplugin.java b/src/main/java/rsb/plugin/Botplugin.java
index 1a5aec15..93543f6d 100644
--- a/src/main/java/rsb/plugin/Botplugin.java
+++ b/src/main/java/rsb/plugin/Botplugin.java
@@ -1,18 +1,22 @@
package rsb.plugin;
+import java.awt.*;
import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.imageio.ImageIO;
import javax.inject.Inject;
import com.google.inject.Injector;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
-import net.runelite.client.plugins.account.AccountPlugin;
import rsb.botLauncher.RuneLite;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.ClientToolbar;
-import net.runelite.client.util.ImageUtil;
+import rsb.internal.globval.GlobalConfiguration;
@PluginDescriptor(
name = "Bot panel",
@@ -30,6 +34,10 @@ public Botplugin(Injector injector) {
private NavigationButton navButton;
+ private static ScriptPanel scriptPanel;
+
+ private static AccountPanel accountPanel;
+
@Override
protected void startUp() throws Exception
@@ -37,9 +45,12 @@ protected void startUp() throws Exception
BotPanel panel = injector.getInstance(BotPanel.class);
RuneLite bot = injector.getInstance(RuneLite.class);
- panel.associateBot(new BasePanel(bot), new ScriptPanel(bot));
+ accountPanel = new AccountPanel(bot);
+ scriptPanel = new ScriptPanel(bot);
+
+ panel.associateBot(accountPanel, scriptPanel);
- final BufferedImage icon = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "login_icon.png");
+ BufferedImage icon = imageToBufferedImage(Botplugin.class.getResourceAsStream("rsb.png"));
navButton = NavigationButton.builder()
.tooltip("Bot Interface")
@@ -57,5 +68,29 @@ protected void shutDown()
clientToolbar.removeNavigation(navButton);
}
+ public static BufferedImage imageToBufferedImage(InputStream is) throws IOException {
+ Image im = ImageIO.read(is);
+ BufferedImage bi = new BufferedImage
+ (im.getWidth(null),im.getHeight(null),BufferedImage.TYPE_INT_RGB);
+ Graphics bg = bi.getGraphics();
+ bg.drawImage(im, 0, 0, null);
+ bg.dispose();
+ return bi;
+ }
+
+ public static ScriptPanel getScriptPanel() {
+ return scriptPanel;
+ }
+ public static void setScriptPanel(ScriptPanel scriptPanel) {
+ Botplugin.scriptPanel = scriptPanel;
+ }
+
+ public static AccountPanel getAccountPanel() {
+ return accountPanel;
+ }
+
+ public void setAccountPanel(AccountPanel accountPanel) {
+ Botplugin.accountPanel = accountPanel;
+ }
}
diff --git a/src/main/java/rsb/gui/LogTextArea.java b/src/main/java/rsb/plugin/LogTextArea.java
similarity index 99%
rename from src/main/java/rsb/gui/LogTextArea.java
rename to src/main/java/rsb/plugin/LogTextArea.java
index 36f05160..362d1e63 100644
--- a/src/main/java/rsb/gui/LogTextArea.java
+++ b/src/main/java/rsb/plugin/LogTextArea.java
@@ -1,4 +1,4 @@
-package rsb.gui;
+package rsb.plugin;
import rsb.internal.LogFormatter;
import rsb.internal.globval.GlobalConfiguration;
diff --git a/src/main/java/rsb/plugin/ScriptPanel.java b/src/main/java/rsb/plugin/ScriptPanel.java
index e153111e..540b8fd2 100644
--- a/src/main/java/rsb/plugin/ScriptPanel.java
+++ b/src/main/java/rsb/plugin/ScriptPanel.java
@@ -1,12 +1,8 @@
package rsb.plugin;
import rsb.botLauncher.RuneLite;
-import rsb.gui.AccountManager;
-import rsb.gui.BotToolBar;
-import rsb.gui.ScriptSelector;
import rsb.internal.ScriptHandler;
import rsb.script.Script;
-import rsb.script.ScriptManifest;
import java.awt.event.*;
import java.util.Map;
@@ -22,9 +18,11 @@ public class ScriptPanel extends JPanel {
private JButton buttonStart;
private JButton buttonPause;
private JButton buttonStop;
+ private ScriptSelector scriptSelector;
public ScriptPanel(RuneLite bot) {
this.bot = bot;
+ scriptSelector = new ScriptSelector(bot);
initComponents();
}
@@ -75,9 +73,8 @@ private void buttonStopActionPerformed(ActionEvent e) {
}
private void initComponents() {
- ScriptSelector scriptSelector = new ScriptSelector(bot);
scrollPane1 = new JScrollPane();
- table1 = scriptSelector.getTable(0, 70, 30, 70);
+ table1 = scriptSelector.getTable(0, 70, 45, 30);
comboBoxAccounts = scriptSelector.getAccounts();
buttonStart = scriptSelector.getSubmit();
//Make a search area
@@ -106,39 +103,55 @@ private void initComponents() {
buttonStop.setText("Stop");
buttonStop.addActionListener(e -> buttonStopActionPerformed(e));
+ assignLayouts();
+
+ }
+
+ /**
+ * Assigns the layouts for the script panel
+ */
+ private void assignLayouts() {
GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setHorizontalGroup(
- layout.createParallelGroup()
- .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup()
- .addGroup(layout.createSequentialGroup()
- .addGap(47, 47, 47)
- .addComponent(comboBoxAccounts, GroupLayout.PREFERRED_SIZE, 157, GroupLayout.PREFERRED_SIZE))
+ layout.createParallelGroup()
+ .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(buttonStart, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(buttonPause, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(73, 73, 73)
- .addComponent(buttonStop, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)))
- .addContainerGap(30, Short.MAX_VALUE))
+ .addGroup(layout.createParallelGroup()
+ .addGroup(layout.createSequentialGroup()
+ .addGap(47, 47, 47)
+ .addComponent(comboBoxAccounts, GroupLayout.PREFERRED_SIZE, 157, GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(buttonStart, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(buttonPause, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(73, 73, 73)
+ .addComponent(buttonStop, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(30, Short.MAX_VALUE))
);
layout.setVerticalGroup(
- layout.createParallelGroup()
- .addGroup(layout.createSequentialGroup()
- .addComponent(scrollPane1, GroupLayout.PREFERRED_SIZE, 293, GroupLayout.PREFERRED_SIZE)
- .addGap(28, 28, 28)
- .addComponent(comboBoxAccounts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGap(57, 57, 57)
- .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(buttonStart, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonPause, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))
- .addGap(28, 28, 28)
- .addComponent(buttonStop, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
- .addGap(0, 60, Short.MAX_VALUE))
+ layout.createParallelGroup()
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(scrollPane1, GroupLayout.PREFERRED_SIZE, 240, GroupLayout.PREFERRED_SIZE)
+ .addGap(28, 28, 28)
+ .addComponent(comboBoxAccounts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGap(57, 57, 57)
+ .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonStart, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonPause, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))
+ .addGap(28, 28, 28)
+ .addComponent(buttonStop, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 60, Short.MAX_VALUE))
);
}
+
+ /**
+ * Redefines the list of accounts in the dropdown list with an updated set of values
+ * by reassigning the model
+ */
+ public void updateAccountList() {
+ comboBoxAccounts.setModel(scriptSelector.getAccounts().getModel());
+ }
}
diff --git a/src/main/java/rsb/gui/ScriptSelector.java b/src/main/java/rsb/plugin/ScriptSelector.java
similarity index 86%
rename from src/main/java/rsb/gui/ScriptSelector.java
rename to src/main/java/rsb/plugin/ScriptSelector.java
index b5c27212..76fc43fb 100644
--- a/src/main/java/rsb/gui/ScriptSelector.java
+++ b/src/main/java/rsb/plugin/ScriptSelector.java
@@ -1,4 +1,4 @@
-package rsb.gui;
+package rsb.plugin;
import rsb.botLauncher.RuneLite;
import rsb.internal.ScriptHandler;
@@ -26,6 +26,8 @@
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
+import static rsb.util.StringUtil.convertIntelliJPath;
+
public class ScriptSelector extends JDialog implements ScriptListener {
public static void main(String[] args) {
@@ -55,21 +57,7 @@ public static void main(String[] args) {
private boolean connected = true;
static {
- /**
- * Gets the testsScripts path compiled path and replaces the path with the values needed to direct it to the non-compiled path with the .java file to edit
- */
- StringBuilder temp = new StringBuilder(rsb.testsScript.Test.class.getResource("Test.class").getPath().replace("Test.class", ""));
- String testScriptPath = rsb.testsScript.Test.class.getResource("Test.class").getPath().replace("Test.class", "");
- if (!GlobalConfiguration.RUNNING_FROM_JAR) {
- testScriptPath = testScriptPath.replace("build/classes/java/main", "src/main/java");
- /*
- temp = temp.replace(temp.indexOf("target"), temp.indexOf("target") + "target".length(), "main");
- temp = temp.insert(temp.indexOf("main") - 1, temp.charAt(temp.indexOf("main") - 1) + "src");
- temp = temp.replace(temp.indexOf("classes"), temp.indexOf("classes") + "classes".length(), "java");
- */
- }
- TEST_PATH = testScriptPath;
-
+ TEST_PATH = convertIntelliJPath(rsb.testsScript.Test.class, "Test.class");
SRC_TEST = new FileScriptSource(new File(TEST_PATH));
SRC_SOURCES = new FileScriptSource(new File(GlobalConfiguration.Paths.getScriptsSourcesDirectory()));
SRC_PRECOMPILED = new FileScriptSource(new File(GlobalConfiguration.Paths.getScriptsPrecompiledDirectory()));
@@ -209,17 +197,12 @@ public void windowClosing(final WindowEvent e) {
toolBar.setFloatable(false);
getSubmit();
-
- final JButton connect = new JButton(new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_CONNECT)));
getAccounts();
toolBar.add(search);
toolBar.add(Box.createHorizontalStrut(5));
toolBar.add(accounts);
toolBar.add(Box.createHorizontalStrut(5));
- toolBar.add(connect);
- toolBar.add(Box.createHorizontalStrut(5));
toolBar.add(submit);
JPanel center = new JPanel();
center.setLayout(new BorderLayout());
@@ -273,10 +256,10 @@ private void showMenu(MouseEvent e) {
JPopupMenu contextMenu = new JPopupMenu();
JMenuItem visit = new JMenuItem();
visit.setText("GitHub");
- visit.setIcon(new ImageIcon(GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_WEBLINK)));
+ visit.setIcon(new ImageIcon(GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON)));
visit.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
- //OldBotGUI.openURL(def.website); //Update later
+ //GlobalConfiguration.Paths.URLs.PROJECT; TODO: Update later
}
});
contextMenu.add(visit);
@@ -354,6 +337,7 @@ public void keyTyped(KeyEvent e) {
*/
public JComboBox> getAccounts(){
accounts = new JComboBox(AccountManager.getAccountNames());
+ accounts.setMaximumRowCount(100);
accounts.setMinimumSize(new Dimension(200, 20));
accounts.setPreferredSize(new Dimension(200, 20));
return accounts;
@@ -397,14 +381,6 @@ public void valueChanged(ListSelectionEvent evt) {
private static class ScriptTableModel extends AbstractTableModel {
private static final long serialVersionUID = 1L;
- public static final ImageIcon ICON_SCRIPT_SRC = new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_SCRIPT_SRC));
- public static final ImageIcon ICON_SCRIPT_PRE = new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_SCRIPT_PRE));
- public static final ImageIcon ICON_SCRIPT_DRM = new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_SCRIPT_DRM));
- public static final ImageIcon ICON_SCRIPT_BDL = new ImageIcon(
- GlobalConfiguration.getImage(GlobalConfiguration.Paths.Resources.ICON_SCRIPT_BDL));
private final List scripts;
private final List matches;
@@ -450,18 +426,6 @@ public int getColumnCount() {
public Object getValueAt(int rowIndex, int columnIndex) {
if (rowIndex >= 0 && rowIndex < matches.size()) {
ScriptDefinition def = matches.get(rowIndex);
- if (columnIndex == 0) {
- if (def.source == SRC_SOURCES) {
- return ICON_SCRIPT_SRC;
- }
- if (def.source == SRC_PRECOMPILED) {
- return ICON_SCRIPT_PRE;
- }
- if (def.source == SRC_BUNDLED) {
- return ICON_SCRIPT_BDL;
- }
- return ICON_SCRIPT_DRM;
- }
if (columnIndex == 1) {
return def.name;
}
diff --git a/src/main/java/rsb/plugin/login_icon.png b/src/main/java/rsb/plugin/login_icon.png
deleted file mode 100644
index 66792abe..00000000
Binary files a/src/main/java/rsb/plugin/login_icon.png and /dev/null differ
diff --git a/src/main/java/rsb/script/Script.java b/src/main/java/rsb/script/Script.java
index 0900202e..35c0012c 100644
--- a/src/main/java/rsb/script/Script.java
+++ b/src/main/java/rsb/script/Script.java
@@ -7,7 +7,7 @@
import rsb.botLauncher.RuneLite;
-import rsb.gui.AccountManager;
+import rsb.plugin.AccountManager;
import rsb.internal.BreakHandler;
import rsb.event.EventMulticaster;
import rsb.event.listener.PaintListener;
diff --git a/src/main/java/rsb/script/randoms/LoginBot.java b/src/main/java/rsb/script/randoms/LoginBot.java
index 33910146..941070b6 100644
--- a/src/main/java/rsb/script/randoms/LoginBot.java
+++ b/src/main/java/rsb/script/randoms/LoginBot.java
@@ -5,22 +5,12 @@
import net.runelite.api.Point;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
-import rsb.internal.input.Mouse;
-import rsb.methods.Magic;
import rsb.script.Random;
-import rsb.gui.AccountManager;
-import rsb.wrappers.RSNPC;
-import rsb.wrappers.RSPlayer;
-import rsb.wrappers.RSWidget;
+import rsb.plugin.AccountManager;
import rsb.wrappers.RSWidget;
import rsb.script.ScriptManifest;
-import java.applet.Applet;
import java.awt.*;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
import static java.lang.Thread.sleep;
diff --git a/src/main/java/rsb/util/AccountStore.java b/src/main/java/rsb/util/AccountStore.java
index bae2bf6e..fe88ecf1 100644
--- a/src/main/java/rsb/util/AccountStore.java
+++ b/src/main/java/rsb/util/AccountStore.java
@@ -43,12 +43,13 @@ public String getPassword() {
boolean safe = true;
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
for (StackTraceElement stackTraceElement : stackTraceElements) {
- safe = safe && (stackTraceElement.getClassName().contains("net.runelite") || stackTraceElement
+ safe = safe && (stackTraceElement.getClassName().contains("rsb") || stackTraceElement
.getClassName().contains("java.lang.T") || stackTraceElement
.getClassName().contains("java.awt.") || stackTraceElement
.getClassName().contains("javax.swing.") || stackTraceElement
.getClassName().contains("java.security.") || stackTraceElement
- .getClassName().contains("sun.awt."));
+ .getClassName().contains("sun.awt.") || stackTraceElement.getClassName().contains("org.pushingpixels")
+ );
}
return safe ? password : null;
}
@@ -58,12 +59,12 @@ public String getAttribute(String key) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (key.equalsIgnoreCase("pin")) {
for (StackTraceElement stackTraceElement : stackTraceElements) {
- safe = safe && (stackTraceElement.getClassName().contains("org.rsbot.") || stackTraceElement
+ safe = safe && (stackTraceElement.getClassName().contains("rsb") || stackTraceElement
.getClassName().contains("java.lang.T") || stackTraceElement
.getClassName().contains("java.awt.") || stackTraceElement
.getClassName().contains("javax.swing.") || stackTraceElement
.getClassName().contains("java.security.") || stackTraceElement
- .getClassName().contains("sun.awt."));
+ .getClassName().contains("sun.awt.") || stackTraceElement.getClassName().contains("org.pushingpixels"));
}
}
return safe ? attributes.get(key) : null;
diff --git a/src/main/java/rsb/util/StringUtil.java b/src/main/java/rsb/util/StringUtil.java
index 7d021904..464c56d8 100644
--- a/src/main/java/rsb/util/StringUtil.java
+++ b/src/main/java/rsb/util/StringUtil.java
@@ -1,6 +1,7 @@
package rsb.util;
import lombok.extern.slf4j.Slf4j;
+import rsb.internal.globval.GlobalConfiguration;
import java.awt.*;
import java.io.PrintWriter;
@@ -124,5 +125,23 @@ public static String newStringUtf8(byte[] bytes) {
}
}
-
+ /**
+ * Gets the compiled path of the class containing the object
+ * and replaces the path with the values needed to direct it to the
+ * non-compiled path with the .java file to access
+ * Used only in IntelliJ due to the weird behavior when building w/ the run-time compiler for test scripts
+ * TODO: Remove this via Gradle behavior such as a resources folder
+ *
+ * @param clazz The class of the object in the same directory as the one we wish to find
+ * @param file The file we wish to locate within the above directory
+ *
+ * @return The path of the item in IntelliJ's non-build path
+ */
+ public static String convertIntelliJPath(Class> clazz, String file) {
+ String path = clazz.getResource(file).getPath().replace(file, "");
+ if (!GlobalConfiguration.RUNNING_FROM_JAR) {
+ path = path.replace("build/classes/java/main", "src/main/java");
+ }
+ return path;
+ }
}
diff --git a/src/main/resources/rsb/plugin/rsb.png b/src/main/resources/rsb/plugin/rsb.png
new file mode 100644
index 00000000..c9e82711
Binary files /dev/null and b/src/main/resources/rsb/plugin/rsb.png differ