1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 12:49:25 +08:00

add: auto once again

This commit is contained in:
0O0o0oOoO00
2026-01-14 14:39:07 +08:00
parent aa12aa8511
commit 1e9c811ea5
16 changed files with 111 additions and 1 deletions

View File

@@ -322,6 +322,15 @@ void Cracker::disable_all() {
disable_skip_story();
disable_infinite_battle();
disable_skip_air_strike_animation();
disable_auto_once_again();
}
void Cracker::enable_auto_once_again() {
ENABLE(AUTO_ONCE_AGAIN);
}
void Cracker::disable_auto_once_again() {
DISABLE(AUTO_ONCE_AGAIN);
}
void Cracker::enable_skip_air_strike_animation() {
@@ -730,6 +739,8 @@ void Cracker::load_lua_resources() {
m_lua_res.Chapter_findPath = m_state["Chapter"]["findPath"];
m_lua_res.ChapterConst_SubjectPlayer = m_state["ChapterConst"]["SubjectPlayer"];
m_lua_res.Ship_ENERGY_LOW = m_state["Ship"]["ENERGY_LOW"];
m_lua_res.BaseUI_closeView = m_state["BaseUI"]["closeView"];
m_lua_res.LevelMediator2_ON_RETRACKING = m_state["LevelMediator2"]["ON_RETRACKING"];
SPDLOG_INFO("Load lua functions");
m_original.GetBattleCheckResult = m_state["GetBattleCheckResult"];
@@ -772,11 +783,29 @@ void Cracker::load_lua_resources() {
m_original.ContinuousOperationRuntimeData_ConsumeBattleTime = m_state["ContinuousOperationRuntimeData"]["ConsumeBattleTime"];
m_original.ActivityProxy_UseContinuousTime = m_state["ActivityProxy"]["UseContinuousTime"];
m_original.LevelScene_doPlayAirStrike = m_state["LevelScene"]["doPlayAirStrike"];
m_original.LevelStageTotalRewardPanel_UpdateView = m_state["LevelStageTotalRewardPanel"]["UpdateView"];
}
void Cracker::hook_all_lua_functions() {
SPDLOG_INFO("Hook lua functions");
// auto_once_again
m_state["LevelStageTotalRewardPanel"]["UpdateView"] = [this](sol::this_state L, Lua::VariadicArgs args) {
CALLED(LevelStageTotalRewardPanel.UpdateView)
m_original.LevelStageTotalRewardPanel_UpdateView(L, args);
if (IS_ENABLED(AUTO_ONCE_AGAIN)) {
Lua::Table self = args[0];
Lua::Object chap = self["contextData"]["chapter"];
Lua::Object auto_fight_timer = m_lua_res.Timer_New(L, [this, self, chap](sol::this_state l, Lua::VariadicArgs) {
m_original.BaseUI_emit(l, self, m_lua_res.LevelMediator2_ON_RETRACKING, chap, true);
m_lua_res.BaseUI_closeView(l, self);
}, 1, 1);
m_lua_res.Timer_Start(L, auto_fight_timer);
}
};
// skip_air_strike_animation
m_state["LevelScene"]["doPlayAirStrike"] = [this](sol::this_state L, Lua::VariadicArgs args) {
CALLED(LevelScene.doPlayAirStrike)
@@ -1592,6 +1621,7 @@ Cracker::Config Cracker::get_config() {
SET_CONFIG_FLAG(SKIP_STORY),
SET_CONFIG_FLAG(INFINITE_BATTLE),
SET_CONFIG_FLAG(SKIP_AIR_STRIKE_ANIMATION),
SET_CONFIG_FLAG(AUTO_ONCE_AGAIN),
},
.globle_ship_properties = m_globle_ship_properties,
.global_speedup_rate = static_cast<int>(m_global_speedup_rate),
@@ -1606,6 +1636,12 @@ Cracker::Config Cracker::get_config() {
#define IS_CONFIG_ENABLED(n) config.flag.n
void Cracker::apply_config(Config& config) {
if(IS_CONFIG_ENABLED(AUTO_ONCE_AGAIN)) {
enable_auto_once_again();
} else {
disable_auto_once_again();
}
if(IS_CONFIG_ENABLED(SKIP_AIR_STRIKE_ANIMATION)) {
enable_skip_air_strike_animation();
} else {