diff --git a/cheat-library/FakeTime.h b/cheat-library/FakeTime.h new file mode 100644 index 0000000..d255681 --- /dev/null +++ b/cheat-library/FakeTime.h @@ -0,0 +1,19 @@ +#pragma once +namespace cheat::feature +{ + + class FakeTime : public Feature + { + public: + config::Field> f_Enabled; + static FakeTime& GetInstance(); + const FeatureGUIInfo& GetGUIInfo() const override; + void DrawMain() override; + virtual bool NeedStatusDraw() const override; + void DrawStatus() override; + void OnGameUpdate(); + private: + static void LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method); + FakeTime(); + }; +} \ No newline at end of file diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj index 2e06492..4e5dd82 100644 --- a/cheat-library/cheat-library.vcxproj +++ b/cheat-library/cheat-library.vcxproj @@ -15,6 +15,7 @@ + false false @@ -125,6 +126,7 @@ + false false diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters index e63930a..54eb76c 100644 --- a/cheat-library/cheat-library.vcxproj.filters +++ b/cheat-library/cheat-library.vcxproj.filters @@ -225,6 +225,9 @@ Header Files + + Header Files + @@ -408,6 +411,9 @@ Source Files + + Source Files + diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp index 85afd9e..a22ef97 100644 --- a/cheat-library/src/user/cheat/cheat.cpp +++ b/cheat-library/src/user/cheat/cheat.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,7 @@ namespace cheat FEAT_INST(ElementalSight), FEAT_INST(KillAura), FEAT_INST(MobVacuum), + FEAT_INST(FakeTime), FEAT_INST(ChestTeleport), FEAT_INST(OculiTeleport), diff --git a/cheat-library/src/user/cheat/world/FakeTime.cpp b/cheat-library/src/user/cheat/world/FakeTime.cpp new file mode 100644 index 0000000..a72d17e --- /dev/null +++ b/cheat-library/src/user/cheat/world/FakeTime.cpp @@ -0,0 +1,56 @@ +#include "pch-il2cpp.h" +#include "FakeTime.h" +#include + + +namespace cheat::feature +{ + //CNLouisLiu + void* LevelTimeManager = NULL; + FakeTime::FakeTime() : Feature(), + NF(f_Enabled, "FakeTime", "Enabled", false) + { + HookManager::install(app::LevelTimeManager_SetInternalTimeOfDay, LevelTimeManager_SetInternalTimeOfDay_Hook); + + events::GameUpdateEvent += MY_METHOD_HANDLER(FakeTime::OnGameUpdate); + } + FakeTime& FakeTime::GetInstance() + { + static FakeTime instance; + return instance; + } + const FeatureGUIInfo& FakeTime::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "FakeTime", "World", true }; + return info; + } + void FakeTime::DrawMain() + { + ConfigWidget("Enabled", f_Enabled, "Keep the game in daylight (12 noon)"); + } + bool FakeTime::NeedStatusDraw() const + { + return f_Enabled; + } + void FakeTime::DrawStatus() + { + ImGui::Text("FakeTime"); + } + void FakeTime::OnGameUpdate() + { + if (LevelTimeManager != NULL&& f_Enabled) { + CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, LevelTimeManager, 12.00f, false, false, (MethodInfo*)0); + } + } + void FakeTime::LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method) { + float Hours = inHours; + + if (GetInstance().f_Enabled) + { + Hours = 12.00f; + } + CALL_ORIGIN(LevelTimeManager_SetInternalTimeOfDay_Hook, __this, Hours, force, refreshEnviroTime, method); + + } + +} \ No newline at end of file diff --git a/cheat-library/src/user/cheat/world/FakeTime.h b/cheat-library/src/user/cheat/world/FakeTime.h new file mode 100644 index 0000000..947faad --- /dev/null +++ b/cheat-library/src/user/cheat/world/FakeTime.h @@ -0,0 +1,19 @@ +#pragma once +namespace cheat::feature +{ + + class FakeTime : public Feature + { + public: + config::Field> f_Enabled; + static FakeTime& GetInstance(); + void OnGameUpdate(); + const FeatureGUIInfo& GetGUIInfo() const override; + void DrawMain() override; + virtual bool NeedStatusDraw() const override; + void DrawStatus() override; + private: + static void LevelTimeManager_SetInternalTimeOfDay_Hook(void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method); + FakeTime(); + }; +} \ No newline at end of file