自动采集

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 * @param rect
*/ */
public static void show(ViewRect rect) { public synchronized static void show(ViewRect rect) {
Robot robot = JMainService.getInstance().getMacro().getRobot(); Robot robot = JMainService.getInstance().getMacro().getRobot();
BufferedImage screenCapture = robot.createScreenCapture(new Rectangle(rect.getLeft(), rect.getTop(), rect.getWidth(), rect.getHeight())); BufferedImage screenCapture = robot.createScreenCapture(new Rectangle(rect.getLeft(), rect.getTop(), rect.getWidth(), rect.getHeight()));
show(screenCapture); show(screenCapture);
@ -126,7 +126,7 @@ public class ImageUtil {
* *
* @param image * @param image
*/ */
public static void show(BufferedImage image) { public synchronized static void show(BufferedImage image) {
int viewSize = 100; int viewSize = 100;
Image showImage = image; 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.util.TaskUtil;
import com.example.jmacro.wjdr.wjdr.task.*; 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("定位城镇"); Logger.info("定位城镇");
// 定位城镇 // 定位城镇
Boolean inMain = TaskUtil.retryTask(() -> { Boolean inMain = TaskUtil.timeTask(() -> {
{ // 定位弹框,关闭弹框 { // 定位弹框,关闭弹框
delayUnstable(); delayUnstable();
ViewRect rect = findLegend("城镇_礼包", 0.7); ViewRect rect = findLegend(of(437, 28, 491, 106), "城镇_礼包", 0.7);
if (rect != null) { if (rect != null) {
mouseLeftClick(rect); mouseLeftClick(rect);
Logger.info("检测到充值广告弹框,关闭弹框"); Logger.info("检测到充值广告弹框,关闭弹框");
@ -109,7 +112,7 @@ public class MacroForWJDR extends JMacro {
} }
} }
return false; return false;
}, 10, 1000); }, 60, TimeUnit.SECONDS);
if (!Convert.toBool(inMain, false)) { if (!Convert.toBool(inMain, false)) {
Logger.info("未进入城镇:退出线程"); Logger.info("未进入城镇:退出线程");

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

Loading…
Cancel
Save

Powered by TurnKey Linux.