JS脚本:周本和打牌 bug 修复 (#716)

* 测试

* 你的提交信息

* 周本全2.0更新以及打牌更新

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* Update manifest.json

* 打牌、周本bug 修复
This commit is contained in:
5117600049
2025-05-06 19:48:27 +08:00
committed by GitHub
parent bada32fbf8
commit c73252d674
11 changed files with 137 additions and 49 deletions

View File

@@ -1,5 +1,26 @@
(async function () {
//检测传送结束 await tpEndDetection();
async function tpEndDetection() {
const region = RecognitionObject.ocr(1690, 230, 75, 350);// 队伍名称区域
let tpTime = 0;
await sleep(3000);//点击传送后等待一段时间避免误判
//最多30秒传送时间
while (tpTime < 300) {
let capture = captureGameRegion();
let res = capture.find(region);
if (!res.isEmpty()){
log.info("传送完成");
await sleep(1200);//传送结束后有僵直
return;
}
tpTime++;
await sleep(100);
}
throw new Error('传送时间超时');
}
let teaPot = settings.teaPot ?? 0;
let delay = 2000;
let ksl = settings.kslSelect ?? "枫丹";
async function kslAutoPath(location) {
@@ -89,11 +110,7 @@
await sleep(delay);
await pathingScript.runFile("assets/recover.json");
await sleep(5000);//前往神像,避免茶壶放不出来
let teaPot = settings.teaPot ?? 0;
await sleep(1000);
await sleep(500);//前往神像,避免茶壶放不出来
if(teaPot){
keyPress("B");
@@ -105,8 +122,8 @@ if(teaPot){
click(1700, 1018); //放置
await sleep(1500);
keyPress("F"); //进入
await sleep(20000);
await tpEndDetection();
await sleep(1500);
if (teaPot == "璃月"){
keyDown("D");
await sleep(500);

View File

@@ -8,8 +8,8 @@ async function checkChallengeResults() {
const region1 = RecognitionObject.ocr(785, 890, 340, 82);// 对话区域
let capture = captureGameRegion();
let res1 = capture.find(region1);
if (res1.test != "对局胜利"){
log.info("挑战失败");
if (1){
await sleep(1000);
click(960, 540);
await sleep(500);
@@ -25,15 +25,7 @@ async function checkChallengeResults() {
await sleep(1000);
return;
}
else{
log.info("挑战成功");
await sleep(1000);
click(754,915 );//退出挑战
await sleep(4000);
await autoConversation();
await sleep(1000);
return;
}
}
@@ -42,7 +34,7 @@ async function autoConversation() {
const region1 = RecognitionObject.ocr(785, 890, 340, 82);// 对话区域
const region2 = RecognitionObject.ocr(1250, 400, 660, 440);// 选项区域
let talkTime = 0;
await sleep(500);//点击后等待一段时间避免误判
await sleep(2000);//点击后等待一段时间避免误判
//最多10次对话
while (talkTime < 20) {
let capture = captureGameRegion();
@@ -72,7 +64,7 @@ async function autoConversation() {
async function tpEndDetection() {
const region = RecognitionObject.ocr(1690, 230, 75, 350);// 队伍名称区域
let tpTime = 0;
await sleep(500);//点击传送后等待一段时间避免误判
await sleep(1500);//点击传送后等待一段时间避免误判
//最多30秒传送时间
while (tpTime < 300) {
let capture = captureGameRegion();
@@ -332,7 +324,7 @@ keyDown("w");
await sleep(1200);
keyUp("d");
keyUp("w");
await sleep(700);
await sleep(600);
}
//前往二号桌
async function gotoTable2() {

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "打牌一条龙",
"version": "1.5",
"version": "1.6",
"description": "只靠一个牌组的话,胜率还是太低了,所以有没有既简单又强势的卡组推荐下呢?",
"authors": [
{

View File

@@ -55,7 +55,7 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 80){
else if(advanceNum > 20){
throw new Error('前进时间超时');
}
// 2. 未到达领奖点,则调整视野
@@ -94,7 +94,7 @@ const autoNavigateToReward = async () => {
}
// 3. 前进一小步
keyDown("w");
await sleep(800);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -123,10 +123,19 @@ async function autoFightAndEndDetection() {
if (hasText1 && !hasText2 && hasText3) {
challengeNum++;
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -27,9 +27,22 @@ async function autoFightAndEndDetection() {
await sleep(1800);
keyUp("s");
challengeNum++;
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 40;
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {
@@ -76,12 +89,12 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 30){
else if(advanceNum > 15){
throw new Error('前进时间超时');
}
// 前进一小步
keyDown("w");
await sleep(700);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}

View File

@@ -54,7 +54,7 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 80){
else if(advanceNum > 30){
throw new Error('前进时间超时');
}
// 2. 未到达领奖点,则调整视野
@@ -93,7 +93,7 @@ const autoNavigateToReward = async () => {
}
// 3. 前进一小步
keyDown("w");
await sleep(800);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -123,9 +123,23 @@ async function autoFightAndEndDetection() {
challengeNum++;
await sleep(500);//避免切人冷却,导致角色识别失败
log.info(`执行第${challengeNum}次战斗`);
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -42,12 +42,12 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 30){
else if(advanceNum > 20){
throw new Error('前进时间超时');
}
// 前进一小步
keyDown("w");
await sleep(700);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -78,11 +78,19 @@ async function autoFightAndEndDetection() {
keyDown("s");
await sleep(1200);
keyUp("s");
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -152,12 +152,12 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 30){
else if(advanceNum > 20){
throw new Error('前进时间超时');
}
// 前进一小步
keyDown("w");
await sleep(700);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -189,11 +189,19 @@ async function autoFightAndEndDetection() {
keyDown("s");
await sleep(1800);
keyUp("s");
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -153,12 +153,12 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 30){
else if(advanceNum > 25){
throw new Error('前进时间超时');
}
// 前进一小步
keyDown("w");
await sleep(700);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -191,10 +191,19 @@ async function autoFightAndEndDetection() {
await sleep(1800);
keyUp("s");
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -54,7 +54,7 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 80){
else if(advanceNum > 20){
throw new Error('前进时间超时');
}
// 2. 未到达领奖点,则调整视野
@@ -72,7 +72,7 @@ const autoNavigateToReward = async () => {
await sleep(800);
keyUp("a");
keyDown("w");
await sleep(800);
await sleep(500);
keyUp("w");
}
if (iconRes.x >= 920 && iconRes.x <= 980 && iconRes.y <= 540) {
@@ -93,7 +93,7 @@ const autoNavigateToReward = async () => {
}
// 3. 前进一小步
keyDown("w");
await sleep(800);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -122,10 +122,19 @@ async function autoFightAndEndDetection() {
if (hasText1 && !hasText2 && hasText3) {
challengeNum++;
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {

View File

@@ -54,7 +54,7 @@ const autoNavigateToReward = async () => {
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
return;
}
else if(advanceNum > 80){
else if(advanceNum > 30){
throw new Error('前进时间超时');
}
// 2. 未到达领奖点,则调整视野
@@ -93,7 +93,7 @@ const autoNavigateToReward = async () => {
}
// 3. 前进一小步
keyDown("w");
await sleep(800);
await sleep(500);
keyUp("w");
await sleep(100); // 等待角色移动稳定
}
@@ -122,10 +122,19 @@ async function autoFightAndEndDetection() {
if (hasText1 && !hasText2 && hasText3) {
challengeNum++;
await sleep(500);//避免切人冷却,导致角色识别失败
capture = captureGameRegion();
res1 = capture.find(region1);
res2 = capture.find(region2);
res3 = capture.find(region3);
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
//二次检测避免无法启动战斗
if (hasText1 && !hasText2 && hasText3){
log.info(`执行第${challengeNum}次战斗`);
challengeTime = challengeTime + 205;
await dispatcher.runTask(new SoloTask("AutoFight"));
}
}
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
else if (hasText2 && !hasText1 && hasText3) {