mirror of
https://github.com/SunsetMkt/Akebi-GC.git
synced 2025-01-09 02:53:43 +08:00
Merge pull request #244 from biswop/vacuum-change
added Mob Drop Radius to vacuum and added RadishDrop and CarrotDrop to filter
This commit is contained in:
commit
f3a0f88de1
@ -256,6 +256,8 @@ namespace cheat::game::filters
|
|||||||
SimpleFilter Wheat = { EntityType__Enum_1::GatherObject, "_Plant_Wheat" };
|
SimpleFilter Wheat = { EntityType__Enum_1::GatherObject, "_Plant_Wheat" };
|
||||||
SimpleFilter WindwheelAster = { EntityType__Enum_1::GatherObject, "_WindmilDaisy" };
|
SimpleFilter WindwheelAster = { EntityType__Enum_1::GatherObject, "_WindmilDaisy" };
|
||||||
SimpleFilter Wolfhook = { EntityType__Enum_1::GatherObject, "_GogoFruit" };
|
SimpleFilter Wolfhook = { EntityType__Enum_1::GatherObject, "_GogoFruit" };
|
||||||
|
SimpleFilter RadishDrop = { EntityType__Enum_1::GatherObject, "_Plant_Carrot02_Clear" };
|
||||||
|
SimpleFilter CarrotDrop = { EntityType__Enum_1::GatherObject, "_Plant_Radish02_Clear" };
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace puzzle
|
namespace puzzle
|
||||||
|
@ -253,6 +253,8 @@ namespace cheat::game::filters
|
|||||||
extern SimpleFilter Wheat;
|
extern SimpleFilter Wheat;
|
||||||
extern SimpleFilter WindwheelAster;
|
extern SimpleFilter WindwheelAster;
|
||||||
extern SimpleFilter Wolfhook;
|
extern SimpleFilter Wolfhook;
|
||||||
|
extern SimpleFilter RadishDrop;
|
||||||
|
extern SimpleFilter CarrotDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace puzzle
|
namespace puzzle
|
||||||
@ -261,7 +263,7 @@ namespace cheat::game::filters
|
|||||||
extern SimpleFilter BakeDanuki;
|
extern SimpleFilter BakeDanuki;
|
||||||
extern SimpleFilter BloattyFloatty;
|
extern SimpleFilter BloattyFloatty;
|
||||||
extern WhitelistFilter CubeDevices;
|
extern WhitelistFilter CubeDevices;
|
||||||
|
|
||||||
extern SimpleFilter EightStoneTablets;
|
extern SimpleFilter EightStoneTablets;
|
||||||
extern SimpleFilter ElectricConduction;
|
extern SimpleFilter ElectricConduction;
|
||||||
extern SimpleFilter RelayStone;
|
extern SimpleFilter RelayStone;
|
||||||
@ -308,7 +310,7 @@ namespace cheat::game::filters
|
|||||||
extern SimpleFilter MonsterBosses;
|
extern SimpleFilter MonsterBosses;
|
||||||
extern SimpleFilter MonsterShielded;
|
extern SimpleFilter MonsterShielded;
|
||||||
extern SimpleFilter MonsterEquips;
|
extern SimpleFilter MonsterEquips;
|
||||||
extern BlacklistFilter Living;
|
extern BlacklistFilter Living;
|
||||||
extern SimpleFilter OrganicTargets;
|
extern SimpleFilter OrganicTargets;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,10 +9,11 @@
|
|||||||
namespace cheat::feature
|
namespace cheat::feature
|
||||||
{
|
{
|
||||||
VacuumLoot::VacuumLoot() : 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_DelayTime, "Delay time (in ms)", "VacuumLoot", 1000),
|
||||||
NF(f_Distance, "Distance", "VacuumLoot", 1.5f),
|
NF(f_Distance, "Distance", "VacuumLoot", 1.5f),
|
||||||
NF(f_Radius, "Radius", "VacuumLoot", 20.0f),
|
NF(f_MobDropRadius, "Mob Drop Radius", "VacuumLoot", 20.0f),
|
||||||
|
NF(f_Radius, "Radius", "VacuumLoot", 20.0f),
|
||||||
nextTime(0)
|
nextTime(0)
|
||||||
{
|
{
|
||||||
InstallFilters();
|
InstallFilters();
|
||||||
@ -21,20 +22,21 @@ namespace cheat::feature
|
|||||||
|
|
||||||
const FeatureGUIInfo& VacuumLoot::GetGUIInfo() const
|
const FeatureGUIInfo& VacuumLoot::GetGUIInfo() const
|
||||||
{
|
{
|
||||||
static const FeatureGUIInfo info{ "", "World", true };
|
static const FeatureGUIInfo info{ "Vacuum Loot", "World", true };
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VacuumLoot::DrawMain()
|
void VacuumLoot::DrawMain()
|
||||||
{
|
{
|
||||||
if (ImGui::BeginGroupPanel("Vacuum Loot", false))
|
|
||||||
{
|
|
||||||
ConfigWidget("Enabled", f_Enabled, "Vacuum Loot drops"); ImGui::SameLine(); ImGui::SetNextItemWidth(100.0f);
|
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("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("Radius (m)", f_Radius, 0.1f, 5.0f, 100.0f, "Radius of common loot vacuum.");
|
||||||
|
ConfigWidget("Mob Drop Radius (m)", f_MobDropRadius, 0.1f, 5.0f, 100.0f, "Radius of mob drop vacuum.\n"
|
||||||
|
"(Item Drops and Equipments)");
|
||||||
ConfigWidget("Distance (m)", f_Distance, 0.1f, 1.0f, 10.0f, "Distance between the player and the loot.\n"
|
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.");
|
"Values under 1.5 may be too intruding.");
|
||||||
if (ImGui::TreeNode(this, "Loot Types"))
|
if (ImGui::TreeNode("Loot Types"))
|
||||||
{
|
{
|
||||||
for (auto& [section, filters] : m_Sections)
|
for (auto& [section, filters] : m_Sections)
|
||||||
{
|
{
|
||||||
@ -44,8 +46,6 @@ namespace cheat::feature
|
|||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui::EndGroupPanel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VacuumLoot::NeedStatusDraw() const
|
bool VacuumLoot::NeedStatusDraw() const
|
||||||
@ -55,7 +55,12 @@ namespace cheat::feature
|
|||||||
|
|
||||||
void VacuumLoot::DrawStatus()
|
void VacuumLoot::DrawStatus()
|
||||||
{
|
{
|
||||||
ImGui::Text("VacuumLoot");
|
ImGui::Text("VacuumLoot\n[%dms|%.01fm|%.01fm|%.01fm]",
|
||||||
|
f_DelayTime.value(),
|
||||||
|
f_Radius.value(),
|
||||||
|
f_MobDropRadius.value(),
|
||||||
|
f_Distance.value()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
VacuumLoot& VacuumLoot::GetInstance()
|
VacuumLoot& VacuumLoot::GetInstance()
|
||||||
@ -68,18 +73,22 @@ namespace cheat::feature
|
|||||||
{
|
{
|
||||||
// Go through all sections. For each section, go through all filters.
|
// 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.
|
// 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(),
|
bool entityValid = std::any_of(m_Sections.begin(), m_Sections.end(),
|
||||||
[entity](std::pair<std::string, Filters> const& section) {
|
[entity](std::pair<std::string, Filters> const& section) {
|
||||||
return std::any_of(section.second.begin(), section.second.end(), [entity](const FilterInfo& filterInfo) {
|
return std::any_of(section.second.begin(), section.second.end(), [entity](const FilterInfo& filterInfo) {
|
||||||
return filterInfo.second->IsValid(entity) && filterInfo.first; });
|
return filterInfo.second->IsValid(entity) && filterInfo.first; });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!entityValid)return false;
|
if (!entityValid) return false;
|
||||||
|
|
||||||
|
bool isMobDrop = std::any_of(m_MobDropFilter.begin(), m_MobDropFilter.end(),
|
||||||
|
[entity](const game::IEntityFilter* filter) { return filter->IsValid(entity); });
|
||||||
|
|
||||||
auto& manager = game::EntityManager::instance();
|
auto& manager = game::EntityManager::instance();
|
||||||
auto distance = manager.avatar()->distance(entity);
|
auto distance = manager.avatar()->distance(entity);
|
||||||
|
|
||||||
return distance <= f_Radius;
|
return distance <= (isMobDrop ? f_MobDropRadius : f_Radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VacuumLoot::OnGameUpdate()
|
void VacuumLoot::OnGameUpdate()
|
||||||
@ -93,7 +102,6 @@ namespace cheat::feature
|
|||||||
|
|
||||||
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))
|
||||||
@ -120,13 +128,13 @@ namespace cheat::feature
|
|||||||
if (ImGui::BeginTable(section.c_str(), columns == 0 ? 1 : columns )) {
|
if (ImGui::BeginTable(section.c_str(), columns == 0 ? 1 : columns )) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::pair<config::Field<bool>, game::IEntityFilter*> filter : filters) {
|
for (std::pair<config::Field<bool>, game::IEntityFilter*> filter : filters) {
|
||||||
|
|
||||||
if (i % (columns == 0 ? 1 : columns) == 0)
|
if (i % (columns == 0 ? 1 : columns) == 0)
|
||||||
{
|
{
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
ImGui::PushID(&filter);
|
ImGui::PushID(&filter);
|
||||||
@ -147,6 +155,7 @@ namespace cheat::feature
|
|||||||
info.first.FireChanged();
|
info.first.FireChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VacuumLoot::AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter)
|
void VacuumLoot::AddFilter(const std::string& section, const std::string& name, game::IEntityFilter* filter)
|
||||||
@ -162,25 +171,15 @@ namespace cheat::feature
|
|||||||
#define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##)
|
#define ADD_FILTER_FIELD(section, name) AddFilter(util::MakeCapital(#section), util::SplitWords(#name), &game::filters::##section##::##name##)
|
||||||
void VacuumLoot::InstallFilters()
|
void VacuumLoot::InstallFilters()
|
||||||
{
|
{
|
||||||
// Add more in the future
|
|
||||||
|
|
||||||
ADD_FILTER_FIELD(featured, ItemDrops);
|
ADD_FILTER_FIELD(featured, ItemDrops);
|
||||||
|
|
||||||
// ADD_FILTER_FIELD(mineral, AmethystLump);
|
ADD_FILTER_FIELD(equipment, Artifacts);
|
||||||
// ADD_FILTER_FIELD(mineral, ArchaicStone);
|
ADD_FILTER_FIELD(equipment, Bow);
|
||||||
// ADD_FILTER_FIELD(mineral, CorLapis);
|
ADD_FILTER_FIELD(equipment, Catalyst);
|
||||||
// ADD_FILTER_FIELD(mineral, CrystalChunk);
|
ADD_FILTER_FIELD(equipment, Claymore);
|
||||||
// ADD_FILTER_FIELD(mineral, CrystalMarrow);
|
ADD_FILTER_FIELD(equipment, Sword);
|
||||||
// ADD_FILTER_FIELD(mineral, ElectroCrystal);
|
ADD_FILTER_FIELD(equipment, Pole);
|
||||||
// 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, AmethystLumpDrop);
|
||||||
ADD_FILTER_FIELD(mineral, CrystalChunkDrop);
|
ADD_FILTER_FIELD(mineral, CrystalChunkDrop);
|
||||||
ADD_FILTER_FIELD(mineral, ElectroCrystalDrop);
|
ADD_FILTER_FIELD(mineral, ElectroCrystalDrop);
|
||||||
@ -193,9 +192,9 @@ namespace cheat::feature
|
|||||||
|
|
||||||
ADD_FILTER_FIELD(plant, Apple);
|
ADD_FILTER_FIELD(plant, Apple);
|
||||||
ADD_FILTER_FIELD(plant, Cabbage);
|
ADD_FILTER_FIELD(plant, Cabbage);
|
||||||
ADD_FILTER_FIELD(plant, Carrot);
|
ADD_FILTER_FIELD(plant, CarrotDrop);
|
||||||
ADD_FILTER_FIELD(plant, Potato);
|
ADD_FILTER_FIELD(plant, Potato);
|
||||||
ADD_FILTER_FIELD(plant, Radish);
|
ADD_FILTER_FIELD(plant, RadishDrop);
|
||||||
ADD_FILTER_FIELD(plant, Sunsettia);
|
ADD_FILTER_FIELD(plant, Sunsettia);
|
||||||
ADD_FILTER_FIELD(plant, Wheat);
|
ADD_FILTER_FIELD(plant, Wheat);
|
||||||
|
|
||||||
@ -204,13 +203,7 @@ namespace cheat::feature
|
|||||||
ADD_FILTER_FIELD(living, Crab);
|
ADD_FILTER_FIELD(living, Crab);
|
||||||
ADD_FILTER_FIELD(living, Eel);
|
ADD_FILTER_FIELD(living, Eel);
|
||||||
ADD_FILTER_FIELD(living, LizardTail);
|
ADD_FILTER_FIELD(living, LizardTail);
|
||||||
|
ADD_FILTER_FIELD(living, Fish);
|
||||||
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
|
#undef ADD_FILTER_FIELD
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace cheat::feature
|
|||||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||||
config::Field<float> f_Distance;
|
config::Field<float> f_Distance;
|
||||||
config::Field<float> f_Radius;
|
config::Field<float> f_Radius;
|
||||||
|
config::Field<float> f_MobDropRadius;
|
||||||
config::Field<int> f_DelayTime;
|
config::Field<int> f_DelayTime;
|
||||||
|
|
||||||
static VacuumLoot& GetInstance();
|
static VacuumLoot& GetInstance();
|
||||||
@ -35,6 +36,16 @@ namespace cheat::feature
|
|||||||
Sections m_Sections;
|
Sections m_Sections;
|
||||||
SafeValue<int64_t> nextTime;
|
SafeValue<int64_t> nextTime;
|
||||||
|
|
||||||
|
const std::vector<game::IEntityFilter*> m_MobDropFilter = {
|
||||||
|
& game::filters::featured::ItemDrops,
|
||||||
|
& game::filters::equipment::Artifacts,
|
||||||
|
& game::filters::equipment::Bow,
|
||||||
|
& game::filters::equipment::Catalyst,
|
||||||
|
& game::filters::equipment::Claymore,
|
||||||
|
& game::filters::equipment::Pole,
|
||||||
|
& game::filters::equipment::Sword
|
||||||
|
};
|
||||||
|
|
||||||
VacuumLoot();
|
VacuumLoot();
|
||||||
void DrawSection(const std::string& section, const Filters& filters);
|
void DrawSection(const std::string& section, const Filters& filters);
|
||||||
void InstallFilters();
|
void InstallFilters();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user