上传备份

wjdr
王兵 1 year ago
parent fcf2021826
commit 7c56119647

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

@ -1,6 +1,6 @@
package com.example.jmacro.wjdr; package com.example.jmacro.wjdr;
import com.example.jmacro.wjdr.demo.MacroForWJDR; import com.example.jmacro.wjdr.wjdr.MacroForWJDR;
import com.example.jmacro.wjdr.ui.FXMLUtil; import com.example.jmacro.wjdr.ui.FXMLUtil;
import com.example.jmacro.wjdr.util.Logger; import com.example.jmacro.wjdr.util.Logger;
import com.example.jmacro.wjdr.util.ResourceUtil; import com.example.jmacro.wjdr.util.ResourceUtil;

@ -2,7 +2,7 @@ package com.example.jmacro.wjdr;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import com.example.jmacro.wjdr.base.Legend; import com.example.jmacro.wjdr.base.Legend;
import com.example.jmacro.wjdr.demo.MacroForWJDR; import com.example.jmacro.wjdr.wjdr.MacroForWJDR;
import com.example.jmacro.wjdr.util.DialogUtil; import com.example.jmacro.wjdr.util.DialogUtil;
import com.example.jmacro.wjdr.util.Logger; import com.example.jmacro.wjdr.util.Logger;

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo; package com.example.jmacro.wjdr.wjdr;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@ -6,10 +6,10 @@ import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.JMainService; import com.example.jmacro.wjdr.JMainService;
import com.example.jmacro.wjdr.base.Legend; import com.example.jmacro.wjdr.base.Legend;
import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.base.ViewRect;
import com.example.jmacro.wjdr.demo.task.Task_; import com.example.jmacro.wjdr.wjdr.task.Task_;
import com.example.jmacro.wjdr.demo.task.Task_; import com.example.jmacro.wjdr.wjdr.task.Task_;
import com.example.jmacro.wjdr.demo.task.Task_线; import com.example.jmacro.wjdr.wjdr.task.Task_线;
import com.example.jmacro.wjdr.demo.task.Task_; import com.example.jmacro.wjdr.wjdr.task.Task_;
import com.example.jmacro.wjdr.util.Logger; import com.example.jmacro.wjdr.util.Logger;
import com.example.jmacro.wjdr.util.TaskUtil; import com.example.jmacro.wjdr.util.TaskUtil;
@ -80,14 +80,14 @@ public class MacroForWJDR extends JMacro {
// 定位城镇 // 定位城镇
Boolean inMain = TaskUtil.retryTask(() -> { Boolean inMain = TaskUtil.retryTask(() -> {
{ // 定位弹框,关闭弹框 { // 定位弹框,关闭弹框
ViewRect rect = waitAndMatchLegend("城镇_充值", 0.8d); ViewRect rect = matchLegend("城镇_充值", 0.8d);
if (rect != null) { if (rect != null) {
mouseLeftClick(rect); mouseLeftClick(rect);
Logger.info("检测到充值广告弹框,关闭弹框"); Logger.info("检测到充值广告弹框,关闭弹框");
} }
} }
{// 定位离线收益 {// 定位离线收益
ViewRect rect = waitAndMatchLegend("城镇_离线收益", 0.9); ViewRect rect = matchLegend("城镇_离线收益", 0.9);
if (rect != null) { if (rect != null) {
mouseLeftClick(rect); mouseLeftClick(rect);
Logger.info("检测到离线收益弹框,关闭弹框"); Logger.info("检测到离线收益弹框,关闭弹框");
@ -95,7 +95,7 @@ public class MacroForWJDR extends JMacro {
} }
// 定位城镇 // 定位城镇
{ {
ViewRect rect = waitAndMatchLegend("城镇", 0.9); ViewRect rect = matchLegend("城镇", 0.9);
if (rect != null) { if (rect != null) {
Logger.info("当前区域【野外】"); Logger.info("当前区域【野外】");
Logger.info("返回区域【城镇】"); Logger.info("返回区域【城镇】");
@ -104,14 +104,14 @@ public class MacroForWJDR extends JMacro {
} }
} }
{// 定位野外 {// 定位野外
ViewRect rect = waitAndMatchLegend("野外", 0.9); ViewRect rect = matchLegend("野外", 0.9);
if (rect != null) { if (rect != null) {
Logger.info("当前区域【城镇】"); Logger.info("当前区域【城镇】");
return true; return true;
} }
} }
return false; return false;
}, 10, 10); }, 10, 1000);
if (!Convert.toBool(inMain, false)) { if (!Convert.toBool(inMain, false)) {
Logger.info("未进入城镇:退出线程"); Logger.info("未进入城镇:退出线程");

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.JMainService; import com.example.jmacro.wjdr.JMainService;

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.base.ViewRect;
@ -13,13 +13,13 @@ public class Task_探险领取 extends BaseTask {
@Override @Override
public void task(JMacro macro, ViewRect viewRect) { public void task(JMacro macro, ViewRect viewRect) {
Logger.info("定位【探险】按钮"); Logger.info("定位【探险】按钮");
ViewRect TAB_ = macro.waitAndMatchLegend("城镇_探险", 0.9); ViewRect _ = macro.waitAndMatchLegend("城镇_探险", 0.9);
if (TAB_ == null) { if (_ == null) {
return; return;
} }
Logger.info("点击【探险】按钮"); Logger.info("点击【探险】按钮");
macro.mouseLeftClick(TAB_); macro.mouseLeftClick(_);
ViewRect _ = macro.waitAndMatchLegend("探险_按钮", 0.9); ViewRect _ = macro.waitAndMatchLegend("探险_按钮", 0.9);
if (_ == null) { if (_ == null) {

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.base.ViewRect;
@ -12,7 +12,7 @@ public class Task_收留避难者 extends BaseTask {
@Override @Override
public void task(JMacro macro, ViewRect viewRect) { public void task(JMacro macro, ViewRect viewRect) {
ViewRect rect = macro.waitAndMatchLegend("城镇_避难者", 0.9); ViewRect rect = macro.matchLegend("城镇_避难者", 0.9);
if (rect == null) { if (rect == null) {
Logger.info("未发现避难者"); Logger.info("未发现避难者");
return; return;

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.base.ViewRect;
@ -12,12 +12,13 @@ public class Task_离线收益 extends BaseTask {
@Override @Override
public void task(JMacro macro, ViewRect viewRect) { public void task(JMacro macro, ViewRect viewRect) {
macro.delay(); macro.delayUnstable();
// 定位离线收益弹框,关闭弹框 // 定位离线收益弹框,关闭弹框
ViewRect rect = macro.waitAndMatchLegend("城镇_离线收益", 0.9); ViewRect rect = macro.waitAndMatchLegend("城镇_离线收益", 0.9);
if (rect != null) { if (rect != null) {
macro.mouseLeftClick(rect); macro.mouseLeftClick(rect);
Logger.info("检测到离线收益弹框,关闭弹框"); Logger.info("检测到离线收益弹框,关闭弹框");
} }
macro.delayUnstable();
} }
} }

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
@ -16,13 +16,14 @@ public class Task_自动采矿 extends BaseTask {
@Override @Override
public void task(JMacro macro, ViewRect viewRect) { public void task(JMacro macro, ViewRect viewRect) {
macro.delayUnstable();
Logger.info("判断是否在野外"); Logger.info("判断是否在野外");
ViewRect = macro.waitAndMatchLegend( "城镇", 0.9); ViewRect = macro.matchLegend("城镇", 0.9);
if ( != null) { if ( != null) {
Logger.info("当前界面【野外】"); Logger.info("当前界面【野外】");
} else { } else {
Logger.info("定位【野外】"); Logger.info("定位【野外】");
ViewRect = macro.waitAndMatchLegend( "野外", 0.99); ViewRect = macro.matchLegend("野外", 0.99);
if ( == null) { if ( == null) {
Logger.error("定位【野外】失败,采矿终止"); Logger.error("定位【野外】失败,采矿终止");
return; return;
@ -31,12 +32,13 @@ public class Task_自动采矿 extends BaseTask {
Logger.info("点击【野外】,坐标{}", JSONUtil.toJsonStr(.getCenter())); Logger.info("点击【野外】,坐标{}", JSONUtil.toJsonStr(.getCenter()));
macro.mouseLeftClick(); macro.mouseLeftClick();
macro.delayUnstable();
Logger.info("定位野外按钮成功"); Logger.info("定位野外按钮成功");
} }
Logger.info("定位资源搜索按钮"); Logger.info("定位资源搜索按钮");
// 因为搜索按钮透明,不好比对,通过定位其下面的任务图标定位 // 因为搜索按钮透明,不好比对,通过定位其下面的任务图标定位
ViewRect _ = macro.waitAndMatchLegend( "野外_任务", 0.9); ViewRect _ = macro.waitAndMatchLegend("野外_任务", 0.9);
if (_ == null) { if (_ == null) {
Logger.error("未检测到【资源搜索按钮】,采矿终止"); Logger.error("未检测到【资源搜索按钮】,采矿终止");
return; return;
@ -45,11 +47,8 @@ public class Task_自动采矿 extends BaseTask {
Logger.info("定位资源搜索按钮成功:{}", .toString()); Logger.info("定位资源搜索按钮成功:{}", .toString());
macro.mouseLeftClick(); macro.mouseLeftClick();
// 定位木材
// 因为搜索按钮透明,不好比对,通过定位其下面的任务图标定位 // 因为搜索按钮透明,不好比对,通过定位其下面的任务图标定位
ViewRect _ = macro.waitAndMatchLegend( "野外_搜索#L226,879.png", 0.9); ViewRect _ = macro.waitAndMatchLegend("野外_搜索#L226,879.png", 0.9);
if (_ == null) { if (_ == null) {
Logger.error("未检测到【野外_搜索】采矿终止"); Logger.error("未检测到【野外_搜索】采矿终止");
return; return;
@ -68,18 +67,19 @@ public class Task_自动采矿 extends BaseTask {
} }
// 检测是否是搜索界面 // 检测是否是搜索界面
ViewRect _2 = macro.waitAndMatchLegend( "野外_任务", 9); ViewRect _2 = macro.waitAndMatchLegend("野外_任务", 9);
if (_2 != null) { if (_2 != null) {
Logger.info("退出资源搜索界面"); Logger.info("退出资源搜索界面");
macro.mouseLeftClick(this.viewRect); macro.mouseLeftClick(this.viewRect);
} }
ViewRect 1 = macro.waitAndMatchLegend( "城镇", 0.9); ViewRect 1 = macro.waitAndMatchLegend("城镇", 0.9);
if (1 == null) { if (1 == null) {
Logger.error("未检测到【城镇】,采矿终止"); Logger.error("未检测到【城镇】,采矿终止");
return; return;
} }
Logger.info("返回城镇"); Logger.info("返回城镇");
macro.delayUnstable();
} }
/** /**

@ -1,4 +1,4 @@
package com.example.jmacro.wjdr.demo.task; package com.example.jmacro.wjdr.wjdr.task;
import com.example.jmacro.wjdr.JMacro; import com.example.jmacro.wjdr.JMacro;
import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.base.ViewRect;
Loading…
Cancel
Save

Powered by TurnKey Linux.