mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 12:59:25 +08:00
add: skip story
This commit is contained in:
@@ -252,6 +252,7 @@ void Cracker::disable_all() {
|
||||
disable_chapter_auto_next_battle();
|
||||
disable_chapter_auto_ambush();
|
||||
disable_chapter_auto_clear();
|
||||
disable_skip_story();
|
||||
}
|
||||
|
||||
void Cracker::enable_hooked_lua_function_trace() {
|
||||
@@ -262,6 +263,14 @@ void Cracker::disable_hooked_lua_function_trace() {
|
||||
DISABLE(HOOKED_LUA_FUNCTION_TRACE);
|
||||
}
|
||||
|
||||
void Cracker::enable_skip_story() {
|
||||
ENABLE(SKIP_STORY);
|
||||
}
|
||||
|
||||
void Cracker::disable_skip_story() {
|
||||
DISABLE(SKIP_STORY);
|
||||
}
|
||||
|
||||
void Cracker::enable_chapter_auto_clear() {
|
||||
ENABLE(CHAPTER_AUTO_CLEAR);
|
||||
}
|
||||
@@ -635,11 +644,23 @@ void Cracker::load_lua_resources() {
|
||||
m_original.Chapter_writeBack = m_state["Chapter"]["writeBack"];
|
||||
m_original.LevelStageView_tryAutoTrigger = m_state["LevelStageView"]["tryAutoTrigger"];
|
||||
m_original.LevelStageView_TryAutoFight = m_state["LevelStageView"]["TryAutoFight"];
|
||||
m_original.Story_Ctor = m_state["Story"]["Ctor"];
|
||||
}
|
||||
|
||||
void Cracker::hook_all_lua_functions() {
|
||||
SPDLOG_INFO("Hook lua functions");
|
||||
|
||||
// skip_story
|
||||
m_state["Story"]["Ctor"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(Story.Ctor);
|
||||
m_original.Story_Ctor(L, args);
|
||||
if (IS_ENABLED(SKIP_STORY)) {
|
||||
Lua::Table self = args[0];
|
||||
self["skipAll"] = true;
|
||||
self["isAuto"] = false;
|
||||
}
|
||||
};
|
||||
|
||||
// chapter_auto_clear
|
||||
m_state["LevelStageView"]["TryAutoFight"] = [this](sol::this_state L, Lua::VariadicArgs args) {
|
||||
CALLED(LevelStageView.TryAutoFight);
|
||||
@@ -1374,6 +1395,7 @@ Cracker::Config Cracker::get_config() {
|
||||
SET_CONFIG_FLAG(CHAPTER_AUTO_NEXT_BATTLE),
|
||||
SET_CONFIG_FLAG(CHAPTER_AUTO_AMBUSH),
|
||||
SET_CONFIG_FLAG(CHAPTER_AUTO_CLEAR),
|
||||
SET_CONFIG_FLAG(SKIP_STORY),
|
||||
},
|
||||
.globle_ship_properties = m_globle_ship_properties,
|
||||
.global_speedup_rate = static_cast<int>(m_global_speedup_rate),
|
||||
@@ -1393,6 +1415,12 @@ void Cracker::apply_config(Config& config) {
|
||||
disable_hooked_lua_function_trace();
|
||||
}
|
||||
|
||||
if(IS_CONFIG_ENABLED(SKIP_STORY)) {
|
||||
enable_skip_story();
|
||||
} else {
|
||||
disable_skip_story();
|
||||
}
|
||||
|
||||
if(IS_CONFIG_ENABLED(CHAPTER_AUTO_CLEAR)) {
|
||||
enable_chapter_auto_clear();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user