Compare commits

...

2 Commits

Author SHA1 Message Date
zaodonganqi
7a8c01d348 update repo.json
Some checks failed
Build repo.json / build (18.x) (push) Has been cancelled
Build repo.json / upload (push) Has been cancelled
2025-08-12 03:38:46 +00:00
躁动的氨气
262f229bf9 自动兑换码归档 (#1563) 2025-08-12 11:37:57 +08:00
16 changed files with 122 additions and 140 deletions

View File

@@ -1,3 +1,3 @@
兑换码+截止时间存储地址codes.txt 兑换码+截止时间存储地址codes.txt
格式 兑换码,xxxx.xx.xx xx:xx:xx 格式 兑换码,xxxx.xx.xx xx:xx:xx
仅支持国服 仅支持国服

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -1,3 +1,3 @@
KG3SZF8EZGQN,2025.7.21 12:00:00 KG3SZF8EZGQN,2025.7.21 12:00:00
DZ2TZX9WHXSS,2025.7.21 12:00:00 DZ2TZX9WHXSS,2025.7.21 12:00:00
ZGKBHW9FGXSW,2025.7.21 12:00:00 ZGKBHW9FGXSW,2025.7.21 12:00:00

View File

@@ -1,117 +1,117 @@
(async function () { (async function () {
setGameMetrics(1920, 1080, 1); setGameMetrics(1920, 1080, 1);
// 1. 返回主界面等待1秒 // 1. 返回主界面等待1秒
await genshin.returnMainUi(); await genshin.returnMainUi();
await sleep(1000); await sleep(1000);
// 2. 通过keyPress点按esc键(VK_ESCAPE)等待2秒。ocr识别设置图片并点击等待2秒。识别账户图片并点击等待0.5秒识别前往兑换图片并点击等待0.5秒 // 2. 通过keyPress点按esc键(VK_ESCAPE)等待2秒。ocr识别设置图片并点击等待2秒。识别账户图片并点击等待0.5秒识别前往兑换图片并点击等待0.5秒
keyPress("ESCAPE"); keyPress("ESCAPE");
await sleep(2000); await sleep(2000);
const settingsRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/settings.png")); const settingsRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/settings.png"));
const settingsRes = captureGameRegion().find(settingsRo); const settingsRes = captureGameRegion().find(settingsRo);
if (settingsRes.isExist()) { if (settingsRes.isExist()) {
settingsRes.click(); settingsRes.click();
} }
await sleep(2000); await sleep(2000);
const accountRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/account.png")); const accountRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/account.png"));
const accountRes = captureGameRegion().find(accountRo); const accountRes = captureGameRegion().find(accountRo);
if (accountRes.isExist()) { if (accountRes.isExist()) {
accountRes.click(); accountRes.click();
} }
await sleep(500); await sleep(500);
const goToRedeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/go_to_redeem.png")); const goToRedeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/go_to_redeem.png"));
const goToRedeemRes = captureGameRegion().find(goToRedeemRo); const goToRedeemRes = captureGameRegion().find(goToRedeemRo);
if (goToRedeemRes.isExist()) { if (goToRedeemRes.isExist()) {
goToRedeemRes.click(); goToRedeemRes.click();
} }
await sleep(500); await sleep(500);
// 3. 新建一个txt用于存储兑换码及截止时间之间换行区分格式为【兑换码截止时间】 // 3. 新建一个txt用于存储兑换码及截止时间之间换行区分格式为【兑换码截止时间】
try { try {
const content = file.readTextSync("codes.txt"); const content = file.readTextSync("codes.txt");
const codes = content.split('\n'); const codes = content.split('\n');
for (let i = 0; i < codes.length; i++) { for (let i = 0; i < codes.length; i++) {
const codeInfo = codes[i].split(','); const codeInfo = codes[i].split(',');
const code = codeInfo[0]; const code = codeInfo[0];
const deadline = codeInfo[1]; const deadline = codeInfo[1];
// a. 获取当前时间【xxxx.xx.xx xx:xx:xx】(年月日时分秒),与截止时间进行对比 // a. 获取当前时间【xxxx.xx.xx xx:xx:xx】(年月日时分秒),与截止时间进行对比
const now = new Date(); const now = new Date();
const currentTime = now.getFullYear() + '.' + String(now.getMonth() + 1).padStart(2, '0') + '.' + String(now.getDate()).padStart(2, '0') + ' ' + String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0') + ':' + String(now.getSeconds()).padStart(2, '0'); const currentTime = now.getFullYear() + '.' + String(now.getMonth() + 1).padStart(2, '0') + '.' + String(now.getDate()).padStart(2, '0') + ' ' + String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0') + ':' + String(now.getSeconds()).padStart(2, '0');
if (currentTime > deadline) { if (currentTime > deadline) {
log.info(`兑换码【${code}】已超过截止时间,跳过`); log.info(`兑换码【${code}】已超过截止时间,跳过`);
continue; continue;
} }
// b. 识别输入兑换码图片并点击 // b. 识别输入兑换码图片并点击
const inputCodeRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/input_code.png")); const inputCodeRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/input_code.png"));
const inputCodeRes = captureGameRegion().find(inputCodeRo); const inputCodeRes = captureGameRegion().find(inputCodeRo);
if (inputCodeRes.isExist()) { if (inputCodeRes.isExist()) {
inputCodeRes.click(); inputCodeRes.click();
} }
await sleep(300); await sleep(300);
// c. 通过虚拟键代码依次keyPress键入兑换码的每一个字符 // c. 通过虚拟键代码依次keyPress键入兑换码的每一个字符
await inputText(code); await inputText(code);
await sleep(500); await sleep(500);
// d. 输入完毕后识别兑换图片并点击等待1.5秒 // d. 输入完毕后识别兑换图片并点击等待1.5秒
const redeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/redeem.png")); const redeemRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/redeem.png"));
const redeemRes = captureGameRegion().find(redeemRo); const redeemRes = captureGameRegion().find(redeemRo);
if (redeemRes.isExist()) { if (redeemRes.isExist()) {
redeemRes.click(); redeemRes.click();
} }
await sleep(1500); await sleep(1500);
// e. 识别无效图片、已使用图片、过期图片、确认图片、未开启图片 // e. 识别无效图片、已使用图片、过期图片、确认图片、未开启图片
const invalidRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/invalid.png")); const invalidRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/invalid.png"));
const invalidRes = captureGameRegion().find(invalidRo); const invalidRes = captureGameRegion().find(invalidRo);
if (invalidRes.isExist()) { if (invalidRes.isExist()) {
log.info(`兑换码【${code}】无效`); log.info(`兑换码【${code}】无效`);
} }
const usedRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/used.png")); const usedRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/used.png"));
const usedRes = captureGameRegion().find(usedRo); const usedRes = captureGameRegion().find(usedRo);
if (usedRes.isExist()) { if (usedRes.isExist()) {
log.info(`兑换码【${code}】已使用`); log.info(`兑换码【${code}】已使用`);
} }
const expiredRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/expired.png")); const expiredRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/expired.png"));
const expiredRes = captureGameRegion().find(expiredRo); const expiredRes = captureGameRegion().find(expiredRo);
if (expiredRes.isExist()) { if (expiredRes.isExist()) {
log.info(`兑换码【${code}】已过期`); log.info(`兑换码【${code}】已过期`);
} }
const notopenRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/not_open.png")); const notopenRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/not_open.png"));
const notopenRes = captureGameRegion().find(notopenRo); const notopenRes = captureGameRegion().find(notopenRo);
if (notopenRes.isExist()) { if (notopenRes.isExist()) {
log.info(`兑换码【${code}】未开启`); log.info(`兑换码【${code}】未开启`);
} }
const confirmRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/confirm.png")); const confirmRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/confirm.png"));
const confirmRes = captureGameRegion().find(confirmRo); const confirmRes = captureGameRegion().find(confirmRo);
if (confirmRes.isExist()) { if (confirmRes.isExist()) {
log.info(`兑换码【${code}】成功兑换`); log.info(`兑换码【${code}】成功兑换`);
confirmRes.click(); confirmRes.click();
} }
// f. 识别清除图片并点击,若未识别到则不做处理 // f. 识别清除图片并点击,若未识别到则不做处理
const clearRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/clear.png")); const clearRo = RecognitionObject.TemplateMatch(file.readImageMatSync("assets/clear.png"));
const clearRes = captureGameRegion().find(clearRo); const clearRes = captureGameRegion().find(clearRo);
if (clearRes.isExist()) { if (clearRes.isExist()) {
clearRes.click(); clearRes.click();
} }
await sleep(4000); await sleep(4000);
} }
} catch (error) { } catch (error) {
log.error(`读取兑换码文件失败: ${error}`); log.error(`读取兑换码文件失败: ${error}`);
} }
// 4. 所有兑换码兑换完成后返回主界面 // 4. 所有兑换码兑换完成后返回主界面
await genshin.returnMainUi(); await genshin.returnMainUi();
})(); })();

View File

@@ -1,5 +1,5 @@
{ {
"time": "20250812100818", "time": "20250812113845",
"url": "https://github.com/babalae/bettergi-scripts-list/archive/refs/heads/main.zip", "url": "https://github.com/babalae/bettergi-scripts-list/archive/refs/heads/main.zip",
"file": "repo.json", "file": "repo.json",
"indexes": [ "indexes": [
@@ -75682,24 +75682,6 @@
], ],
"lastUpdated": "2025-07-04 23:14:44" "lastUpdated": "2025-07-04 23:14:44"
}, },
{
"name": "AutoCode",
"type": "directory",
"hash": "19708ceed0043da5a49d2f02ede7247ca37664a3",
"version": "5.8.0",
"author": "Tool_tingsu",
"authors": [
{
"name": "Tool_tingsu",
"link": "https://github.com/Tooltingsu"
}
],
"description": "自动使用兑换码~|~仅支持国服",
"tags": [
"bgi≥0.45.0"
],
"lastUpdated": "2025-07-18 20:40:27"
},
{ {
"name": "AutoCommission", "name": "AutoCommission",
"type": "directory", "type": "directory",