The current BepInExPack is broken due to the Oakveil update, and mods installed through a mod manager may not work. Join the modding Discord for more information.
Decompiled source of AbuseForge v1.0.0
AbuseForge.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Bloodstone.API; using Bloodstone.Hooks; using HarmonyLib; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Network; using Stunlock.Core; using Unity.Collections; using Unity.Entities; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AbuseForge")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Created with VRising.ModTemplate, you should edit this.")] [assembly: AssemblyFileVersion("0.1.10.0")] [assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e")] [assembly: AssemblyProduct("AbuseForge")] [assembly: AssemblyTitle("AbuseForge")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.10.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AbuseForge { public static class AbuseForgeBuffSystem { public static bool BuffPlayer(Entity character, Entity user, PrefabGUID buffPrefab, int durationSeconds = -1, bool persistThroughDeath = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = VWorld.Server.EntityManager; DebugEventsSystem existingSystemManaged = VWorld.Server.GetExistingSystemManaged<DebugEventsSystem>(); if (existingSystemManaged == null) { return false; } if (TryGetBuff(entityManager, character, buffPrefab, out var _)) { return false; } ApplyBuffDebugEvent val = default(ApplyBuffDebugEvent); val.BuffPrefabGUID = buffPrefab; ApplyBuffDebugEvent val2 = val; FromCharacter val3 = default(FromCharacter); val3.User = user; val3.Character = character; FromCharacter val4 = val3; existingSystemManaged.ApplyBuff(val4, val2); if (TryGetBuff(entityManager, character, buffPrefab, out var outBuffEntity2)) { if (((EntityManager)(ref entityManager)).HasComponent<CreateGameplayEventsOnSpawn>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<CreateGameplayEventsOnSpawn>(outBuffEntity2); } if (((EntityManager)(ref entityManager)).HasComponent<GameplayEventListeners>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<GameplayEventListeners>(outBuffEntity2); } if (persistThroughDeath) { ((EntityManager)(ref entityManager)).AddComponentData<Buff_Persists_Through_Death>(outBuffEntity2, default(Buff_Persists_Through_Death)); if (((EntityManager)(ref entityManager)).HasComponent<RemoveBuffOnGameplayEvent>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<RemoveBuffOnGameplayEvent>(outBuffEntity2); } if (((EntityManager)(ref entityManager)).HasComponent<RemoveBuffOnGameplayEventEntry>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<RemoveBuffOnGameplayEventEntry>(outBuffEntity2); } } if (durationSeconds > 0 && ((EntityManager)(ref entityManager)).HasComponent<LifeTime>(outBuffEntity2)) { LifeTime componentData = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(outBuffEntity2); componentData.Duration = durationSeconds; ((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(outBuffEntity2, componentData); } else if (durationSeconds == 0 && ((EntityManager)(ref entityManager)).HasComponent<LifeTime>(outBuffEntity2)) { LifeTime componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(outBuffEntity2); componentData2.Duration = -1f; componentData2.EndAction = (LifeTimeEndAction)0; ((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(outBuffEntity2, componentData2); if (((EntityManager)(ref entityManager)).HasComponent<RemoveBuffOnGameplayEvent>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<RemoveBuffOnGameplayEvent>(outBuffEntity2); } if (((EntityManager)(ref entityManager)).HasComponent<RemoveBuffOnGameplayEventEntry>(outBuffEntity2)) { ((EntityManager)(ref entityManager)).RemoveComponent<RemoveBuffOnGameplayEventEntry>(outBuffEntity2); } } return true; } return false; } public static void Unbuff(Entity character, PrefabGUID buffPrefab) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = VWorld.Server.EntityManager; if (TryGetBuff(entityManager, character, buffPrefab, out var outBuffEntity)) { ((EntityManager)(ref entityManager)).DestroyEntity(outBuffEntity); } } private static bool TryGetBuff(EntityManager em, Entity character, PrefabGUID buffGUID, out Entity outBuffEntity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) outBuffEntity = Entity.Null; if (!((EntityManager)(ref em)).HasComponent<BuffBuffer>(character)) { return false; } DynamicBuffer<BuffBuffer> buffer = ((EntityManager)(ref em)).GetBuffer<BuffBuffer>(character, false); for (int i = 0; i < buffer.Length; i++) { BuffBuffer val = buffer[i]; if (((PrefabGUID)(ref val.PrefabGuid)).Equals(buffGUID)) { outBuffEntity = buffer[i].Entity; return true; } } return false; } } public static class AbuseForgeManager { private static readonly HashSet<AbusePlayer> QueuedUnstucks = new HashSet<AbusePlayer>(); public static void HandleOnPlayerUnstuck(AbusePlayer player, Entity killEventEntity) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) EntityManager em = VWorld.Server.EntityManager; if (((EntityManager)(ref em)).Exists(killEventEntity)) { ((EntityManager)(ref em)).DestroyEntity(killEventEntity); } if (!player.IsAlive()) { return; } if (QueuedUnstucks.Contains(player)) { SendChatMessage(em, player.User, "<color=yellow>You are already queued to unstuck!</color>"); return; } int value = UnstuckConfig.UnstuckKillDelay.Value; if (UnstuckConfig.UseStunBuff.Value) { PrefabGUID buffPrefab = default(PrefabGUID); ((PrefabGUID)(ref buffPrefab))..ctor(-704735901); AbuseForgeBuffSystem.BuffPlayer(player.Character, player.User, buffPrefab, value); } SendChatMessage(em, player.User, $"<color=red>You will be killed in {value} second(s)!</color>"); QueuedUnstucks.Add(player); AbuseStopwatchScheduler.RunActionOnceAfterDelay(delegate { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) QueuedUnstucks.Remove(player); if (player.IsAlive()) { EntityArchetype val = ((EntityManager)(ref em)).CreateArchetype((ComponentType[])(object)new ComponentType[3] { ComponentType.ReadWrite<KillEvent>(), ComponentType.ReadWrite<FromCharacter>(), ComponentType.ReadWrite<CanFly>() }); Entity val2 = ((EntityManager)(ref em)).CreateEntity(val); ((EntityManager)(ref em)).SetComponentData<FromCharacter>(val2, new FromCharacter { User = player.User, Character = player.Character }); NetworkId componentData = ((EntityManager)(ref em)).GetComponentData<NetworkId>(player.Character); ((EntityManager)(ref em)).SetComponentData<KillEvent>(val2, new KillEvent { Filter = (KillWhoFilter)0, TargetNetworkId = componentData, Who = (KillWho)4 }); } }, value); } private static void SendChatMessage(EntityManager em, Entity userEntity, string message) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (((EntityManager)(ref em)).HasComponent<User>(userEntity)) { User componentData = ((EntityManager)(ref em)).GetComponentData<User>(userEntity); ServerChatUtils.SendSystemMessageToClient(em, componentData, message); } } } [BepInPlugin("AbuseForge", "AbuseForge", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [Reloadable] public class AbuseForgePlugin : BasePlugin { public static ManualLogSource LoggerInstance; private Harmony _harmony; public static Stopwatch RealTimeWatch; private ConfigFile _specialConfig; public override void Load() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown LoggerInstance = ((BasePlugin)this).Log; string text = Path.Combine(Paths.ConfigPath, "AbuseForge"); Directory.CreateDirectory(text); string text2 = Path.Combine(text, "UnstuckAbuse.cfg"); _specialConfig = new ConfigFile(text2, true); UnstuckConfig.Initialize(_specialConfig); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AbuseForge] Loaded. "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UnstuckKillDelay="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(UnstuckConfig.UnstuckKillDelay.Value); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UseStunBuff="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(UnstuckConfig.UseStunBuff.Value); } log.LogInfo(val); GameFrame.Initialize(); GameFrame.OnUpdate += new GameFrameUpdateEventHandler(OnGameFrameUpdate); RealTimeWatch = new Stopwatch(); RealTimeWatch.Start(); _harmony = new Harmony("AbuseForgeStandalone"); _harmony.PatchAll(); Chat.OnChatMessage += new ChatEventHandler(HandleChatCommand); ((BasePlugin)this).Log.LogInfo((object)"[AbuseForge] Load complete."); } public override bool Unload() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Chat.OnChatMessage -= new ChatEventHandler(HandleChatCommand); GameFrame.OnUpdate -= new GameFrameUpdateEventHandler(OnGameFrameUpdate); GameFrame.Uninitialize(); RealTimeWatch?.Stop(); RealTimeWatch = null; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } ((BasePlugin)this).Log.LogInfo((object)"[AbuseForge] Unloaded."); return true; } private void OnGameFrameUpdate() { AbuseStopwatchScheduler.Tick(); } private void HandleChatCommand(VChatEvent ev) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!ev.Message.Equals("!AbuseForge", StringComparison.OrdinalIgnoreCase) || !ev.User.IsAdmin) { return; } try { _specialConfig.Reload(); _specialConfig.Save(); UnstuckConfig.Initialize(_specialConfig); VExtensions.SendSystemMessage(ev.User, "<color=#00FF00>AbuseForge config reloaded successfully!</color>"); ((BasePlugin)this).Log.LogInfo((object)"[AbuseForge] Config reloaded via !AbuseForge."); } catch (Exception ex) { VExtensions.SendSystemMessage(ev.User, "<color=#FF0000>AbuseForge config reload failed:</color> " + ex.Message); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error reloading AbuseForge config: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } } public class AbusePlayer { public Entity User; public Entity Character; private static readonly Dictionary<Entity, AbusePlayer> s_cache = new Dictionary<Entity, AbusePlayer>(); private EntityManager em => VWorld.Server.EntityManager; private AbusePlayer(Entity userEntity, Entity characterEntity) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) User = userEntity; Character = characterEntity; } public bool IsAlive() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) EntityManager val = em; if (!((EntityManager)(ref val)).Exists(Character)) { return false; } val = em; if (!((EntityManager)(ref val)).HasComponent<Health>(Character)) { return false; } val = em; Health componentData = ((EntityManager)(ref val)).GetComponentData<Health>(Character); return componentData.Value > 0f; } public void LogToConsole(string message) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ManualLogSource loggerInstance = AbuseForgePlugin.LoggerInstance; if (loggerInstance != null) { bool flag = default(bool); BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(32, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (UserEntity="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(User); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", CharacterEntity="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(Character); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } loggerInstance.LogMessage(val); } } public static AbusePlayer FromUser(Entity userEntity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = VWorld.Server.EntityManager; if (!((EntityManager)(ref entityManager)).Exists(userEntity)) { return null; } if (s_cache.TryGetValue(userEntity, out var value)) { return value; } if (!((EntityManager)(ref entityManager)).HasComponent<User>(userEntity)) { return null; } User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity); Entity entity = componentData.LocalCharacter._Entity; if (!((EntityManager)(ref entityManager)).Exists(entity)) { return null; } AbusePlayer abusePlayer = new AbusePlayer(userEntity, entity); s_cache[userEntity] = abusePlayer; return abusePlayer; } } public static class AbuseScheduler { private class ScheduledAction { public float TimeToRun; public Action Action; } private static readonly List<ScheduledAction> _actions = new List<ScheduledAction>(); private static float _currentTime = 0f; public static void UpdateScheduler(float deltaTime) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown _currentTime += deltaTime; bool flag = default(bool); for (int num = _actions.Count - 1; num >= 0; num--) { if (_currentTime >= _actions[num].TimeToRun) { try { _actions[num].Action?.Invoke(); } catch (Exception ex) { ManualLogSource loggerInstance = AbuseForgePlugin.LoggerInstance; if (loggerInstance != null) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AbuseScheduler] Error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } loggerInstance.LogError(val); } } _actions.RemoveAt(num); } } } public static void RunActionOnceAfterDelay(Action action, float delaySeconds) { _actions.Add(new ScheduledAction { TimeToRun = _currentTime + delaySeconds, Action = action }); } } public static class AbuseStopwatchScheduler { private class ScheduledAction { public double RunAt; public Action Action; } private static readonly List<ScheduledAction> _actions = new List<ScheduledAction>(); public static void Tick() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if (AbuseForgePlugin.RealTimeWatch == null) { return; } double totalSeconds = AbuseForgePlugin.RealTimeWatch.Elapsed.TotalSeconds; bool flag = default(bool); for (int num = _actions.Count - 1; num >= 0; num--) { if (totalSeconds >= _actions[num].RunAt) { try { _actions[num].Action?.Invoke(); } catch (Exception ex) { ManualLogSource loggerInstance = AbuseForgePlugin.LoggerInstance; if (loggerInstance != null) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StopwatchScheduler] Error in action: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } loggerInstance.LogError(val); } } _actions.RemoveAt(num); } } } public static void RunActionOnceAfterDelay(Action action, double delaySeconds) { if (AbuseForgePlugin.RealTimeWatch != null) { double totalSeconds = AbuseForgePlugin.RealTimeWatch.Elapsed.TotalSeconds; double runAt = totalSeconds + delaySeconds; _actions.Add(new ScheduledAction { RunAt = runAt, Action = action }); } } } [HarmonyPatch(typeof(KillEventSystem), "OnUpdate")] public static class KillEventSystemPatch { [HarmonyPrefix] public static void Prefix(KillEventSystem __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager; EntityQuery query = __instance._Query; NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (((EntityManager)(ref entityManager)).Exists(current) && !((EntityManager)(ref entityManager)).HasComponent<CanFly>(current) && ((EntityManager)(ref entityManager)).HasComponent<FromCharacter>(current)) { FromCharacter componentData = ((EntityManager)(ref entityManager)).GetComponentData<FromCharacter>(current); AbusePlayer abusePlayer = AbusePlayer.FromUser(componentData.User); if (abusePlayer != null) { AbuseForgeManager.HandleOnPlayerUnstuck(abusePlayer, current); } } } val.Dispose(); } } public static class UnstuckConfig { public static ConfigEntry<int> UnstuckKillDelay; public static ConfigEntry<bool> UseStunBuff; public static void Initialize(ConfigFile config) { UnstuckKillDelay = config.Bind<int>("UnstuckAbuse", "UnstuckKillDelay", 5, "Seconds to wait before killing the player after they initiate unstuck."); UseStunBuff = config.Bind<bool>("UnstuckAbuse", "UseStunBuff", true, "If true, apply a stun buff to the player during the unstuck countdown."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "AbuseForge"; public const string PLUGIN_NAME = "AbuseForge"; public const string PLUGIN_VERSION = "0.1.10"; } }