using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("NoBump")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e135765ae735b8ede4619c873e878dfa67c06f12")] [assembly: AssemblyProduct("Plugin for Big Walk that disables collisions between players")] [assembly: AssemblyTitle("NoBump")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 NoBump { [BepInPlugin("dev.foxgirl.plugins.nobump", "NoBump", "1.0.0.0")] public class NoBumpPlugin : BasePlugin { internal static ManualLogSource Log; internal static Harmony HarmonyInstance; internal static GameObject ManagerObject; internal static void SetupManager() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown if ((Object)(object)ManagerObject == (Object)null) { ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Creating NoBumpManager..."); } log.LogInfo(val); ManagerObject = new GameObject("NoBumpManager"); ((Object)ManagerObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)ManagerObject); ManagerObject.AddComponent(); ManualLogSource log2 = Log; val = new BepInExInfoLogInterpolatedStringHandler(20, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("NoBumpManager ready."); } log2.LogInfo(val); } } public override void Load() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ClassInjector.RegisterTypeInIl2Cpp(); ClassInjector.RegisterTypeInIl2Cpp(); HarmonyInstance = new Harmony("dev.foxgirl.plugins.nobump"); HarmonyInstance.PatchAll(); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("NoBump loaded :3c"); } log.LogInfo(val); } } internal sealed class PointerComparer : IEqualityComparer where T : Il2CppObjectBase { public static readonly PointerComparer Instance = new PointerComparer(); public bool Equals(T a, T b) { object obj = a; IntPtr intPtr = ((obj != null) ? ((Il2CppObjectBase)obj).Pointer : IntPtr.Zero); object obj2 = b; return intPtr == ((obj2 != null) ? ((Il2CppObjectBase)obj2).Pointer : IntPtr.Zero); } public int GetHashCode(T o) { return ((Il2CppObjectBase)o).Pointer.GetHashCode(); } } public class NoBumpController : MonoBehaviour { internal static readonly Dictionary Instances = new Dictionary(); internal HashSet CurrentColliders = new HashSet(16, PointerComparer.Instance); internal HashSet PreviousColliders = new HashSet(16, PointerComparer.Instance); private static readonly List ColliderList = new List(64); public NoBumpController(IntPtr ptr) : base(ptr) { } public void OnEnable() { Instances[((Il2CppObjectBase)this).Pointer] = this; NoBumpPlugin.SetupManager(); } public void OnDisable() { Instances.Remove(((Il2CppObjectBase)this).Pointer); NoBumpManager.Dirty = true; } internal bool Rescan() { HashSet currentColliders = CurrentColliders; HashSet previousColliders = PreviousColliders; PreviousColliders = currentColliders; CurrentColliders = previousColliders; CurrentColliders.Clear(); ColliderList.Clear(); ((Component)this).gameObject.GetComponentsInChildren(true, ColliderList); int i = 0; for (int count = ColliderList.Count; i < count; i++) { Collider val = ColliderList[i]; if (!val.isTrigger && val.enabled && ((Component)val).gameObject.activeInHierarchy) { CurrentColliders.Add(val); } } if (CurrentColliders.Count != PreviousColliders.Count) { return true; } foreach (Collider currentCollider in CurrentColliders) { if (!PreviousColliders.Contains(currentCollider)) { return true; } } return false; } } public class NoBumpManager : MonoBehaviour { internal static bool Dirty = true; private static readonly List Controllers = new List(16); private static readonly List AppliedColliderPairs = new List(128); public NoBumpManager(IntPtr ptr) : base(ptr) { } public void OnEnable() { NoBumpPlugin.Log.LogInfo((object)"NoBumpManager OnEnable"); } public void OnDisable() { NoBumpPlugin.Log.LogInfo((object)"NoBumpManager OnDisable"); } public void FixedUpdate() { Controllers.Clear(); foreach (KeyValuePair instance in NoBumpController.Instances) { if (instance.Value.Rescan()) { Dirty = true; } Controllers.Add(instance.Value); } if (!Dirty) { return; } Dirty = false; for (int i = 0; i + 1 < AppliedColliderPairs.Count; i += 2) { Collider val = AppliedColliderPairs[i]; Collider val2 = AppliedColliderPairs[i + 1]; if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { Physics.IgnoreCollision(val, val2, false); } } AppliedColliderPairs.Clear(); for (int j = 0; j < Controllers.Count; j++) { for (int k = j + 1; k < Controllers.Count; k++) { foreach (Collider currentCollider in Controllers[j].CurrentColliders) { foreach (Collider currentCollider2 in Controllers[k].CurrentColliders) { Physics.IgnoreCollision(currentCollider, currentCollider2, true); AppliedColliderPairs.Add(currentCollider); AppliedColliderPairs.Add(currentCollider2); } } } } } } [HarmonyPatch(typeof(PlayerCharacter), "Start")] internal static class AddNoBumpControllerPatch { private static void Postfix(PlayerCharacter __instance) { ((Component)__instance).gameObject.AddComponent(); } } }