Decompiled source of RansomLC v1.0.0

RansomLC.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RansomLC.NetcodePatcher;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RansomLC")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RansomLC")]
[assembly: AssemblyTitle("RansomLC")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
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;
		}
	}
}
namespace RansomLC
{
	public class API
	{
		public static UnityEvent OnRansomAttack = new UnityEvent();

		public static UnityEvent OnRansomHack = new UnityEvent();

		public static UnityEvent OnRansomPaid = new UnityEvent();

		public static UnityEvent OnRansomNotPaid = new UnityEvent();
	}
	public class MoonConfig
	{
		public string moon;

		public ConfigEntry<int> Rarity;

		public ConfigEntry<int> CooldownMin;

		public ConfigEntry<int> CooldownMax;

		public ConfigEntry<float> GoldMultiplier;

		public MoonConfig(ConfigFile config, SelectableLevel level)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			Rarity = config.Bind<int>(level.PlanetName, "Rarity", 1, new ConfigDescription("Spawn rarity for " + level.PlanetName + ".\n1: Always spawns;\nBigger than 1: Chance 1/Value", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			CooldownMin = config.Bind<int>(level.PlanetName, "Cooldown minimum", 50, new ConfigDescription("Cooldown minimum for " + level.PlanetName + ".\nMinimum time for ransom to attack player\n (Specified in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 540), Array.Empty<object>()));
			CooldownMax = config.Bind<int>(level.PlanetName, "Cooldown maximum", 100, new ConfigDescription("Cooldown maximum for " + level.PlanetName + ".\nMaximum time for ransom to attack player (Specified in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 540), Array.Empty<object>()));
			GoldMultiplier = config.Bind<float>(level.PlanetName, "Gold multiplier", level.factorySizeMultiplier, new ConfigDescription("Gold multiplier for " + level.PlanetName + ".\nMaximum time for ransom to attack player (Specified in seconds)", (AcceptableValueBase)null, Array.Empty<object>()));
			moon = level.PlanetName;
		}
	}
	[BepInPlugin("WaterGun.ransomLC", "RansomLC", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(NetworkManager))]
		internal static class NetworkPrefabPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("SetSingleton")]
			private static void RegisterPrefab()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("WaterGun.ransomLC Prefab");
				((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
				val.AddComponent<RansomNetworkManager>();
				NetworkObject obj = val.AddComponent<NetworkObject>();
				FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(obj, GetHash("WaterGun.ransomLC"));
				NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val);
				netManager = val;
				static uint GetHash(string value)
				{
					return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0;
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRound_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("Start")]
			public static void Start_Post()
			{
				if (NetworkManager.Singleton.IsServer && (Object)(object)netManager != (Object)null)
				{
					Object.Instantiate<GameObject>(netManager).GetComponent<NetworkObject>().Spawn(false);
				}
				SelectableLevel[] levels = StartOfRound.Instance.levels;
				foreach (SelectableLevel val in levels)
				{
					if (val.planetHasTime)
					{
						RegisterMoonConfig(val);
					}
				}
				foreach (KeyValuePair<string, MoonConfig> moonConfig in RansomNetworkManager.Instance.MoonConfigs)
				{
					RansomNetworkManager.Instance.moonUsables[moonConfig.Key] = new MoonInstance(moonConfig.Value);
				}
				if (!NetworkManager.Singleton.IsServer)
				{
					RansomNetworkManager.Instance.RequestConfigsRpc();
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("SceneManager_OnLoadComplete1")]
			public static void SceneManager_OnLoadComplete1_Post(StartOfRound __instance, ref string sceneName)
			{
				if (sceneName == "SampleSceneRelay")
				{
					return;
				}
				MoonConfig moonConfig = RansomNetworkManager.Instance.MoonConfigs[__instance.currentLevel.PlanetName];
				if (moonConfig != null)
				{
					if (moonConfig.Rarity.Value == 1)
					{
						RansomHandler.Instance.isEnabled = true;
					}
					else if (Random.Range(1, moonConfig.Rarity.Value + 1) == 1)
					{
						RansomHandler.Instance.isEnabled = true;
					}
					else
					{
						RansomHandler.Instance.isEnabled = false;
					}
				}
				else if (defaultRarity.Value == 1)
				{
					RansomHandler.Instance.isEnabled = true;
				}
				else if (Random.Range(1, defaultRarity.Value + 1) == 1)
				{
					RansomHandler.Instance.isEnabled = true;
				}
				else
				{
					RansomHandler.Instance.isEnabled = false;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		internal class PlayerControllerB_Patch
		{
			[HarmonyPrefix]
			[HarmonyPatch("NextItemSlot")]
			public static bool NextItemSlot_Pre(ref int __result, PlayerControllerB __instance)
			{
				if (__instance.currentItemSlot == 50 && RansomHandler.Instance.isDuringGame)
				{
					__result = RansomHandler.Instance.slotOnStart;
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch("FirstEmptyItemSlot")]
			public static bool FirstEmptyItemSlot_Pre(ref int __result)
			{
				if (RansomHandler.Instance.isDuringGame || RansomHandler.Instance.isDuringAttack)
				{
					__result = RansomHandler.Instance.slotOnStart;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(HUDManager))]
		internal class HUDManager_Patch
		{
			[HarmonyPostfix]
			[HarmonyPatch("Start")]
			public static void Start_Post(HUDManager __instance)
			{
				currentRansomHUD = Object.Instantiate<GameObject>(RansomHUD, __instance.HUDContainer.transform.parent);
			}
		}

		[HarmonyPatch(typeof(ShipTeleporter))]
		internal class ShipTeleporter_Patch
		{
			[HarmonyPrefix]
			[HarmonyPatch("PressTeleportButtonOnLocalClient")]
			public static bool PressTeleportButtonOnLocalClient_Pre()
			{
				if (RansomNetworkManager.Instance.clientsWithRansom.Any((ulong c) => c == StartOfRound.Instance.mapScreen.targetedPlayer.playerClientId))
				{
					HUDManager.Instance.DisplayTip("Ship teleporter", "The player you want to teleport seems to be hijacked...", true, false, "LC_Tip1");
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EntranceTeleport))]
		internal class EntranceTeleporte_Patch
		{
			[HarmonyPrefix]
			[HarmonyPatch("TeleportPlayer")]
			public static bool TeleportPlayer_Pre()
			{
				if (RansomHandler.Instance.isDuringGame || RansomHandler.Instance.isDuringAttack)
				{
					HUDManager.Instance.DisplayTip("Ransom", "DOOR HAS BEEN LOCKED", true, false, "LC_Tip1");
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch("FinishOpeningEntrance")]
			public static bool FinishOpeningEntrance_Pre(PlayerControllerB __instance)
			{
				if ((RansomHandler.Instance.isDuringGame || RansomHandler.Instance.isDuringAttack) && (Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch("StartOpeningEntrance")]
			public static bool StartOpeningEntrance_Pre(PlayerControllerB __instance)
			{
				if ((RansomHandler.Instance.isDuringGame || RansomHandler.Instance.isDuringAttack) && (Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					return false;
				}
				return true;
			}
		}

		private const string GUID = "WaterGun.ransomLC";

		private const string NAME = "RansomLC";

		private const string VER = "1.0.0";

		public static ConfigFile config;

		public static ManualLogSource logger;

		public static GameObject RansomHUD;

		public static GameObject currentRansomHUD;

		public static GameObject netManager;

		public static Dictionary<string, MethodInfo> methodsToAdd = new Dictionary<string, MethodInfo>();

		public static ConfigEntry<int> defaultRarity;

		public static ConfigEntry<int> defaultCooldownMin;

		public static ConfigEntry<int> defaultCooldownMax;

		public static ConfigEntry<float> defaultGoldMultiplier;

		public static ConfigEntry<bool> killsPlayer;

		public static ConfigEntry<bool> scanNodes;

		public static ConfigEntry<int> damageAmount;

		public static void RegisterMoonConfig(SelectableLevel level)
		{
			if (config == null)
			{
				logger.LogInfo((object)"Something went wrong during config creation");
			}
			else
			{
				RansomNetworkManager.Instance.MoonConfigs.Add(level.PlanetName, new MoonConfig(config, level));
			}
		}

		private void Awake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			config = ((BaseUnityPlugin)this).Config;
			logger = ((BaseUnityPlugin)this).Logger;
			killsPlayer = config.Bind<bool>("General", "Kill Player", true, new ConfigDescription("Should ransom kill the player after the attack?", (AcceptableValueBase)null, Array.Empty<object>()));
			scanNodes = config.Bind<bool>("General", "ScanNodes", false, new ConfigDescription("Should the gold spawned by ransom be scannable?", (AcceptableValueBase)null, Array.Empty<object>()));
			damageAmount = config.Bind<int>("General", "Damage amount", 90, new ConfigDescription("What should be the damage after the ransom attack\n (Ignored if 'Kill player' is disabled)", (AcceptableValueBase)null, Array.Empty<object>()));
			defaultRarity = config.Bind<int>("Default", "Rarity", 1, new ConfigDescription("Default spawn rarity.\n1: Always spawns;\nBigger than 0: Chance 1/Value", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			defaultCooldownMin = config.Bind<int>("Default", "Cooldown minimum", 100, new ConfigDescription("Default cooldown minimum.\nMinimum time for ransom to attack player\n (Specified in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 540), Array.Empty<object>()));
			defaultCooldownMax = config.Bind<int>("Default", "Cooldown maximum", 150, new ConfigDescription("Default cooldown maximum.\nMaximum time for ransom to attack player\n (Specified in seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 540), Array.Empty<object>()));
			defaultGoldMultiplier = config.Bind<float>("Default", "Gold multiplier", 1f, new ConfigDescription("Default Gold multiplier.\nGold amount multiplier", (AcceptableValueBase)null, Array.Empty<object>()));
			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);
					}
				}
			}
			Harmony val = new Harmony("WaterGun.ransomLC");
			val.PatchAll();
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ransomassets");
			AssetBundle val2 = AssetBundle.LoadFromFile(text);
			RansomHUD = val2.LoadAsset<GameObject>("Assets/LethalCompany/Mods/Ransom/RansomUI.prefab");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)RansomHUD).name + " Loaded!"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded succesfuly");
		}
	}
	[Serializable]
	public class GoldCollectable
	{
		public GameObject prefab;

		public int rarity;
	}
	[Serializable]
	public class LightState
	{
		public Light light;

		public Color color;

		public float lightTemperature;

		public LightState(Light source)
		{
			//IL_0011: 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)
			light = source;
			color = source.color;
			lightTemperature = source.colorTemperature;
		}

		public void Restore()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			light.color = color;
			light.colorTemperature = lightTemperature;
		}
	}
	[Serializable]
	public class BorderState
	{
		public Image image;

		public Animator animator;

		public bool enabled;

		public Color color;

		public BorderState(Image source)
		{
			//IL_0011: 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)
			image = source;
			color = ((Graphic)source).color;
			animator = ((Component)source).GetComponent<Animator>();
			enabled = ((Behaviour)animator).enabled;
		}

		public void Restore()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)image).color = color;
			((Behaviour)animator).enabled = enabled;
		}
	}
	[Serializable]
	public class WindowType
	{
		public RectTransform mainRect;

		public Image image;

		public List<Sprite> spriteTypes;
	}
	public class CoinController : MonoBehaviour
	{
		public int value;

		public ScanNodeProperties scan;

		public void OnPickup()
		{
			RansomHandler.Instance.DepositGold(value);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void Start()
		{
			if (RansomNetworkManager.Instance.scanNodes)
			{
				((Component)scan).gameObject.SetActive(true);
				scan.scrapValue = value;
				scan.subText = "Value: " + value;
			}
		}
	}
	public class RansomHandler : MonoBehaviour
	{
		public bool isDuringAttack = false;

		public bool isDuringGame = false;

		public int slotOnStart = -1;

		public static RansomHandler Instance;

		public Animator ransomAnim;

		public AudioSource audioSource;

		public Sprite hackedSprintmeter;

		public List<AudioClip> audioClips;

		public List<GoldCollectable> goldCollectables;

		public List<WindowType> windowTypes;

		public TMP_Text collectedText;

		public TMP_Text timeLeft;

		public GameObject inventoryObject;

		private List<BorderState> defaultSlots = new List<BorderState>();

		private List<LightState> defaultLights = new List<LightState>();

		private RectTransform canvasArea;

		private Coroutine ransomGame;

		private Sprite defaultSprint;

		private string[] randomTips = new string[4] { "<color=#DE3163>HACKED BY RANSOM</color>", "<color=#811331>THERE IS NO TIME</color>", "<color=#DE3163>ITS OVER</color>", "<color=#811331>&*^$%(&%^</color>" };

		private List<GameObject> hackedSlots = new List<GameObject>();

		private List<GameObject> spawnedGolds = new List<GameObject>();

		private int deposited = 0;

		private int time = 78;

		public bool isEnabled = false;

		private float timeJumpscare = -1f;

		public void ResetRansom()
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			if ((Object)(object)RansomNetworkManager.Instance != (Object)null)
			{
				RansomNetworkManager.Instance?.SetPlayerRansomRpc(GameNetworkManager.Instance.localPlayerController.playerClientId, value: false);
			}
			InputAction obj = InputSystem.actions.FindAction("SwitchItem", false);
			if (obj != null)
			{
				obj.Enable();
			}
			Animator obj2 = ransomAnim;
			if (obj2 != null)
			{
				obj2.SetBool("Attacking", false);
			}
			time = 78;
			deposited = 0;
			isDuringGame = false;
			if ((Object)(object)defaultSprint != (Object)null && (Object)(object)HUDManager.Instance != (Object)null)
			{
				((Component)HUDManager.Instance.HUDContainer.transform.Find("TopLeftCorner/SprintMeter")).GetComponent<Image>().sprite = defaultSprint;
			}
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				((Component)val).gameObject.SetActive(false);
			}
			audioSource.Stop();
			((MonoBehaviour)this).StopCoroutine(ransomGame);
			ransomGame = null;
			foreach (LightState defaultLight in defaultLights)
			{
				defaultLight?.Restore();
			}
			foreach (GameObject spawnedGold in spawnedGolds)
			{
				if ((Object)(object)spawnedGold != (Object)null)
				{
					Object.Destroy((Object)(object)spawnedGold);
				}
			}
			foreach (GameObject hackedSlot in hackedSlots)
			{
				if ((Object)(object)hackedSlot != (Object)null)
				{
					Object.Destroy((Object)(object)hackedSlot);
				}
			}
			foreach (BorderState defaultSlot in defaultSlots)
			{
				defaultSlot?.Restore();
			}
			HUDManager instance = HUDManager.Instance;
			if (instance != null)
			{
				instance.ShakeCamera((ScreenShakeType)0);
			}
			HUDManager instance2 = HUDManager.Instance;
			if (instance2 != null)
			{
				instance2.ClearControlTips();
			}
			defaultLights?.Clear();
			timeJumpscare = -1f;
		}

		public void DepositGold(int value)
		{
			deposited += value;
			audioSource.PlayOneShot(audioClips[6]);
			collectedText.text = (500 - deposited).ToString();
			if (deposited >= 500)
			{
				ResetRansom();
				UnityEvent onRansomPaid = API.OnRansomPaid;
				if (onRansomPaid != null)
				{
					onRansomPaid.Invoke();
				}
				audioSource.PlayOneShot(audioClips[7]);
				ransomAnim.SetTrigger("ThankYou");
			}
		}

		private void Awake()
		{
			Instance = this;
			canvasArea = ((Component)this).GetComponent<RectTransform>();
			Plugin.logger.LogInfo((object)"ransomHandler Initialized!");
		}

		private void OnDestroy()
		{
			Instance = null;
		}

		public string ReturnTime(int time)
		{
			int num = time / 60;
			int num2 = time % 60;
			return $"{num:00}:{num2:00}";
		}

		private void Update()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if ((GameNetworkManager.Instance.localPlayerController.isPlayerDead || StartOfRound.Instance.inShipPhase) && ransomGame != null)
			{
				ResetRansom();
			}
			else if (ransomGame != null)
			{
				timeLeft.text = ReturnTime(time);
			}
			if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory || !isEnabled || timeJumpscare == 0f || GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				return;
			}
			if (timeJumpscare == -1f)
			{
				MoonInstance moonInstance = RansomNetworkManager.Instance.moonUsables[StartOfRound.Instance.currentLevel.PlanetName];
				int num = moonInstance?.cooldownMin ?? RansomNetworkManager.Instance.defaultCooldownMin;
				int num2 = moonInstance?.cooldownMax ?? RansomNetworkManager.Instance.defaultCooldownMax;
				if (num > num2)
				{
					num2 = num;
				}
				float num3 = Time.realtimeSinceStartup + (float)Random.Range(num, num2 + 1);
				timeJumpscare = num3;
			}
			if (timeJumpscare <= Time.realtimeSinceStartup)
			{
				MoveToRandomPosition(((Component)((Component)this).transform.Find("Ransom")).GetComponent<RectTransform>());
				ransomAnim.SetTrigger("IdleJumpscare");
				audioSource.PlayOneShot(audioClips[0]);
				if (ransomGame != null)
				{
					((MonoBehaviour)this).StopCoroutine(ransomGame);
				}
				ransomGame = ((MonoBehaviour)this).StartCoroutine(handleJumpscare());
				timeJumpscare = 0f;
			}
		}

		public void MoveToRandomPosition(RectTransform popup)
		{
			//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_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004f: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = canvasArea.rect;
			float num = (0f - ((Rect)(ref rect)).width) / 2f;
			rect = popup.rect;
			float num2 = num + ((Rect)(ref rect)).width / 2f;
			rect = canvasArea.rect;
			float num3 = ((Rect)(ref rect)).width / 2f;
			rect = popup.rect;
			float num4 = Random.Range(num2, num3 - ((Rect)(ref rect)).width / 2f);
			rect = canvasArea.rect;
			float num5 = (0f - ((Rect)(ref rect)).height) / 2f;
			rect = popup.rect;
			float num6 = num5 + ((Rect)(ref rect)).height / 2f;
			rect = canvasArea.rect;
			float num7 = ((Rect)(ref rect)).height / 2f;
			rect = popup.rect;
			float num8 = Random.Range(num6, num7 - ((Rect)(ref rect)).height / 2f);
			popup.anchoredPosition = new Vector2(num4, num8);
		}

		public void HandleSpawningGold(int targetAmount)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			GameObject[] array = GameObject.FindGameObjectsWithTag("AINode");
			if (array.Length == 0)
			{
				return;
			}
			int num2 = 0;
			foreach (GoldCollectable goldCollectable2 in goldCollectables)
			{
				if ((Object)(object)goldCollectable2.prefab != (Object)null && goldCollectable2.rarity > 0)
				{
					num2 += goldCollectable2.rarity;
				}
			}
			while (num < targetAmount)
			{
				for (int i = 0; i < array.Length; i++)
				{
					if (num >= targetAmount)
					{
						break;
					}
					Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(array[i].transform.position, (float)Random.Range(5, 36), default(NavMeshHit), RoundManager.Instance.AnomalyRandom, -8193, 1f);
					int num3 = Random.Range(1, num2 + 1);
					GoldCollectable goldCollectable = null;
					foreach (GoldCollectable goldCollectable3 in goldCollectables)
					{
						num3 -= goldCollectable3.rarity;
						if (num3 <= 0)
						{
							goldCollectable = goldCollectable3;
							break;
						}
					}
					if (goldCollectable == null)
					{
						return;
					}
					GameObject val = Object.Instantiate<GameObject>(goldCollectable.prefab, randomNavMeshPositionInBoxPredictable, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform);
					num += val.GetComponent<CoinController>().value;
					spawnedGolds.Add(val);
				}
			}
		}

		public void RandomizeWindows()
		{
			foreach (WindowType windowType in windowTypes)
			{
				if (Random.Range(1, 3) == 1)
				{
					((Component)windowType.mainRect).gameObject.SetActive(true);
					windowType.image.sprite = windowType.spriteTypes[Random.Range(0, windowType.spriteTypes.Count)];
					MoveToRandomPosition(windowType.mainRect);
				}
				else
				{
					((Component)windowType.mainRect).gameObject.SetActive(false);
				}
			}
		}

		public IEnumerator handleJumpscare()
		{
			isDuringAttack = true;
			UnityEvent onRansomAttack = API.OnRansomAttack;
			if (onRansomAttack != null)
			{
				onRansomAttack.Invoke();
			}
			RansomNetworkManager.Instance.SetPlayerRansomRpc(GameNetworkManager.Instance.localPlayerController.playerClientId, value: true);
			yield return (object)new WaitForSeconds(0.95f);
			Vector2 mousepos = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).delta).ReadValue();
			bool pressedKeys = ((ButtonControl)Keyboard.current.anyKey).isPressed;
			yield return (object)new WaitForSeconds(0.05f);
			if (mousepos != ((InputControl<Vector2>)(object)((Pointer)Mouse.current).delta).ReadValue() || pressedKeys)
			{
				UnityEvent onRansomHack = API.OnRansomHack;
				if (onRansomHack != null)
				{
					onRansomHack.Invoke();
				}
				isDuringAttack = false;
				collectedText.text = "500";
				ransomAnim.SetBool("Attacking", true);
				if ((Object)(object)defaultSprint == (Object)null)
				{
					defaultSprint = ((Component)HUDManager.Instance.HUDContainer.transform.Find("TopLeftCorner/SprintMeter")).GetComponent<Image>().sprite;
				}
				((Component)HUDManager.Instance.HUDContainer.transform.Find("TopLeftCorner/SprintMeter")).GetComponent<Image>().sprite = hackedSprintmeter;
				InputSystem.actions.FindAction("SwitchItem", false).Disable();
				foreach (Transform item in HUDManager.Instance.HUDContainer.transform.Find("Inventory"))
				{
					Transform slot = item;
					if (!((Object)(object)slot == (Object)null) && !(((Object)slot).name == "Slot4Items (1)") && !(((Object)slot).name == "Slot" + GameNetworkManager.Instance.localPlayerController.currentItemSlot))
					{
						slotOnStart = GameNetworkManager.Instance.localPlayerController.currentItemSlot;
						Image image = ((Component)slot).GetComponent<Image>();
						defaultSlots.Add(new BorderState(image));
						((Behaviour)((Component)slot).GetComponent<Animator>()).enabled = false;
						((Graphic)image).color = Color.red;
						hackedSlots.Add(Object.Instantiate<GameObject>(inventoryObject, ((Component)slot).transform.position, Quaternion.identity, ((Component)slot).transform));
					}
				}
				Image chatBorder = ((Component)HUDManager.Instance.HUDContainer.transform.Find("BottomLeftCorner/Image")).GetComponent<Image>();
				defaultSlots.Add(new BorderState(chatBorder));
				((Behaviour)((Component)chatBorder).GetComponent<Animator>()).enabled = false;
				((Graphic)chatBorder).color = Color.red;
				isDuringGame = true;
				Transform windows = ((Component)this).transform.Find("Windows");
				((Component)windows).gameObject.SetActive(true);
				RectTransform mainWindow = ((Component)((Component)this).transform.Find("MainWindow")).GetComponent<RectTransform>();
				((Component)mainWindow).gameObject.SetActive(true);
				deposited = 0;
				int baseGoldAmount = 750;
				float facilityMultiplier = 1f + (RansomNetworkManager.Instance.moonUsables[StartOfRound.Instance.currentLevel.PlanetName].goldMultiplier - 1f) * 0.65f;
				int targetAmount = Mathf.RoundToInt((float)baseGoldAmount * facilityMultiplier);
				HandleSpawningGold(targetAmount);
				if (RoundManager.Instance.allPoweredLights.Count > 0)
				{
					defaultLights.Clear();
					foreach (Light light in RoundManager.Instance.allPoweredLights)
					{
						defaultLights.Add(new LightState(light));
						light.color = Color.red;
						light.colorTemperature = 1500f;
					}
				}
				audioSource.PlayOneShot(audioClips[5]);
				ransomAnim.SetTrigger("StartAttack");
				yield return (object)new WaitForSeconds(0.95f);
				audioSource.PlayOneShot(audioClips[1]);
				GameObject downloading = ((Component)((Component)this).transform.Find("Downloading")).gameObject;
				downloading.SetActive(true);
				GameObject vignette = ((Component)((Component)this).transform.Find("RedVignette")).gameObject;
				yield return (object)new WaitForSeconds(1f);
				HUDManager.Instance.ShakeCamera((ScreenShakeType)4);
				vignette.SetActive(true);
				audioSource.clip = audioClips[2];
				audioSource.Play();
				for (int i = 0; i < 26; i++)
				{
					int random = Random.Range(1, 15);
					if (random == 1)
					{
						MoveToRandomPosition(mainWindow);
						RoundManager.Instance.FlickerLights(false, false);
					}
					else if (random > 8)
					{
						RandomizeWindows();
					}
					time--;
					yield return (object)new WaitForSeconds(1f);
				}
				audioSource.clip = audioClips[3];
				audioSource.Play();
				for (int j = 0; j < 26; j++)
				{
					int random2 = Random.Range(1, 8);
					if (random2 == 1)
					{
						MoveToRandomPosition(mainWindow);
						RoundManager.Instance.FlickerLights(false, false);
					}
					else if (random2 > 4)
					{
						RandomizeWindows();
					}
					time--;
					yield return (object)new WaitForSeconds(1f);
				}
				audioSource.clip = audioClips[4];
				audioSource.Play();
				for (int k = 0; k < 25; k++)
				{
					MoveToRandomPosition(mainWindow);
					RandomizeWindows();
					for (int j2 = randomTips.Length - 1; j2 > 0; j2--)
					{
						int randomIndex = Random.Range(0, j2 + 1);
						string temp = randomTips[j2];
						randomTips[j2] = randomTips[randomIndex];
						randomTips[randomIndex] = temp;
					}
					HUDManager.Instance.ChangeControlTipMultiple(randomTips, false, (Item)null);
					HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
					RoundManager.Instance.FlickerLights(false, false);
					time--;
					yield return (object)new WaitForSeconds(1f);
				}
				yield return (object)new WaitForSeconds(0.5f);
				audioSource.PlayOneShot(audioClips[5]);
				vignette.SetActive(false);
				downloading.SetActive(false);
				ransomAnim.SetTrigger("Jumpscare");
				yield return (object)new WaitForSeconds(1.2f);
				UnityEvent onRansomNotPaid = API.OnRansomNotPaid;
				if (onRansomNotPaid != null)
				{
					onRansomNotPaid.Invoke();
				}
				GrabbableObject[] slots = GameNetworkManager.Instance.localPlayerController.ItemSlots;
				GrabbableObject itemOnlySlot = GameNetworkManager.Instance.localPlayerController.ItemOnlySlot;
				for (int l = 0; l < slots.Length; l++)
				{
					if (l != slotOnStart && (Object)(object)slots[l] != (Object)null)
					{
						HUDManager.Instance.itemSlotIcons[l].sprite = null;
						((Behaviour)HUDManager.Instance.itemSlotIcons[l]).enabled = false;
						RansomNetworkManager.Instance.DespawnItemRpc(NetworkObjectReference.op_Implicit(((Component)slots[l]).GetComponent<NetworkObject>()));
					}
				}
				if (slotOnStart == 50 && (Object)(object)itemOnlySlot != (Object)null)
				{
					HUDManager.Instance.itemOnlySlotIcon.sprite = null;
					((Behaviour)HUDManager.Instance.itemOnlySlotIcon).enabled = false;
					RansomNetworkManager.Instance.DespawnItemRpc(NetworkObjectReference.op_Implicit(((Component)itemOnlySlot).GetComponent<NetworkObject>()));
				}
				if (RansomNetworkManager.Instance.killsPlayer)
				{
					GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.up * 25f, true, (CauseOfDeath)0, 8, default(Vector3), false);
				}
				else
				{
					GameNetworkManager.Instance.localPlayerController.DamagePlayer(RansomNetworkManager.Instance.damageAmount, true, true, (CauseOfDeath)0, 8, false, Vector3.up * 25f);
				}
				ResetRansom();
			}
			else
			{
				RansomNetworkManager.Instance.SetPlayerRansomRpc(GameNetworkManager.Instance.localPlayerController.playerClientId, value: false);
				isDuringAttack = false;
				timeJumpscare = -1f;
			}
		}
	}
	public class MoonInstance
	{
		public string name;

