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

View File

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