Decompiled source of CleaningCompany v1.0.7

BepInEx/plugins/CleaningCompany/CleaningCompany.dll

Decompiled 10 months 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 CleaningCompany.Misc;
using CleaningCompany.Monos;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CleaningCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Viscera Cleanup meets Lethal Company")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+cb81add47d6b7da0ef0e9989ed4b1196d0462af1")]
[assembly: AssemblyProduct("CleaningCompany")]
[assembly: AssemblyTitle("CleaningCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 CleaningCompany
{
	[BepInPlugin("malco.cleaning_company", "Cleaning Company", "1.0.0")]
	[BepInDependency("evaisa.lethallib", "0.6.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("malco.cleaning_company");

		private const string GUID = "malco.cleaning_company";

		private const string NAME = "Cleaning Company";

		private const string VERSION = "1.0.0";

		private static string root = "Assets/CleaningAssets/";

		private Dictionary<string, int> minBodyValues;

		private Dictionary<string, int> maxBodyValues;

		private Dictionary<string, float> bodyWeights;

		private Dictionary<string, AnimationCurve> bodyPaths;

		private Dictionary<string, string> pathToName = new Dictionary<string, string>
		{
			{
				root + "ScavItem.asset",
				"IgnoreThis"
			},
			{
				root + "HoarderItem.asset",
				"Hoarding bug"
			},
			{
				root + "SpiderItem.asset",
				"Bunker Spider"
			},
			{
				root + "ThumperItem.asset",
				"Crawler"
			},
			{
				root + "CentipedeItem.asset",
				"Centipede"
			},
			{
				root + "BrackenDustItem.asset",
				"Flowerman"
			},
			{
				root + "NutcrackerItem.asset",
				"Nutcracker"
			}
		};

		private Dictionary<string, string> messPaths = new Dictionary<string, string>
		{
			{
				root + "ThumperDroolItem.asset",
				"mop"
			},
			{
				root + "SporePileItem.asset",
				"vacuum"
			},
			{
				root + "EtherealItem.asset",
				"vacuum"
			},
			{
				root + "ScavGoopItem.asset",
				"mop"
			},
			{
				root + "BrackenDustItem.asset",
				"broom"
			},
			{
				root + "NailPileItem.asset",
				"broom"
			},
			{
				root + "HoardingEggItem.asset",
				"garbage"
			},
			{
				root + "BonesItem.asset",
				"garbage"
			}
		};

		public Dictionary<string, Item> BodySpawns = new Dictionary<string, Item>();

		public List<GameObject> tools = new List<GameObject>();

		private AssetBundle bundle;

		public Texture2D janitorMat;

		public static Plugin instance;

		public AudioClip open;

		public AudioClip close;

		public AudioClip zeroDays;

		public AudioClip firedSFX;

		public AudioClip introSFX;

		public static PluginConfig cfg { get; private set; }

		private void Awake()
		{
			cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
			cfg.InitBindings();
			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);
					}
				}
			}
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cleaningassets");
			bundle = AssetBundle.LoadFromFile(text);
			janitorMat = bundle.LoadAsset<Texture2D>("Assets/CleaningAssets/JanitorOutfit.png");
			open = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/open.ogg");
			close = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/close.ogg");
			zeroDays = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/VA/zeroDays.mp3");
			firedSFX = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/VA/fired.mp3");
			introSFX = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/VA/intro.mp3");
			ApplyConfig();
			SetupItems();
			SetupScrap();
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Cleaning Company is patched!");
		}

		private void ApplyConfig()
		{
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Expected O, but got Unknown
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Expected O, but got Unknown
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Expected O, but got Unknown
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Expected O, but got Unknown
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Expected O, but got Unknown
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Expected O, but got Unknown
			bodyWeights = new Dictionary<string, float>
			{
				{
					root + "ScavItem.asset",
					cfg.SCAV_WEIGHT
				},
				{
					root + "HoarderItem.asset",
					cfg.HOARDER_WEIGHT
				},
				{
					root + "SpiderItem.asset",
					cfg.SPIDER_WEIGHT
				},
				{
					root + "ThumperItem.asset",
					cfg.THUMPER_WEIGHT
				},
				{
					root + "NutcrackerItem.asset",
					cfg.NUTCRACKER_WEIGHT
				},
				{
					root + "CentipedeItem.asset",
					cfg.CENTIPEDE_WEIGHT
				}
			};
			maxBodyValues = new Dictionary<string, int>
			{
				{
					root + "ScavItem.asset",
					cfg.SCAV_MAX
				},
				{
					root + "HoarderItem.asset",
					cfg.HOARDER_MAX
				},
				{
					root + "SpiderItem.asset",
					cfg.SPIDER_MAX
				},
				{
					root + "ThumperItem.asset",
					cfg.THUMPER_MAX
				},
				{
					root + "NutcrackerItem.asset",
					cfg.NUTCRACKER_MAX
				},
				{
					root + "CentipedeItem.asset",
					cfg.CENTIPEDE_MAX
				}
			};
			minBodyValues = new Dictionary<string, int>
			{
				{
					root + "ScavItem.asset",
					cfg.SCAV_MIN
				},
				{
					root + "HoarderItem.asset",
					cfg.HOARDER_MIN
				},
				{
					root + "SpiderItem.asset",
					cfg.SPIDER_MIN
				},
				{
					root + "ThumperItem.asset",
					cfg.THUMPER_MIN
				},
				{
					root + "NutcrackerItem.asset",
					cfg.NUTCRACKER_MIN
				},
				{
					root + "CentipedeItem.asset",
					cfg.CENTIPEDE_MIN
				}
			};
			bodyPaths = new Dictionary<string, AnimationCurve>
			{
				{
					root + "ScavItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 1f),
						new Keyframe(cfg.SCAV_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_SCAVS)
					})
				},
				{
					root + "HoarderItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 0f),
						new Keyframe(cfg.HOARDER_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_HOARDERS)
					})
				},
				{
					root + "SpiderItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 0f),
						new Keyframe(cfg.SPIDER_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_SPIDERS)
					})
				},
				{
					root + "ThumperItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 0f),
						new Keyframe(cfg.THUMPER_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_THUMPERS)
					})
				},
				{
					root + "NutcrackerItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 0f),
						new Keyframe(cfg.NUTCRACKER_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_NUTCRACKER)
					})
				},
				{
					root + "CentipedeItem.asset",
					new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 0f),
						new Keyframe(cfg.CENTIPEDE_CURVE, 0f),
						new Keyframe(1f, (float)cfg.MAX_CENTIPEDES)
					})
				}
			};
		}

		private void SetupItems()
		{
			Item val = bundle.LoadAsset<Item>("Assets/CleaningAssets/MopItem.asset");
			ToolItem toolItem = val.spawnPrefab.AddComponent<ToolItem>();
			val.spawnPrefab.AddComponent<AudioMixerFixer>();
			val.itemSpawnsOnGround = true;
			val.canBeGrabbedBeforeGameStart = true;
			toolItem.toolType = "mop";
			((GrabbableObject)toolItem).grabbable = true;
			((GrabbableObject)toolItem).grabbableToEnemies = true;
			((GrabbableObject)toolItem).itemProperties = val;
			Items.RegisterItem(val);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			tools.Add(val.spawnPrefab);
			Item val2 = bundle.LoadAsset<Item>("Assets/CleaningAssets/BroomItem.asset");
			ToolItem toolItem2 = val2.spawnPrefab.AddComponent<ToolItem>();
			val2.spawnPrefab.AddComponent<AudioMixerFixer>();
			val2.itemSpawnsOnGround = true;
			val2.canBeGrabbedBeforeGameStart = true;
			toolItem2.toolType = "broom";
			((GrabbableObject)toolItem2).grabbable = true;
			((GrabbableObject)toolItem2).grabbableToEnemies = true;
			((GrabbableObject)toolItem2).itemProperties = val2;
			Items.RegisterItem(val2);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			tools.Add(val2.spawnPrefab);
			Item val3 = bundle.LoadAsset<Item>("Assets/CleaningAssets/GarbageBox.asset");
			ToolItem toolItem3 = val3.spawnPrefab.AddComponent<ToolItem>();
			val3.spawnPrefab.AddComponent<AudioMixerFixer>();
			val3.itemSpawnsOnGround = true;
			val3.canBeGrabbedBeforeGameStart = true;
			toolItem3.toolType = "garbage";
			((GrabbableObject)toolItem3).grabbable = true;
			((GrabbableObject)toolItem3).grabbableToEnemies = true;
			((GrabbableObject)toolItem3).itemProperties = val3;
			Items.RegisterItem(val3);
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			tools.Add(val3.spawnPrefab);
			Item val4 = bundle.LoadAsset<Item>("Assets/CleaningAssets/DusterItem.asset");
			ToolItem toolItem4 = val4.spawnPrefab.AddComponent<ToolItem>();
			val4.spawnPrefab.AddComponent<AudioMixerFixer>();
			val4.canBeGrabbedBeforeGameStart = true;
			val4.itemSpawnsOnGround = true;
			toolItem4.toolType = "vacuum";
			((GrabbableObject)toolItem4).grabbable = true;
			((GrabbableObject)toolItem4).grabbableToEnemies = true;
			((GrabbableObject)toolItem4).itemProperties = val4;
			Items.RegisterItem(val4);
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			tools.Add(val4.spawnPrefab);
			UnlockablesList val5 = bundle.LoadAsset<UnlockablesList>("Assets/CleaningAssets/TestUnlocks.asset");
			val5.unlockables[0].prefabObject.AddComponent<CabinetScript>();
			val5.unlockables[0].prefabObject.AddComponent<AudioMixerFixer>();
			NetworkPrefabs.RegisterNetworkPrefab(val5.unlockables[0].prefabObject);
			Unlockables.RegisterUnlockable(val5.unlockables[0], 0, (StoreType)0);
		}

		private void SetupScrap()
		{
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Expected O, but got Unknown
			Dictionary<string, AudioClip> dictionary = new Dictionary<string, AudioClip>();
			AudioClip value = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/mop.mp3");
			AudioClip value2 = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/vac.mp3");
			AudioClip value3 = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/sweep.mp3");
			AudioClip value4 = bundle.LoadAsset<AudioClip>("Assets/CleaningAssets/garb.mp3");
			dictionary.Add("mop", value);
			dictionary.Add("vacuum", value2);
			dictionary.Add("broom", value3);
			dictionary.Add("garbage", value4);
			Dictionary<string, Item> dictionary2 = new Dictionary<string, Item>();
			Item val = bundle.LoadAsset<Item>("Assets/CleaningAssets/GarbageBagItem.asset");
			val.spawnPrefab.AddComponent<AudioMixerFixer>();
			Item val2 = bundle.LoadAsset<Item>("Assets/CleaningAssets/BucketItem.asset");
			val2.spawnPrefab.AddComponent<AudioMixerFixer>();
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			dictionary2.Add("mop", val2);
			dictionary2.Add("vacuum", val);
			dictionary2.Add("broom", val);
			dictionary2.Add("garbage", val);
			foreach (KeyValuePair<string, string> messPath in messPaths)
			{
				Item val3 = bundle.LoadAsset<Item>(messPath.Key);
				val3.spawnPrefab.AddComponent<AudioMixerFixer>();
				MessItem messItem = val3.spawnPrefab.AddComponent<MessItem>();
				messItem.loot = dictionary2[messPath.Value].spawnPrefab;
				messItem.toolType = messPath.Value;
				messItem.cleanNoise = dictionary[messPath.Value];
				val3.maxValue = cfg.TRASH_MAX;
				val3.minValue = cfg.TRASH_MIN;
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Items.RegisterScrap(val3, cfg.MESS_RARITY, (LevelTypes)(-1));
				if (messPath.Key.Contains("Bracken"))
				{
					BodySpawns.Add("Flowerman", val3);
				}
			}
			foreach (KeyValuePair<string, AnimationCurve> pair in bodyPaths)
			{
				Item val4 = bundle.LoadAsset<Item>(pair.Key);
				val4.spawnPrefab.AddComponent<AudioMixerFixer>();
				val4.spawnPrefab.AddComponent<BodySyncer>();
				val4.maxValue = maxBodyValues[pair.Key];
				val4.minValue = minBodyValues[pair.Key];
				val4.weight = bodyWeights[pair.Key];
				NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
				SpawnableMapObjectDef val5 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val5.spawnableMapObject = new SpawnableMapObject();
				val5.spawnableMapObject.prefabToSpawn = val4.spawnPrefab;
				MapObjects.RegisterMapObject(val5, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => pair.Value));
				Items.RegisterItem(val4);
				BodySpawns.Add(pathToName[pair.Key], val4);
			}
		}
	}
}
namespace CleaningCompany.Patches
{
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyAIPatcher
	{
		private static ulong currentEnemy = 9999999uL;

		[HarmonyPrefix]
		[HarmonyPatch("KillEnemyServerRpc")]
		private static void SpawnScrapBody(EnemyAI __instance)
		{
			//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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (currentEnemy != ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId)
			{
				currentEnemy = ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId;
				string enemyName = __instance.enemyType.enemyName;
				if (Plugin.instance.BodySpawns.ContainsKey(enemyName))
				{
					GameObject val = Object.Instantiate<GameObject>(Plugin.instance.BodySpawns[enemyName].spawnPrefab, ((Component)__instance).transform.position + Vector3.up, Quaternion.identity);
					val.GetComponent<NetworkObject>().Spawn(false);
					((Component)__instance).gameObject.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("SetScrapValue")]
		private static bool ReturnFalseGaming(GrabbableObject __instance)
		{
			if ((Object)(object)((Component)__instance).GetComponent<MessItem>() != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void RemoveScrap(StartOfRound __instance)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.cfg.SCRAP_SPAWN)
			{
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					string name = ((Object)val).name;
					if (!Enum.IsDefined(typeof(LevelTypes), name))
					{
						continue;
					}
					LevelTypes val2 = (LevelTypes)Enum.Parse(typeof(LevelTypes), name);
					foreach (SpawnableItemWithRarity item in val.spawnableScrap)
					{
						if (item.spawnableItem.isScrap)
						{
							item.rarity = 0;
						}
					}
				}
			}
			if (Plugin.cfg.JANITOR_SUIT)
			{
				foreach (UnlockableItem unlockable in __instance.unlockablesList.unlockables)
				{
					if ((Object)(object)unlockable.suitMaterial != (Object)null && unlockable.alreadyUnlocked)
					{
						unlockable.suitMaterial.mainTexture = (Texture)(object)Plugin.instance.janitorMat;
						break;
					}
				}
				PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val3 in array)
				{
					((Renderer)val3.thisPlayerModel).material.mainTexture = (Texture)(object)Plugin.instance.janitorMat;
					((Renderer)val3.thisPlayerModelLOD1).material.mainTexture = (Texture)(object)Plugin.instance.janitorMat;
					((Renderer)val3.thisPlayerModelLOD2).material.mainTexture = (Texture)(object)Plugin.instance.janitorMat;
					((Renderer)val3.thisPlayerModelArms).material.mainTexture = (Texture)(object)Plugin.instance.janitorMat;
				}
			}
			if (Plugin.cfg.JANITOR_VA)
			{
				__instance.zeroDaysLeftAlertSFX = Plugin.instance.zeroDays;
				__instance.firedVoiceSFX = Plugin.instance.firedSFX;
				__instance.shipIntroSpeechSFX = Plugin.instance.introSFX;
			}
			((MonoBehaviour)__instance).StartCoroutine(SpawnCabinet(__instance));
		}

		private static IEnumerator SpawnCabinet(StartOfRound __instance)
		{
			yield return (object)new WaitForSeconds(0.5f);
			if (!((Object)(object)GameObject.Find("TestCabinet(Clone)") == (Object)null))
			{
				yield break;
			}
			GameObject cabinet = null;
			foreach (UnlockableItem unlockable in __instance.unlockablesList.unlockables)
			{
				if (unlockable.unlockableName == "Cleaning Cabinet")
				{
					cabinet = unlockable.prefabObject;
					break;
				}
			}
			GameObject terminal = GameObject.Find("Terminal");
			GameObject cab = Object.Instantiate<GameObject>(cabinet, terminal.transform.parent);
			cab.GetComponent<NetworkObject>().Spawn(false);
		}
	}
}
namespace CleaningCompany.Monos
{
	internal class BodySyncer : NetworkBehaviour
	{
		public override void OnNetworkSpawn()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				PhysicsProp component = ((Component)this).GetComponent<PhysicsProp>();
				if (((GrabbableObject)component).scrapValue == 0)
				{
					int price = Random.Range(((GrabbableObject)component).itemProperties.minValue, ((GrabbableObject)component).itemProperties.maxValue);
					SyncDetailsClientRpc(price, new NetworkBehaviourReference((NetworkBehaviour)(object)component));
				}
			}
		}

		[ClientRpc]
		private void SyncDetailsClientRpc(int price, NetworkBehaviourReference netRef)
		{
			//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)
			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(3571516743u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, price);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3571516743u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PhysicsProp val3 = default(PhysicsProp);
				((NetworkBehaviourReference)(ref netRef)).TryGet<PhysicsProp>(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 != (Object)null)
				{
					((GrabbableObject)val3).scrapValue = price;
					((GrabbableObject)val3).itemProperties.creditsWorth = price;
					((Component)val3).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}";
					Debug.Log((object)"Successfully synced body values");
				}
				else
				{
					Debug.LogError((object)"Failed to resolve network reference!");
				}
			}
		}

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

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

		private static void __rpc_handler_3571516743(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				NetworkBehaviourReference netRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BodySyncer)(object)target).SyncDetailsClientRpc(price, netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BodySyncer";
		}
	}
	[RequireComponent(typeof(AudioSource))]
	internal class CabinetScript : NetworkBehaviour
	{
		private Animator leftDoor;

		private Animator rightDoor;

		private AudioSource audio;

		private AudioClip open;

		private AudioClip close;

		private InteractTrigger leftTrig;

		private InteractTrigger rightTrig;

		private InteractTrigger broomTrig;

		private InteractTrigger vacTrig;

		private InteractTrigger mopTrig;

		private InteractTrigger garbTrig;

		private bool leftClosed;

		private bool rightClosed;

		private Dictionary<bool, string> doorTip = new Dictionary<bool, string>
		{
			{ true, "Open : [E]" },
			{ false, "Close : [E]" }
		};

		private void Start()
		{
			audio = ((Component)this).GetComponent<AudioSource>();
			open = Plugin.instance.open;
			close = Plugin.instance.close;
			leftDoor = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).GetComponent<Animator>();
			rightDoor = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).GetComponent<Animator>();
			leftTrig = ((Component)leftDoor).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)leftTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)ChangeLeftDoorState);
			rightTrig = ((Component)rightDoor).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)rightTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)ChangeRightDoorState);
			broomTrig = ((Component)((Component)this).transform.GetChild(0).GetChild(2)).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)broomTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)GrabBroom);
			mopTrig = ((Component)((Component)this).transform.GetChild(0).GetChild(3)).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)mopTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)GrabMop);
			garbTrig = ((Component)((Component)this).transform.GetChild(0).GetChild(4)).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)garbTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)GrabGarb);
			vacTrig = ((Component)((Component)this).transform.GetChild(0).GetChild(5)).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)vacTrig.onInteract).AddListener((UnityAction<PlayerControllerB>)GrabVac);
		}

		private void GrabBroom(PlayerControllerB player)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SpawnToolServerRpc(1, ((Component)player).transform.position);
		}

		private void GrabVac(PlayerControllerB player)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SpawnToolServerRpc(3, ((Component)player).transform.position);
		}

		private void GrabMop(PlayerControllerB player)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SpawnToolServerRpc(0, ((Component)player).transform.position);
		}

		private void GrabGarb(PlayerControllerB player)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SpawnToolServerRpc(2, ((Component)player).transform.position);
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnToolServerRpc(int toolID, Vector3 pos)
		{
			//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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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(495819505u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, toolID);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 495819505u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(Plugin.instance.tools[toolID], pos, Quaternion.identity);
					NetworkObject component = val3.GetComponent<NetworkObject>();
					component.Spawn(false);
					((MonoBehaviour)this).StartCoroutine(setParentToShip(component));
				}
			}
		}

		private IEnumerator setParentToShip(NetworkObject netObj)
		{
			yield return (object)new WaitForSeconds(0.5f);
			netObj.TrySetParent(((Component)this).transform.parent, true);
		}

		private void ChangeLeftDoorState(PlayerControllerB player)
		{
			if (leftClosed)
			{
				audio.PlayOneShot(open);
			}
			else
			{
				audio.PlayOneShot(close);
			}
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				TriggerDoorClientRpc(left: true);
			}
			else
			{
				TriggerDoorServerRpc(left: true);
			}
		}

		private void ChangeRightDoorState(PlayerControllerB player)
		{
			if (rightClosed)
			{
				audio.PlayOneShot(open);
			}
			else
			{
				audio.PlayOneShot(close);
			}
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				TriggerDoorClientRpc(left: false);
			}
			else
			{
				TriggerDoorServerRpc(left: false);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void TriggerDoorServerRpc(bool left)
		{
			//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 != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2501078389u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref left, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2501078389u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					TriggerDoorClientRpc(left);
				}
			}
		}

		[ClientRpc]
		private void TriggerDoorClientRpc(bool left)
		{
			//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(3535707651u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref left, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3535707651u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (left)
				{
					leftDoor.SetTrigger("Play");
					leftClosed = !leftClosed;
					leftTrig.hoverTip = doorTip[leftClosed];
				}
				else
				{
					rightDoor.SetTrigger("Play");
					rightClosed = !rightClosed;
					rightTrig.hoverTip = doorTip[rightClosed];
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CabinetScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(495819505u, new RpcReceiveHandler(__rpc_handler_495819505));
			NetworkManager.__rpc_func_table.Add(2501078389u, new RpcReceiveHandler(__rpc_handler_2501078389));
			NetworkManager.__rpc_func_table.Add(3535707651u, new RpcReceiveHandler(__rpc_handler_3535707651));
		}

		private static void __rpc_handler_495819505(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int toolID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref toolID);
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CabinetScript)(object)target).SpawnToolServerRpc(toolID, pos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2501078389(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool left = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref left, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CabinetScript)(object)target).TriggerDoorServerRpc(left);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3535707651(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool left = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref left, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CabinetScript)(object)target).TriggerDoorClientRpc(left);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CabinetScript";
		}
	}
	internal class MessItem : NetworkBehaviour
	{
		private Animator anim;

		public GameObject loot;

		public string toolType;

		private InteractTrigger trig;

		private AudioSource audio;

		public AudioClip cleanNoise;

		private int cleaning = 0;

		private void Awake()
		{
			trig = ((Component)this).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)trig.onInteract).AddListener((UnityAction<PlayerControllerB>)CleanMess);
			((UnityEvent<PlayerControllerB>)(object)trig.onStopInteract).AddListener((UnityAction<PlayerControllerB>)StopMess);
			((UnityEvent<PlayerControllerB>)(object)trig.onInteractEarly).AddListener((UnityAction<PlayerControllerB>)PlayMess);
			anim = ((Component)this).GetComponentInChildren<Animator>();
			audio = ((Component)this).GetComponent<AudioSource>();
			audio.clip = cleanNoise;
		}

		private void Update()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				trig.interactable = false;
				return;
			}
			if ((Object)(object)localPlayerController.currentlyHeldObjectServer == (Object)null)
			{
				trig.interactable = false;
				return;
			}
			ToolItem component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<ToolItem>();
			if ((Object)(object)component == (Object)null)
			{
				trig.interactable = false;
				return;
			}
			if (component.toolType == toolType)
			{
				trig.interactable = true;
			}
			else
			{
				trig.interactable = false;
			}
			anim.SetInteger("CleanStatus", cleaning);
			if (cleaning == 1)
			{
				if (!audio.isPlaying)
				{
					audio.Play();
				}
			}
			else if (audio.isPlaying)
			{
				audio.Stop();
			}
		}

		private void CleanMess(PlayerControllerB player)
		{
			SpawnLootServerRpc();
			audio.Stop();
			audio.volume = 0f;
		}

		private void StopMess(PlayerControllerB player)
		{
			cleaning = 0;
		}

		private void PlayMess(PlayerControllerB player)
		{
			cleaning = 1;
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnLootServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			//IL_0115: 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(969310882u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 969310882u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(loot, ((Component)this).transform.position + Vector3.up, Quaternion.identity);
					val3.GetComponent<NetworkObject>().Spawn(false);
					PhysicsProp component = val3.GetComponent<PhysicsProp>();
					int price = Random.Range(((GrabbableObject)component).itemProperties.minValue, ((GrabbableObject)component).itemProperties.maxValue);
					SyncDetailsClientRpc(price, new NetworkBehaviourReference((NetworkBehaviour)(object)component));
				}
			}
		}

		[ClientRpc]
		private void SyncDetailsClientRpc(int price, NetworkBehaviourReference netRef)
		{
			//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)
			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(1088653732u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, price);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1088653732u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PhysicsProp val3 = default(PhysicsProp);
				((NetworkBehaviourReference)(ref netRef)).TryGet<PhysicsProp>(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 != (Object)null)
				{
					((GrabbableObject)val3).scrapValue = price;
					((GrabbableObject)val3).itemProperties.creditsWorth = price;
					((Component)val3).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}";
					Debug.Log((object)"Successfully synced trash values");
				}
				else
				{
					Debug.LogError((object)"Failed to resolve network reference!");
				}
				((Component)this).gameObject.SetActive(false);
			}
		}

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

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

		private static void __rpc_handler_969310882(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MessItem)(object)target).SpawnLootServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1088653732(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				NetworkBehaviourReference netRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MessItem)(object)target).SyncDetailsClientRpc(price, netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "MessItem";
		}
	}
	internal class ToolItem : PhysicsProp
	{
		public string toolType;

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

		protected internal override string __getTypeName()
		{
			return "ToolItem";
		}
	}
}
namespace CleaningCompany.Misc
{
	public class AudioMixerFixer : MonoBehaviour
	{
		private static AudioMixerGroup _masterDiageticMixer;

