add faketime
This commit is contained in:
parent
d01c6f442e
commit
22094cd23b
19
cheat-library/FakeTime.h
Normal file
19
cheat-library/FakeTime.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
namespace cheat::feature
|
||||
{
|
||||
|
||||
class FakeTime : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> 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();
|
||||
};
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\user\cheat\world\FakeTime.h" />
|
||||
<ClInclude Include="src\user\cheat\debugger.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
@ -125,6 +126,7 @@
|
||||
<Font Include="res\Ruda-ExtraBold.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\user\cheat\world\FakeTime.cpp" />
|
||||
<ClCompile Include="src\user\cheat\debugger.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">false</ExcludedFromBuild>
|
||||
|
@ -225,6 +225,9 @@
|
||||
<ClInclude Include="src\user\cheat\world\AutoCook.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\world\FakeTime.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Font Include="res\Ruda-Bold.ttf" />
|
||||
@ -408,6 +411,9 @@
|
||||
<ClCompile Include="src\user\cheat\debugger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\world\FakeTime.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\res.rc">
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <cheat/world/MobVacuum.h>
|
||||
#include <cheat/world/AutoTreeFarm.h>
|
||||
#include <cheat/world/AutoDestroy.h>
|
||||
#include <cheat/world/FakeTime.h>
|
||||
|
||||
#include <cheat/teleport/ChestTeleport.h>
|
||||
#include <cheat/teleport/MapTeleport.h>
|
||||
@ -80,6 +81,7 @@ namespace cheat
|
||||
FEAT_INST(ElementalSight),
|
||||
FEAT_INST(KillAura),
|
||||
FEAT_INST(MobVacuum),
|
||||
FEAT_INST(FakeTime),
|
||||
|
||||
FEAT_INST(ChestTeleport),
|
||||
FEAT_INST(OculiTeleport),
|
||||
|
56
cheat-library/src/user/cheat/world/FakeTime.cpp
Normal file
56
cheat-library/src/user/cheat/world/FakeTime.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "FakeTime.h"
|
||||
#include <cheat/events.h>
|
||||
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
19
cheat-library/src/user/cheat/world/FakeTime.h
Normal file
19
cheat-library/src/user/cheat/world/FakeTime.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
namespace cheat::feature
|
||||
{
|
||||
|
||||
class FakeTime : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> 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();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user