自动采集

wjdr
wangbing 12 months ago
parent 69bbd6cf1a
commit c58fca4574

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

@ -141,7 +141,7 @@ public abstract class JMacro {
double absY = Math.abs(startY - endY); double absY = Math.abs(startY - endY);
double absZ = Math.sqrt(Math.pow(absX, 2) + Math.pow(absY, 2)); double absZ = Math.sqrt(Math.pow(absX, 2) + Math.pow(absY, 2));
int times = (int) (absZ / 15 + (absZ % 15 > 0 ? 1 : 0)); int times = (int) (absZ / 15 + (absZ % 15 > 0 ? 1 : 0));
int interval = (int) Math.max((absZ/4) / times, 10); int interval = (int) Math.max((absZ / 4) / times, 10);
times = Math.min(times, 10); times = Math.min(times, 10);
// 分times次移动到指定点 // 分times次移动到指定点
@ -157,25 +157,43 @@ public abstract class JMacro {
} }
} }
/**
*
*
* @param rect
*/
public void mouseLeftClick(ViewRect rect) {
mouseLeftClick(rect, 100);
}
/**
*
*
* @param rect
*/
public void mouseLeftClick(ViewRect rect, long delay) {
mouseLeftClick(new ViewPoint(rect.getCenter().getX(), rect.getCenter().getY()), delay);
}
/** /**
* *
* *
* @param rect * @param rect
*/ */
public void mouseLeftClick(ViewPoint rect) { public void mouseLeftClick(ViewPoint rect) {
mouseMove(rect); mouseLeftClick(rect, 100);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
delay(100);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
} }
/** /**
* *
* *
* @param rect * @param rect
*/ */
public void mouseLeftClick(ViewRect rect) { public void mouseLeftClick(ViewPoint rect, long delay) {
mouseLeftClick(new ViewPoint(rect.getCenter().getX(), rect.getCenter().getY())); mouseMove(rect);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
delay(delay);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
} }
/** /**

@ -0,0 +1,36 @@
package xyz.wbsite.jmacro.util;
public class AnimateUtil {
/**
*
*
* @param time 0~1
* @return 0~1
*/
public static double easeOut(double time) {
if (time <= 0) {
return 0D;
}
if (time >= 1) {
return 1D;
}
return Math.sin(time * Math.PI / 2);
}
/**
*
*
* @param time 0~1
* @return 0~1
*/
public static double easeIn(double time) {
if (time <= 0) {
return 0D;
}
if (time >= 1) {
return 1D;
}
return 1 - Math.cos(time * Math.PI / 2);
}
}

@ -74,12 +74,11 @@ public class MacroForWJDR extends JMacro {
} }
Logger.info("启动循环任务"); Logger.info("启动循环任务");
int count = 10; int count = 1;
while (JMainService.getInstance().run && count > 0) { while (JMainService.getInstance().run && count > 0) {
count--; count--;
// 任意界面优先返回城镇 // 任意界面优先返回城镇
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();
@ -100,8 +99,9 @@ public class MacroForWJDR extends JMacro {
ViewRect = findLegend(getFocusRect().offsetY(-30), "无尽", 0.8); ViewRect = findLegend(getFocusRect().offsetY(-30), "无尽", 0.8);
if ( != null) { if ( != null) {
Logger.info("游戏窗口存在,关闭窗口!"); Logger.info("游戏窗口存在,关闭窗口!");
mouseMove(.getCenter()); mouseMove(.getCenter(), true);
delay(1000); delay(50);
mouseMove(.getCenter().offsetY(1), true);
mouseLeftClick(); mouseLeftClick();
} }

@ -64,21 +64,21 @@ public class Task_定位城镇 extends BaseTask {
} }
} }
{ // 定位弹框,关闭弹框 { // 定位弹框,关闭弹框
ViewRect rect = macro.findLegend(macro.of(450,36,484,76), "城镇_礼包", 0.7); ViewRect rect = macro.findLegend(macro.of(450, 36, 484, 76), "城镇_礼包", 0.7);
if (rect != null) { if (rect != null) {
macro.mouseLeftClick(rect); macro.mouseLeftClick(rect);
Logger.info("关闭充值广告弹框"); Logger.info("关闭充值广告弹框");
} }
} }
{ // 定位弹框,关闭弹框 { // 定位弹框,关闭弹框
ViewRect rect = macro.findLegend(macro.of(436,54,465,162), "城镇_礼包", 0.7); ViewRect rect = macro.findLegend(macro.of(436, 54, 465, 162), "城镇_礼包", 0.7);
if (rect != null) { if (rect != null) {
macro.mouseLeftClick(rect); macro.mouseLeftClick(rect);
Logger.info("关闭充值广告弹框"); Logger.info("关闭充值广告弹框");
} }
} }
{ // 定位弹框2 { // 定位弹框2
ViewRect rect = macro.findLegend(macro.of(436,54,465,162), "城镇_礼包2", 0.7); ViewRect rect = macro.findLegend(macro.of(436, 54, 465, 162), "城镇_礼包2", 0.7);
if (rect != null) { if (rect != null) {
macro.mouseLeftClick(rect); macro.mouseLeftClick(rect);
Logger.info("关闭充值广告弹框"); Logger.info("关闭充值广告弹框");
@ -130,6 +130,13 @@ public class Task_定位城镇 extends BaseTask {
Logger.info("关闭每日任务关闭弹框"); Logger.info("关闭每日任务关闭弹框");
} }
} }
{// 万象杂货铺
ViewRect rect = macro.matchLegend("城镇_万象杂货铺关闭", 0.9);
if (rect != null) {
macro.mouseLeftClick(rect);
Logger.info("关闭万象杂货铺");
}
}
} }
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.