From cc2bfcf2f15fe592be633d0c506a3f0db19c1251 Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Mon, 4 Jul 2022 21:42:50 +0100 Subject: [PATCH 1/9] Made VacuumLoot more user configurable --- .../src/user/cheat/world/VacuumLoot.cpp | 82 ++++++++++++------- .../src/user/cheat/world/VacuumLoot.h | 9 +- 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 5cdd182..cfd94a9 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -11,8 +11,10 @@ namespace cheat::feature VacuumLoot::VacuumLoot() : Feature(), NF(f_Enabled, "Vacuum Loot", "VacuumLoot", false) { + InstallFilters(); events::GameUpdateEvent += MY_METHOD_HANDLER(VacuumLoot::OnGameUpdate); } + const FeatureGUIInfo& VacuumLoot::GetGUIInfo() const { static const FeatureGUIInfo info{ "", "World", true }; @@ -21,7 +23,19 @@ namespace cheat::feature void VacuumLoot::DrawMain() { - ConfigWidget("Vacuum Loot", f_Enabled, "Vacuum Loot drops"); + if (ImGui::BeginGroupPanel("Vacuum Loot", false)) + { + ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); + ImGui::TreeNode(this, "Loot Types"); + for (auto& [field, name] : m_Filters) + { + ImGui::PushID(name.c_str()); + ConfigWidget(field); + ImGui::PopID(); + } + ImGui::TreePop(); + } + ImGui::EndGroupPanel(); } bool VacuumLoot::NeedStatusDraw() const @@ -46,35 +60,10 @@ namespace cheat::feature 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", - "_DropMagicCrystal", - "_Thundercrystaldrop", - "_Ore_ElectricRock", - "_DropMoonMeteor_", - "_DropMagicCrystal", - "_Potato", - "_Radish02_Clear", - "_Cabbage", - "_Carrot02_Clear", - "_Wheat", - "Wisp", - "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; + for (const auto& lootItem : m_Filters) + if (lootItem.first.value()) + if (entity->name().find(lootItem.second) != std::string::npos) + return distance <= radius; return false; } @@ -100,4 +89,37 @@ namespace cheat::feature nextTime = currentTime + 1000; } + void VacuumLoot::AddFilter(const std::string& friendName, const std::string& name) + { + m_Filters.push_back({ + config::CreateField(friendName, name, + fmt::format("VacuumLoot::Filters::{}", name), + false, true), + name + }); + } + + void VacuumLoot::InstallFilters() + { + AddFilter("General loot", "SceneObj_DropItem" ); + AddFilter("Ore Drops", "SceneObj_Ore_Drop" ); + AddFilter("Magic Crystal", "_DropMagicCrystal" ); + AddFilter("???", "_Thundercrystaldrop" ); + AddFilter("Electro Crystal", "_Ore_ElectricRock" ); + AddFilter("Starsilver Ore", "_DropMoonMeteor_" ); + AddFilter("Potatoes", "_Potato" ); + AddFilter("Radish", "_Radish02_Clear" ); + AddFilter("Cabbage", "_Cabbage" ); + AddFilter("Carrot", "_Carrot02_Clear" ); + AddFilter("Wheat", "_Wheat" ); + AddFilter("Butterflies & Crystalflies", "Wisp" ); + AddFilter("Meat", "Meat" ); + AddFilter("Fishmeat", "Fishmeat" ); + AddFilter("Swords", "Equip_Sword" ); + AddFilter("Poles", "Equip_Pole" ); + AddFilter("Bows", "Equip_Bow" ); + AddFilter("Catalysts", "Equip_Catalyst" ); + AddFilter("Claymores", "Equip_Claymore" ); + AddFilter("???", "Eff_Animal" ); + } } diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.h b/cheat-library/src/user/cheat/world/VacuumLoot.h index 72bff8b..e0a817c 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.h +++ b/cheat-library/src/user/cheat/world/VacuumLoot.h @@ -23,11 +23,14 @@ namespace cheat::feature void DrawStatus() override; void OnGameUpdate(); - private: - std::vector m_Filters; + private: + std::vector, std::string>> m_Filters; + int nextTime = 0; + VacuumLoot(); - int nextTime{}; + void InstallFilters(); + void AddFilter(const std::string& friendName, const std::string& name); bool IsEntityForVac(cheat::game::Entity* entity); }; } From f1d85d220326342ed46ec00ff19cbe336eea1f55 Mon Sep 17 00:00:00 2001 From: Taiga <67109235+Taiga74164@users.noreply.github.com> Date: Mon, 4 Jul 2022 16:44:38 -0600 Subject: [PATCH 2/9] fix 1, 2, 3, 5 --- .../src/user/cheat/world/VacuumLoot.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index cfd94a9..59804ee 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -26,14 +26,16 @@ namespace cheat::feature if (ImGui::BeginGroupPanel("Vacuum Loot", false)) { ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); - ImGui::TreeNode(this, "Loot Types"); - for (auto& [field, name] : m_Filters) + if (ImGui::TreeNode(this, "Loot Types")) { - ImGui::PushID(name.c_str()); - ConfigWidget(field); - ImGui::PopID(); + for (auto& [field, name] : m_Filters) + { + ImGui::PushID(name.c_str()); + ConfigWidget(field); + ImGui::PopID(); + } + ImGui::TreePop(); } - ImGui::TreePop(); } ImGui::EndGroupPanel(); } @@ -104,22 +106,26 @@ namespace cheat::feature AddFilter("General loot", "SceneObj_DropItem" ); AddFilter("Ore Drops", "SceneObj_Ore_Drop" ); AddFilter("Magic Crystal", "_DropMagicCrystal" ); - AddFilter("???", "_Thundercrystaldrop" ); + AddFilter("Amethyst Lump", "_Thundercrystaldrop" ); AddFilter("Electro Crystal", "_Ore_ElectricRock" ); AddFilter("Starsilver Ore", "_DropMoonMeteor_" ); + AddFilter("Noctilucous Jade", "NightBerth" ); AddFilter("Potatoes", "_Potato" ); AddFilter("Radish", "_Radish02_Clear" ); AddFilter("Cabbage", "_Cabbage" ); AddFilter("Carrot", "_Carrot02_Clear" ); AddFilter("Wheat", "_Wheat" ); - AddFilter("Butterflies & Crystalflies", "Wisp" ); - AddFilter("Meat", "Meat" ); + AddFilter("Crystalflies", "Wisp" ); + AddFilter("Meat & Fowl", "Meat" ); AddFilter("Fishmeat", "Fishmeat" ); + AddFilter("Crab", "Crab" ); + AddFilter("Eel", "Eel_" ); + AddFilter("Lizard", "Lizard" ); AddFilter("Swords", "Equip_Sword" ); AddFilter("Poles", "Equip_Pole" ); AddFilter("Bows", "Equip_Bow" ); AddFilter("Catalysts", "Equip_Catalyst" ); AddFilter("Claymores", "Equip_Claymore" ); - AddFilter("???", "Eff_Animal" ); + AddFilter("Butterflies & Fireflies", "Eff_Animal" ); } } From c7a31d9d153698ffd74b84daac20107d30fa98b9 Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Tue, 5 Jul 2022 01:53:32 +0100 Subject: [PATCH 3/9] Grouped filters by categories --- .../src/user/cheat/world/VacuumLoot.cpp | 114 +++++++++++------- .../src/user/cheat/world/VacuumLoot.h | 6 +- 2 files changed, 73 insertions(+), 47 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 59804ee..5f39204 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -6,6 +6,18 @@ #include #include +// Returns the unique categories (i.e. the third element of every tuple) in a filter object. +static std::vector uniqueCategories(const std::vector, std::string, std::string>>& filter) +{ + std::vector result; + std::transform(filter.begin(), filter.end(), std::back_inserter(result), + [](const auto& item) {return std::get<2>(item); }); + std::sort(result.begin(), result.end()); + auto it = std::unique(result.begin(), result.end()); + result.erase(it, result.end()); + return result; +} + namespace cheat::feature { VacuumLoot::VacuumLoot() : Feature(), @@ -23,21 +35,31 @@ namespace cheat::feature void VacuumLoot::DrawMain() { - if (ImGui::BeginGroupPanel("Vacuum Loot", false)) - { - ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); - if (ImGui::TreeNode(this, "Loot Types")) - { - for (auto& [field, name] : m_Filters) - { - ImGui::PushID(name.c_str()); - ConfigWidget(field); - ImGui::PopID(); - } - ImGui::TreePop(); - } - } - ImGui::EndGroupPanel(); + if (ImGui::BeginGroupPanel("Vacuum Loot", false)) + { + ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); + if (ImGui::TreeNode(this, "Loot Types")) + { + for (const auto& groupCategory : uniqueCategories(m_Filters)) + { + if (ImGui::BeginGroupPanel(groupCategory.c_str(), false)) + { + for (auto& [field, name, category] : m_Filters) + { + if (category == groupCategory) + { + ImGui::PushID(name.c_str()); + ConfigWidget(field); + ImGui::PopID(); + } + } + } + ImGui::EndGroupPanel(); + } + ImGui::TreePop(); + } + } + ImGui::EndGroupPanel(); } bool VacuumLoot::NeedStatusDraw() const @@ -62,11 +84,11 @@ namespace cheat::feature auto distance = manager.avatar()->distance(entity); float radius = 100.0f; - for (const auto& lootItem : m_Filters) - if (lootItem.first.value()) - if (entity->name().find(lootItem.second) != std::string::npos) + for (const auto& [field, name, category] : m_Filters) + if (field.value()) + if (entity->name().find(name) != std::string::npos) return distance <= radius; - + return false; } @@ -91,41 +113,43 @@ namespace cheat::feature nextTime = currentTime + 1000; } - void VacuumLoot::AddFilter(const std::string& friendName, const std::string& name) + void VacuumLoot::AddFilter(const std::string& friendName, + const std::string& name, + const std::string& category) { m_Filters.push_back({ config::CreateField(friendName, name, fmt::format("VacuumLoot::Filters::{}", name), false, true), - name + name, category }); } void VacuumLoot::InstallFilters() { - AddFilter("General loot", "SceneObj_DropItem" ); - AddFilter("Ore Drops", "SceneObj_Ore_Drop" ); - AddFilter("Magic Crystal", "_DropMagicCrystal" ); - AddFilter("Amethyst Lump", "_Thundercrystaldrop" ); - AddFilter("Electro Crystal", "_Ore_ElectricRock" ); - AddFilter("Starsilver Ore", "_DropMoonMeteor_" ); - AddFilter("Noctilucous Jade", "NightBerth" ); - AddFilter("Potatoes", "_Potato" ); - AddFilter("Radish", "_Radish02_Clear" ); - AddFilter("Cabbage", "_Cabbage" ); - AddFilter("Carrot", "_Carrot02_Clear" ); - AddFilter("Wheat", "_Wheat" ); - AddFilter("Crystalflies", "Wisp" ); - AddFilter("Meat & Fowl", "Meat" ); - AddFilter("Fishmeat", "Fishmeat" ); - AddFilter("Crab", "Crab" ); - AddFilter("Eel", "Eel_" ); - AddFilter("Lizard", "Lizard" ); - AddFilter("Swords", "Equip_Sword" ); - AddFilter("Poles", "Equip_Pole" ); - AddFilter("Bows", "Equip_Bow" ); - AddFilter("Catalysts", "Equip_Catalyst" ); - AddFilter("Claymores", "Equip_Claymore" ); - AddFilter("Butterflies & Fireflies", "Eff_Animal" ); + AddFilter("General loot", "SceneObj_DropItem" ,"General"); + AddFilter("Ore Drops", "SceneObj_Ore_Drop" ,"Ore"); + AddFilter("Magic Crystal", "_DropMagicCrystal" ,"Ore"); + AddFilter("Amethyst Lump", "_Thundercrystaldrop" ,"Ore"); + AddFilter("Electro Crystal", "_Ore_ElectricRock" ,"Ore"); + AddFilter("Starsilver Ore", "_DropMoonMeteor_" ,"Ore"); + AddFilter("Noctilucous Jade", "NightBerth" ,"Ore"); + AddFilter("Potatoes", "_Potato" ,"Food"); + AddFilter("Radish", "_Radish02_Clear" ,"Food"); + AddFilter("Cabbage", "_Cabbage" ,"Food"); + AddFilter("Carrot", "_Carrot02_Clear" ,"Food"); + AddFilter("Wheat", "_Wheat" ,"Food"); + AddFilter("Crystalflies", "Wisp" ,"General"); + AddFilter("Meat & Fowl", "Meat" ,"Food"); + AddFilter("Fishmeat", "Fishmeat" ,"Food"); + AddFilter("Crab", "Crab" ,"Food"); + AddFilter("Eel", "Eel_" ,"Food"); + AddFilter("Lizard", "Lizard" ,"General"); + AddFilter("Swords", "Equip_Sword" ,"Equipment"); + AddFilter("Poles", "Equip_Pole" ,"Equipment"); + AddFilter("Bows", "Equip_Bow" ,"Equipment"); + AddFilter("Catalysts", "Equip_Catalyst" ,"Equipment"); + AddFilter("Claymores", "Equip_Claymore" ,"Equipment"); + AddFilter("Butterflies & Fireflies", "Eff_Animal" ,"General"); } } diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.h b/cheat-library/src/user/cheat/world/VacuumLoot.h index e0a817c..f74e54d 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.h +++ b/cheat-library/src/user/cheat/world/VacuumLoot.h @@ -25,12 +25,14 @@ namespace cheat::feature void OnGameUpdate(); private: - std::vector, std::string>> m_Filters; + // Tuple of: enabled flag, human-readable name, filter category + using LootFilter = std::tuple, std::string, std::string>; + std::vector m_Filters; int nextTime = 0; VacuumLoot(); void InstallFilters(); - void AddFilter(const std::string& friendName, const std::string& name); + void AddFilter(const std::string& friendName, const std::string& name, const std::string& category); bool IsEntityForVac(cheat::game::Entity* entity); }; } From 43b66ba7f81fddb45689cd9917cbad2e2a8502e2 Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Tue, 5 Jul 2022 02:06:09 +0100 Subject: [PATCH 4/9] Fixed config writer --- cheat-library/src/user/cheat/world/VacuumLoot.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 5f39204..2ff04e9 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -118,11 +118,9 @@ namespace cheat::feature const std::string& category) { m_Filters.push_back({ - config::CreateField(friendName, name, - fmt::format("VacuumLoot::Filters::{}", name), - false, true), + config::CreateField(friendName, name, "VacuumLoot::Filters", false, true), name, category - }); + }); } void VacuumLoot::InstallFilters() From c60731d26dad02af2f991d9fb07dd273f9dac041 Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Tue, 5 Jul 2022 11:21:00 +0100 Subject: [PATCH 5/9] Moved vacuum in front of player, not underneath Changed game object for Noctilucous Jade --- .../src/user/cheat/world/VacuumLoot.cpp | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 2ff04e9..31d2d9d 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -108,7 +108,7 @@ namespace cheat::feature if (!IsEntityForVac(entity)) continue; - entity->setRelativePosition(avatarEntity->relativePosition()); + entity->setRelativePosition(avatarEntity->relativePosition() + avatarEntity->forward() * 0.8f); } nextTime = currentTime + 1000; } @@ -123,31 +123,31 @@ namespace cheat::feature }); } - void VacuumLoot::InstallFilters() +void VacuumLoot::InstallFilters() { - AddFilter("General loot", "SceneObj_DropItem" ,"General"); - AddFilter("Ore Drops", "SceneObj_Ore_Drop" ,"Ore"); - AddFilter("Magic Crystal", "_DropMagicCrystal" ,"Ore"); - AddFilter("Amethyst Lump", "_Thundercrystaldrop" ,"Ore"); - AddFilter("Electro Crystal", "_Ore_ElectricRock" ,"Ore"); - AddFilter("Starsilver Ore", "_DropMoonMeteor_" ,"Ore"); - AddFilter("Noctilucous Jade", "NightBerth" ,"Ore"); - AddFilter("Potatoes", "_Potato" ,"Food"); - AddFilter("Radish", "_Radish02_Clear" ,"Food"); - AddFilter("Cabbage", "_Cabbage" ,"Food"); - AddFilter("Carrot", "_Carrot02_Clear" ,"Food"); - AddFilter("Wheat", "_Wheat" ,"Food"); - AddFilter("Crystalflies", "Wisp" ,"General"); - AddFilter("Meat & Fowl", "Meat" ,"Food"); - AddFilter("Fishmeat", "Fishmeat" ,"Food"); - AddFilter("Crab", "Crab" ,"Food"); - AddFilter("Eel", "Eel_" ,"Food"); - AddFilter("Lizard", "Lizard" ,"General"); - AddFilter("Swords", "Equip_Sword" ,"Equipment"); - AddFilter("Poles", "Equip_Pole" ,"Equipment"); - AddFilter("Bows", "Equip_Bow" ,"Equipment"); - AddFilter("Catalysts", "Equip_Catalyst" ,"Equipment"); - AddFilter("Claymores", "Equip_Claymore" ,"Equipment"); - AddFilter("Butterflies & Fireflies", "Eff_Animal" ,"General"); + AddFilter("General loot", "SceneObj_DropItem" ,"General"); + AddFilter("Ore Drops", "SceneObj_Ore_Drop" ,"Ore"); + AddFilter("Magic Crystal", "_DropMagicCrystal" ,"Ore"); + AddFilter("Amethyst Lump", "_Thundercrystaldrop" ,"Ore"); + AddFilter("Electro Crystal", "_Ore_ElectricRock" ,"Ore"); + AddFilter("Starsilver Ore", "_DropMoonMeteor_" ,"Ore"); + AddFilter("Noctilucous Jade", "SceneObj_Item_NightBerth" ,"Ore"); + AddFilter("Potatoes", "_Potato" ,"Food"); + AddFilter("Radish", "_Radish02_Clear" ,"Food"); + AddFilter("Cabbage", "_Cabbage" ,"Food"); + AddFilter("Carrot", "_Carrot02_Clear" ,"Food"); + AddFilter("Wheat", "_Wheat" ,"Food"); + AddFilter("Crystalflies", "Wisp" ,"General"); + AddFilter("Meat & Fowl", "Meat" ,"Food"); + AddFilter("Fishmeat", "Fishmeat" ,"Food"); + AddFilter("Crab", "Crab" ,"Food"); + AddFilter("Eel", "Eel_" ,"Food"); + AddFilter("Lizard", "Lizard" ,"General"); + AddFilter("Swords", "Equip_Sword" ,"Equipment"); + AddFilter("Poles", "Equip_Pole" ,"Equipment"); + AddFilter("Bows", "Equip_Bow" ,"Equipment"); + AddFilter("Catalysts", "Equip_Catalyst" ,"Equipment"); + AddFilter("Claymores", "Equip_Claymore" ,"Equipment"); + AddFilter("Butterflies & Fireflies", "Eff_Animal" ,"General"); } } From e4619ee6a1a61712b0ebdc4220c59e3b68826073 Mon Sep 17 00:00:00 2001 From: HarrySilan Date: Wed, 6 Jul 2022 11:29:12 +0800 Subject: [PATCH 6/9] string manipulation moved to utils --- cheat-base/src/cheat-base/util.cpp | 24 ++++++++++++++++++++++ cheat-base/src/cheat-base/util.h | 2 ++ cheat-library/src/user/cheat/esp/ESP.cpp | 26 +----------------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/cheat-base/src/cheat-base/util.cpp b/cheat-base/src/cheat-base/util.cpp index 1557180..3ef4286 100644 --- a/cheat-base/src/cheat-base/util.cpp +++ b/cheat-base/src/cheat-base/util.cpp @@ -172,6 +172,30 @@ namespace util return tokens; } + std::string SplitWords(const std::string& value) + { + std::stringstream outStream; + std::stringstream inStream(value); + + char ch; + inStream >> ch; + outStream << ch; + while (inStream >> ch) + { + if (isupper(ch)) + outStream << " "; + outStream << ch; + } + return outStream.str(); + } + + std::string MakeCapital(std::string value) + { + if (islower(value[0])) + value[0] = toupper(value[0]); + return value; + } + static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" diff --git a/cheat-base/src/cheat-base/util.h b/cheat-base/src/cheat-base/util.h index aa09c1b..366bba7 100644 --- a/cheat-base/src/cheat-base/util.h +++ b/cheat-base/src/cheat-base/util.h @@ -37,6 +37,8 @@ namespace util int64_t GetCurrentTimeMillisec(); std::vector StringSplit(const std::string& delimiter, const std::string& content); + std::string SplitWords(const std::string& value); + std::string MakeCapital(std::string value); std::string to_hex_string(uint8_t* barray, int length); bool IsLittleEndian(); diff --git a/cheat-library/src/user/cheat/esp/ESP.cpp b/cheat-library/src/user/cheat/esp/ESP.cpp index b6f9d94..2165fed 100644 --- a/cheat-library/src/user/cheat/esp/ESP.cpp +++ b/cheat-library/src/user/cheat/esp/ESP.cpp @@ -409,31 +409,7 @@ namespace cheat::feature return; } - std::string SplitWords(const std::string& value) - { - std::stringstream outStream; - std::stringstream inStream(value); - - char ch; - inStream >> ch; - outStream << ch; - while (inStream >> ch) - { - if (isupper(ch)) - outStream << " "; - outStream << ch; - } - return outStream.str(); - } - - std::string MakeCapital(std::string value) - { - if (islower(value[0])) - value[0] = toupper(value[0]); - return value; - } - -#define ADD_FILTER_FIELD(section, name) AddFilter(MakeCapital(#section), SplitWords(#name), &game::filters::##section##::##name##) +#define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##) void ESP::InstallFilters() { ADD_FILTER_FIELD(collection, Book); From 25092ff98979f93387867db337850801cc9a7e71 Mon Sep 17 00:00:00 2001 From: HarrySilan Date: Wed, 6 Jul 2022 12:02:20 +0800 Subject: [PATCH 7/9] add more filters --- cheat-library/src/user/cheat/game/filters.cpp | 26 ++++++++++++++++++- cheat-library/src/user/cheat/game/filters.h | 24 +++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/cheat-library/src/user/cheat/game/filters.cpp b/cheat-library/src/user/cheat/game/filters.cpp index 70f87df..d3e54d0 100644 --- a/cheat-library/src/user/cheat/game/filters.cpp +++ b/cheat-library/src/user/cheat/game/filters.cpp @@ -29,6 +29,16 @@ namespace cheat::game::filters ChestFilter STrap = ChestFilter(game::Chest::ChestState::Trap); } + namespace equipment + { + SimpleFilter Artifacts = { app::EntityType__Enum_1::DropItem, "_Relic" }; + SimpleFilter Bow = { app::EntityType__Enum_1::DropItem, "_Bow" }; + SimpleFilter Claymore = { app::EntityType__Enum_1::DropItem, "_Claymore" }; + SimpleFilter Catalyst = { app::EntityType__Enum_1::DropItem, "_Catalyst" }; + SimpleFilter Pole = { app::EntityType__Enum_1::DropItem, "_Pole" }; + SimpleFilter Sword = { app::EntityType__Enum_1::DropItem, "_Sword" }; + } + namespace featured { SimpleFilter Anemoculus = { app::EntityType__Enum_1::GatherObject, "WindCrystalShell" }; @@ -93,12 +103,13 @@ namespace cheat::game::filters SimpleFilter WeaselThief = { app::EntityType__Enum_1::Monster, "Thoarder_Weasel" }; SimpleFilter Kitsune = { app::EntityType__Enum_1::EnvAnimal, "Vulpes" }; SimpleFilter BakeDanuki = { app::EntityType__Enum_1::Monster, "Inu_Tanuki" }; + SimpleFilter Meat = { app::EntityType__Enum_1::GatherObject , std::vector { "_Food_BirdMeat", "_Food_Meat", "_Fishmeat" }}; } namespace mineral { SimpleFilter AmethystLump = { app::EntityType__Enum_1::GatherObject, "_Thundercrystal" }; - SimpleFilter ArchaicStone = { app::EntityType__Enum_1::GatherObject, "AncientOre" }; + SimpleFilter ArchaicStone = { app::EntityType__Enum_1::GatherObject, "_AncientOre" }; SimpleFilter CorLapis = { app::EntityType__Enum_1::GatherObject, "_ElementRock" }; SimpleFilter CrystalChunk = { app::EntityType__Enum_1::GatherObject, std::vector { "_OreCrystal", "_ShiningCrystalOre" } }; @@ -112,6 +123,16 @@ namespace cheat::game::filters SimpleFilter Starsilver = { app::EntityType__Enum_1::GatherObject, "_OreMoonMeteor" }; SimpleFilter WhiteIronChunk = { app::EntityType__Enum_1::GatherObject, "_OreMetal" }; SimpleFilter DunlinsTooth = { app::EntityType__Enum_1::GatherObject, "_DunlinsTooth" }; + + SimpleFilter AmethystLumpDrop = { app::EntityType__Enum_1::GatherObject, "_Thundercrystaldrop" }; + SimpleFilter CrystalChunkDrop = { app::EntityType__Enum_1::GatherObject,"_Drop_Crystal"}; + SimpleFilter ElectroCrystalDrop = { app::EntityType__Enum_1::GatherObject, "_Drop_Ore_ElectricRock" }; + SimpleFilter IronChunkDrop = { app::EntityType__Enum_1::GatherObject, "_Drop_Stone" }; + SimpleFilter NoctilucousJadeDrop = { app::EntityType__Enum_1::GatherObject,"_NightBerth" }; + SimpleFilter MagicalCrystalChunkDrop = { app::EntityType__Enum_1::GatherObject, "_DropMagicCrystal" }; + SimpleFilter ScarletQuartzDrop = { app::EntityType__Enum_1::GatherObject, "_DropDulinsBlood" }; + SimpleFilter StarsilverDrop = { app::EntityType__Enum_1::GatherObject, "_DropMoonMeteor" }; + SimpleFilter WhiteIronChunkDrop = { app::EntityType__Enum_1::GatherObject, "_Drop_Metal" }; } namespace monster @@ -193,6 +214,7 @@ namespace cheat::game::filters SimpleFilter BambooShoot = { app::EntityType__Enum_1::GatherObject, "_Bambooshoot" }; SimpleFilter Berry = { app::EntityType__Enum_1::GatherObject, "_Raspberry" }; SimpleFilter CallaLily = { app::EntityType__Enum_1::GatherObject, "_Plant_Callas" }; + SimpleFilter Cabbage = { app::EntityType__Enum_1::GatherObject, "_Plant_Cabbage" }; SimpleFilter Carrot = { app::EntityType__Enum_1::GatherObject, "_Plant_Carrot" }; SimpleFilter Cecilia = { app::EntityType__Enum_1::GatherObject, "_Cecilia" }; SimpleFilter DandelionSeed = { app::EntityType__Enum_1::GatherObject, "_Plant_Dandelion" }; @@ -211,6 +233,7 @@ namespace cheat::game::filters SimpleFilter NakuWeed = { app::EntityType__Enum_1::GatherObject, "_Howlgrass" }; SimpleFilter PhilanemoMushroom = { app::EntityType__Enum_1::GatherObject, "_WindmilHunter" }; SimpleFilter Pinecone = { app::EntityType__Enum_1::GatherObject, "_Drop_Plant_Pine" }; + SimpleFilter Potato = { app::EntityType__Enum_1::GatherObject, "_Plant_Potato" }; SimpleFilter Qingxin = { app::EntityType__Enum_1::GatherObject, "_QingXin" }; SimpleFilter Radish = { app::EntityType__Enum_1::GatherObject, "_Plant_Radish" }; SimpleFilter SakuraBloom = { app::EntityType__Enum_1::GatherObject, "_Cherrypetals" }; @@ -224,6 +247,7 @@ namespace cheat::game::filters SimpleFilter SweetFlower = { app::EntityType__Enum_1::GatherObject, "_Plant_Whiteballet" }; SimpleFilter Valberry = { app::EntityType__Enum_1::GatherObject, "_DropingBerry_Gather" }; SimpleFilter Violetgrass = { app::EntityType__Enum_1::GatherObject, "_GlazedGrass" }; + SimpleFilter Wheat = { app::EntityType__Enum_1::GatherObject, "_Plant_Wheat" }; SimpleFilter WindwheelAster = { app::EntityType__Enum_1::GatherObject, "_WindmilDaisy" }; SimpleFilter Wolfhook = { app::EntityType__Enum_1::GatherObject, "_GogoFruit" }; } diff --git a/cheat-library/src/user/cheat/game/filters.h b/cheat-library/src/user/cheat/game/filters.h index aafe47e..20617bf 100644 --- a/cheat-library/src/user/cheat/game/filters.h +++ b/cheat-library/src/user/cheat/game/filters.h @@ -32,6 +32,16 @@ namespace cheat::game::filters extern ChestFilter STrap; } + namespace equipment + { + extern SimpleFilter Artifacts; + extern SimpleFilter Bow; + extern SimpleFilter Claymore; + extern SimpleFilter Catalyst; + extern SimpleFilter Pole; + extern SimpleFilter Sword; + } + namespace featured { extern SimpleFilter Anemoculus; @@ -94,6 +104,7 @@ namespace cheat::game::filters extern SimpleFilter Weasel; extern SimpleFilter Kitsune; extern SimpleFilter BakeDanuki; + extern SimpleFilter Meat; } namespace mineral @@ -111,6 +122,16 @@ namespace cheat::game::filters extern SimpleFilter Starsilver; extern SimpleFilter WhiteIronChunk; extern SimpleFilter DunlinsTooth; + + extern SimpleFilter AmethystLumpDrop; + extern SimpleFilter CrystalChunkDrop; + extern SimpleFilter ElectroCrystalDrop; + extern SimpleFilter IronChunkDrop; + extern SimpleFilter NoctilucousJadeDrop; + extern SimpleFilter MagicalCrystalChunkDrop; + extern SimpleFilter ScarletQuartzDrop; + extern SimpleFilter StarsilverDrop; + extern SimpleFilter WhiteIronChunkDrop; } namespace monster @@ -189,6 +210,7 @@ namespace cheat::game::filters extern SimpleFilter Apple; extern SimpleFilter BambooShoot; extern SimpleFilter Berry; + extern SimpleFilter Cabbage; extern SimpleFilter CallaLily; extern SimpleFilter Carrot; extern SimpleFilter Cecilia; @@ -208,6 +230,7 @@ namespace cheat::game::filters extern SimpleFilter NakuWeed; extern SimpleFilter PhilanemoMushroom; extern SimpleFilter Pinecone; + extern SimpleFilter Potato; extern SimpleFilter Qingxin; extern SimpleFilter Radish; extern SimpleFilter SakuraBloom; @@ -221,6 +244,7 @@ namespace cheat::game::filters extern SimpleFilter SweetFlower; extern SimpleFilter Valberry; extern SimpleFilter Violetgrass; + extern SimpleFilter Wheat; extern SimpleFilter WindwheelAster; extern SimpleFilter Wolfhook; } From f70423447f2f184738b413df5ca9c05840496351 Mon Sep 17 00:00:00 2001 From: HarrySilan Date: Wed, 6 Jul 2022 12:35:14 +0800 Subject: [PATCH 8/9] use existing implementations --- .../src/user/cheat/world/VacuumLoot.cpp | 256 +++++++++++------- .../src/user/cheat/world/VacuumLoot.h | 20 +- 2 files changed, 171 insertions(+), 105 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 2ff04e9..0637a7c 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -6,26 +6,18 @@ #include #include -// Returns the unique categories (i.e. the third element of every tuple) in a filter object. -static std::vector uniqueCategories(const std::vector, std::string, std::string>>& filter) -{ - std::vector result; - std::transform(filter.begin(), filter.end(), std::back_inserter(result), - [](const auto& item) {return std::get<2>(item); }); - std::sort(result.begin(), result.end()); - auto it = std::unique(result.begin(), result.end()); - result.erase(it, result.end()); - return result; -} - namespace cheat::feature { VacuumLoot::VacuumLoot() : Feature(), - NF(f_Enabled, "Vacuum Loot", "VacuumLoot", false) - { + NF(f_Enabled, "Vacuum Loot", "VacuumLoot", false), + NF(f_DelayTime, "Delay time (in ms)", "VacuumLoot", 1000), + NF(f_Distance, "Distance", "VacuumLoot", 1.5f), + NF(f_Radius, "Radius", "VacuumLoot", 20.0f), + nextTime(0) + { InstallFilters(); - events::GameUpdateEvent += MY_METHOD_HANDLER(VacuumLoot::OnGameUpdate); - } + events::GameUpdateEvent += MY_METHOD_HANDLER(VacuumLoot::OnGameUpdate); + } const FeatureGUIInfo& VacuumLoot::GetGUIInfo() const { @@ -33,34 +25,28 @@ namespace cheat::feature return info; } - void VacuumLoot::DrawMain() - { - if (ImGui::BeginGroupPanel("Vacuum Loot", false)) - { - ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); - if (ImGui::TreeNode(this, "Loot Types")) - { - for (const auto& groupCategory : uniqueCategories(m_Filters)) - { - if (ImGui::BeginGroupPanel(groupCategory.c_str(), false)) - { - for (auto& [field, name, category] : m_Filters) - { - if (category == groupCategory) - { - ImGui::PushID(name.c_str()); - ConfigWidget(field); - ImGui::PopID(); - } - } - } - ImGui::EndGroupPanel(); - } - ImGui::TreePop(); - } - } - ImGui::EndGroupPanel(); - } + void VacuumLoot::DrawMain() + { + if (ImGui::BeginGroupPanel("Vacuum Loot", false)) + { + ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); ImGui::SameLine(); ImGui::SetNextItemWidth(100.0f); + ConfigWidget("Delay Time (ms)", f_DelayTime, 1, 0, 1000, "Delay (in ms) between loot vacuum."); + ConfigWidget("Radius (m)", f_Radius, 0.1f, 5.0f, 100.0f, "Radius of loot vacuum."); + ConfigWidget("Distance (m)", f_Distance, 0.1f, 1.0f, 10.0f, "Distance between the player and the loot.\n" + "Values under 1.5 may be too intruding."); + if (ImGui::TreeNode(this, "Loot Types")) + { + for (auto& [section, filters] : m_Sections) + { + ImGui::PushID(section.c_str()); + DrawSection(section, filters); + ImGui::PopID(); + } + ImGui::TreePop(); + } + } + ImGui::EndGroupPanel(); + } bool VacuumLoot::NeedStatusDraw() const { @@ -69,7 +55,7 @@ namespace cheat::feature void VacuumLoot::DrawStatus() { - ImGui::Text ("VacuumLoot"); + ImGui::Text("VacuumLoot"); } VacuumLoot& VacuumLoot::GetInstance() @@ -80,74 +66,148 @@ namespace cheat::feature bool VacuumLoot::IsEntityForVac(game::Entity* entity) { + bool entityValid = std::any_of(m_Sections.begin(), m_Sections.end(), + [entity](std::pair const& section) { + return std::any_of(section.second.begin(), section.second.end(), [entity](const FilterInfo& filterInfo) { + return filterInfo.second->IsValid(entity) && filterInfo.first; }); + }); + + if (!entityValid)return false; + auto& manager = game::EntityManager::instance(); auto distance = manager.avatar()->distance(entity); - float radius = 100.0f; - for (const auto& [field, name, category] : m_Filters) - if (field.value()) - if (entity->name().find(name) != std::string::npos) - return distance <= radius; - - return false; + return distance <= f_Radius; } - void VacuumLoot::OnGameUpdate() - { - if (!f_Enabled) - return; + void VacuumLoot::OnGameUpdate() + { + if (!f_Enabled) + return; auto currentTime = util::GetCurrentTimeMillisec(); if (currentTime < nextTime) return; - auto& manager = game::EntityManager::instance(); + auto& manager = game::EntityManager::instance(); auto avatarEntity = manager.avatar(); - for (const auto& entity : manager.entities()) - { - if (!IsEntityForVac(entity)) - continue; + for (const auto& entity : manager.entities()) + { + if (!IsEntityForVac(entity)) + continue; - entity->setRelativePosition(avatarEntity->relativePosition()); - } - nextTime = currentTime + 1000; - } - - void VacuumLoot::AddFilter(const std::string& friendName, - const std::string& name, - const std::string& category) - { - m_Filters.push_back({ - config::CreateField(friendName, name, "VacuumLoot::Filters", false, true), - name, category - }); + entity->setRelativePosition(avatarEntity->relativePosition() + avatarEntity->forward() * f_Distance); + } + nextTime = currentTime + f_DelayTime.value(); } + void VacuumLoot::AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter) + { + if (m_Sections.count(section) == 0) + m_Sections[section] = {}; + + auto& filters = m_Sections[section]; + bool newItem(filter); + filters.push_back({ config::CreateField(name,name,fmt::format("VacuumLoot::Filters::{}", section),false, newItem) , filter }); + } + + void VacuumLoot::DrawSection(const std::string& section, const Filters& filters) + { + bool checked = std::all_of(filters.begin(), filters.end(), [](const FilterInfo& filter) { return filter.first; }); + bool changed = false; + + if (ImGui::BeginSelectableGroupPanel(section.c_str(), checked, changed, true)) + { + // TODO : Get Max Container Width and Calculate Max Item Width of Checkbox + Text / or specify same width for all columns + // then divide MaxWidth by ItemWidth/ColumnWidth and asign a floor result >= 1 to columns. + // Though this is also just fine IMO. + + int columns = 3; + + if (ImGui::BeginTable(section.c_str(), columns == 0 ? 1 : columns )) { + int i = 0; + for (std::pair, game::IEntityFilter*> filter : filters) { + + if (i % (columns == 0 ? 1 : columns) == 0) + { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + } + else + ImGui::TableNextColumn(); + + ImGui::PushID(&filter); + ConfigWidget(filter.first); + ImGui::PopID(); + i++; + } + ImGui::EndTable(); + } + } + ImGui::EndSelectableGroupPanel(); + + if (changed) + { + for (const auto& info : filters) + { + info.first.value() = checked; + info.first.FireChanged(); + } + } + } + +#define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##) void VacuumLoot::InstallFilters() { - AddFilter("General loot", "SceneObj_DropItem" ,"General"); - AddFilter("Ore Drops", "SceneObj_Ore_Drop" ,"Ore"); - AddFilter("Magic Crystal", "_DropMagicCrystal" ,"Ore"); - AddFilter("Amethyst Lump", "_Thundercrystaldrop" ,"Ore"); - AddFilter("Electro Crystal", "_Ore_ElectricRock" ,"Ore"); - AddFilter("Starsilver Ore", "_DropMoonMeteor_" ,"Ore"); - AddFilter("Noctilucous Jade", "NightBerth" ,"Ore"); - AddFilter("Potatoes", "_Potato" ,"Food"); - AddFilter("Radish", "_Radish02_Clear" ,"Food"); - AddFilter("Cabbage", "_Cabbage" ,"Food"); - AddFilter("Carrot", "_Carrot02_Clear" ,"Food"); - AddFilter("Wheat", "_Wheat" ,"Food"); - AddFilter("Crystalflies", "Wisp" ,"General"); - AddFilter("Meat & Fowl", "Meat" ,"Food"); - AddFilter("Fishmeat", "Fishmeat" ,"Food"); - AddFilter("Crab", "Crab" ,"Food"); - AddFilter("Eel", "Eel_" ,"Food"); - AddFilter("Lizard", "Lizard" ,"General"); - AddFilter("Swords", "Equip_Sword" ,"Equipment"); - AddFilter("Poles", "Equip_Pole" ,"Equipment"); - AddFilter("Bows", "Equip_Bow" ,"Equipment"); - AddFilter("Catalysts", "Equip_Catalyst" ,"Equipment"); - AddFilter("Claymores", "Equip_Claymore" ,"Equipment"); - AddFilter("Butterflies & Fireflies", "Eff_Animal" ,"General"); + // Add more in the future + + ADD_FILTER_FIELD(featured, ItemDrops); + + ADD_FILTER_FIELD(mineral, AmethystLump); + ADD_FILTER_FIELD(mineral, ArchaicStone); + ADD_FILTER_FIELD(mineral, CorLapis); + ADD_FILTER_FIELD(mineral, CrystalChunk); + ADD_FILTER_FIELD(mineral, CrystalMarrow); + ADD_FILTER_FIELD(mineral, ElectroCrystal); + ADD_FILTER_FIELD(mineral, IronChunk); + ADD_FILTER_FIELD(mineral, NoctilucousJade); + ADD_FILTER_FIELD(mineral, MagicalCrystalChunk); + ADD_FILTER_FIELD(mineral, ScarletQuartz); + ADD_FILTER_FIELD(mineral, Starsilver); + ADD_FILTER_FIELD(mineral, WhiteIronChunk); + ADD_FILTER_FIELD(mineral, DunlinsTooth); + + // Ores that drops as a loot when destroyed + ADD_FILTER_FIELD(mineral, AmethystLumpDrop); + ADD_FILTER_FIELD(mineral, CrystalChunkDrop); + ADD_FILTER_FIELD(mineral, ElectroCrystalDrop); + ADD_FILTER_FIELD(mineral, IronChunkDrop); + ADD_FILTER_FIELD(mineral, NoctilucousJadeDrop); + ADD_FILTER_FIELD(mineral, MagicalCrystalChunkDrop); + ADD_FILTER_FIELD(mineral, ScarletQuartzDrop); + ADD_FILTER_FIELD(mineral, StarsilverDrop); + ADD_FILTER_FIELD(mineral, WhiteIronChunkDrop); + + ADD_FILTER_FIELD(plant, Apple); + ADD_FILTER_FIELD(plant, Cabbage); + ADD_FILTER_FIELD(plant, Carrot); + ADD_FILTER_FIELD(plant, Potato); + ADD_FILTER_FIELD(plant, Radish); + ADD_FILTER_FIELD(plant, Sunsettia); + ADD_FILTER_FIELD(plant, Wheat); + + ADD_FILTER_FIELD(living, CrystalCore); + ADD_FILTER_FIELD(living, Meat); + ADD_FILTER_FIELD(living, Crab); + ADD_FILTER_FIELD(living, Eel); + ADD_FILTER_FIELD(living, LizardTail); + + ADD_FILTER_FIELD(equipment, Artifacts); + ADD_FILTER_FIELD(equipment, Bow); + ADD_FILTER_FIELD(equipment, Catalyst); + ADD_FILTER_FIELD(equipment, Claymore); + ADD_FILTER_FIELD(equipment, Sword); + ADD_FILTER_FIELD(equipment, Pole); } +#undef ADD_FILTER_FIELD } diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.h b/cheat-library/src/user/cheat/world/VacuumLoot.h index f74e54d..6a7a81b 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.h +++ b/cheat-library/src/user/cheat/world/VacuumLoot.h @@ -5,14 +5,17 @@ #include #include #include +#include namespace cheat::feature { - class VacuumLoot : public Feature { public: config::Field> f_Enabled; + config::Field f_Distance; + config::Field f_Radius; + config::Field f_DelayTime; static VacuumLoot& GetInstance(); @@ -25,14 +28,17 @@ namespace cheat::feature void OnGameUpdate(); private: - // Tuple of: enabled flag, human-readable name, filter category - using LootFilter = std::tuple, std::string, std::string>; - std::vector m_Filters; - int nextTime = 0; + using FilterInfo = std::pair, game::IEntityFilter*>; + using Filters = std::vector; + using Sections = std::map; + + Sections m_Sections; + SafeValue nextTime; VacuumLoot(); + void DrawSection(const std::string& section, const Filters& filters); void InstallFilters(); - void AddFilter(const std::string& friendName, const std::string& name, const std::string& category); + void AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter); bool IsEntityForVac(cheat::game::Entity* entity); }; -} +} \ No newline at end of file From fdb7457e41d8ed2ae5d2bf9e8686d58b0becfc6e Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Wed, 6 Jul 2022 11:54:36 +0100 Subject: [PATCH 9/9] Disabled vacuum for mineral chunks + some cleanup --- .../src/user/cheat/world/VacuumLoot.cpp | 48 ++++++++++--------- .../src/user/cheat/world/VacuumLoot.h | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.cpp b/cheat-library/src/user/cheat/world/VacuumLoot.cpp index 493cf92..851bc39 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.cpp +++ b/cheat-library/src/user/cheat/world/VacuumLoot.cpp @@ -66,6 +66,8 @@ namespace cheat::feature bool VacuumLoot::IsEntityForVac(game::Entity* entity) { + // Go through all sections. For each section, go through all filters. + // If a filter matches the given entity and that filter is enabled, return true. bool entityValid = std::any_of(m_Sections.begin(), m_Sections.end(), [entity](std::pair const& section) { return std::any_of(section.second.begin(), section.second.end(), [entity](const FilterInfo& filterInfo) { @@ -102,16 +104,6 @@ namespace cheat::feature nextTime = currentTime + f_DelayTime.value(); } - void VacuumLoot::AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter) - { - if (m_Sections.count(section) == 0) - m_Sections[section] = {}; - - auto& filters = m_Sections[section]; - bool newItem(filter); - filters.push_back({ config::CreateField(name,name,fmt::format("VacuumLoot::Filters::{}", section),false, newItem) , filter }); - } - void VacuumLoot::DrawSection(const std::string& section, const Filters& filters) { bool checked = std::all_of(filters.begin(), filters.end(), [](const FilterInfo& filter) { return filter.first; }); @@ -157,6 +149,16 @@ namespace cheat::feature } } + void VacuumLoot::AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter) + { + if (m_Sections.count(section) == 0) + m_Sections[section] = {}; + + auto& filters = m_Sections[section]; + bool newItem(filter); + filters.push_back({ config::CreateField(name,name,fmt::format("VacuumLoot::Filters::{}", section),false, newItem) , filter }); + } + #define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##) void VacuumLoot::InstallFilters() { @@ -164,19 +166,19 @@ namespace cheat::feature ADD_FILTER_FIELD(featured, ItemDrops); - ADD_FILTER_FIELD(mineral, AmethystLump); - ADD_FILTER_FIELD(mineral, ArchaicStone); - ADD_FILTER_FIELD(mineral, CorLapis); - ADD_FILTER_FIELD(mineral, CrystalChunk); - ADD_FILTER_FIELD(mineral, CrystalMarrow); - ADD_FILTER_FIELD(mineral, ElectroCrystal); - ADD_FILTER_FIELD(mineral, IronChunk); - ADD_FILTER_FIELD(mineral, NoctilucousJade); - ADD_FILTER_FIELD(mineral, MagicalCrystalChunk); - ADD_FILTER_FIELD(mineral, ScarletQuartz); - ADD_FILTER_FIELD(mineral, Starsilver); - ADD_FILTER_FIELD(mineral, WhiteIronChunk); - ADD_FILTER_FIELD(mineral, DunlinsTooth); + // ADD_FILTER_FIELD(mineral, AmethystLump); + // ADD_FILTER_FIELD(mineral, ArchaicStone); + // ADD_FILTER_FIELD(mineral, CorLapis); + // ADD_FILTER_FIELD(mineral, CrystalChunk); + // ADD_FILTER_FIELD(mineral, CrystalMarrow); + // ADD_FILTER_FIELD(mineral, ElectroCrystal); + // ADD_FILTER_FIELD(mineral, IronChunk); + // ADD_FILTER_FIELD(mineral, NoctilucousJade); + // ADD_FILTER_FIELD(mineral, MagicalCrystalChunk); + // ADD_FILTER_FIELD(mineral, ScarletQuartz); + // ADD_FILTER_FIELD(mineral, Starsilver); + // ADD_FILTER_FIELD(mineral, WhiteIronChunk); + // ADD_FILTER_FIELD(mineral, DunlinsTooth); // Ores that drops as a loot when destroyed ADD_FILTER_FIELD(mineral, AmethystLumpDrop); diff --git a/cheat-library/src/user/cheat/world/VacuumLoot.h b/cheat-library/src/user/cheat/world/VacuumLoot.h index 6a7a81b..007d4bb 100644 --- a/cheat-library/src/user/cheat/world/VacuumLoot.h +++ b/cheat-library/src/user/cheat/world/VacuumLoot.h @@ -41,4 +41,4 @@ namespace cheat::feature void AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter); bool IsEntityForVac(cheat::game::Entity* entity); }; -} \ No newline at end of file +}