自动采集

wjdr
wangbing 12 months ago
parent 84d20c4290
commit 78096c88fa

@ -909,7 +909,7 @@ public abstract class JMacro {
for (int x = 0; x < capture.getWidth(); x++) {
String col = "#" + Integer.toHexString(capture.getRGB(x, y) & 0xFFFFFF);
for (String s : color) {
if (col.equals(s)) {
if (ColorUtil.isSimilar(ColorUtil.hexToColor(s), ColorUtil.hexToColor(col))) {
return true;
}
}

@ -1,7 +1,8 @@
package xyz.wbsite.jmacro.util;
import java.awt.image.BufferedImage;
import java.io.File;
import cn.hutool.core.util.StrUtil;
import java.awt.*;
/**
*
@ -51,6 +52,18 @@ public class ColorUtil {
return calculateSimilarity(colorInt1, colorInt2) > THRESHOLD_OF_SIMILARITY;
}
/**
* 16Color#fcf6d6
*
* @param hex 16#fcf6d6
* @return {@link Color}
* @since 4.1.14
*/
public static int hexToColor(String hex) {
return Integer.parseInt(StrUtil.removePrefix(hex, "#"), 16);
}
public static void main(String[] args) {
int color1 = 0xf6fbff; // 白色

@ -25,7 +25,7 @@ public class MacroForWJDR extends JMacro {
/**
*
*/
private final String workEnd = "23:00:00";
private final String workEnd = "24:00:00";
/**
* (ms)
@ -95,16 +95,16 @@ public class MacroForWJDR extends JMacro {
// 可按优先级排序以下任务
{
// 矿场攻击检测任务
// new Task_采矿被攻击(this, focusRect).run();
//
// // 避难者
// new Task_收留避难者(this, focusRect).run();
//
// // 自动练兵
// new Task_自动练兵(this, focusRect).run();
//
// // 自动采矿任务
// new Task_自动采矿(this, focusRect).run();
new Task_(this, focusRect).run();
// 避难者
new Task_(this, focusRect).run();
// 自动练兵
new Task_(this, focusRect).run();
// 自动采矿任务
new Task_(this, focusRect).run();
// 探险领取
new Task_(this, focusRect).run();

@ -31,6 +31,26 @@ public class Task_任务奖励领取 extends BaseTask {
"#a42e38",
"#c83532",
"#f83838",
"#ccb7c9",
"#c89dab",
"#c58794",
"#c58592",
"#c68b98",
"#c699a8",
"#cab4c4",
"#c894a1",
"#c7484c",
"#c73d40",
"#c4383a",
"#c7393a",
"#c8474b",
"#c65e64",
"#ce5252",
"#c3696b",
"#fb5d5d",
"#fe3535",
"#fe3535",
"#d4262d",
};
public Task_(JMacro macro, ViewRect viewRect) {
@ -46,7 +66,7 @@ public class Task_任务奖励领取 extends BaseTask {
return;
}
Logger.info("进入任务页面,领取奖励");
macro.mouseLeftClick(macro.of(43, 758));
macro.mouseLeftClick(macro.of(33,779));
macro.delay(1000);
Logger.info("检测章节任务");

@ -6,6 +6,54 @@ import xyz.wbsite.jmacro.util.Logger;
public class Task_ extends BaseTask {
String[] numColor = new String[]{
"#f15252",
"#fe3838",
"#e33335",
"#f23335",
"#e12929",
"#f65455",
"#d44446",
"#871829",
"#c22526",
"#e92f2f",
"#d02020",
"#b64046",
"#cb4840",
"#f93a3a",
"#962433",
"#f73132",
"#c82a28",
"#c21b1d",
"#e22424",
"#fd3e3e",
"#ff3939",
"#a42e38",
"#c83532",
"#f83838",
"#ccb7c9",
"#c89dab",
"#c58794",
"#c58592",
"#c68b98",
"#c699a8",
"#cab4c4",
"#c894a1",
"#c7484c",
"#c73d40",
"#c4383a",
"#c7393a",
"#c8474b",
"#c65e64",
"#ce5252",
"#c3696b",
"#fb5d5d",
"#fe3535",
"#fe3535",
"#d4262d",
};
public Task_(JMacro macro, ViewRect viewRect) {
super(macro, viewRect);
}
@ -13,8 +61,9 @@ public class Task_邮件奖励领取 extends BaseTask {
@Override
public void task(JMacro macro, ViewRect viewRect) {
Logger.info("检测邮箱待领取礼包");
boolean b = macro.matchColor(macro.of(504,751,"#f93838"));
if (!b) {
boolean hasColor = macro.hasColor(macro.of(503,745,518,756), numColor);
if (!hasColor) {
Logger.info("邮箱无待领取礼包");
return;
}
@ -24,7 +73,7 @@ public class Task_邮件奖励领取 extends BaseTask {
macro.delay(1000);
// 战争
if (!macro.matchColor(macro.of(98,71,"#6c9fd8"))) {
if (macro.hasColor(macro.of(84,65,106,78), numColor)) {
macro.mouseLeftClick(macro.of(198,71));
macro.delay(500);
@ -44,7 +93,7 @@ public class Task_邮件奖励领取 extends BaseTask {
}
// 联盟
if (!macro.matchColor(macro.of(198,71,"#6c9fd8"))) {
if (macro.hasColor(macro.of(187,68,209,83), numColor)) {
macro.mouseLeftClick(macro.of(198,71));
macro.delay(500);
@ -64,7 +113,7 @@ public class Task_邮件奖励领取 extends BaseTask {
}
// 系统
if (!macro.matchColor(macro.of(297, 70, "#6c9fd8"))) {
if (macro.hasColor(macro.of(291,62,311,78), numColor)) {
macro.mouseLeftClick(macro.of(297, 70));
macro.delay(500);
@ -84,7 +133,7 @@ public class Task_邮件奖励领取 extends BaseTask {
}
// 报告
if (!macro.matchColor(macro.of(398, 71, "#6c9fd8"))) {
if (macro.hasColor(macro.of(390,64,411,77), numColor)) {
macro.mouseLeftClick(macro.of(398, 71));
macro.delay(500);

Loading…
Cancel
Save

Powered by TurnKey Linux.