1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 15:39:26 +08:00

fix: hook ys.Battle.BattleGateGuild.GeneralPackage

This commit is contained in:
0O0o0oOoO00
2025-06-05 18:51:56 +08:00
parent de575966b9
commit ebb7b35932
2 changed files with 17 additions and 6 deletions

View File

@@ -403,6 +403,7 @@ void Cracker::load_lua_resources() {
m_original.BossSingleBattleFleetSelectSubPanel_CheckValid = m_state["BossSingleBattleFleetSelectSubPanel"]["CheckValid"];
m_original.Chapter_IsEliteFleetLegal = m_state["Chapter"]["IsEliteFleetLegal"];
m_original.Ship_getShipProperties = m_state["Ship"]["getShipProperties"];
m_original.ys_Battle_BattleGateGuild_GeneralPackage = m_state["ys"]["Battle"]["BattleGateGuild"]["GeneralPackage"];
}
void Cracker::hook_all_lua_functions() {
@@ -413,13 +414,22 @@ void Cracker::hook_all_lua_functions() {
return m_original.GetBattleCheckResult(L, args);
}
if (args.size() >= 3) {
double total_time = args[2];
std::vector<Lua::Object> new_args(args.begin(), args.end());
new_args[2] = sol::make_object(L, total_time / m_global_speedup_rate.load());
return m_original.GetBattleCheckResult(sol::as_args(new_args));
double total_time = args[2];
std::vector<Lua::Object> new_args(args.begin(), args.end());
new_args[2] = sol::make_object(L, total_time / m_global_speedup_rate.load());
return m_original.GetBattleCheckResult(L, sol::as_args(new_args));
};
m_state["ys"]["Battle"]["BattleGateGuild"]["GeneralPackage"] = [this](sol::this_state L, Lua::VariadicArgs args) -> Lua::Table {
CALLED(BattleGateGuild.GeneralPackage);
if (!IS_ENABLED(GLOBAL_SPEEDUP)) {
return m_original.ys_Battle_BattleGateGuild_GeneralPackage(L, args);
}
return m_original.GetBattleCheckResult(L, args);
Lua::Table ret = m_original.ys_Battle_BattleGateGuild_GeneralPackage(args);
double total_time = ret["total_time"];
ret["total_time"] = total_time / m_global_speedup_rate.load();
return ret;
};
m_state["FinishStageCommand"]["GeneralPackage"] = [this](sol::this_state L, Lua::VariadicArgs args) -> Lua::Table {

View File

@@ -193,6 +193,7 @@ private:
Lua::Function Ship_intimacyAdditions;
Lua::Function GetBattleCheckResult;
Lua::Function FinishStageCommand_GeneralPackage;
Lua::Function ys_Battle_BattleGateGuild_GeneralPackage;
} m_original;
struct {
Lua::Function Ship_getIntimacyLevel;