mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 08: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 {
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
bool CHAPTER_AUTO_NEXT_BATTLE = false;
|
||||
bool CHAPTER_AUTO_AMBUSH = false;
|
||||
bool CHAPTER_AUTO_CLEAR = false;
|
||||
bool SKIP_STORY = false;
|
||||
} flag;
|
||||
ShipProperties globle_ship_properties;
|
||||
int global_speedup_rate = 1;
|
||||
@@ -134,6 +135,9 @@ public:
|
||||
void enable_hooked_lua_function_trace();
|
||||
void disable_hooked_lua_function_trace();
|
||||
|
||||
void enable_skip_story();
|
||||
void disable_skip_story();
|
||||
|
||||
void enable_chapter_auto_clear();
|
||||
void disable_chapter_auto_clear();
|
||||
|
||||
@@ -280,6 +284,7 @@ private:
|
||||
std::atomic<bool> CHAPTER_AUTO_NEXT_BATTLE = false;
|
||||
std::atomic<bool> CHAPTER_AUTO_AMBUSH = false;
|
||||
std::atomic<bool> CHAPTER_AUTO_CLEAR = false;
|
||||
std::atomic<bool> SKIP_STORY = false;
|
||||
} m_flag;
|
||||
|
||||
struct {
|
||||
@@ -326,6 +331,7 @@ private:
|
||||
Lua::Function Chapter_writeBack;
|
||||
Lua::Function LevelStageView_tryAutoTrigger;
|
||||
Lua::Function LevelStageView_TryAutoFight;
|
||||
Lua::Function Story_Ctor;
|
||||
} m_original;
|
||||
struct {
|
||||
Lua::Function Clone;
|
||||
|
||||
@@ -1026,6 +1026,28 @@ CrackerServer::CrackerServer() {
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/enable_skip_story", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().enable_skip_story();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Enable skip story failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/disable_skip_story", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance().disable_skip_story();
|
||||
} catch (std::exception& e) {
|
||||
SPDLOG_ERROR("Disable skip story failed: {}", e.what());
|
||||
res.status = 500;
|
||||
return;
|
||||
}
|
||||
CRACK_OK();
|
||||
});
|
||||
|
||||
Post("/init", [](const httplib::Request& req, httplib::Response& res) {
|
||||
try {
|
||||
Cracker::Instance();
|
||||
|
||||
@@ -106,6 +106,7 @@ void CrackerUI::draw_menu() {
|
||||
ImGui::Checkbox("章节图跳过战前准备", &CONFIG_FLAG(CHAPTER_SKIP_PRECOMBAT));
|
||||
ImGui::Checkbox("演习锁血", &CONFIG_FLAG(EXERCISE_GOD_MOD));
|
||||
ImGui::Checkbox("自动规避伏击", &CONFIG_FLAG(CHAPTER_AUTO_AMBUSH));
|
||||
ImGui::Checkbox("跳过剧情", &CONFIG_FLAG(SKIP_STORY));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Checkbox("移除困难图属性限制", &CONFIG_FLAG(REMOVE_HARD_MODE_SHIP_PROPERTIES_LIMIT));
|
||||
|
||||
@@ -215,6 +215,12 @@ POST http://{{Host}}:{{Port}}/enable_chapter_auto_clear
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_chapter_auto_clear
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/enable_skip_story
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/disable_skip_story
|
||||
|
||||
###
|
||||
POST http://{{Host}}:{{Port}}/is_alive
|
||||
|
||||
|
||||
@@ -227,7 +227,8 @@
|
||||
"ChapterSkipPrecombat": false,
|
||||
"ChapterAutoNextBattle": false,
|
||||
"ChapterAutoAmbush": false,
|
||||
"ChapterAutoClear": false
|
||||
"ChapterAutoClear": false,
|
||||
"SkipStory": false
|
||||
},
|
||||
"ShipProperty": {
|
||||
"Method": "disable",
|
||||
|
||||
@@ -905,6 +905,10 @@
|
||||
"ChapterAutoClear": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
},
|
||||
"SkipStory": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"ShipProperty": {
|
||||
|
||||
@@ -893,6 +893,7 @@ Misc:
|
||||
ChapterAutoNextBattle: false
|
||||
ChapterAutoAmbush: false
|
||||
ChapterAutoClear: false
|
||||
SkipStory: false
|
||||
|
||||
# ==================== Cheat ====================
|
||||
PowerLimit:
|
||||
|
||||
@@ -548,6 +548,7 @@ class GeneratedConfig:
|
||||
Misc_ChapterAutoNextBattle = False
|
||||
Misc_ChapterAutoAmbush = False
|
||||
Misc_ChapterAutoClear = False
|
||||
Misc_SkipStory = False
|
||||
|
||||
# Group `PowerLimit`
|
||||
PowerLimit_Enable = True
|
||||
|
||||
@@ -161,6 +161,7 @@ class FullGeneratedConfig:
|
||||
Hook_Misc_ChapterAutoNextBattle = None
|
||||
Hook_Misc_ChapterAutoAmbush = None
|
||||
Hook_Misc_ChapterAutoClear = None
|
||||
Hook_Misc_SkipStory = None
|
||||
Hook_ShipProperty_Method = None
|
||||
Hook_ShipProperty_Factor = None
|
||||
Hook_ShipProperty_Armor = None
|
||||
|
||||
@@ -3152,6 +3152,10 @@
|
||||
"ChapterAutoClear": {
|
||||
"name": "Misc.ChapterAutoClear.name",
|
||||
"help": "Misc.ChapterAutoClear.help"
|
||||
},
|
||||
"SkipStory": {
|
||||
"name": "Misc.SkipStory.name",
|
||||
"help": "Misc.SkipStory.help"
|
||||
}
|
||||
},
|
||||
"PowerLimit": {
|
||||
|
||||
@@ -3152,6 +3152,10 @@
|
||||
"ChapterAutoClear": {
|
||||
"name": "Misc.ChapterAutoClear.name",
|
||||
"help": "Misc.ChapterAutoClear.help"
|
||||
},
|
||||
"SkipStory": {
|
||||
"name": "Misc.SkipStory.name",
|
||||
"help": "Misc.SkipStory.help"
|
||||
}
|
||||
},
|
||||
"PowerLimit": {
|
||||
|
||||
@@ -3152,6 +3152,10 @@
|
||||
"ChapterAutoClear": {
|
||||
"name": "章节图自动开荒",
|
||||
"help": ""
|
||||
},
|
||||
"SkipStory": {
|
||||
"name": "跳过剧情",
|
||||
"help": ""
|
||||
}
|
||||
},
|
||||
"PowerLimit": {
|
||||
|
||||
@@ -3152,6 +3152,10 @@
|
||||
"ChapterAutoClear": {
|
||||
"name": "Misc.ChapterAutoClear.name",
|
||||
"help": "Misc.ChapterAutoClear.help"
|
||||
},
|
||||
"SkipStory": {
|
||||
"name": "Misc.SkipStory.name",
|
||||
"help": "Misc.SkipStory.help"
|
||||
}
|
||||
},
|
||||
"PowerLimit": {
|
||||
|
||||
@@ -361,3 +361,9 @@ class CrackApi:
|
||||
|
||||
def disable_chapter_auto_clear(self):
|
||||
self.post("disable_chapter_auto_clear")
|
||||
|
||||
def enable_skip_story(self):
|
||||
self.post("enable_skip_story")
|
||||
|
||||
def disable_skip_story(self):
|
||||
self.post("disable_skip_story")
|
||||
|
||||
@@ -44,6 +44,7 @@ ALL_ENABLE_OPS = [
|
||||
CrackOp.EnableChapterAutoNextBattle,
|
||||
CrackOp.EnableChapterAutoAmbush,
|
||||
CrackOp.EnableChapterAutoClear,
|
||||
CrackOp.EnableSkipStory,
|
||||
]
|
||||
|
||||
REMOTE_PORT = 23897
|
||||
@@ -288,6 +289,11 @@ def do_crack_op(config: AzurLaneConfig, device: Device, ops: Union[Type[CrackOp.
|
||||
api.enable_chapter_auto_clear()
|
||||
elif op == CrackOp.DisableChapterAutoClear:
|
||||
api.disable_chapter_auto_clear()
|
||||
elif op == CrackOp.EnableSkipStory:
|
||||
if full_config.Hook_Misc_SkipStory:
|
||||
api.enable_skip_story()
|
||||
elif op == CrackOp.DisableSkipStory:
|
||||
api.disable_skip_story()
|
||||
else:
|
||||
logger.error(f"Unsupported op: {op}")
|
||||
|
||||
@@ -345,6 +351,7 @@ CHAPTER_CRACK_OPS = [
|
||||
CrackOp.EnableChapterAutoNextBattle,
|
||||
CrackOp.EnableChapterAutoAmbush,
|
||||
CrackOp.EnableChapterAutoClear,
|
||||
CrackOp.EnableSkipStory,
|
||||
]
|
||||
|
||||
|
||||
@@ -373,6 +380,7 @@ OPSI_CRACK_OPS = [
|
||||
CrackOp.EnableOpsiForceAuto,
|
||||
CrackOp.EnableOpsiNoMapFog,
|
||||
CrackOp.EnableSkipShipGainShow,
|
||||
CrackOp.EnableSkipStory,
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -172,3 +172,9 @@ class CrackOp:
|
||||
|
||||
class DisableChapterAutoClear(Op):
|
||||
...
|
||||
|
||||
class EnableSkipStory(Op):
|
||||
...
|
||||
|
||||
class DisableSkipStory(Op):
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user