// // INostaleHook.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Remora.Results; namespace NosSmooth.LocalBinding.Hooks; /// /// A hook of a NosTale function. /// /// The function delegate. /// A wrapper function that abstracts the call to original function. May get the neccessary object to call the function and accept only relevant arguments. /// The event args used in case of a call. public interface INostaleHook : INostaleHook where TFunction : Delegate where TWrapperFunction : Delegate where TEventArgs : System.EventArgs { /// /// Gets the wrapper function delegate. /// public TWrapperFunction WrapperFunction { get; } /// /// Gets the original function delegate. /// public TFunction OriginalFunction { get; } /// /// An event fired in case the function is called from NosTale. /// public event EventHandler? Called; } /// /// A hook of a NosTale function. /// public interface INostaleHook { /// /// Gets the name of the function. /// /// /// Usually denoted as Type.Method, /// for example PlayerManager.Walk. /// public string Name { get; } /// /// Gets whether the hook is currently enabled. /// public bool IsEnabled { get; } /// /// Enable the hook. /// /// /// If it already is enabled, does nothing. /// /// A result that may or may not have succeeded. public Result Enable(); /// /// Disable the hook. /// /// /// If it already is disabled, does nothing. /// /// A result that may or may not have succeeded. public Result Disable(); }