using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using Unity.Mathematics; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("my.pahsiv.MyBananaDontHurtMe")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.6.0")] [assembly: AssemblyInformationalVersion("0.1.6")] [assembly: AssemblyProduct("my.pahsiv.MyBananaDontHurtMe")] [assembly: AssemblyTitle("MyBananaDontHurtMe")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.6.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace MyBananaDontHurtMe { public static class ColorHelper { public const string White = "FFFFFF"; public const string Black = "000000"; public const string Red = "FF0000"; public const string Green = "00FF00"; public const string Blue = "0000FF"; public const string Yellow = "FFFF00"; public const string Purple = "8765CA"; public const string Gray = "808080"; public const string Orange = "FFA500"; public const string Cyan = "00FFFF"; public const string Magenta = "FF00FF"; public const string Pink = "FFC0CB"; public const string Brown = "A52A2A"; public const string Lime = "00FF00"; public const string Teal = "008080"; public const string Navy = "000080"; public const string Maroon = "800000"; public const string Olive = "808000"; public const string Aqua = "00FFFF"; public const string Silver = "C0C0C0"; public const string Gold = "FFD700"; public const string LightRed = "FF6B6B"; public const string LightGreen = "90EE90"; public const string LightBlue = "ADD8E6"; public const string LightGray = "D3D3D3"; public const string LightPink = "FFB6C1"; public const string DarkRed = "8B0000"; public const string DarkGreen = "006400"; public const string DarkBlue = "00008B"; public const string DarkGray = "A9A9A9"; public const string DarkOrange = "FF8C00"; public const string Pahsiv = "3582E7"; } internal class Explosion { [HarmonyPatch(typeof(ExplosionEffect), "GetPoints")] private static class ReduceDynamiteCloudInstanceCount { public static void Postfix(ExplosionEffect __instance) { //IL_0010: 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) __instance.explosionPoints = (ExplosionOrb[])(object)new ExplosionOrb[1] { __instance.explosionPoints[0] }; } } } [HarmonyPatch(typeof(BananaPeel), "Start")] public static class BananaPeel_Start_Patch { [HarmonyPostfix] public static void Postfix(BananaPeel __instance) { Item component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { ItemImpactSFX component2 = ((Component)component).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } ItemParticles component3 = ((Component)component).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = false; } EventOnItemCollision component4 = ((Component)component).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = false; } ItemCooking component5 = ((Component)component).GetComponent(); if ((Object)(object)component5 != (Object)null) { ((Behaviour)component5).enabled = false; } LootData component6 = ((Component)component).GetComponent(); if ((Object)(object)component6 != (Object)null) { ((Behaviour)component6).enabled = false; } ColorblindVariant component7 = ((Component)component).GetComponent(); if ((Object)(object)component7 != (Object)null) { ((Behaviour)component7).enabled = false; } } } } [HarmonyPatch(typeof(BananaPeel), "Update")] public static class BananaPeel_Physics_Patch { [HarmonyPostfix] public static void Postfix(BananaPeel __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //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) if (PhotonNetwork.IsMasterClient) { return; } Rigidbody component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return; } Item component2 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 == (Object)null) { return; } if ((int)component2.itemState == 0) { Vector3 linearVelocity = component.linearVelocity; if (((Vector3)(ref linearVelocity)).magnitude < 0.05f) { if (!component.isKinematic) { component.isKinematic = true; RestoreOriginalColor(__instance); } return; } } if (component.isKinematic) { component.isKinematic = false; SetSleepingColor(__instance); } } private static void SetSleepingColor(BananaPeel banana) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ShowDebugInfo.Value) { Renderer[] componentsInChildren = ((Component)banana).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.material.SetColor("_Tint", Color.magenta); } } } public static void RestoreOriginalColor(BananaPeel banana) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ShowDebugInfo.Value) { Renderer[] componentsInChildren = ((Component)banana).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.material.SetColor("_Tint", Color.blue); } } } } [HarmonyPatch(typeof(ItemPhysicsSyncer), "FixedUpdate")] public static class ItemPhysicsSyncer_FixedUpdate_Patch { private static Dictionary s_bananaPeelCounters = new Dictionary(); private static Dictionary s_bananaPeelSyncState = new Dictionary(); private const int k_bananaPeelSyncInterval = 3; private const float k_stopSyncThreshold = 0.3f; private const float k_startSyncThreshold = 0.6f; private static float s_lastLogTime = 0f; private const float k_logInterval = 1f; [HarmonyPrefix] public static bool Prefix(ItemPhysicsSyncer __instance) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0076: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient) { return true; } if (!Plugin.NewBananaStabilize.Value) { return true; } BananaPeel component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { if (!s_bananaPeelSyncState.ContainsKey(__instance)) { s_bananaPeelSyncState[__instance] = true; } bool flag = s_bananaPeelSyncState[__instance]; if (!((PhotonBinaryStreamSerializer)(object)__instance).RemoteValue.IsNone) { ItemPhysicsSyncData value = ((PhotonBinaryStreamSerializer)(object)__instance).RemoteValue.Value; float num = Vector3.Distance(((Component)__instance).transform.position, float3.op_Implicit(value.position)); if (flag && num < 0.3f) { flag = false; if (Plugin.ShowDebugInfo.Value && Time.realtimeSinceStartup - s_lastLogTime > 1f) { s_lastLogTime = Time.realtimeSinceStartup; Plugin.Log.LogMessage((object)$"[BananaPeel] Stopped syncing (distance: {num:F3})"); } } else if (!flag && num > 0.6f) { flag = true; if (Plugin.ShowDebugInfo.Value && Time.realtimeSinceStartup - s_lastLogTime > 1f) { s_lastLogTime = Time.realtimeSinceStartup; Plugin.Log.LogMessage((object)$"[BananaPeel] Started syncing (distance: {num:F3})"); } } s_bananaPeelSyncState[__instance] = flag; if (!flag) { return false; } } if (!s_bananaPeelCounters.ContainsKey(__instance)) { s_bananaPeelCounters[__instance] = 0; } s_bananaPeelCounters[__instance]++; if (s_bananaPeelCounters[__instance] % 3 != 0) { return false; } s_bananaPeelCounters[__instance] = 0; } return true; } } public class Magnitude : MonoBehaviour { [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Magnitude <>4__this; private List.Enumerator <>7__wrap1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List.Enumerator); <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; Magnitude magnitude = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (Character.AllCharacters == null) { return false; } <>7__wrap1 = Character.AllCharacters.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { Character current = <>7__wrap1.Current; if ((Object)(object)current == (Object)null || (Object)(object)current == (Object)(object)Character.localCharacter) { <>2__current = null; <>1__state = 1; return true; } if (magnitude.CheckMagnitude(current)) { string text = Plugin.RemoveTags(((Object)current.player).name); Plugin.Log.LogMessage((object)(text + " High Magnitude Detected!")); Plugin.Notification(Plugin.AddColor(((Object)current.player).name, "00FFFF") + " High Magnitude Detected!"); magnitude.ResetRagdollPhysics(current); } <>2__current = null; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap1 = default(List.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Magnitude <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown int num = <>1__state; Magnitude magnitude = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; if (Plugin.PeriodicCheck) { ((MonoBehaviour)magnitude).StartCoroutine(magnitude.CheckAllPlayers()); } break; } if (Plugin.PeriodicCheck) { <>2__current = (object)new WaitForSeconds(20f); <>1__state = 1; return true; } magnitude.periodicCheckCoroutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Character character; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)character == (Object)null || character.refs == null || (Object)(object)character.refs.ragdoll == (Object)null || character.refs.ragdoll.partList == null) { return false; } foreach (Bodypart part in character.refs.ragdoll.partList) { if (!((Object)(object)part == (Object)null) && !((Object)(object)part.rig == (Object)null)) { part.rig.linearVelocity = Vector3.zero; part.rig.angularVelocity = Vector3.zero; part.rig.isKinematic = false; } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Coroutine periodicCheckCoroutine; public void StartPeriodicCheck() { if (periodicCheckCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(periodicCheckCoroutine); periodicCheckCoroutine = null; } periodicCheckCoroutine = ((MonoBehaviour)this).StartCoroutine(PeriodicCheck()); } public void StopPeriodicCheck() { if (periodicCheckCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(periodicCheckCoroutine); periodicCheckCoroutine = null; } } [IteratorStateMachine(typeof(d__3))] private IEnumerator PeriodicCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__4))] private IEnumerator CheckAllPlayers() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { <>4__this = this }; } private void ResetRagdollPhysics(Character character) { if ((Object)(object)character == (Object)null || character.refs == null || (Object)(object)character.refs.ragdoll == (Object)null || character.refs.ragdoll.partList == null) { return; } foreach (Bodypart part in character.refs.ragdoll.partList) { if (!((Object)(object)part == (Object)null) && !((Object)(object)part.rig == (Object)null)) { part.rig.isKinematic = true; } } ((MonoBehaviour)this).StartCoroutine(ReEnablePhysics(character)); } [IteratorStateMachine(typeof(d__6))] private IEnumerator ReEnablePhysics(Character character) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { character = character }; } public bool CheckMagnitude(Character selectCharacter) { //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) if (selectCharacter?.refs?.ragdoll?.partList == null) { return false; } foreach (Bodypart part in selectCharacter.refs.ragdoll.partList) { if (!((Object)(object)part?.rig == (Object)null)) { Vector3 linearVelocity = part.rig.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude > Plugin.HighMagnitudeThreshold.Value) { return true; } } } return false; } } internal class MobPatch { [HarmonyPatch(typeof(MushroomZombie), "Update")] private class MushroomZombieUpdatePatch { private static bool Prefix(MushroomZombie __instance) { //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_0017: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)__instance).transform.position; float num = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (num > 2500f) { return false; } return true; } } [HarmonyPatch(typeof(Mob), "Update")] private class MobUpdatePatch { private static bool Prefix(Mob __instance) { //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_0017: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)__instance).transform.position; float num = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (num > 2500f) { return false; } return true; } } } public static class Network { [HarmonyPatch(typeof(Campfire), "Light_Rpc")] public class Light_Rpc_Patch { private static bool Prefix(Campfire __instance) { if (!Plugin.gracePeriod) { Plugin.gracePeriod = true; ((MonoBehaviour)Plugin.Instance).StartCoroutine(Plugin.Instance.EndGracePeriod()); } return true; } } [HarmonyPatch(typeof(BananaPeel), "Start")] public class BananaPeelStartPatch { private static void Postfix(BananaPeel __instance) { Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.shadowCastingMode = (ShadowCastingMode)0; val.receiveShadows = false; val.reflectionProbeUsage = (ReflectionProbeUsage)0; val.lightProbeUsage = (LightProbeUsage)0; val.motionVectorGenerationMode = (MotionVectorGenerationMode)2; } MeshFilter component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.mesh != (Object)null) { component.mesh.Optimize(); } } } [HarmonyPatch(typeof(Dynamite), "Start")] public class DynamiteStartPatch { private static void Postfix(Dynamite __instance) { Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.shadowCastingMode = (ShadowCastingMode)0; val.receiveShadows = false; val.reflectionProbeUsage = (ReflectionProbeUsage)0; val.lightProbeUsage = (LightProbeUsage)0; val.motionVectorGenerationMode = (MotionVectorGenerationMode)2; } MeshFilter component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.mesh != (Object)null) { component.mesh.Optimize(); } } } [HarmonyPatch(typeof(Item), "Update")] public class Item_Update_Patch { private static Dictionary myDestroyTicks = new Dictionary(); private static bool Prefix(Item __instance) { //IL_0006: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)Camera.main).transform.position); if (((Component)__instance).transform.position.y < -2000f || ((Component)__instance).transform.position.y > 4000f || num > 10000f) { if (!myDestroyTicks.ContainsKey(__instance)) { myDestroyTicks[__instance] = 0f; } myDestroyTicks[__instance] += Time.deltaTime; if (myDestroyTicks[__instance] > 2f) { Plugin.Log.LogMessage((object)$"Hiding {((Object)__instance).name} at {((Component)__instance).transform.position} | Distance: {num:F0}"); myDestroyTicks.Remove(__instance); ((Component)__instance).gameObject.SetActive(false); return false; } } else { myDestroyTicks.Remove(__instance); } return true; } } public static int skipCounter = 0; public static Vector3 StoragePosition = new Vector3(0f, -500f, 0f); public static void ResetSkipCounter() { skipCounter = 0; } public static bool PreNetworkInstantiate(InstantiateParameters parameters, bool roomObject, bool instantiateEvent) { //IL_0005: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) if (!instantiateEvent) { return true; } string prefabName = parameters.prefabName; Vector3 position = parameters.position; Player creator = parameters.creator; string text = prefabName.ToLower(); if (text.Contains("healingpuffshroomspawn")) { float num = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (num > 40f) { return false; } } else if (text.Contains("healingpuffshroom")) { if (PhotonNetwork.LocalPlayer.IsMasterClient) { return true; } if (Plugin.gracePeriod) { Plugin.Log.LogMessage((object)$"GracePeriod Spawn | {prefabName} at {position}!"); return true; } float num2 = Vector3.Distance(position, StoragePosition); if (num2 < 1f) { return true; } float num3 = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (num3 > 45f) { return false; } } else if (text.Contains("berrynana peel")) { if (PhotonNetwork.LocalPlayer.IsMasterClient) { return true; } float num4 = Vector3.Distance(position, StoragePosition); if (num4 < 1f) { return true; } float num5 = Mathf.Sqrt(Mathf.Pow(position.x - ((Component)Camera.main).transform.position.x, 2f) + Mathf.Pow(position.z - ((Component)Camera.main).transform.position.z, 2f)); if (num5 > 45f) { return false; } } if (creator != null && creator != PhotonNetwork.MasterClient) { float num6 = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (prefabName.ToLower().Contains("mushroomzombie")) { Plugin.Notification(string.Format("[ZOMBIE SPAWN] {0} spawn a Zombie at {1} ! Distance : {2}", Plugin.AddColor(creator.NickName, "00FFFF"), position, num6), "FFFF00"); Plugin.Log.LogWarning((object)$"[ZOMBIE SPAWN] {creator} spawn a Zombie at {position} ! Distance : {num6}"); return false; } if (prefabName.ToLower().Contains("scorpion") && num6 > 2500f) { Plugin.Notification(string.Format("[SCORPION SPAWN] {0} spawn a Scorpion at {1} ! Distance : {2}", Plugin.AddColor(creator.NickName, "00FFFF"), position, num6), "FFFF00"); Plugin.Log.LogWarning((object)$"[SCORPION SPAWN] {creator} spawn a Scorpion at {position} ! Distance : {num6}"); return false; } } if (prefabName.ToLower().Contains("mushroomzombie") || prefabName.ToLower().Contains("scorpion") || prefabName.ToLower().Contains("beetle")) { float num7 = Vector3.Distance(position, ((Component)Camera.main).transform.position); if (num7 > 2500f) { return false; } } return true; } public static bool PreOnEvent(EventData photonEvent) { return true; } private static void LogShaderProperties(BananaPeel input) { //IL_005d: 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_0064: 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_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) Renderer[] componentsInChildren = ((Component)input).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material material = val.material; Shader shader = material.shader; Plugin.Log.LogMessage((object)("Shader name: " + ((Object)shader).name)); int propertyCount = shader.GetPropertyCount(); for (int j = 0; j < propertyCount; j++) { string propertyName = shader.GetPropertyName(j); ShaderPropertyType propertyType = shader.GetPropertyType(j); if ((int)propertyType == 0) { Color color = material.GetColor(propertyName); Plugin.Log.LogMessage((object)$" Color property: {propertyName} = {color}"); } } } } } internal class NullReferencePatch { } [BepInPlugin("my.pahsiv.MyBananaDontHurtMe", "MyBananaDontHurtMe", "0.1.6")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__21 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(30f); <>1__state = 1; return true; case 1: <>1__state = -1; gracePeriod = false; Log.LogMessage((object)" Remedy Fungus Grace Period Ended"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Network.skipCounter > 0) { Log.LogMessage((object)$"[ {Network.skipCounter} ] Banana Update Skipped!"); Network.ResetSkipCounter(); } <>2__current = (object)new WaitForSeconds(10f); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool gracePeriod; public static bool PeriodicCheck; public static Magnitude? MagnitudeCheck; public static ConfigEntry HighMagnitudeThreshold; public static ConfigEntry ShowDebugInfo; public static ConfigEntry NewBananaStabilize; public static ConfigEntry RagdollClose; public static ConfigEntry RagdollFar; public static ConfigEntry RagdollVeryFar; private static InputAction? TestAction; public static bool Stabilize; public const string Id = "my.pahsiv.MyBananaDontHurtMe"; public static ManualLogSource Log { get; private set; } public static Plugin Instance { get; private set; } public static string Name => "MyBananaDontHurtMe"; public static string Version => "0.1.6"; private void Awake() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; HighMagnitudeThreshold = ((BaseUnityPlugin)this).Config.Bind("General", "High Magnitude Threshold", 70f, ""); NewBananaStabilize = ((BaseUnityPlugin)this).Config.Bind("General", "New Banana Stabilizer", true, ""); ShowDebugInfo = ((BaseUnityPlugin)this).Config.Bind("General", "Debug Info", false, ""); RagdollClose = ((BaseUnityPlugin)this).Config.Bind("General", "Ragdoll Update Distance (Close)", 30f, new ConfigDescription("Distance for ragdoll update in full speed.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2500f), Array.Empty())); RagdollFar = ((BaseUnityPlugin)this).Config.Bind("General", "Ragdoll Update Distance (Far)", 100f, new ConfigDescription("Distance for ragdoll update in half speed.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2500f), Array.Empty())); RagdollVeryFar = ((BaseUnityPlugin)this).Config.Bind("General", "Ragdoll Update Distance (Very Far)", 1000f, new ConfigDescription("Distance for ragdoll update in very slow speed.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2500f), Array.Empty())); Harmony val = new Harmony("my.pahsiv.MyBananaDontHurtMe"); val.PatchAll(); SceneManager.sceneLoaded += SceneManager_sceneLoaded; MethodInfo method = typeof(PhotonNetwork).GetMethod("NetworkInstantiate", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[3] { typeof(InstantiateParameters), typeof(bool), typeof(bool) }, null); if (method == null) { Log.LogError((object)" Failed to find NetworkInstantiate method!"); } else { MethodInfo method2 = typeof(Network).GetMethod("PreNetworkInstantiate", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (ShowDebugInfo.Value) { IEnumerable patchedMethods = val.GetPatchedMethods(); Log.LogMessage((object)$" Total patched methods: {patchedMethods.Count()}"); foreach (MethodBase item in patchedMethods) { Log.LogMessage((object)(" Patched: " + item.DeclaringType?.Name + "." + item.Name)); } } GameObject val2 = new GameObject("MagnitudeCheck"); MagnitudeCheck = val2.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val2); Log.LogMessage((object)(" Plugin " + Name + " " + Version + " is loaded!")); } private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name.Contains("Level_")) { PeriodicCheck = true; Log.LogMessage((object)" Magnitude Check Started!"); MagnitudeCheck?.StartPeriodicCheck(); gracePeriod = true; Log.LogMessage((object)" Remedy Fungus Grace Period Started"); ((MonoBehaviour)this).StartCoroutine(EndGracePeriod()); if (ShowDebugInfo.Value) { ((MonoBehaviour)this).StartCoroutine(SkippingInfo()); } } else { PeriodicCheck = false; Log.LogMessage((object)" Magnitude Check Stopped!"); MagnitudeCheck?.StopPeriodicCheck(); } } [IteratorStateMachine(typeof(d__21))] public IEnumerator EndGracePeriod() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__21(0); } [IteratorStateMachine(typeof(d__22))] public IEnumerator SkippingInfo() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0); } public static void Notification(string message, string color = "FFFFFF", bool sound = false) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) PlayerConnectionLog val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } string text = "" + message + ""; MethodInfo method = typeof(PlayerConnectionLog).GetMethod("AddMessage", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(val, new object[1] { text }); if ((Object)(object)val.sfxJoin != (Object)null && sound) { val.sfxJoin.Play(default(Vector3)); } } else { Debug.LogWarning((object)"AddMessage method not found."); } } public static string RemoveTags(string input) { return Regex.Replace(input, "<[^>]*>", ""); } public static string AddColor(string text, string color) { return "" + text + ""; } } internal class Ragdoll { [HarmonyPatch(typeof(CharacterRagdoll), "FixedUpdate")] private class RagdollPatch { private static Dictionary update_time = new Dictionary(); private static float medium_update_time = 0.5f; private static float far_update_time = 5f; private static bool Prefix(CharacterRagdoll __instance) { //IL_0025: 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) if ((Object)(object)__instance.character == (Object)null) { return false; } if (__instance.character.IsLocal) { return true; } float num = Vector3.Distance(__instance.character.Center, ((Component)Camera.main).transform.position); if (num < Plugin.RagdollClose.Value) { return true; } float num2; if (num < Plugin.RagdollFar.Value) { num2 = medium_update_time; } else { if (!(num < Plugin.RagdollVeryFar.Value)) { return false; } num2 = far_update_time; } if (!update_time.ContainsKey(__instance)) { update_time[__instance] = 0f; } update_time[__instance] += Time.fixedDeltaTime; if (update_time[__instance] >= num2) { update_time[__instance] -= num2; __instance.SetPhysicsMats(); if (__instance.firstFrame) { __instance.firstFrame = false; } else { UpdateRagdoll(__instance); } } return false; } private static void UpdateRagdoll(CharacterRagdoll ragdoll) { //IL_0072: 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) if ((Object)(object)ragdoll.character.data.currentItem != (Object)null) { ragdoll.character.refs.animations.PrepIK(); } ragdoll.RotateCharacter(); ragdoll.character.refs.ikRigBuilder.SyncLayers(); ragdoll.character.refs.ikRigBuilder.Evaluate(Time.fixedDeltaTime); PlayableGraph playableGraph = ragdoll.character.refs.animator.playableGraph; ((PlayableGraph)(ref playableGraph)).Evaluate(Time.fixedDeltaTime); ragdoll.character.refs.animations.ConfigureIK(); foreach (Bodypart part in ragdoll.partList) { part.SaveAnimationData(); ragdoll.DrawLines(part.jointParent, part); } ragdoll.SaveAdditionalTransformPositions(); ragdoll.ResetRotation(); foreach (Bodypart part2 in ragdoll.partList) { part2.ResetTransform(); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }