Decompiled source of CursedScraps v2.1.1

CursedScraps.dll

Decompiled 2 weeks 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.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CursedScraps.Behaviours;
using CursedScraps.Behaviours.Curses;
using CursedScraps.Behaviours.Items;
using CursedScraps.CustomInputs;
using CursedScraps.Managers;
using CursedScraps.NetcodePatcher;
using CursedScraps.Patches;
using CursedScraps.Patches.ModsPatches;
using CursedScraps.Values;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CursedScraps")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CursedScraps")]
[assembly: AssemblyTitle("CursedScraps")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CursedScraps
{
	public class Constants
	{
		public const string GLOBAL = "_Global_";

		public const string HUD = "_HUD_";

		public const string HIDING_MECHANIC = "_Hiding mechanic_";

		public const string PENALTY_MECHANIC = "_Penalty mechanic_";

		public const string PENALTY_HARD = "Hard";

		public const string PENALTY_MEDIUM = "Medium";

		public const string PENALTY_NONE = "None";

		public const string HOLY_WATER = "Holy Water";

		public const string OLD_SCROLL = "Old Scroll";

		public const string INHIBITION = "Inhibition";

		public const string CONFUSION = "Confusion";

		public const string CAPTIVE = "Captive";

		public const string BLURRY = "Blurry";

		public const string MUTE = "Mute";

		public const string DEAFNESS = "Deafness";

		public const string ERRANT = "Errant";

		public const string PARALYSIS = "Paralysis";

		public const string SHADOW = "Shadow";

		public const string DIMINUTIVE = "Diminutive";

		public const string EXPLORATION = "Exploration";

		public const string COMMUNICATION = "Communication";

		public const string FRAGILE = "Fragile";

		public const string ERROR_OCCURRED = "Error occurred";

		public const string IMPOSSIBLE_ACTION = "Impossible action";

		public const string IMPORTANT_INFORMATION = "Important information";
	}
	[BepInPlugin("Lega.CursedScraps", "Cursed Scraps", "2.1.1")]
	public class CursedScraps : BaseUnityPlugin
	{
		private const string modGUID = "Lega.CursedScraps";

		private const string modName = "Cursed Scraps";

		private const string modVersion = "2.1.1";

		private readonly Harmony harmony = new Harmony("Lega.CursedScraps");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cursedscraps"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static List<CustomItem> customItems = new List<CustomItem>();

		public static List<CurseEffect> curseEffects = new List<CurseEffect>();

		public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("CursedScrapsNetworkManager");

		public static GameObject curseParticle;

		public static GameObject hotParticle;

		public static GameObject coldParticle;

		public static Material wallhackShader;

		public void Awake()
		{
			mls = Logger.CreateLogSource("CursedScraps");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			curseEffects = ConfigManager.GetCurseEffectsFromConfig();
			_ = CommunicationInputs.Instance;
			LoadManager();
			NetcodePatcher();
			LoadItems();
			LoadParticles();
			LoadShaders();
			harmony.PatchAll(typeof(IngamePlayerSettingsPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(BeltBagInventoryUIPatch));
			harmony.PatchAll(typeof(BeltBagItemPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(EnemyAIPatch));
			PatchOtherMods(harmony);
		}

		public static void LoadManager()
		{
			Utilities.FixMixerGroups(managerPrefab);
			managerPrefab.AddComponent<CursedScrapsNetworkManager>();
		}

		private static void NetcodePatcher()
		{
			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);
					}
				}
			}
		}

		public static void LoadItems()
		{
			if (ConfigManager.isHolyWater.Value)
			{
				customItems.Add(new CustomItem(typeof(HolyWater), bundle.LoadAsset<Item>("Assets/HolyWater/HolyWaterItem.asset"), isSpawnable: true, ConfigManager.minHolyWater.Value, ConfigManager.maxHolyWater.Value, ConfigManager.holyWaterRarity.Value));
			}
			customItems.Add(new CustomItem(typeof(OldScroll), bundle.LoadAsset<Item>("Assets/OldScroll/OldScrollItem.asset"), ConfigManager.isOldScrollSpawnable.Value, ConfigManager.minOldScroll.Value, ConfigManager.maxOldScroll.Value, ConfigManager.oldScrollRarity.Value));
			foreach (CustomItem item in customItems.ToList())
			{
				Component obj = item.Item.spawnPrefab.AddComponent(item.Type);
				PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
				((GrabbableObject)val).grabbable = true;
				((GrabbableObject)val).grabbableToEnemies = true;
				((GrabbableObject)val).itemProperties = item.Item;
				NetworkPrefabs.RegisterNetworkPrefab(item.Item.spawnPrefab);
				Utilities.FixMixerGroups(item.Item.spawnPrefab);
				Items.RegisterItem(item.Item);
			}
		}

		public static void LoadParticles()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject>
			{
				curseParticle = bundle.LoadAsset<GameObject>("Assets/Particles/CurseParticle.prefab"),
				hotParticle = bundle.LoadAsset<GameObject>("Assets/Particles/HotParticle.prefab"),
				coldParticle = bundle.LoadAsset<GameObject>("Assets/Particles/ColdParticle.prefab")
			};
			foreach (GameObject item in hashSet)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
				Utilities.FixMixerGroups(item);
			}
		}

		public static void LoadShaders()
		{
			wallhackShader = bundle.LoadAsset<Material>("Assets/Shaders/WallhackMaterial.mat");
		}

		public static void PatchOtherMods(Harmony harmony)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			Type type = Type.GetType("AddonFusion.Behaviours.CapsuleHoiPoi, AddonFusion");
			if (type != null)
			{
				harmony.Patch((MethodBase)AccessTools.Method(type, "SetComponentClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(AddonFusionPatch).GetMethod("PreGrabObject")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			Type type2 = Type.GetType("BagConfig.Patches.BeltBagPatch, BagConfig");
			if (type2 != null)
			{
				harmony.Patch((MethodBase)AccessTools.Method(type2, "EmptyBagCoroutine", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BagConfigPatch).GetMethod("EmptyBag")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CursedScraps";

		public const string PLUGIN_NAME = "CursedScraps";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace CursedScraps.Values
{
	public class CustomItem
	{
		public Type Type { get; internal set; }

		public Item Item { get; internal set; }

		public bool IsSpawnable { get; internal set; }

		public int MinSpawn { get; private set; }

		public int MaxSpawn { get; private set; }

		public int Rarity { get; internal set; }

		public int Value { get; internal set; }

		public CustomItem(Type type, Item item, bool isSpawnable, int minSpawn, int maxSpawn, int rarity, int value = 0)
		{
			Type = type;
			Item = item;
			IsSpawnable = isSpawnable;
			MinSpawn = minSpawn;
			MaxSpawn = maxSpawn;
			Rarity = rarity;
			Value = value;
			base..ctor();
		}
	}
}
namespace CursedScraps.Patches
{
	internal class BeltBagInventoryUIPatch
	{
		[HarmonyPatch(typeof(BeltBagInventoryUI), "RemoveItemFromUI")]
		[HarmonyPrefix]
		private static bool PreDropObject(ref BeltBagInventoryUI __instance, int slot)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.currentBeltBag != (Object)null && slot != -1)
			{
				GrabbableObject val = __instance.currentBeltBag.objectsInBag[slot];
				if (__instance.currentBeltBag.objectsInBag.Count > slot && (Object)(object)val != (Object)null && !__instance.currentBeltBag.tryingAddToBag && !ObjectCSManager.PreDropObject(((GrabbableObject)__instance.currentBeltBag).playerHeldBy, val))
				{
					if (val.deactivated)
					{
						CursedScrapsNetworkManager.Instance.RemoveFromBagServerRpc(NetworkObjectReference.op_Implicit(((Component)val).GetComponent<NetworkObject>()), NetworkObjectReference.op_Implicit(((Component)__instance.currentBeltBag).GetComponent<NetworkObject>()));
						((Behaviour)__instance.inventorySlotIcons[slot]).enabled = false;
						__instance.FillSlots(__instance.currentBeltBag);
						__instance.grabbingItemSlot = -1;
					}
					HUDManager.Instance.SetMouseCursorSprite(HUDManager.Instance.handOpenCursorTex, default(Vector2));
					return false;
				}
				ObjectCSManager.PostDropObject(((GrabbableObject)__instance.currentBeltBag).playerHeldBy);
			}
			return true;
		}
	}
	internal class BeltBagItemPatch
	{
		[HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")]
		[HarmonyPostfix]
		private static void PreGrabObject(ref BeltBagItem __instance, ref GrabbableObject gObject)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null))
			{
				return;
			}
			ObjectCSManager.PostGrabObject(ref ((GrabbableObject)__instance).playerHeldBy, ref gObject);
			ObjectCSBehaviour component = ((Component)gObject).GetComponent<ObjectCSBehaviour>();
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			foreach (CurseEffect curseEffect in component.curseEffects)
			{
				CursedScrapsNetworkManager.Instance.SetScrapCurseEffectServerRpc(NetworkObjectReference.op_Implicit(((Component)__instance).GetComponent<NetworkObject>()), curseEffect.CurseName);
			}
		}

		[HarmonyPatch(typeof(BeltBagItem), "DiscardItem")]
		[HarmonyPrefix]
		private static void DropItem(ref BeltBagItem __instance)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) || !((GrabbableObject)__instance).playerHeldBy.isInHangarShipRoom)
			{
				return;
			}
			foreach (GrabbableObject item in __instance.objectsInBag)
			{
				ObjectCSBehaviour component = ((Component)item).GetComponent<ObjectCSBehaviour>();
				if ((Object)(object)component != (Object)null && component.curseEffects.Any())
				{
					CursedScrapsNetworkManager.Instance.RemoveAllScrapCurseEffectServerRpc(NetworkObjectReference.op_Implicit(((Component)item).GetComponent<NetworkObject>()));
				}
			}
		}
	}
	internal class EnemyAIPatch
	{
		[HarmonyPatch(typeof(EnemyAI), "SetClientCalculatingAI")]
		[HarmonyPostfix]
		private static void CalculateIA(ref EnemyAI __instance)
		{
			Shadow.ApplyShadow(ref __instance);
		}
	}
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch(typeof(GrabbableObject), "Update")]
		[HarmonyPostfix]
		private static void UpdateGrabbableObject(ref GrabbableObject __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			ObjectCSBehaviour component = ((Component)__instance).GetComponent<ObjectCSBehaviour>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.particleEffect != (Object)null)
			{
				component.particleEffect.transform.localScale = ((Component)__instance).transform.localScale;
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")]
		[HarmonyPrefix]
		private static bool PreventOverrideCurseValue(ref GrabbableObject __instance)
		{
			ObjectCSBehaviour component = ((Component)__instance).GetComponent<ObjectCSBehaviour>();
			if ((Object)(object)component != (Object)null && component.curseEffects.Count > 0)
			{
				return false;
			}
			return true;
		}
	}
	internal class HUDManagerPatch
	{
		public static TextMeshProUGUI distanceText;

		public static TextMeshProUGUI cursesText;

		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		private static void StartHUDManager()
		{
			//IL_000f: 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_002d: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			distanceText = HUDCSManager.CreateUIElement("DistanceUI", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(ConfigManager.communicationDistancePosX.Value, ConfigManager.communicationDistancePosY.Value), (TextAlignmentOptions)257);
			cursesText = HUDCSManager.CreateUIElement("CursesUI", new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(ConfigManager.deadCursesPosX.Value, ConfigManager.deadCursesPosY.Value), (TextAlignmentOptions)1028);
		}

		[HarmonyPatch(typeof(HUDManager), "AssignNodeToUIElement")]
		[HarmonyPostfix]
		private static void ScanPerformed(ref HUDManager __instance, ref ScanNodeProperties node)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.scanNodes.ContainsValue(node))
			{
				return;
			}
			PlayerCSBehaviour component = ((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<PlayerCSBehaviour>();
			Paralysis.ScanPerformed(component, node);
			if (string.IsNullOrEmpty(ConfigManager.penaltyMode.Value) || ConfigManager.penaltyMode.Value.Equals("None"))
			{
				return;
			}
			ObjectCSBehaviour componentInParent = ((Component)node).GetComponentInParent<ObjectCSBehaviour>();
			if (!((Object)(object)componentInParent != (Object)null) || componentInParent.curseEffects.Count() <= 0)
			{
				return;
			}
			SORCSBehaviour component2 = ((Component)StartOfRound.Instance).GetComponent<SORCSBehaviour>();
			if (!component2.scannedObjects.Contains(componentInParent.objectProperties))
			{
				CursedScrapsNetworkManager.Instance.IncrementPenaltyCounterServerRpc(NetworkObjectReference.op_Implicit(((Component)componentInParent.objectProperties).GetComponent<NetworkObject>()));
			}
			if (component2.counter < ConfigManager.penaltyCounter.Value)
			{
				return;
			}
			foreach (CurseEffect curseEffect in componentInParent.curseEffects)
			{
				if (ConfigManager.penaltyMode.Value.Equals("Hard"))
				{
					foreach (PlayerControllerB item in StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => p.isPlayerControlled && !p.isPlayerDead))
					{
						CursedScrapsNetworkManager.Instance.SetPlayerCurseEffectServerRpc((int)item.playerClientId, curseEffect.CurseName, enable: true);
					}
				}
				else if (ConfigManager.penaltyMode.Value.Equals("Medium"))
				{
					CursedScrapsNetworkManager.Instance.SetPlayerCurseEffectServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, curseEffect.CurseName, enable: true);
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "SetScreenFilters")]
		[HarmonyPostfix]
		private static void UpdateScreenFilters()
		{
			Blurry.UpdateScreenFilters(((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<PlayerCSBehaviour>());
		}

		[HarmonyPatch(typeof(HUDManager), "HoldInteractionFill")]
		[HarmonyPostfix]
		private static void EntranceInteraction(ref bool __result)
		{
			if (__result)
			{
				PlayerCSBehaviour component = ((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<PlayerCSBehaviour>();
				InteractTrigger hoveringOverTrigger = component.playerProperties.hoveringOverTrigger;
				EntranceTeleport val = ((hoveringOverTrigger != null) ? ((Component)hoveringOverTrigger).gameObject.GetComponent<EntranceTeleport>() : null);
				if ((Object)(object)val != (Object)null && (!Exploration.EntranceInteraction(component, val) || !Communication.CanEscape(component, "A curse prevents you from using this doorway.")))
				{
					__result = false;
				}
			}
		}
	}
	internal class IngamePlayerSettingsPatch
	{
		[HarmonyPatch(typeof(IngamePlayerSettings), "DiscardChangedSettings")]
		[HarmonyPrefix]
		private static bool PreventRemoveWhenDiscardSettings(ref IngamePlayerSettings __instance)
		{
			return DiscardSettings(ref __instance);
		}

		[HarmonyPatch(typeof(IngamePlayerSettings), "SaveChangedSettings")]
		[HarmonyPrefix]
		private static bool PreventRemoveWhenConfirmSettings(ref IngamePlayerSettings __instance)
		{
			return DiscardSettings(ref __instance);
		}

		public static bool DiscardSettings(ref IngamePlayerSettings ingamePlayerSettings)
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				PlayerControllerB localPlayerController = instance.localPlayerController;
				obj = ((localPlayerController != null) ? ((Component)localPlayerController).GetComponent<PlayerCSBehaviour>() : null);
			}
			PlayerCSBehaviour playerCSBehaviour = (PlayerCSBehaviour)obj;
			if (ConfigManager.globalPrevent.Value && (Object)(object)playerCSBehaviour != (Object)null)
			{
				IEnumerable<string> source = playerCSBehaviour.activeCurses.Select((CurseEffect c) => c.CurseName);
				if (source.Contains("Confusion") || source.Contains("Mute") || source.Contains("Deafness"))
				{
					ingamePlayerSettings.SetChangesNotAppliedTextVisible(false);
					ingamePlayerSettings.unsavedSettings.CopySettings(ingamePlayerSettings.settings);
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(IngamePlayerSettings), "SetOption")]
		[HarmonyPrefix]
		private static bool PreventUpdateSettings(ref SettingsOptionType optionType)
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				PlayerControllerB localPlayerController = instance.localPlayerController;
				obj = ((localPlayerController != null) ? ((Component)localPlayerController).GetComponent<PlayerCSBehaviour>() : null);
			}
			PlayerCSBehaviour playerCSBehaviour = (PlayerCSBehaviour)obj;
			if (ConfigManager.globalPrevent.Value && (Object)(object)playerCSBehaviour != (Object)null)
			{
				IEnumerable<string> source = playerCSBehaviour.activeCurses.Select((CurseEffect c) => c.CurseName);
				if ((source.Contains("Mute") && ((int)optionType == 4 || (int)optionType == 5 || (int)optionType == 3)) || (source.Contains("Deafness") && ((int)optionType == 8 || (int)optionType == 5)))
				{
					HUDManager.Instance.DisplayTip("Impossible action", "A curse prevents you from performing this action.", false, false, "LC_Tip1");
					return false;
				}
			}
			return true;
		}
	}
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void ConnectPlayer(ref PlayerControllerB __instance)
		{
			if (__instance.isPlayerControlled && (Object)(object)((Component)__instance).GetComponent<PlayerCSBehaviour>() == (Object)null)
			{
				PlayerCSBehaviour playerCSBehaviour = ((Component)__instance).gameObject.AddComponent<PlayerCSBehaviour>();
				playerCSBehaviour.playerProperties = __instance;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void UpdatePlayerControllerB(ref PlayerControllerB __instance)
		{
			//IL_002a: 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)
			PlayerCSBehaviour component = ((Component)__instance).GetComponent<PlayerCSBehaviour>();
			if (!((Object)(object)component != (Object)null) || !((Object)(object)component.targetDoor != (Object)null))
			{
				return;
			}
			if (Vector3.Distance(((Component)component.targetDoor).transform.position, ((Component)__instance).transform.position) > ConfigManager.explorationDistance.Value)
			{
				if (!component.isRendered)
				{
					CustomPassManager.SetupCustomPassForDoor(component.targetDoor);
				}
				component.isRendered = true;
			}
			else
			{
				CustomPassManager.RemoveAuraFromDoor();
				component.isRendered = false;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")]
		[HarmonyPostfix]
		private static void PostGrabObject(ref PlayerControllerB __instance)
		{
			ObjectCSManager.PostGrabObject(ref __instance, ref __instance.currentlyHeldObjectServer);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
		[HarmonyPrefix]
		private static bool PreventJump(ref PlayerControllerB __instance)
		{
			PlayerCSBehaviour component = ((Component)__instance).GetComponent<PlayerCSBehaviour>();
			if ((Object)(object)component != (Object)null)
			{
				if ((!string.IsNullOrEmpty(component.blockedAction) && component.blockedAction.Equals("Jump")) || component.actionsBlockedBy.Count > 0)
				{
					return false;
				}
				if (Diminutive.PreventJump(component))
				{
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Crouch_performed")]
		[HarmonyPrefix]
		private static bool PreventCrouch(ref PlayerControllerB __instance)
		{
			PlayerCSBehaviour component = ((Component)__instance).GetComponent<PlayerCSBehaviour>();
			if ((Object)(object)component != (Object)null && ((!string.IsNullOrEmpty(component.blockedAction) && component.blockedAction.Equals("Crouch")) || component.actionsBlockedBy.Count > 0))
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyPrefix]
		private static bool PreDropObject(ref PlayerControllerB __instance)
		{
			return ObjectCSManager.PreDropObject(__instance, __instance.currentlyHeldObjectServer);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyPostfix]
		private static void PostDropObject(ref PlayerControllerB __instance)
		{
			ObjectCSManager.PostDropObject(__instance);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "PlayerHitGroundEffects")]
		[HarmonyPostfix]
		private static void PlayerFall(ref PlayerControllerB __instance)
		{
			Fragile.PlayerFall(__instance);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "UpdatePlayerPositionClientRpc")]
		[HarmonyPostfix]
		private static void UpdatePlayerPositionClientRpc(ref PlayerControllerB __instance)
		{
			PlayerCSBehaviour component = ((Component)__instance).GetComponent<PlayerCSBehaviour>();
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			if (__instance.isInHangarShipRoom)
			{
				foreach (CurseEffect item in component.activeCurses.ToList())
				{
					PlayerCSManager.SetPlayerCurseEffect(__instance, item, enable: false);
				}
			}
			Diminutive.PlayerCollision(component);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
		[HarmonyPostfix]
		private static void DamagePlayer(ref PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath())
			{
				Fragile.DestroyHeldObjects(((Component)__instance).GetComponent<PlayerCSBehaviour>());
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		[HarmonyPrefix]
		private static void PlayerDeath(ref PlayerControllerB __instance)
		{
			CursedScrapsNetworkManager.Instance.RemoveAllPlayerCurseEffectServerRpc((int)__instance.playerClientId);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")]
		[HarmonyPrefix]
		private static bool PreventTeleportPlayer(ref PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				PlayerCSBehaviour component = ((Component)__instance).GetComponent<PlayerCSBehaviour>();
				if (!__instance.isInsideFactory && (Exploration.IsExploration(component) || !Communication.CanEscape(component, "A curse prevented you from being teleported.")))
				{
					__instance.isInElevator = false;
					__instance.isInHangarShipRoom = false;
					__instance.isInsideFactory = true;
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")]
		[HarmonyPostfix]
		private static void SwitchSpectatedPlayer(ref PlayerControllerB __instance)
		{
			PlayerControllerB spectatedPlayerScript = __instance.spectatedPlayerScript;
			PlayerCSBehaviour playerBehaviour = ((spectatedPlayerScript != null) ? ((Component)spectatedPlayerScript).GetComponent<PlayerCSBehaviour>() : null);
			if ((Object)(object)playerBehaviour != (Object)null)
			{
				HUDCSManager.RefreshCursesText(ref playerBehaviour);
				Communication.ApplyCommunicationForDeadPlayer(playerBehaviour);
				CommunicationInputs.Instance.EnableInputs();
			}
		}
	}
	internal class RoundManagerPatch
	{
		private static bool hasBeenExecutedOnHost;

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void LoadNewGame()
		{
			hasBeenExecutedOnHost = false;
			SORCSBehaviour component = ((Component)StartOfRound.Instance).GetComponent<SORCSBehaviour>();
			component.counter = 0;
			component.scannedObjects.Clear();
		}

		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		[HarmonyPostfix]
		private static void SpawnScraps(ref RoundManager __instance)
		{
			ObjectCSManager.AddNewItems(ref __instance);
		}

		[HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")]
		[HarmonyPostfix]
		private static void SetCurseObject()
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (hasBeenExecutedOnHost || !((Object)(object)GameNetworkManager.Instance?.localPlayerController != (Object)null) || (!((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost && !((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer))
			{
				return;
			}
			hasBeenExecutedOnHost = true;
			foreach (GrabbableObject item in (from g in Object.FindObjectsOfType<GrabbableObject>()
				where (string.IsNullOrEmpty(ConfigManager.scrapExclusions.Value) || !ConfigManager.scrapExclusions.Value.Contains(g.itemProperties.itemName)) && g.isInFactory && !g.isInShipRoom && g.scrapValue > 0
				select g).ToList())
			{
				string planetName = new string(StartOfRound.Instance.currentLevel.PlanetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray());
				if (!CurseCSManager.IsCursed(planetName))
				{
					continue;
				}
				CurseEffect randomCurseEffect = CurseCSManager.GetRandomCurseEffect(planetName);
				if (randomCurseEffect != null)
				{
					NetworkObject component = ((Component)item).GetComponent<NetworkObject>();
					if ((Object)(object)component != (Object)null && component.IsSpawned)
					{
						CursedScrapsNetworkManager.Instance.SetScrapCurseEffectServerRpc(NetworkObjectReference.op_Implicit(component), randomCurseEffect.CurseName);
					}
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "DetectElevatorIsRunning")]
		[HarmonyPrefix]
		private static void EndGame()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			ObjectCSBehaviour objectBehaviour;
			foreach (GrabbableObject item in from g in Object.FindObjectsOfType<GrabbableObject>()
				where g.isInElevator && (Object)(object)(objectBehaviour = ((Component)g).GetComponent<ObjectCSBehaviour>()) != (Object)null && objectBehaviour.curseEffects.Count > 0
				select g)
			{
				CursedScrapsNetworkManager.Instance.DestroyObjectServerRpc(NetworkObjectReference.op_Implicit(((Component)item).GetComponent<NetworkObject>()));
			}
		}
	}
	internal class StartOfRoundPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyBefore(new string[] { "evaisa.lethallib" })]
		[HarmonyPostfix]
		private static void StartRound(ref StartOfRound __instance)
		{
			if (NetworkManager.Singleton.IsHost && (Object)(object)CursedScrapsNetworkManager.Instance == (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(CursedScraps.managerPrefab, ((Component)__instance).transform.parent);
				val.GetComponent<NetworkObject>().Spawn(false);
				CursedScraps.mls.LogInfo((object)"Spawning CursedScrapsNetworkManager");
			}
			if ((Object)(object)((Component)__instance).GetComponent<SORCSBehaviour>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<SORCSBehaviour>();
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			CursedScrapsNetworkManager.Instance = null;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
		[HarmonyPostfix]
		private static void PlayerConnection(ref StartOfRound __instance)
		{
			PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled && (Object)(object)((Component)val).GetComponent<PlayerCSBehaviour>() == (Object)null)
				{
					PlayerCSBehaviour playerCSBehaviour = ((Component)val).gameObject.AddComponent<PlayerCSBehaviour>();
					playerCSBehaviour.playerProperties = val;
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")]
		[HarmonyPostfix]
		private static void ReviveDeadPlayers()
		{
			CommunicationInputs.Instance.DisableInputs();
		}
	}
}
namespace CursedScraps.Patches.ModsPatches
{
	[HarmonyPatch]
	internal class AddonFusionPatch
	{
		public static bool PreGrabObject(ref object __instance, ref NetworkObjectReference itemObject)
		{
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref itemObject)).TryGet(ref val, (NetworkManager)null))
			{
				ObjectCSBehaviour componentInChildren = ((Component)val).gameObject.GetComponentInChildren<ObjectCSBehaviour>();
				if ((Object)(object)componentInChildren != (Object)null && componentInChildren.curseEffects.Count() > 0)
				{
					object obj = __instance;
					GrabbableObject val2 = (GrabbableObject)((obj is GrabbableObject) ? obj : null);
					if ((Object)(object)val2.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						HUDManager.Instance.DisplayTip("Impossible action", "A curse prevents you from performing this action.", false, false, "LC_Tip1");
					}
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal class BagConfigPatch
	{
		public static bool EmptyBag(BeltBagItem @this, ref IEnumerator __result)
		{
			PlayerControllerB playerHeldBy = ((GrabbableObject)@this).playerHeldBy;
			PlayerCSBehaviour playerCSBehaviour = ((playerHeldBy != null) ? ((Component)playerHeldBy).GetComponent<PlayerCSBehaviour>() : null);
			if ((Object)(object)playerCSBehaviour != (Object)null && playerCSBehaviour.activeCurses.Any())
			{
				__result = (Captive.IsCaptive(playerCSBehaviour, isMessage: true) ? EmptyCoroutine() : EmptyBagCoroutine(@this));
				return false;
			}
			return true;
		}

		public static IEnumerator EmptyCoroutine()
		{
			yield break;
		}

		public static IEnumerator EmptyBagCoroutine(BeltBagItem beltBagItem)
		{
			while (beltBagItem.objectsInBag.Count > 0)
			{
				for (int num = beltBagItem.objectsInBag.Count - 1; num >= 0; num--)
				{
					GrabbableObject grabbableObject = beltBagItem.objectsInBag[num];
					if ((Object)(object)((GrabbableObject)beltBagItem).playerHeldBy != (Object)null && ObjectCSManager.PreDropObject(((GrabbableObject)beltBagItem).playerHeldBy, grabbableObject))
					{
						beltBagItem.RemoveObjectFromBag(num);
						ObjectCSManager.PostDropObject(((GrabbableObject)beltBagItem).playerHeldBy);
						break;
					}
				}
				yield return (object)new WaitForEndOfFrame();
			}
		}
	}
}
namespace CursedScraps.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<string> globalChance;

		public static ConfigEntry<bool> globalPrevent;

		public static ConfigEntry<string> scrapExclusions;

		public static ConfigEntry<float> minParticleScale;

		public static ConfigEntry<float> maxParticleScale;

		public static ConfigEntry<string> rendererNames;

		public static ConfigEntry<bool> isCurseInfoOn;

		public static ConfigEntry<float> deadCursesPosX;

		public static ConfigEntry<float> deadCursesPosY;

		public static ConfigEntry<float> communicationDistancePosX;

		public static ConfigEntry<float> communicationDistancePosY;

		public static ConfigEntry<bool> isRedScanOn;

		public static ConfigEntry<bool> isParticleOn;

		public static ConfigEntry<bool> isHideLine;

		public static ConfigEntry<bool> isHideName;

		public static ConfigEntry<bool> isHideValue;

		public static ConfigEntry<string> penaltyMode;

		public static ConfigEntry<int> penaltyCounter;

		public static ConfigEntry<bool> isHolyWater;

		public static ConfigEntry<int> holyWaterRarity;

		public static ConfigEntry<int> minHolyWater;

		public static ConfigEntry<int> maxHolyWater;

		public static ConfigEntry<bool> isOldScrollSpawnable;

		public static ConfigEntry<int> oldScrollRarity;

		public static ConfigEntry<int> minOldScroll;

		public static ConfigEntry<int> maxOldScroll;

		public static ConfigEntry<float> oldScrollAura;

		public static ConfigEntry<bool> isInhibition;

		public static ConfigEntry<float> inhibitionMultiplier;

		public static ConfigEntry<string> inhibitionWeight;

		public static ConfigEntry<bool> isInhibitionTip;

		public static ConfigEntry<float> inhibitionCooldown;

		public static ConfigEntry<string> inhibitionActions;

		public static ConfigEntry<bool> isConfusion;

		public static ConfigEntry<float> confusionMultiplier;

		public static ConfigEntry<string> confusionWeight;

		public static ConfigEntry<bool> isCaptive;

		public static ConfigEntry<float> captiveMultiplier;

		public static ConfigEntry<string> captiveWeight;

		public static ConfigEntry<bool> isBlurry;

		public static ConfigEntry<float> blurryMultiplier;

		public static ConfigEntry<string> blurryWeight;

		public static ConfigEntry<float> blurryIntensity;

		public static ConfigEntry<bool> isMute;

		public static ConfigEntry<float> muteMultiplier;

		public static ConfigEntry<string> muteWeight;

		public static ConfigEntry<bool> isDeafness;

		public static ConfigEntry<float> deafnessMultiplier;

		public static ConfigEntry<string> deafnessWeight;

		public static ConfigEntry<bool> isErrant;

		public static ConfigEntry<float> errantMultiplier;

		public static ConfigEntry<string> errantWeight;

		public static ConfigEntry<string> errantExclusions;

		public static ConfigEntry<bool> isParalysis;

		public static ConfigEntry<float> paralysisMultiplier;

		public static ConfigEntry<string> paralysisWeight;

		public static ConfigEntry<float> paralysisTime;

		public static ConfigEntry<bool> isShadow;

		public static ConfigEntry<float> shadowMultiplier;

		public static ConfigEntry<string> shadowWeight;

		public static ConfigEntry<string> shadowExclusions;

		public static ConfigEntry<bool> isDiminutive;

		public static ConfigEntry<float> diminutiveMultiplier;

		public static ConfigEntry<string> diminutiveWeight;

		public static ConfigEntry<float> diminutiveSpeed;

		public static ConfigEntry<float> diminutiveGrab;

		public static ConfigEntry<bool> isExploration;

		public static ConfigEntry<float> explorationMultiplier;

		public static ConfigEntry<string> explorationWeight;

		public static ConfigEntry<float> explorationDistance;

		public static ConfigEntry<bool> isCommunication;

		public static ConfigEntry<float> communicationMultiplier;

		public static ConfigEntry<string> communicationWeight;

		public static ConfigEntry<float> communicationCooldown;

		public static ConfigEntry<bool> isFragile;

		public static ConfigEntry<float> fragileMultiplier;

		public static ConfigEntry<string> fragileWeight;

		public static ConfigEntry<string> fragileExclusions;

		public static void Load()
		{
			globalChance = CursedScraps.configFile.Bind<string>("_Global_", "Chance", "default:15", "Overall chance of scrap appearing.\nThis value does not replace the chance of appearance for each curse; the latter are considered after the overall chance to determine which curse is chosen.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			globalPrevent = CursedScraps.configFile.Bind<bool>("_Global_", "Preventing settings changes", true, "Set to false to allow players to change their settings when a curse modifying controls is active.\nThis configuration is mainly there in case of unforeseen bugs or potential incompatibility.");
			scrapExclusions = CursedScraps.configFile.Bind<string>("_Global_", "Exclusion list", "Key", "List of scraps that will not be cursed.\nYou can add scraps by separating them with a comma.");
			minParticleScale = CursedScraps.configFile.Bind<float>("_Global_", "Min particle scale", 0.1f, "Min cursed particle scale.");
			maxParticleScale = CursedScraps.configFile.Bind<float>("_Global_", "Max particle scale", 1f, "Max cursed particle scale.");
			rendererNames = CursedScraps.configFile.Bind<string>("_Global_", "Renderer names", "Cube.001,Cube.002,DoorMesh,Trigger,EntranceTeleport", "List of renderer names for displaying the door's aura, to use in case custom map doors have different names.");
			isCurseInfoOn = CursedScraps.configFile.Bind<bool>("_HUD_", "Curse info", true, "Does the information popup appear when a player is cursed?");
			deadCursesPosX = CursedScraps.configFile.Bind<float>("_HUD_", "Dead curses pos X", -30f, "X position of player curses text on the interface as a spectator.");
			deadCursesPosY = CursedScraps.configFile.Bind<float>("_HUD_", "Dead curses pos Y", 50f, "Y position of player curses text on the interface as a spectator.");
			communicationDistancePosX = CursedScraps.configFile.Bind<float>("_HUD_", "Communication distance pos X", 30f, "X position of player's distance text, from the Communication curse, on the interface as a spectator.");
			communicationDistancePosY = CursedScraps.configFile.Bind<float>("_HUD_", "Communication distance pos Y", -50f, "Y position of player's distance text, from the Communication curse, on the interface as a spectator.");
			isRedScanOn = CursedScraps.configFile.Bind<bool>("_Hiding mechanic_", "Enable red scan", true, "Is red scan on cursed scraps enabled?");
			isParticleOn = CursedScraps.configFile.Bind<bool>("_Hiding mechanic_", "Enable particle", true, "Is cursed particle enabled?");
			isHideLine = CursedScraps.configFile.Bind<bool>("_Hiding mechanic_", "Hide curse line", false, "Hide curse line in scan node");
			isHideName = CursedScraps.configFile.Bind<bool>("_Hiding mechanic_", "Hide curse name", false, "Replace the curse name with '???'");
			isHideValue = CursedScraps.configFile.Bind<bool>("_Hiding mechanic_", "Hide scrap value", false, "Replace the cursed scrap value with '???'");
			penaltyMode = CursedScraps.configFile.Bind<string>("_Penalty mechanic_", "Mode", "Hard", "Mode for the penalty mechanic.\nHard - When the counter is reached, all players receive the curse of the next scrap scanned.\nMedium - When the counter is reached, only the player who scans the next cursed scrap receives the curse.\nNone - Never apply the penalty.");
			penaltyCounter = CursedScraps.configFile.Bind<int>("_Penalty mechanic_", "Counter", 10, "Number of cursed objects to be scanned before the next one affects the penalty.\nThe counter is reset after the penalty is applied.");
			isHolyWater = CursedScraps.configFile.Bind<bool>("Holy Water", "Enable", true, "Is Holy Water item enabled?\nConsumable that removes all active curses on the player.");
			holyWaterRarity = CursedScraps.configFile.Bind<int>("Holy Water", "Rarity", 20, "Holy Water spawn rarity.");
			minHolyWater = CursedScraps.configFile.Bind<int>("Holy Water", "Min spawn", 1, "Min Holy Water to spawn");
			maxHolyWater = CursedScraps.configFile.Bind<int>("Holy Water", "Max spawn", 4, "Max Holy Water to spawn");
			isOldScrollSpawnable = CursedScraps.configFile.Bind<bool>("Old Scroll", "Spawnable", true, "Is Old Scroll item enabled?\nConsumable that shows the aura of the entrances.");
			oldScrollRarity = CursedScraps.configFile.Bind<int>("Old Scroll", "Rarity", 20, "Old Scroll spawn rarity.");
			minOldScroll = CursedScraps.configFile.Bind<int>("Old Scroll", "Min spawn", 1, "Min Old Scroll to spawn");
			maxOldScroll = CursedScraps.configFile.Bind<int>("Old Scroll", "Max spawn", 2, "Max Old Scroll to spawn");
			oldScrollAura = CursedScraps.configFile.Bind<float>("Old Scroll", "Aura duration", 10f, "Duration for which the door's aura is visible through walls");
			isInhibition = CursedScraps.configFile.Bind<bool>("Inhibition", "Enable", true, "Is Inhibition curse enabled?\nPrevents the player from jumping and crouching.");
			inhibitionMultiplier = CursedScraps.configFile.Bind<float>("Inhibition", "Multiplier", 1.75f, "Value multiplier for scraps with the Inhibition curse.");
			inhibitionWeight = CursedScraps.configFile.Bind<string>("Inhibition", "Weight", "default:1", "Spawn weight of a scrap with the Inhibition curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			isInhibitionTip = CursedScraps.configFile.Bind<bool>("Inhibition", "Message", false, "Display a message when the blocked action is modified.");
			inhibitionCooldown = CursedScraps.configFile.Bind<float>("Inhibition", "Cooldown", 20f, "Cooldown duration before a new action can be triggered.");
			inhibitionActions = CursedScraps.configFile.Bind<string>("Inhibition", "Actions", "Jump,Crouch,Interact,Sprint,PingScan", "Actions that can be blocked by the curse Inhibition.");
			isConfusion = CursedScraps.configFile.Bind<bool>("Confusion", "Enable", true, "Is Confusion curse enabled?\nReverses movement controls and jump/crouch keys for the player.");
			confusionMultiplier = CursedScraps.configFile.Bind<float>("Confusion", "Multiplier", 2f, "Value multiplier for scraps with the Confusion curse.");
			confusionWeight = CursedScraps.configFile.Bind<string>("Confusion", "Weight", "default:1", "Spawn weight of a scrap with the Confusion curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			isCaptive = CursedScraps.configFile.Bind<bool>("Captive", "Enable", true, "Is Captive curse enabled?\nPrevents the item from being thrown until it has been brought back to the ship.");
			captiveMultiplier = CursedScraps.configFile.Bind<float>("Captive", "Multiplier", 1.5f, "Value multiplier for scraps with the Captive curse.");
			captiveWeight = CursedScraps.configFile.Bind<string>("Captive", "Weight", "default:1", "Spawn weight of a scrap with the Captive curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			isBlurry = CursedScraps.configFile.Bind<bool>("Blurry", "Enable", true, "Is Blurry curse enabled?\nReduces visual clarity on the player's camera.");
			blurryMultiplier = CursedScraps.configFile.Bind<float>("Blurry", "Multiplier", 2f, "Value multiplier for scraps with the Blurry curse.");
			blurryWeight = CursedScraps.configFile.Bind<string>("Blurry", "Weight", "default:1", "Spawn weight of a scrap with the Blurry curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			blurryIntensity = CursedScraps.configFile.Bind<float>("Blurry", "Intensity", 1f, "Intensity of the Blurry curse.");
			isMute = CursedScraps.configFile.Bind<bool>("Mute", "Enable", true, "Is Mute curse enabled?\nMutes the player's microphone.");
			muteMultiplier = CursedScraps.configFile.Bind<float>("Mute", "Multiplier", 1.25f, "Value multiplier for scraps with the Mute curse.");
			muteWeight = CursedScraps.configFile.Bind<string>("Mute", "Weight", "default:1", "Spawn weight of a scrap with the Mute curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			isDeafness = CursedScraps.configFile.Bind<bool>("Deafness", "Enable", true, "Is Deafness curse enabled?\nRemoves the player's sound.");
			deafnessMultiplier = CursedScraps.configFile.Bind<float>("Deafness", "Multiplier", 2f, "Value multiplier for scraps with the Deafness curse.");
			deafnessWeight = CursedScraps.configFile.Bind<string>("Deafness", "Weight", "default:1", "Spawn weight of a scrap with the Deafness curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			isErrant = CursedScraps.configFile.Bind<bool>("Errant", "Enable", true, "Is Errant curse enabled?\nTeleports the player randomly when an item is picked up or placed down.");
			errantMultiplier = CursedScraps.configFile.Bind<float>("Errant", "Multiplier", 2.5f, "Value multiplier for scraps with the Errant curse.");
			errantWeight = CursedScraps.configFile.Bind<string>("Errant", "Weight", "default:1", "Spawn weight of a scrap with the Errant curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			errantExclusions = CursedScraps.configFile.Bind<string>("Errant", "Exclusion list", "Saw Tape,Pursuer Eye,Saw Key,Saw", "List of items not affected by the Errant curse.\nYou can add items by separating them with a comma.");
			isParalysis = CursedScraps.configFile.Bind<bool>("Paralysis", "Enable", true, "Is Paralysis curse enabled?\nParalyzes the player when scanning an enemy.");
			paralysisMultiplier = CursedScraps.configFile.Bind<float>("Paralysis", "Multiplier", 1.75f, "Value multiplier for scraps with the Paralysis curse.");
			paralysisWeight = CursedScraps.configFile.Bind<string>("Paralysis", "Weight", "default:1", "Spawn weight of a scrap with the Paralysis curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			paralysisTime = CursedScraps.configFile.Bind<float>("Paralysis", "Time", 5f, "Player paralysis time in seconds.");
			isShadow = CursedScraps.configFile.Bind<bool>("Shadow", "Enable", true, "Is Shadow curse enabled?\nAll enemies are invisible by default (their sound is still active), scanning reveals them.");
			shadowMultiplier = CursedScraps.configFile.Bind<float>("Shadow", "Multiplier", 2f, "Value multiplier for scraps with the Shadow curse.");
			shadowWeight = CursedScraps.configFile.Bind<string>("Shadow", "Weight", "default:1", "Spawn weight of a scrap with the Shadow curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			shadowExclusions = CursedScraps.configFile.Bind<string>("Shadow", "Exclusion list", "Masked", "List of creatures that will not be affected by the Shadow curse.\nYou can add enemies by separating them with a comma.");
			isDiminutive = CursedScraps.configFile.Bind<bool>("Diminutive", "Enable", true, "Is Diminutive curse enabled?\nReduces the player's size.");
			diminutiveMultiplier = CursedScraps.configFile.Bind<float>("Diminutive", "Multiplier", 2f, "Value multiplier for scraps with the Diminutive curse.");
			diminutiveWeight = CursedScraps.configFile.Bind<string>("Diminutive", "Weight", "default:1", "Spawn weight of a scrap with the Diminutive curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			diminutiveSpeed = CursedScraps.configFile.Bind<float>("Diminutive", "Speed", 2f, "Speed divider for player movement; the higher the value, the slower the player will move.");
			diminutiveGrab = CursedScraps.configFile.Bind<float>("Diminutive", "Grab", 4f, "Distance grab divider for the player; the higher the value, the less the player will be able to grab from a distance.");
			isExploration = CursedScraps.configFile.Bind<bool>("Exploration", "Enable", true, "Is Exploration curse enabled?\nPrevents the player from exiting or entering the factory through all doors except one.");
			explorationMultiplier = CursedScraps.configFile.Bind<float>("Exploration", "Multiplier", 1.5f, "Value multiplier for scraps with the Exploration curse.");
			explorationWeight = CursedScraps.configFile.Bind<string>("Exploration", "Weight", "default:1", "Spawn weight of a scrap with the Exploration curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			explorationDistance = CursedScraps.configFile.Bind<float>("Exploration", "Distance", 30f, "Distance between the player and the door at which the door's aura disappears.");
			isCommunication = CursedScraps.configFile.Bind<bool>("Communication", "Enable", true, "Is Communication curse enabled?.");
			communicationMultiplier = CursedScraps.configFile.Bind<float>("Communication", "Multiplier", 2f, "Value multiplier for scraps with the Communication curse.");
			communicationWeight = CursedScraps.configFile.Bind<string>("Communication", "Weight", "default:1", "Spawn weight of a scrap with the Communication curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			communicationCooldown = CursedScraps.configFile.Bind<float>("Communication", "Cooldown duration", 10f, "Cooldown duration per player for sending indications to the cursed player (hot/cold particles).");
			isFragile = CursedScraps.configFile.Bind<bool>("Fragile", "Enable", true, "Is Fragile curse enabled?.");
			fragileMultiplier = CursedScraps.configFile.Bind<float>("Fragile", "Multiplier", 2f, "Value multiplier for scraps with the Fragile curse.");
			fragileWeight = CursedScraps.configFile.Bind<string>("Fragile", "Weight", "default:1", "Spawn weight of a scrap with the Fragile curse.\nYou can adjust this value according to the moon by adding its name along with its value (moon:value). Each key/value pair should be separated by a comma.");
			fragileExclusions = CursedScraps.configFile.Bind<string>("Fragile", "Exclusion list", "Saw Tape,Pursuer Eye,Saw Key,Saw", "List of items not affected by the Fragile curse.\nYou can add items by separating them with a comma.");
		}

		internal static List<CurseEffect> GetCurseEffectsFromConfig()
		{
			List<CurseEffect> list = new List<CurseEffect>();
			if (isInhibition.Value)
			{
				list.Add(new CurseEffect("Inhibition", inhibitionMultiplier.Value, inhibitionWeight.Value));
			}
			if (isConfusion.Value)
			{
				list.Add(new CurseEffect("Confusion", confusionMultiplier.Value, confusionWeight.Value));
			}
			if (isCaptive.Value)
			{
				list.Add(new CurseEffect("Captive", captiveMultiplier.Value, captiveWeight.Value));
			}
			if (isBlurry.Value)
			{
				list.Add(new CurseEffect("Blurry", blurryMultiplier.Value, blurryWeight.Value));
			}
			if (isMute.Value)
			{
				list.Add(new CurseEffect("Mute", muteMultiplier.Value, muteWeight.Value));
			}
			if (isDeafness.Value)
			{
				list.Add(new CurseEffect("Deafness", deafnessMultiplier.Value, deafnessWeight.Value));
			}
			if (isErrant.Value)
			{
				list.Add(new CurseEffect("Errant", errantMultiplier.Value, errantWeight.Value));
			}
			if (isParalysis.Value)
			{
				list.Add(new CurseEffect("Paralysis", paralysisMultiplier.Value, paralysisWeight.Value));
			}
			if (isShadow.Value)
			{
				list.Add(new CurseEffect("Shadow", shadowMultiplier.Value, shadowWeight.Value));
			}
			if (isDiminutive.Value)
			{
				list.Add(new CurseEffect("Diminutive", diminutiveMultiplier.Value, diminutiveWeight.Value));
			}
			if (isExploration.Value)
			{
				list.Add(new CurseEffect("Exploration", explorationMultiplier.Value, explorationWeight.Value));
			}
			if (isCommunication.Value)
			{
				list.Add(new CurseEffect("Communication", communicationMultiplier.Value, communicationWeight.Value));
			}
			if (isFragile.Value)
			{
				list.Add(new CurseEffect("Fragile", fragileMultiplier.Value, fragileWeight.Value));
			}
			return list;
		}
	}
	public class CurseCSManager
	{
		public static bool IsCursed(string planetName)
		{
			if (new Random().Next(1, 100) <= GetValueFromPair(ConfigManager.globalChance.Value, planetName))
			{
				return true;
			}
			return false;
		}

		public static CurseEffect GetRandomCurseEffect(string planetName)
		{
			List<CurseEffect> eligibleCurseEffects = GetEligibleCurseEffects(planetName);
			if (eligibleCurseEffects.Count > 0)
			{
				return eligibleCurseEffects[new Random().Next(eligibleCurseEffects.Count)];
			}
			return null;
		}

		public static List<CurseEffect> GetEligibleCurseEffects(string planetName)
		{
			List<CurseEffect> list = new List<CurseEffect>();
			foreach (CurseEffect curseEffect in CursedScraps.curseEffects)
			{
				for (int i = 0; i < GetValueFromPair(curseEffect.Weight, planetName); i++)
				{
					list.Add(curseEffect);
				}
			}
			if (((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name.Equals("SDMLevel"))
			{
				list.RemoveAll((CurseEffect c) => c.CurseName.Equals("Exploration"));
			}
			return list;
		}

		public static int GetValueFromPair(string valueByMoons, string planetName)
		{
			string[] array = valueByMoons.Split(',');
			int result = 0;
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split(':');
				if (array3.Length == 2 && array3[0] == planetName)
				{
					return int.Parse(array3[1]);
				}
				if (array3.Length == 2 && array3[0] == "default")
				{
					result = int.Parse(array3[1]);
				}
			}
			return result;
		}
	}
	public class CursedScrapsNetworkManager : NetworkBehaviour
	{
		public static CursedScrapsNetworkManager Instance;

		public void Awake()
		{
			Instance = this;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetScrapCurseEffectServerRpc(NetworkObjectReference obj, string curseName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1176719234u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				bool flag = curseName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(curseName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1176719234u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetScrapCurseEffectClientRpc(obj, curseName);
			}
		}

		[ClientRpc]
		private void SetScrapCurseEffectClientRpc(NetworkObjectReference obj, string curseName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(914014177u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				bool flag = curseName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(curseName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 914014177u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				GrabbableObject grabbableObject = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
				SetScrapCurseEffect(ref grabbableObject, curseName, applyValue: true);
			}
		}

		public void SetScrapCurseEffect(ref GrabbableObject grabbableObject, string curseName, bool applyValue)
		{
			//IL_009b: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			CurseEffect curseEffect = CursedScraps.curseEffects.FirstOrDefault((CurseEffect c) => c.CurseName.Equals(curseName));
			if (curseEffect == null || (Object)(object)grabbableObject == (Object)null)
			{
				return;
			}
			ObjectCSBehaviour objectBehaviour = ((Component)grabbableObject).GetComponent<ObjectCSBehaviour>() ?? ((Component)grabbableObject).gameObject.AddComponent<ObjectCSBehaviour>();
			objectBehaviour.objectProperties = grabbableObject;
			objectBehaviour.curseEffects.Add(curseEffect);
			if (grabbableObject.itemProperties.isScrap && applyValue)
			{
				grabbableObject.scrapValue = (int)((float)grabbableObject.scrapValue * curseEffect.Multiplier);
			}
			if (ConfigManager.isParticleOn.Value)
			{
				float num = Mathf.Max(((Component)grabbableObject).transform.localScale.x, Mathf.Max(((Component)grabbableObject).transform.localScale.y, ((Component)grabbableObject).transform.localScale.z));
				if (num < ConfigManager.minParticleScale.Value)
				{
					num = ConfigManager.minParticleScale.Value;
				}
				else if (num > ConfigManager.maxParticleScale.Value)
				{
					num = ConfigManager.maxParticleScale.Value;
				}
				if ((Object)(object)objectBehaviour.particleEffect == (Object)null)
				{
					GameObject val = Object.Instantiate<GameObject>(CursedScraps.curseParticle, ((Component)grabbableObject).transform.position, Quaternion.identity);
					val.transform.SetParent(((Component)grabbableObject).transform);
					objectBehaviour.particleEffect = val;
					ParticleSystem component = val.GetComponent<ParticleSystem>();
					if ((Object)(object)component != (Object)null)
					{
						MainModule main = component.main;
						((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(num);
						((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(num / 3f);
					}
				}
				if (grabbableObject.isHeld)
				{
					EnableParticle(ref objectBehaviour, enable: false);
				}
			}
			ScanNodeProperties componentInChildren = ((Component)grabbableObject).gameObject.GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				if (grabbableObject.itemProperties.isScrap)
				{
					componentInChildren.scrapValue = grabbableObject.scrapValue;
				}
				componentInChildren.subText = GetNewSubText(ref objectBehaviour, grabbableObject.scrapValue.ToString());
				if (ConfigManager.isRedScanOn.Value)
				{
					componentInChildren.nodeType = 1;
				}
			}
		}

		public string GetNewSubText(ref ObjectCSBehaviour objectCSBehaviour, string scrapValue)
		{
			if (ConfigManager.isHideValue.Value)
			{
				scrapValue = "???";
			}
			string text = "";
			bool isScrap = objectCSBehaviour.objectProperties.itemProperties.isScrap;
			bool flag = true;
			if (!ConfigManager.isHideLine.Value)
			{
				foreach (CurseEffect curseEffect in objectCSBehaviour.curseEffects)
				{
					string text2 = (ConfigManager.isHideName.Value ? "???" : curseEffect.CurseName);
					text = text + ((flag && !isScrap) ? "" : "\n") + "Curse: " + text2;
					flag = false;
				}
			}
			if (!isScrap)
			{
				return text;
			}
			return "Value: $" + scrapValue + text;
		}

		[ServerRpc(RequireOwnership = false)]
		public void RemoveAllScrapCurseEffectServerRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711148993u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711148993u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RemoveAllScrapCurseEffectClientRpc(obj);
				}
			}
		}

		[ClientRpc]
		private void RemoveAllScrapCurseEffectClientRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3115650421u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3115650421u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			ObjectCSBehaviour componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<ObjectCSBehaviour>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.curseEffects.Clear();
				if ((Object)(object)componentInChildren.particleEffect != (Object)null)
				{
					Object.Destroy((Object)(object)componentInChildren.particleEffect);
				}
				ScanNodeProperties componentInChildren2 = ((Component)componentInChildren.objectProperties).gameObject.GetComponentInChildren<ScanNodeProperties>();
				if ((Object)(object)componentInChildren2 != (Object)null)
				{
					componentInChildren2.subText = $"Value: ${componentInChildren2.scrapValue}";
					componentInChildren2.nodeType = (componentInChildren.objectProperties.itemProperties.isScrap ? 2 : 0);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPlayerCurseEffectServerRpc(int playerId, string curseName, bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0095: 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_00c8: 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)
			//IL_00e2: 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 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2280554102u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				bool flag = curseName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(curseName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2280554102u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetPlayerCurseEffectClientRpc(playerId, curseName, enable);
			}
		}

		[ClientRpc]
		private void SetPlayerCurseEffectClientRpc(int playerId, string curseName, bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0095: 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_00c8: 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)
			//IL_00e2: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2709002570u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				bool flag = curseName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(curseName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2709002570u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				string curseName2 = curseName;
				CurseEffect curseEffect = CursedScraps.curseEffects.Where((CurseEffect c) => c.CurseName.Equals(curseName2)).FirstOrDefault();
				if (curseEffect != null)
				{
					PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
					PlayerCSManager.SetPlayerCurseEffect(component, curseEffect, enable);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RemoveAllPlayerCurseEffectServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(977683197u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 977683197u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RemoveAllPlayerCurseEffectClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		private void RemoveAllPlayerCurseEffectClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2554942328u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2554942328u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
			PlayerCSBehaviour component2 = ((Component)component).GetComponent<PlayerCSBehaviour>();
			if (!((Object)(object)component2 != (Object)null))
			{
				return;
			}
			foreach (CurseEffect item in component2.activeCurses.ToList())
			{
				PlayerCSManager.SetPlayerCurseEffect(component, item, enable: false);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DestroyObjectServerRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4145267314u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4145267314u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DestroyObjectClientRpc(obj);
				}
			}
		}

		[ClientRpc]
		private void DestroyObjectClientRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(593296167u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 593296167u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					DestroyObject(((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>());
				}
			}
		}

		public void DestroyObject(GrabbableObject grabbableObject)
		{
			if (!((Object)(object)grabbableObject != (Object)null))
			{
				return;
			}
			FlashlightItem val = (FlashlightItem)(object)((grabbableObject is FlashlightItem) ? grabbableObject : null);
			if (val != null)
			{
				if (((GrabbableObject)val).isBeingUsed)
				{
					((GrabbableObject)val).isBeingUsed = false;
					val.usingPlayerHelmetLight = false;
					((Behaviour)val.flashlightBulbGlow).enabled = false;
					val.SwitchFlashlight(false);
				}
			}
			else
			{
				BeltBagItem val2 = (BeltBagItem)(object)((grabbableObject is BeltBagItem) ? grabbableObject : null);
				if (val2 != null)
				{
					SkinnedMeshRenderer[] componentsInChildren = ((Component)val2).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
					foreach (SkinnedMeshRenderer item in componentsInChildren.ToList())
					{
						Object.Destroy((Object)(object)item);
					}
				}
			}
			ObjectCSBehaviour component = ((Component)grabbableObject).GetComponent<ObjectCSBehaviour>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.particleEffect != (Object)null)
			{
				Object.Destroy((Object)(object)component.particleEffect);
			}
			grabbableObject.DestroyObjectInHand(grabbableObject.playerHeldBy);
		}

		[ServerRpc(RequireOwnership = false)]
		public void EnableParticleServerRpc(NetworkObjectReference obj, bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1524154121u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1524154121u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					EnableParticleClientRpc(obj, enable);
				}
			}
		}

		[ClientRpc]
		private void EnableParticleClientRpc(NetworkObjectReference obj, bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b2: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1229719461u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1229719461u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					ObjectCSBehaviour objectBehaviour = ((Component)val3).gameObject.GetComponentInChildren<ObjectCSBehaviour>();
					EnableParticle(ref objectBehaviour, enable);
				}
			}
		}

		public void EnableParticle(ref ObjectCSBehaviour objectBehaviour, bool enable)
		{
			if ((Object)(object)objectBehaviour != (Object)null && (Object)(object)objectBehaviour.particleEffect != (Object)null)
			{
				objectBehaviour.particleEffect.gameObject.SetActive(enable);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PushPlayerServerRpc(int playerId, Vector3 pushVector)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(430160808u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref pushVector);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 430160808u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PushPlayerClientRpc(playerId, pushVector);
				}
			}
		}

		[ClientRpc]
		private void PushPlayerClientRpc(int playerId, Vector3 pushVector)
		{
			//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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(856580968u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pushVector);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 856580968u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					component.thisController.Move(pushVector);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void KillPlayerServerRpc(int playerId, Vector3 velocity, bool spawnBody, int causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00ff: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3713272427u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref velocity);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnBody, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, causeOfDeath);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3713272427u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillPlayerClientRpc(playerId, velocity, spawnBody, causeOfDeath);
				}
			}
		}

		[ClientRpc]
		private void KillPlayerClientRpc(int playerId, Vector3 velocity, bool spawnBody, int causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3449312647u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref velocity);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnBody, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, causeOfDeath);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3449312647u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					component.KillPlayer(velocity, spawnBody, (CauseOfDeath)causeOfDeath, 0, default(Vector3));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AssignTrackedItemServerRpc(int playerId, NetworkObjectReference obj)
		{
			//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_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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4169255007u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4169255007u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AssignTrackedItemClientRpc(playerId, obj);
				}
			}
		}

		[ClientRpc]
		private void AssignTrackedItemClientRpc(int playerId, NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing re