From cfeae14903dca13351998cc60cf8a8a6877bb1b2 Mon Sep 17 00:00:00 2001
From: Taiga <67109235+Taiga74164@users.noreply.github.com>
Date: Thu, 30 Jun 2022 23:58:54 -0600
Subject: [PATCH] Added VacuumLoot
based on @m0nkrel AutoSeelie
---
cheat-library/cheat-library.vcxproj | 2 +
cheat-library/cheat-library.vcxproj.filters | 6 ++
cheat-library/src/user/cheat/cheat.cpp | 2 +
.../src/user/cheat/world/AutoSeelie.cpp | 4 +-
.../src/user/cheat/world/VacuumLoot.cpp | 93 +++++++++++++++++++
.../src/user/cheat/world/VacuumLoot.h | 33 +++++++
6 files changed, 137 insertions(+), 3 deletions(-)
create mode 100644 cheat-library/src/user/cheat/world/VacuumLoot.cpp
create mode 100644 cheat-library/src/user/cheat/world/VacuumLoot.h
diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj
index 4dafbd1..859d978 100644
--- a/cheat-library/cheat-library.vcxproj
+++ b/cheat-library/cheat-library.vcxproj
@@ -111,6 +111,7 @@
+
@@ -211,6 +212,7 @@
+
diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters
index b44f723..725c14d 100644
--- a/cheat-library/cheat-library.vcxproj.filters
+++ b/cheat-library/cheat-library.vcxproj.filters
@@ -240,6 +240,9 @@
Header Files
+
+ Header Files
+
@@ -438,6 +441,9 @@
Source Files
+
+ Source Files
+
diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp
index 044080d..8779c13 100644
--- a/cheat-library/src/user/cheat/cheat.cpp
+++ b/cheat-library/src/user/cheat/cheat.cpp
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
@@ -85,6 +86,7 @@ namespace cheat
FEAT_INST(AutoTreeFarm),
FEAT_INST(AutoDestroy),
FEAT_INST(AutoSeelie),
+ FEAT_INST(VacuumLoot),
FEAT_INST(DialogSkip),
FEAT_INST(DumbEnemies),
FEAT_INST(ElementalSight),
diff --git a/cheat-library/src/user/cheat/world/AutoSeelie.cpp b/cheat-library/src/user/cheat/world/AutoSeelie.cpp
index 62e139c..f52adf3 100644
--- a/cheat-library/src/user/cheat/world/AutoSeelie.cpp
+++ b/cheat-library/src/user/cheat/world/AutoSeelie.cpp
@@ -10,7 +10,6 @@ namespace cheat::feature
{
AutoSeelie::AutoSeelie() : Feature(),
NF(f_Enabled, "Auto follow seelie", "AutoSeelie", false)
-
{
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoSeelie::OnGameUpdate);
}
@@ -22,7 +21,7 @@ namespace cheat::feature
void AutoSeelie::DrawMain()
{
- ConfigWidget("Auto seelie", f_Enabled, "Auto follow seelie to it 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");
}
@@ -58,7 +57,6 @@ namespace cheat::feature
return false;
}
-
void AutoSeelie::OnGameUpdate()
{
if (!f_Enabled)
diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp
new file mode 100644
index 0000000..c5feb20
--- /dev/null
+++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp
@@ -0,0 +1,93 @@
+#include "pch-il2cpp.h"
+#include "VacuumLoot.h"
+
+#include
+#include
+#include
+#include
+
+namespace cheat::feature
+{
+ VacuumLoot::VacuumLoot() : Feature(),
+ NF(f_Enabled, "Vacuum Loot", "VacuumLoot", false)
+ {
+ events::GameUpdateEvent += MY_METHOD_HANDLER(VacuumLoot::OnGameUpdate);
+ }
+ const FeatureGUIInfo& VacuumLoot::GetGUIInfo() const
+ {
+ static const FeatureGUIInfo info{ "", "World", true };
+ return info;
+ }
+
+ void VacuumLoot::DrawMain()
+ {
+ ConfigWidget("Vacuum Loot", f_Enabled, "Vacuum Loot drops");
+ }
+
+ bool VacuumLoot::NeedStatusDraw() const
+ {
+ return f_Enabled;
+ }
+
+ void VacuumLoot::DrawStatus()
+ {
+ ImGui::Text ("VacuumLoot");
+ }
+
+ VacuumLoot& VacuumLoot::GetInstance()
+ {
+ static VacuumLoot instance;
+ return instance;
+ }
+
+ bool VacuumLoot::IsEntityForVac(game::Entity* entity)
+ {
+ auto& manager = game::EntityManager::instance();
+ auto distance = manager.avatar()->distance(entity);
+ float radius = 100.0f;
+
+ // TODO: Add more on the filter list in the future
+ static std::vector dropList
+ {
+ "SceneObj_DropItem",
+ "SceneObj_Ore_Drop",
+ "_Thundercrystaldrop",
+ "Meat",
+ "Fishmeat",
+ "Equip_Sword",
+ "Equip_Pole",
+ "Equip_Bow",
+ "Equip_Catalyst",
+ "Equip_Claymore",
+ "Eff_Animal"
+ };
+
+ for (auto& dropListNames : dropList)
+ if (entity->name().find(dropListNames) != std::string::npos)
+ return distance <= radius;
+
+ return false;
+ }
+
+ void VacuumLoot::OnGameUpdate()
+ {
+ if (!f_Enabled)
+ return;
+
+ auto currentTime = util::GetCurrentTimeMillisec();
+ if (currentTime < nextTime)
+ return;
+
+ auto& manager = game::EntityManager::instance();
+ auto avatarEntity = manager.avatar();
+ for (const auto& entity : manager.entities())
+ {
+ if (!IsEntityForVac(entity))
+ continue;
+
+ entity->setRelativePosition(avatarEntity->relativePosition());
+ }
+ nextTime = currentTime + 1000;
+ }
+
+}
\ No newline at end of file
diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.h b/cheat-library/src/user/cheat/world/VacuumLoot.h
new file mode 100644
index 0000000..72bff8b
--- /dev/null
+++ b/cheat-library/src/user/cheat/world/VacuumLoot.h
@@ -0,0 +1,33 @@
+#pragma once
+#include
+#include
+
+#include
+#include
+#include
+
+namespace cheat::feature
+{
+
+ class VacuumLoot : public Feature
+ {
+ public:
+ config::Field> f_Enabled;
+
+ static VacuumLoot& GetInstance();
+
+ const FeatureGUIInfo& GetGUIInfo() const override;
+ void DrawMain() override;
+
+ virtual bool NeedStatusDraw() const override;
+ void DrawStatus() override;
+
+ void OnGameUpdate();
+ private:
+
+ std::vector m_Filters;
+ VacuumLoot();
+ int nextTime{};
+ bool IsEntityForVac(cheat::game::Entity* entity);
+ };
+}