Merge branch 'pr/237'

This commit is contained in:
Callow 2022-07-13 11:25:28 +03:00
commit e84c00a60a
5 changed files with 119 additions and 0 deletions

View File

@ -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" />
@ -109,6 +110,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" />

View File

@ -243,6 +243,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" />
@ -444,6 +447,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">

View File

@ -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>
@ -81,6 +82,7 @@ namespace cheat
FEAT_INST(NoCD),
FEAT_INST(NoClip),
FEAT_INST(RapidFire),
FEAT_INST(AutoRun),
FEAT_INST(AutoLoot),
FEAT_INST(AutoTreeFarm),

View File

@ -0,0 +1,82 @@
#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
{
AutoRun::AutoRun() : Feature(),
NF(f_Enabled, "Auto Run", "Player::AutoRun", false),
NF(f_Speed, "Speed", "Player::AutoRun",1.0f)
{
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");
}
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) {
auto& manager = game::EntityManager::instance();
auto avatarEntity = manager.avatar();
auto baseMove = avatarEntity->moveComponent();
auto rigidBody = avatarEntity->rigidbody();
if (baseMove == nullptr)
return;
if (rigidBody == nullptr)
return;
if (renderer::IsInputLocked())
return;
auto cameraEntity = game::Entity(reinterpret_cast<app::BaseEntity*>(manager.mainCamera()));
auto relativeEntity = &cameraEntity;
app::Vector3 dir = relativeEntity->forward();
app::Vector3 prevPos = avatarEntity->relativePosition();
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();
enableAutoRun(speed);
}
}
}

View File

@ -0,0 +1,27 @@
#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;
static AutoRun& GetInstance();
const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override;
bool NeedStatusDraw() const override;
void DrawStatus() override;
void OnGameUpdate();
private:
AutoRun();
};
}