mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-20 04:10:00 +08:00
枫丹水下挖矿自动根据DPI scale做适配,默认开启,增加README (#1735)
* Auto scale underwater mining * Add README
This commit is contained in:
@@ -1 +1,28 @@
|
||||
WIP
|
||||
# 说明
|
||||
|
||||
该脚本按挖矿路线的效率从高到低挖矿,记录矿产资源的冷却时间,自动规划挖矿路线,可选挖矿种类和挖矿区域。
|
||||
|
||||
- 目前支持5种运行模式
|
||||
1. 最速480矿
|
||||
|
||||
刷满480个矿石即停止
|
||||
|
||||
1. 挖指定数目的矿
|
||||
|
||||
需要在下面的输入框中填一个数字,代表要挖矿的个数
|
||||
|
||||
1. 挖一段时间
|
||||
|
||||
需要在下面的输入框中填一个数字,代表分钟数
|
||||
|
||||
1. 挖到某个时间点
|
||||
|
||||
需要在下面的输入框中填一个停止挖矿的时间点,例如`3:55`、`23:30`等。若已过当前时间则代表第二天的该时间点,比如开始运行时间是`23:30`,填写`3:55`则表示一直挖矿到第二天的`3:55`。
|
||||
|
||||
(WIP)也可以填一个时间段,例如`22:30~3:55`。若不在此时间段内则不会开始挖矿。
|
||||
|
||||
1. 挖所有矿
|
||||
|
||||
顾名思义
|
||||
- 地面挖矿队伍中必须有诺艾尔,只挖水下的矿则无此限制
|
||||
- 矿产资源的冷却时间记录在脚本目录下`records/persistent_data.json`文件中,升级、重新订阅脚本或重新安装BetterGI可能导致该记录丢失,请自行备份。
|
||||
|
||||
@@ -240,10 +240,11 @@ async function run_pathing_script(name, path_state_change, current_states) {
|
||||
path_state_change.add ||= [];
|
||||
path_state_change.sustain ||= [];
|
||||
|
||||
const statistics = JSON.parse(file.readTextSync("assets/statistics.json")).data;
|
||||
|
||||
for (const s of path_state_change.require) {
|
||||
if (!current_states.has(s)) {
|
||||
log.debug("Trying to get {s}", s);
|
||||
const statistics = JSON.parse(file.readTextSync("assets/statistics.json")).data;
|
||||
for (const [name, data] of Object.entries(statistics)) {
|
||||
const add_states = data.state_change?.add || [];
|
||||
if (add_states.includes(s)) {
|
||||
@@ -266,6 +267,28 @@ async function run_pathing_script(name, path_state_change, current_states) {
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
// scale underwater mining actions
|
||||
if (statistics[name].tags.includes("fontaine underwater") && genshin.screenDpiScale !== 1.0) {
|
||||
for (const i of json_obj.positions) {
|
||||
if (i.action_params) {
|
||||
const new_actions = [];
|
||||
for (const a of i.action_params.split(";")) {
|
||||
if (a.startsWith("moveby(")) {
|
||||
const [x, y] = a.slice(7, -1).split(",");
|
||||
const new_val = "moveby(" + String(Math.round(x * genshin.screenDpiScale)) + "," + String(Math.round(y * genshin.screenDpiScale)) + ")";
|
||||
new_actions.push(new_val);
|
||||
} else {
|
||||
new_actions.push(a);
|
||||
}
|
||||
}
|
||||
const new_action_params = new_actions.join(";");
|
||||
if (new_action_params !== i.action_params) {
|
||||
i.action_params = new_action_params;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modified) {
|
||||
log.debug("Patched mining action");
|
||||
json_content = JSON.stringify(json_obj);
|
||||
@@ -279,8 +302,11 @@ async function run_pathing_script(name, path_state_change, current_states) {
|
||||
throw new Error("Cancelled");
|
||||
}
|
||||
|
||||
current_states = current_states.intersection(new Set(path_state_change.sustain));
|
||||
current_states = current_states.union(new Set(path_state_change.add));
|
||||
const new_states = current_states.intersection(new Set(path_state_change.sustain)).union(new Set(path_state_change.add));
|
||||
current_states.clear();
|
||||
for (const s of new_states) {
|
||||
current_states.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -417,4 +443,4 @@ async function main() {
|
||||
|
||||
(async function() {
|
||||
await main();
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
{
|
||||
"name": "exclude_fontaine_underwater",
|
||||
"type": "checkbox",
|
||||
"default": true,
|
||||
"label": "不挖枫丹水下(详见README)👇"
|
||||
"label": "不挖枫丹水下👇"
|
||||
},
|
||||
{
|
||||
"name": "exclude_fontaine_terrestrial",
|
||||
|
||||
Reference in New Issue
Block a user