		public int rarity;

		public int cooldownMin;

		public int cooldownMax;

		public float goldMultiplier;

		public MoonInstance(MoonConfig cfg)
		{
			name = cfg.moon;
			rarity = cfg.Rarity.Value;
			cooldownMin = cfg.CooldownMin.Value;
			cooldownMax = cfg.CooldownMax.Value;
			goldMultiplier = cfg.GoldMultiplier.Value;
		}
	}
	public class RansomNetworkManager : NetworkBehaviour
	{
		public static RansomNetworkManager Instance;

		public List<ulong> clientsWithRansom = new List<ulong>();

		public Dictionary<string, MoonConfig> MoonConfigs = new Dictionary<string, MoonConfig>();

		public Dictionary<string, MoonInstance> moonUsables = new Dictionary<string, MoonInstance>();

		public bool killsPlayer = true;

		public bool scanNodes = false;

		public int damageAmount = 90;

		public int defaultRarity;

		public int defaultCooldownMin;

		public int defaultCooldownMax;

		public float defaultGoldMultiplier;

		private void Awake()
		{
			Instance = this;
			killsPlayer = Plugin.killsPlayer.Value;
			scanNodes = Plugin.scanNodes.Value;
			damageAmount = Plugin.damageAmount.Value;
			defaultRarity = Plugin.defaultRarity.Value;
			defaultCooldownMin = Plugin.defaultCooldownMin.Value;
			defaultCooldownMax = Plugin.defaultCooldownMax.Value;
			defaultGoldMultiplier = Plugin.defaultGoldMultiplier.Value;
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
			Instance = null;
		}

