|
|
|
@ -3,6 +3,7 @@ package com.example.jmacro.wjdr;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import com.example.jmacro.wjdr.base.ScreenPoint;
|
|
|
|
|
import com.example.jmacro.wjdr.base.ScreenRect;
|
|
|
|
|
import com.example.jmacro.wjdr.task.TaskMining;
|
|
|
|
|
import com.example.jmacro.wjdr.util.Imager;
|
|
|
|
@ -44,7 +45,7 @@ public class Main {
|
|
|
|
|
|
|
|
|
|
if (DateUtil.isIn(DateUtil.date(), DateUtil.parse(workStart), DateUtil.parse(workEnd))) {
|
|
|
|
|
int anInt = RandomUtil.randomInt(5, 20);
|
|
|
|
|
Logger.info("等待{}分钟后,重新启动游戏线程");
|
|
|
|
|
Logger.info("等待{}分钟后,重新启动游戏线程", anInt);
|
|
|
|
|
jMacro.setThread(new GameThread(jMacro));
|
|
|
|
|
TaskUtil.schedule(jMacro.getThread(), anInt, TimeUnit.MINUTES);
|
|
|
|
|
}
|
|
|
|
@ -84,7 +85,7 @@ public class Main {
|
|
|
|
|
Logger.info("扫描游戏主界面:");
|
|
|
|
|
ScreenRect 城镇 = TaskUtil.timeTask(() -> {
|
|
|
|
|
while (true) {
|
|
|
|
|
ScreenRect screenRect1 = locationHome(jMacro);
|
|
|
|
|
ScreenRect screenRect1 = locationHome(jMacro, gameScreen);
|
|
|
|
|
if (screenRect1 != null) {
|
|
|
|
|
return screenRect1;
|
|
|
|
|
}
|
|
|
|
@ -119,10 +120,10 @@ public class Main {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ScreenRect locationHome(JMacro jMacro) {
|
|
|
|
|
public static ScreenRect locationHome(JMacro jMacro, ScreenRect gameScreen) {
|
|
|
|
|
{ // 定位弹框,关闭弹框
|
|
|
|
|
BufferedImage image = Imager.load(new File("legend", "首页_广告关闭按钮.png"));
|
|
|
|
|
ScreenRect rect = jMacro.findPic(image, 0.80d);
|
|
|
|
|
ScreenRect rect = jMacro.findPic(gameScreen, image, 0.95d);
|
|
|
|
|
if (rect != null) {
|
|
|
|
|
jMacro.mouseLeftClick(rect);
|
|
|
|
|
Logger.info("检测到弹框,关闭弹框");
|
|
|
|
@ -131,7 +132,7 @@ public class Main {
|
|
|
|
|
|
|
|
|
|
{ // 定位主程序
|
|
|
|
|
BufferedImage legend = Imager.load(new File("legend", "城镇.png"));
|
|
|
|
|
ScreenRect rect = jMacro.findPic(legend, 0.80d);
|
|
|
|
|
ScreenRect rect = jMacro.findPic(gameScreen, legend, 0.2d);
|
|
|
|
|
if (rect != null) {
|
|
|
|
|
Logger.info("程序主界面已就绪");
|
|
|
|
|
return rect;
|
|
|
|
@ -142,7 +143,7 @@ public class Main {
|
|
|
|
|
|
|
|
|
|
public static ScreenRect locationMuMu(JMacro jMacro) {
|
|
|
|
|
BufferedImage image = Imager.load(new File("legend", "慕慕_工具栏.png"));
|
|
|
|
|
return jMacro.findPic(image, 0.99d);
|
|
|
|
|
return jMacro.findPic(image, 0.95d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|