public boolean login(String account, String pw) { mouseClickAt(Settings.OFFSETS.get("login.name")); clearArea(); fillArea(account); delay(250); mouseClickAt(Settings.OFFSETS.get("login.pw")); fillArea(pw); mouseClickAt(Settings.OFFSETS.get("login.button")); do { delay(500); boolean equal = true; for (Map.Entry<String, Integer> entry : Settings.COLORS.get("client").entrySet()) { String[] key = entry.getKey().split("x"); Integer value = entry.getValue(); Integer RGB = getPixelColor(Integer.parseInt(key[0]), Integer.parseInt(key[1])).getRGB(); Integer ORGB = new Color(value).getRGB(); equal = equal && (RGB.equals(ORGB)); } loaded = equal; } while (!loaded); delay(5000); whenLogin(); return loaded; }
public boolean sendWhisper(String player, String message) { mouseClickAt(Settings.OFFSETS.get("chat")); fillArea(String.format(Settings.COMMANDS.get("whisper"), player)); sendMessage(message); delay(1000); return false; }
public boolean sendMessage(String message) { mouseClickAt(Settings.OFFSETS.get("chat")); fillArea(message); keyPress(KeyEvent.VK_ENTER); keyRelease(KeyEvent.VK_ENTER); return false; }
public void readChat() { mouseClickAt(Settings.OFFSETS.get("chat.content")); keyBoardCommand("selectall"); keyBoardCommand("copy"); String chat = getClipboardContent(); String[] chatLines = chat.split("\\r?\\n"); for (String line : chatLines) { Matcher matcher = Settings.PATTERNS.get("whisper.received").matcher(line); if (matcher.find()) { switch (matcher.group(4).toLowerCase()) { case "time": sendWhisper(matcher.group(3), "Nothing to see here :)"); break; default: sendWhisper(matcher.group(3), "Unknown command."); } } } }