mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 14:19: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();
|
||||
|
||||
Reference in New Issue
Block a user