1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-21 15:49:30 +08:00

fix: hook WorldConst.GetTerrainMoveStepDuration to control opsi fast move

This commit is contained in:
0O0o0oOoO00
2025-06-08 12:23:55 +08:00
parent 7cef54d350
commit 8913d3294d
2 changed files with 11 additions and 8 deletions

View File

@@ -275,12 +275,10 @@ void Cracker::update_gg_factor(double factor) {
}
void Cracker::enable_opsi_fast_move() {
m_state["WorldConst"]["BaseMoveDuration"] = 0.0;
ENABLE(OPSI_FAST_MOVE);
}
void Cracker::disable_opsi_fast_move() {
m_state["WorldConst"]["BaseMoveDuration"] = 0.35;
DISABLE(OPSI_FAST_MOVE);
}
@@ -427,6 +425,7 @@ void Cracker::load_lua_resources() {
m_original.Ship_getShipProperties = m_state["Ship"]["getShipProperties"];
m_original.ys_Battle_BattleGateGuild_GeneralPackage = m_state["ys"]["Battle"]["BattleGateGuild"]["GeneralPackage"];
m_original.ys_Battle_BattleDataFunction_GetBuffTemplate = m_state["ys"]["Battle"]["BattleDataFunction"]["GetBuffTemplate"];
m_original.WorldConst_GetTerrainMoveStepDuration = m_state["WorldConst"]["GetTerrainMoveStepDuration"];
}
void Cracker::hook_all_lua_functions() {
@@ -703,6 +702,14 @@ void Cracker::hook_all_lua_functions() {
}
return m_original.ys_Battle_BattleDataFunction_GetBuffTemplate(L, args);
};
m_state["WorldConst"]["GetTerrainMoveStepDuration"] = [this](sol::this_state L, Lua::VariadicArgs args) -> Lua::Object {
CALLED(WorldConst.GetTerrainMoveStepDuration);
if (!IS_ENABLED(OPSI_FAST_MOVE)) {
return m_original.WorldConst_GetTerrainMoveStepDuration(L, args);
}
return sol::make_object(L, 0);
};
}
#define SET_SHIP_PROPERTIES_VALUE(f) v[#f]["value"] = m_globle_ship_properties.f
@@ -771,18 +778,13 @@ void Cracker::apply_config(Config& config) {
APPLY_ATOMIC_CONFIG(flag.GLOBAL_SPEEDUP);
APPLY_ATOMIC_CONFIG(flag.EXERCISE_GOD_MOD);
APPLY_ATOMIC_CONFIG(flag.EXERCISE_MORE_POWER);
APPLY_ATOMIC_CONFIG(flag.OPSI_FAST_MOVE);
APPLY_CONFIG(globle_ship_properties);
APPLY_ATOMIC_CONFIG(global_speedup_rate);
APPLY_CONFIG(gg_factor);
APPLY_ATOMIC_CONFIG(exercise_more_power_rate);
if (config.flag.OPSI_FAST_MOVE) {
enable_opsi_fast_move();
} else {
disable_opsi_fast_move();
}
if (config.flag.FAST_STAGE_MOVE_CRACK) {
enable_fast_stage_move();
} else {

View File

@@ -207,6 +207,7 @@ private:
Lua::Function FinishStageCommand_GeneralPackage;
Lua::Function ys_Battle_BattleGateGuild_GeneralPackage;
Lua::Function ys_Battle_BattleDataFunction_GetBuffTemplate;
Lua::Function WorldConst_GetTerrainMoveStepDuration;
} m_original;
struct {
Lua::Function Ship_getIntimacyLevel;