Decompiled source of Strange Objects v1.2.3

BepInEx/plugins/StrangeObjects.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance.Integrations.Unity_NFGO;
using GameNetcodeStuff;
using HarmonyLib;
using StrangeObjects.Patches;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("StrangeObjects")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StrangeObjects")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e7e087a1-2426-4476-9b63-af35329e5ac2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StrangeObjects
{
	[BepInPlugin("Bits.StrangeObjects", "Strange Objects", "1.2.0.0")]
	public class StrangeObjectsBase : BaseUnityPlugin
	{
		private const string modGUID = "Bits.StrangeObjects";

		private const string modName = "Strange Objects";

		private const string modVersion = "1.2.0.0";

		private readonly Harmony harmony = new Harmony("Bits.StrangeObjects");

		private static StrangeObjectsBase Instance;

		internal ManualLogSource mls;

		public static ConfigEntry<int> StrangeObjectSpawnRate { get; private set; }

		public static ConfigEntry<float> StrangeObjectValueMultiplier { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfPain { get; private set; }

		public static ConfigEntry<int> PainLevelOnePlayerDamage { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfSight { get; private set; }

		public static ConfigEntry<float> SightLevelOneDrunkDebuff { get; private set; }

		public static ConfigEntry<float> SightLevelTwoDrunkDebuff { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfSloth { get; private set; }

		public static ConfigEntry<float> SlothLevelOneMovementDebuff { get; private set; }

		public static ConfigEntry<float> SlothLevelTwoMovementDebuff { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfMidas { get; private set; }

		public static ConfigEntry<int> MidasMaxScrapValue { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfVoice { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Bits.StrangeObjects");
			StrangeObjectSpawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnRate", 20, "Probability of a scrap item being strange. 20 means 20% chance. Range 1-100");
			StrangeObjectValueMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValueMultiplier", 0.3f, "Controls how much value strange objects have. 0.3 is 30% higher value. Range 0.0-infinity");
			EnableCurseOfPain = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Pain", "EnableCurseofPain", true, "Disables curse if false");
			PainLevelOnePlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Pain", "Level1Pain", 40, "Damage done to player from level one pain curse. Default is 40 same as falling down a cliff twice.");
			EnableCurseOfSight = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sight", "EnableCurseofSight", true, "Disables curse if false");
			SightLevelOneDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level1DrunkDebuff", 0.2f, "Percentage of Drunkness for Level 1. Default is 20% or 0.2. Range 0.0-1.0");
			SightLevelTwoDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level2DrunkDebuff", 1f, "Percentage of Drunkness for Level 2. Default is 100% or 1.0. Range 0.0-1.0");
			EnableCurseOfSloth = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sloth", "EnableCurseofSloth", true, "Disables curse if false");
			SlothLevelOneMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level1MovementDebuff", 0.75f, "Percentage of Movement Speed after Level 1 Debuff. Default is 75% or 0.75. Range 0.0-1.0");
			SlothLevelTwoMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level2MovementDebuff", 0.5f, "Percentage of Movement Speed after Level 2 Debuff. Default is 50% or 0.5. Range 0.0-1.0");
			EnableCurseOfMidas = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Midas", "EnableCurseofMidas", true, "Disables curse if false");
			MidasMaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Midas", "MaxValueShinyObjects", 100, "This is the maximum scrap value a shiny object can randomly roll");
			EnableCurseOfVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Voice", "EnableCurseofVoice", false, "Disables curse if false");
			harmony.PatchAll(typeof(StrangeObjectsBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(SpawnScrapInLevelPatch));
			harmony.PatchAll(typeof(GrabbleObjectPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(NegativeEffectPatch));
			harmony.PatchAll(typeof(ShipLeavingPatch));
			harmony.PatchAll(typeof(VoiceRefreshPatch));
			harmony.PatchAll(typeof(SyncScrapValuesPatch));
			harmony.PatchAll(typeof(PlaceObjectPatch));
			harmony.PatchAll(typeof(DropAllItemsPatch));
		}
	}
}
namespace StrangeObjects.Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class DropAllItemsPatch
	{
		[HarmonyPostfix]
		private static void removeCurseEffectPatch(ref float ___drunkness, ref float ___movementSpeed)
		{
			___drunkness = 0f;
			___movementSpeed = 4.6f;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbleObjectPatch
	{
		[HarmonyPatch("SetScrapValue")]
		[HarmonyPostfix]
		private static void SubtextPatch(ref GrabbableObject __instance, ref Item ___itemProperties)
		{
			if (__instance.scrapValue < 900 && !(___itemProperties.batteryUsage >= 900f))
			{
				return;
			}
			List<string> list = new List<string> { "Strange", "Painful", "Sloth", "Shiny", "Tipsy", "Silent" };
			if (__instance.scrapValue >= 9000)
			{
				___itemProperties.batteryUsage = 999f;
				GrabbableObject obj = __instance;
				obj.scrapValue -= 9999;
			}
			Random random = new Random(__instance.scrapValue + __instance.itemProperties.minValue + __instance.itemProperties.maxValue + (int)__instance.itemProperties.weight);
			char c = (char)(65 + random.Next(0, 26));
			string text = random.Next(0, 10).ToString() + random.Next(0, 10);
			ScanNodeProperties componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				string[] array = componentInChildren.headerText.Split(new char[1] { ' ' });
				if (array.Length != 0 && !list.Contains(array[0]))
				{
					componentInChildren.headerText = "Strange " + componentInChildren.headerText;
				}
				componentInChildren.subText = $"Value: ${__instance.scrapValue}" + " \nObject: " + c + "-" + text;
				componentInChildren.scrapValue = __instance.scrapValue;
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("UpdateScanNodes")]
		[HarmonyPostfix]
		private static void SubtextPatch(ref HUDManager __instance, ref TextMeshProUGUI[] ___scanElementText, ref RectTransform[] ___scanElements)
		{
			for (int i = 0; i < ___scanElements.Length; i++)
			{
				try
				{
					___scanElementText = ((Component)___scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
					if (___scanElementText.Length > 1)
					{
						string[] array = ((TMP_Text)___scanElementText[1]).text.Split(new char[1] { ' ' });
						if (array.Length > 2 && array[2] == "\nObject:")
						{
							((Component)___scanElements[i]).GetComponent<Animator>().SetInteger("colorNumber", 1);
						}
					}
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"Error in updatescanNodes F: {arg}");
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class NegativeEffectPatch
	{
		[HarmonyPatch("GrabObject")]
		[HarmonyPostfix]
		private static void grabObjectPatch(ref bool ___grabInvalidated, ref GrabbableObject ___currentlyGrabbingObject, ref float ___insanityLevel, ref float ___maxSlideFriction)
		{
			if (___grabInvalidated)
			{
				return;
			}
			if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
			{
				Random random = new Random();
				Random random2 = new Random();
				___currentlyGrabbingObject.scrapValue = random.Next(1, random2.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value)));
			}
			if (___currentlyGrabbingObject.itemProperties.batteryUsage == 999f)
			{
				Random random3 = new Random(___currentlyGrabbingObject.scrapValue + ___currentlyGrabbingObject.itemProperties.minValue + ___currentlyGrabbingObject.itemProperties.maxValue + (int)___currentlyGrabbingObject.itemProperties.weight);
				List<float> list = new List<float>();
				if (StrangeObjectsBase.EnableCurseOfPain.Value)
				{
					list.Add(998f);
				}
				if (StrangeObjectsBase.EnableCurseOfSight.Value)
				{
					list.Add(997f);
				}
				if (StrangeObjectsBase.EnableCurseOfSloth.Value)
				{
					list.Add(996f);
				}
				if (StrangeObjectsBase.EnableCurseOfMidas.Value)
				{
					list.Add(995f);
				}
				if (StrangeObjectsBase.EnableCurseOfVoice.Value)
				{
					list.Add(994f);
				}
				if (list.Count == 0)
				{
					return;
				}
				int index = random3.Next(0, list.Count);
				float batteryUsage = list[index];
				___currentlyGrabbingObject.itemProperties.batteryUsage = batteryUsage;
				if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
				{
					Random random4 = new Random();
					Random random5 = new Random();
					___currentlyGrabbingObject.scrapValue = random4.Next(1, random5.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value)));
				}
				___insanityLevel += 10f;
				ScanNodeProperties componentInChildren = ((Component)___currentlyGrabbingObject).gameObject.GetComponentInChildren<ScanNodeProperties>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					string[] array = componentInChildren.headerText.Split(new char[1] { ' ' });
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 997f)
					{
						array[0] = "Tipsy";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 998f)
					{
						array[0] = "Painful";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 996f)
					{
						array[0] = "Sloth";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
					{
						array[0] = "Shiny";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 994f)
					{
						array[0] = "Silent";
					}
					componentInChildren.headerText = string.Join(" ", array);
				}
			}
			___currentlyGrabbingObject.SetScrapValue(___currentlyGrabbingObject.scrapValue);
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class PlaceObjectPatch
	{
		[HarmonyPostfix]
		private static void removeCurseEffectPatch(GrabbableObject placeObject, ref float ___drunkness, ref float ___movementSpeed)
		{
			if (placeObject.itemProperties.batteryUsage == 997f)
			{
				___drunkness = 0f;
			}
			if (placeObject.itemProperties.batteryUsage == 996f)
			{
				___movementSpeed = 4.6f;
			}
			if (placeObject.itemProperties.batteryUsage == 994f && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void addNegativePatch(ref PlayerControllerB __instance, ref GrabbableObject[] ___ItemSlots, ref float ___maxSlideFriction, ref float ___drunkness, ref float ___movementSpeed, ref bool ___isPlayerDead, ref bool ___isPlayerControlled)
		{
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			if (___isPlayerDead || !___isPlayerControlled)
			{
				___drunkness = 0f;
				___movementSpeed = 4.6f;
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				}
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			List<int> list = new List<int>();
			for (int i = 0; i < ___ItemSlots.Length; i++)
			{
				if (!((Object)(object)___ItemSlots[i] == (Object)null))
				{
					if (___ItemSlots[i].itemProperties.batteryUsage == 998f)
					{
						num++;
						num2++;
						list.Add(i);
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 997f)
					{
						num++;
						num3++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 996f)
					{
						num++;
						num4++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 995f)
					{
						num++;
						num5++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 994f)
					{
						num++;
						num6++;
					}
				}
			}
			if (num3 == 1)
			{
				___drunkness = StrangeObjectsBase.SightLevelOneDrunkDebuff.Value;
			}
			if (num >= 2 && num3 >= 1)
			{
				___drunkness = StrangeObjectsBase.SightLevelTwoDrunkDebuff.Value;
			}
			if (num2 == 1)
			{
				__instance.DamagePlayer(StrangeObjectsBase.PainLevelOnePlayerDamage.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				for (int j = 0; j < list.Count; j++)
				{
					___ItemSlots[list[j]].itemProperties.batteryUsage = 999f;
				}
			}
			if (num4 == 1)
			{
				___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelOneMovementDebuff.Value;
			}
			if (num >= 2 && num4 >= 1)
			{
				___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelTwoMovementDebuff.Value;
			}
			if (num6 == 1 && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = -5f;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(ElevatorAnimationEvents))]
	internal class ShipLeavingPatch
	{
		[HarmonyPatch("ElevatorFullyRunning")]
		[HarmonyPostfix]
		private static void adjustMaxSlideFrictionPatch()
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.drunkness = 0f;
				GameNetworkManager.Instance.localPlayerController.movementSpeed = 4.6f;
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SpawnScrapInLevelPatch
	{
		private static FieldInfo f_someField = AccessTools.Field(typeof(GrabbableObject), "fallTime");

		private static FieldInfo f_someField_2 = AccessTools.Field(typeof(GrabbableObject), "scrapValue");

		private static FieldInfo f_someField_3 = AccessTools.Field(typeof(GrabbableObject), "itemProperties");

		private static FieldInfo f_someField_4 = AccessTools.Field(typeof(Item), "batteryUsage");

		private static FieldInfo f_someField_5 = AccessTools.Field(typeof(RoundManager), "scrapValueMultiplier");

		private static MethodInfo m_randomChance = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => randomChance()));

		private static MethodInfo m_multiValue = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => multiValue()));

		private static MethodInfo m_listCount = typeof(List<int>).GetProperty("Count").GetGetMethod();

		private static MethodInfo m_listGet = typeof(List<int>).GetProperty("Item").GetGetMethod();

		private static MethodInfo m_listSet = typeof(List<int>).GetProperty("Item").GetSetMethod();

		private static MethodInfo getComponentGenericMethod = AccessTools.Method(typeof(Component), "GetComponent", new Type[0], (Type[])null);

		private static MethodInfo m_component = getComponentGenericMethod.MakeGenericMethod(typeof(GrabbableObject));

		private static int myClamp(int value)
		{
			if (value < 1)
			{
				return 1;
			}
			if (value > 100)
			{
				return 100;
			}
			return value;
		}

		private static float multiValue()
		{
			return StrangeObjectsBase.StrangeObjectValueMultiplier.Value;
		}

		private static int randomChance()
		{
			Random random = new Random();
			int result = 0;
			if (random.Next(0, 100) < myClamp(StrangeObjectsBase.StrangeObjectSpawnRate.Value))
			{
				result = 1;
			}
			return result;
		}

		private static IEnumerable<CodeInstruction> Transpiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Expected O, but got Unknown
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			bool flag = false;
			bool flag2 = false;
			Label label = generator.DefineLabel();
			Label label2 = generator.DefineLabel();
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.StoresField(list[i], f_someField) && !flag)
				{
					list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null)
					{
						labels = new List<Label> { label }
					});
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)1));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stloc_S, (object)1));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_randomChance));
					flag = true;
				}
				if (CodeInstructionExtensions.StoresField(list[i], f_someField_2) && !flag2)
				{
					list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null)
					{
						labels = new List<Label> { label2 }
					});
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listSet));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)9999));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listGet));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label2));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)1));
					flag2 = true;
				}
			}
			return list;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SyncScrapValuesPatch
	{
		[HarmonyPostfix]
		private static void fixScrapTotalPatch(int[] allScrapValue, ref float ___totalScrapValueInLevel)
		{
			int num = 0;
			if (allScrapValue != null)
			{
				for (int i = 0; i < allScrapValue.Length; i++)
				{
					num = ((allScrapValue[i] < 9000) ? (num + allScrapValue[i]) : (num + (allScrapValue[i] - 9999)));
				}
			}
			___totalScrapValueInLevel = num;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class VoiceRefreshPatch
	{
		[HarmonyPatch("RefreshPlayerVoicePlaybackObjects")]
		[HarmonyPostfix]
		private static void addMufflePatch(ref PlayerControllerB[] ___allPlayerScripts)
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			PlayerVoiceIngameSettings[] array = Object.FindObjectsOfType<PlayerVoiceIngameSettings>(true);
			for (int i = 0; i < ___allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = ___allPlayerScripts[i];
				if (!val.isPlayerControlled && !val.isPlayerDead)
				{
					continue;
				}
				for (int j = 0; j < array.Length; j++)
				{
					if (array[j]._playerState == null)
					{
						array[j].FindPlayerIfNull();
						if (array[j]._playerState != null)
						{
						}
					}
					else if (((Behaviour)array[j]).isActiveAndEnabled && array[j]._playerState.Name == ((Component)val).gameObject.GetComponentInChildren<NfgoPlayer>().PlayerId)
					{
						val.voicePlayerState = array[j]._playerState;
						val.currentVoiceChatAudioSource = array[j].voiceAudio;
						val.currentVoiceChatIngameSettings = array[j];
						val.currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val.playerClientId];
						if (GameNetworkManager.Instance.localPlayerController.maxSlideFriction == -5f)
						{
							((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f;
							OccludeAudio component = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
							component.overridingLowPass = true;
							component.lowPassOverride = 500f;
							Debug.Log((object)$"Applied Muffle to player voice object #{j} and player object #{i}");
							val.voiceMuffledByEnemy = true;
						}
						else
						{
							((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f;
							OccludeAudio component2 = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
							component2.overridingLowPass = false;
							component2.lowPassOverride = 20000f;
							val.voiceMuffledByEnemy = false;
						}
					}
				}
			}
		}
	}
}