mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-19 03:59:51 +08:00
修复js脚本AutoMine中的bug (#1731)
* Fix bugs: cancellation detection, persistent file not existing * Add disabled paths
This commit is contained in:
20
repo/js/AutoMine/assets/disabled_paths.txt
Normal file
20
repo/js/AutoMine/assets/disabled_paths.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
// 容易摔死
|
||||
A23-萃凝晶-枫丹-优兰尼娅湖-1(火神赶路-有战斗-16个).json
|
||||
|
||||
// 地图边缘容易卡死
|
||||
20-水晶块-层岩巨渊·地下矿区-巨渊主矿区-(诺艾尔必须放1号位)东2-3个.json
|
||||
|
||||
// 战斗容易卡死
|
||||
03-水晶块-璃月-天衡山西(有战斗,冰免,精英200x1)-5个.json
|
||||
|
||||
// 战斗必超时
|
||||
07-水晶块-璃月-遁玉陵西(有战斗,小怪)-8个.json
|
||||
|
||||
// 爬墙容易卡死
|
||||
07-水晶块-蒙德-风龙废墟南-6个.json
|
||||
|
||||
// 满命火神适配不好
|
||||
A05-紫晶块-稻妻-鸣神岛-荒海-8~9个.json
|
||||
C01-紫晶块-稻妻-八酝島-名椎滩-西-2个.json
|
||||
C04-紫晶块-稻妻-八酝岛-绯木村-3个.json
|
||||
F04-紫晶块-稻妻-鹤观-菅名山-4个.json
|
||||
@@ -40,7 +40,7 @@ function get_exclude_tags() {
|
||||
}
|
||||
|
||||
function get_profile_name() {
|
||||
if (settings.profile_id.length === 0) {
|
||||
if (!settings.profile_id) {
|
||||
return null;
|
||||
}
|
||||
return settings.profile_id;
|
||||
@@ -69,7 +69,11 @@ function load_filename_to_path_map() {
|
||||
var persistent_data = {};
|
||||
|
||||
function load_persistent_data() {
|
||||
const file_content = file.readTextSync("records/persistent_data.json");
|
||||
var file_content = "";
|
||||
try {
|
||||
file_content = file.readTextSync("records/persistent_data.json");
|
||||
} catch (error) {
|
||||
}
|
||||
if (file_content.length !== 0) {
|
||||
persistent_data = JSON.parse(file_content);
|
||||
}
|
||||
@@ -272,6 +276,8 @@ async function run_pathing_script(name, path_state_change, current_states) {
|
||||
await pathingScript.run(json_content);
|
||||
if (!cancellation_token.isCancellationRequested) {
|
||||
await mark_task_finished(name);
|
||||
} else {
|
||||
throw new Error("Cancelled");
|
||||
}
|
||||
|
||||
current_states = current_states.intersection(new Set(path_state_change.sustain));
|
||||
@@ -338,7 +344,12 @@ async function main() {
|
||||
}
|
||||
for (const [name, data] of tasks) {
|
||||
cached_inventory_data = null;
|
||||
await run_pathing_script(name, data.state_change, current_states);
|
||||
try {
|
||||
await run_pathing_script(name, data.state_change, current_states);
|
||||
} catch (e) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
estimated_yield += data.statistics.avg_yield;
|
||||
|
||||
if (target_yield !== null && estimated_yield >= target_yield + 5) {
|
||||
|
||||
Reference in New Issue
Block a user