Decompiled source of GottaGoLethal v1.0.3

GottaGoLethal.dll

Decompiled a month ago
using System;
using System.Collections;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using GottaGoLethal.NetcodePatcher;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GottaGoLethal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GottaGoLethal")]
[assembly: AssemblyTitle("GottaGoLethal")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 GottaGoLethal
{
	public class AssetLoad
	{
		public static AssetBundle MainAssets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static ContentLoader ContentLoader;

		public static GameObject configManagerPrefab;

		public static void Init()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "gottagolethal"));
			ContentLoader = new ContentLoader(GottaGoLethal.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab)
			{
				Prefabs.Add(content.ID, prefab);
			});
			CustomContent[] array = (CustomContent[])(object)new CustomContent[4]
			{
				(CustomContent)new ScrapItem("SonicRegularRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicregularring.asset", GottaGoConfig.regularRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicDeathRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicdeathring.asset", GottaGoConfig.deathRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicFalseRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicfalsering.asset", GottaGoConfig.falseRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("SonicTeleportRing", "assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicteleportring.asset", GottaGoConfig.teleportRingSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null)
			};
			ContentLoader.RegisterAll(array);
			GameObject val = MainAssets.LoadAsset<GameObject>("assets/lethalcompany/mods/plugins/jehlou-gottagolethal/gottagolethal/prefabs/sonicphysicsring.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val);
		}
	}
	public class GottaGoConfig : SyncedConfig2<GottaGoConfig>
	{
		[SyncedEntryField]
		public static SyncedEntry<int> regularRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> deathRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> falseRingSpawnChance;

		[SyncedEntryField]
		public static SyncedEntry<int> teleportRingSpawnChance;

		public GottaGoConfig(ConfigFile configFile)
			: base(GottaGoLethal.pluginInfo.Metadata.GUID)
		{
			//IL_0020: 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_003b: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0066: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0092: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00bd: Expected O, but got Unknown
			regularRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Regular Ring"), 4, new ConfigDescription("Spawn chance for Regular Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			deathRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Death Ring"), 8, new ConfigDescription("Spawn chance for Death Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			falseRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "False Ring"), 15, new ConfigDescription("Spawn chance for False Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			teleportRingSpawnChance = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, new ConfigDefinition("Spawn Chance", "Teleport Ring"), 2, new ConfigDescription("Spawn chance for Teleport Ring", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigManager.Register<GottaGoConfig>((SyncedConfig2<GottaGoConfig>)(object)this);
		}
	}
	[BepInPlugin("GottaGoLethal", "GottaGoLethal", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("com.sigurd.csync", "5.0.0")]
	public class GottaGoLethal : BaseUnityPlugin
	{
		public const string ModGUID = "jehlou.gottagolethal";

		public const string ModName = "GottaGoLethal";

		public const string ModVersion = "1.0.1";

		public static bool devMode;

		internal static GottaGoConfig Config;

		public static PluginInfo pluginInfo;

		public static GottaGoLethal Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"GottaGoLethal v1.0.0 start loading!");
			Instance = this;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Config = new GottaGoConfig(((BaseUnityPlugin)this).Config);
			Version version = Chainloader.PluginInfos["evaisa.lethallib"].Metadata.Version;
			if (version.Major > 0 || version.Minor > 11 || (version.Minor == 11 && version.Build >= 2))
			{
				Logger.LogInfo((object)("LethalLib version is " + version?.ToString() + ", which is compatible with LethalThings 0.9.0+"));
				Type[] types = Assembly.GetExecutingAssembly().GetTypes();
				Type[] array = types;
				foreach (Type type in array)
				{
					MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array2 = methods;
					foreach (MethodInfo methodInfo in array2)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
				AssetLoad.Init();
				Patch();
				Logger.LogInfo((object)"GottaGoLethal v1.0.0 has loaded!");
			}
			else
			{
				Logger.LogError((object)("LethalLib version is " + version?.ToString() + ", which is not compatible with LethalThings 0.9.0+"));
				Logger.LogError((object)"Please update LethalLib to version 0.11.2 or newer");
			}
		}

		internal static void Patch()
		{
			//IL_000c: 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)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("GottaGoLethal");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		public static void ModifyPlayerDiscardAction(bool enableDiscard, PlayerControllerB playerHeldBy)
		{
			if ((Object)(object)playerHeldBy == (Object)(object)RoundManager.Instance.playersManager.localPlayerController)
			{
				if (enableDiscard)
				{
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Discard", false).Enable();
				}
				else
				{
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Discard", false).Disable();
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GottaGoLethal";

		public const string PLUGIN_NAME = "GottaGoLethal";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace GottaGoLethal.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
	[HarmonyPatch(typeof(TVScript))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void setInfiniteSprint(PlayerControllerB __instance)
		{
		}
	}
}
namespace GottaGoLethal.MonoBehaviours
{
	public class SonicFalseRing : GrabbableObject
	{
		public AudioClip wentFastSound;

		public AudioSource audioSource;

		private void PlayWentFastSound()
		{
			audioSource.PlayOneShot(wentFastSound, 1f);
		}

		public void GoFast()
		{
			PlayWentFastSound();
		}

		[ServerRpc]
		public void GoFastServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3986776512u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3986776512u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GoFastClientRpc();
			}
		}

		[ClientRpc]
		public void GoFastClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(37269713u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 37269713u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GoFast();
				}
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if (!base.isInShipRoom && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			GoFastServerRpc();
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SonicFalseRing()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3986776512u, new RpcReceiveHandler(__rpc_handler_3986776512));
			NetworkManager.__rpc_func_table.Add(37269713u, new RpcReceiveHandler(__rpc_handler_37269713));
		}

		private static void __rpc_handler_3986776512(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SonicFalseRing)(object)target).GoFastServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_37269713(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SonicFalseRing)(object)target).GoFastClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SonicFalseRing";
		}
	}
	public class SonicRegularRing : GrabbableObject
	{
		public float goFastTime = 60f;

		public float goDeadTime = 11.5f;

		public float flingUpAngle = 20f;

		public float flingForce = 3f;

		public bool goingFast;

		public bool wentFast;

		public bool goingToDie;

		public int ringcount = 10;

		public AudioClip goFastSound;

		public AudioClip goDieSound;

		public AudioClip wentFastSound;

		public AudioSource audioSource;

		public GameObject ringSplosionEffect;

		public SonicRigidRing ringWithRigidBody;

		public bool allowdestroy = true;

		public float debugOffset = 1f;

		public void GoFast()
		{
			((MonoBehaviour)this).StartCoroutine(StartGoFastCountdown(goFastTime));
		}

		[ServerRpc]
		public void GoFastServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2536947030u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2536947030u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GottaGoLethal.Logger.LogInfo((object)"Nima: GoFast ServerRpc");
				GoFastClientRpc();
			}
		}

		[ClientRpc]
		public void GoFastClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1570763840u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1570763840u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GottaGoLethal.Logger.LogInfo((object)"Nima: GoFast ClientRpc");
					GoFast();
				}
			}
		}

		private IEnumerator StartGoFastCountdown(float time)
		{
			goingFast = true;
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			PlayGoFastSound();
			yield return (object)new WaitForSeconds(time);
			((MonoBehaviour)this).StartCoroutine(StartDeathCountdown(goDeadTime));
		}

		private IEnumerator StartDeathCountdown(float time)
		{
			goingToDie = true;
			PlayGoDieSound();
			yield return (object)new WaitForSeconds(time);
			goingFast = false;
			goingToDie = false;
			wentFast = true;
			PlayWentFastSound();
			GottaGoLethal.Logger.LogInfo((object)("Nima: Spawn for " + RoundManager.Instance.playersManager.localPlayerController.playerClientId));
			if (((NetworkBehaviour)this).IsOwner)
			{
				SpawnRingsplosionServerRpc();
			}
		}

		[ServerRpc]
		public void SpawnRingsplosionServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2627976941u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2627976941u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ulong[] array = new ulong[ringcount];
				GottaGoLethal.Logger.LogInfo((object)"Server Ringsplosion");
				array = spawnRingsplosion();
				spawnRingsplosionClientRpc(array);
			}
		}

		[ClientRpc]
		public void spawnRingsplosionClientRpc(ulong[] ids)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0088: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(347746377u, val, (RpcDelivery)0);
				bool flag = ids != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ids, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 347746377u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				GottaGoLethal.Logger.LogInfo((object)"Client Ringsplosion");
				SonicRigidRing[] array = new SonicRigidRing[ringcount];
				for (int i = 0; i < ringcount; i++)
				{
					array[i] = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[ids[i]]).gameObject.GetComponent<SonicRigidRing>();
				}
				flingRigidRings(array);
				Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.5f, true, 5.7f, 6f, 50, 0f, ringSplosionEffect, false);
				wentFast = false;
				if (allowdestroy)
				{
					((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
				}
			}
		}

		public ulong[] spawnRingsplosion()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_004e: 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)
			GottaGoLethal.Logger.LogInfo((object)"Spawn Ringsplosion");
			SonicRigidRing[] array = new SonicRigidRing[ringcount];
			ulong[] array2 = new ulong[ringcount];
			for (int i = 0; i < ringcount; i++)
			{
				array[i] = Object.Instantiate<SonicRigidRing>(ringWithRigidBody, ((Component)this).transform.position + Vector3.up * debugOffset, Quaternion.identity);
				NetworkObject component = ((Component)array[i]).GetComponent<NetworkObject>();
				component.Spawn(false);
				array2[i] = component.NetworkObjectId;
			}
			return array2;
		}

		public void flingRigidRings(SonicRigidRing[] item)
		{
			//IL_001c: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			float num = 360f / (float)(item.Length - 1);
			for (int i = 0; i < item.Length; i++)
			{
				Ray flingRingDir = GetFlingRingDir(num * (float)i, flingUpAngle);
				item[i].force = flingForce;
				SonicRigidRing obj = item[i];
				Vector3 direction = ((Ray)(ref flingRingDir)).direction;
				obj.forceDir = ((Vector3)(ref direction)).normalized;
			}
		}

		public Ray GetFlingRingDir(float angleAround, float angleUp)
		{
			//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_0016: 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_0020: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_004a: 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_0059: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position + Vector3.up * debugOffset;
			Vector3 val2 = Quaternion.AngleAxis(angleUp, Vector3.right) * (Quaternion.AngleAxis(angleAround, Vector3.up) * Vector3.forward);
			Ray result = default(Ray);
			((Ray)(ref result))..ctor(val, val2);
			Debug.DrawRay(((Ray)(ref result)).origin, ((Ray)(ref result)).direction, Color.green, 15f);
			return result;
		}

		public override void Update()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (goingFast && !((Object)(object)base.playerHeldBy == (Object)null))
			{
				base.playerHeldBy.sprintMeter = 1f;
				base.playerHeldBy.isSprinting = true;
				base.playerHeldBy.isExhausted = false;
				base.playerHeldBy.gameplayCamera.fieldOfView = Mathf.Lerp(base.playerHeldBy.gameplayCamera.fieldOfView, 90f, 6f * Time.deltaTime);
				base.playerHeldBy.localVisor.localScale = calcVisorScale();
			}
		}

		public static Vector3 calcVisorScale()
		{
			//IL_0050: 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)
			float num = 1f;
			num = Mathf.Lerp(num, Mathf.Sin(num * 3.145f / 2f), 0.6f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0.68f, 0.8f, 0.95f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0.68f, 0.35f, 0.99f);
			return Vector3.LerpUnclamped(val, val2, num);
		}

		private void PlayGoFastSound()
		{
			audioSource.PlayOneShot(goFastSound, 1f);
		}

		private void PlayGoDieSound()
		{
			audioSource.PlayOneShot(goDieSound, 1f);
		}

		private void PlayWentFastSound()
		{
			audioSource.PlayOneShot(wentFastSound, 1f);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if ((goingFast & !base.isInShipRoom) && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!goingFast && !wentFast)
			{
				GoFastServerRpc();
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SonicRegularRing()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2536947030u, new RpcReceiveHandler(__rpc_handler_2536947030));
			NetworkManager.__rpc_func_table.Add(1570763840u, new RpcReceiveHandler(__rpc_handler_1570763840));
			NetworkManager.__rpc_func_table.Add(2627976941u, new RpcReceiveHandler(__rpc_handler_2627976941));
			NetworkManager.__rpc_func_table.Add(347746377u, new RpcReceiveHandler(__rpc_handler_347746377));
		}

		private static void __rpc_handler_2536947030(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SonicRegularRing)(object)target).GoFastServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1570763840(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SonicRegularRing)(object)target).GoFastClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2627976941(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SonicRegularRing)(object)target).SpawnRingsplosionServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_347746377(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				ulong[] ids = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref ids, default(ForPrimitives));
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SonicRegularRing)(object)target).spawnRingsplosionClientRpc(ids);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SonicRegularRing";
		}
	}
	public class SonicTeleportRing : GrabbableObject
	{
		public float teleporterChargeUp = 2f;

		public AudioSource teleporterAudio;

		public AudioClip teleporterBeamUpSFX;

		public AudioClip teleporterPrimeSFX;

		public void GoTeleport()
		{
			//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_003c: 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_004a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			GottaGoLethal.Logger.LogInfo((object)"GoTeleport");
			Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
			position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
			PlayTeleporterPrimeAudio();
			((MonoBehaviour)this).StartCoroutine(TeleportPlayerCoroutine((int)base.playerHeldBy.playerClientId, position));
		}

		private IEnumerator TeleportPlayerCoroutine(int playerObj, Vector3 teleportPos)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSeconds(teleporterChargeUp);
			TeleportPlayerServerRpc(playerObj, teleportPos);
		}

		[ServerRpc(RequireOwnership = false)]
		private void TeleportPlayerServerRpc(int playerObj, Vector3 teleportPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0071: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1695833749u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerObj);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref teleportPos);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1695833749u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					TeleportPlayerClientRpc(playerObj, teleportPos);
				}
			}
		}

		[ClientRpc]
		private void TeleportPlayerClientRpc(int playerObj, Vector3 teleportPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0071: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3956416923u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObj);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref teleportPos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3956416923u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayTeleporterBeamUpAudio();
				if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead)
				{
					TeleportPlayerBody(playerObj, teleportPos);
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				else
				{
					TeleportPlayer(playerObj, teleportPos);
					((GrabbableObject)this).DestroyObjectInHand(StartOfRound.Instance.allPlayerScripts[playerObj]);
				}
			}
		}

		public static IEnumerator TeleportPlayerBody(int playerObj, Vector3 teleportPosition)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			float startTime = Time.realtimeSinceStartup;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj].deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f));
			if (StartOfRound.Instance.inShipPhase || SceneManager.sceneCount <= 1)
			{
				yield break;
			}
			DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerObj].deadBody;
			if ((Object)(object)deadBody != (Object)null)
			{
				deadBody.attachedTo = null;
				deadBody.attachedLimb = null;
				deadBody.secondaryAttachedLimb = null;
				deadBody.secondaryAttachedTo = null;
				if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null)
				{
					deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
				}
				deadBody.isInShip = false;
				deadBody.parentedToShip = false;
				((Component)deadBody).transform.SetParent((Transform)null, true);
				deadBody.SetRagdollPositionSafely(teleportPosition, true);
			}
		}

		public static void TeleportPlayer(int playerObj, Vector3 teleportPos)
		{
			//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_0062: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
			}
			val.isInElevator = false;
			val.isInHangarShipRoom = false;
			val.isInsideFactory = true;
			val.averageVelocity = 0f;
			val.velocityLastFrame = Vector3.zero;
			StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
			StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
			if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
		}

		private void PlayTeleporterPrimeAudio()
		{
			teleporterAudio.PlayOneShot(teleporterPrimeSFX);
			base.playerHeldBy.movementAudio.PlayOneShot(teleporterPrimeSFX);
		}

		private void PlayTeleporterBeamUpAudio()
		{
			teleporterAudio.PlayOneShot(teleporterBeamUpSFX);
			base.playerHeldBy.movementAudio.PlayOneShot(teleporterBeamUpSFX);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
		}

		public override void GrabItem()
		{
			if (base.isInShipRoom && base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			}
			((GrabbableObject)this).GrabItem();
		}

		public override void EquipItem()
		{
			if (!base.isInShipRoom && !base.isInElevator)
			{
				GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: false, base.playerHeldBy);
			}
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItem()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnBroughtToShip()
		{
			GottaGoLethal.ModifyPlayerDiscardAction(enableDiscard: true, base.playerHeldBy);
			((GrabbableObject)this).OnBroughtToShip();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			GoTeleport();
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SonicTeleportRing()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1695833749u, new RpcReceiveHandler(__rpc_handler_1695833749));
			NetworkManager.__rpc_func_table.Add(3956416923u, new RpcReceiveHandler(__rpc_handler_3956416923));
		}

		private static void __rpc_handler_1695833749(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0052: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerObj = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
				Vector3 teleportPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref teleportPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SonicTeleportRing)(object)target).TeleportPlayerServerRpc(playerObj, teleportPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3956416923(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0052: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerObj = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
				Vector3 teleportPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref teleportPos);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SonicTeleportRing)(object)target).TeleportPlayerClientRpc(playerObj, teleportPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SonicTeleportRing";
		}
	}
	public class SonicRigidRing : NetworkBehaviour
	{
		public GrabbableObject sonicFalseRing;

		public float spawnVelocity = 0.1f;

		public float force = 10f;

		public Vector3 forceDir;

		internal Rigidbody rb;

		public void Start()
		{
			GottaGoLethal.Logger.LogInfo((object)"SonicRigidRing component start");
			rb = ((Component)this).GetComponent<Rigidbody>();
			rb.WakeUp();
		}

		public void FixedUpdate()
		{
			//IL_005c: 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_0013: 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_001e: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			if (force > 0f)
			{
				Debug.DrawRay(((Component)this).transform.position, forceDir, Color.red, 15f);
				rb.AddForce(forceDir * force, (ForceMode)1);
				force = 0f;
				return;
			}
			Vector3 velocity = rb.velocity;
			if (!(((Vector3)(ref velocity)).magnitude > spawnVelocity) && ((NetworkBehaviour)this).IsOwner)
			{
				SpawnFalseRingServerRpc();
			}
		}

		[ServerRpc]
		public void SpawnFalseRingServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(798002698u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 798002698u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GottaGoLethal.Logger.LogInfo((object)"Jehlou: Spawn Server False Ring");
				GrabbableObject val3 = Object.Instantiate<GrabbableObject>(sonicFalseRing, ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity);
				((Component)val3).GetComponent<NetworkObject>().Spawn(false);
				SpawnFalseRing(val3);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void SpawnFalseRing(GrabbableObject falseRing)
		{
			//IL_0007: 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_0018: 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)
			falseRing.startFallingPosition = ((Component)falseRing).transform.position;
			falseRing.targetFloorPosition = ((Component)falseRing).transform.position;
			falseRing.playerHeldBy = null;
			falseRing.reachedFloorTarget = false;
			falseRing.hasHitGround = false;
			falseRing.fallTime = 0f;
			falseRing.grabbable = true;
			falseRing.FallToGround(false);
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SonicRigidRing()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(798002698u, new RpcReceiveHandler(__rpc_handler_798002698));
		}

		private static void __rpc_handler_798002698(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SonicRigidRing)(object)target).SpawnFalseRingServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SonicRigidRing";
		}
	}
	public class TailsDollAI : EnemyAI
	{
		[Header("Behaviors")]
		public AISearchRoutine searchForPlayers;

		public bool investigating;

		public bool hasBegunInvestigating;

		public Vector3 investigatePosition;

		[Header("Audio")]
		public AudioSource tailsAudio;

		public AudioSource floatAudio;

		public AudioClip fullSong;

		public AudioClip canYouHearTheSunshine;

		public AudioClip itMakesMeWantToSurvive;

		public AudioClip youJustNeedToRunAway;

		public AudioClip whenYourHereIWishYouWereAlwaysNear;

		public AudioClip attackSound;

		public float rubyLightInterval = 1f;

		public float rubylightTimer;

		public float lightOnDuration = 0.1f;

		private float angeredTimer;

		private List<Light> lights = new List<Light>();

		public override void Start()
		{
			((EnemyAI)this).Start();
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
		}

		private void FixedUpdate()
		{
			_ = base.ventAnimationFinished;
		}

		private void OnTriggerEnter(Collider other)
		{
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead)
			{
				_ = StartOfRound.Instance.allPlayersDead;
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, false, -1);
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "TailsDollAI";
		}
	}
}
namespace GottaGoLethal.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}