自动采集

wjdr
wangbing 1 year ago
parent 3ef4d911b6
commit ab00ae6faa

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -34,9 +34,10 @@ public class MacroForWJDR extends JMacro {
@Override
public synchronized ViewRect focus() {
Logger.info("聚焦窗口");
ViewRect mumu = findLegend("慕慕_工具栏", 0.95d);
Logger.info("请确保MuMu显示分辨率为540 x 960(DPI 240)");
ViewRect rect = getScreenRect();
Logger.info("查找定位MuMu工具栏");
ViewRect mumu = findLegend("慕慕_工具栏", 0.95d);
if (mumu == null) {
Logger.info("聚焦窗口失败,默认全屏");
} else {
@ -80,10 +81,6 @@ public class MacroForWJDR extends JMacro {
// 任意界面优先返回城镇
new Task_(this, focusRect).run();
// 检测状态
Task_ task_ = new Task_(this, focusRect);
task_.run();
// 可按优先级排序以下任务
{
// 矿场攻击检测任务
@ -92,23 +89,20 @@ public class MacroForWJDR extends JMacro {
// 避难者
new Task_(this, focusRect).run();
// 邮箱礼包领取
if (task_.) {
new Task_(this, focusRect).run();
}
// 探险领取
new Task_(this, focusRect).run();
// 探险领取
if (task_.) {
new Task_(this, focusRect).run();
}
new Task_(this, focusRect).run();
// 邮箱礼包领取
new Task_(this, focusRect).run();
// 自动练兵
new Task_(this, focusRect).run();
// 自动采矿任务
if (task_.()) {
new Task_(this, focusRect).run();
}
new Task_(this, focusRect).run();
}
Logger.info("休眠1分钟...");

@ -0,0 +1,81 @@
package xyz.wbsite.jmacro.wjdr.task;
import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@Override
public void task(JMacro macro, ViewRect viewRect) {
Logger.info("检测任务奖励");
ViewRect[] viewRects = macro.matchLegends(0.3, "任务奖励_待领取", "任务奖励_待领取2");
if (viewRects[0] == null && viewRects[1] == null) {
Logger.info("无任务奖励,跳过");
return;
}
Logger.info("进入任务页面,领取奖励");
macro.mouseLeftClick(macro.of(43, 758));
Logger.info("检测章节任务");
ViewRect = macro.matchLegend("任务奖励_章节任务", 0.5);
if ( != null) {
Logger.info("领取章节任务");
macro.mouseLeftClick();
macro.delay(500);
ViewRect ;
do {
= macro.matchLegend("任务奖励_章节任务领取按钮", 0.9);
if ( != null) {
macro.mouseLeftClick();
}
} while ( != null);
}
Logger.info("检测成长任务");
ViewRect = macro.matchLegend("任务奖励_成长任务", 0.5);
if ( != null) {
Logger.info("领取成长任务");
macro.mouseLeftClick();
macro.delay(500);
ViewRect ;
do {
= macro.matchLegend("任务奖励_领取按钮", 0.9);
if ( != null) {
macro.mouseLeftClick();
macro.delay(1000);
}
} while ( != null);
}
Logger.info("检测每日任务");
ViewRect = macro.matchLegend("任务奖励_每日任务", 0.5);
if ( != null) {
Logger.info("领取每日任务");
macro.mouseLeftClick();
macro.delay(500);
ViewRect ;
do {
= macro.matchLegend("任务奖励_领取按钮", 0.9);
if ( != null) {
macro.mouseLeftClick();
ViewRect _退 = macro.waitAndMatchLegend("任务奖励_点击退出", 0.5, 2);
if (_退 != null) {
macro.mouseLeftClick(_退);
macro.delay(500);
}
}
} while ( != null);
}
ViewRect legend = macro.matchLegend("任务奖励_关闭", 0.9);
if (legend != null) {
Logger.info("关闭任务奖励面板");
macro.mouseLeftClick(legend);
}
}
}

@ -4,15 +4,15 @@ import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
public class Task_ extends BaseTask {
public Task_(JMacro macro, ViewRect viewRect) {
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@Override
public void task(JMacro macro, ViewRect viewRect) {
boolean = macro.matchColor(macro.of(71, 877, "#ff1e1f"));
boolean = macro.matchColor(macro.of(71,877,"#ff1e1f"));
if (!) {
Logger.info("探险奖励未满,跳过");
return;

@ -1,108 +0,0 @@
package xyz.wbsite.jmacro.wjdr.task;
import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
public boolean 1;
public boolean 2;
public boolean 3;
public boolean 4;
public boolean 5;
public boolean 6;
public boolean ;
public boolean ;
public boolean ;
public boolean ;
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@Override
public void task(JMacro macro, ViewRect viewRect) {
Logger.info("读取行军状态");
{
Logger.info("检测面板状态");
ViewRect[] viewRects = macro.matchLegends(0.6, "城镇_打开面板", "城镇_关闭面板");
if (viewRects[0] == null && viewRects[1] == null) {
Logger.info("检测面板状态失败");
return;
}
if (viewRects[0] != null) {
Logger.info("打开面板");
macro.mouseLeftClick(viewRects[0]);
macro.delay(1000);
}
Logger.info("选中城镇");
macro.mouseLeftClick(macro.of(85,200));
macro.delay(1000);
// todo
Logger.info("选中野外");
macro.mouseLeftClick(macro.of(245,200));
macro.delay(1000);
ViewRect[] viewRects1 = macro.matchLegends(0.6D,
"城镇_面板_空闲1",
"城镇_面板_空闲2",
"城镇_面板_空闲3",
"城镇_面板_空闲4",
"城镇_面板_空闲5",
"城镇_面板_空闲6"
);
if (null != macro.matchLegend("城镇_面板_空闲1", 0.6D)) {
1 = true;
Logger.info("队列1空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲2", 0.6D)) {
2 = true;
Logger.info("队列2空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲3", 0.6D)) {
3 = true;
Logger.info("队列3空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲4", 0.6D)) {
4 = true;
Logger.info("队列4空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲5", 0.6D)) {
5 = true;
Logger.info("队列5空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲6", 0.6D)) {
6 = true;
Logger.info("队列6空闲");
}
}
ViewRect _ = macro.matchLegend("城镇_关闭面板", 0.6);
if (_ == null) {
Logger.info("关闭面板异常");
return;
}
Logger.info("关闭面板");
macro.mouseLeftClick(_);
{// 任务奖励
= macro.matchColor(macro.of(43, 759, "#ff3939"));
}
{// 邮件奖励
= macro.matchColor(macro.of(506, 751, "#fe3939"));
}
{// 探险奖励
= macro.matchColor(macro.of(71,877,"#ff1e1f"));
}
}
public boolean () {
return 1 || 2 || 3 || 4 || 5 || 6;
}
}

@ -7,41 +7,136 @@ import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
public boolean 1;
public boolean 2;
public boolean 3;
public boolean 4;
public boolean 5;
public boolean 6;
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@Override
public void task(JMacro macro, ViewRect viewRect) {
Logger.info("读取行军状态");
{
Logger.info("检测面板状态");
ViewRect[] viewRects = macro.matchLegends(0.6, "城镇_打开面板", "城镇_关闭面板");
if (viewRects[0] == null && viewRects[1] == null) {
Logger.info("检测面板状态失败");
return;
}
if (viewRects[0] != null) {
Logger.info("打开面板");
macro.mouseLeftClick(viewRects[0]);
macro.delay(1000);
}
Logger.info("选中野外");
macro.mouseLeftClick(macro.of(245,200));
macro.delay(1000);
ViewRect[] viewRects1 = macro.matchLegends(0.6D,
"城镇_面板_空闲1",
"城镇_面板_空闲2",
"城镇_面板_空闲3",
"城镇_面板_空闲4",
"城镇_面板_空闲5",
"城镇_面板_空闲6"
);
if (null != macro.matchLegend("城镇_面板_空闲1", 0.6D)) {
1 = true;
Logger.info("队列1空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲2", 0.6D)) {
2 = true;
Logger.info("队列2空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲3", 0.6D)) {
3 = true;
Logger.info("队列3空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲4", 0.6D)) {
4 = true;
Logger.info("队列4空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲5", 0.6D)) {
5 = true;
Logger.info("队列5空闲");
}
if (null != macro.matchLegend("城镇_面板_空闲6", 0.6D)) {
6 = true;
Logger.info("队列6空闲");
}
}
ViewRect _ = macro.matchLegend("城镇_关闭面板", 0.6);
if (_ == null) {
Logger.info("关闭面板异常");
return;
}
Logger.info("关闭面板");
macro.mouseLeftClick(_);
Logger.info("定位【野外】");
ViewRect = macro.matchLegend("野外", 0.99);
if ( == null) {
Logger.error("定位【野外】失败,采矿终止");
return;
}
Logger.info("定位【野外】成功,{}", .toString());
Logger.info("点击【野外】,坐标{}", JSONUtil.toJsonStr(.getCenter()));
macro.mouseLeftClick();
macro.delayUnstable();
Logger.info("判断是否在野外");
ViewRect = macro.matchLegend("城镇", 0.9);
if ( != null) {
Logger.info("当前界面【野外】");
} else {
Logger.info("定位【野外】");
ViewRect = macro.matchLegend("野外", 0.99);
if ( == null) {
Logger.error("定位【野外】失败,采矿终止");
Logger.info("定位野外按钮成功");
if (1) {
Logger.info("队列一空闲资源,派去采集生肉");
boolean success = collect("生肉", 3);
if (!success) { // 中断采集
return;
}
Logger.info("定位【野外】成功,{}", .toString());
}
Logger.info("点击【野外】,坐标{}", JSONUtil.toJsonStr(.getCenter()));
macro.mouseLeftClick();
macro.delayUnstable();
Logger.info("定位野外按钮成功");
if (2) {
Logger.info("队列一空闲资源,派去采集木材");
boolean success = collect("木材", 3);
if (!success) { // 中断采集
return;
}
}
if (3) {
Logger.info("队列一空闲资源,派去采集煤矿");
boolean success = collect("煤矿", 3);
if (!success) { // 中断采集
return;
}
}
if (4) {
Logger.info("队列一空闲资源,派去采集铁矿");
boolean success = collect("铁矿", 3);
if (!success) { // 中断采集
return;
}
}
Logger.info("开始采集资源");
String[] types = new String[]{
"生肉", "木材", "煤矿", "铁矿"
};
for (String type : types) {
Logger.info("搜索资源【{}】", type);
boolean success = collect(type, 3);
if (5) {
Logger.info("队列一空闲资源,派去采集煤矿");
boolean success = collect("生肉", 3);
if (!success) { // 中断采集
break;
return;
}
}
if (6) {
Logger.info("队列一空闲资源,派去采集铁矿");
boolean success = collect("木材", 3);
if (!success) { // 中断采集
return;
}
}
@ -57,6 +152,7 @@ public class Task_自动采矿 extends BaseTask {
Logger.error("未检测到【城镇】,异常终止");
return;
}
macro.mouseLeftClick(1);
Logger.info("返回城镇");
}

@ -4,16 +4,16 @@ import xyz.wbsite.jmacro.JMacro;
import xyz.wbsite.jmacro.base.ViewRect;
import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
public class Task_ extends BaseTask {
public Task_(JMacro macro, ViewRect viewRect) {
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@Override
public void task(JMacro macro, ViewRect viewRect) {
Logger.info("检测邮箱待领取礼包");
boolean b = macro.matchColor(macro.of(506, 751, "#fe3939"));
boolean b = macro.matchColor(macro.of(504,751,"#f93838"));
if (!b) {
Logger.info("邮箱无待领取礼包");
return;
@ -23,10 +23,48 @@ public class Task_邮箱礼包领取 extends BaseTask {
macro.mouseLeftClick(macro.of(505, 750));
macro.delay(1000);
// todo 战争
// todo 联盟
// 战争
if (!macro.matchColor(macro.of(98,71,"#6c9fd8"))) {
macro.mouseLeftClick(macro.of(198,71));
macro.delay(500);
ViewRect = macro.waitAndMatchLegend("一键已读领取", 0.9, 2);
if ( == null) {
Logger.info("异常结束");
return;
}
macro.mouseLeftClick();
ViewRect 退 = macro.waitAndMatchLegend("点击任意位置退出", 0.5, 2);
if (退 != null) {
Logger.info("点击任意位置退出");
macro.mouseLeftClick(退);
macro.delay(500);
}
}
// 联盟
if (!macro.matchColor(macro.of(198,71,"#6c9fd8"))) {
macro.mouseLeftClick(macro.of(198,71));
macro.delay(500);
ViewRect = macro.waitAndMatchLegend("一键已读领取", 0.9, 2);
if ( == null) {
Logger.info("异常结束");
return;
}
macro.mouseLeftClick();
ViewRect 退 = macro.waitAndMatchLegend("点击任意位置退出", 0.5, 2);
if (退 != null) {
Logger.info("点击任意位置退出");
macro.mouseLeftClick(退);
macro.delay(500);
}
}
// 系统
if (macro.matchColor(macro.of(297, 70, "#fe3939"))) {
if (!macro.matchColor(macro.of(297, 70, "#6c9fd8"))) {
macro.mouseLeftClick(macro.of(297, 70));
macro.delay(500);
@ -46,7 +84,7 @@ public class Task_邮箱礼包领取 extends BaseTask {
}
// 报告
if (macro.matchColor(macro.of(398, 71, "#fe3939"))) {
if (!macro.matchColor(macro.of(398, 71, "#6c9fd8"))) {
macro.mouseLeftClick(macro.of(398, 71));
macro.delay(500);
Loading…
Cancel
Save

Powered by TurnKey Linux.