This repository has been archived on 2026-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
undead-universal-patch-il2cpp/Patches/AFKPatch.cs
zombieb 1c51b37a7c Remove galvanic authentication support
... that server is being rewritten
2025-08-10 21:53:58 -04:00

31 lines
988 B
C#

using System.Reflection;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
namespace undead_universal_patch_il2cpp.Patches;
[HarmonyPatch]
public class AFKPatch
{
static readonly string TargetTypeName = "Player";
static readonly string TargetMethodName = "UpdateAFKStatus";
static readonly string Description = "Always present, never AFK";
static bool Prepare()
{
if (AccessTools.Method(AccessTools.TypeByName(TargetTypeName), TargetMethodName) == null)
{
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
return false;
}
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
return true;
}
static MethodBase TargetMethod() => AccessTools.Method(AccessTools.TypeByName(TargetTypeName), TargetMethodName);
static void Prefix(ref bool userIsPresent)
{
if (GenericConfig.AFKPatch.Value) userIsPresent = true;
}
}