修正啟動流程錯誤
This commit is contained in:
1 parent
4eeea3033f
commit
084dc4cdf7
10 files changed
+869
-12
No files matched your search
@@ -0,0 +1,89 @@
|
||||
# **AutoCatAndSoup v0.0.0**
|
||||
|
||||
Date 今天晚上到圖書館
|
||||
|
||||
## 更新
|
||||
- 優化 `照相` 判斷邏輯
|
||||
- 新增 `返回設定` 按鍵
|
||||
|
||||
|
||||
## 支援
|
||||
- Cat and Soup 4.29.1
|
||||
- 解析度:720x1280
|
||||
- 繁體中文
|
||||
|
||||
---
|
||||
|
||||
# **AutoCatAndSoup v1.1.0**
|
||||
|
||||
Date
|
||||
|
||||
## 更新
|
||||
- 新增`應用圖標`
|
||||
- 新增`語言包`功能(繁體中文, 英文)
|
||||
- 修正`自動啟動`錯誤
|
||||
- 調整`玩耍`歸位精細度
|
||||
-
|
||||
## 支援
|
||||
- 遊戲版本:4.29.2
|
||||
- 解析度:720x1280
|
||||
- 語言:繁體中文、English
|
||||
|
||||
## Update
|
||||
- Add `application icon`
|
||||
- Add `language package`(Traditional chinese, English)
|
||||
- Fix `Auto restart` error
|
||||
- Increase `PLay` repositioning precision
|
||||
|
||||
## Support
|
||||
- Game version: 4.29.2
|
||||
- Resolution: 720x1280
|
||||
- Language: Traditional chinese, English
|
||||
|
||||
# **AutoCatAndSoup v1.0.2**
|
||||
|
||||
2026-03-04
|
||||
|
||||
## 更新
|
||||
- 修改`浮窗權限`為自動詢問
|
||||
> Note: 螢幕擷取權限無法預先獲取,保持啟動後詢問
|
||||
- 新增主頁面判斷 (可避免提前執行腳本)
|
||||
- 新增`隨機任務-玩耍`誤觸退出判斷、玩具自動歸位
|
||||
- 合併一般模式以及免廣告模式下 `設施升級` 的判斷
|
||||
|
||||
## 支援
|
||||
- Cat and Soup 4.29.1
|
||||
- 解析度:720x1280
|
||||
- 繁體中文
|
||||
|
||||
# **AutoCatAndSoup v1.0.1**
|
||||
|
||||
2026-02-26
|
||||
|
||||
## 更新
|
||||
- 修復`食譜升級`退出停滯
|
||||
- 修復`販賣商品`偵測問題
|
||||
- 優化`照相`執行邏輯
|
||||
- 優化`成就`執行邏輯
|
||||
- 優化`設施升級`判斷邏輯
|
||||
- 新增`成就`收取每日目標獎勵
|
||||
|
||||
## 支援
|
||||
- Cat and Soup 4.28.1
|
||||
- 解析度:720x1280
|
||||
- 繁體中文
|
||||
|
||||
# **AutoCatAndSoup v1.0.0**
|
||||
|
||||
2026-02-24
|
||||
|
||||
## 實作
|
||||
- 基本任務(販賣、設施升級、食譜升級)
|
||||
- 獎勵領取(掛機、罐子精靈、商人、信箱、成就)
|
||||
- 隨機任務(拍照、禮物、玩耍)
|
||||
- 浮動視窗暫停控制
|
||||
- 儲存上次使用功能
|
||||
|
||||
## 支援
|
||||
- Cat and Soup 4.28.1
|
||||
- 解析度:720x1280
|
||||
+6
-5
@@ -21,21 +21,22 @@ Date
|
||||
## 更新
|
||||
- 新增`應用圖標`
|
||||
- 新增`語言包`功能(繁體中文, 英文)
|
||||
- 優化腳本架構
|
||||
- 增加`玩耍`歸位精細度
|
||||
- 修正`自動啟動`錯誤
|
||||
- 調整`玩耍`歸位精細度
|
||||
-
|
||||
## 支援
|
||||
- 遊戲版本:4.29.1
|
||||
- 遊戲版本:4.29.2
|
||||
- 解析度:720x1280
|
||||
- 語言:繁體中文、English
|
||||
|
||||
## Update
|
||||
- Add `application icon`
|
||||
- Add `language package`(Traditional chinese, English)
|
||||
- d
|
||||
- Fix `Auto restart` error
|
||||
- Increase `PLay` repositioning precision
|
||||
|
||||
## Support
|
||||
- Game version: 4.29.1
|
||||
- Game version: 4.29.2
|
||||
- Resolution: 720x1280
|
||||
- Language: Traditional chinese, English
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 專案名稱: AutoCatAndSoup
|
||||
* Copyright (C) 2026 Sthkm3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const i18n = {};
|
||||
|
||||
const locale = java.util.Locale.getDefault().getLanguage();
|
||||
|
||||
let currentLang = "zh";
|
||||
|
||||
if (locale.startsWith("en")) {
|
||||
currentLang = "en";
|
||||
}
|
||||
|
||||
// 支援的語系定義
|
||||
const languages = {
|
||||
"zh": {
|
||||
// UI 標題與標籤
|
||||
"title": "Auto CatAndSoup 設定",
|
||||
"basic_section": "── 基本 ──",
|
||||
"collect_section": "── 領取 ──",
|
||||
"random_task": "─ 隨機任務 ─",
|
||||
"daily_task": "─ 每日任務 ─",
|
||||
|
||||
// 選項文字
|
||||
"sell_product": "販賣商品",
|
||||
"upgrade_facility": "設施升級",
|
||||
"upgrade_recipe": "食譜升級",
|
||||
"build_facility": "設施建設(未開發)",
|
||||
"afk_reward": "掛機獎勵",
|
||||
"jar_reward": "罐子精靈獎勵",
|
||||
"merchant_reward": "商人獎勵",
|
||||
"butterfly_reward": "黃金蝴蝶獎勵",
|
||||
"frog_reward": "青蛙王子獎勵",
|
||||
"mail": "信箱",
|
||||
"achievement": "成就",
|
||||
"take_photo": "拍攝照片",
|
||||
"gift": "禮物",
|
||||
"play": "玩耍",
|
||||
"travel": "旅行(未開發)",
|
||||
"fishing": "釣魚(未開發)",
|
||||
"gacha": "扭蛋(未開發)",
|
||||
"shooting": "投籃(未開發)",
|
||||
|
||||
// 按鈕與提示
|
||||
"start": "啟動",
|
||||
"pause": "暫停",
|
||||
|
||||
"perm_floaty": "請開啟懸浮窗權限",
|
||||
"perm_accessibility": "請啟用無障礙服務",
|
||||
"launching": "嘗試開啟遊戲..."
|
||||
},
|
||||
|
||||
"en": {
|
||||
"title": "Auto CatAndSoup Settings",
|
||||
"basic_section": "── Basic ──",
|
||||
"collect_section": "── Collect ──",
|
||||
"random_task": "─ Random Task ─",
|
||||
"daily_task": "─ Daily Task ─",
|
||||
|
||||
"sell_product": "Sell Products",
|
||||
"upgrade_facility": "Upgrade Facility",
|
||||
"upgrade_recipe": "Upgrade Recipe",
|
||||
"build_facility": "Build (Dev)",
|
||||
"afk_reward": "AFK Reward",
|
||||
"jar_reward": "Jar Spirit",
|
||||
"merchant_reward": "Merchant Reward",
|
||||
"butterfly_reward": "Golden Butterfly",
|
||||
"frog_reward": "Frog Prince",
|
||||
"mail": "Mailbox",
|
||||
"achievement": "Achievement",
|
||||
"take_photo": "Take Photo",
|
||||
"gift": "Gifts",
|
||||
"play": "Play",
|
||||
"travel": "Travel (Dev)",
|
||||
"fishing": "Fishing (Dev)",
|
||||
"gacha": "Gacha (Dev)",
|
||||
"shooting": "Basket (Dev)",
|
||||
|
||||
"start": "START",
|
||||
"pause": "PAUSE",
|
||||
"perm_floaty": "Please enable Floating Window permission",
|
||||
"perm_accessibility": "Please enable Accessibility service",
|
||||
"launching": "Launching game..."
|
||||
}
|
||||
};
|
||||
|
||||
function t(key){
|
||||
if(languages[currentLang] && languages[currentLang][key]){
|
||||
return languages[currentLang][key];
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
module.exports = t;
|
||||
@@ -0,0 +1,230 @@
|
||||
-/**
|
||||
* 專案名稱: AutoCatAndSoup
|
||||
* Copyright (C) 2026 Sthkm3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
"ui";
|
||||
|
||||
importClass(android.provider.Settings);
|
||||
|
||||
// 基本設定
|
||||
const STORAGE = storages.create("AutoCatAndSoupConfig");
|
||||
|
||||
// 語言包
|
||||
const T = require("./i18n.js");
|
||||
|
||||
// 設定資料
|
||||
let config = {
|
||||
sellProduct: STORAGE.get("sellProduct", false),
|
||||
upgradeFacility: STORAGE.get("upgradeFacility", false),
|
||||
upgradeRecipe: STORAGE.get("upgradeRecipe", false),
|
||||
Photo: STORAGE.get("Photo", false),
|
||||
Gift: STORAGE.get("Gift", false),
|
||||
Play: STORAGE.get("Play", false),
|
||||
receiveAFK: STORAGE.get("receiveAFK", false),
|
||||
receiveJar: STORAGE.get("receiveJar", false),
|
||||
receiveMerchant: STORAGE.get("receiveMerchant", false),
|
||||
receiveButterfly: STORAGE.get("receiveButterfly", false),
|
||||
receiveFrog: STORAGE.get("receiveFrog", false),
|
||||
receiveMail: STORAGE.get("receiveMail", false),
|
||||
receiveAchievement: STORAGE.get("receiveAchievement", false)
|
||||
};
|
||||
|
||||
// 浮窗權限檢查
|
||||
function checkFloatyPermission() {
|
||||
if (!Settings.canDrawOverlays(context)) {
|
||||
toast("perm_floaty");
|
||||
var intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
app.startActivity(intent);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 無障礙檢查
|
||||
function checkAccessibility() {
|
||||
if (!auto.service) {
|
||||
toast("perm_accessibility");
|
||||
app.startActivity({
|
||||
action: Settings.ACTION_ACCESSIBILITY_SETTINGS
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// UI
|
||||
ui.layout(
|
||||
<vertical>
|
||||
<text text="{{T('title')}}" textSize="20sp" textColor="#000000" gravity="center_horizontal" padding="16"/>
|
||||
|
||||
<scroll layout_weight="1">
|
||||
<vertical padding="24">
|
||||
<text text="{{T('basic_section')}}" textColor="#888888"/>
|
||||
<checkbox id="cbSell" text="{{T('sell_product')}}"/>
|
||||
<checkbox id="cbUpgrade" text="{{T('upgrade_facility')}}"/>
|
||||
<checkbox id="cbUpgrade2" text="{{T('upgrade_recipe')}}"/>
|
||||
<checkbox id="cbBuild" text="{{T('build_facility')}}"/>
|
||||
|
||||
<space h="16"/>
|
||||
<text text="{{T('collect_section')}}" textColor="#888888"/>
|
||||
<checkbox id="cbReceive" text="{{T('afk_reward')}}"/>
|
||||
<checkbox id="cbReceive2" text="{{T('jar_reward')}}"/>
|
||||
<checkbox id="cbReceive3" text="{{T('merchant_reward')}}"/>
|
||||
<checkbox id="cbReceive4" text="{{T('butterfly_reward')}}"/>
|
||||
<checkbox id="cbReceive5" text="{{T('frog_reward')}}"/>
|
||||
<checkbox id="cbReceive6" text="{{T('mail')}}"/>
|
||||
<checkbox id="cbReceive7" text="{{T('achievement')}}"/>
|
||||
|
||||
<space h="16"/>
|
||||
<text text="{{T('random_task')}}" textColor="#888888"/>
|
||||
<checkbox id="cbPhoto" text="{{T('take_photo')}}"/>
|
||||
<checkbox id="cbGift" text="{{T('gift')}}"/>
|
||||
<checkbox id="cbPlay" text="{{T('play')}}"/>
|
||||
<checkbox id="cbTravel" text="{{T('travel')}}"/>
|
||||
|
||||
<space h="16"/>
|
||||
<text text="{{T('daily_task')}}" textColor="#888888"/>
|
||||
<checkbox id="cbFishing" text="{{T('fishing')}}"/>
|
||||
<checkbox id="cbGacha" text="{{T('gacha')}}"/>
|
||||
<checkbox id="cbShooting" text="{{T('shooting')}}"/>
|
||||
</vertical>
|
||||
</scroll>
|
||||
|
||||
<button id="btnStart" text="{{T('start')}}" textSize="18sp" layout_gravity="center_horizontal" margin="16"/>
|
||||
</vertical>
|
||||
);
|
||||
|
||||
// 初始化狀態
|
||||
ui.cbSell.checked = config.sellProduct;
|
||||
ui.cbUpgrade.checked = config.upgradeFacility;
|
||||
ui.cbUpgrade2.checked = config.upgradeRecipe;
|
||||
ui.cbPhoto.checked = config.Photo;
|
||||
ui.cbGift.checked = config.Gift;
|
||||
ui.cbPlay.checked = config.Play;
|
||||
ui.cbReceive.checked = config.receiveAFK;
|
||||
ui.cbReceive2.checked = config.receiveJar;
|
||||
ui.cbReceive3.checked = config.receiveMerchant;
|
||||
ui.cbReceive4.checked = config.receiveButterfly;
|
||||
ui.cbReceive5.checked = config.receiveFrog;
|
||||
ui.cbReceive6.checked = config.receiveMail;
|
||||
ui.cbReceive7.checked = config.receiveAchievement;
|
||||
|
||||
// 未開發功能鎖定
|
||||
ui.cbBuild.enabled = false;
|
||||
ui.cbTravel.enabled = false;
|
||||
ui.cbFishing.enabled = false;
|
||||
ui.cbGacha.enabled = false;
|
||||
ui.cbShooting.enabled = false;
|
||||
|
||||
// 勾選監聽
|
||||
ui.cbSell.on("check", checked => {
|
||||
config.sellProduct = checked;
|
||||
STORAGE.put("sellProduct", checked);
|
||||
});
|
||||
|
||||
ui.cbUpgrade.on("check", checked => {
|
||||
config.upgradeFacility = checked;
|
||||
STORAGE.put("upgradeFacility", checked);
|
||||
});
|
||||
|
||||
ui.cbUpgrade2.on("check", checked => {
|
||||
config.upgradeRecipe = checked;
|
||||
STORAGE.put("upgradeRecipe", checked);
|
||||
});
|
||||
|
||||
ui.cbPhoto.on("check", checked => {
|
||||
config.Photo = checked;
|
||||
STORAGE.put("Photo", checked);
|
||||
});
|
||||
|
||||
ui.cbGift.on("check", checked => {
|
||||
config.Gift = checked;
|
||||
STORAGE.put("Gift", checked);
|
||||
});
|
||||
|
||||
ui.cbPlay.on("check", checked => {
|
||||
config.Play = checked;
|
||||
STORAGE.put("Play", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive.on("check", checked => {
|
||||
config.receiveAFK = checked;
|
||||
STORAGE.put("receiveAFK", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive2.on("check", checked => {
|
||||
config.receiveJar = checked;
|
||||
STORAGE.put("receiveJar", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive3.on("check", checked => {
|
||||
config.receiveMerchant = checked;
|
||||
STORAGE.put("receiveMerchant", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive4.on("check", checked => {
|
||||
config.receiveButterfly = checked;
|
||||
STORAGE.put("receiveButterfly", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive5.on("check", checked => {
|
||||
config.receiveFrog = checked;
|
||||
STORAGE.put("receiveFrog", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive6.on("check", checked => {
|
||||
config.receiveMail = checked;
|
||||
STORAGE.put("receiveMail", checked);
|
||||
});
|
||||
|
||||
ui.cbReceive7.on("check", checked => {
|
||||
config.receiveAchievement = checked;
|
||||
STORAGE.put("receiveAchievement", checked);
|
||||
});
|
||||
|
||||
// 啟動
|
||||
ui.btnStart.on("click", () => {
|
||||
if (!checkAccessibility()) return;
|
||||
if (!checkFloatyPermission()) return;
|
||||
|
||||
STORAGE.put("sellProduct", config.sellProduct);
|
||||
STORAGE.put("upgradeFacility", config.upgradeFacility);
|
||||
STORAGE.put("upgradeRecipe", config.upgradeRecipe);
|
||||
STORAGE.put("Photo", config.Photo);
|
||||
STORAGE.put("Gift", config.Gift);
|
||||
STORAGE.put("Play", config.Play);
|
||||
STORAGE.put("receiveAFK", config.receiveAFK);
|
||||
STORAGE.put("receiveJar", config.receiveJar);
|
||||
STORAGE.put("receiveMerchant", config.receiveMerchant);
|
||||
STORAGE.put("receiveButterfly", config.receiveButterfly);
|
||||
STORAGE.put("receiveFrog", config.receiveFrog);
|
||||
STORAGE.put("receiveMail", config.receiveMail);
|
||||
STORAGE.put("receiveAchievement", config.receiveAchievement);
|
||||
|
||||
ui.finish();
|
||||
|
||||
engines.execScriptFile("run.js");
|
||||
});
|
||||
|
||||
// 啟動時確認權限
|
||||
setTimeout(() => {
|
||||
checkFloatyPermission();
|
||||
checkAccessibility();
|
||||
}, 300);
|
||||
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* 專案名稱: AutoCatAndSoup
|
||||
* Copyright (C) 2026 Sthkm3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
"auto";
|
||||
|
||||
const STORAGE = storages.create("AutoCatAndSoupConfig");
|
||||
const T = require("./i18n.js");
|
||||
const Tasks = require("./tasks.js");
|
||||
|
||||
const SCREEN_W = 720;
|
||||
const SCREEN_H = 1280;
|
||||
|
||||
// 讀取
|
||||
let config = {
|
||||
sellProduct: STORAGE.get("sellProduct", false),
|
||||
upgradeFacility: STORAGE.get("upgradeFacility", false),
|
||||
upgradeRecipe: STORAGE.get("upgradeRecipe", false),
|
||||
Photo: STORAGE.get("Photo", false),
|
||||
Gift: STORAGE.get("Gift", false),
|
||||
Play: STORAGE.get("Play", false),
|
||||
receiveAFK: STORAGE.get("receiveAFK", false),
|
||||
receiveJar: STORAGE.get("receiveJar", false),
|
||||
receiveMerchant: STORAGE.get("receiveMerchant", false),
|
||||
receiveButterfly: STORAGE.get("receiveButterfly", false),
|
||||
receiveFrog: STORAGE.get("receiveFrog", false),
|
||||
receiveMail: STORAGE.get("receiveMail", false),
|
||||
receiveAchievement: STORAGE.get("receiveAchievement", false)
|
||||
};
|
||||
|
||||
// 小視窗
|
||||
let isPaused = false;
|
||||
|
||||
let win = floaty.rawWindow(
|
||||
<vertical bg="#AA000000" padding="6">
|
||||
<text text="Auto CatAndSoup" textColor="#FFFFFF" textSize="12sp"/>
|
||||
<button id="btnPause" text="pause"/>
|
||||
</vertical>
|
||||
);
|
||||
|
||||
win.setPosition(0, (SCREEN_H / 2) - 80);
|
||||
win.setSize(160, -2); win.btnPause.click(() => { isPaused = !isPaused;
|
||||
|
||||
win.btnPause.setText(isPaused ? "{{T('start')}}" : "{{T('pause')}}");
|
||||
toast(isPaused ? "{{T('pause')}}" : "{{T('start')}}"); });
|
||||
|
||||
// 主循環
|
||||
while (true) {
|
||||
|
||||
//暫停等待
|
||||
if (isPaused) {
|
||||
sleep(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 判斷應用
|
||||
if (currentPackage() != "com.hidea.cat" && !isPaused) {
|
||||
app.launchPackage("com.hidea.cat");
|
||||
toast("{{T('launchingʼ)}}");
|
||||
var img = captureScreen();
|
||||
var launch_time = 0;
|
||||
while(!images.detectsColor(img, "#F4ECD3", 685, 1095) && launch_time <= 600) //啟動五分鐘無果 再次啟動
|
||||
launch_time += 1;
|
||||
sleep(1000);
|
||||
var img = captureScreen();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var img = captureScreen();
|
||||
|
||||
// 販賣商品
|
||||
if (config.sellProduct && !isPaused) {
|
||||
let l = (
|
||||
!images.detectsColor(img, "#B38282", 35, 1267) &&
|
||||
!images.detectsColor(img, "#DCAB82", 35, 1267)
|
||||
)
|
||||
let r = (
|
||||
!images.detectsColor(img, "#B38282", 45, 1267) &&
|
||||
!images.detectsColor(img, "#DCAB82", 45, 1267)
|
||||
)
|
||||
if (l || r) {
|
||||
click(60, 1222);
|
||||
}
|
||||
}
|
||||
|
||||
// 設施升級
|
||||
if (config.upgradeFacility && !isPaused) {
|
||||
if (images.detectsColor(img, "#FFFFFF", 87, 1032)) {
|
||||
click(31, 1044);
|
||||
}
|
||||
}
|
||||
|
||||
// 食譜升級
|
||||
if (config.upgradeRecipe && !isPaused) {
|
||||
if (images.detectsColor(img, "#FD7171", 581, 1081)) {
|
||||
click(550, 1101); sleep(500);
|
||||
var img = captureScreen();
|
||||
while (images.detectsColor(img, "#8EE3D3", 458, 1037)){
|
||||
click(535, 1053);
|
||||
var img = captureScreen();
|
||||
} sleep(100);
|
||||
back(); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 拍照
|
||||
if (config.Photo && !isPaused) {
|
||||
if (images.detectsColor(img, "#B5B5C6", 648, 813)){
|
||||
click(660, 815);
|
||||
var img = captureScreen();
|
||||
while(!images.detectsColor(img, "#FFFFFF", 360, 950)){
|
||||
sleep(100);
|
||||
var img = captureScreen();
|
||||
}
|
||||
click(360, 1025);
|
||||
var img = captureScreen();
|
||||
while(!images.detectsColor(img, "#F4ECD3", 360, 1150)){
|
||||
sleep(100);
|
||||
var img = captureScreen();
|
||||
}
|
||||
back(); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 禮物
|
||||
if (config.Gift && !isPaused) {
|
||||
if (images.detectsColor(img, "#FFFFFF", 680, 725) && images.detectsColor(img, "#FFFFFF", 680, 715)) {
|
||||
click(662, 745);
|
||||
var img = captureScreen();
|
||||
while (!images.detectsColor(img, "#FFFFFF", 250, 825)){
|
||||
sleep(100);
|
||||
var img = captureScreen();
|
||||
} sleep(500);
|
||||
click(360, 760); sleep(500);
|
||||
back(); sleep(2000);
|
||||
var img = captureScreen();
|
||||
if (images.detectsColor(img, "#FFFFFF", 250, 830)){
|
||||
click(360, 735); sleep(3000);
|
||||
back();
|
||||
}
|
||||
sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 玩耍
|
||||
if (config.Play && !isPaused) {
|
||||
if (images.detectsColor(img, "#F9DBDC", 673, 737)) {
|
||||
click(645, 739); sleep(3000);
|
||||
click(360, 800); sleep(500);
|
||||
var playing_screen = (images.detectsColor(img, "#FDEFEF", 575, 400) && !images.detectsColor(img, "#F2B1B1", 501, 858));
|
||||
var img = captureScreen();
|
||||
while(images.detectsColor(img, "#F2B1B1", 527, 846) && !isPaused){
|
||||
swipe(360, 800, 360, 200, 500); sleep(50);// up
|
||||
swipe(360, 300, 360, 900, 500); sleep(50);// down
|
||||
|
||||
img = captureScreen();
|
||||
var firstY = -1;
|
||||
var lastY = -1;
|
||||
|
||||
// 從上往下
|
||||
for (var y = 300; y <= 800; y += 5) {
|
||||
if (images.detectsColor(img, "#F9DBDC", 360, y)) {
|
||||
firstY = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 從下往上
|
||||
for (var y = 800; y >= 300; y -= 5) {
|
||||
if (images.detectsColor(img, "#F9DBDC", 360, y)) {
|
||||
lastY = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstY !== -1 && lastY !== -1) {
|
||||
var avgY = (firstY + lastY) / 2;
|
||||
swipe(360, avgY, 360, 900, 500); sleep(50);
|
||||
}
|
||||
|
||||
var img = captureScreen();
|
||||
}
|
||||
click(415, 923); sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
// 掛機獎勵
|
||||
if (config.receiveAFK && !isPaused) {
|
||||
if (images.detectsColor(img, "#E3C5AE", 371, 1092)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 809); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 罐子精靈獎勵
|
||||
if (config.receiveJar && !isPaused) {
|
||||
if (images.detectsColor(img, "#AAAAAA", 433, 1132)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 844); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 商人獎勵
|
||||
if (config.receiveMerchant && !isPaused) {
|
||||
if (images.detectsColor(img, "#DB937D", 351, 1152)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 755); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 黃金蝴蝶獎勵
|
||||
if (config.receiveButterfly && !isPaused) {
|
||||
if (images.detectsColor(img, "#FBE771", 71, 280)) {
|
||||
click(71, 280); sleep(2000);
|
||||
click(360, 650); sleep(300);
|
||||
click(423, 724); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 青蛙王子獎勵
|
||||
if (config.receiveFrog && !isPaused) {
|
||||
if (images.detectsColor(img, "#D8E0B7", 55, 291) && images.detectsColor(img, "#D8E0B7", 49, 291)) {
|
||||
click(71, 280); sleep(2000);
|
||||
click(360, 650); sleep(300);
|
||||
click(423, 724); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 信箱
|
||||
if (config.receiveMail && !isPaused) {
|
||||
if (images.detectsColor(img, "#FFFFFF", 376, 199) && images.detectsColor(img, "#F2DFC7", 356, 234)) {
|
||||
click(360, 208); sleep(1000);
|
||||
var img = captureScreen();
|
||||
while (images.detectsColor(img, "#8EE3D3", 570, 380) && !isPaused) {
|
||||
click(484, 398);
|
||||
sleep(500);
|
||||
var img = captureScreen();
|
||||
if (images.detectsColor(img, "#E5D8CA", 489, 632)) {
|
||||
click(400, 720);
|
||||
var img = captureScreen();
|
||||
} sleep(500);
|
||||
var img = captureScreen();
|
||||
}
|
||||
back(); sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
// 成就與任務
|
||||
if (config.receiveAchievement && !isPaused) {
|
||||
if (images.detectsColor(img, "#FF6F6E", 680, 243)) {
|
||||
click(662, 263); sleep(1000);
|
||||
var img = captureScreen();
|
||||
if (images.detectsColor(img, "#FF6F6E", 307, 234)) {
|
||||
click(225, 250); sleep(500);
|
||||
var img = captureScreen();
|
||||
while (images.detectsColor(img, "#8EE3D3", 520, 460) && !isPaused) {
|
||||
click(520, 470); sleep(100);
|
||||
var img = captureScreen();
|
||||
}
|
||||
sleep(500);
|
||||
if (images.detectsColor(img, "#F3E5D3", 370, 380) && !isPaused) {
|
||||
click(370, 380);
|
||||
}
|
||||
}
|
||||
else {
|
||||
click(495, 250); sleep(500);
|
||||
var img = captureScreen();
|
||||
while (images.detectsColor(img, "#8EE3D3", 520, 344) && !isPaused) {
|
||||
click(520, 344); sleep(100);
|
||||
var img = captureScreen();
|
||||
}
|
||||
}
|
||||
back(); sleep(500);
|
||||
}
|
||||
}
|
||||
img.recycle();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
while (true) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --- 根據 Config 呼叫對應的 Task ---
|
||||
if (config.sellProduct) Tasks.sellProduct(img);
|
||||
|
||||
if (config.upgradeFacility) Tasks.upgradeFacility(img);
|
||||
|
||||
if (config.upgradeRecipe) Tasks.upgradeRecipe(img);
|
||||
|
||||
if (config.Photo) Tasks.takePhoto(img);
|
||||
|
||||
// 獎勵領取類
|
||||
if (config.receiveAFK || config.receiveJar || config.receiveMerchant) {
|
||||
Tasks.collectRewards(img);
|
||||
}
|
||||
|
||||
if (config.receiveButterfly || config.receiveFrog) {
|
||||
Tasks.randomRewards(img);
|
||||
}
|
||||
|
||||
// --- 結束本輪 ---
|
||||
img.recycle();
|
||||
sleep(200);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* 專案名稱: AutoCatAndSoup
|
||||
* Copyright (C) 2026 Sthkm3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var tasks = {};
|
||||
|
||||
// 1. 販賣商品
|
||||
tasks.sellProduct = function(img) {
|
||||
let l = (!images.detectsColor(img, "#B38282", 35, 1267) && !images.detectsColor(img, "#DCAB82", 35, 1267));
|
||||
let r = (!images.detectsColor(img, "#B38282", 45, 1267) && !images.detectsColor(img, "#DCAB82", 45, 1267));
|
||||
if (l || r) {
|
||||
click(60, 1222);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 2. 設施升級
|
||||
tasks.upgradeFacility = function(img) {
|
||||
if (images.detectsColor(img, "#FFFFFF", 87, 1032)) {
|
||||
click(31, 1044);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 3. 食譜升級
|
||||
tasks.upgradeRecipe = function(img) {
|
||||
if (images.detectsColor(img, "#FD7171", 581, 1081)) {
|
||||
click(550, 1101);
|
||||
sleep(500);
|
||||
let tempImg = captureScreen();
|
||||
while (images.detectsColor(tempImg, "#8EE3D3", 458, 1037)) {
|
||||
click(535, 1053);
|
||||
tempImg = captureScreen();
|
||||
}
|
||||
back();
|
||||
sleep(500);
|
||||
}
|
||||
};
|
||||
|
||||
// 4. 拍照
|
||||
tasks.takePhoto = function(img) {
|
||||
if (images.detectsColor(img, "#B5B5C6", 648, 813)) {
|
||||
click(660, 815);
|
||||
// 等待拍照按鈕出現
|
||||
while (!images.detectsColor(captureScreen(), "#FFFFFF", 360, 950)) sleep(100);
|
||||
click(360, 1025);
|
||||
// 等待返回
|
||||
while (!images.detectsColor(captureScreen(), "#F4ECD3", 360, 1150)) sleep(100);
|
||||
back();
|
||||
sleep(500);
|
||||
}
|
||||
};
|
||||
|
||||
// 5. 領取獎勵
|
||||
tasks.collectRewards = function(img) {
|
||||
// 掛機獎勵
|
||||
if (images.detectsColor(img, "#E3C5AE", 371, 1092)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 809);
|
||||
}
|
||||
// 罐子精靈
|
||||
if (images.detectsColor(img, "#AAAAAA", 433, 1132)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 844);
|
||||
}
|
||||
// 商人
|
||||
if (images.detectsColor(img, "#DB937D", 351, 1152)) {
|
||||
click(360, 1130); sleep(500);
|
||||
click(420, 755);
|
||||
}
|
||||
};
|
||||
|
||||
// 6. 隨機出現的獎勵 (蝴蝶/青蛙)
|
||||
tasks.randomRewards = function(img) {
|
||||
// 蝴蝶或青蛙 (共用點擊位置)
|
||||
let isButterfly = images.detectsColor(img, "#FBE771", 71, 280);
|
||||
let isFrog = images.detectsColor(img, "#D8E0B7", 55, 291);
|
||||
if (isButterfly || isFrog) {
|
||||
click(71, 280);
|
||||
sleep(2000);
|
||||
click(360, 650); sleep(300); click(423, 724);
|
||||
}
|
||||
};
|
||||
|
||||
// 7. 玩耍
|
||||
tasks.playWithCat = function(img) {
|
||||
if (images.detectsColor(img, "#F9DBDC", 673, 737)) {
|
||||
click(645, 739);
|
||||
sleep(3000);
|
||||
click(360, 800);
|
||||
// 這裡保留你原本複雜的滑動邏輯...
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = tasks;
|
||||
@@ -64,6 +64,7 @@ const languages = {
|
||||
"perm_accessibility": "請啟用無障礙服務",
|
||||
"launching": "嘗試開啟遊戲..."
|
||||
},
|
||||
|
||||
"en": {
|
||||
"title": "Auto CatAndSoup Settings",
|
||||
"basic_section": "── Basic ──",
|
||||
|
||||
+3
-1
@@ -72,7 +72,9 @@ while (true) {
|
||||
app.launchPackage("com.hidea.cat");
|
||||
toast("{{T('launchingʼ)}}");
|
||||
var img = captureScreen();
|
||||
while(!images.detectsColor(img, "#F4ECD3", 685, 1095) && currentPackage() == "com.hidea.cat"){
|
||||
var launch_time = 0;
|
||||
while(!images.detectsColor(img, "#F4ECD3", 685, 1095) && launch_time <= 600) //啟動五分鐘無果 再次啟動
|
||||
launch_time += 1;
|
||||
sleep(1000);
|
||||
var img = captureScreen();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
while (true) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --- 根據 Config 呼叫對應的 Task ---
|
||||
if (config.sellProduct) Tasks.sellProduct(img);
|
||||
|
||||
|
||||
Reference in new issue
Block a user