Update JS script AbundantOre (#3094)

This commit is contained in:
Jamis
2026-04-10 23:20:03 +10:00
committed by GitHub
parent edff2d226a
commit ca98204b7b
3 changed files with 51 additions and 17 deletions

View File

@@ -17,7 +17,7 @@
如果三个条件均未填写,脚本将在挖完所有的矿后停止。注意如果第一次运行这个脚本,挖所有矿的过程可能持续十数个小时。
- 地面挖矿队伍中请带诺艾尔,只挖水下的矿则无此限制。如需进一步了解,请阅读[进阶使用](#进阶使用)中的相关内容。
- 地面挖矿队伍中请带莉奈娅或诺艾尔,只挖水下的矿则无此限制。如需进一步了解,请阅读[进阶使用](#进阶使用)中的相关内容。
- 矿产资源的刷新时间记录在脚本目录下`local/persistent_data.json`文件中升级或重新安装BetterGI可能导致该记录丢失请自行备份。
- 如果`需要战斗的路线`选择了`全跳过`选项,将不会运行所有需要打败怪物的挖矿路线。但角色仍可能在运行部分路线时被路过的怪物摸两下,请仍保证队伍有一定的生存能力。
@@ -29,6 +29,10 @@
## ChangeLog
### 0.28
- 增加莉奈娅挖矿实验性支持,效果不甚稳定,待针对性优化。
### 0.27
- 增加旧日之海、远古圣山地区的路线

View File

@@ -348,6 +348,7 @@ async function get_inventory() {
let last_script_end_pos = [null, null];
let last_script_normal_completion = true;
let mining_character = null;
async function run_pathing_script(name, path_state_change, current_states) {
path_state_change ||= {};
@@ -374,21 +375,42 @@ async function run_pathing_script(name, path_state_change, current_states) {
{
const json_obj = JSON.parse(json_content);
let modified = false;
let num_skipped_mining_actions = 0;
let num_replaced_mining_actions = 0;
let last_linnea_mining_pos = null;
for (const i of json_obj.positions) {
if (i.action !== "mining") {
continue;
}
if (use_global_mining_action) {
if (settings.custom_mining_action && i.action === "combat_script" && i.action_params.includes("诺艾尔 ")) {
i.action = "mining";
// nop
} else if (settings.custom_mining_action) {
i.action = "combat_script";
i.action_params = settings.custom_mining_action;
num_replaced_mining_actions += 1;
modified = true;
} else if (mining_character === "诺艾尔") {
i.action = "combat_script";
i.action_params = "诺艾尔 attack(2.0)";
num_replaced_mining_actions += 1;
modified = true;
} else if (mining_character === "莉奈娅") {
const dist_from_last_mining_pos = last_linnea_mining_pos === null ? 9999 :
Math.hypot(i.x - last_linnea_mining_pos.x, i.y - last_linnea_mining_pos.y);
if (dist_from_last_mining_pos < 7.5) {
i.type = "path";
i.action = "";
i.action_params = "";
num_skipped_mining_actions += 1;
modified = true;
}
} else {
if (i.action === "mining") {
// set Noelle mining action
} else {
i.action = "combat_script";
i.action_params = settings.custom_mining_action || "诺艾尔 attack(2.0)";
modified = true;
} else if (settings.custom_mining_action && i.action === "combat_script" && i.action_params.includes("诺艾尔 ")) {
i.action_params = settings.custom_mining_action;
i.action_params = "莉奈娅 moveby(0,2500),charge(0.6),click(middle)";
num_replaced_mining_actions += 1;
last_linnea_mining_pos = {
x: i.x,
y: i.y
};
modified = true;
}
}
@@ -474,9 +496,17 @@ async function main() {
log.debug("Exclude regions: {a}, exclude types: {b}", settings.exclude_regions, settings.exclude_ore_types);
log.debug("Exclude tags: {a}", get_exclude_tags());
log.debug("Underwater only: {a}", underwater_only());
if (!underwater_only()) {
if (!Array.from(getAvatars()).includes("诺艾尔") && !settings.custom_mining_action) {
log.error("地面挖矿请带诺艾尔");
const preapproved_mining_characters = ["莉奈娅", "诺艾尔"];
if (!underwater_only() && !settings.custom_mining_action) {
const characters = Array.from(getAvatars());
for (const i of preapproved_mining_characters) {
if (characters.includes(i)) {
mining_character = i;
break;
}
}
if (mining_character === null) {
log.error("地面挖矿请带{c}", preapproved_mining_characters.join("或"));
return;
}
}
@@ -637,4 +667,4 @@ async function main() {
(async function() {
await main();
})();
})();

View File

@@ -1,8 +1,8 @@
{
"bgi_version": "0.55.0",
"bgi_version": "0.60.0",
"manifest_version": 1,
"name": "矿产资源批发",
"version": "0.27",
"version": "0.28",
"description": "自动记录矿石刷新时间,优先选择效率最高的路线,支持按区域、种类、数量自动规划挖矿路线",
"authors": [
{