Added VacuumLoot

based on @m0nkrel AutoSeelie
This commit is contained in:
Taiga 2022-06-30 23:58:54 -06:00
parent cca312a348
commit a2f3d05e6f
6 changed files with 137 additions and 3 deletions

View File

@ -111,6 +111,7 @@
<ClInclude Include="src\user\cheat\world\KillAura.h" /> <ClInclude Include="src\user\cheat\world\KillAura.h" />
<ClInclude Include="src\user\cheat\world\MobVacuum.h" /> <ClInclude Include="src\user\cheat\world\MobVacuum.h" />
<ClInclude Include="src\user\cheat\world\MusicEvent.h" /> <ClInclude Include="src\user\cheat\world\MusicEvent.h" />
<ClInclude Include="src\user\cheat\world\VacuumLoot.h" />
<ClInclude Include="src\user\main.h" /> <ClInclude Include="src\user\main.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -211,6 +212,7 @@
<ClCompile Include="src\user\cheat\world\KillAura.cpp" /> <ClCompile Include="src\user\cheat\world\KillAura.cpp" />
<ClCompile Include="src\user\cheat\world\MobVacuum.cpp" /> <ClCompile Include="src\user\cheat\world\MobVacuum.cpp" />
<ClCompile Include="src\user\cheat\world\MusicEvent.cpp" /> <ClCompile Include="src\user\cheat\world\MusicEvent.cpp" />
<ClCompile Include="src\user\cheat\world\VacuumLoot.cpp" />
<ClCompile Include="src\user\main.cpp" /> <ClCompile Include="src\user\main.cpp" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>

View File

@ -240,6 +240,9 @@
<ClInclude Include="src\user\cheat\world\AutoSeelie.h"> <ClInclude Include="src\user\cheat\world\AutoSeelie.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\user\cheat\world\VacuumLoot.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Font Include="res\Ruda-Bold.ttf" /> <Font Include="res\Ruda-Bold.ttf" />
@ -438,6 +441,9 @@
<ClCompile Include="src\user\cheat\world\AutoSeelie.cpp"> <ClCompile Include="src\user\cheat\world\AutoSeelie.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\user\cheat\world\VacuumLoot.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="res\res.rc"> <ResourceCompile Include="res\res.rc">

View File

@ -28,6 +28,7 @@
#include <cheat/world/AutoDestroy.h> #include <cheat/world/AutoDestroy.h>
#include <cheat/world/FakeTime.h> #include <cheat/world/FakeTime.h>
#include <cheat/world/AutoSeelie.h> #include <cheat/world/AutoSeelie.h>
#include <cheat/world/VacuumLoot.h>
#include <cheat/teleport/ChestTeleport.h> #include <cheat/teleport/ChestTeleport.h>
#include <cheat/teleport/MapTeleport.h> #include <cheat/teleport/MapTeleport.h>
@ -85,6 +86,7 @@ namespace cheat
FEAT_INST(AutoTreeFarm), FEAT_INST(AutoTreeFarm),
FEAT_INST(AutoDestroy), FEAT_INST(AutoDestroy),
FEAT_INST(AutoSeelie), FEAT_INST(AutoSeelie),
FEAT_INST(VacuumLoot),
FEAT_INST(DialogSkip), FEAT_INST(DialogSkip),
FEAT_INST(DumbEnemies), FEAT_INST(DumbEnemies),
FEAT_INST(ElementalSight), FEAT_INST(ElementalSight),

View File

@ -10,7 +10,6 @@ namespace cheat::feature
{ {
AutoSeelie::AutoSeelie() : Feature(), AutoSeelie::AutoSeelie() : Feature(),
NF(f_Enabled, "Auto follow seelie", "AutoSeelie", false) NF(f_Enabled, "Auto follow seelie", "AutoSeelie", false)
{ {
events::GameUpdateEvent += MY_METHOD_HANDLER(AutoSeelie::OnGameUpdate); events::GameUpdateEvent += MY_METHOD_HANDLER(AutoSeelie::OnGameUpdate);
} }
@ -22,7 +21,7 @@ namespace cheat::feature
void AutoSeelie::DrawMain() 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::SameLine();
ImGui::TextColored(ImColor(255, 165, 0, 255), "Don't work with Electro Seelies"); ImGui::TextColored(ImColor(255, 165, 0, 255), "Don't work with Electro Seelies");
} }
@ -58,7 +57,6 @@ namespace cheat::feature
return false; return false;
} }
void AutoSeelie::OnGameUpdate() void AutoSeelie::OnGameUpdate()
{ {
if (!f_Enabled) if (!f_Enabled)

View File

@ -0,0 +1,93 @@
#include "pch-il2cpp.h"
#include "VacuumLoot.h"
#include <helpers.h>
#include <cheat/events.h>
#include <cheat/game/EntityManager.h>
#include <cheat/game/util.h>
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<std::string> 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;
}
}

View File

@ -0,0 +1,33 @@
#pragma once
#include <cheat-base/cheat/Feature.h>
#include <cheat-base/config/config.h>
#include <cheat/game/Entity.h>
#include <cheat/game/filters.h>
#include <il2cpp-appdata.h>
namespace cheat::feature
{
class VacuumLoot : public Feature
{
public:
config::Field<config::Toggle<Hotkey>> 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<game::IEntityFilter*> m_Filters;
VacuumLoot();
int nextTime{};
bool IsEntityForVac(cheat::game::Entity* entity);
};
}