		[SerializeField]
		private List<AudioSource> sourcesToFix;

		public static AudioMixerGroup MasterDiageticMixer
		{
			get
			{
				if ((Object)(object)_masterDiageticMixer == (Object)null)
				{
					AudioSource val = (from p in ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.Prefabs.Prefabs
						select p.Prefab.GetComponentInChildren<NoisemakerProp>() into p
						where (Object)(object)p != (Object)null
						select ((Component)p).GetComponentInChildren<AudioSource>() into p
						where (Object)(object)p != (Object)null
						select p).FirstOrDefault();
					if ((Object)(object)val == (Object)null)
					{
						throw new Exception("Failed to locate a suitable AudioSource output mixer to reference! Could you be calling this method before the GameNetworkManager is initialized?");
					}
					_masterDiageticMixer = val.outputAudioMixerGroup;
				}
				return _masterDiageticMixer;
			}
		}

		private void Start()
		{
			AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren<AudioSource>();
			foreach (AudioSource item in componentsInChildren)
			{
				if (!sourcesToFix.Contains(item))
				{
					sourcesToFix.Add(item);
				}
			}
			foreach (AudioSource item2 in sourcesToFix)
			{
				item2.outputAudioMixerGroup = MasterDiageticMixer;
			}
		}
	}
	public class PluginConfig
	{
		private readonly ConfigFile configFile;

