diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj index a605bca..efbd795 100644 --- a/cheat-library/cheat-library.vcxproj +++ b/cheat-library/cheat-library.vcxproj @@ -20,6 +20,7 @@ + @@ -109,6 +110,7 @@ + diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters index 5e6915f..e0f93c9 100644 --- a/cheat-library/cheat-library.vcxproj.filters +++ b/cheat-library/cheat-library.vcxproj.filters @@ -243,6 +243,9 @@ Header Files + + Header Files + @@ -444,6 +447,9 @@ Source Files + + Source Files + diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp index 2fc8172..249b63a 100644 --- a/cheat-library/src/user/cheat/cheat.cpp +++ b/cheat-library/src/user/cheat/cheat.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,7 @@ namespace cheat FEAT_INST(NoCD), FEAT_INST(NoClip), FEAT_INST(RapidFire), + FEAT_INST(AutoRun), FEAT_INST(AutoLoot), FEAT_INST(AutoTreeFarm), diff --git a/cheat-library/src/user/cheat/player/AutoRun.cpp b/cheat-library/src/user/cheat/player/AutoRun.cpp new file mode 100644 index 0000000..cc3da23 --- /dev/null +++ b/cheat-library/src/user/cheat/player/AutoRun.cpp @@ -0,0 +1,82 @@ +#include "pch-il2cpp.h" +#include "AutoRun.h" + +#include +#include +#include +#include +#include + +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(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); + } + } +} \ No newline at end of file diff --git a/cheat-library/src/user/cheat/player/AutoRun.h b/cheat-library/src/user/cheat/player/AutoRun.h new file mode 100644 index 0000000..6943018 --- /dev/null +++ b/cheat-library/src/user/cheat/player/AutoRun.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include + + +namespace cheat::feature +{ + class AutoRun : public Feature + { + public: + config::Field> f_Enabled; + config::Field f_Speed; + + static AutoRun& GetInstance(); + + const FeatureGUIInfo& GetGUIInfo() const override; + void DrawMain() override; + + bool NeedStatusDraw() const override; + void DrawStatus() override; + + void OnGameUpdate(); + + private: + AutoRun(); + }; +} \ No newline at end of file