mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 17:39:25 +08:00
add: webui of luahook
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -278,4 +278,10 @@ blcrack/patchelf/build/
|
||||
blcrack/test/
|
||||
blcrack/cracker/pb/
|
||||
|
||||
report/
|
||||
report/
|
||||
|
||||
blcrack/cracker/webpage.cpp
|
||||
blcrack/cracker/webui/node_modules/
|
||||
blcrack/cracker/webui/dist/
|
||||
blcrack/cracker/webui/.vscode/
|
||||
blcrack/cracker/webui/.idea/
|
||||
@@ -590,6 +590,77 @@ void Cracker::hook_all_lua_functions() {
|
||||
};
|
||||
}
|
||||
|
||||
#define SET_SHIP_PROPERTIES_VALUE(f) v[#f]["value"] = m_globle_ship_properties.f
|
||||
|
||||
Json::Value Cracker::get_config_json() {
|
||||
Json::Value j;
|
||||
j["globalSpeedup"]["enabled"] = m_flag.GLOBAL_SPEEDUP.load();
|
||||
j["globalSpeedup"]["value"] = m_global_speedup_rate.load();
|
||||
|
||||
j["chapterFastMove"]["enabled"] = m_flag.FAST_STAGE_MOVE_CRACK.load();
|
||||
j["opsiFastMove"]["enabled"] = m_flag.OPSI_FAST_MOVE.load();
|
||||
j["noBBAnimation"]["enabled"] = m_flag.NO_BB_ANIMATION.load();
|
||||
j["noEmotionWarning"]["enabled"] = m_flag.NO_EMOTION_WARNING.load();
|
||||
j["removeHardModeShipPropertiesLimit"]["enabled"] = m_flag.REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT.load();
|
||||
j["removeHardModeShipTypeLimit"]["enabled"] = m_flag.REMOVE_HARD_MODE_SHIP_TYPE_LIMIT.load();
|
||||
|
||||
j["globalShipProperties"]["enabled"] = m_flag.GLOBAL_SHIP_PROPERTIES_CRACK.load();
|
||||
j["globalShipProperties"]["value"] = [this] -> Json::Value {
|
||||
Json::Value v;
|
||||
SET_SHIP_PROPERTIES_VALUE(armor);
|
||||
SET_SHIP_PROPERTIES_VALUE(speed);
|
||||
SET_SHIP_PROPERTIES_VALUE(antiaircraft);
|
||||
SET_SHIP_PROPERTIES_VALUE(oxy_recovery_bench);
|
||||
SET_SHIP_PROPERTIES_VALUE(torpedo);
|
||||
SET_SHIP_PROPERTIES_VALUE(hit);
|
||||
SET_SHIP_PROPERTIES_VALUE(sonarRange);
|
||||
SET_SHIP_PROPERTIES_VALUE(attack_duration);
|
||||
SET_SHIP_PROPERTIES_VALUE(raid_distance);
|
||||
SET_SHIP_PROPERTIES_VALUE(oxy_recovery_surface);
|
||||
SET_SHIP_PROPERTIES_VALUE(oxy_recovery);
|
||||
SET_SHIP_PROPERTIES_VALUE(dodge);
|
||||
SET_SHIP_PROPERTIES_VALUE(luck);
|
||||
SET_SHIP_PROPERTIES_VALUE(reload);
|
||||
SET_SHIP_PROPERTIES_VALUE(oxy_cost);
|
||||
SET_SHIP_PROPERTIES_VALUE(durability);
|
||||
SET_SHIP_PROPERTIES_VALUE(air);
|
||||
SET_SHIP_PROPERTIES_VALUE(oxy_max);
|
||||
SET_SHIP_PROPERTIES_VALUE(cannon);
|
||||
SET_SHIP_PROPERTIES_VALUE(antisub);
|
||||
return v;
|
||||
}();
|
||||
|
||||
j["ggFactor"]["enabled"] = m_flag.GG_FACTOR.load();
|
||||
j["ggFactor"]["value"] = m_gg_factor;
|
||||
return j;
|
||||
}
|
||||
|
||||
#define APPLY_CONFIG(f) m_##f = config.f
|
||||
#define APPLY_ATOMIC_CONFIG(f) m_##f.store(config.f)
|
||||
|
||||
void Cracker::apply_config(Config& config) {
|
||||
APPLY_ATOMIC_CONFIG(flag.GLOBAL_SHIP_PROPERTIES_CRACK);
|
||||
APPLY_ATOMIC_CONFIG(flag.FAST_STAGE_MOVE_CRACK);
|
||||
APPLY_ATOMIC_CONFIG(flag.REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT);
|
||||
APPLY_ATOMIC_CONFIG(flag.REMOVE_HARD_MODE_SHIP_TYPE_LIMIT);
|
||||
APPLY_ATOMIC_CONFIG(flag.NO_BB_ANIMATION);
|
||||
APPLY_ATOMIC_CONFIG(flag.NO_EMOTION_WARNING);
|
||||
APPLY_ATOMIC_CONFIG(flag.OPSI_FAST_MOVE);
|
||||
APPLY_ATOMIC_CONFIG(flag.GG_FACTOR);
|
||||
APPLY_ATOMIC_CONFIG(flag.GLOBAL_SPEEDUP);
|
||||
|
||||
APPLY_CONFIG(globle_ship_properties);
|
||||
APPLY_ATOMIC_CONFIG(global_speedup_rate);
|
||||
APPLY_CONFIG(gg_factor);
|
||||
|
||||
if (config.flag.GLOBAL_SPEEDUP) {
|
||||
update_global_speedup_rate(config.global_speedup_rate);
|
||||
enable_global_speedup();
|
||||
} else {
|
||||
disable_global_speedup();
|
||||
}
|
||||
}
|
||||
|
||||
#define MODIFY_PROPERTY(name) \
|
||||
if (new_properties.name != -1) { \
|
||||
properties[#name] = new_properties.name; \
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <sol/variadic_args.hpp>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <json/json.h>
|
||||
|
||||
#include "timer.hpp"
|
||||
|
||||
@@ -66,6 +67,23 @@ public:
|
||||
int curr_star;
|
||||
};
|
||||
|
||||
struct Config {
|
||||
struct {
|
||||
bool GLOBAL_SHIP_PROPERTIES_CRACK;
|
||||
bool FAST_STAGE_MOVE_CRACK;
|
||||
bool REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT;
|
||||
bool REMOVE_HARD_MODE_SHIP_TYPE_LIMIT;
|
||||
bool NO_BB_ANIMATION;
|
||||
bool NO_EMOTION_WARNING;
|
||||
bool OPSI_FAST_MOVE;
|
||||
bool GG_FACTOR;
|
||||
bool GLOBAL_SPEEDUP;
|
||||
} flag;
|
||||
ShipProperties globle_ship_properties;
|
||||
float global_speedup_rate;
|
||||
double gg_factor;
|
||||
};
|
||||
|
||||
public:
|
||||
Cracker();
|
||||
|
||||
@@ -129,6 +147,10 @@ public:
|
||||
void print_table_field(std::vector<std::string>& path);
|
||||
void print_value(std::vector<std::string>& path);
|
||||
|
||||
Json::Value get_config_json();
|
||||
|
||||
void apply_config(Config& config);
|
||||
|
||||
private:
|
||||
void load_lua_resources();
|
||||
void hook_all_lua_functions();
|
||||
|
||||
47
blcrack/cracker/gen_embed_web.py
Normal file
47
blcrack/cracker/gen_embed_web.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import glob
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
|
||||
PRE = '''#include "server.hpp"
|
||||
|
||||
std::map<
|
||||
std::string,
|
||||
CrackerServer::WebPage
|
||||
> CrackerServer::WebRes = {
|
||||
'''
|
||||
|
||||
POST = "};"
|
||||
|
||||
TYPE_MAP = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".js": "application/javascript",
|
||||
".css": "text/css",
|
||||
".png": "image/png",
|
||||
".jpeg": "image/jpeg",
|
||||
".ico": "image/x-icon",
|
||||
}
|
||||
|
||||
def main():
|
||||
root = "./webui/dist"
|
||||
dist = [
|
||||
"./webui/dist/*.*",
|
||||
"./webui/dist/**/*.*"
|
||||
]
|
||||
|
||||
l = []
|
||||
for i in dist:
|
||||
l += glob.glob(i)
|
||||
|
||||
with open(file="./webpage.cpp", mode="w", encoding="utf-8") as f:
|
||||
f.write(PRE)
|
||||
for i in l:
|
||||
print(f"Use {i}")
|
||||
with open(file=i, mode="r+b") as raw:
|
||||
content = raw.read()
|
||||
path = os.path.relpath(i, root).replace('\\', '/')
|
||||
f.write(f'''{{"/{path}", {{"{TYPE_MAP[Path(i).suffix]}",{{ {", ".join([hex(b) for b in content])} }} }} }},\n''')
|
||||
f.write(POST)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -657,6 +657,101 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Get("/get_config", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto j = Cracker::Instance().get_config_json();
|
||||
Json::FastWriter writer;
|
||||
res.body = writer.write(j);
|
||||
res.status = 200;
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
res.set_header("Access-Control-Allow-Headers", "*");
|
||||
res.set_header("Access-Control-Allow-Methods", "*");
|
||||
return;
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Get config failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
res.status = 500;
|
||||
return;
|
||||
});
|
||||
|
||||
Options("/get_config", [](const httplib::Request& req, httplib::Response& res) {
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
res.set_header("Access-Control-Allow-Headers", "*");
|
||||
res.set_header("Access-Control-Allow-Methods", "*");
|
||||
res.status = 200;
|
||||
});
|
||||
|
||||
Post("/apply", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Json::Reader reader;
|
||||
Json::Value j;
|
||||
reader.parse(req.body, j);
|
||||
|
||||
Cracker::Config config = {
|
||||
.flag = {
|
||||
.GLOBAL_SHIP_PROPERTIES_CRACK = j["globalShipProperties"]["enabled"].asBool(),
|
||||
.FAST_STAGE_MOVE_CRACK = j["chapterFastMove"]["enabled"].asBool(),
|
||||
.REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT = j["removeHardModeShipPropertiesLimit"]["enabled"].asBool(),
|
||||
.REMOVE_HARD_MODE_SHIP_TYPE_LIMIT = j["removeHardModeShipTypeLimit"]["enabled"].asBool(),
|
||||
.NO_BB_ANIMATION = j["noBBAnimation"]["enabled"].asBool(),
|
||||
.NO_EMOTION_WARNING = j["noEmotionWarning"]["enabled"].asBool(),
|
||||
.OPSI_FAST_MOVE = j["opsiFastMove"]["enabled"].asBool(),
|
||||
.GG_FACTOR = j["ggFactor"]["enabled"].asBool(),
|
||||
.GLOBAL_SPEEDUP = j["globalSpeedup"]["enabled"].asBool(),
|
||||
},
|
||||
.globle_ship_properties = {
|
||||
.armor = j["globalShipProperties"]["value"]["armor"]["value"].asDouble(),
|
||||
.speed = j["globalShipProperties"]["value"]["speed"]["value"].asDouble(),
|
||||
.antiaircraft = j["globalShipProperties"]["value"]["antiaircraft"]["value"].asDouble(),
|
||||
.oxy_recovery_bench = j["globalShipProperties"]["value"]["oxy_recovery_bench"]["value"].asDouble(),
|
||||
.torpedo = j["globalShipProperties"]["value"]["torpedo"]["value"].asDouble(),
|
||||
.hit = j["globalShipProperties"]["value"]["hit"]["value"].asDouble(),
|
||||
.sonarRange = j["globalShipProperties"]["value"]["sonarRange"]["value"].asDouble(),
|
||||
.attack_duration = j["globalShipProperties"]["value"]["attack_duration"]["value"].asDouble(),
|
||||
.raid_distance = j["globalShipProperties"]["value"]["raid_distance"]["value"].asDouble(),
|
||||
.oxy_recovery_surface = j["globalShipProperties"]["value"]["oxy_recovery_surface"]["value"].asDouble(),
|
||||
.oxy_recovery = j["globalShipProperties"]["value"]["oxy_recovery"]["value"].asDouble(),
|
||||
.dodge = j["globalShipProperties"]["value"]["dodge"]["value"].asDouble(),
|
||||
.luck = j["globalShipProperties"]["value"]["luck"]["value"].asDouble(),
|
||||
.reload = j["globalShipProperties"]["value"]["reload"]["value"].asDouble(),
|
||||
.oxy_cost = j["globalShipProperties"]["value"]["oxy_cost"]["value"].asDouble(),
|
||||
.durability = j["globalShipProperties"]["value"]["durability"]["value"].asDouble(),
|
||||
.air = j["globalShipProperties"]["value"]["air"]["value"].asDouble(),
|
||||
.oxy_max = j["globalShipProperties"]["value"]["oxy_max"]["value"].asDouble(),
|
||||
.cannon = j["globalShipProperties"]["value"]["cannon"]["value"].asDouble(),
|
||||
.antisub = j["globalShipProperties"]["value"]["antisub"]["value"].asDouble(),
|
||||
},
|
||||
.global_speedup_rate = j["globalSpeedup"]["value"].asFloat(),
|
||||
.gg_factor = j["ggFactor"]["value"].asDouble(),
|
||||
};
|
||||
|
||||
Cracker::Instance().apply_config(config);
|
||||
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
res.set_header("Access-Control-Allow-Headers", "*");
|
||||
res.set_header("Access-Control-Allow-Methods", "*");
|
||||
CRACK_OK();
|
||||
return;
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Apply config failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
res.status = 500;
|
||||
return;
|
||||
});
|
||||
|
||||
Options("/apply", [](const httplib::Request& req, httplib::Response& res) {
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
res.set_header("Access-Control-Allow-Headers", "*");
|
||||
res.set_header("Access-Control-Allow-Methods", "*");
|
||||
res.status = 200;
|
||||
});
|
||||
|
||||
set_web_page();
|
||||
|
||||
std::thread([this] {
|
||||
SPDLOG_INFO("Start server on port 23897");
|
||||
listen("0.0.0.0", 23897);
|
||||
@@ -666,3 +761,20 @@ CrackerServer::CrackerServer() {
|
||||
void CrackerServer::Start() {
|
||||
new CrackerServer;
|
||||
}
|
||||
|
||||
void CrackerServer::set_web_page() {
|
||||
if (WebRes.contains("/index.html")) {
|
||||
Get("/", WebPageResponder(WebRes["/index.html"]));
|
||||
}
|
||||
for (auto& item: WebRes) {
|
||||
Get(item.first, WebPageResponder(item.second));
|
||||
}
|
||||
}
|
||||
|
||||
CrackerServer::WebPageResponder::WebPageResponder(WebPage& page)
|
||||
: m_page(page) {}
|
||||
|
||||
void CrackerServer::WebPageResponder::operator()(const httplib::Request& req, httplib::Response& res) const {
|
||||
res.set_content(reinterpret_cast<const char *>(m_page.content.data()), m_page.content.size(), m_page.type);
|
||||
res.status = 200;
|
||||
}
|
||||
|
||||
@@ -2,13 +2,39 @@
|
||||
#define SERVER_HPP
|
||||
|
||||
#include <httplib.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class CrackerServer: public httplib::Server {
|
||||
public:
|
||||
struct WebPage {
|
||||
std::string type;
|
||||
std::vector<unsigned char> content;
|
||||
};
|
||||
|
||||
CrackerServer();
|
||||
~CrackerServer() override = default;
|
||||
|
||||
static void Start();
|
||||
|
||||
static std::map<
|
||||
std::string,
|
||||
WebPage
|
||||
> WebRes;
|
||||
|
||||
private:
|
||||
void set_web_page();
|
||||
|
||||
class WebPageResponder {
|
||||
public:
|
||||
WebPageResponder(WebPage& page);
|
||||
|
||||
void operator()(const httplib::Request& req, httplib::Response& res) const;
|
||||
|
||||
private:
|
||||
WebPage& m_page;
|
||||
};
|
||||
};
|
||||
|
||||
#endif //SERVER_HPP
|
||||
|
||||
11
blcrack/cracker/webui/index.html
Normal file
11
blcrack/cracker/webui/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
8
blcrack/cracker/webui/jsconfig.json
Normal file
8
blcrack/cracker/webui/jsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
3026
blcrack/cracker/webui/package-lock.json
generated
Normal file
3026
blcrack/cracker/webui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
blcrack/cracker/webui/package.json
Normal file
20
blcrack/cracker/webui/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "test",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.3",
|
||||
"naive-ui": "^2.41.0",
|
||||
"vite": "^6.2.4",
|
||||
"vite-plugin-vue-devtools": "^7.7.2"
|
||||
}
|
||||
}
|
||||
BIN
blcrack/cracker/webui/public/favicon.ico
Normal file
BIN
blcrack/cracker/webui/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
68
blcrack/cracker/webui/src/App.vue
Normal file
68
blcrack/cracker/webui/src/App.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<n-space vertical align="center">
|
||||
<n-space align="center">
|
||||
<n-ellipsis>后端: </n-ellipsis>
|
||||
<n-input v-model:value="baseUrl" type="text" />
|
||||
<n-button type="primary" @click="update">刷新</n-button>
|
||||
<n-button type="primary" @click="apply">应用</n-button>
|
||||
</n-space>
|
||||
|
||||
<SwitchInput v-model:group="global.globalSpeedup"></SwitchInput>
|
||||
<Switch v-model:group="global.chapterFastMove"></Switch>
|
||||
<Switch v-model:group="global.opsiFastMove"></Switch>
|
||||
<Switch v-model:group="global.noBBAnimation"></Switch>
|
||||
<Switch v-model:group="global.noEmotionWarning"></Switch>
|
||||
<Switch v-model:group="global.removeHardModeShipPropertiesLimit"></Switch>
|
||||
<Switch v-model:group="global.removeHardModeShipTypeLimit"></Switch>
|
||||
|
||||
<SwitchInput v-model:group="global.ggFactor"></SwitchInput>
|
||||
|
||||
<ShipProperties></ShipProperties>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {NSpace, NInput, NEllipsis, NButton} from "naive-ui"
|
||||
|
||||
import SwitchInput from "@/components/SwitchInput.vue";
|
||||
|
||||
import {g as global, baseUrl} from "./global.js"
|
||||
import Switch from "@/components/Switch.vue";
|
||||
import ShipProperties from "@/components/ShipProperties.vue";
|
||||
function update() {
|
||||
fetch(`${baseUrl.value}/get_config`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
}).then((res) => {
|
||||
res.json().then(
|
||||
(ret) => {
|
||||
for (let key in ret) {
|
||||
global[key].enabled = ret[key].enabled;
|
||||
}
|
||||
|
||||
for (let key in ret.globalShipProperties.value) {
|
||||
global.globalShipProperties.value[key].value = ret.globalShipProperties.value[key].value;
|
||||
}
|
||||
global.globalSpeedup.value = ret.globalSpeedup.value;
|
||||
global.ggFactor.value = ret.ggFactor.value;
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function apply() {
|
||||
fetch(`${baseUrl.value}/apply`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(global),
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
update()
|
||||
|
||||
</script>
|
||||
16
blcrack/cracker/webui/src/components/NumberInput.vue
Normal file
16
blcrack/cracker/webui/src/components/NumberInput.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<n-space align="center">
|
||||
<n-ellipsis>{{ group.name }} : </n-ellipsis>
|
||||
<n-input-number v-model:value="group.value" :disabled="!enabled"/>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {NEllipsis, NInputNumber, NSpace} from "naive-ui";
|
||||
import {defineModel} from "vue";
|
||||
|
||||
let group = defineModel("group")
|
||||
let enabled = defineModel("enabled")
|
||||
|
||||
</script>
|
||||
39
blcrack/cracker/webui/src/components/ShipProperties.vue
Normal file
39
blcrack/cracker/webui/src/components/ShipProperties.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<n-checkbox v-model:checked="global.globalShipProperties.enabled" size="large">
|
||||
{{ global.globalShipProperties.name }}
|
||||
</n-checkbox>
|
||||
<n-grid :cols="2">
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.armor"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.speed"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.antiaircraft"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.oxy_recovery_bench"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.torpedo"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.hit"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.sonarRange"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.attack_duration"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.raid_distance"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.oxy_recovery_surface"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.oxy_recovery"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.dodge"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.luck"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.reload"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.oxy_cost"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.durability"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.air"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.oxy_max"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.cannon"></NumberInput></n-grid-item>
|
||||
<n-grid-item><NumberInput v-model:enabled="global.globalShipProperties.enabled" v-model:group="globalShipPropertiesGroups.antisub"></NumberInput></n-grid-item>
|
||||
</n-grid>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {NCheckbox, NGrid, NGridItem} from "naive-ui"
|
||||
|
||||
import {g as global} from "../global.js"
|
||||
import NumberInput from "@/components/NumberInput.vue";
|
||||
import SwitchInput from "@/components/SwitchInput.vue";
|
||||
|
||||
let globalShipPropertiesGroups = global.globalShipProperties.value
|
||||
|
||||
</script>
|
||||
16
blcrack/cracker/webui/src/components/Switch.vue
Normal file
16
blcrack/cracker/webui/src/components/Switch.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<n-space align="center">
|
||||
<n-checkbox v-model:checked="group.enabled" size="large">
|
||||
{{ group.name }}
|
||||
</n-checkbox>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {NCheckbox, NSpace} from "naive-ui";
|
||||
import {defineModel} from "vue";
|
||||
|
||||
let group = defineModel("group")
|
||||
|
||||
</script>
|
||||
17
blcrack/cracker/webui/src/components/SwitchInput.vue
Normal file
17
blcrack/cracker/webui/src/components/SwitchInput.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<n-space align="center">
|
||||
<n-checkbox v-model:checked="group.enabled" size="large">
|
||||
{{ group.name }}
|
||||
</n-checkbox>
|
||||
<n-input-number v-model:value="group.value" :disabled="!group.enabled"/>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {defineModel} from "vue";
|
||||
import {NCheckbox, NInputNumber, NSpace} from "naive-ui";
|
||||
|
||||
let group = defineModel("group")
|
||||
|
||||
</script>
|
||||
126
blcrack/cracker/webui/src/global.js
Normal file
126
blcrack/cracker/webui/src/global.js
Normal file
@@ -0,0 +1,126 @@
|
||||
import {reactive, ref} from "vue";
|
||||
|
||||
export let baseUrl = ref(window.location.origin)
|
||||
|
||||
export let g = reactive({
|
||||
globalSpeedup: {
|
||||
name: "全局加速",
|
||||
enabled: false,
|
||||
value: 1,
|
||||
},
|
||||
chapterFastMove: {
|
||||
name: "章节图移动加速",
|
||||
enabled: false,
|
||||
},
|
||||
opsiFastMove: {
|
||||
name: "大世界移动加速",
|
||||
enabled: false,
|
||||
},
|
||||
noBBAnimation: {
|
||||
name: "移除战列开火的子弹时间",
|
||||
enabled: false,
|
||||
},
|
||||
noEmotionWarning: {
|
||||
name: "移除低心情警告",
|
||||
enabled: false,
|
||||
},
|
||||
removeHardModeShipPropertiesLimit: {
|
||||
name: "移除困难图属性限制",
|
||||
enabled: false,
|
||||
},
|
||||
removeHardModeShipTypeLimit: {
|
||||
name: "移除困难图舰种限制",
|
||||
enabled: false,
|
||||
},
|
||||
globalShipProperties: {
|
||||
name: "改属性",
|
||||
enabled: false,
|
||||
value: {
|
||||
armor: {
|
||||
name: "装甲类型",
|
||||
value: -1,
|
||||
},
|
||||
speed: {
|
||||
name: "航速",
|
||||
value: -1,
|
||||
},
|
||||
antiaircraft: {
|
||||
name: "防空",
|
||||
value: -1,
|
||||
},
|
||||
oxy_recovery_bench: {
|
||||
name: "OxyRecoveryBench",
|
||||
value: -1,
|
||||
},
|
||||
torpedo: {
|
||||
name: "雷击",
|
||||
value: -1,
|
||||
},
|
||||
hit: {
|
||||
name: "命中",
|
||||
value: -1,
|
||||
},
|
||||
sonarRange: {
|
||||
name: "反潜范围",
|
||||
value: -1,
|
||||
},
|
||||
attack_duration: {
|
||||
name: "攻击间隔",
|
||||
value: -1,
|
||||
},
|
||||
raid_distance: {
|
||||
name: "雷达范围",
|
||||
value: -1,
|
||||
},
|
||||
oxy_recovery_surface: {
|
||||
name: "OxyRecoverySurface",
|
||||
value: -1,
|
||||
},
|
||||
oxy_recovery: {
|
||||
name: "OxyRecovery",
|
||||
value: -1,
|
||||
},
|
||||
dodge: {
|
||||
name: "机动",
|
||||
value: -1,
|
||||
},
|
||||
luck: {
|
||||
name: "幸运",
|
||||
value: -1,
|
||||
},
|
||||
reload: {
|
||||
name: "装填",
|
||||
value: -1,
|
||||
},
|
||||
oxy_cost: {
|
||||
name: "氧气消耗",
|
||||
value: -1,
|
||||
},
|
||||
durability: {
|
||||
name: "耐久",
|
||||
value: -1,
|
||||
},
|
||||
air: {
|
||||
name: "航空",
|
||||
value: -1,
|
||||
},
|
||||
oxy_max: {
|
||||
name: "氧气",
|
||||
value: -1,
|
||||
},
|
||||
cannon: {
|
||||
name: "炮击",
|
||||
value: -1,
|
||||
},
|
||||
antisub: {
|
||||
name: "反潜",
|
||||
value: -1,
|
||||
},
|
||||
},
|
||||
},
|
||||
ggFactor: {
|
||||
name: "倍率",
|
||||
enabled: false,
|
||||
value: 1,
|
||||
},
|
||||
})
|
||||
4
blcrack/cracker/webui/src/main.js
Normal file
4
blcrack/cracker/webui/src/main.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
18
blcrack/cracker/webui/vite.config.js
Normal file
18
blcrack/cracker/webui/vite.config.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -109,4 +109,7 @@ POST http://{{Host}}:{{Port}}/disable_global_speedup
|
||||
POST http://{{Host}}:{{Port}}/is_alive
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/init
|
||||
POST http://{{Host}}:{{Port}}/init
|
||||
|
||||
###
|
||||
GET http://{{Host}}:{{Port}}/get_config
|
||||
Reference in New Issue
Block a user