		public bool JANITOR_SUIT { get; set; }

		public bool JANITOR_VA { get; set; }

		public int MAX_SCAVS { get; set; }

		public int MAX_SPIDERS { get; set; }

		public int MAX_HOARDERS { get; set; }

		public int MAX_THUMPERS { get; set; }

		public int MAX_CENTIPEDES { get; set; }

		public int MAX_NUTCRACKER { get; set; }

		public float SCAV_CURVE { get; set; }

		public float SPIDER_CURVE { get; set; }

		public float THUMPER_CURVE { get; set; }

		public float CENTIPEDE_CURVE { get; set; }

		public float NUTCRACKER_CURVE { get; set; }

		public float HOARDER_CURVE { get; set; }

		public int SCAV_MIN { get; set; }

		public int SPIDER_MIN { get; set; }

		public int THUMPER_MIN { get; set; }

		public int NUTCRACKER_MIN { get; set; }

		public int CENTIPEDE_MIN { get; set; }

		public int HOARDER_MIN { get; set; }

		public int SCAV_MAX { get; set; }

		public int NUTCRACKER_MAX { get; set; }

		public int SPIDER_MAX { get; set; }

		public int THUMPER_MAX { get; set; }

		public int CENTIPEDE_MAX { get; set; }

		public int HOARDER_MAX { get; set; }

