This commit is contained in:
Joaquin 2022-09-02 20:16:01 -06:00
parent 8db1501523
commit c0ed854f98
2 changed files with 23 additions and 27 deletions

View File

@ -12,8 +12,7 @@ namespace cheat::feature
}
PaimonFollow::PaimonFollow() : Feature(),
NFEX(f_Enabled, "Paimon Follow", "PaimonFollow", "Visuals", false, false),
toBeUpdate(), nextUpdate(0)
NFEX(f_Enabled, "Paimon Follow", "PaimonFollow", "Visuals", false, false)
{
events::GameUpdateEvent += MY_METHOD_HANDLER(PaimonFollow::OnGameUpdate);
}
@ -48,31 +47,32 @@ namespace cheat::feature
void PaimonFollow::OnGameUpdate()
{
if (!f_Enabled)
return;
UPDATE_DELAY(100);
auto currentTime = util::GetCurrentTimeMillisec();
if (currentTime < nextUpdate)
return;
if (GameObject::Paimon == nullptr) {
if (f_Enabled)
{
GameObject::Paimon = app::GameObject_Find(string_to_il2cppi("/EntityRoot/OtherGadgetRoot/NPC_Guide_Paimon(Clone)"), nullptr);
}
if (GameObject::Paimon == nullptr)
return;
if (GameObject::ProfileLayer == nullptr) {
GameObject::ProfileLayer = app::GameObject_Find(string_to_il2cppi("/Canvas/Pages/PlayerProfilePage"), nullptr);
}
if (GameObject::ProfileLayer == nullptr)
return;
if (GameObject::Paimon != nullptr && GameObject::ProfileLayer != nullptr) {
if (GameObject::Paimon->fields._.m_CachedPtr != nullptr && GameObject::ProfileLayer->fields._.m_CachedPtr != nullptr)
{
auto ProfileOpen = app::GameObject_get_active(GameObject::ProfileLayer, nullptr);
if (ProfileOpen) {
if (ProfileOpen)
app::GameObject_set_active(GameObject::Paimon, false, nullptr);
}
else {
else
app::GameObject_set_active(GameObject::Paimon, true, nullptr);
}
}
nextUpdate = currentTime + (int)f_DelayUpdate;
else
{
GameObject::Paimon == nullptr;
GameObject::ProfileLayer == nullptr;
}
}
}

View File

@ -1,7 +1,6 @@
#pragma once
#include <cheat-base/cheat/Feature.h>
#include <cheat-base/config/config.h>
#include <cheat-base/thread-safe.h>
namespace cheat::feature
{
@ -16,9 +15,6 @@ namespace cheat::feature
virtual bool NeedStatusDraw() const override;
void DrawStatus() override;
private:
SafeQueue<uint32_t> toBeUpdate;
SafeValue<int64_t> nextUpdate;
int f_DelayUpdate = 100;
void OnGameUpdate();
PaimonFollow();