上传备份

master
王兵 1 month ago
parent b97fa076cf
commit 72ae923afe

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

@ -7,7 +7,11 @@ import xyz.wbsite.jmacro.base.Legend;
import xyz.wbsite.jmacro.base.ViewColor;
import xyz.wbsite.jmacro.base.ViewPoint;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.util.*;
import xyz.wbsite.jmacro.util.ColorUtil;
import xyz.wbsite.jmacro.util.ImageUtil;
import xyz.wbsite.jmacro.util.Logger;
import xyz.wbsite.jmacro.util.TaskUtil;
import xyz.wbsite.jmacro.util.ValueUtil;
import java.awt.*;
import java.awt.event.InputEvent;
@ -189,18 +193,93 @@ public abstract class JMacro {
* @param rect
*/
public void mouseLeftClick(ViewPoint rect, long delay) {
// 获取当前鼠标位置
Point mousePoint = MouseInfo.getPointerInfo().getLocation();
if (mousePoint.x != rect.getX() || mousePoint.y != rect.getY()) {
Logger.info("鼠标移动至[{},{}]", rect.getX(), rect.getY());
mouseMove(rect);
}
mouseLeftClick(delay);
}
/**
*
*
* @param delay
*/
public void mouseLeftClick(long delay) {
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
delay(delay);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
/**
*
*/
public void mouseLeftClick() {
mouseLeftClick(100);
}
/**
*
*
* @param rect
*/
public void mouseRightClick(ViewRect rect) {
mouseRightClick(rect, 100);
}
/**
*
*
* @param rect
*/
public void mouseRightClick(ViewRect rect, long delay) {
mouseRightClick(new ViewPoint(rect.getCenter().getX(), rect.getCenter().getY()), delay);
}
/**
*
*
* @param rect
*/
public void mouseRightClick(ViewPoint rect) {
mouseRightClick(rect, 100);
}
/**
*
*
* @param rect
*/
public void mouseRightClick(ViewPoint rect, long delay) {
// 获取当前鼠标位置
Point mousePoint = MouseInfo.getPointerInfo().getLocation();
if (mousePoint.x != rect.getX() || mousePoint.y != rect.getY()) {
Logger.info("鼠标移动至[{},{}]", rect.getX(), rect.getY());
mouseMove(rect);
}
mouseRightClick(delay);
}
/**
*
*
* @param delay
*/
public void mouseRightClick(long delay) {
robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
delay(delay);
robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
}
/**
*
*/
public void mouseRightClick() {
mouseLeftClick(100);
}
/**
*
*
@ -269,20 +348,6 @@ public abstract class JMacro {
robot.mouseRelease(InputEvent.BUTTON2_DOWN_MASK);
}
/**
*
*
* @param rect
*/
public void mouseRightClick(ViewRect rect) {
delayUnstable();
robot.mouseMove(rect.getCenter().getX(), rect.getCenter().getY());
delayUnstable();
robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
delayUnstable();
robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
}
/**
*
*

@ -1,16 +1,14 @@
package xyz.wbsite.jmacro;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.ui.FXMLUtil;
import xyz.wbsite.jmacro.util.Logger;
import xyz.wbsite.jmacro.util.ResourceUtil;
import com.melloware.jintellitype.JIntellitype;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import xyz.wbsite.jmacro.wjdr.MacroForWJDR;
import xyz.wbsite.jmacro.ui.FXMLUtil;
import xyz.wbsite.jmacro.util.ResourceUtil;
import xyz.wbsite.jtask.TaskImpl;
import java.awt.event.KeyEvent;
import java.io.File;
@ -65,7 +63,7 @@ public class JMainApplication extends Application {
});
// 服务初始化
JMainService.init(new MacroForWJDR(), new File("legend"));
JMainService.init(new TaskImpl(), new File("legend"));
}
public static void main(String[] args) {

@ -2,6 +2,7 @@ package xyz.wbsite.jmacro;
import cn.hutool.core.collection.BoundedPriorityQueue;
import cn.hutool.core.util.StrUtil;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
@ -127,8 +128,8 @@ public class JMainController {
@FXML
public void onStop() {
boolean stop = JMainService.stop();
this.start.setDisable(!stop);
this.stop.setDisable(stop);
this.start.setDisable(false);
this.stop.setDisable(true);
this.preview.setImage(null);
}
@ -159,12 +160,14 @@ public class JMainController {
* @param args
*/
public synchronized void println(String log, Object... args) {
String format = StrUtil.format(log, args) + "\n";
if (logs.size() >= MAX_LENGTH) {
String poll = logs.poll();
console.deleteText(0, poll.length());
}
logs.add(format);
console.appendText(format);
Platform.runLater(() -> {
String format = StrUtil.format(log, args) + "\n";
if (logs.size() >= MAX_LENGTH) {
String poll = logs.poll();
console.deleteText(0, poll.length());
}
logs.add(format);
console.appendText(format);
});
}
}

@ -2,9 +2,9 @@ package xyz.wbsite.jmacro;
import cn.hutool.core.thread.ThreadUtil;
import xyz.wbsite.jmacro.base.Legend;
import xyz.wbsite.jmacro.wjdr.MacroForWJDR;
import xyz.wbsite.jmacro.util.DialogUtil;
import xyz.wbsite.jmacro.util.Logger;
import xyz.wbsite.jtask.TaskImpl;
import java.io.File;
@ -133,7 +133,7 @@ public class JMainService {
*
*/
public static void main(String[] args) {
JMainService.init(new MacroForWJDR(), new File("legend"));
JMainService.init(new TaskImpl(), new File("legend"));
JMainService.start();
}
}

@ -18,14 +18,19 @@ import xyz.wbsite.jmacro.ex.MacroErrorException;
public class Logger {
public static void info(String format, Object... arg) {
// 获取当前时间
DateTime date = DateUtil.date();
// 获取日志级别
String level = Level.INFO.toString();
// 格式化日志信息
String log = StrUtil.format(format, arg);
// 获取调用者类名
String name = CallerUtil.getCallerCaller().getSimpleName();
// 获取当前线程的堆栈追踪
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
// 通常堆栈追踪数组的第三个元素是logMessage方法的调用者
int lineNumber = stackTrace[2].getLineNumber();
// 打印日志信息
JMainApplication.mainController.println("[{}] [{}] {} [{}:{}]", date, level, log, name, lineNumber);
}

@ -1,124 +0,0 @@
package xyz.wbsite.jmacro.wjdr;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.JMainService;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.ex.MacroErrorException;
import xyz.wbsite.jmacro.util.Logger;
import xyz.wbsite.jmacro.wjdr.task.*;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 1.8
*/
public class MacroForWJDR extends JMacro {
/**
*
*/
private final String workStart = "00:00:00";
/**
*
*/
private final String workEnd = "24:00:00";
/**
* (ms)
*/
private final long workTime = 30 * 60 * 1000;
@Override
public synchronized ViewRect focus() {
Logger.info("请确保MuMu配置如下");
Logger.info("显卡渲染模式Vulkan模式");
Logger.info("性能配置:中性能");
Logger.info("显卡使用策略:画面标签更好");
Logger.info("其他优化:强制使用独立显卡");
Logger.info("分辨率设置显示分辨率为540 x 960(DPI 240)");
Logger.info("画面设置画面亮度【50】画面风格【普通】");
Logger.info("帧率设置60");
Logger.info("技术上次关闭时的窗口位置和大小60");
Logger.info("固定窗口大小,禁止手动拉伸");
ViewRect rect = getScreenRect();
Logger.info("查找定位MuMu工具栏");
ViewRect mumu = findLegend("慕慕_工具栏", 0.98d);
if (mumu == null) {
Logger.error("聚焦窗口失败");
} else {
// 计算应用窗口返回
rect.setLeft(mumu.getLeft() - 428);
rect.setTop(mumu.getBottom() + 7);
rect.setRight(mumu.getRight());
rect.setBottom(mumu.getBottom() + 951);
}
Logger.info("聚焦窗口:" + rect.toString());
Logger.info("聚焦窗口大小:{}x{}", rect.getRight() - rect.getLeft(), rect.getBottom() - rect.getTop());
return rect;
}
@Override
public void run() {
DateTime current = DateUtil.date();
String currentTime = current.toString("HH:mm:ss");
Logger.info("工作时间:{}~{}", workStart, workEnd);
Logger.info("当前时间:{}", currentTime);
if (DateUtil.parseTime(currentTime).isIn(DateUtil.parseTime(workStart), DateUtil.parseTime(workEnd))) {
Logger.info("当前时间为工作时间");
Logger.info("任务线程开始", current.toString("yyyy-MM-dd HH:mm:ss"));
// 获取启动图标
Logger.info("查找启动图标");
ViewRect launch = findLegend("启动图标", 0.9);
if (launch != null) {
Logger.info("启动图标坐标:", launch.toString());
Logger.info("点击启动图标");
mouseLeftClick(launch);
Logger.info("等待程序启动中,请稍等...");
delay(10 * 1000);
}
Logger.info("启动循环任务");
int count = 99;
while (JMainService.getInstance().run && count > 0) {
count--;
try {
// 任意界面优先返回城镇
new Task_(this, focusRect).run();
// 可按优先级排序以下任务
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
new Task_(this, focusRect).run();
} catch (MacroErrorException ignored) {
}
}
} else {
Logger.info("当前时间为非工作时间,休眠待命!");
}
Logger.info("检测游戏窗口是否关闭!");
ViewRect = findLegend(getFocusRect().offsetY(-30), "无尽", 0.8);
if ( != null) {
Logger.info("游戏窗口存在,关闭窗口!");
mouseMove(.getCenter(), true);
delay(50);
mouseMove(.getCenter().offsetY(1), true);
mouseLeftClick();
}
int randomInt = RandomUtil.randomInt(5, 10);
Logger.info("休眠中{}分钟", randomInt);
delay(randomInt * 60 * 1000);
}
}

@ -1,64 +0,0 @@
package xyz.wbsite.jmacro.wjdr.task;
import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.JMainService;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.ex.MacroErrorException;
import xyz.wbsite.jmacro.util.Logger;
/**
*
*/
public abstract class BaseTask {
/**
*
*/
protected JMacro macro;
/**
*
*/
protected ViewRect viewRect;
public BaseTask(JMacro macro, ViewRect viewRect) {
this.macro = macro;
this.viewRect = viewRect;
}
public void run() {
if (!JMainService.getInstance().run) {
Logger.error("服务中断");
return;
}
String name = getClass().getSimpleName();
try {
Logger.info("》》》任务[{}]开始》》》", name);
this.task(macro, viewRect);
Logger.info("》》》任务[{}]结束》》》", name);
} catch (Exception e) {
Logger.info("》》》任务[{}]异常中断》》》", name);
throw e;
}
}
public void isReady() {
for (int i = 0; i < 10; i++) {
ViewRect rect = macro.matchLegend("野外", 0.9);
if (rect != null) {
return;
}
macro.delay(100);
}
throw new MacroErrorException("请返回城镇");
}
/**
*
*
* @param macro
* @param viewRect
*/
public abstract void task(JMacro macro, ViewRect viewRect);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save

Powered by TurnKey Linux.