Merge pull request #596 from WitchGod/master
RF alt, hooked to FireBeingHit instead of DoHitEntity.
This commit is contained in:
commit
5a289b41db
@ -7,12 +7,11 @@
|
||||
namespace cheat::feature
|
||||
{
|
||||
GodMode::GodMode() : Feature(),
|
||||
NFEX(f_Enabled, "God mode", "m_GodMode", "Player", false, false),
|
||||
NF(f_AltGodMode, "Alternative God Mode", "Player", false)
|
||||
NFEX(f_Enabled, "God mode", "m_GodMode", "Player", false, false)
|
||||
{
|
||||
HookManager::install(app::VCHumanoidMove_NotifyLandVelocity, VCHumanoidMove_NotifyLandVelocity_Hook);
|
||||
HookManager::install(app::Miscs_CheckTargetAttackable, Miscs_CheckTargetAttackable_Hook);
|
||||
HookManager::install(app::MoleMole_LCBaseCombat_FireBeingHitEvent, LCBaseCombat_FireBeingHitEvent_Hook);
|
||||
//HookManager::install(app::MoleMole_LCBaseCombat_FireBeingHitEvent, LCBaseCombat_FireBeingHitEvent_Hook);
|
||||
HookManager::install(app::MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp, MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook);
|
||||
}
|
||||
|
||||
@ -24,24 +23,17 @@ namespace cheat::feature
|
||||
|
||||
void GodMode::DrawMain()
|
||||
{
|
||||
ConfigWidget("God Mode", f_Enabled,
|
||||
"Enables god mode, i.e. no incoming damage.\n" \
|
||||
"May not work with some types of damage.");
|
||||
ImGui::Indent();
|
||||
ConfigWidget("Alternative God Mode", f_AltGodMode,
|
||||
"Alternative god mode that ignores incoming damage\n" \
|
||||
"including environmental damage.");
|
||||
ImGui::Unindent();
|
||||
ConfigWidget("God Mode", f_Enabled, "Enables god mode, i.e. no incoming damage including environmental damage.\n");
|
||||
}
|
||||
|
||||
bool GodMode::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled || f_AltGodMode;
|
||||
return f_Enabled;
|
||||
}
|
||||
|
||||
void GodMode::DrawStatus()
|
||||
{
|
||||
ImGui::Text("God Mode%s", f_AltGodMode ? "+Alt " : " ");
|
||||
ImGui::Text("God Mode");
|
||||
}
|
||||
|
||||
GodMode& GodMode::GetInstance()
|
||||
@ -68,7 +60,7 @@ namespace cheat::feature
|
||||
void GodMode::VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method)
|
||||
{
|
||||
auto& gm = GodMode::GetInstance();
|
||||
if ((gm.f_Enabled || gm.f_AltGodMode) && -velocity.y > 13)
|
||||
if (gm.f_Enabled && -velocity.y > 13)
|
||||
{
|
||||
float randAdd = (float)(std::rand() % 1000) / 1000;
|
||||
velocity.y = -8 - randAdd;
|
||||
@ -79,15 +71,15 @@ namespace cheat::feature
|
||||
}
|
||||
|
||||
// Analog function for disable attack damage (Thanks to Taiga74164)
|
||||
void GodMode::LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method)
|
||||
{
|
||||
auto& gm = GodMode::GetInstance();
|
||||
auto& manager = game::EntityManager::instance();
|
||||
if (gm.f_AltGodMode && manager.avatar()->runtimeID() == attackeeRuntimeID)
|
||||
return;
|
||||
//void GodMode::LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method)
|
||||
//{
|
||||
// auto& gm = GodMode::GetInstance();
|
||||
// auto& manager = game::EntityManager::instance();
|
||||
// if (gm.f_AltGodMode && manager.avatar()->runtimeID() == attackeeRuntimeID)
|
||||
// return;
|
||||
|
||||
CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method);
|
||||
}
|
||||
// CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method);
|
||||
//}
|
||||
|
||||
// Environmental damage immunity (Thanks to RELOADED#7236 / GitHub: @34736384)
|
||||
bool GodMode::MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method)
|
||||
@ -100,7 +92,7 @@ namespace cheat::feature
|
||||
|
||||
bool GodMode::NeedBlockHanlerModifierThinkTimeUp(app::Object* arg)
|
||||
{
|
||||
if (!f_AltGodMode)
|
||||
if (!f_Enabled)
|
||||
return false;
|
||||
|
||||
auto actorModifier = CastTo<app::MoleMole_ActorModifier>(arg, *app::MoleMole_ActorModifier__TypeInfo);
|
||||
|
@ -9,7 +9,6 @@ namespace cheat::feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||
config::Field<config::Toggle<Hotkey>> f_AltGodMode;
|
||||
|
||||
static GodMode& GetInstance();
|
||||
|
||||
@ -24,7 +23,7 @@ namespace cheat::feature
|
||||
bool NeedBlockHanlerModifierThinkTimeUp(app::Object* arg);
|
||||
static bool MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method);
|
||||
|
||||
static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method);
|
||||
//static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method);
|
||||
static void VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method);
|
||||
static bool Miscs_CheckTargetAttackable_Hook(app::BaseEntity* attacker, app::BaseEntity* target, MethodInfo* method);
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult,
|
||||
bool ignoreCheckCanBeHitInMP, MethodInfo* method);
|
||||
//static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult, bool ignoreCheckCanBeHitInMP, MethodInfo* method);
|
||||
static void VCAnimatorEvent_HandleProcessItem_Hook(app::MoleMole_VCAnimatorEvent* __this,
|
||||
app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem* processItem,
|
||||
app::AnimatorStateInfo processStateInfo, app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_TriggerMode__Enum mode, MethodInfo* method);
|
||||
static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method);
|
||||
|
||||
RapidFire::RapidFire() : Feature(),
|
||||
NF(f_Enabled, "Attack Multiplier", "RapidFire", false),
|
||||
@ -26,8 +26,9 @@ namespace cheat::feature
|
||||
NF(f_MultiTargetRadius, "Multi-target Radius", "RapidFire", 20.0f),
|
||||
NF(f_MultiAnimation, "Multi-animation", "RapidFire", false)
|
||||
{
|
||||
HookManager::install(app::MoleMole_LCBaseCombat_DoHitEntity, LCBaseCombat_DoHitEntity_Hook);
|
||||
// HookManager::install(app::MoleMole_LCBaseCombat_DoHitEntity, LCBaseCombat_DoHitEntity_Hook); -- Looks like FireBeingHitEvent is superior to this.
|
||||
HookManager::install(app::MoleMole_VCAnimatorEvent_HandleProcessItem, VCAnimatorEvent_HandleProcessItem_Hook);
|
||||
HookManager::install(app::MoleMole_LCBaseCombat_FireBeingHitEvent, LCBaseCombat_FireBeingHitEvent_Hook);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& RapidFire::GetGUIInfo() const
|
||||
@ -223,8 +224,7 @@ namespace cheat::feature
|
||||
// Raises when any entity do hit event.
|
||||
// Just recall attack few times (regulating by combatProp)
|
||||
// It's not tested well, so, I think, anticheat can detect it.
|
||||
static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult,
|
||||
bool ignoreCheckCanBeHitInMP, MethodInfo* method)
|
||||
/*static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult, bool ignoreCheckCanBeHitInMP, MethodInfo* method)
|
||||
{
|
||||
auto attacker = game::Entity(__this->fields._._._entity);
|
||||
RapidFire& rapidFire = RapidFire::GetInstance();
|
||||
@ -273,6 +273,51 @@ namespace cheat::feature
|
||||
}
|
||||
|
||||
CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, targetID, attackResult, ignoreCheckCanBeHitInMP, method);
|
||||
}*/
|
||||
|
||||
static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method)
|
||||
{
|
||||
auto attacker = game::Entity(__this->fields._._._entity);
|
||||
RapidFire& rapidFire = RapidFire::GetInstance();
|
||||
if (!IsConfigByAvatar(attacker) || !IsAttackByAvatar(attacker) || !rapidFire.f_Enabled)
|
||||
return CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method);
|
||||
|
||||
auto& manager = game::EntityManager::instance();
|
||||
auto originalTarget = manager.entity(attackeeRuntimeID);
|
||||
|
||||
if (!IsValidByFilter(originalTarget))
|
||||
return CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method);
|
||||
|
||||
std::vector<cheat::game::Entity*> validEntities;
|
||||
validEntities.push_back(originalTarget);
|
||||
|
||||
if (rapidFire.f_MultiTarget)
|
||||
{
|
||||
auto filteredEntities = manager.entities();
|
||||
for (const auto& entity : filteredEntities) {
|
||||
auto distance = originalTarget->distance(entity);
|
||||
|
||||
if (entity->runtimeID() == manager.avatar()->runtimeID())
|
||||
continue;
|
||||
|
||||
if (entity->runtimeID() == attackeeRuntimeID)
|
||||
continue;
|
||||
|
||||
if (distance > rapidFire.f_MultiTargetRadius)
|
||||
continue;
|
||||
|
||||
if (!IsValidByFilter(entity))
|
||||
continue;
|
||||
|
||||
validEntities.push_back(entity);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& entity : validEntities) {
|
||||
int attackCount = rapidFire.f_MultiHit ? rapidFire.GetAttackCount(__this, entity->runtimeID(), attackResult) : 1;
|
||||
for (int i = 0; i < attackCount; i++)
|
||||
CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, entity->runtimeID(), attackResult, method);
|
||||
}
|
||||
}
|
||||
|
||||
static void VCAnimatorEvent_HandleProcessItem_Hook(app::MoleMole_VCAnimatorEvent* __this,
|
||||
|
Loading…
Reference in New Issue
Block a user