自动采集

wjdr
wangbing 1 year ago
parent 92370fe0d0
commit 4f153867ed

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

@ -115,7 +115,7 @@ public class ImageUtil {
*
* @param rect
*/
public static void show(ViewRect rect) {
public synchronized static void show(ViewRect rect) {
Robot robot = JMainService.getInstance().getMacro().getRobot();
BufferedImage screenCapture = robot.createScreenCapture(new Rectangle(rect.getLeft(), rect.getTop(), rect.getWidth(), rect.getHeight()));
show(screenCapture);
@ -126,7 +126,7 @@ public class ImageUtil {
*
* @param image
*/
public static void show(BufferedImage image) {
public synchronized static void show(BufferedImage image) {
int viewSize = 100;
Image showImage = image;
// 图片太大时进行缩放显示

@ -10,6 +10,9 @@ import com.example.jmacro.wjdr.util.Logger;
import com.example.jmacro.wjdr.util.TaskUtil;
import com.example.jmacro.wjdr.wjdr.task.*;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/**
*
*
@ -72,10 +75,10 @@ public class MacroForWJDR extends JMacro {
Logger.info("定位城镇");
// 定位城镇
Boolean inMain = TaskUtil.retryTask(() -> {
Boolean inMain = TaskUtil.timeTask(() -> {
{ // 定位弹框,关闭弹框
delayUnstable();
ViewRect rect = findLegend("城镇_礼包", 0.7);
ViewRect rect = findLegend(of(437, 28, 491, 106), "城镇_礼包", 0.7);
if (rect != null) {
mouseLeftClick(rect);
Logger.info("检测到充值广告弹框,关闭弹框");
@ -109,7 +112,7 @@ public class MacroForWJDR extends JMacro {
}
}
return false;
}, 10, 1000);
}, 60, TimeUnit.SECONDS);
if (!Convert.toBool(inMain, false)) {
Logger.info("未进入城镇:退出线程");

@ -55,7 +55,7 @@ public class Task_自动采矿 extends BaseTask {
};
for (String type : types) {
Logger.info("搜索资源【{}】", type);
boolean collect = collect(type, 4);
boolean collect = collect(type, 3);
if (collect) { // 中断采集
break;
}
@ -131,6 +131,7 @@ public class Task_自动采矿 extends BaseTask {
if (viewRects[0] != null) {
Logger.info("出征");
macro.mouseLeftClick(viewRects[0]);
return true;
}
if (viewRects[1] != null) {
Logger.info("队列已满,取消采集");

Loading…
Cancel
Save

Powered by TurnKey Linux.