Decompiled source of REPOCAOS v69.0.3

RepoCaosMod.dll

Decompiled a day ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using RepoCaos;
using RepoCaosMod.Resources;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RepoCaosMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ReviOS 11 24.12")]
[assembly: AssemblyProduct("RepoCaosMod")]
[assembly: AssemblyCopyright("Copyright © ReviOS 11 24.12 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b62091cf-1bc7-4d0e-be7b-011b6b98bf30")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RepoCaosMod.Scripts
{
	internal class ItemVolumePatch
	{
		[HarmonyPatch(typeof(ItemVolume), "Start")]
		public class StatsManagerPatchItems
		{
			[HarmonyPrefix]
			public static bool Prefix(ItemVolume __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Invalid comparison between Unknown and I4
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				if ((int)__instance.itemVolume == 3 || (int)__instance.itemVolume == 8)
				{
					return true;
				}
				__instance.itemVolume = (itemVolume)6;
				__instance.itemSecretShopType = (itemSecretShopType)0;
				return true;
			}
		}
	}
	internal class StatsManagerPatch
	{
		[HarmonyPatch(typeof(StatsManager), "Update")]
		public class StatsManagerPatchItems
		{
			[HarmonyPrefix]
			public static bool Prefix(StatsManager __instance)
			{
				if (itemCount != __instance.itemDictionary.Count)
				{
					itemCount = __instance.itemDictionary.Count;
					foreach (Item value in __instance.itemDictionary.Values)
					{
						value.maxAmount = 100;
						value.maxAmountInShop = 100;
					}
					ShopManager.instance.itemUpgradesAmount = 100;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(StatsManager), "GetItemsUpgradesPurchased")]
		public class StatsManagerGetItemsUpgradesPurchasedPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(StatsManager __instance, string itemName, ref int __result)
			{
				__result = __instance.itemsUpgradesPurchased[itemName] * 2;
				return true;
			}
		}

		[HarmonyPatch(typeof(StatsManager), "SaveGame")]
		public class StatsManagerSaveGame
		{
			[HarmonyPrefix]
			public static bool Prefix(StatsManager __instance, string fileName, ref string ___teamName)
			{
				___teamName = "R.E.P.O.C.A.O.S.";
				return true;
			}
		}

		private static int itemCount;
	}
}
namespace RepoCaosMod.Scripts.Menu
{
	internal class MainMenuPatcher
	{
		[HarmonyPatch(typeof(MenuButton), "Awake")]
		public class MenuButtonsDisabler
		{
			[HarmonyPrefix]
			public static bool Prefix(MenuButton __instance)
			{
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)((Component)__instance).gameObject).name == "Menu Button - singleplayer")
				{
					((Behaviour)__instance).enabled = false;
					((Graphic)((Component)((Component)__instance).transform.GetChild(0)).GetComponent<TMP_Text>()).color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
					return true;
				}
				return true;
			}
		}
	}
}
namespace RepoCaosMod.Scripts.Levels
{
	internal class ArcticLevelPatch
	{
		[HarmonyPatch(typeof(Module), "Start")]
		public class ModulePatcher
		{
			[HarmonyPrefix]
			public static bool Prefix(Module __instance)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)((Component)__instance).gameObject).name.Contains("Module - Arctic - DE - 1 - Bathroom Stalls"))
				{
					GameObject gameObject = ((Component)((Component)__instance).transform.GetChild(2).GetChild(0).GetChild(8)).gameObject;
					GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform);
					val.transform.SetParent(gameObject.transform.parent);
					val.transform.localPosition = new Vector3(0.782f, 0.099f, -6.319f);
				}
				return true;
			}
		}
	}
	internal class ArenaLevelPatcher
	{
		[HarmonyPatch(typeof(Module), "Start")]
		public class ModulePatcher
		{
			[HarmonyPrefix]
			public static bool Prefix(Module __instance)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0247: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)((Component)__instance).gameObject).name.Contains("Start Room - Arena"))
				{
					((Component)__instance).transform.GetChild(2).GetChild(10).localScale = new Vector3(2f * ((Component)__instance).transform.GetChild(2).GetChild(10).localScale.x, 1f * ((Component)__instance).transform.GetChild(2).GetChild(10).localScale.y, 2f * ((Component)__instance).transform.GetChild(2).GetChild(10).localScale.z);
					((Component)__instance).transform.GetChild(2).GetChild(11).localScale = new Vector3(2f * ((Component)__instance).transform.GetChild(2).GetChild(11).localScale.x, 1f * ((Component)__instance).transform.GetChild(2).GetChild(11).localScale.y, 2f * ((Component)__instance).transform.GetChild(2).GetChild(11).localScale.z);
					((Component)__instance).transform.GetChild(2).GetChild(12).localScale = new Vector3(2f * ((Component)__instance).transform.GetChild(2).GetChild(12).localScale.x, 1f * ((Component)__instance).transform.GetChild(2).GetChild(12).localScale.y, 2f * ((Component)__instance).transform.GetChild(2).GetChild(12).localScale.z);
					((Component)__instance).transform.GetChild(2).GetChild(12).GetChild(0)
						.localScale = new Vector3(0.5f * ((Component)__instance).transform.GetChild(2).GetChild(12).GetChild(0)
						.localScale.x, 1f * ((Component)__instance).transform.GetChild(2).GetChild(12).GetChild(0)
						.localScale.y, 0.5f * ((Component)__instance).transform.GetChild(2).GetChild(12).GetChild(0)
						.localScale.z);
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Arena), "Update")]
		public class ArenaTimeSlower
		{
			[HarmonyPrefix]
			public static bool Prefix(Arena __instance, ref float ___stateTimer)
			{
				return true;
			}
		}
	}
	internal class RunManagerPatch
	{
		[HarmonyPatch(typeof(RunManager), "Update")]
		public class RunManagerSetMusic
		{
			[HarmonyPrefix]
			public static bool Prefix(RunManager __instance)
			{
				if (__instance.levelCurrent.ResourcePath == "Main Menu" && !ChangedMainMenuSong && Plugin.ReplaceMenuMusic.Value)
				{
					ChangedMainMenuSong = true;
					AssetBundle val = AssetBundle.LoadFromMemory(Resource1.audios);
					__instance.levelCurrent.ConstantMusicPreset.clip = val.LoadAsset<AudioClip>("Flint And Steel Chicken Jockey");
					__instance.levelCurrent.ConstantMusicPreset.volume = 0.1f;
				}
				return true;
			}
		}

		private static string lastL = "";

		private static bool ChangedMainMenuSong = false;
	}
	internal class ManorLevelPatcher
	{
		[HarmonyPatch(typeof(Module), "Start")]
		public class SaunaModulePatcher
		{
			[HarmonyPrefix]
			public static bool Prefix(Module __instance)
			{
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)((Component)__instance).gameObject).name.Contains("Module - Manor - DE - 1 - Sauna"))
				{
					GameObject gameObject = ((Component)((Component)__instance).transform.GetChild(1).GetChild(3).GetChild(7)).gameObject;
					GameObject val = Object.Instantiate<GameObject>(gameObject);
					val.transform.SetParent(gameObject.transform.parent);
					val.transform.localPosition = new Vector3(4.421f, -0.138f, -3.763f);
					val.transform.localRotation = Quaternion.Euler(-16f, -90f, 0f);
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ModuleConnectObject), "Start")]
		public class DoorModulePatcher
		{
			[HarmonyPrefix]
			public static bool Prefix(ModuleConnectObject __instance)
			{
				//IL_0108: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)((Component)__instance).gameObject).name.Contains("Manor Door"))
				{
					PhysGrabHinge component = ((Component)((Component)__instance).transform.GetChild(0)).GetComponent<PhysGrabHinge>();
					component.drag *= 10f;
					PhysAttribute val = Object.Instantiate<PhysAttribute>(((Component)((Component)__instance).transform.GetChild(0)).GetComponent<NotValuableObject>().physAttributePreset);
					val.mass = 16f;
					((Component)((Component)__instance).transform.GetChild(0)).GetComponent<NotValuableObject>().physAttributePreset = val;
					Material material = ((Renderer)((Component)((Component)__instance).transform.GetChild(0).GetChild(0)).GetComponent<MeshRenderer>()).material;
					material.SetFloat("_Metallic", 0.5f);
					((Renderer)((Component)((Component)__instance).transform.GetChild(0).GetChild(0)).GetComponent<MeshRenderer>()).material.SetFloat("_Metallic", 0.5f);
					((Renderer)((Component)((Component)__instance).transform.GetChild(0).GetChild(0)).GetComponent<MeshRenderer>()).material.color = new Color(0.8f, 0.8f, 0.8f, 1f);
					AudioSource component2 = ((Component)((Component)__instance).transform.GetChild(0).GetChild(2)).GetComponent<AudioSource>();
					component2.pitch /= 2f;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Module), "Start")]
		public class SplitMineModulePatcher
		{
			[HarmonyPrefix]
			public static bool Prefix(Module __instance)
			{
				if (((Object)((Component)__instance).gameObject).name.Contains("Module - Manor - P - 3 - Split Mine"))
				{
					((Component)((Component)__instance).transform.GetChild(1)).gameObject.SetActive(false);
				}
				return true;
			}
		}
	}
}
namespace RepoCaosMod.Scripts.Items
{
	internal class ItemUpgradeChangeMaterial
	{
		[HarmonyPatch(typeof(ItemUpgrade), "Start")]
		public class ItemUpgradeStart
		{
			[HarmonyPrefix]
			public static bool Prefix(ItemUpgrade __instance)
			{
				if (!Plugin.ChangeSmallShit.Value)
				{
					return true;
				}
				if (((Object)((Component)__instance).gameObject).name.Contains("Item Upgrade Player Health"))
				{
					if ((Object)(object)HealthMaterial == (Object)null)
					{
						AssetBundle val = AssetBundle.LoadFromMemory(Resource1.pedroche);
						HealthMaterial = val.LoadAsset<Material>("upgrade_pedroche");
					}
					((Renderer)((Component)((Component)__instance).transform.GetChild(5)).GetComponent<MeshRenderer>()).material = HealthMaterial;
				}
				return true;
			}
		}

