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.7.0")]
[assembly: AssemblyInformationalVersion("0.1.7")]
[assembly: AssemblyProduct("my.pahsiv.MyBananaDontHurtMe")]
[assembly: AssemblyTitle("MyBananaDontHurtMe")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.7.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 Prefix(ExplosionEffect __instance)
{
__instance.explosionPointCount = 0;
__instance.subExplosionPointCount = 0;
}
}
[HarmonyPatch(typeof(SFX_Player), "IPlaySFX")]
private static class ReduceDynamiteExplosionVolume
{
private static readonly string[] ExplosionClips = new string[9] { "Au_ExplosionLayer1", "Au_Explosion_Deep", "Au_explosionRock1", "Au_ExplosionLayer4", "Au_ExplosionLayer5", "Au_ExplosionLayer6", "Au_ExplosionLayer7", "Au_MagicBomb9", "Au_Explosion_Debris" };
public static void Postfix(IEnumerator __result, SFX_Instance SFX)
{
if ((Object)(object)SFX != (Object)null && ((Object)SFX).name.Contains("Dynamite Explode"))
{
((MonoBehaviour)SFX_Player.instance).StartCoroutine(ReduceVolumeWhilePlaying());
}
}
private static IEnumerator ReduceVolumeWhilePlaying()
{
AudioSource[] array = Object.FindObjectsByType<AudioSource>((FindObjectsSortMode)0);
AudioSource[] array2 = array;
foreach (AudioSource val in array2)
{
if ((Object)(object)val.clip != (Object)null && ExplosionClips.Contains(((Object)val.clip).name))
{
val.volume = Plugin.ExplosionVolume.Value;
}
}
yield return null;
}
}
}
[HarmonyPatch(typeof(BananaPeel), "Start")]
public static class BananaPeel_Start_Patch
{
[HarmonyPostfix]
public static void Postfix(BananaPeel __instance)
{
Item component = ((Component)__instance).GetComponent<Item>();
if (!((Object)(object)component == (Object)null))
{
ItemImpactSFX component2 = ((Component)component).GetComponent<ItemImpactSFX>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = false;
}
ItemParticles component3 = ((Component)component).GetComponent<ItemParticles>();
if ((Object)(object)component3 != (Object)null)
{
((Behaviour)component3).enabled = false;
}
EventOnItemCollision component4 = ((Component)component).GetComponent<EventOnItemCollision>();
if ((Object)(object)component4 != (Object)null)
{
((Behaviour)component4).enabled = false;
}
ItemCooking component5 = ((Component)component).GetComponent<ItemCooking>();
if ((Object)(object)component5 != (Object)null)
{
((Behaviour)component5).enabled = false;
}
LootData component6 = ((Component)component).GetComponent<LootData>();
if ((Object)(object)component6 != (Object)null)
{
((Behaviour)component6).enabled = false;
}
ColorblindVariant component7 = ((Component)component).GetComponent<ColorblindVariant>();
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<Rigidbody>();
if ((Object)(object)component == (Object)null)
{
return;
}
Item component2 = ((Component)__instance).GetComponent<Item>();
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>();
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>();
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<ItemPhysicsSyncer, int> s_bananaPeelCounters = new Dictionary<ItemPhysicsSyncer, int>();
private static Dictionary<ItemPhysicsSyncer, bool> s_bananaPeelSyncState = new Dictionary<ItemPhysicsSyncer, bool>();
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<BananaPeel>();
if ((Object)(object)component != (Object)null)
{
if (!s_bananaPeelSyncState.ContainsKey(__instance))
{
s_bananaPeelSyncState[__instance] = true;
}
bool flag = s_bananaPeelSyncState[__instance];
if (!((PhotonBinaryStreamSerializer<ItemPhysicsSyncData>)(object)__instance).RemoteValue.IsNone)
{
ItemPhysicsSyncData value = ((PhotonBinaryStreamSerializer<ItemPhysicsSyncData>)(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
{
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;
}
}
private IEnumerator PeriodicCheck()
{
while (Plugin.PeriodicCheck)
{
yield return (object)new WaitForSeconds(20f);
if (Plugin.PeriodicCheck)
{
((MonoBehaviour)this).StartCoroutine(CheckAllPlayers());
}
}
periodicCheckCoroutine = null;
}
private IEnumerator CheckAllPlayers()
{
if (Character.AllCharacters == null)
{
yield break;
}
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)Character.localCharacter)
{
yield return null;
continue;
}
if (CheckMagnitude(allCharacter))
{
string text = Plugin.RemoveTags(((Object)allCharacter.player).name);
Plugin.Log.LogMessage((object)(text + " High Magnitude Detected!"));
ResetRagdollPhysics(allCharacter);
}
yield return null;
}
}
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));
}
private IEnumerator ReEnablePhysics(Character character)
{
yield return (object)new WaitForFixedUpdate();
if ((Object)(object)character == (Object)null || character.refs == null || (Object)(object)character.refs.ragdoll == (Object)null || character.refs.ragdoll.partList == null)
{
yield break;
}
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;
}
}
}
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_001d: 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)
Vector3 position = ((Component)__instance).transform.position;
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return true;
}
float num = Vector3.Distance(position, ((Component)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_001d: 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)
Vector3 position = ((Component)__instance).transform.position;
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return true;
}
float num = Vector3.Distance(position, ((Component)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>();
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<MeshFilter>();
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>();
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<MeshFilter>();
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<Item, float> myDestroyTicks = new Dictionary<Item, float>();
private static bool Prefix(Item __instance)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return true;
}
float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: 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)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: 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"))
{
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return true;
}
float num = Vector3.Distance(position, ((Component)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;
}
Camera main2 = Camera.main;
if ((Object)(object)main2 == (Object)null)
{
return true;
}
float num3 = Vector3.Distance(position, ((Component)main2).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;
}
Camera main3 = Camera.main;
if ((Object)(object)main3 == (Object)null)
{
return true;
}
float num5 = Mathf.Sqrt(Mathf.Pow(position.x - ((Component)main3).transform.position.x, 2f) + Mathf.Pow(position.z - ((Component)main3).transform.position.z, 2f));
if (num5 > 45f)
{
return false;
}
}
if (creator != null && creator != PhotonNetwork.MasterClient)
{
Camera main4 = Camera.main;
if ((Object)(object)main4 == (Object)null)
{
return true;
}
float num6 = Vector3.Distance(position, ((Component)main4).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"))
{
Camera main5 = Camera.main;
if ((Object)(object)main5 == (Object)null)
{
return true;
}
float num7 = Vector3.Distance(position, ((Component)main5).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>();
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.7")]
public class Plugin : BaseUnityPlugin
{
public static bool gracePeriod;
public static bool PeriodicCheck;
public static Magnitude? MagnitudeCheck;
public static ConfigEntry<float> HighMagnitudeThreshold;
public static ConfigEntry<bool> ShowDebugInfo;
public static ConfigEntry<bool> NewBananaStabilize;
public static ConfigEntry<float> RagdollClose;
public static ConfigEntry<float> RagdollFar;
public static ConfigEntry<float> RagdollVeryFar;
public static ConfigEntry<float> ExplosionVolume;
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.7";
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_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Instance = this;
HighMagnitudeThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("General", "High Magnitude Threshold", 70f, "Magnitude for automatic ragdoll reset.");
NewBananaStabilize = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "New Banana Stabilizer", true, "Toggle for peels stabilizer");
ShowDebugInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debug Info", false, "");
RagdollClose = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Ragdoll Update Distance (Close)", 30f, new ConfigDescription("Distance for ragdoll update in full speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2500f), Array.Empty<object>()));
RagdollFar = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Ragdoll Update Distance (Far)", 100f, new ConfigDescription("Distance for ragdoll update in half speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2500f), Array.Empty<object>()));
RagdollVeryFar = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Ragdoll Update Distance (Very Far)", 1000f, new ConfigDescription("Distance for ragdoll update in very slow speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2500f), Array.Empty<object>()));
ExplosionVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Dynamite Explosion Volume", 0.2f, new ConfigDescription("Setting to reduce the sound volume of dynamite explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
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<MethodBase> 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<Magnitude>();
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();
}
}
public IEnumerator EndGracePeriod()
{
yield return (object)new WaitForSeconds(30f);
gracePeriod = false;
Log.LogMessage((object)" Remedy Fungus Grace Period Ended");
}
public IEnumerator SkippingInfo()
{
if (Network.skipCounter > 0)
{
Log.LogMessage((object)$"[ {Network.skipCounter} ] Banana Update Skipped!");
Network.ResetSkipCounter();
}
yield return (object)new WaitForSeconds(10f);
}
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<PlayerConnectionLog>();
if ((Object)(object)val == (Object)null)
{
return;
}
string text = "<color=#" + color + ">" + message + "</color>";
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 "<color=#" + color + ">" + text + "</color>";
}
}
internal class Ragdoll
{
[HarmonyPatch(typeof(CharacterRagdoll), "FixedUpdate")]
private class RagdollPatch
{
private static Dictionary<CharacterRagdoll, float> update_time = new Dictionary<CharacterRagdoll, float>();
private static float medium_update_time = 0.5f;
private static float far_update_time = 5f;
private static bool Prefix(CharacterRagdoll __instance)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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;
}
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return true;
}
float num = Vector3.Distance(__instance.character.Center, ((Component)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)
{
}
}
}