From fdb7457e41d8ed2ae5d2bf9e8686d58b0becfc6e Mon Sep 17 00:00:00 2001 From: Andrei Abrudan Date: Wed, 6 Jul 2022 11:54:36 +0100 Subject: [PATCH] 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 +}