mirror of
https://github.com/ApfelTeeSaft/UnrealEvent.git
synced 2026-08-26 19:33:43 +00:00
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#pragma once
|
|
#include "framework.h"
|
|
|
|
namespace Hooks
|
|
{
|
|
namespace Abilities
|
|
{
|
|
void hkInternalServerTryActivateAbility(UAbilitySystemComponent* ASc, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey& PredictionKey, FGameplayEventData* TriggerEventData)
|
|
{
|
|
FGameplayAbilitySpec* Spec = AbilitiesHandler::FindAbilitySpecFromHandle(ASc, Handle);
|
|
if (!Spec)
|
|
{
|
|
ASc->ClientActivateAbilityFailed(Handle, PredictionKey.Current);
|
|
return;
|
|
}
|
|
|
|
const UGameplayAbility* AbilityToActivate = Spec->Ability;
|
|
|
|
UGameplayAbility* InstancedAbility = nullptr;
|
|
Spec->InputPressed = true;
|
|
|
|
if (Defines::Abilities::InternalTryActivateAbility(ASc, Handle, PredictionKey, &InstancedAbility, nullptr, TriggerEventData))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
ASc->ClientActivateAbilityFailed(Handle, PredictionKey.Current);
|
|
Spec->InputPressed = false;
|
|
ASc->ActivatableAbilities.MarkItemDirty(*Spec);
|
|
}
|
|
}
|
|
|
|
void Initialize()
|
|
{
|
|
auto DefaultObject = UFortAbilitySystemComponentAthena::StaticClass()->DefaultObject;
|
|
HookingManager::VirtualHook(DefaultObject, 0xf5, hkInternalServerTryActivateAbility);
|
|
}
|
|
}
|
|
} |