Added AutoRun feature
This commit is contained in:
parent
d97e2c449d
commit
a47a8e8de0
@ -20,6 +20,7 @@
|
||||
<ClInclude Include="src\user\cheat\misc\sniffer\pipe\messages\PipePacketData.h" />
|
||||
<ClInclude Include="src\user\cheat\misc\sniffer\pipe\PipeClient.h" />
|
||||
<ClInclude Include="src\user\cheat\misc\sniffer\pipe\PipeIO.h" />
|
||||
<ClInclude Include="src\user\cheat\player\AutoRun.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\TextureChanger.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\FreeCamera.h" />
|
||||
<ClInclude Include="src\user\cheat\world\AutoSeelie.h" />
|
||||
@ -110,6 +111,7 @@
|
||||
<ClCompile Include="src\user\cheat\misc\sniffer\pipe\messages\PipePacketData.cpp" />
|
||||
<ClCompile Include="src\user\cheat\misc\sniffer\pipe\PipeClient.cpp" />
|
||||
<ClCompile Include="src\user\cheat\misc\sniffer\pipe\PipeIO.cpp" />
|
||||
<ClCompile Include="src\user\cheat\player\AutoRun.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\TextureChanger.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\FreeCamera.cpp" />
|
||||
<ClCompile Include="src\user\cheat\world\AutoSeelie.cpp" />
|
||||
|
@ -246,6 +246,9 @@
|
||||
<ClInclude Include="src\user\cheat\visuals\FreeCamera.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\player\AutoRun.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Font Include="res\Ruda-Bold.ttf" />
|
||||
@ -450,6 +453,9 @@
|
||||
<ClCompile Include="src\user\cheat\visuals\FreeCamera.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\player\AutoRun.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\res.rc">
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <cheat/player/NoCD.h>
|
||||
#include <cheat/player/NoClip.h>
|
||||
#include <cheat/player/RapidFire.h>
|
||||
#include <cheat/player/AutoRun.h>
|
||||
|
||||
#include <cheat/world/AutoLoot.h>
|
||||
#include <cheat/world/DialogSkip.h>
|
||||
@ -82,6 +83,7 @@ namespace cheat
|
||||
FEAT_INST(NoCD),
|
||||
FEAT_INST(NoClip),
|
||||
FEAT_INST(RapidFire),
|
||||
FEAT_INST(AutoRun),
|
||||
|
||||
FEAT_INST(AutoLoot),
|
||||
FEAT_INST(AutoTreeFarm),
|
||||
|
93
cheat-library/src/user/cheat/player/AutoRun.cpp
Normal file
93
cheat-library/src/user/cheat/player/AutoRun.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "AutoRun.h"
|
||||
|
||||
#include <helpers.h>
|
||||
#include <cheat/events.h>
|
||||
#include <cheat/game/EntityManager.h>
|
||||
#include <cheat/game/util.h>
|
||||
#include <cheat-base/render/renderer.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
//bool isAutoRunEnabled = false;
|
||||
|
||||
AutoRun::AutoRun() : Feature(),
|
||||
NF(f_Enabled, "Auto Run", "Player::AutoRun", false),
|
||||
NF(f_Speed, "Speed", "Player::AutoRun",1.0f),
|
||||
NF(f_CameraRelative, "Relative to camera", "Player::AutoRun" , false)
|
||||
{
|
||||
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoRun::OnGameUpdate);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& AutoRun::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "Auto Run", "Player", true };
|
||||
return info;
|
||||
}
|
||||
|
||||
void AutoRun::DrawMain()
|
||||
{
|
||||
ConfigWidget("Enable", f_Enabled);
|
||||
ConfigWidget("Auto Run speed", f_Speed, 0.01f, 0.01f, 1000.0f, "Speed of character \n Not recommended going above 5");
|
||||
ConfigWidget("Movement relative to camera", f_CameraRelative);
|
||||
}
|
||||
|
||||
bool AutoRun::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled;
|
||||
}
|
||||
void AutoRun::DrawStatus()
|
||||
{
|
||||
ImGui::Text("Auto Run[%.01f]",f_Speed.value());
|
||||
}
|
||||
|
||||
AutoRun& AutoRun::GetInstance()
|
||||
{
|
||||
static AutoRun instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void enableAutoRun(float speed, bool cameraRelative) {
|
||||
|
||||
auto& manager = game::EntityManager::instance();
|
||||
auto avatarEntity = manager.avatar();
|
||||
|
||||
auto baseMove = avatarEntity->moveComponent();
|
||||
auto rigidBody = avatarEntity->rigidbody();
|
||||
|
||||
app::Rigidbody_set_detectCollisions(rigidBody, true, nullptr);
|
||||
|
||||
auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera()));
|
||||
auto relativeEntity = cameraRelative ? &cameraEntity : avatarEntity;
|
||||
|
||||
if (baseMove == nullptr)
|
||||
return;
|
||||
|
||||
if (rigidBody == nullptr)
|
||||
return;
|
||||
|
||||
if (renderer::IsInputLocked())
|
||||
return;
|
||||
|
||||
app::Vector3 dir = {};
|
||||
dir = dir + relativeEntity->forward();
|
||||
|
||||
app::Vector3 prevPos = avatarEntity->relativePosition();
|
||||
if (IsVectorZero(prevPos))
|
||||
return;
|
||||
|
||||
float deltaTime = app::Time_get_deltaTime(nullptr);
|
||||
|
||||
app::Vector3 newPos = prevPos + dir * speed * deltaTime;
|
||||
|
||||
avatarEntity->setRelativePosition(newPos);
|
||||
}
|
||||
|
||||
void AutoRun::OnGameUpdate() {
|
||||
if (f_Enabled) {
|
||||
float speed = f_Speed.value();
|
||||
bool cameraRelative = f_CameraRelative.value();
|
||||
enableAutoRun(speed, cameraRelative);
|
||||
}
|
||||
}
|
||||
}
|
28
cheat-library/src/user/cheat/player/AutoRun.h
Normal file
28
cheat-library/src/user/cheat/player/AutoRun.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include <cheat-base/cheat/Feature.h>
|
||||
#include <cheat-base/config/config.h>
|
||||
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
class AutoRun : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||
config::Field<float> f_Speed;
|
||||
config::Field<bool> f_CameraRelative;
|
||||
|
||||
static AutoRun& GetInstance();
|
||||
|
||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||
void DrawMain() override;
|
||||
|
||||
bool NeedStatusDraw() const override;
|
||||
void DrawStatus() override;
|
||||
|
||||
void OnGameUpdate();
|
||||
|
||||
private:
|
||||
AutoRun();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user