		private string SerializeMoonConfigs()
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<string, MoonConfig> moonConfig in MoonConfigs)
			{
				if (stringBuilder.Length > 0)
				{
					stringBuilder.Append(";");
				}
				stringBuilder.Append(moonConfig.Key);
				stringBuilder.Append("|");
				stringBuilder.Append(moonConfig.Value.Rarity.Value);
				stringBuilder.Append("|");
				stringBuilder.Append(moonConfig.Value.CooldownMin.Value);
				stringBuilder.Append("|");
				stringBuilder.Append(moonConfig.Value.CooldownMax.Value);
				stringBuilder.Append("|");
				stringBuilder.Append(moonConfig.Value.GoldMultiplier.Value);
			}
			return stringBuilder.ToString();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void RequestConfigsRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4023968690u, val3, val, (SendTo)2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 4023968690u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					string data = SerializeMoonConfigs();
					SendConfigsRpc($"{defaultRarity}|{defaultCooldownMin}|{defaultCooldownMax}|{defaultGoldMultiplier}", data, killsPlayer, scanNodes, damageAmount);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SendConfigsRpc(string defaultData, string data, bool kPlayer, bool sNodes, int dmgAmount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1785227345u, val3, val, (SendTo)6, (RpcDelivery)0);
				bool flag = defaultData != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(defaultData, false);
				}
				bool flag2 = data != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(data, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref kPlayer, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sNodes, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, dmgAmount);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1785227345u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Plugin.logger.LogInfo((object)$"Received configs: {data} + {defaultData} + {kPlayer} + {sNodes} + {dmgAmount}");
			string[] array = data.Split(';');
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split('|');
				if (array3.Length != 4)
				{
					continue;
				}
				string text2 = array3[0];
				if (int.TryParse(array3[1], out var result) && int.TryParse(array3[2], out var result2) && int.TryParse(array3[3], out var result3) && float.TryParse(array3[4], out var result4))
				{
					if (!moonUsables.TryGetValue(text2, out MoonInstance value))
					{
						Plugin.logger.LogWarning((object)("Received config for unknown moon: " + text2));
						continue;
					}
					value.rarity = result;
					value.cooldownMin = result2;
					value.cooldownMax = result3;
					value.goldMultiplier = result4;
					Plugin.logger.LogInfo((object)("Applied " + text2 + ": " + $"Rarity={result}, " + $"CooldownMin={result2}, " + $"CooldownMax={result3}"));
				}
			}
			string[] array4 = defaultData.Split('|');
			int.TryParse(array4[0], out var result5);
			int.TryParse(array4[1], out var result6);
			int.TryParse(array4[2], out var result7);
			float.TryParse(array4[3], out var result8);
			killsPlayer = kPlayer;
			scanNodes = sNodes;
			damageAmount = dmgAmount;
			defaultRarity = result5;
			defaultCooldownMin = result6;
			defaultCooldownMax = result7;
			defaultGoldMultiplier = result8;
			Plugin.logger.LogInfo((object)($"killsPlayer={killsPlayer}" + $"defRarity={defaultRarity}" + $"defCooldownMin={defaultCooldownMin}" + $"defCooldownMax={defaultCooldownMax}" + $"defGoldMultiplier={defaultGoldMultiplier}"));
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetPlayerRansomRpc(ulong clientId, bool value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(244258448u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 244258448u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (value)
				{
					clientsWithRansom.Add(clientId);
				}
				else
				{
					clientsWithRansom.Remove(clientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DespawnItemRpc(NetworkObjectReference Ref)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1721994311u, val3, val, (SendTo)2, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref Ref, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1721994311u, val3, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val4 = default(NetworkObject);
				if (((NetworkObjectReference)(ref Ref)).TryGet(ref val4, (NetworkManager)null))
				{
					val4.Despawn(true);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(4023968690u, new RpcReceiveHandler(__rpc_handler_4023968690), "RequestConfigsRpc");
			((NetworkBehaviour)this).__registerRpc(1785227345u, new RpcReceiveHandler(__rpc_handler_1785227345), "SendConfigsRpc");
			((NetworkBehaviour)this).__registerRpc(244258448u, new RpcReceiveHandler(__rpc_handler_244258448), "SetPlayerRansomRpc");
			((NetworkBehaviour)this).__registerRpc(1721994311u, new RpcReceiveHandler(__rpc_handler_1721994311), "DespawnItemRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_4023968690(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)1;
				((RansomNetworkManager)(object)target).RequestConfigsRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1785227345(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_0067: 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_009f: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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));
				string defaultData = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref defaultData, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string data = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref data, false);
				}
				bool kPlayer = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref kPlayer, default(ForPrimitives));
				bool sNodes = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sNodes, default(ForPrimitives));
				int dmgAmount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref dmgAmount);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RansomNetworkManager)(object)target).SendConfigsRpc(defaultData, data, kPlayer, sNodes, dmgAmount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_244258448(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RansomNetworkManager)(object)target).SetPlayerRansomRpc(clientId, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1721994311(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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)
			{
				NetworkObjectReference val = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref val, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RansomNetworkManager)(object)target).DespawnItemRpc(val);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "RansomNetworkManager";
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace RansomLC.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}