Auto Follow Paimon

Auto Follow Paimon
This commit is contained in:
RyujinZX
2022-06-10 15:36:14 +03:00
parent 50d1cec7f0
commit 2328cbaf9b
6 changed files with 117 additions and 2 deletions

View File

@ -53,6 +53,7 @@
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h" />
<ClInclude Include="src\user\cheat\visuals\FPSUnlock.h" />
<ClInclude Include="src\user\cheat\visuals\NoFog.h" />
<ClInclude Include="src\user\cheat\visuals\PaimonFollow.h" />
<ClInclude Include="src\user\cheat\visuals\ProfileChanger.h" />
<ClInclude Include="src\user\cheat\visuals\ShowChestIndicator.h" />
<ClInclude Include="src\user\cheat\world\AutoCook.h" />
@ -164,6 +165,7 @@
<ClCompile Include="src\user\cheat\visuals\CameraZoom.cpp" />
<ClCompile Include="src\user\cheat\visuals\FPSUnlock.cpp" />
<ClCompile Include="src\user\cheat\visuals\NoFog.cpp" />
<ClCompile Include="src\user\cheat\visuals\PaimonFollow.cpp" />
<ClCompile Include="src\user\cheat\visuals\ProfileChanger.cpp" />
<ClCompile Include="src\user\cheat\visuals\ShowChestIndicator.cpp" />
<ClCompile Include="src\user\cheat\world\AutoCook.cpp" />

View File

@ -228,6 +228,9 @@
<ClInclude Include="src\user\cheat\visuals\ProfileChanger.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\user\cheat\visuals\PaimonFollow.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Font Include="res\Ruda-Bold.ttf" />
@ -414,6 +417,9 @@
<ClCompile Include="src\user\cheat\visuals\ProfileChanger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\user\cheat\visuals\PaimonFollow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\res.rc">

View File

@ -157,6 +157,8 @@ DO_APP_FUNC(0x016A77B0, void, ProfileEditPage, (MonoFriendInformationDialog* __t
// Game Object Utility
DO_APP_FUNC(0x0662F130, GameObject*, GameObject_Find, (String* name, MethodInfo* method));
DO_APP_FUNC(0x0662F190, Component_1*, GameObject_GetComponentByName, (GameObject* __this, String* type, MethodInfo* method));
DO_APP_FUNC(0x0662F660, bool, GameObject_get_active, (GameObject* __this, MethodInfo* method));
DO_APP_FUNC(0x0662F720, void, GameObject_set_active, (GameObject* __this, bool value, MethodInfo* method));
// Utility
DO_APP_FUNC(0x06568060, void, Text_set_text, (Text* __this, String* value, MethodInfo* method));

View File

@ -43,6 +43,7 @@
#include <cheat/visuals/CameraZoom.h>
#include <cheat/visuals/ShowChestIndicator.h>
#include <cheat/visuals/ProfileChanger.h>
#include <cheat/visuals/PaimonFollow.h>
#include "GenshinCM.h"
@ -97,8 +98,9 @@ namespace cheat
FEAT_INST(FPSUnlock),
FEAT_INST(CameraZoom),
FEAT_INST(ChestIndicator),
FEAT_INST(ProfileChanger)
FEAT_INST(ProfileChanger),
FEAT_INST(PaimonFollow)
});
#undef FEAT_INST

View File

@ -0,0 +1,77 @@
#include "pch-il2cpp.h"
#include "PaimonFollow.h"
#include <helpers.h>
#include <cheat/events.h>
namespace cheat::feature
{
namespace GameObject {
app::GameObject* Paimon = nullptr;
app::GameObject* ProfileLayer = nullptr;
}
PaimonFollow::PaimonFollow() : Feature(),
NF(f_Enabled, "Paimon Follow", "Visuals", false),
toBeUpdate(), nextUpdate(0)
{
events::GameUpdateEvent += MY_METHOD_HANDLER(PaimonFollow::OnGameUpdate);
}
const FeatureGUIInfo& PaimonFollow::GetGUIInfo() const
{
static const FeatureGUIInfo info{ "PaimonFollow", "Visuals", true };
return info;
}
void PaimonFollow::DrawMain()
{
ConfigWidget(f_Enabled, "Paimon Follow.");
}
bool PaimonFollow::NeedStatusDraw() const
{
return f_Enabled;
}
void PaimonFollow::DrawStatus()
{
ImGui::Text("Paimon Follow");
}
PaimonFollow& PaimonFollow::GetInstance()
{
static PaimonFollow instance;
return instance;
}
void PaimonFollow::OnGameUpdate()
{
if (!f_Enabled)
return;
auto currentTime = util::GetCurrentTimeMillisec();
if (currentTime < nextUpdate)
return;
if (GameObject::Paimon == nullptr) {
GameObject::Paimon = app::GameObject_Find(string_to_il2cppi("/EntityRoot/OtherGadgetRoot/NPC_Guide_Paimon(Clone)"), nullptr);
}
if (GameObject::ProfileLayer == nullptr) {
GameObject::ProfileLayer = app::GameObject_Find(string_to_il2cppi("/Canvas/Pages/PlayerProfilePage"), nullptr);
}
if (GameObject::Paimon != nullptr && GameObject::ProfileLayer != nullptr) {
auto ProfileOpen = app::GameObject_get_active(GameObject::ProfileLayer, nullptr);
if (ProfileOpen) {
app::GameObject_set_active(GameObject::Paimon, false, nullptr);
}
else {
app::GameObject_set_active(GameObject::Paimon, true, nullptr);
}
}
nextUpdate = currentTime + (int)f_DelayUpdate;
}
}

View File

@ -0,0 +1,26 @@
#pragma once
#include <cheat-base/cheat/Feature.h>
#include <cheat-base/config/config.h>
#include <cheat-base/thread-safe.h>
namespace cheat::feature
{
class PaimonFollow : public Feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
static PaimonFollow& GetInstance();
const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override;
virtual bool NeedStatusDraw() const override;
void DrawStatus() override;
private:
SafeQueue<uint32_t> toBeUpdate;
SafeValue<int64_t> nextUpdate;
int f_DelayUpdate = 100.f;
void OnGameUpdate();
PaimonFollow();
};
}