mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 11:19:26 +08:00
add: operate cracker without pause
This commit is contained in:
@@ -28,6 +28,21 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_all_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.better_global_speedup_pause(false);
|
||||
ins.skip_battle_celebrate_pause(false);
|
||||
ins.fast_stage_move_pause(false);
|
||||
ins.disable_all();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable all failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_hooked_lua_function_trace", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_hooked_lua_function_trace();
|
||||
@@ -121,6 +136,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_fast_stage_move_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.fast_stage_move_pause(false);
|
||||
ins.enable_fast_stage_move();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable fast stage move failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_fast_stage_move", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance();
|
||||
@@ -134,6 +162,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_fast_stage_move_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.fast_stage_move_pause(false);
|
||||
ins.disable_fast_stage_move();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable fast stage move failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_remove_hard_mode_ship_properties_limit", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_remove_hard_mode_ship_properties_limit();
|
||||
@@ -791,6 +832,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_battle_celebrate_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.skip_battle_celebrate_pause(false);
|
||||
ins.enable_skip_battle_celebrate();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip battle celebrate failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_battle_celebrate", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance();
|
||||
@@ -804,6 +858,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_battle_celebrate_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.skip_battle_celebrate_pause(false);
|
||||
ins.disable_skip_battle_celebrate();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip battle celebrate failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_better_global_speedup", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance();
|
||||
@@ -817,6 +884,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_better_global_speedup_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.better_global_speedup_pause(false);
|
||||
ins.enable_better_global_speedup();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable better global speedup failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/update_better_global_speedup_rate", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Json::Reader reader;
|
||||
@@ -833,6 +913,22 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/update_better_global_speedup_rate_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Json::Reader reader;
|
||||
Json::Value j;
|
||||
reader.parse(req.body, j);
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.better_global_speedup_pause(false);
|
||||
ins.update_better_global_speedup_rate(j["rate"].asDouble());
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Update better global speedup rate failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_better_global_speedup", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance();
|
||||
@@ -846,6 +942,19 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_better_global_speedup_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.better_global_speedup_pause(false);
|
||||
ins.disable_better_global_speedup();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable better global speedup failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_no_damage", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_no_damage();
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
POST http://{{Host}}:{{Port}}/disable_all
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_all_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_hooked_lua_function_trace
|
||||
|
||||
@@ -44,9 +47,15 @@ POST http://{{Host}}:{{Port}}/update_global_ship_properties
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_fast_stage_move
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_fast_stage_move_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_fast_stage_move
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_fast_stage_move_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_remove_hard_mode_ship_properties_limit
|
||||
|
||||
@@ -145,12 +154,21 @@ POST http://{{Host}}:{{Port}}/disable_monster_kill_self
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_skip_battle_celebrate
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_skip_battle_celebrate_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_skip_battle_celebrate
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_skip_battle_celebrate_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_better_global_speedup
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_better_global_speedup_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/update_better_global_speedup_rate
|
||||
|
||||
@@ -158,9 +176,19 @@ POST http://{{Host}}:{{Port}}/update_better_global_speedup_rate
|
||||
"rate": 5.0
|
||||
}
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/update_better_global_speedup_rate_without_pause
|
||||
|
||||
{
|
||||
"rate": 5.0
|
||||
}
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_better_global_speedup
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_better_global_speedup_without_pause
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_no_damage
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
"UpdateServer": null,
|
||||
"GameLibDir": null,
|
||||
"HookedLuaFunctionTrace": false,
|
||||
"InitWithoutPause": false
|
||||
"OperateWithoutPause": false
|
||||
},
|
||||
"Misc": {
|
||||
"GlobalSpeedup": 1.0,
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
},
|
||||
"InitWithoutPause": {
|
||||
"OperateWithoutPause": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ HookGeneral:
|
||||
value: ""
|
||||
type: textarea
|
||||
HookedLuaFunctionTrace: false
|
||||
InitWithoutPause: false
|
||||
OperateWithoutPause: false
|
||||
ShipProperty:
|
||||
Method:
|
||||
value: disable
|
||||
|
||||
@@ -495,7 +495,7 @@ class GeneratedConfig:
|
||||
HookGeneral_UpdateServer = None
|
||||
HookGeneral_GameLibDir = None
|
||||
HookGeneral_HookedLuaFunctionTrace = False
|
||||
HookGeneral_InitWithoutPause = False
|
||||
HookGeneral_OperateWithoutPause = False
|
||||
|
||||
# Group `ShipProperty`
|
||||
ShipProperty_Method = 'disable' # disable, gg_factor, final_properties
|
||||
|
||||
@@ -140,7 +140,7 @@ class FullGeneratedConfig:
|
||||
Hook_HookGeneral_UpdateServer = None
|
||||
Hook_HookGeneral_GameLibDir = None
|
||||
Hook_HookGeneral_HookedLuaFunctionTrace = None
|
||||
Hook_HookGeneral_InitWithoutPause = None
|
||||
Hook_HookGeneral_OperateWithoutPause = None
|
||||
Hook_Misc_GlobalSpeedup = None
|
||||
Hook_Misc_BetterGlobalSpeedup = None
|
||||
Hook_Misc_ChapterMove = None
|
||||
|
||||
@@ -2940,9 +2940,9 @@
|
||||
"name": "HookGeneral.HookedLuaFunctionTrace.name",
|
||||
"help": "HookGeneral.HookedLuaFunctionTrace.help"
|
||||
},
|
||||
"InitWithoutPause": {
|
||||
"name": "HookGeneral.InitWithoutPause.name",
|
||||
"help": "HookGeneral.InitWithoutPause.help"
|
||||
"OperateWithoutPause": {
|
||||
"name": "HookGeneral.OperateWithoutPause.name",
|
||||
"help": "HookGeneral.OperateWithoutPause.help"
|
||||
}
|
||||
},
|
||||
"ShipProperty": {
|
||||
|
||||
@@ -2940,9 +2940,9 @@
|
||||
"name": "HookGeneral.HookedLuaFunctionTrace.name",
|
||||
"help": "HookGeneral.HookedLuaFunctionTrace.help"
|
||||
},
|
||||
"InitWithoutPause": {
|
||||
"name": "HookGeneral.InitWithoutPause.name",
|
||||
"help": "HookGeneral.InitWithoutPause.help"
|
||||
"OperateWithoutPause": {
|
||||
"name": "HookGeneral.OperateWithoutPause.name",
|
||||
"help": "HookGeneral.OperateWithoutPause.help"
|
||||
}
|
||||
},
|
||||
"ShipProperty": {
|
||||
|
||||
@@ -2940,8 +2940,8 @@
|
||||
"name": "Lua函数追踪",
|
||||
"help": "仅供调试使用,平时使用不要开"
|
||||
},
|
||||
"InitWithoutPause": {
|
||||
"name": "Cracker非暂停初始化",
|
||||
"OperateWithoutPause": {
|
||||
"name": "非暂停操作",
|
||||
"help": "正常使用不需要开启"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2940,9 +2940,9 @@
|
||||
"name": "HookGeneral.HookedLuaFunctionTrace.name",
|
||||
"help": "HookGeneral.HookedLuaFunctionTrace.help"
|
||||
},
|
||||
"InitWithoutPause": {
|
||||
"name": "HookGeneral.InitWithoutPause.name",
|
||||
"help": "HookGeneral.InitWithoutPause.help"
|
||||
"OperateWithoutPause": {
|
||||
"name": "HookGeneral.OperateWithoutPause.name",
|
||||
"help": "HookGeneral.OperateWithoutPause.help"
|
||||
}
|
||||
},
|
||||
"ShipProperty": {
|
||||
|
||||
@@ -188,6 +188,9 @@ class CrackApi:
|
||||
def disable_all(self):
|
||||
self.post('disable_all')
|
||||
|
||||
def disable_all_without_pause(self):
|
||||
self.post('disable_all_without_pause')
|
||||
|
||||
def enable_global_ship_properties_crack(self):
|
||||
self.post('enable_global_ship_properties_crack')
|
||||
|
||||
@@ -200,9 +203,15 @@ class CrackApi:
|
||||
def enable_fast_stage_move(self):
|
||||
self.post("enable_fast_stage_move")
|
||||
|
||||
def enable_fast_stage_move_without_pause(self):
|
||||
self.post("enable_fast_stage_move_without_pause")
|
||||
|
||||
def disable_fast_stage_move(self):
|
||||
self.post("disable_fast_stage_move")
|
||||
|
||||
def disable_fast_stage_move_without_pause(self):
|
||||
self.post("disable_fast_stage_move_without_pause")
|
||||
|
||||
def enable_remove_hard_mode_ship_properties_limit(self):
|
||||
self.post("enable_remove_hard_mode_ship_properties_limit")
|
||||
|
||||
@@ -260,12 +269,21 @@ class CrackApi:
|
||||
def enable_better_global_speedup(self):
|
||||
self.post("enable_better_global_speedup")
|
||||
|
||||
def enable_better_global_speedup_without_pause(self):
|
||||
self.post("enable_better_global_speedup_without_pause")
|
||||
|
||||
def update_better_global_speedup_rate(self, rate: BetterGlobalSpeedupRate):
|
||||
self.post("update_better_global_speedup_rate", data=rate.json())
|
||||
|
||||
def update_better_global_speedup_rate_without_pause(self, rate: BetterGlobalSpeedupRate):
|
||||
self.post("update_better_global_speedup_rate_without_pause", data=rate.json())
|
||||
|
||||
def disable_better_global_speedup(self):
|
||||
self.post("disable_better_global_speedup")
|
||||
|
||||
def disable_better_global_speedup_without_pause(self):
|
||||
self.post("disable_better_global_speedup_without_pause")
|
||||
|
||||
def is_alive(self):
|
||||
self.post("is_alive")
|
||||
|
||||
@@ -299,9 +317,15 @@ class CrackApi:
|
||||
def enable_skip_battle_celebrate(self):
|
||||
self.post("enable_skip_battle_celebrate")
|
||||
|
||||
def enable_skip_battle_celebrate_without_pause(self):
|
||||
self.post("enable_skip_battle_celebrate_without_pause")
|
||||
|
||||
def disable_skip_battle_celebrate(self):
|
||||
self.post("disable_skip_battle_celebrate")
|
||||
|
||||
def disable_skip_battle_celebrate_without_pause(self):
|
||||
self.post("disable_skip_battle_celebrate_without_pause")
|
||||
|
||||
def enable_no_damage(self):
|
||||
self.post("enable_no_damage")
|
||||
|
||||
|
||||
@@ -104,9 +104,10 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
timeout = full_config.Hook_HookGeneral_RequestTimeLimit
|
||||
api = CrackApi(base_url, timeout=timeout)
|
||||
|
||||
without_pause = full_config.Hook_HookGeneral_OperateWithoutPause
|
||||
|
||||
global g_cracker_has_inited
|
||||
if not g_cracker_has_inited:
|
||||
without_pause = full_config.Hook_HookGeneral_InitWithoutPause
|
||||
if without_pause:
|
||||
api.init_without_pause()
|
||||
else:
|
||||
@@ -115,7 +116,10 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
|
||||
for op in l:
|
||||
if op == CrackOp.DisableAll:
|
||||
api.disable_all()
|
||||
if without_pause:
|
||||
api.disable_all_without_pause()
|
||||
else:
|
||||
api.disable_all()
|
||||
elif op == CrackOp.EnableHookedLuaFunctionTrace:
|
||||
if full_config.Hook_HookGeneral_HookedLuaFunctionTrace:
|
||||
api.enable_hooked_lua_function_trace()
|
||||
@@ -154,9 +158,15 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
elif op == CrackOp.EnableChapterFastMove:
|
||||
if not full_config.Hook_Misc_ChapterMove:
|
||||
continue
|
||||
api.enable_fast_stage_move()
|
||||
if without_pause:
|
||||
api.enable_fast_stage_move_without_pause()
|
||||
else:
|
||||
api.enable_fast_stage_move()
|
||||
elif op == CrackOp.DisableChapterFastMove:
|
||||
api.disable_fast_stage_move()
|
||||
if without_pause:
|
||||
api.disable_fast_stage_move_without_pause()
|
||||
else:
|
||||
api.disable_fast_stage_move()
|
||||
elif op == CrackOp.EnableRemoveHardModeShipPropertiesLimit:
|
||||
if full_config.Hook_Misc_RemoveHardMapLimit != "remove_ship_properties_limit":
|
||||
continue
|
||||
@@ -225,10 +235,17 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
rate = float(full_config.Hook_Misc_BetterGlobalSpeedup)
|
||||
if rate == 1.0:
|
||||
continue
|
||||
api.update_better_global_speedup_rate(CrackApi.BetterGlobalSpeedupRate(rate=rate))
|
||||
api.enable_better_global_speedup()
|
||||
if without_pause:
|
||||
api.update_better_global_speedup_rate_without_pause(CrackApi.BetterGlobalSpeedupRate(rate=rate))
|
||||
api.enable_better_global_speedup_without_pause()
|
||||
else:
|
||||
api.update_better_global_speedup_rate(CrackApi.BetterGlobalSpeedupRate(rate=rate))
|
||||
api.enable_better_global_speedup()
|
||||
elif op == CrackOp.DisableBetterGlobalSpeedup:
|
||||
api.disable_better_global_speedup()
|
||||
if without_pause:
|
||||
api.disable_better_global_speedup_without_pause()
|
||||
else:
|
||||
api.disable_better_global_speedup()
|
||||
elif op == CrackOp.EnableExerciseGodMod:
|
||||
if full_config.Hook_Misc_ExerciseGodMod:
|
||||
api.enable_exercise_god_mode()
|
||||
@@ -254,9 +271,15 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
api.disable_monster_kill_self()
|
||||
elif op == CrackOp.EnableSkipBattleCelebrate:
|
||||
if full_config.Hook_Misc_SkipBattleCelebrate:
|
||||
api.enable_skip_battle_celebrate()
|
||||
if without_pause:
|
||||
api.enable_skip_battle_celebrate_without_pause()
|
||||
else:
|
||||
api.enable_skip_battle_celebrate()
|
||||
elif op == CrackOp.DisableSkipBattleCelebrate:
|
||||
api.disable_skip_battle_celebrate()
|
||||
if without_pause:
|
||||
api.disable_skip_battle_celebrate_without_pause()
|
||||
else:
|
||||
api.disable_skip_battle_celebrate()
|
||||
elif op == CrackOp.EnableNoDamage:
|
||||
if full_config.Hook_Misc_NoDamage:
|
||||
api.enable_no_damage()
|
||||
|
||||
Reference in New Issue
Block a user