Merge pull request #72 from WitchGod/master

Added ore and some other items to Attack Modifiers.
This commit is contained in:
Callow 2022-06-12 16:04:10 +03:00 committed by GitHub
commit ae055c873d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,6 +183,17 @@ namespace cheat::feature
return attackerID == avatarID || IsAvatarOwner(attacker); return attackerID == avatarID || IsAvatarOwner(attacker);
} }
bool IsValidByFilter(game::Entity* entity)
{
if (game::filters::combined::OrganicTargets.IsValid(entity) ||
game::filters::combined::Ores.IsValid(entity) ||
game::filters::puzzle::Geogranum.IsValid(entity) ||
game::filters::puzzle::LargeRockPile.IsValid(entity) ||
game::filters::puzzle::SmallRockPile.IsValid(entity))
return true;
return false;
}
// Raises when any entity do hit event. // Raises when any entity do hit event.
// Just recall attack few times (regulating by combatProp) // Just recall attack few times (regulating by combatProp)
// It's not tested well, so, I think, anticheat can detect it. // It's not tested well, so, I think, anticheat can detect it.
@ -196,7 +207,7 @@ namespace cheat::feature
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
auto originalTarget = manager.entity(targetID); auto originalTarget = manager.entity(targetID);
if (!game::filters::combined::OrganicTargets.IsValid(originalTarget)) if (!IsValidByFilter(originalTarget))
return CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, targetID, attackResult, ignoreCheckCanBeHitInMP, method); return CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, targetID, attackResult, ignoreCheckCanBeHitInMP, method);
std::vector<cheat::game::Entity*> validEntities; std::vector<cheat::game::Entity*> validEntities;
@ -204,16 +215,22 @@ namespace cheat::feature
if (rapidFire.f_MultiTarget) if (rapidFire.f_MultiTarget)
{ {
auto filteredEntities = manager.entities(game::filters::combined::Monsters); auto filteredEntities = manager.entities();
for (const auto& entity : filteredEntities) { for (const auto& entity : filteredEntities) {
auto distance = originalTarget->distance(entity); auto distance = originalTarget->distance(entity);
if (entity->runtimeID() == manager.avatar()->runtimeID())
continue;
if (entity->runtimeID() == targetID) if (entity->runtimeID() == targetID)
continue; continue;
if (distance > rapidFire.f_MultiTargetRadius) if (distance > rapidFire.f_MultiTargetRadius)
continue; continue;
if (!IsValidByFilter(entity))
continue;
validEntities.push_back(entity); validEntities.push_back(entity);
} }
} }