mirror of
https://github.com/SunsetMkt/Akebi-GC.git
synced 2025-09-19 20:16:01 +08:00
Support custom time
This commit is contained in:
@ -8,7 +8,9 @@ namespace cheat::feature
|
|||||||
//CNLouisLiu
|
//CNLouisLiu
|
||||||
void* LevelTimeManager = NULL;
|
void* LevelTimeManager = NULL;
|
||||||
FakeTime::FakeTime() : Feature(),
|
FakeTime::FakeTime() : Feature(),
|
||||||
NF(f_Enabled, "FakeTime", "Enabled", false)
|
NF(f_Enabled, "FakeTime", "Enabled", false),
|
||||||
|
NF(f_TimeHour, "FakeTime", "TimeHour", 12),
|
||||||
|
NF(f_TimeMinute, "FakeTime", "TimeMinute", 0)
|
||||||
{
|
{
|
||||||
HookManager::install(app::LevelTimeManager_SetInternalTimeOfDay, LevelTimeManager_SetInternalTimeOfDay_Hook);
|
HookManager::install(app::LevelTimeManager_SetInternalTimeOfDay, LevelTimeManager_SetInternalTimeOfDay_Hook);
|
||||||
|
|
||||||
@ -26,7 +28,9 @@ namespace cheat::feature
|
|||||||
}
|
}
|
||||||
void FakeTime::DrawMain()
|
void FakeTime::DrawMain()
|
||||||
{
|
{
|
||||||
ConfigWidget("Enabled", f_Enabled, "Keep the game in daylight (12 noon)");
|
ConfigWidget("Enabled", f_Enabled, "Keep game time the same");
|
||||||
|
ConfigWidget("TimeHour", f_TimeHour, 1, 0, 24);
|
||||||
|
ConfigWidget("TimeMinute", f_TimeMinute, 1, 0, 60);
|
||||||
}
|
}
|
||||||
bool FakeTime::NeedStatusDraw() const
|
bool FakeTime::NeedStatusDraw() const
|
||||||
{
|
{
|
||||||
@ -34,23 +38,30 @@ namespace cheat::feature
|
|||||||
}
|
}
|
||||||
void FakeTime::DrawStatus()
|
void FakeTime::DrawStatus()
|
||||||
{
|
{
|
||||||
ImGui::Text("FakeTime");
|
ImGui::Text("FakeTime|%d:%d", f_TimeHour.value(), f_TimeMinute.value());
|
||||||
|
}
|
||||||
|
float FakeTime::ConversionTime() {
|
||||||
|
|
||||||
|
float time = float(f_TimeHour);
|
||||||
|
float timemin = f_TimeMinute / 60;
|
||||||
|
return time + timemin;
|
||||||
}
|
}
|
||||||
void FakeTime::OnGameUpdate()
|
void FakeTime::OnGameUpdate()
|
||||||
{
|
{
|
||||||
if (LevelTimeManager != NULL&& f_Enabled) {
|
if (LevelTimeManager != NULL && f_Enabled) {
|
||||||
CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, LevelTimeManager, 12.00f, false, false, (MethodInfo*)0);
|
auto& faketime = GetInstance();
|
||||||
|
CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, LevelTimeManager, faketime.ConversionTime(), false, false, (MethodInfo*)0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void FakeTime::LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method) {
|
void FakeTime::LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method) {
|
||||||
float Hours = inHours;
|
float Hours = inHours;
|
||||||
|
auto& faketime = GetInstance();
|
||||||
if (GetInstance().f_Enabled)
|
if (faketime.f_Enabled)
|
||||||
{
|
{
|
||||||
Hours = 12.00f;
|
Hours = faketime.ConversionTime();
|
||||||
}
|
}
|
||||||
CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, __this, Hours, force, refreshEnviroTime, method);
|
CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, __this, Hours, force, refreshEnviroTime, method);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,6 +6,9 @@ namespace cheat::feature
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||||
|
config::Field<int> f_TimeHour;
|
||||||
|
config::Field<int> f_TimeMinute;
|
||||||
|
|
||||||
static FakeTime& GetInstance();
|
static FakeTime& GetInstance();
|
||||||
void OnGameUpdate();
|
void OnGameUpdate();
|
||||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||||
@ -14,6 +17,7 @@ namespace cheat::feature
|
|||||||
void DrawStatus() override;
|
void DrawStatus() override;
|
||||||
private:
|
private:
|
||||||
static void LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method);
|
static void LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method);
|
||||||
|
float ConversionTime();
|
||||||
FakeTime();
|
FakeTime();
|
||||||
};
|
};
|
||||||
}
|
}
|
Reference in New Issue
Block a user