diff --git a/src/main/java/xyz/wbsite/jmacro/wjdr/task/Task_自动练兵.java b/src/main/java/xyz/wbsite/jmacro/wjdr/task/Task_自动练兵.java index 7cbe7db..7feeaf8 100644 --- a/src/main/java/xyz/wbsite/jmacro/wjdr/task/Task_自动练兵.java +++ b/src/main/java/xyz/wbsite/jmacro/wjdr/task/Task_自动练兵.java @@ -48,6 +48,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("训练完成,去领取"); macro.mouseLeftClick(viewRects2[0]); macro.delay(1000); + Logger.info("点击领取"); macro.mouseLeftClick(macro.of(268, 431)); macro.delay(1000); @@ -63,7 +64,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("检测任意位置继续"); ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); if (兵营_任意位置继续 != null) { - Logger.error("点击继续"); + Logger.info("点击继续"); macro.mouseLeftClick(兵营_任意位置继续); macro.delay(1500); } @@ -71,14 +72,16 @@ public class Task_自动练兵 extends BaseTask { ViewRect 兵营_训练 = macro.waitAndMatchLegend("兵营_训练", 0.9, 2); if (兵营_训练 == null) { Logger.error("训练失败,未检测到兵营训练"); + return; } - Logger.error("确认训练"); + Logger.info("确认训练"); macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -86,18 +89,37 @@ public class Task_自动练兵 extends BaseTask { if (viewRects2[1] != null) { Logger.info("兵营空闲,去练兵"); macro.mouseLeftClick(viewRects2[1]); + macro.delay(1000); + + Logger.info("点击兵营"); + macro.mouseLeftClick(macro.of(268, 431)); + macro.delay(1000); Logger.info("点击训练"); macro.mouseLeftClick(macro.of(355, 632)); macro.delay(1000); - Logger.error("确认训练"); - macro.mouseLeftClick(macro.of(396, 885)); + Logger.info("检测任意位置继续"); + ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); + if (兵营_任意位置继续 != null) { + Logger.info("点击继续"); + macro.mouseLeftClick(兵营_任意位置继续); + macro.delay(1500); + } + + ViewRect 兵营_训练 = macro.waitAndMatchLegend("兵营_训练", 0.9, 2); + if (兵营_训练 == null) { + Logger.error("训练失败,未检测到兵营训练"); + return; + } + Logger.info("确认训练"); + macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -109,6 +131,7 @@ public class Task_自动练兵 extends BaseTask { return; } macro.mouseLeftClick(rect); + macro.delay(1000); } } @@ -143,6 +166,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("训练完成,去领取"); macro.mouseLeftClick(viewRects2[0]); macro.delay(1000); + Logger.info("点击领取"); macro.mouseLeftClick(macro.of(268, 431)); macro.delay(1000); @@ -158,7 +182,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("检测任意位置继续"); ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); if (兵营_任意位置继续 != null) { - Logger.error("点击继续"); + Logger.info("点击继续"); macro.mouseLeftClick(兵营_任意位置继续); macro.delay(1500); } @@ -166,14 +190,16 @@ public class Task_自动练兵 extends BaseTask { ViewRect 兵营_训练 = macro.waitAndMatchLegend("兵营_训练", 0.9, 2); if (兵营_训练 == null) { Logger.error("训练失败,未检测到兵营训练"); + return; } - Logger.error("确认训练"); + Logger.info("确认训练"); macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -181,18 +207,37 @@ public class Task_自动练兵 extends BaseTask { if (viewRects2[1] != null) { Logger.info("兵营空闲,去练兵"); macro.mouseLeftClick(viewRects2[1]); + macro.delay(1000); + + Logger.info("点击兵营"); + macro.mouseLeftClick(macro.of(268, 431)); + macro.delay(1000); Logger.info("点击训练"); macro.mouseLeftClick(macro.of(355, 632)); macro.delay(1000); - Logger.error("确认训练"); - macro.mouseLeftClick(macro.of(396, 885)); + Logger.info("检测任意位置继续"); + ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); + if (兵营_任意位置继续 != null) { + Logger.info("点击继续"); + macro.mouseLeftClick(兵营_任意位置继续); + macro.delay(1500); + } + + ViewRect 兵营_训练 = macro.waitAndMatchLegend("兵营_训练", 0.9, 2); + if (兵营_训练 == null) { + Logger.error("训练失败,未检测到兵营训练"); + return; + } + Logger.info("确认训练"); + macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -201,9 +246,11 @@ public class Task_自动练兵 extends BaseTask { Logger.info("关闭面板"); ViewRect rect = macro.matchLegend("城镇_关闭面板", 0.6); if (rect == null) { + Logger.error("关闭面板失败"); return; } macro.mouseLeftClick(rect); + macro.delay(1000); } } @@ -238,6 +285,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("训练完成,去领取"); macro.mouseLeftClick(viewRects2[0]); macro.delay(1000); + Logger.info("点击领取"); macro.mouseLeftClick(macro.of(268, 431)); macro.delay(1000); @@ -253,7 +301,7 @@ public class Task_自动练兵 extends BaseTask { Logger.info("检测任意位置继续"); ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); if (兵营_任意位置继续 != null) { - Logger.error("点击继续"); + Logger.info("点击继续"); macro.mouseLeftClick(兵营_任意位置继续); macro.delay(1500); } @@ -262,13 +310,14 @@ public class Task_自动练兵 extends BaseTask { if (兵营_训练 == null) { Logger.error("训练失败,未检测到兵营训练"); } - Logger.error("确认训练"); + Logger.info("确认训练"); macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -276,18 +325,37 @@ public class Task_自动练兵 extends BaseTask { if (viewRects2[1] != null) { Logger.info("兵营空闲,去练兵"); macro.mouseLeftClick(viewRects2[1]); + macro.delay(1000); + + Logger.info("点击兵营"); + macro.mouseLeftClick(macro.of(268, 431)); + macro.delay(1000); Logger.info("点击训练"); macro.mouseLeftClick(macro.of(355, 632)); macro.delay(1000); - Logger.error("确认训练"); - macro.mouseLeftClick(macro.of(396, 885)); + Logger.info("检测任意位置继续"); + ViewRect 兵营_任意位置继续 = macro.waitAndMatchLegend("兵营_任意位置继续", 0.9, 2); + if (兵营_任意位置继续 != null) { + Logger.info("点击继续"); + macro.mouseLeftClick(兵营_任意位置继续); + macro.delay(1500); + } + + ViewRect 兵营_训练 = macro.waitAndMatchLegend("兵营_训练", 0.9, 2); + if (兵营_训练 == null) { + Logger.error("训练失败,未检测到兵营训练"); + return; + } + Logger.info("确认训练"); + macro.mouseLeftClick(兵营_训练); macro.delay(1000); ViewRect 兵营_返回 = macro.matchLegend("兵营_返回", 0.9D); if (兵营_返回 == null) { Logger.error("兵营返回失败"); + return; } macro.mouseLeftClick(兵营_返回); macro.delay(1000); @@ -299,6 +367,7 @@ public class Task_自动练兵 extends BaseTask { return; } macro.mouseLeftClick(rect); + macro.delay(1000); } } }