mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 13:29:25 +08:00
add: SKIP_ENEMY_SCAN, SKIP_BATTLE_RESULT, SKIP_ENTER_BATTLE crack
This commit is contained in:
@@ -326,6 +326,39 @@ void Cracker::disable_all() {
|
||||
disable_skip_air_strike_animation();
|
||||
disable_auto_once_again();
|
||||
disable_auto_retire();
|
||||
disable_skip_enemy_scan();
|
||||
disable_skip_battle_result();
|
||||
disable_skip_enter_battle();
|
||||
}
|
||||
|
||||
void Cracker::enable_skip_enemy_scan() {
|
||||
ENABLE(SKIP_ENEMY_SCAN);
|
||||
}
|
||||
|
||||
void Cracker::disable_skip_enemy_scan() {
|
||||
DISABLE(SKIP_ENEMY_SCAN);
|
||||
}
|
||||
|
||||
void Cracker::enable_skip_battle_result() {
|
||||
ENABLE(SKIP_BATTLE_RESULT);
|
||||
}
|
||||
|
||||
void Cracker::disable_skip_battle_result() {
|
||||
DISABLE(SKIP_BATTLE_RESULT);
|
||||
}
|
||||
|
||||
void Cracker::skip_enter_battle_pause(bool need_pause) {
|
||||
m_skip_enter_battle_need_pause.store(need_pause);
|
||||
}
|
||||
|
||||
void Cracker::enable_skip_enter_battle() {
|
||||
ENABLE(SKIP_ENTER_BATTLE);
|
||||
clear_combat_delay_active();
|
||||
}
|
||||
|
||||
void Cracker::disable_skip_enter_battle() {
|
||||
DISABLE(SKIP_ENTER_BATTLE);
|
||||
restore_combat_delay_active();
|
||||
}
|
||||
|
||||
void Cracker::enable_auto_retire() {
|
||||
@@ -781,6 +814,9 @@ void Cracker::load_lua_resources() {
|
||||
m_lua_res.BayProxy_findShipsByGroup = m_state["BayProxy"]["findShipsByGroup"];
|
||||
m_lua_res._map = m_state["_"]["map"];
|
||||
m_lua_res._select = m_state["_"]["select"];
|
||||
m_lua_res.NewBattleResultScene_GoBack = m_state["NewBattleResultScene"]["GoBack"];
|
||||
m_lua_res.ys_Battle_BattleConfig_COMBAT_DELAY_ACTIVE = m_state["ys"]["Battle"]["BattleConfig"]["COMBAT_DELAY_ACTIVE"];
|
||||
m_lua_res.LevelScene_unfrozen = m_state["LevelScene"]["unfrozen"];
|
||||
|
||||
SPDLOG_INFO("Load lua functions");
|
||||
m_original.GetBattleCheckResult = m_state["GetBattleCheckResult"];
|
||||
@@ -823,11 +859,60 @@ void Cracker::load_lua_resources() {
|
||||
m_original.ActivityProxy_UseContinuousTime = m_state["ActivityProxy"]["UseContinuousTime"];
|
||||
m_original.LevelScene_doPlayAirStrike = m_state["LevelScene"]["doPlayAirStrike"];
|
||||
m_original.LevelStageTotalRewardPanel_UpdateView = m_state["LevelStageTotalRewardPanel"]["UpdateView"];
|
||||
m_original.NewBattleResultScene_SetUp = m_state["NewBattleResultScene"]["SetUp"];
|
||||
m_original.ys_Battle_BattleUIMediator_SeaSurfaceShift = m_state["ys"]["Battle"]["BattleUIMediator"]["SeaSurfaceShift"];
|
||||
m_original.LevelScene_doTracking = m_state["LevelScene"]["doTracking"];
|
||||
}
|
||||
|
||||
void Cracker::hook_all_lua_functions() {
|
||||
SPDLOG_INFO("Hook lua functions");
|
||||
|
||||
// skip_enemy_scan
|
||||
m_state["LevelScene"]["doTracking"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(LevelScene.doTracking);
|
||||
|
||||
if (IS_ENABLED(SKIP_ENEMY_SCAN)) {
|
||||
if (args.size() >= 2) {
|
||||
Lua::Object self = args[0];
|
||||
Lua::Object callback = args[1];
|
||||
if (callback.get_type() == sol::type::function) {
|
||||
m_lua_res.LevelScene_unfrozen(L, self);
|
||||
callback.as<sol::function>()();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_original.LevelScene_doTracking(L, args);
|
||||
};
|
||||
|
||||
// skip_enter_battle
|
||||
m_state["ys"]["Battle"]["BattleUIMediator"]["SeaSurfaceShift"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(ys.Battle.BattleUIMediator.SeaSurfaceShift);
|
||||
|
||||
if (IS_ENABLED(SKIP_ENTER_BATTLE)) {
|
||||
if (args.size() >= 5) {
|
||||
Lua::Object callback = args[4];
|
||||
if (callback.get_type() == sol::type::function) {
|
||||
callback.as<sol::function>()();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_original.ys_Battle_BattleUIMediator_SeaSurfaceShift(L, args);
|
||||
};
|
||||
|
||||
// skip_battle_result
|
||||
m_state["NewBattleResultScene"]["SetUp"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(NewBattleResultScene.SetUp);
|
||||
|
||||
if (IS_ENABLED(SKIP_BATTLE_RESULT)) {
|
||||
Lua::Object self = args[0];
|
||||
m_lua_res.NewBattleResultScene_GoBack(L, self);
|
||||
return;
|
||||
}
|
||||
m_original.NewBattleResultScene_SetUp(L, args);
|
||||
};
|
||||
|
||||
// auto_once_again
|
||||
m_state["LevelStageTotalRewardPanel"]["UpdateView"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(LevelStageTotalRewardPanel.UpdateView)
|
||||
@@ -1839,6 +1924,9 @@ Cracker::Config Cracker::get_config() {
|
||||
SET_CONFIG_FLAG(SKIP_AIR_STRIKE_ANIMATION),
|
||||
SET_CONFIG_FLAG(AUTO_ONCE_AGAIN),
|
||||
SET_CONFIG_FLAG(AUTO_RETIRE),
|
||||
SET_CONFIG_FLAG(SKIP_ENEMY_SCAN),
|
||||
SET_CONFIG_FLAG(SKIP_BATTLE_RESULT),
|
||||
SET_CONFIG_FLAG(SKIP_ENTER_BATTLE),
|
||||
},
|
||||
.globle_ship_properties = m_globle_ship_properties,
|
||||
.global_speedup_rate = static_cast<int>(m_global_speedup_rate),
|
||||
@@ -1853,6 +1941,24 @@ Cracker::Config Cracker::get_config() {
|
||||
#define IS_CONFIG_ENABLED(n) config.flag.n
|
||||
|
||||
void Cracker::apply_config(Config& config) {
|
||||
if(IS_CONFIG_ENABLED(SKIP_ENEMY_SCAN)) {
|
||||
enable_skip_enemy_scan();
|
||||
} else {
|
||||
disable_skip_enemy_scan();
|
||||
}
|
||||
|
||||
if(IS_CONFIG_ENABLED(SKIP_BATTLE_RESULT)) {
|
||||
enable_skip_battle_result();
|
||||
} else {
|
||||
disable_skip_battle_result();
|
||||
}
|
||||
|
||||
if(IS_CONFIG_ENABLED(SKIP_ENTER_BATTLE)) {
|
||||
enable_skip_enter_battle();
|
||||
} else {
|
||||
disable_skip_enter_battle();
|
||||
}
|
||||
|
||||
if(IS_CONFIG_ENABLED(AUTO_RETIRE)) {
|
||||
enable_auto_retire();
|
||||
} else {
|
||||
@@ -2031,6 +2137,42 @@ void Cracker::apply_config(Config& config) {
|
||||
}
|
||||
}
|
||||
|
||||
void Cracker::clear_combat_delay_active() {
|
||||
if (m_skip_enter_battle_need_pause.load()) {
|
||||
clear_combat_delay_active_with_pause();
|
||||
} else {
|
||||
clear_combat_delay_active_without_pause();
|
||||
}
|
||||
}
|
||||
|
||||
void Cracker::clear_combat_delay_active_with_pause() {
|
||||
m_lua_state_pauser.do_when_paused([&]() {
|
||||
m_state["ys"]["Battle"]["BattleConfig"]["COMBAT_DELAY_ACTIVE"] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
void Cracker::clear_combat_delay_active_without_pause() {
|
||||
m_state["ys"]["Battle"]["BattleConfig"]["COMBAT_DELAY_ACTIVE"] = 0;
|
||||
}
|
||||
|
||||
void Cracker::restore_combat_delay_active() {
|
||||
if (m_skip_enter_battle_need_pause.load()) {
|
||||
restore_combat_delay_active_with_pause();
|
||||
} else {
|
||||
restore_combat_delay_active_without_pause();
|
||||
}
|
||||
}
|
||||
|
||||
void Cracker::restore_combat_delay_active_with_pause() {
|
||||
m_lua_state_pauser.do_when_paused([&]() {
|
||||
m_state["ys"]["Battle"]["BattleConfig"]["COMBAT_DELAY_ACTIVE"] = m_lua_res.ys_Battle_BattleConfig_COMBAT_DELAY_ACTIVE;
|
||||
});
|
||||
}
|
||||
|
||||
void Cracker::restore_combat_delay_active_without_pause() {
|
||||
m_state["ys"]["Battle"]["BattleConfig"]["COMBAT_DELAY_ACTIVE"] = m_lua_res.ys_Battle_BattleConfig_COMBAT_DELAY_ACTIVE;
|
||||
}
|
||||
|
||||
void Cracker::clear_emotion_threshold() {
|
||||
if (m_no_emotion_warning_need_pause.load()) {
|
||||
clear_emotion_threshold_with_pause();
|
||||
|
||||
@@ -120,6 +120,9 @@ public:
|
||||
bool SKIP_AIR_STRIKE_ANIMATION = false;
|
||||
bool AUTO_ONCE_AGAIN = false;
|
||||
bool AUTO_RETIRE = false;
|
||||
bool SKIP_ENEMY_SCAN = false;
|
||||
bool SKIP_BATTLE_RESULT = false;
|
||||
bool SKIP_ENTER_BATTLE = false;
|
||||
} flag;
|
||||
ShipProperties globle_ship_properties;
|
||||
int global_speedup_rate = 1;
|
||||
@@ -156,6 +159,16 @@ public:
|
||||
|
||||
void disable_all();
|
||||
|
||||
void enable_skip_enemy_scan();
|
||||
void disable_skip_enemy_scan();
|
||||
|
||||
void enable_skip_battle_result();
|
||||
void disable_skip_battle_result();
|
||||
|
||||
void skip_enter_battle_pause(bool need_pause);
|
||||
void enable_skip_enter_battle();
|
||||
void disable_skip_enter_battle();
|
||||
|
||||
void enable_auto_retire();
|
||||
void disable_auto_retire();
|
||||
|
||||
@@ -271,6 +284,13 @@ public:
|
||||
void apply_config(Config& config);
|
||||
|
||||
private:
|
||||
void clear_combat_delay_active();
|
||||
void clear_combat_delay_active_with_pause();
|
||||
void clear_combat_delay_active_without_pause();
|
||||
void restore_combat_delay_active();
|
||||
void restore_combat_delay_active_with_pause();
|
||||
void restore_combat_delay_active_without_pause();
|
||||
|
||||
void clear_emotion_threshold();
|
||||
void clear_emotion_threshold_with_pause();
|
||||
void clear_emotion_threshold_without_pause();
|
||||
@@ -358,6 +378,9 @@ private:
|
||||
std::atomic<bool> SKIP_AIR_STRIKE_ANIMATION = false;
|
||||
std::atomic<bool> AUTO_ONCE_AGAIN = false;
|
||||
std::atomic<bool> AUTO_RETIRE = false;
|
||||
std::atomic<bool> SKIP_ENEMY_SCAN = false;
|
||||
std::atomic<bool> SKIP_BATTLE_RESULT = false;
|
||||
std::atomic<bool> SKIP_ENTER_BATTLE = false;
|
||||
} m_flag;
|
||||
|
||||
struct {
|
||||
@@ -410,6 +433,9 @@ private:
|
||||
Lua::Function ActivityProxy_UseContinuousTime;
|
||||
Lua::Function LevelScene_doPlayAirStrike;
|
||||
Lua::Function LevelStageTotalRewardPanel_UpdateView;
|
||||
Lua::Function NewBattleResultScene_SetUp;
|
||||
Lua::Function ys_Battle_BattleUIMediator_SeaSurfaceShift;
|
||||
Lua::Function LevelScene_doTracking;
|
||||
} m_original;
|
||||
struct {
|
||||
Lua::Function Clone;
|
||||
@@ -473,6 +499,9 @@ private:
|
||||
Lua::Function BayProxy_findShipsByGroup;
|
||||
Lua::Function _map;
|
||||
Lua::Function _select;
|
||||
Lua::Function NewBattleResultScene_GoBack;
|
||||
double ys_Battle_BattleConfig_COMBAT_DELAY_ACTIVE;
|
||||
Lua::Function LevelScene_unfrozen;
|
||||
} m_lua_res;
|
||||
|
||||
struct {
|
||||
@@ -504,6 +533,7 @@ private:
|
||||
std::atomic<bool> m_skip_battle_celebrate_need_pause = false;
|
||||
std::atomic<bool> m_fast_stage_move_need_pause = false;
|
||||
std::atomic<bool> m_no_emotion_warning_need_pause = false;
|
||||
std::atomic<bool> m_skip_enter_battle_need_pause = false;
|
||||
|
||||
static std::vector<std::string> s_shipStatus;
|
||||
static std::vector<int> s_excludedShips;
|
||||
|
||||
@@ -19,6 +19,7 @@ CrackerServer::CrackerServer() {
|
||||
ins.better_global_speedup_pause(true);
|
||||
ins.skip_battle_celebrate_pause(true);
|
||||
ins.fast_stage_move_pause(true);
|
||||
ins.skip_enter_battle_pause(true);
|
||||
ins.disable_all();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable all failed: {}", e.what());
|
||||
@@ -34,6 +35,7 @@ CrackerServer::CrackerServer() {
|
||||
ins.better_global_speedup_pause(false);
|
||||
ins.skip_battle_celebrate_pause(false);
|
||||
ins.fast_stage_move_pause(false);
|
||||
ins.skip_enter_battle_pause(false);
|
||||
ins.disable_all();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable all failed: {}", e.what());
|
||||
@@ -1286,6 +1288,98 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_enemy_scan", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_skip_enemy_scan();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip enemy scan failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_enemy_scan", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().disable_skip_enemy_scan();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip enemy scan failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_battle_result", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_skip_battle_result();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip battle result failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_battle_result", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().disable_skip_battle_result();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip battle result failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_enter_battle", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_skip_enter_battle();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip enter battle failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_enter_battle", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().disable_skip_enter_battle();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip enter battle failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_enter_battle_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.skip_enter_battle_pause(false);
|
||||
ins.enable_skip_enter_battle();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip enter battle failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_enter_battle_without_pause", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
auto& ins = Cracker::Instance(false);
|
||||
ins.skip_enter_battle_pause(false);
|
||||
ins.disable_skip_enter_battle();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip enter battle failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_auto_retire", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_auto_retire();
|
||||
|
||||
@@ -92,6 +92,7 @@ void CrackerUI::draw_menu() {
|
||||
ins.skip_battle_celebrate_pause(false);
|
||||
ins.fast_stage_move_pause(false);
|
||||
ins.no_emotion_warning_pause(false);
|
||||
ins.skip_enter_battle_pause(false);
|
||||
ins.apply_config(m_cracker_config);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
@@ -116,6 +117,9 @@ void CrackerUI::draw_menu() {
|
||||
PRESET(CHAPTER_AUTO_NEXT_BATTLE);
|
||||
PRESET(CHAPTER_AUTO_CLEAR);
|
||||
PRESET(SKIP_AIR_STRIKE_ANIMATION);
|
||||
PRESET(SKIP_ENEMY_SCAN);
|
||||
PRESET(SKIP_BATTLE_RESULT);
|
||||
PRESET(SKIP_ENTER_BATTLE);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("加载大世界开荒预设")) {
|
||||
@@ -126,6 +130,8 @@ void CrackerUI::draw_menu() {
|
||||
PRESET(OPSI_NO_MAP_FOG);
|
||||
PRESET(FAST_WAVE);
|
||||
PRESET(MONSTER_KILL_SELF);
|
||||
PRESET(SKIP_BATTLE_RESULT);
|
||||
PRESET(SKIP_ENTER_BATTLE);
|
||||
}
|
||||
if(ImGui::BeginTable("MiscTable", 3)) {
|
||||
ImGui::TableNextColumn();
|
||||
@@ -137,6 +143,7 @@ void CrackerUI::draw_menu() {
|
||||
ImGui::Checkbox("跳过战斗胜利庆祝", &CONFIG_FLAG(SKIP_BATTLE_CELEBRATE));
|
||||
ImGui::Checkbox("章节图强制开启自动战斗", &CONFIG_FLAG(CHAPTER_FORCE_ENABLE_AUTO_FIGHT));
|
||||
ImGui::Checkbox("章节图跳过战前准备", &CONFIG_FLAG(CHAPTER_SKIP_PRECOMBAT));
|
||||
ImGui::Checkbox("章节图跳过索敌", &CONFIG_FLAG(SKIP_ENEMY_SCAN));
|
||||
|
||||
ImGui::Checkbox("演习我方伤害增加 X %", &CONFIG_FLAG(EXERCISE_MORE_POWER));
|
||||
ImGui::DragInt("(%)##Exercise Power Rate", &m_cracker_config.exercise_more_power_rate);
|
||||
@@ -150,6 +157,7 @@ void CrackerUI::draw_menu() {
|
||||
ImGui::Checkbox("无伤害无击杀", &CONFIG_FLAG(NO_DAMAGE));
|
||||
ImGui::Checkbox("全皮肤", &CONFIG_FLAG(ALL_SKIN));
|
||||
ImGui::Checkbox("跳过舰船获取展示", &CONFIG_FLAG(SKIP_SHIP_GAIN_SHOW));
|
||||
ImGui::Checkbox("跳过战斗结算", &CONFIG_FLAG(SKIP_BATTLE_RESULT));
|
||||
|
||||
ImGui::Text("章节图自动开荒移动间隔(s)");
|
||||
ImGui::InputDouble("##StepInterval", &m_cracker_config.chapter_auto_clear_step_interval, 0.1f, 0, "%.1f");
|
||||
@@ -164,6 +172,7 @@ void CrackerUI::draw_menu() {
|
||||
ImGui::Checkbox("无限连战", &CONFIG_FLAG(INFINITE_BATTLE));
|
||||
ImGui::Checkbox("自动再次前往", &CONFIG_FLAG(AUTO_ONCE_AGAIN));
|
||||
ImGui::Checkbox("自动退役", &CONFIG_FLAG(AUTO_RETIRE));
|
||||
ImGui::Checkbox("跳过战斗进场", &CONFIG_FLAG(SKIP_ENTER_BATTLE));
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user