		public float SCAV_WEIGHT { get; set; }

		public float NUTCRACKER_WEIGHT { get; set; }

		public float SPIDER_WEIGHT { get; set; }

		public float THUMPER_WEIGHT { get; set; }

		public float CENTIPEDE_WEIGHT { get; set; }

		public float HOARDER_WEIGHT { get; set; }

		public int TRASH_MIN { get; set; }

		public int TRASH_MAX { get; set; }

		public bool SCRAP_SPAWN { get; set; }

		public int MESS_RARITY { get; set; }

		public PluginConfig(ConfigFile cfg)
		{
			configFile = cfg;
		}

		private T ConfigEntry<T>(string section, string key, T defaultVal, string description)
		{
			return configFile.Bind<T>(section, key, defaultVal, description).Value;
		}

		public void InitBindings()
		{
			JANITOR_SUIT = ConfigEntry("Janitor Theme", "Janitor Suits", defaultVal: true, "If true the default suit will be replaced with a janitor suit.");
			JANITOR_VA = ConfigEntry("Janitor Theme", "Janitor Voice Acting", defaultVal: true, "If true the default loud speaker voicelines will be replaced with Rufus'.");
			MAX_CENTIPEDES = ConfigEntry("Max Body Spawns", "Max number of Centipede Bodies", 2, "");
			MAX_HOARDERS = ConfigEntry("Max Body Spawns", "Max number of Hoarding Bug Bodies", 1, "");
			MAX_SCAVS = ConfigEntry("Max Body Spawns", "Max number of Scavenger Bodies", 3, "");
			MAX_SPIDERS = ConfigEntry("Max Body Spawns", "Max number of Spider Bodies", 1, "");
			MAX_THUMPERS = ConfigEntry("Max Body Spawns", "Max number of Thumper Bodies", 1, "");
			MAX_NUTCRACKER = ConfigEntry("Max Body Spawns", "Max number of Nutcracker Bodies", 1, "");
			CENTIPEDE_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Centipede Bodies", 0.25f, "Lower this number to increase spawn chance.");
			HOARDER_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Hoarding Bug Bodies", 0.35f, "Lower this number to increase spawn chance.");
			SCAV_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Scavenger Bodies", 0.35f, "Lower this number to increase spawn chance.");
			SPIDER_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Spider Bodies", 0.5f, "Lower this number to increase spawn chance.");
			THUMPER_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Thumper Bodies", 0.75f, "Lower this number to increase spawn chance.");
			NUTCRACKER_CURVE = ConfigEntry("Body Spawn Chance", "Max number of Nutcracker Bodies", 0.75f, "Lower this number to increase spawn chance.");
			CENTIPEDE_MIN = ConfigEntry("Body Values", "Min price of Centipede Bodies", 45, "");
			CENTIPEDE_MAX = ConfigEntry("Body Values", "Max price of Centipede Bodies", 70, "");
			HOARDER_MIN = ConfigEntry("Body Values", "Min price of Hoarding Bug Bodies", 55, "");
			HOARDER_MAX = ConfigEntry("Body Values", "Max price of Hoarding Bug Bodies", 88, "");
			SCAV_MIN = ConfigEntry("Body Values", "Min price of Scavenger Bodies", 100, "");
			SCAV_MAX = ConfigEntry("Body Values", "Max price of Scavenger Bodies", 170, "");
			SPIDER_MIN = ConfigEntry("Body Values", "Min price of Spider Bodies", 70, "");
			SPIDER_MAX = ConfigEntry("Body Values", "Max price of Spider Bodies", 110, "");
			THUMPER_MIN = ConfigEntry("Body Values", "Min price of Thumper Bodies", 120, "");
			THUMPER_MAX = ConfigEntry("Body Values", "Max price of Thumper Bodies", 160, "");
			NUTCRACKER_MIN = ConfigEntry("Body Values", "Min price of Nutcracker Bodies", 125, "");
			NUTCRACKER_MAX = ConfigEntry("Body Values", "Max price of Nutcracker Bodies", 150, "");
			CENTIPEDE_WEIGHT = ConfigEntry("Body Weights", "Weight of Centipede Bodies", 1.65f, "");
			HOARDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Hoarding Bug Bodies", 1.6f, "");
			SCAV_WEIGHT = ConfigEntry("Body Weights", "Weight of Scavenger Bodies", 2.5f, "");
			SPIDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Spider Bodies", 2.3f, "");
			THUMPER_WEIGHT = ConfigEntry("Body Weights", "Weight of Thumper Bodies", 2.9f, "");
			NUTCRACKER_WEIGHT = ConfigEntry("Body Weights", "Weight of Nutcracker Bodies", 2.9f, "");
			TRASH_MIN = ConfigEntry("Trash Value", "Min price of trash", 20, "");
			TRASH_MAX = ConfigEntry("Trash Value", "Max price of trash", 70, "");
			SCRAP_SPAWN = ConfigEntry("Scrap", "Spawn regular scrap", defaultVal: false, "");
			MESS_RARITY = ConfigEntry("Scrap", "Mess rarity", 50, "Higher means it has a higher chance of spawning. if the above option is false this doesn't matter.");
		}
	}
}