mirror of
https://github.com/bdnugget/IdleRSC.git
synced 2026-11-07 07:57:27 +00:00
Fixes for Batch bars, improvements in client, and custom Ui options/fixes
This commit is contained in:
1 parent
8fd141806d
commit
d97c467326
17 files changed
+367
-324
No files matched your search
@@ -56,7 +56,9 @@ final class AuthFrame extends JFrame {
|
||||
screenRefresh,
|
||||
helpMenu,
|
||||
showVersion,
|
||||
newUi;
|
||||
newIcons,
|
||||
newUi,
|
||||
keepOpen;
|
||||
|
||||
private final Choice themeChoice = new Choice();
|
||||
private final Choice initChoice = new Choice();
|
||||
@@ -212,14 +214,16 @@ final class AuthFrame extends JFrame {
|
||||
}
|
||||
|
||||
// Build out all of our checkbox options
|
||||
Checkbox[] checkBoxes = {
|
||||
Component[] checkBoxes = {
|
||||
autoLogin = new Checkbox(" Auto-login", false),
|
||||
sideBar = new Checkbox(" Show Side Bar", true),
|
||||
logWindow = new Checkbox(" Open Log Window", false),
|
||||
debug = new Checkbox(" Open Debugger", false),
|
||||
botPaint = new Checkbox(" Show Bot Paint", true),
|
||||
disableGraphics = new Checkbox(" Disable Graphics", false),
|
||||
newUi = new Checkbox(" New UI style", false),
|
||||
newUi = new Checkbox(" Custom Game UI", false),
|
||||
newIcons = new Checkbox(" New Skillbar Icons", false),
|
||||
keepOpen = new Checkbox(" Keep Inv Open", false),
|
||||
interlace = new Checkbox(" Interlace Mode", false),
|
||||
screenRefresh = new Checkbox(" 60s Screen Refresh", true),
|
||||
helpMenu = new Checkbox(" Show Help Menu", false),
|
||||
@@ -330,7 +334,9 @@ final class AuthFrame extends JFrame {
|
||||
interlace.setState(false);
|
||||
helpMenu.setState(false);
|
||||
showVersion.setState(false);
|
||||
newIcons.setState(false);
|
||||
newUi.setState(false);
|
||||
keepOpen.setState(true);
|
||||
}
|
||||
|
||||
public void storeAuthData(AuthFrame auth) {
|
||||
@@ -366,7 +372,9 @@ final class AuthFrame extends JFrame {
|
||||
p.put("screen-refresh", auth.getScreenRefresh());
|
||||
p.put("help", auth.getHelpMenu());
|
||||
p.put("version", auth.getShowVersion());
|
||||
p.put("new-icons", auth.getNewIcons());
|
||||
p.put("new-ui", auth.getNewUi());
|
||||
p.put("keep-open", auth.getKeepOpen());
|
||||
p.put("server-ip", auth.getServerIpChoice());
|
||||
p.put("theme", auth.getThemeName());
|
||||
|
||||
@@ -395,7 +403,7 @@ final class AuthFrame extends JFrame {
|
||||
* @param component component to be resized
|
||||
* @param size Dimension object representing the x and y size
|
||||
*/
|
||||
private static void setElementSizing(Component component, Dimension size) {
|
||||
private void setElementSizing(Component component, Dimension size) {
|
||||
component.setMaximumSize(size);
|
||||
component.setMinimumSize(size);
|
||||
component.setPreferredSize(size);
|
||||
@@ -449,7 +457,9 @@ final class AuthFrame extends JFrame {
|
||||
helpMenu.setState(Boolean.parseBoolean(p.getProperty("help", "false")));
|
||||
showVersion.setState(Boolean.parseBoolean(p.getProperty("version", "false")));
|
||||
themeChoice.select(p.getProperty("theme", "RuneDark Theme"));
|
||||
newIcons.setState(Boolean.parseBoolean(p.getProperty("new-icons", "false")));
|
||||
newUi.setState(Boolean.parseBoolean(p.getProperty("new-ui", "false")));
|
||||
keepOpen.setState(Boolean.parseBoolean(p.getProperty("keep-open", "false")));
|
||||
screenRefresh.setState(Boolean.parseBoolean(p.getProperty("screen-refresh", "true")));
|
||||
|
||||
} catch (final Throwable t) {
|
||||
@@ -569,10 +579,18 @@ final class AuthFrame extends JFrame {
|
||||
return Boolean.toString(showVersion.getState());
|
||||
}
|
||||
|
||||
synchronized String getNewIcons() {
|
||||
return Boolean.toString(newIcons.getState());
|
||||
}
|
||||
|
||||
synchronized String getNewUi() {
|
||||
return Boolean.toString(newUi.getState());
|
||||
}
|
||||
|
||||
synchronized String getKeepOpen() {
|
||||
return Boolean.toString(keepOpen.getState());
|
||||
}
|
||||
|
||||
synchronized void addActionListener(final ActionListener al) {
|
||||
okButton.addActionListener(al);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class Config extends ParseResult {
|
||||
// Boolean options
|
||||
setUsingAccount(parseResult.isUsingAccount());
|
||||
setAutoStart(parseResult.isAutoStart());
|
||||
setAutoStart(parseResult.isAutoStart());
|
||||
setAutoLogin(parseResult.isAutoLogin());
|
||||
setLogWindowVisible(parseResult.isLogWindowVisible());
|
||||
setDebug(parseResult.isDebug());
|
||||
@@ -46,7 +47,9 @@ public class Config extends ParseResult {
|
||||
setGraphicsInterlacingEnabled(parseResult.isGraphicsInterlacingEnabled());
|
||||
setScriptSelectorWindowVisible(parseResult.isScriptSelectorOpen());
|
||||
setScreenRefresh(parseResult.getScreenRefresh());
|
||||
setUiStyle(parseResult.getNewUi());
|
||||
setNewIcons(parseResult.getNewIcons());
|
||||
setNewUi(parseResult.getNewUi());
|
||||
setKeepOpen(parseResult.getKeepOpen());
|
||||
|
||||
// position
|
||||
setPositionX(parseResult.getPositionX());
|
||||
|
||||
@@ -23,11 +23,9 @@ import java.net.MalformedURLException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.swing.*;
|
||||
@@ -87,6 +85,8 @@ public class Main {
|
||||
interlaceCheckbox,
|
||||
autoscrollLogsCheckbox,
|
||||
sidebarCheckbox,
|
||||
customUiMode,
|
||||
keepInvOpen,
|
||||
gfxCheckbox; // all the checkboxes on the sidepanel.
|
||||
private static JButton loadScriptButton,
|
||||
pathwalkerButton,
|
||||
@@ -386,26 +386,26 @@ public class Main {
|
||||
rscFrame.setSize(new Dimension(rscFrame.getWidth() + 122, rscFrame.getHeight()));
|
||||
|
||||
// Set checkboxes on side panel using "get" methods
|
||||
logWindowCheckbox.setSelected(config.isLogWindowVisible());
|
||||
sidebarCheckbox.setSelected(config.isSidebarVisible());
|
||||
debugCheckbox.setSelected(config.isDebug());
|
||||
interlaceCheckbox.setSelected(config.isGraphicsInterlacingEnabled());
|
||||
botPaintCheckbox.setSelected(config.isBotPaintVisible());
|
||||
|
||||
if (config.isGraphicsInterlacingEnabled()) {
|
||||
controller.setInterlacer(config.isGraphicsInterlacingEnabled());
|
||||
}
|
||||
if (config.isScriptSelectorOpen()) {
|
||||
showLoadScript();
|
||||
}
|
||||
|
||||
if (config.isDebug()) debugger.open();
|
||||
autoLoginCheckbox.setSelected(config.isAutoLogin());
|
||||
graphicsCheckbox.setSelected(config.isGraphicsEnabled());
|
||||
render3DCheckbox.setSelected(config.isRender3DEnabled());
|
||||
gfxCheckbox.setSelected(config.isGraphicsEnabled());
|
||||
controller.setDrawing(config.isGraphicsEnabled(), 0);
|
||||
controller.setRender3D(config.isRender3DEnabled());
|
||||
logWindowCheckbox.setSelected(config.isLogWindowVisible());
|
||||
sidebarCheckbox.setSelected(config.isSidebarVisible());
|
||||
debugCheckbox.setSelected(config.isDebug());
|
||||
interlaceCheckbox.setSelected(config.isGraphicsInterlacingEnabled());
|
||||
botPaintCheckbox.setSelected(config.isBotPaintVisible());
|
||||
customUiMode.setSelected(config.getNewUi());
|
||||
keepInvOpen.setSelected(config.getKeepOpen());
|
||||
|
||||
// Set client properties from checkboxes
|
||||
if (config.getKeepOpen()) controller.setKeepInventoryOpenMode(keepInvOpen.isSelected());
|
||||
if (config.isGraphicsInterlacingEnabled())
|
||||
controller.setInterlacer(config.isGraphicsInterlacingEnabled());
|
||||
if (config.isScriptSelectorOpen()) showLoadScript();
|
||||
if (config.isDebug()) debugger.open();
|
||||
|
||||
log("Initializing WindowListener...");
|
||||
windowListener =
|
||||
@@ -607,14 +607,6 @@ public class Main {
|
||||
menuBar.add(logWindowCheckbox);
|
||||
menuBar.add(sidebarCheckbox);
|
||||
|
||||
// prevent tab/etc "focusing" an element
|
||||
menuBar.setFocusable(false);
|
||||
settingsMenu.setFocusable(false);
|
||||
themeMenu.setFocusable(false);
|
||||
gfxCheckbox.setFocusable(false);
|
||||
logWindowCheckbox.setFocusable(false);
|
||||
sidebarCheckbox.setFocusable(false);
|
||||
|
||||
// style our elements
|
||||
settingsMenu.setBackground(themeBackColor);
|
||||
settingsMenu.setBorder(BorderFactory.createLineBorder(themeBackColor));
|
||||
@@ -650,11 +642,10 @@ public class Main {
|
||||
themeMenu.add(menuItem);
|
||||
}
|
||||
JMenuItem _accOpp;
|
||||
JCheckBox customUiMode, keepInvOpen;
|
||||
// Define settings menu drop down
|
||||
Component[] _settingsMenu = {
|
||||
_accOpp = new JMenuItem("Account Startup Settings", KeyEvent.VK_F4), // S key
|
||||
customUiMode = new JCheckBox("Custom in-game UI"),
|
||||
customUiMode = new JCheckBox("Custom In-game UI"),
|
||||
keepInvOpen = new JCheckBox("Keep Inventory Open"),
|
||||
};
|
||||
|
||||
@@ -663,6 +654,16 @@ public class Main {
|
||||
settingsMenu.add(_menuItem);
|
||||
}
|
||||
|
||||
// prevent tab/etc "focusing" an element
|
||||
menuBar.setFocusable(false);
|
||||
settingsMenu.setFocusable(false);
|
||||
themeMenu.setFocusable(false);
|
||||
gfxCheckbox.setFocusable(false);
|
||||
logWindowCheckbox.setFocusable(false);
|
||||
sidebarCheckbox.setFocusable(false);
|
||||
customUiMode.setFocusable(false);
|
||||
keepInvOpen.setFocusable(false);
|
||||
|
||||
// menuItem.setAccelerator(KeyStroke.getKeyStroke((char) KeyEvent.VK_F4));
|
||||
// //opens 2 authframes
|
||||
_accOpp.addActionListener(
|
||||
@@ -677,14 +678,20 @@ public class Main {
|
||||
authFrame.storeAuthData(authFrame);
|
||||
authFrame.setVisible(false);
|
||||
});
|
||||
settingsMenu.setPopupMenuVisible(false);
|
||||
settingsMenu.setSelected(false);
|
||||
authFrame.setVisible(true);
|
||||
});
|
||||
customUiMode.addActionListener(
|
||||
e -> {
|
||||
settingsMenu.setPopupMenuVisible(false);
|
||||
settingsMenu.setSelected(false);
|
||||
controller.setCustomUiMode(customUiMode.isSelected());
|
||||
});
|
||||
keepInvOpen.addActionListener(
|
||||
e -> {
|
||||
settingsMenu.setPopupMenuVisible(false);
|
||||
settingsMenu.setSelected(false);
|
||||
controller.setKeepInventoryOpenMode(keepInvOpen.isSelected());
|
||||
});
|
||||
}
|
||||
@@ -790,8 +797,8 @@ public class Main {
|
||||
botFrame.add(debugCheckbox);
|
||||
botFrame.add(interlaceCheckbox);
|
||||
botFrame.add(botPaintCheckbox);
|
||||
botFrame.add(graphicsCheckbox);
|
||||
botFrame.add(render3DCheckbox);
|
||||
botFrame.add(graphicsCheckbox);
|
||||
botFrame.add(takeScreenshotButton);
|
||||
botFrame.add(showIdButton);
|
||||
botFrame.add(openDebuggerButton);
|
||||
@@ -1063,7 +1070,7 @@ public class Main {
|
||||
}
|
||||
|
||||
// set new or old UI bar design
|
||||
setUiStyle(config.getNewUi());
|
||||
setIconStyle(config.getNewIcons());
|
||||
|
||||
// Generate our port file
|
||||
if (config.getInitCache().equalsIgnoreCase("custom")) {
|
||||
@@ -1088,58 +1095,36 @@ public class Main {
|
||||
new File("cache" + File.separator + "video" + File.separator + "spritepacks");
|
||||
File videoDirectory = new File("cache" + File.separator + "video/");
|
||||
File[] spriteFilelist = spriteDirectory.listFiles();
|
||||
File[] videoFilelist = videoDirectory.listFiles();
|
||||
String[] videoFilelist = videoDirectory.list();
|
||||
String[] fileNames = {
|
||||
"authentic_landscape.orsc",
|
||||
"authentic_sprites.orsc",
|
||||
"custom_landscape.orsc",
|
||||
"custom_sprites.osar",
|
||||
"library.orsc",
|
||||
"models.orsc"
|
||||
"models.orsc",
|
||||
"spritepacks"
|
||||
};
|
||||
|
||||
if (spriteFilelist != null) {
|
||||
if (!spriteFilelist[0].getName().equalsIgnoreCase("Menus.osar")) return false;
|
||||
// check sprite files
|
||||
if (spriteFilelist != null && spriteFilelist.length > 0) {
|
||||
if (!spriteFilelist[0].getName().equalsIgnoreCase("menus.osar")) return false;
|
||||
} else return false;
|
||||
if (videoFilelist != null) {
|
||||
if (videoFilelist.length < 6) return false;
|
||||
String[] videoNames = new String[videoFilelist.length];
|
||||
for (int i = 0; i < videoFilelist.length; i++) {
|
||||
videoNames[i] = videoFilelist[i].getName();
|
||||
}
|
||||
// compare the file names we read to the names we need
|
||||
for (String videoName : videoNames) {
|
||||
boolean callReturn = true;
|
||||
for (String fileName : fileNames) {
|
||||
if (videoName.equalsIgnoreCase(fileName)) {
|
||||
callReturn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check video files
|
||||
if (videoFilelist != null && videoFilelist.length >= 6) {
|
||||
for (String fileName : fileNames) {
|
||||
boolean callReturn = Arrays.stream(videoFilelist).noneMatch(fileName::equalsIgnoreCase);
|
||||
// we are missing a file so regen cache
|
||||
if (callReturn) return false;
|
||||
}
|
||||
} else return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void setUiStyle(boolean newStyle) {
|
||||
// Create Cache directory
|
||||
File dir = new File("." + File.separator + "Cache");
|
||||
dir.mkdirs();
|
||||
|
||||
// Add config.txt to client cache (1 gives new UI icons, 0 gives old Icons)
|
||||
try {
|
||||
FileWriter portFile = new FileWriter("Cache/config.txt");
|
||||
portFile.write("Menus:" + (newStyle ? 1 : 0));
|
||||
portFile.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void createCache() {
|
||||
log("Cache Missing, Generating the Cache.");
|
||||
// Create Cache directory
|
||||
File dir = new File("." + File.separator + "Cache");
|
||||
dir.mkdirs();
|
||||
@@ -1153,6 +1138,22 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIconStyle(boolean newIcons) {
|
||||
// Create Cache directory
|
||||
File dir = new File("." + File.separator + "Cache");
|
||||
dir.mkdirs();
|
||||
|
||||
// Add config.txt to client cache (1 gives new UI icons, 0 gives old Icons)
|
||||
try {
|
||||
FileWriter portFile = new FileWriter("Cache/config.txt");
|
||||
portFile.write("Menus:" + (newIcons ? 1 : 0));
|
||||
portFile.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIp(String serverId) {
|
||||
// Create Cache directory
|
||||
File dir = new File("." + File.separator + "Cache");
|
||||
@@ -1292,6 +1293,15 @@ public class Main {
|
||||
return themeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by login listener to set
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isCustomUiSelected() {
|
||||
return customUiMode.isSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the WindowListener for tracking the log window.
|
||||
*
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import javax.swing.*;
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
public class CLIParser {
|
||||
@@ -64,7 +63,9 @@ public class CLIParser {
|
||||
parseResult.setRender3DEnabled(!cmd.hasOption("disable-3d"));
|
||||
parseResult.setGraphicsInterlacingEnabled(cmd.hasOption("interlace"));
|
||||
parseResult.setScreenRefresh(!cmd.hasOption("no-screen-refresh"));
|
||||
parseResult.setUiStyle(cmd.hasOption("new-ui"));
|
||||
parseResult.setNewIcons(cmd.hasOption("new-icons"));
|
||||
parseResult.setNewUi(cmd.hasOption("new-ui"));
|
||||
parseResult.setKeepOpen(cmd.hasOption("keep-open"));
|
||||
parseResult.setSpellId(cmd.getOptionValue("spell-id", "-1"));
|
||||
parseResult.setPositionX(Integer.parseInt(cmd.getOptionValue("x-position", "-1")));
|
||||
parseResult.setPositionX(Integer.parseInt(cmd.getOptionValue("y-position", "-1")));
|
||||
@@ -143,9 +144,12 @@ public class CLIParser {
|
||||
p.getProperty("interlace", "false").replace(" ", "").toLowerCase().contains("true"));
|
||||
parseResult.setScreenRefresh(
|
||||
p.getProperty("screen-refresh", "true").replace(" ", "").toLowerCase().contains("true"));
|
||||
parseResult.setUiStyle(
|
||||
parseResult.setNewIcons(
|
||||
p.getProperty("new-icons", "false").replace(" ", "").toLowerCase().contains("true"));
|
||||
parseResult.setNewUi(
|
||||
p.getProperty("new-ui", "false").replace(" ", "").toLowerCase().contains("true"));
|
||||
|
||||
parseResult.setKeepOpen(
|
||||
p.getProperty("keep-open", "false").replace(" ", "").toLowerCase().contains("true"));
|
||||
parseResult.setPositionX(
|
||||
Integer.parseInt(p.getProperty("x-position", "-1").replace(" ", "")));
|
||||
parseResult.setPositionY(
|
||||
|
||||
@@ -33,7 +33,9 @@ public class ParseResult {
|
||||
graphicsInterlacing,
|
||||
screenRefresh,
|
||||
scriptSelectorOpen,
|
||||
newIcons,
|
||||
newUi,
|
||||
keepOpen,
|
||||
help,
|
||||
version;
|
||||
|
||||
@@ -308,7 +310,15 @@ public class ParseResult {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setUiStyle(boolean newUi) {
|
||||
public void setNewIcons(boolean newIcons) {
|
||||
this.newIcons = newIcons;
|
||||
}
|
||||
|
||||
public boolean getNewIcons() {
|
||||
return newIcons;
|
||||
}
|
||||
|
||||
public void setNewUi(boolean newUi) {
|
||||
this.newUi = newUi;
|
||||
}
|
||||
|
||||
@@ -316,6 +326,14 @@ public class ParseResult {
|
||||
return newUi;
|
||||
}
|
||||
|
||||
public void setKeepOpen(boolean keepOpen) {
|
||||
this.keepOpen = keepOpen;
|
||||
}
|
||||
|
||||
public boolean getKeepOpen() {
|
||||
return keepOpen;
|
||||
}
|
||||
|
||||
private ArrayList<Integer> stringsToIntArray(String[] strings) {
|
||||
try {
|
||||
ArrayList<Integer> itemIds = new ArrayList<>();
|
||||
|
||||
@@ -2,7 +2,7 @@ package bot.ocrlib;
|
||||
|
||||
public enum OCRType {
|
||||
HASH(0, "Hashes"),
|
||||
INTERNAL(1, "Internal"),
|
||||
INTERNAL(1, "Num3l OCR"),
|
||||
// EXTERNAL(2, "External"),
|
||||
REMOTE(3, "Remote"),
|
||||
MANUAL(4, "Manual");
|
||||
|
||||
@@ -76,6 +76,26 @@ public class SleepCallback {
|
||||
|
||||
private static void onSleepWord(final byte[] data, final int length) {
|
||||
switch (ocrType) {
|
||||
case REMOTE:
|
||||
try {
|
||||
Main.log("Uploading CAPTCHA...");
|
||||
sleepWord = uploadCaptcha(data, length);
|
||||
if (controller.getFatigue() == 0) onSleepFatigueUpdate(0);
|
||||
break; // allow cases to cascade as a fallback when exceptions are called
|
||||
} catch (final Exception ex) {
|
||||
Main.log("Error uploading CAPTCHA! Falling Back to Internal Num3l Sleeper");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
case INTERNAL:
|
||||
try (final ByteArrayOutputStream out = new ByteArrayOutputStream(4096)) {
|
||||
saveBitmap(out, data, length);
|
||||
sleepWord = ocr.guess(SimpleImageIO.readBMP(out.toByteArray()), true);
|
||||
if (controller.getFatigue() == 0) onSleepFatigueUpdate(0);
|
||||
break; // allow cases to cascade as a fallback when exceptions are called
|
||||
} catch (final IOException ex) {
|
||||
Main.log("Error solving sleep word! Falling Back to Hashes");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
case HASH:
|
||||
byte[] image = Arrays.copyOfRange(data, 1, length);
|
||||
int hash = hash32(image);
|
||||
@@ -86,49 +106,23 @@ public class SleepCallback {
|
||||
}
|
||||
if (controller.getFatigue() == 0) onSleepFatigueUpdate(0);
|
||||
break;
|
||||
|
||||
case INTERNAL:
|
||||
try (final ByteArrayOutputStream out = new ByteArrayOutputStream(4096)) {
|
||||
saveBitmap(out, data, length);
|
||||
sleepWord = ocr.guess(SimpleImageIO.readBMP(out.toByteArray()), true);
|
||||
if (controller.getFatigue() == 0) onSleepFatigueUpdate(0);
|
||||
} catch (final IOException ex) {
|
||||
Main.log("Error solving sleep word");
|
||||
ex.printStackTrace();
|
||||
sleepWord = null;
|
||||
}
|
||||
break;
|
||||
|
||||
// case EXTERNAL:
|
||||
// try (final FileOutputStream out = new FileOutputStream(hc)) {
|
||||
// Main.log("Saving sleep image...");
|
||||
// saveBitmap(out, data, length);
|
||||
// checkLastModified = true;
|
||||
// } catch (final IOException ex) {
|
||||
// ex.printStackTrace();
|
||||
// sleepWord = null;
|
||||
// }
|
||||
// break;
|
||||
|
||||
case REMOTE:
|
||||
try {
|
||||
Main.log("Uploading CAPTCHA...");
|
||||
sleepWord = uploadCaptcha(data, length);
|
||||
if (controller.getFatigue() == 0) onSleepFatigueUpdate(0);
|
||||
} catch (final Exception ex) {
|
||||
|
||||
Main.log("Error uploading CAPTCHA!");
|
||||
ex.printStackTrace();
|
||||
sleepWord = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case MANUAL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// case EXTERNAL:
|
||||
// try (final FileOutputStream out = new FileOutputStream(hc)) {
|
||||
// Main.log("Saving sleep image...");
|
||||
// saveBitmap(out, data, length);
|
||||
// checkLastModified = true;
|
||||
// } catch (final IOException ex) {
|
||||
// ex.printStackTrace();
|
||||
// sleepWord = null;
|
||||
// }
|
||||
// break;
|
||||
|
||||
private static void onSleepFatigueUpdate(final int fatigue) {
|
||||
if (sleepWord == null) return;
|
||||
|
||||
@@ -154,63 +148,54 @@ public class SleepCallback {
|
||||
public static void setOCRType(final OCRType type) {
|
||||
ocrType = type;
|
||||
// force hashes for coleslaw to prevent unnecessary SVM memory usage
|
||||
// todo: Investigate fixing SVM Heap size issue directly. Null the array after using?
|
||||
if (Main.config.getInitCache().equalsIgnoreCase("coleslaw") && type.equals(OCRType.INTERNAL))
|
||||
ocrType = OCRType.HASH;
|
||||
// todo: Investigate fixing SVM Heap size issue directly. Null the array after using?
|
||||
|
||||
Main.log("Setting up " + ocrType.getName() + " OCR.");
|
||||
if (!checkAssetFiles()) createAssetFiles();
|
||||
|
||||
switch (ocrType) {
|
||||
case REMOTE:
|
||||
String url = Main.config.getOCRServer();
|
||||
if (url.isEmpty()) {
|
||||
Main.log("No remote OCR URL was set for " + controller.getPlayerName());
|
||||
Main.log("Falling back to image hashes.");
|
||||
}
|
||||
try {
|
||||
sleepServer = new URL(url);
|
||||
sleepServer.toURI();
|
||||
break;
|
||||
} catch (MalformedURLException | URISyntaxException e) {
|
||||
sleepServer = null;
|
||||
Main.log("Remote OCR URL: '" + url + "' is not a valid url.");
|
||||
Main.log("Falling back to Image hashes.");
|
||||
}
|
||||
case HASH:
|
||||
try (FileInputStream fs = new FileInputStream(HASHES)) {
|
||||
hashes = new Properties();
|
||||
hashes.load(fs);
|
||||
break;
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
Main.log("Falling back to internal/manual.");
|
||||
// prevent circular recursion between hashes and internal on coleslaw
|
||||
if (Main.config.getInitCache().equalsIgnoreCase("coleslaw"))
|
||||
setOCRType(OCRType.MANUAL); // avoid memory leak from SVM
|
||||
else setOCRType(OCRType.INTERNAL);
|
||||
Main.log("Issue detected with Image Hashes.");
|
||||
Main.log("Falling back to internal.");
|
||||
}
|
||||
break;
|
||||
|
||||
case INTERNAL:
|
||||
try (final BufferedReader mr = new BufferedReader(new FileReader(MODEL_TXT));
|
||||
final BufferedReader dr = new BufferedReader(new FileReader(DICT_TXT))) {
|
||||
ocr = new OCR(new DictSearch(dr), mr);
|
||||
break;
|
||||
} catch (final IOException | OCRException e) {
|
||||
e.printStackTrace();
|
||||
Main.log("Issue detected with Internal Sleeper Num3l.");
|
||||
Main.log("Falling back to manual.");
|
||||
setOCRType(OCRType.MANUAL);
|
||||
}
|
||||
break;
|
||||
|
||||
// case EXTERNAL:
|
||||
// hc = new File(HC_BMP);
|
||||
// slword = new File(SLWORD_TXT);
|
||||
// lastModified = slword.lastModified();
|
||||
// break;
|
||||
|
||||
case REMOTE:
|
||||
String url = Main.config.getOCRServer();
|
||||
|
||||
if (url.length() < 1) {
|
||||
Main.log("No remote OCR URL was set for " + controller.getPlayerName());
|
||||
Main.log("Falling back to image hashes.");
|
||||
setOCRType(OCRType.HASH);
|
||||
}
|
||||
|
||||
try {
|
||||
sleepServer = new URL(url);
|
||||
sleepServer.toURI();
|
||||
} catch (MalformedURLException | URISyntaxException e) {
|
||||
sleepServer = null;
|
||||
Main.log("Remote OCR URL: '" + url + "' is not a valid url.");
|
||||
Main.log("Falling back to image hashes.");
|
||||
setOCRType(OCRType.HASH);
|
||||
}
|
||||
break;
|
||||
case MANUAL:
|
||||
default:
|
||||
break;
|
||||
@@ -349,31 +334,23 @@ public class SleepCallback {
|
||||
|
||||
private static boolean checkAssetFiles() {
|
||||
File sleepDirectory = new File("assets" + File.separator + "sleep");
|
||||
File[] sleepFilelist = sleepDirectory.listFiles();
|
||||
String[] fileNames = {"dictionary.txt", "model.txt", "hashes.properties"};
|
||||
if (sleepFilelist != null) {
|
||||
if (sleepFilelist.length != 2) return false;
|
||||
String[] sleepNames = new String[sleepFilelist.length];
|
||||
for (int i = 0; i < sleepFilelist.length; i++) {
|
||||
sleepNames[i] = sleepFilelist[i].getName();
|
||||
}
|
||||
// compare the file names we read to the names we need
|
||||
for (String sleepName : sleepNames) {
|
||||
boolean callReturn = true;
|
||||
for (String fileName : fileNames) {
|
||||
if (sleepName.equalsIgnoreCase(fileName)) {
|
||||
callReturn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String[] sleepFilelist = sleepDirectory.list();
|
||||
String[] fileNames = {"dictionary.txt", "hashes.properties", "model.txt"};
|
||||
|
||||
// check video files
|
||||
if (sleepFilelist != null && sleepFilelist.length == 3) {
|
||||
for (String fileName : fileNames) {
|
||||
boolean callReturn = Arrays.stream(sleepFilelist).noneMatch(fileName::equalsIgnoreCase);
|
||||
// we are missing a file so regen cache
|
||||
if (callReturn) return false;
|
||||
}
|
||||
} else return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void createAssetFiles() {
|
||||
Main.log("Asset files missing, generating sleep assets.");
|
||||
// Create Asset directory
|
||||
File dir = new File("." + File.separator + "assets" + File.separator + "sleep");
|
||||
dir.mkdirs();
|
||||
|
||||
@@ -4498,7 +4498,10 @@ public class Controller {
|
||||
else log("IdleRSC: Turning Off Custom UI mode", "gre");
|
||||
mud.setCustomUI(mode);
|
||||
}
|
||||
|
||||
/** Checks for the Custom UI mode config in mudclient. */
|
||||
public boolean getCustomUiMode() {
|
||||
return mud.getCustomUI();
|
||||
}
|
||||
/**
|
||||
* Set the in-game scroll level of the client.
|
||||
*
|
||||
@@ -4537,6 +4540,8 @@ public class Controller {
|
||||
* @param setting boolean - true to keep invent open, false to let it close.
|
||||
*/
|
||||
public void setKeepInventoryOpenMode(boolean setting) {
|
||||
if (setting) log("IdleRSC: Turning On Custom UI mode", "gre");
|
||||
else log("IdleRSC: Turning Off Custom UI mode", "gre");
|
||||
mud.setAndroidInvToggle(!setting);
|
||||
}
|
||||
|
||||
@@ -4653,13 +4658,14 @@ public class Controller {
|
||||
|
||||
/**
|
||||
* while batching, sleep 1 Game tick. Cancel loop if controller stops or needToMove is true
|
||||
* Warning - sleeps 2 ticks before checking if batching.
|
||||
*
|
||||
* @param checkInventory boolean - true to check for full inventory, false to ignore full invent.
|
||||
*/
|
||||
public void waitForBatching(boolean checkInventory) {
|
||||
sleep(GAME_TICK);
|
||||
while (isAuthentic()
|
||||
&& isRunning()
|
||||
if (isAuthentic()) return;
|
||||
sleep(2 * GAME_TICK);
|
||||
while (isRunning()
|
||||
&& isBatching()
|
||||
&& !needToMove
|
||||
&& !shouldSleep
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LoginListener implements Runnable {
|
||||
controller.log("Logged out! Logging back in...");
|
||||
controller.login();
|
||||
loginCount++;
|
||||
controller.sleep(640);
|
||||
Thread.sleep(640);
|
||||
// calc the next login time
|
||||
if (loginCount > 10)
|
||||
sleepTime =
|
||||
|
||||
@@ -65,92 +65,99 @@ public class WindowListener implements Runnable {
|
||||
int prevHeight = rscFrame.getHeight();
|
||||
boolean consolePrevious = Main.isLogWindowOpen();
|
||||
boolean sidePrevious = Main.isSideWindowOpen();
|
||||
try {
|
||||
while (true) {
|
||||
|
||||
while (true) {
|
||||
|
||||
// Update size of JFrame when log window is opened and closed
|
||||
if (consolePrevious != Main.isLogWindowOpen()) {
|
||||
if (Main.isLogWindowOpen()) {
|
||||
controller.log("IdleRSC: Showing Log Window!", "gre");
|
||||
consoleFrame.setVisible(true);
|
||||
rscFrame.setSize(rscFrame.getWidth(), rscFrame.getHeight() + 188);
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
} else {
|
||||
controller.log("IdleRSC: Hiding Log Window!", "gre");
|
||||
consoleFrame.setVisible(false);
|
||||
rscFrame.setSize(rscFrame.getWidth(), rscFrame.getHeight() - 188);
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
// set custom UI mode when logged it (relog resets the mode)
|
||||
if (controller.isLoggedIn() && Main.isCustomUiSelected() && !controller.getCustomUiMode()) {
|
||||
Thread.sleep(640);
|
||||
controller.setCustomUiMode(true);
|
||||
}
|
||||
consolePrevious = Main.isLogWindowOpen();
|
||||
}
|
||||
// Update size of JFrame when side window is opened and closed
|
||||
if (sidePrevious != Main.isSideWindowOpen()) {
|
||||
if (Main.isSideWindowOpen()) {
|
||||
controller.log("IdleRSC: Showing Side Bar!", "gre");
|
||||
botFrame.setVisible(true);
|
||||
rscFrame.setSize(rscFrame.getWidth() + 122, rscFrame.getHeight());
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
} else {
|
||||
controller.log("IdleRSC: Hiding Side Bar!", "gre");
|
||||
botFrame.setVisible(false);
|
||||
rscFrame.setSize(rscFrame.getWidth() - 122, rscFrame.getHeight());
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
|
||||
// Update size of JFrame when log window is opened and closed
|
||||
if (consolePrevious != Main.isLogWindowOpen()) {
|
||||
if (Main.isLogWindowOpen()) {
|
||||
controller.log("IdleRSC: Showing Log Window!", "gre");
|
||||
consoleFrame.setVisible(true);
|
||||
rscFrame.setSize(rscFrame.getWidth(), rscFrame.getHeight() + 188);
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
} else {
|
||||
controller.log("IdleRSC: Hiding Log Window!", "gre");
|
||||
consoleFrame.setVisible(false);
|
||||
rscFrame.setSize(rscFrame.getWidth(), rscFrame.getHeight() - 188);
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
}
|
||||
consolePrevious = Main.isLogWindowOpen();
|
||||
}
|
||||
sidePrevious = Main.isSideWindowOpen();
|
||||
}
|
||||
|
||||
// Resize window if it goes below a certain size (crashes when small height and you teleport)
|
||||
if (Main.isLogWindowOpen() && rscFrame.getHeight() < 593) {
|
||||
rscFrame.setSize(rscFrame.getWidth(), 593);
|
||||
} else if (rscFrame.getHeight() < 405) rscFrame.setSize(rscFrame.getWidth(), 405);
|
||||
if (Main.isSideWindowOpen() && rscFrame.getWidth() < 655) {
|
||||
rscFrame.setSize(655, rscFrame.getHeight());
|
||||
} else if (rscFrame.getWidth() < 533) rscFrame.setSize(533, rscFrame.getHeight());
|
||||
|
||||
// Refresh JFrame when resizing happens to prevent white screen
|
||||
if ((rscFrame.getWidth() != prevWidth || rscFrame.getHeight() != prevHeight)) {
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(300);
|
||||
prevWidth = rscFrame.getWidth();
|
||||
prevHeight = rscFrame.getHeight();
|
||||
}
|
||||
|
||||
// update our theme when themeName string is changed in Main
|
||||
if (!themeName.equals(Main.getThemeName())) {
|
||||
controller.log("IdleRSC: Switching Theme to " + Main.getThemeName(), "gre");
|
||||
Color[] colors = Main.getThemeElements(Main.getThemeName()); // back, front
|
||||
botFrame.setBackground(colors[0]);
|
||||
rscFrame.getContentPane().setBackground(colors[0]);
|
||||
botFrame.setBorder(BorderFactory.createLineBorder(colors[0]));
|
||||
themeMenu.setForeground(colors[1]);
|
||||
menu.setForeground(colors[1]); // text color
|
||||
menuBar.setBackground(colors[0]);
|
||||
menuBar.setBorder(BorderFactory.createLineBorder(colors[0]));
|
||||
buttonClear.setBackground(colors[0].darker());
|
||||
buttonClear.setForeground(colors[1]);
|
||||
autoscrollLogsCheckbox.setBackground(colors[0]);
|
||||
autoscrollLogsCheckbox.setForeground(colors[1]);
|
||||
logArea.setBackground(colors[0].brighter());
|
||||
logArea.setForeground(colors[1]);
|
||||
scroller.setBackground(colors[0]);
|
||||
scroller.setForeground(colors[1]);
|
||||
consoleFrame.setBackground(colors[0]);
|
||||
consoleFrame.setForeground(colors[1]);
|
||||
|
||||
for (JButton jButton : buttonArray) {
|
||||
jButton.setBackground(colors[0].darker());
|
||||
jButton.setForeground(colors[1]);
|
||||
// Update size of JFrame when side window is opened and closed
|
||||
if (sidePrevious != Main.isSideWindowOpen()) {
|
||||
if (Main.isSideWindowOpen()) {
|
||||
controller.log("IdleRSC: Showing Side Bar!", "gre");
|
||||
botFrame.setVisible(true);
|
||||
rscFrame.setSize(rscFrame.getWidth() + 122, rscFrame.getHeight());
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
} else {
|
||||
controller.log("IdleRSC: Hiding Side Bar!", "gre");
|
||||
botFrame.setVisible(false);
|
||||
rscFrame.setSize(rscFrame.getWidth() - 122, rscFrame.getHeight());
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(50);
|
||||
}
|
||||
sidePrevious = Main.isSideWindowOpen();
|
||||
}
|
||||
for (JCheckBox jCheckbox : checkBoxArray) {
|
||||
jCheckbox.setBackground(colors[0]);
|
||||
jCheckbox.setForeground(colors[1]);
|
||||
|
||||
// Resize window if it goes below a certain size (crashes when small height and you
|
||||
// teleport)
|
||||
if (Main.isLogWindowOpen() && rscFrame.getHeight() < 593) {
|
||||
rscFrame.setSize(rscFrame.getWidth(), 593);
|
||||
} else if (rscFrame.getHeight() < 405) rscFrame.setSize(rscFrame.getWidth(), 405);
|
||||
if (Main.isSideWindowOpen() && rscFrame.getWidth() < 655) {
|
||||
rscFrame.setSize(655, rscFrame.getHeight());
|
||||
} else if (rscFrame.getWidth() < 533) rscFrame.setSize(533, rscFrame.getHeight());
|
||||
|
||||
// Refresh JFrame when resizing happens to prevent white screen
|
||||
if ((rscFrame.getWidth() != prevWidth || rscFrame.getHeight() != prevHeight)) {
|
||||
if (!controller.isDrawEnabled()) refreshGraphics(300);
|
||||
prevWidth = rscFrame.getWidth();
|
||||
prevHeight = rscFrame.getHeight();
|
||||
}
|
||||
themeName = Main.getThemeName();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(40);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
// update our theme when themeName string is changed in Main
|
||||
if (!themeName.equals(Main.getThemeName())) {
|
||||
controller.log("IdleRSC: Switching Theme to " + Main.getThemeName(), "gre");
|
||||
Color[] colors = Main.getThemeElements(Main.getThemeName()); // back, front
|
||||
botFrame.setBackground(colors[0]);
|
||||
rscFrame.getContentPane().setBackground(colors[0]);
|
||||
botFrame.setBorder(BorderFactory.createLineBorder(colors[0]));
|
||||
themeMenu.setForeground(colors[1]);
|
||||
menu.setForeground(colors[1]); // text color
|
||||
menuBar.setBackground(colors[0]);
|
||||
menuBar.setBorder(BorderFactory.createLineBorder(colors[0]));
|
||||
buttonClear.setBackground(colors[0].darker());
|
||||
buttonClear.setForeground(colors[1]);
|
||||
autoscrollLogsCheckbox.setBackground(colors[0]);
|
||||
autoscrollLogsCheckbox.setForeground(colors[1]);
|
||||
logArea.setBackground(colors[0].brighter());
|
||||
logArea.setForeground(colors[1]);
|
||||
scroller.setBackground(colors[0]);
|
||||
scroller.setForeground(colors[1]);
|
||||
consoleFrame.setBackground(colors[0]);
|
||||
consoleFrame.setForeground(colors[1]);
|
||||
|
||||
for (JButton jButton : buttonArray) {
|
||||
jButton.setBackground(colors[0].darker());
|
||||
jButton.setForeground(colors[1]);
|
||||
}
|
||||
for (JCheckBox jCheckbox : checkBoxArray) {
|
||||
jCheckbox.setBackground(colors[0]);
|
||||
jCheckbox.setForeground(colors[1]);
|
||||
}
|
||||
themeName = Main.getThemeName();
|
||||
}
|
||||
|
||||
Thread.sleep(60);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -236,7 +236,6 @@ public class AIOBankTrainer extends K_kailaScript {
|
||||
c.walkTo(spinningWheel[0] + 1, spinningWheel[1]);
|
||||
} else c.walkTo(spinningWheel[0], spinningWheel[1] - 1);
|
||||
c.useItemIdOnObject(spinningWheel[0], spinningWheel[1], primaryItemId);
|
||||
c.sleep(3000);
|
||||
c.waitForBatching(false);
|
||||
}
|
||||
// Checks for these actions inside the methods
|
||||
|
||||
@@ -2,14 +2,9 @@ package scripting.idlescript;
|
||||
|
||||
import bot.Main;
|
||||
import controller.Controller;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.*;
|
||||
import orsc.ORSCharacter;
|
||||
|
||||
/**
|
||||
@@ -463,78 +458,86 @@ public class AIOFighter extends IdleScript {
|
||||
|
||||
private void setupGUI() {
|
||||
|
||||
JLabel label2 = new JLabel("Chat commands can be used to direct the bot");
|
||||
JLabel label3 = new JLabel("Control ::bones ::prioritize :doors");
|
||||
JLabel label4 = new JLabel("Combat Styles ::attack :strength ::defense ::controlled");
|
||||
JLabel fightModeLabel = new JLabel("Fight Mode:");
|
||||
JComboBox<String> fightModeField =
|
||||
new JComboBox<>(new String[] {"Controlled", "Aggressive", "Accurate", "Defensive"});
|
||||
fightModeField.setSelectedIndex(c.getFightMode());
|
||||
JLabel npcIdsLabel = new JLabel("NPC IDs:");
|
||||
JTextField npcIdsField = new JTextField("3");
|
||||
JLabel maxWanderLabel = new JLabel("Max Wander Distance: (-1 to disable)");
|
||||
JTextField maxWanderField = new JTextField("20");
|
||||
JLabel eatAtHpLabel = new JLabel("Eat at HP: (food is automatically detected)");
|
||||
JTextField eatAtHpField =
|
||||
new JTextField(String.valueOf(c.getCurrentStat(c.getStatId("Hits")) / 2));
|
||||
JLabel lootTableLabel = new JLabel("Loot Table: (comma separated)");
|
||||
JTextField lootTableField = new JTextField("-1");
|
||||
JCheckBox openDoorsCheckbox =
|
||||
new JCheckBox("Open doors/gates? (if On, then set a max wander!)");
|
||||
JCheckBox buryBonesCheckbox =
|
||||
new JCheckBox("Loot & Bury Bones? (only loots bones when npc is null)");
|
||||
JCheckBox prioritizeBonesCheckbox =
|
||||
new JCheckBox("Prioritize Bone looting over attacking NPCs?)");
|
||||
JCheckBox magingCheckbox = new JCheckBox("Magic?");
|
||||
JLabel spellNameLabel = new JLabel("Spell Name: (exactly as it appears in spellbook)");
|
||||
JTextField spellNameField = new JTextField("Wind Bolt");
|
||||
JCheckBox rangingCheckbox = new JCheckBox("Ranging?");
|
||||
JLabel arrowIdLabel = new JLabel("Pickup Arrow ID: (-1 to disable)");
|
||||
JTextField arrowIdField = new JTextField("-1");
|
||||
JLabel switchLabel =
|
||||
new JLabel("Switch ID (weapon to switch to if in melee combat while ranging)");
|
||||
JTextField switchIdField = new JTextField("81");
|
||||
// generate some variables for components we need to manipulate
|
||||
JComboBox<String> fightModeField;
|
||||
JCheckBox openDoorsCheckbox,
|
||||
buryBonesCheckbox,
|
||||
magingCheckbox,
|
||||
rangingCheckbox,
|
||||
prioritizeBonesCheckbox;
|
||||
JTextField npcIdsField,
|
||||
maxWanderField,
|
||||
eatAtHpField,
|
||||
lootTableField,
|
||||
spellNameField,
|
||||
arrowIdField,
|
||||
switchIdField;
|
||||
JButton startScriptButton = new JButton("Start");
|
||||
|
||||
scriptFrame = new JFrame(c.getPlayerName() + " - options");
|
||||
|
||||
scriptFrame.setLayout(new GridLayout(0, 2));
|
||||
scriptFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
scriptFrame.add(label2);
|
||||
scriptFrame.add(label3);
|
||||
scriptFrame.add(label4);
|
||||
scriptFrame.add(fightModeLabel);
|
||||
scriptFrame.add(fightModeField);
|
||||
scriptFrame.add(npcIdsLabel);
|
||||
scriptFrame.add(npcIdsField);
|
||||
scriptFrame.add(maxWanderLabel);
|
||||
scriptFrame.add(maxWanderField);
|
||||
scriptFrame.add(eatAtHpLabel);
|
||||
scriptFrame.add(eatAtHpField);
|
||||
scriptFrame.add(lootTableLabel);
|
||||
scriptFrame.add(lootTableField);
|
||||
scriptFrame.add(openDoorsCheckbox);
|
||||
scriptFrame.add(new JLabel());
|
||||
scriptFrame.add(buryBonesCheckbox);
|
||||
scriptFrame.add(new JLabel());
|
||||
scriptFrame.add(prioritizeBonesCheckbox);
|
||||
scriptFrame.add(new JLabel());
|
||||
scriptFrame.add(magingCheckbox);
|
||||
scriptFrame.add(new JLabel());
|
||||
scriptFrame.add(spellNameLabel);
|
||||
scriptFrame.add(spellNameField);
|
||||
scriptFrame.add(rangingCheckbox);
|
||||
scriptFrame.add(new JLabel());
|
||||
scriptFrame.add(arrowIdLabel);
|
||||
scriptFrame.add(arrowIdField);
|
||||
scriptFrame.add(switchLabel);
|
||||
scriptFrame.add(switchIdField);
|
||||
scriptFrame.add(startScriptButton);
|
||||
// Set up the left and right panels in component arrays
|
||||
Component[] leftSide = {
|
||||
new JLabel("Chat commands can be used to direct the bot"),
|
||||
new JLabel("Control ::bones ::prioritize ::doors"),
|
||||
new JLabel("Combat Styles ::attack :strength ::defense ::controlled"),
|
||||
new JLabel("Fight Mode:"),
|
||||
fightModeField =
|
||||
new JComboBox<>(new String[] {"Controlled", "Aggressive", "Accurate", "Defensive"}),
|
||||
new JLabel("NPC IDs:"),
|
||||
npcIdsField = new JTextField("3"),
|
||||
new JLabel("Max Wander Distance: (-1 to disable)"),
|
||||
maxWanderField = new JTextField("20"),
|
||||
new JLabel("Eat at HP: (food type is automatically detected)"),
|
||||
eatAtHpField = new JTextField(String.valueOf(c.getCurrentStat(c.getStatId("Hits")) / 2)),
|
||||
new JLabel("Loot Table: (comma separated)"),
|
||||
lootTableField = new JTextField("-1")
|
||||
};
|
||||
Component[] rightSide = {
|
||||
new JLabel(""),
|
||||
openDoorsCheckbox = new JCheckBox("Open doors/gates? (if On, then set a max wander!)"),
|
||||
buryBonesCheckbox = new JCheckBox("Loot & Bury Bones? (only loots bones when npc is null)"),
|
||||
prioritizeBonesCheckbox = new JCheckBox("Prioritize Bone looting over attacking NPCs?)"),
|
||||
new JLabel(""),
|
||||
magingCheckbox = new JCheckBox("Magic?"),
|
||||
new JLabel("Spell Name: (exactly as it appears in spellbook)"),
|
||||
spellNameField = new JTextField("Wind Bolt"),
|
||||
rangingCheckbox = new JCheckBox("Ranging?"),
|
||||
new JLabel("Pickup Arrow ID: (-1 to disable)"),
|
||||
arrowIdField = new JTextField("-1"),
|
||||
new JLabel("Switch ID (weapon to switch to if in melee combat while ranging)"),
|
||||
switchIdField = new JTextField("81"),
|
||||
};
|
||||
|
||||
// set default states
|
||||
spellNameField.setEnabled(false);
|
||||
arrowIdField.setEnabled(false);
|
||||
switchIdField.setEnabled(false);
|
||||
prioritizeBonesCheckbox.setEnabled(false);
|
||||
fightModeField.setSelectedIndex(c.getFightMode());
|
||||
|
||||
// set up our panels
|
||||
JPanel[] jPanels = {new JPanel(), new JPanel()};
|
||||
JPanel gap = new JPanel();
|
||||
gap.setSize(30, 100);
|
||||
|
||||
for (Component comp : leftSide) {
|
||||
jPanels[0].add(comp);
|
||||
}
|
||||
for (Component comp : rightSide) {
|
||||
jPanels[1].add(comp);
|
||||
}
|
||||
for (JPanel panel : jPanels) {
|
||||
panel.setLayout(new GridLayout(0, 1));
|
||||
}
|
||||
|
||||
// set up script frame with finished components
|
||||
scriptFrame = new JFrame(c.getPlayerName() + " - options");
|
||||
scriptFrame.setLayout(new BorderLayout());
|
||||
scriptFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
scriptFrame.add(jPanels[0], BorderLayout.LINE_START);
|
||||
|
||||
scriptFrame.add(gap, BorderLayout.CENTER);
|
||||
scriptFrame.add(jPanels[1], BorderLayout.LINE_END);
|
||||
scriptFrame.add(startScriptButton, BorderLayout.PAGE_END);
|
||||
|
||||
scriptFrame.pack();
|
||||
scriptFrame.setLocation(Main.getRscFrameCenter());
|
||||
|
||||
@@ -254,7 +254,6 @@ public final class K_NoBank_TavChaos extends K_kailaScript {
|
||||
doHerblawLoop();
|
||||
hobsToChaos();
|
||||
if (getNewtSecCount() > 0) { // || c.getInventoryItemCount(ItemId.EYE_OF_NEWT.getId()) < 5
|
||||
doHerblawLoop();
|
||||
buyMoreNewts();
|
||||
doHerblawLoop();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,6 @@ public final class K_SeersMagicTree extends K_kailaScript {
|
||||
c.atObject(519, 494);
|
||||
didActionTime = System.currentTimeMillis();
|
||||
doAction = false;
|
||||
c.sleep(GAME_TICK);
|
||||
c.waitForBatching(true);
|
||||
}
|
||||
|
||||
@@ -133,7 +132,6 @@ public final class K_SeersMagicTree extends K_kailaScript {
|
||||
c.atObject(521, 492);
|
||||
didActionTime = System.currentTimeMillis();
|
||||
doAction = false;
|
||||
c.sleep(GAME_TICK);
|
||||
c.waitForBatching(true);
|
||||
}
|
||||
|
||||
@@ -142,7 +140,6 @@ public final class K_SeersMagicTree extends K_kailaScript {
|
||||
c.atObject(524, 489);
|
||||
didActionTime = System.currentTimeMillis();
|
||||
doAction = false;
|
||||
c.sleep(GAME_TICK);
|
||||
c.waitForBatching(true);
|
||||
}
|
||||
|
||||
@@ -154,7 +151,6 @@ public final class K_SeersMagicTree extends K_kailaScript {
|
||||
c.atObject(548, 484);
|
||||
didActionTime = System.currentTimeMillis();
|
||||
doAction = false;
|
||||
c.sleep(GAME_TICK);
|
||||
c.waitForBatching(true);
|
||||
if (c.getObjectAtCoord(548, 484) != 310) {
|
||||
c.walkTo(538, 486);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class SpinStrings extends IdleScript {
|
||||
if (scriptStarted) {
|
||||
guiSetup = false;
|
||||
scriptStarted = false;
|
||||
if (!c.isAuthentic()) c.setBatchBars(true);
|
||||
if (c.getNearestNpcByIds(bankerIds, false) != null) {
|
||||
if (c.getInventoryItemCount(input) == 0) {
|
||||
bankingLoop();
|
||||
|
||||
@@ -17881,7 +17881,9 @@ public final class mudclient implements Runnable {
|
||||
public void setCustomUI(boolean b) {
|
||||
C_CUSTOM_UI = b;
|
||||
}
|
||||
|
||||
public boolean getCustomUI() {
|
||||
return C_CUSTOM_UI;
|
||||
}
|
||||
public void setHideLoginBox(boolean b) {
|
||||
C_HIDE_LOGIN_BOX = b;
|
||||
}
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user