Added ElectroSeelie with separate button

This commit is contained in:
m0nkrel 2022-07-10 15:58:58 +03:00
parent 83cc1642e2
commit ffff66fa3e
2 changed files with 60 additions and 31 deletions

View File

@ -9,22 +9,33 @@
namespace cheat::feature namespace cheat::feature
{ {
AutoSeelie::AutoSeelie() : Feature(), AutoSeelie::AutoSeelie() : Feature(),
NF(f_Enabled, "Auto follow seelie", "AutoSeelie", false) NF(f_Enabled, "Auto seelie", "Auto Seelie", false),
{ NF(f_ElectroSeelie, "Auto Electro seelie", "Auto Seelie", false),
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoSeelie::OnGameUpdate); nextTime(0)
} {
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoSeelie::OnGameUpdate);
}
const FeatureGUIInfo& AutoSeelie::GetGUIInfo() const const FeatureGUIInfo& AutoSeelie::GetGUIInfo() const
{ {
static const FeatureGUIInfo info{ "", "World", true }; static const FeatureGUIInfo info{ "", "World", true };
return info; return info;
} }
void AutoSeelie::DrawMain() void AutoSeelie::DrawMain()
{ {
ConfigWidget("Auto seelie", f_Enabled, "Auto follow seelie to its home"); ConfigWidget("Auto seelie", f_Enabled, "Auto follow seelie to its home");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Don't work with Electro Seelies"); if (f_Enabled)
} {
ImGui::Indent();
ConfigWidget("Auto Electro seelie", f_ElectroSeelie, "Since you don't need to manually start electroseelie, \n"
"they start moving automatically with this option within 100m radius.");
ImGui::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Read the note!");
ImGui::Unindent();
}
}
bool AutoSeelie::NeedStatusDraw() const bool AutoSeelie::NeedStatusDraw() const
{ {
@ -33,7 +44,7 @@ namespace cheat::feature
void AutoSeelie::DrawStatus() void AutoSeelie::DrawStatus()
{ {
ImGui::Text ("AutoSeelie"); ImGui::Text("AutoSeelie %s", f_ElectroSeelie ? "+ Electro" : "");
} }
AutoSeelie& AutoSeelie::GetInstance() AutoSeelie& AutoSeelie::GetInstance()
@ -47,35 +58,52 @@ namespace cheat::feature
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
auto distance = manager.avatar()->distance(entity); auto distance = manager.avatar()->distance(entity);
float radius = 100.0f; float radius = 100.0f;
if (entity->name().find("Gear_Seelie") != std::string::npos || entity->name().find("_FireSeelie") != std::string::npos || if (entity->name().find("Seelie") != std::string::npos)
entity->name().find("_LitSeelie") != std::string::npos)
{ {
if (entity->name().find("ElectricSeelie") != std::string::npos)
{
if (f_ElectroSeelie)
{
auto EntityGameObject = app::MoleMole_BaseEntity_get_rootGameObject(entity->raw(), nullptr);
auto Transform = app::GameObject_GetComponentByName(EntityGameObject, string_to_il2cppi("Transform"), nullptr);
auto child = app::Transform_GetChild(reinterpret_cast<app::Transform*>(Transform), 1, nullptr);
auto pre_status = app::Component_1_get_gameObject(reinterpret_cast<app::Component_1*>(child), nullptr);
auto status = app::GameObject_get_active(reinterpret_cast<app::GameObject*>(pre_status), nullptr);
if (status)
{
return false;
}
return distance <= radius;
}
return false;
}
return distance <= radius; return distance <= radius;
} }
return false; return false;
} }
void AutoSeelie::OnGameUpdate() void AutoSeelie::OnGameUpdate()
{ {
if (!f_Enabled) if (!f_Enabled)
return; return;
auto currentTime = util::GetCurrentTimeMillisec(); auto currentTime = util::GetCurrentTimeMillisec();
if (currentTime < nextTime) if (currentTime < nextTime)
return; return;
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
auto avatarEntity = manager.avatar(); auto avatarEntity = manager.avatar();
for (const auto& entity : manager.entities()) for (const auto& entity : manager.entities())
{ {
if (!IsEntityForVac(entity)) if (!IsEntityForVac(entity))
continue; continue;
entity->setRelativePosition(avatarEntity->relativePosition()); entity->setRelativePosition(avatarEntity->relativePosition());
} }
nextTime = currentTime + 1000; nextTime = currentTime + 1000;
} }
} }

View File

@ -4,8 +4,10 @@
#include <cheat/game/Entity.h> #include <cheat/game/Entity.h>
#include <cheat/game/filters.h> #include <cheat/game/filters.h>
#include <cheat-base/thread-safe.h>
#include <il2cpp-appdata.h> #include <il2cpp-appdata.h>
namespace cheat::feature namespace cheat::feature
{ {
@ -13,6 +15,7 @@ namespace cheat::feature
{ {
public: public:
config::Field<config::Toggle<Hotkey>> f_Enabled; config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<bool> f_ElectroSeelie;
static AutoSeelie& GetInstance(); static AutoSeelie& GetInstance();
@ -24,10 +27,8 @@ namespace cheat::feature
void OnGameUpdate(); void OnGameUpdate();
private: private:
std::vector<game::IEntityFilter*> m_Filters;
AutoSeelie(); AutoSeelie();
int nextTime{}; SafeValue<int64_t> nextTime;
bool IsEntityForVac(cheat::game::Entity* entity); bool IsEntityForVac(cheat::game::Entity* entity);
}; };
} }