diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj index 3a0ada0..f4dabce 100644 --- a/cheat-library/cheat-library.vcxproj +++ b/cheat-library/cheat-library.vcxproj @@ -15,6 +15,7 @@ + false false @@ -131,6 +132,7 @@ + false false diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters index 5a33a27..f392dec 100644 --- a/cheat-library/cheat-library.vcxproj.filters +++ b/cheat-library/cheat-library.vcxproj.filters @@ -225,6 +225,9 @@ Header Files + + Header Files + Header Files @@ -426,6 +429,9 @@ Source Files + + Source Files + Source Files diff --git a/cheat-library/src/appdata/il2cpp-functions.h b/cheat-library/src/appdata/il2cpp-functions.h index 848eeee..acd5423 100644 --- a/cheat-library/src/appdata/il2cpp-functions.h +++ b/cheat-library/src/appdata/il2cpp-functions.h @@ -319,6 +319,9 @@ DO_APP_FUNC(0x06552F50, Rect, RectTransform_get_rect, (RectTransform* __this, Me DO_APP_FUNC(0x06677BD0, float, Canvas_get_scaleFactor, (/*Canvas**/void* __this, MethodInfo* method)); +DO_APP_FUNC(0x00935700, void, LevelTimeManager_SetInternalTimeOfDay, (/*LevelTimeManager**/void* __this, float inHours, bool force, bool refreshEnviroTime, MethodInfo* method)); + + // Singletons DO_APP_FUNC(0x05189A90, void*, Singleton_GetInstance, (MethodInfo* method)); DO_APP_FUNC_METHODINFO(0x096EA3B0, Singleton_1_MoleMole_MapModule__get_Instance__MethodInfo); diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp index f9625dc..3aaa9f8 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 @@ -86,6 +87,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..3009c0f --- /dev/null +++ b/cheat-library/src/user/cheat/world/FakeTime.cpp @@ -0,0 +1,67 @@ +#include "pch-il2cpp.h" +#include "FakeTime.h" +#include + + +namespace cheat::feature +{ + //CNLouisLiu + void* LevelTimeManager = NULL; + FakeTime::FakeTime() : Feature(), + 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); + + 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 game time the same"); + ConfigWidget("TimeHour", f_TimeHour, 1, 0, 24); + ConfigWidget("TimeMinute", f_TimeMinute, 1, 0, 60); + } + bool FakeTime::NeedStatusDraw() const + { + return f_Enabled; + } + void FakeTime::DrawStatus() + { + 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() + { + if (LevelTimeManager != NULL && f_Enabled) { + 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) { + float Hours = inHours; + auto& faketime = GetInstance(); + if (faketime.f_Enabled) + { + Hours = faketime.ConversionTime(); + } + 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..8f0a31a --- /dev/null +++ b/cheat-library/src/user/cheat/world/FakeTime.h @@ -0,0 +1,23 @@ +#pragma once +namespace cheat::feature +{ + + class FakeTime : public Feature + { + public: + config::Field> f_Enabled; + config::Field f_TimeHour; + config::Field f_TimeMinute; + + 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); + float ConversionTime(); + FakeTime(); + }; +} \ No newline at end of file