		public static Material HealthMaterial;
	}
}
namespace RepoCaosMod.Scripts.Events
{
	internal class EnemyEventsPatcher
	{
		[HarmonyPatch(typeof(EnemyOnScreen), "GetOnScreen")]
		public static class EnemyOnScreen_GetOnScreen_Patch
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyOnScreen __instance, PlayerAvatar _playerAvatar, ref bool __result)
			{
				if (Plugin.EventActive("alwaysWatching"))
				{
					__result = true;
					if (PlayerController.instance.Crouching)
					{
						__result = false;
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Enemy), "Freeze")]
		public class EnemyPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(FlashlightController __instance, ref float time)
			{
				if (Plugin.EventActive("notFreeze"))
				{
					time = 0f;
					return true;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyStateStunned), "Set")]
		public class EnemyStateStunnedPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyStateStunned __instance, ref float time)
			{
				if (Plugin.EventActive("notFreeze"))
				{
					time = 0f;
					return true;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyHealth), "Hurt")]
		public class EnemyHealthHurt
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyHealth __instance, int _damage, Vector3 _hurtDirection)
			{
				if (Plugin.EventActive("enemyNoHurt"))
				{
					return false;
				}
				return true;
			}
		}
	}
	internal class ItemEventsPatcher
	{
		[HarmonyPatch(typeof(ItemGun), "Misfire")]
		public class ItemGunMisFire
		{
			[HarmonyPrefix]
			public static bool Prefix(ItemGun __instance, ItemBattery ___itemBattery)
			{
				if (Plugin.EventActive("gunFire"))
				{
					___itemBattery.batteryLife = 1f;
					__instance.Shoot();
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ItemDrone), "TargetFindPlayer")]
		public class ItemDroneDontFindPlayer
		{
			[HarmonyPrefix]
			public static bool Prefix(ItemDrone __instance)
			{
				if (Plugin.EventActive("droneDoesntFind"))
				{
					return false;
				}
				return true;
			}
		}
	}
	internal class PhysObjectEventsPatcher
	{
		[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "EnemyInvestigate")]
		public class PhysGrabOjectInvestigate
		{
			[HarmonyPrefix]
			public static bool Prefix(PhysGrabObjectImpactDetector __instance, float radius)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				if (Plugin.EventActive("enemiesHearImpact"))
				{
					EnemyDirector.instance.SetInvestigate(((Component)__instance).transform.position, 10000f);
					return false;
				}
				return true;
			}
		}
	}
	internal class PlayerEventsPatcher
	{
		[HarmonyPatch(typeof(PlayerAvatar), "Start")]
		public class PlayerAvatarPicker
		{
			[HarmonyPrefix]
			public static bool Prefix(PlayerAvatar __instance)
			{
				return true;
			}
		}

		[HarmonyPatch(typeof(FlashlightController), "Update")]
		public class FlashlightOnPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(FlashlightController __instance)
			{
				if (Plugin.EventActive("flashLightOn"))
				{
					FieldInfo fieldInfo = AccessTools.Field(typeof(FlashlightController), "hideFlashlight");
					fieldInfo.SetValue(__instance, false);
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerHealth), "Heal")]
		public class HealPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(PlayerHealth __instance, int healAmount, bool effect = true)
			{
				if (!Plugin.EventActive("noHeal"))
				{
					return true;
				}
				if (Plugin.EventActive("healHurts"))
				{
					__instance.Hurt(healAmount, false, -1);
					return true;
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(Aim), "SetState")]
		public class AimPatches
		{
			[HarmonyPrefix]
			public static bool Prefix_Aim_SetState(State _state, Aim __instance)
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				if (Plugin.EventActive("randomCursor"))
				{
					State val = (State)Random.Range(0, Enum.GetValues(typeof(State)).Length);
					foreach (AimState aimState in __instance.aimStates)
					{
						if (aimState.State == _state)
						{
							FieldInfo fieldInfo = AccessTools.Field(typeof(Aim), "currentState");
							FieldInfo fieldInfo2 = AccessTools.Field(typeof(Aim), "currentSprite");
							FieldInfo fieldInfo3 = AccessTools.Field(typeof(Aim), "currentColor");
							FieldInfo fieldInfo4 = AccessTools.Field(typeof(Aim), "animLerp");
							FieldInfo fieldInfo5 = AccessTools.Field(typeof(Aim), "stateTimer");
							fieldInfo.SetValue(__instance, aimState.State);
							fieldInfo2.SetValue(__instance, aimState.Sprite);
							fieldInfo3.SetValue(__instance, aimState.Color);
							fieldInfo4.SetValue(__instance, 0f);
							fieldInfo5.SetValue(__instance, 0.2f);
							break;
						}
					}
					return false;
				}
				if (!Plugin.EventActive("disableCursor"))
				{
					return true;
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(HurtCollider), "PlayerHurt")]
		public class HurtColliderKill
		{
			[HarmonyPrefix]
			public static bool Prefix(HurtCollider __instance, ref PlayerAvatar _player)
			{
				if (Plugin.EventActive("hurtColliderKill"))
				{
					_player = PlayerAvatar.instance;
					return true;
				}
				return true;
			}
		}
	}
}
namespace RepoCaosMod.Scripts.Enemies
{
	internal class EnemyHealthPatch
	{
		[HarmonyPatch(typeof(EnemyHealth), "Awake")]
		public class AwakePatch
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyHealth __instance)
			{
				__instance.health *= RunManager.instance.levelsCompleted + 1;
				__instance.impactHeavyDamage *= 2;
				__instance.spawnValuableMax *= 1000;
				return true;
			}
		}
	}
	internal class EnemyParentPatch
	{
		[HarmonyPatch(typeof(EnemyParent), "Awake")]
		public class AwakePatch
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyParent __instance)
			{
				__instance.SpawnedTimeMax *= 0.1f / (float)(RunManager.instance.levelsCompleted + 1);
				__instance.SpawnedTimeMin *= 0.1f / (float)(RunManager.instance.levelsCompleted + 1);
				__instance.actionMultiplier *= 3f;
				return true;
			}
		}
	}
	internal class EnemyStateInvestigatePatch
	{
		[HarmonyPatch(typeof(EnemyStateInvestigate), "Awake")]
		public class AwakePatch
		{
			[HarmonyPrefix]
			public static bool Prefix(EnemyStateInvestigate __instance)
			{
				__instance.rangeMultiplier *= (float)(5 * (RunManager.instance.levelsCompleted + 1));
				NavMeshAgent component = ((Component)__instance).GetComponent<NavMeshAgent>();
				component.speed *= (float)(RunManager.instance.levelsCompleted + 1);
				NavMeshAgent component2 = ((Component)__instance).GetComponent<NavMeshAgent>();
				component2.angularSpeed *= (float)(RunManager.instance.levelsCompleted * 2 + 1);
				return true;
			}
		}
	}
}
namespace RepoCaosMod.Resources
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resource1
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("RepoCaosMod.Resources.Resource1", typeof(Resource1).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] audios
		{
			get
			{
				object @object = ResourceManager.GetObject("audios", resourceCulture);
				return (byte[])@object;
			}
		}

		internal static byte[] pedroche
		{
			get
			{
				object @object = ResourceManager.GetObject("pedroche", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resource1()
		{
		}
	}
}
namespace RepoCaos
{
	[BepInPlugin("duviz.repocaos.repo", "REPOCAOS", "69.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public static bool debug = false;

		public static bool hideUI = true;

		public static List<string> caosNames = new List<string>();

		public static Dictionary<string, Object> spawnerKeys;

		public static Dictionary<string, string> spawnerPaths;

		public static string selectedString;

		public static float timeToSelectNewEvent;

		public static float timeToAffect;

		public static int LastGamemode = 0;

		public static float LastTime = 7f;

		private const byte AFFECT_EVENT_CODE = 1;

		public static ConfigEntry<bool> ReplaceMenuMusic;

		public static ConfigEntry<bool> ChangeSmallShit;

		private void Awake()
		{
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			((Object)ThreadingHelper.Instance).hideFlags = (HideFlags)61;
			((ConfigEntry<bool>)AccessTools.Field(typeof(Chainloader), "ConfigHideBepInExGOs").GetValue(null)).Value = true;
			caosNames.Add("disableCursor");
			caosNames.Add("randomCursor");
			caosNames.Add("cameraGlitch");
			caosNames.Add("flashLightOn");
			caosNames.Add("noHeal");
			caosNames.Add("notFreeze");
			caosNames.Add("stunPlayer");
			caosNames.Add("enemiesHearImpact");
			caosNames.Add("enemiesInvestigate");
			caosNames.Add("hurtColliderKill");
			caosNames.Add("decreaseSpawnTime");
			caosNames.Add("gunFire");
			caosNames.Add("explodeGrenades");
			caosNames.Add("shootGuns");
			caosNames.Add("healMonsters");
			caosNames.Add("enemyNoHurt");
			caosNames.Add("frogJump");
			caosNames.Add("droneDoesntFind");
			caosNames.Add("spawnEnemy");
			caosNames.Add("none");
			spawnerKeys = new Dictionary<string, Object>();
			spawnerPaths = new Dictionary<string, string>();
			AddSpawn("diamond", "valuables/01 tiny/Valuable Diamond");
			AddSpawn("trophy", "valuables/03 medium/Valuable Trophy");
			AddSpawn("clown", "valuables/03 medium/Valuable Clown");
			AddSpawn("dinosaur", "valuables/05 wide/Valuable Dinosaur");
			AddSpawn("ice", "valuables/05 wide/Valuable Animal Crate");
			AddSpawn("vase", "valuables/04 big/Valuable Vase Big");
			AddSpawn("television", "valuables/04 big/Valuable Television");
			AddSpawn("handgun", "items/Item Gun Handgun");
			AddSpawn("shotgun", "items/Item Gun Shotgun");
			AddSpawn("stungun", "items/Item Gun Tranq");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello, the Instagram community!");
			Harmony val = new Harmony("duviz.repocaos.repo");
			val.PatchAll();
			ReplaceMenuMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ReplaceMenuMusic", false, "If true, replaces the menu music the FLINT N STEEL!!!");
			ChangeSmallShit = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ChangeSmallShit", false, "If true, a lot of materials are replaced with meme ones");
		}

		public static void AddSpawn(string objectName, string ResourcePath)
		{
			spawnerKeys.Add(objectName, Resources.Load(ResourcePath));
			spawnerPaths.Add(objectName, ResourcePath);
		}

		public static string GetRandomSpawnerKey()
		{
			if (spawnerKeys.Count == 0)
			{
				return null;
			}
			List<string> list = new List<string>(spawnerKeys.Keys);
			int index = Random.Range(0, list.Count);
			return list[index];
		}

		private void SpawnItem(string itemId = "trophy", float YOffset = 0f, bool decreaseValue = false, float decreaseAmount = 6f, PlayerAvatar avatar = null)
		{
			//IL_008d: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			if ((Object)(object)avatar == (Object)null)
			{
				avatar = PlayerAvatar.instance;
			}
			if (GameManager.instance.gameMode == 0 || !SemiFunc.IsMultiplayer())
			{
				Object.Instantiate(spawnerKeys[itemId], ((Component)avatar).transform.position + new Vector3(0f, 0f + YOffset, 0f), ((Component)avatar).transform.rotation);
				return;
			}
			GameObject val = PhotonNetwork.InstantiateRoomObject(spawnerPaths[itemId], ((Component)avatar).transform.position + new Vector3(0f, 0f + YOffset, 0f), ((Component)avatar).transform.rotation, (byte)0, (object[])null);
			ValuableObject component = val.GetComponent<ValuableObject>();
			if ((Object)(object)component != (Object)null && decreaseValue)
			{
				Value val2 = Object.Instantiate<Value>(component.valuePreset);
				val2.valueMin /= decreaseAmount;
				val2.valueMax /= decreaseAmount;
				component.valuePreset = val2;
			}
		}

		private void Start()
		{
			PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
			PhotonNetwork.NetworkingClient.StateChanged += OnStateChanged;
		}

		private void OnStateChanged(ClientState from, ClientState to)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if ((int)to == 9)
			{
				PhotonNetwork.AddCallbackTarget((object)this);
			}
			else if ((int)from == 9)
			{
				PhotonNetwork.RemoveCallbackTarget((object)this);
			}
		}

		private void Update()
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Invalid comparison between Unknown and I4
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)107) && debug)
			{
				SpawnItem("trophy", 0f, decreaseValue: true, 0.005f);
			}
			if (Input.GetKey((KeyCode)106) && debug)
			{
				SpawnItem("trophy", 0f, decreaseValue: true, 0.005f);
			}
			if (Input.GetKey((KeyCode)122) && debug)
			{
				timeToAffect -= Time.deltaTime * 10f;
				timeToSelectNewEvent -= Time.deltaTime * 10f;
			}
			if (Input.GetKeyDown((KeyCode)120) && debug)
			{
				GetNewEvent();
			}
			if ((Object)(object)PlayerVoiceChat.instance != (Object)null)
			{
			}
			if (!((Object)(object)HealthUI.instance == (Object)null) && GameManager.instance.gameMode != 0 && (int)GameDirector.instance.currentState == 2 && !SemiFunc.IsMainMenu() && !SemiFunc.RunIsLobbyMenu() && !SemiFunc.RunIsShop())
			{
				if (GameManager.instance.gameMode != LastGamemode)
				{
					LastGamemode = GameManager.instance.gameMode;
					LastTime = Time.time + 7f;
					timeToSelectNewEvent = Random.Range(31, 40);
					timeToAffect = Random.Range(30, 40);
				}
				FieldInfo fieldInfo = AccessTools.Field(typeof(HealthUI), "playerHealthValue");
				float num = Time.deltaTime / 50f * (float)(int)fieldInfo.GetValue(HealthUI.instance);
				timeToSelectNewEvent -= num;
				if (timeToSelectNewEvent < 0f)
				{
					timeToSelectNewEvent = Random.Range(15, 40);
					GetNewEvent();
				}
				timeToAffect -= num;
				if (timeToAffect < 0f)
				{
					timeToAffect = Random.Range(1, 40);
					CameraGlitch.Instance.PlayLong();
					object[] array = new object[2]
					{
						selectedString,
						((Component)PlayerAvatar.instance).GetComponent<PhotonView>().ViewID
					};
					RaiseEventOptions val = new RaiseEventOptions
					{
						Receivers = (ReceiverGroup)2
					};
					SendOptions val2 = default(SendOptions);
					((SendOptions)(ref val2)).Reliability = true;
					SendOptions val3 = val2;
					PhotonNetwork.RaiseEvent((byte)1, (object)array, val, val3);
				}
			}
		}

		public void OnEvent(EventData photonEvent)
		{
			if (photonEvent.Code != 1)
			{
				return;
			}
			object[] array = (object[])photonEvent.CustomData;
			string currentEvent = (string)array[0];
			int num = (int)array[1];
			PhotonView obj = PhotonView.Find(num);
			GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
			if (!((Object)(object)val == (Object)null))
			{
				PlayerAvatar component = val.GetComponent<PlayerAvatar>();
				if (!((Object)(object)component == (Object)null))
				{
					AffectEvent(currentEvent, component);
				}
			}
		}

		[PunRPC]
		public void AffectEventRPC(string currentEvent, int playerViewID)
		{
			GameObject gameObject = ((Component)PhotonView.Find(playerViewID)).gameObject;
			PlayerAvatar component = gameObject.GetComponent<PlayerAvatar>();
			AffectEvent(currentEvent, component);
		}

		public void AffectEvent(string currentEvent, PlayerAvatar instance)
		{
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: 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_0544: Unknown result type (might be due to invalid IL or missing references)
			string text = selectedString;
			selectedString = currentEvent;
			FieldInfo fieldInfo = AccessTools.Field(typeof(HealthUI), "playerHealthValue");
			float num = Time.deltaTime / 50f * (float)(int)fieldInfo.GetValue(HealthUI.instance);
			if (EventActive("cameraGlitch") && (Object)(object)CameraGlitch.Instance != (Object)null)
			{
				GetNewEvent();
			}
			if (EventActive("spawnTrophy"))
			{
				SpawnItem("trophy", 0f, decreaseValue: true, 100f);
			}
			if (EventActive("spawnItem"))
			{
				List<string> list = new List<string>();
				list.Add("stungun");
				list.Add("clown");
				SpawnItem(list[Random.Range(0, list.Count)], 1f, decreaseValue: true, 6f, instance);
			}
			if (EventActive("shotgun"))
			{
				for (int i = 0; i < Random.Range(1, 2); i++)
				{
					SpawnItem("shotgun", 2f, decreaseValue: false, 6f, instance);
				}
				EnemyDirector.instance.SetInvestigate(((Component)instance).transform.position, 10000f);
			}
			if (EventActive("literallyDie"))
			{
				((Component)instance).GetComponent<PlayerHealth>().Hurt(1000000, false, -1);
				((Component)instance).GetComponent<PlayerHealth>().Death();
			}
			if (EventActive("getHurt"))
			{
				((Component)instance).GetComponent<PlayerHealth>().Hurt(Random.Range(0, Mathf.Clamp((int)fieldInfo.GetValue(HealthUI.instance), 0, 50)), true, -1);
			}
			if (EventActive("moreMoney"))
			{
				StatsManager.instance.runStats["currency"] -= Random.Range(0, 6);
			}
			if (EventActive("stunPlayer"))
			{
				instance.tumble.TumbleRequest(true, false);
				instance.tumble.TumbleForce(new Vector3((float)Random.Range(1, 10), (float)Random.Range(1, 10), (float)Random.Range(1, 10)));
			}
			if (EventActive("superStun"))
			{
				instance.tumble.TumbleRequest(true, false);
				instance.tumble.TumbleForce(new Vector3((float)Random.Range(100000, 1000000), (float)Random.Range(100000, 1000000), (float)Random.Range(100000, 1000000)));
			}
			if (EventActive("enemiesInvestigate"))
			{
				EnemyDirector.instance.SetInvestigate(((Component)instance).transform.position, 10000f);
				Enemy[] array = Object.FindObjectsOfType<Enemy>();
				foreach (Enemy val in array)
				{
					val.SetChaseTarget(instance);
					val.SetChaseTimer();
				}
			}
			if (EventActive("spawnEnemy"))
			{
				EnemyDirector instance2 = EnemyDirector.instance;
				List<EnemySetup> list2 = new List<EnemySetup>();
				foreach (EnemySetup item2 in instance2.enemiesDifficulty1)
				{
					list2.Add(item2);
				}
				foreach (EnemySetup item3 in instance2.enemiesDifficulty2)
				{
					list2.Add(item3);
				}
				foreach (EnemySetup item4 in instance2.enemiesDifficulty3)
				{
					list2.Add(item4);
				}
				EnemySetup item = list2[Random.Range(0, list2.Count)];
				RunManager.instance.enemiesSpawned.Add(item);
				selectedString = "decreaseSpawnTime";
			}
			if (EventActive("decreaseSpawnTime"))
			{
				foreach (EnemyParent item5 in EnemyDirector.instance.enemiesSpawned)
				{
					if (item5.DespawnedTimer > 0f)
					{
						item5.DespawnedTimerSet(0f, false);
					}
				}
			}
			if (EventActive("explodeGrenades"))
			{
				ItemGrenade[] array2 = Object.FindObjectsOfType<ItemGrenade>();
				foreach (ItemGrenade val2 in array2)
				{
					((MonoBehaviour)val2).Invoke("TickStart", 0f);
				}
			}
			if (EventActive("shootGuns"))
			{
				ItemGun[] array3 = Object.FindObjectsOfType<ItemGun>();
				foreach (ItemGun val3 in array3)
				{
					val3.Shoot();
				}
			}
			if (EventActive("healMonsters"))
			{
				EnemyHealth[] array4 = Object.FindObjectsOfType<EnemyHealth>();
				foreach (EnemyHealth val4 in array4)
				{
					val4.Hurt(-25, Vector3.zero);
				}
			}
			if (EventActive("frogJump"))
			{
				FrogTrap[] array5 = Object.FindObjectsOfType<FrogTrap>();
				foreach (FrogTrap val5 in array5)
				{
					for (int num2 = 0; num2 < 10; num2++)
					{
						((MonoBehaviour)val5).Invoke("FrogJump", (float)num2);
					}
				}
				ToiletFun[] array6 = Object.FindObjectsOfType<ToiletFun>();
				foreach (ToiletFun val6 in array6)
				{
					for (int num4 = 0; num4 < 10; num4++)
					{
						((MonoBehaviour)val6).Invoke("Explosion", (float)num4);
					}
				}
			}
			selectedString = text;
		}

		private void OnGUI()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0065: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			string text = "REPOCAOS is working :3c";
			if (LastGamemode == 0)
			{
				text = "";
			}
			GUIStyle val = new GUIStyle();
			val.fontSize = 30;
			float num = 0.5f;
			num = Mathf.Clamp(num - Time.time + LastTime, 0f, 1f);
			val.normal.textColor = new Color(1f, 1f, 1f, num);
			float num2 = 10f;
			float num3 = 400f;
			float num4 = 30f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(num2, (float)Screen.height - num4 - num2, num3, num4);
			GUI.Label(val2, text, val);
			if (debug && !hideUI)
			{
				text = $"Current event: {selectedString}\nTime for new event: {timeToSelectNewEvent}\nTime to affect event: {timeToAffect}";
				val = new GUIStyle();
				val.fontSize = 16;
				val.normal.textColor = Color.white;
				num2 = 10f;
				num3 = 400f;
				num4 = 100f;
				((Rect)(ref val2))..ctor(num2, (float)Screen.height - num4 - num2 - 500f, num3, num4);
				GUI.Label(val2, text, val);
			}
		}

		public static void GetNewEvent()
		{
			selectedString = caosNames[Random.Range(0, caosNames.Count)];
		}

		public static bool EventActive(string name)
		{
			if (selectedString == name)
			{
				return true;
			}
			return false;
		}
	}
}