新增js脚本: 每日领取闪闪礼蛋 (#1518)
This commit is contained in:
102
repo/js/每日领取闪闪礼蛋/assets/pathing.json
Normal file
102
repo/js/每日领取闪闪礼蛋/assets/pathing.json
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "未命名路径",
|
||||
"type": "collect",
|
||||
"authors": [
|
||||
{
|
||||
"name": "芝士贝果"
|
||||
}
|
||||
],
|
||||
"version": "1.0",
|
||||
"description": "",
|
||||
"map_name": "Teyvat",
|
||||
"bgi_version": "0.48.0",
|
||||
"tags": [],
|
||||
"last_modified_time": 1754702751073,
|
||||
"enable_monster_loot_split": false,
|
||||
"map_match_method": ""
|
||||
},
|
||||
"positions": [
|
||||
{
|
||||
"id": 1,
|
||||
"action": "",
|
||||
"move_mode": "run",
|
||||
"type": "teleport",
|
||||
"x": 13755.111328125,
|
||||
"y": 380.19482421875,
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"x": 13787.70703125,
|
||||
"y": 371.02294921875,
|
||||
"type": "path",
|
||||
"move_mode": "run",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"x": 13810.38671875,
|
||||
"y": 382.26806640625,
|
||||
"type": "path",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"x": 13825.21484375,
|
||||
"y": 404.3056640625,
|
||||
"type": "path",
|
||||
"move_mode": "run",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"x": 13842.732421875,
|
||||
"y": 405.677734375,
|
||||
"type": "path",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"x": 13861.65625,
|
||||
"y": 399.267578125,
|
||||
"type": "path",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"x": 13888.0849609375,
|
||||
"y": 400.69921875,
|
||||
"type": "path",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"x": 13904.5380859375,
|
||||
"y": 412.7275390625,
|
||||
"type": "path",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"x": 13918.6708984375,
|
||||
"y": 410.32666015625,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
58
repo/js/每日领取闪闪礼蛋/main.js
Normal file
58
repo/js/每日领取闪闪礼蛋/main.js
Normal file
@@ -0,0 +1,58 @@
|
||||
async function click_text(t) {
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
const img = captureGameRegion();
|
||||
const ocr_result = img.findMulti(RecognitionObject.ocr(1170, 328, 494, 594));
|
||||
for (var j = 0; j < ocr_result.count; ++j) {
|
||||
const res = ocr_result[j];
|
||||
if (res.text.includes(t)) {
|
||||
log.info("Found text {text} at ({x}, {y})", res.text, res.x, res.y);
|
||||
keyDown("VK_MENU");
|
||||
await sleep(500);
|
||||
moveMouseTo(res.x, res.y);
|
||||
leftButtonClick();
|
||||
await sleep(500);
|
||||
keyUp("VK_MENU");
|
||||
return;
|
||||
}
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
log.warn("Couldn't find text {t}", t);
|
||||
}
|
||||
|
||||
(async function() {
|
||||
const dry_run = false;
|
||||
|
||||
const coordinates = [
|
||||
[551, 153],
|
||||
[1087, 161],
|
||||
[881, 341],
|
||||
[1342, 357],
|
||||
[472, 572],
|
||||
[572, 721]
|
||||
];
|
||||
const cancel_coordinate = [1497, 676];
|
||||
|
||||
const seed = Date.now();
|
||||
const rand = BigInt(seed) * 1664525n + 1013904223n;
|
||||
const picked_index = rand % BigInt(coordinates.length);
|
||||
log.info("随机到第{n}个蛋", picked_index);
|
||||
const picked_coordinate = dry_run ? cancel_coordinate : coordinates[picked_index];
|
||||
|
||||
await genshin.returnMainUi();
|
||||
await pathingScript.runFile("assets/pathing.json");
|
||||
|
||||
await sleep(500);
|
||||
|
||||
await click_text("察尔瓦");
|
||||
|
||||
await genshin.chooseTalkOption("让我挑一枚");
|
||||
|
||||
await sleep(4000);
|
||||
moveMouseTo(picked_coordinate[0], picked_coordinate[1]);
|
||||
await sleep(100);
|
||||
leftButtonClick();
|
||||
await sleep(3000);
|
||||
|
||||
await genshin.returnMainUi();
|
||||
})();
|
||||
13
repo/js/每日领取闪闪礼蛋/manifest.json
Normal file
13
repo/js/每日领取闪闪礼蛋/manifest.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "每日领取闪闪礼蛋",
|
||||
"version": "1.0",
|
||||
"description": "每日领取闪闪礼蛋",
|
||||
"authors": [
|
||||
{
|
||||
"name": "芝士贝果"
|
||||
}
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js"
|
||||
}
|
||||
Reference in New Issue
Block a user