Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Insanity IL2CPP v1.1.0
Insanity-IL2Cpp.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Il2CppFishNet.Object; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Audio; using Il2CppScheduleOne.Building.Doors; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.FX; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.VoiceOver; using Insanity_IL2Cpp; using MelonLoader; using UnityEngine; using UnityEngine.AI; 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: MelonInfo(typeof(global::Insanity_IL2Cpp.Insanity_IL2Cpp), "Insanity-IL2Cpp", "1.1", "XOWithSauce", null)] [assembly: MelonColor] [assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Insanity-IL2Cpp")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Insanity-IL2Cpp")] [assembly: AssemblyTitle("Insanity-IL2Cpp")] [assembly: AssemblyVersion("1.0.0.0")] namespace Insanity_IL2Cpp; public static class BuildInfo { public const string Name = "Insanity-IL2Cpp"; public const string Description = "Nothing is real"; public const string Author = "XOWithSauce"; public const string Company = null; public const string Version = "1.1"; public const string DownloadLink = null; } public class Insanity_IL2Cpp : MelonMod { [CompilerGenerated] private sealed class <EventCoro>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NPC npc; public KeyValuePair<string, Vector3> kvPair; public Property property; public Insanity_IL2Cpp <>4__this; private int <ranEvents>5__1; private GameObject <knocking>5__2; private AudioSource <audioSource>5__3; private Exception <ex>5__4; private int <roll>5__5; private Vector3 <direction>5__6; private Exception <ex>5__7; private Light[] <propertyLights>5__8; private List<Color> <colors>5__9; private List<float> <intensiti>5__10; private Light[] <propertyLights2>5__11; private List<float> <intensities>5__12; private Vector3 <backward>5__13; private int <stepCount>5__14; private GameObject <footsteps>5__15; private AudioSource <audioSource>5__16; private float <volMax>5__17; private float <volMin>5__18; private int <>s__19; private Exception <ex>5__20; private Exception <ex>5__21; private Exception <ex>5__22; private Light[] <>s__23; private int <>s__24; private Light <l>5__25; private int <i>5__26; private Light[] <>s__27; private int <>s__28; private Light <l>5__29; private int <i>5__30; private Exception <ex>5__31; private int <i>5__32; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EventCoro>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <knocking>5__2 = null; <audioSource>5__3 = null; <ex>5__4 = null; <ex>5__7 = null; <propertyLights>5__8 = null; <colors>5__9 = null; <intensiti>5__10 = null; <propertyLights2>5__11 = null; <intensities>5__12 = null; <footsteps>5__15 = null; <audioSource>5__16 = null; <ex>5__20 = null; <ex>5__21 = null; <ex>5__22 = null; <>s__23 = null; <l>5__25 = null; <>s__27 = null; <l>5__29 = null; <ex>5__31 = null; <>1__state = -2; } private bool MoveNext() { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Expected O, but got Unknown //IL_098b: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Expected O, but got Unknown //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Expected O, but got Unknown //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Expected O, but got Unknown //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Expected O, but got Unknown //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0a58: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a68: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a92: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) Vector3 forward; switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (kvPair.Key.Contains("Door")) { if (Random.Range(0, 100) > 50) { npc.CanOpenDoors = true; } <knocking>5__2 = new GameObject("knockingSound"); <audioSource>5__3 = <knocking>5__2.AddComponent<AudioSource>(); <audioSource>5__3.clip = <>4__this.doorKnock.clip; <audioSource>5__3.spatialBlend = 1f; <audioSource>5__3.rolloffMode = (AudioRolloffMode)1; try { <knocking>5__2.transform.position = ((Component)npc).transform.position; } catch (Exception ex) { <ex>5__4 = ex; MelonLogger.Error((object)<ex>5__4); } <audioSource>5__3.Play(); <>2__current = (object)new WaitForSeconds(0.77f); <>1__state = 1; return true; } goto IL_022b; case 1: <>1__state = -1; <audioSource>5__3.pitch = Random.Range(0.7f, 1f); <audioSource>5__3.Play(); <>2__current = (object)new WaitForSeconds(Random.Range(0.9f, 1.6f)); <>1__state = 2; return true; case 2: <>1__state = -1; <audioSource>5__3.pitch = Random.Range(0.5f, 0.8f); <audioSource>5__3.volume = 0.8f; <audioSource>5__3.Play(); Object.Destroy((Object)(object)<knocking>5__2, <audioSource>5__3.clip.length); <knocking>5__2 = null; <audioSource>5__3 = null; goto IL_022b; case 3: <>1__state = -1; if (!<>4__this.registered) { return false; } if (<ranEvents>5__1 < 2) { <ranEvents>5__1++; if (!(Random.Range(0f, 1f) > 0.8f)) { try { if (((Component)npc).transform.position != kvPair.Value) { ((Component)npc).transform.position = kvPair.Value; } <direction>5__6 = ((Component)<>4__this.playerMain).transform.position - ((Component)npc).transform.position; <direction>5__6.y = 0f; ((Component)npc).transform.rotation = Quaternion.LookRotation(<direction>5__6); } catch (Exception ex) { <ex>5__7 = ex; MelonLogger.Error((object)<ex>5__7); } <roll>5__5 = Random.Range(0, 8); int num = <roll>5__5; <>s__19 = num; switch (<>s__19) { case 0: break; case 1: goto IL_0402; case 2: goto IL_0432; case 3: goto IL_0461; case 4: goto IL_0657; case 5: goto IL_07d3; case 6: goto IL_084b; case 7: goto IL_08e3; default: goto IL_0adb; } try { npc.PlayVO((EVOLineType)16); } catch (Exception ex) { <ex>5__20 = ex; MelonLogger.Error((object)<ex>5__20); } } goto IL_0237; } Singleton<MusicPlayer>.Instance.SetMusicDistorted(false, 5f); Singleton<MusicPlayer>.Instance.SetTrackEnabled("Schizo music", false); Singleton<AudioManager>.Instance.SetDistorted(false, 5f); Singleton<PostProcessingManager>.Instance.SaturationController.RemoveOverride("Schizophrenic"); NPCManager.NPCRegistry.Remove(npc); Object.Destroy((Object)(object)((Component)npc).gameObject); return false; case 4: <>1__state = -1; <colors>5__9.Add(<l>5__25.color); <intensiti>5__10.Add(<l>5__25.intensity); if (Random.Range(0f, 1f) > 0.5f) { <l>5__25.color = Color.red; } else { <l>5__25.intensity = 0.1f; } <l>5__25 = null; <>s__24++; goto IL_0564; case 5: <>1__state = -1; if (!<>4__this.registered) { return false; } <i>5__26 = 0; goto IL_0639; case 6: <>1__state = -1; <propertyLights>5__8[<i>5__26].color = <colors>5__9[<i>5__26]; <propertyLights>5__8[<i>5__26].intensity = <intensiti>5__10[<i>5__26]; <i>5__26++; goto IL_0639; case 7: <>1__state = -1; <intensities>5__12.Add(<l>5__29.intensity); <l>5__29.intensity = 0.1f; <l>5__29 = null; <>s__28++; goto IL_0706; case 8: <>1__state = -1; if (!<>4__this.registered) { return false; } <i>5__30 = 0; goto IL_07b8; case 9: <>1__state = -1; <propertyLights2>5__11[<i>5__30].intensity = <intensities>5__12[<i>5__30]; <i>5__30++; goto IL_07b8; case 10: { <>1__state = -1; <i>5__32++; goto IL_0ab6; } IL_0ab6: if (<i>5__32 < <stepCount>5__14) { if (!<>4__this.registered) { return false; } <audioSource>5__16.pitch = Random.Range(0.8f, 1f); <audioSource>5__16.volume = Random.Range(<volMin>5__18, <volMax>5__17); <volMax>5__17 -= 0.07f; <volMin>5__18 -= 0.07f; <audioSource>5__16.Play(); Transform transform = <footsteps>5__15.transform; transform.position += <backward>5__13 * 2f; <>2__current = (object)new WaitForSeconds(Random.Range(0.7f, 0.9f)); <>1__state = 10; return true; } Object.Destroy((Object)(object)<footsteps>5__15); goto IL_0237; IL_0402: try { npc.PlayVO((EVOLineType)15); } catch (Exception ex) { <ex>5__21 = ex; MelonLogger.Error((object)<ex>5__21); } goto IL_0237; IL_07b8: if (<i>5__30 < <propertyLights2>5__11.Length) { <>2__current = (object)new WaitForSeconds(0.005f); <>1__state = 9; return true; } goto IL_0237; IL_0237: <>2__current = (object)new WaitForSeconds(Random.Range(3f, 6f)); <>1__state = 3; return true; IL_0639: if (<i>5__26 < <propertyLights>5__8.Length) { <>2__current = (object)new WaitForSeconds(0.005f); <>1__state = 6; return true; } goto IL_0237; IL_084b: try { ((Component)npc).transform.rotation = Quaternion.LookRotation(((Component)<>4__this.playerMain).transform.position - ((Component)npc).transform.position); npc.Avatar.SetEmission(Color.red); npc.Avatar.Effects.SetEyeLightEmission(1f, Color.red, true); } catch (Exception ex) { <ex>5__31 = ex; MelonLogger.Error((object)<ex>5__31); } goto IL_0237; IL_022b: <ranEvents>5__1 = 0; goto IL_0237; IL_0432: try { npc.PlayVO((EVOLineType)12); } catch (Exception ex) { <ex>5__22 = ex; MelonLogger.Error((object)<ex>5__22); } goto IL_0237; IL_07d3: if (Random.Range(0, 100) <= 10 && !Singleton<MusicPlayer>.Instance.IsPlaying) { Singleton<MusicPlayer>.Instance.SetMusicDistorted(true, 5f); Singleton<MusicPlayer>.Instance.SetTrackEnabled("Schizo music", true); Singleton<AudioManager>.Instance.SetDistorted(true, 5f); Singleton<PostProcessingManager>.Instance.SaturationController.AddOverride(110f, 7, "Schizophrenic"); } goto IL_0237; IL_0657: <propertyLights2>5__11 = Il2CppArrayBase<Light>.op_Implicit(((Component)((Component)property).transform).GetComponentsInChildren<Light>(true)); <intensities>5__12 = new List<float>(); <>s__27 = <propertyLights2>5__11; <>s__28 = 0; goto IL_0706; IL_0706: if (<>s__28 < <>s__27.Length) { <l>5__29 = <>s__27[<>s__28]; <>2__current = (object)new WaitForSeconds(0.005f); <>1__state = 7; return true; } <>s__27 = null; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 8; return true; IL_0461: <propertyLights>5__8 = Il2CppArrayBase<Light>.op_Implicit(((Component)((Component)property).transform).GetComponentsInChildren<Light>(true)); <colors>5__9 = new List<Color>(); <intensiti>5__10 = new List<float>(); <>s__23 = <propertyLights>5__8; <>s__24 = 0; goto IL_0564; IL_0564: if (<>s__24 < <>s__23.Length) { <l>5__25 = <>s__23[<>s__24]; <>2__current = (object)new WaitForSeconds(0.005f); <>1__state = 4; return true; } <>s__23 = null; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 5; return true; IL_0adb: <propertyLights>5__8 = null; <colors>5__9 = null; <intensiti>5__10 = null; <propertyLights2>5__11 = null; <intensities>5__12 = null; <footsteps>5__15 = null; <audioSource>5__16 = null; goto IL_0237; IL_08e3: forward = ((Component)<>4__this.playerMain).transform.forward; <backward>5__13 = -((Vector3)(ref forward)).normalized; <stepCount>5__14 = Random.Range(5, 9); <footsteps>5__15 = new GameObject("stepSounds"); <audioSource>5__16 = <footsteps>5__15.AddComponent<AudioSource>(); <audioSource>5__16.clip = <>4__this.footSteps; <audioSource>5__16.spatialBlend = 1f; <audioSource>5__16.rolloffMode = (AudioRolloffMode)1; <footsteps>5__15.transform.position = ((Component)<>4__this.playerMain).transform.position + <backward>5__13 * 2f; <volMax>5__17 = 0.8f; <volMin>5__18 = 0.7f; <i>5__32 = 0; goto IL_0ab6; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MoveAlongPath>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NPC npc; public List<Vector3> path; public float durationPerSegment; public Insanity_IL2Cpp <>4__this; private Exception <ex>5__1; private int <i>5__2; private Vector3 <start>5__3; private Vector3 <end>5__4; private float <elapsed>5__5; private float <t>5__6; private Vector3 <direction>5__7; private Exception <ex>5__8; private Vector3 <direction>5__9; private Exception <ex>5__10; private Exception <ex>5__11; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MoveAlongPath>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <ex>5__1 = null; <ex>5__8 = null; <ex>5__10 = null; <ex>5__11 = null; <>1__state = -2; } private bool MoveNext() { //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0120: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (path == null || path.Count < 2) { return false; } try { npc.Avatar.Effects.SetSicklySkinColor(true); npc.Avatar.Effects.SetZombified(true, true); npc.Avatar.EmotionManager.AddEmotionOverride("Zombie", "deal_rejected", 30f, 0); } catch (Exception ex) { <ex>5__1 = ex; MelonLogger.Error((object)<ex>5__1); } <i>5__2 = 0; goto IL_0327; case 1: <>1__state = -1; if (!<>4__this.registered) { return false; } <elapsed>5__5 += Time.deltaTime; <t>5__6 = Mathf.Clamp01(<elapsed>5__5 / durationPerSegment); try { ((Component)npc).transform.position = Vector3.Lerp(<start>5__3, <end>5__4, <t>5__6); <direction>5__7 = ((Component)<>4__this.playerMain).transform.position - ((Component)npc).transform.position; <direction>5__7.y = 0f; ((Component)npc).transform.rotation = Quaternion.LookRotation(<direction>5__7); } catch (Exception ex) { <ex>5__8 = ex; MelonLogger.Error((object)<ex>5__8); } goto IL_020f; case 2: { <>1__state = -1; try { NPCManager.NPCRegistry.Remove(npc); Object.Destroy((Object)(object)((Component)npc).gameObject); } catch (Exception ex) { <ex>5__11 = ex; MelonLogger.Error((object)<ex>5__11); } <i>5__2++; goto IL_0327; } IL_0327: if (<i>5__2 < path.Count - 1) { <start>5__3 = path[<i>5__2]; <end>5__4 = path[<i>5__2 + 1]; <elapsed>5__5 = 0f; goto IL_020f; } return false; IL_020f: if (<elapsed>5__5 < durationPerSegment) { <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 1; return true; } try { ((Component)npc).transform.position = <end>5__4; <direction>5__9 = ((Component)<>4__this.playerMain).transform.position - ((Component)npc).transform.position; <direction>5__9.y = 0f; ((Component)npc).transform.rotation = Quaternion.LookRotation(<direction>5__9); } catch (Exception ex) { <ex>5__10 = ex; MelonLogger.Error((object)<ex>5__10); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RunInsanity>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Insanity_IL2Cpp <>4__this; private int <currTime>5__1; private EDay <currentDay>5__2; private EDay <updatedDay>5__3; private int <updatedTime>5__4; private string <characterId>5__5; private Dictionary<string, Vector3> <positions>5__6; private int <roll>5__7; private KeyValuePair<string, Vector3> <kvpair>5__8; private NPC <spawnedNpc>5__9; private string <characterId>5__10; private Dictionary<string, List<Vector3>> <positions>5__11; private KeyValuePair<string, List<Vector3>> <kvpair>5__12; private KeyValuePair<string, Vector3> <kvStart>5__13; private NPC <spawnedNpc>5__14; private Dictionary<string, Vector3> <positions>5__15; private int <roll>5__16; private KeyValuePair<string, Vector3> <kvpair>5__17; private NPC <spawnedNpc>5__18; private Property <property>5__19; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RunInsanity>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <characterId>5__5 = null; <positions>5__6 = null; <kvpair>5__8 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__9 = null; <characterId>5__10 = null; <positions>5__11 = null; <kvpair>5__12 = default(KeyValuePair<string, List<Vector3>>); <kvStart>5__13 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__14 = null; <positions>5__15 = null; <kvpair>5__17 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__18 = null; <property>5__19 = null; <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_006a: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0393: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(10f); <>1__state = 1; return true; case 1: <>1__state = -1; goto IL_0059; case 2: <>1__state = -1; if (!<>4__this.registered) { return false; } <currTime>5__1 = NetworkSingleton<TimeManager>.Instance.CurrentTime; <currentDay>5__2 = NetworkSingleton<TimeManager>.Instance.CurrentDay; if (<currTime>5__1 > 2000) { goto IL_00c8; } goto IL_0059; case 3: { <>1__state = -1; if (!<>4__this.registered) { return false; } <updatedDay>5__3 = NetworkSingleton<TimeManager>.Instance.CurrentDay; <updatedTime>5__4 = NetworkSingleton<TimeManager>.Instance.CurrentTime; if (<currentDay>5__2 != <updatedDay>5__3 && <updatedTime>5__4 > 500) { goto IL_0059; } if ((Object)(object)<>4__this.playerMain.CurrentProperty != (Object)null && <>4__this.CharacterLocations.ContainsKey(<>4__this.playerMain.CurrentProperty.PropertyName)) { <characterId>5__5 = <>4__this.npcIds[Random.Range(0, <>4__this.npcIds.Count)]; <>4__this.CharacterLocations.TryGetValue(<>4__this.playerMain.CurrentProperty.PropertyName, out <positions>5__6); <roll>5__7 = Random.Range(0, <positions>5__6.Count); <kvpair>5__8 = <positions>5__6.ElementAt(<roll>5__7); <spawnedNpc>5__9 = <>4__this.SpawnAndInitializeNPC(<characterId>5__5, <kvpair>5__8); if ((Object)(object)<spawnedNpc>5__9 != (Object)null) { MelonCoroutines.Start(<>4__this.EventCoro(<spawnedNpc>5__9, <kvpair>5__8, <>4__this.playerMain.CurrentProperty)); } <characterId>5__5 = null; <positions>5__6 = null; <kvpair>5__8 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__9 = null; } if ((Object)(object)<>4__this.playerMain.CurrentBusiness != (Object)null) { <characterId>5__10 = <>4__this.npcIds[Random.Range(0, <>4__this.npcIds.Count)]; if (<>4__this.CharacterSpecials.ContainsKey(((Property)<>4__this.playerMain.CurrentBusiness).PropertyName) && Random.Range(0f, 1f) > 0.8f) { <>4__this.CharacterSpecials.TryGetValue(((Property)<>4__this.playerMain.CurrentBusiness).PropertyName, out <positions>5__11); <kvpair>5__12 = <positions>5__11.ElementAt(0); <kvStart>5__13 = new KeyValuePair<string, Vector3>(<kvpair>5__12.Key, <kvpair>5__12.Value[0]); <spawnedNpc>5__14 = <>4__this.SpawnAndInitializeNPC(<characterId>5__10, <kvStart>5__13); if ((Object)(object)<spawnedNpc>5__14 != (Object)null) { MelonCoroutines.Start(<>4__this.MoveAlongPath(<spawnedNpc>5__14, <kvpair>5__12.Value, 5f)); } <positions>5__11 = null; <kvpair>5__12 = default(KeyValuePair<string, List<Vector3>>); <kvStart>5__13 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__14 = null; } else if (<>4__this.CharacterLocations.ContainsKey(((Property)<>4__this.playerMain.CurrentBusiness).PropertyName)) { <>4__this.CharacterLocations.TryGetValue(((Property)<>4__this.playerMain.CurrentBusiness).PropertyName, out <positions>5__15); <roll>5__16 = Random.Range(0, <positions>5__15.Count); <kvpair>5__17 = <positions>5__15.ElementAt(<roll>5__16); <spawnedNpc>5__18 = <>4__this.SpawnAndInitializeNPC(<characterId>5__10, <kvpair>5__17); if ((Object)(object)<spawnedNpc>5__18 != (Object)null) { <property>5__19 = (Property)(object)<>4__this.playerMain.CurrentBusiness; MelonCoroutines.Start(<>4__this.EventCoro(<spawnedNpc>5__18, <kvpair>5__17, <property>5__19)); <property>5__19 = null; } <positions>5__15 = null; <kvpair>5__17 = default(KeyValuePair<string, Vector3>); <spawnedNpc>5__18 = null; } <characterId>5__10 = null; } goto IL_00c8; } IL_00c8: <>2__current = (object)new WaitForSeconds(Random.Range(25f, 45f)); <>1__state = 3; return true; IL_0059: <>2__current = (object)new WaitForSeconds(30f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <Setup>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Insanity_IL2Cpp <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Setup>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.playerMain = Object.FindObjectOfType<Player>(true); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.doorKnock = Object.FindObjectOfType<DoorKnocker>(true).KnockingSound; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.footSteps = Object.FindObjectOfType<FootstepSounds>(true).soundGroups[0].clips[0]; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 4; return true; case 4: <>1__state = -1; coros.Add(MelonCoroutines.Start(<>4__this.RunInsanity())); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List<object> coros = new List<object>(); private bool registered = false; private Player playerMain; private AudioSource doorKnock; private AudioClip footSteps; public List<string> npcIds = new List<string> { "ming", "jessi_waters" }; public Dictionary<string, Dictionary<string, Vector3>> CharacterLocations = new Dictionary<string, Dictionary<string, Vector3>> { { "Motel Room", new Dictionary<string, Vector3> { { "MotelWindow", new Vector3(-67.4f, 1.3f, 86f) }, { "MotelDoor", new Vector3(-67.04f, 1.3f, 82.6f) } } }, { "Sweatshop", new Dictionary<string, Vector3> { { "SweatWindowMain", new Vector3(-55.16f, 0.3f, 140.1f) }, { "SweatDoor", new Vector3(-64.29f, -0.4f, 141.84f) }, { "SweatStreet1", new Vector3(-57.23f, -3.4f, 123.22f) }, { "SweatHighCorner", new Vector3(-56.18f, 0.3f, 115.25f) } } }, { "Bungalow", new Dictionary<string, Vector3> { { "BungalowDoorMain", new Vector3(-169.18f, -3.7f, 113.82f) }, { "BungalowDoorBack", new Vector3(-176.87f, -3.7f, 110.26f) }, { "BungalowWindowKitchen1", new Vector3(-176.77f, -3.6f, 118.66f) } } }, { "Barn", new Dictionary<string, Vector3> { { "BarnUnderStairs", new Vector3(200.8111f, 0.1f, -10.9124f) }, { "BarnFloating", new Vector3(187.9814f, 3.8f, -13.52317f) }, { "BarnWoods", new Vector3(174.0903f, -0.1f, 3.852638f) }, { "BarnRoad", new Vector3(159.279f, -0.2f, -12.15506f) } } }, { "Docks Warehouse", new Dictionary<string, Vector3> { { "DocksOutCorner", new Vector3(-83.82198f, -2.1f, -35.59542f) }, { "DocksOnPillar", new Vector3(-88.41868f, 0.5f, -61.17904f) }, { "DocksOnRoof", new Vector3(-47.33374f, 4.1f, -68.83347f) } } }, { "Taco Ticklers", new Dictionary<string, Vector3> { { "TacoCan", new Vector3(-27.67904f, 0.23f, 75.21258f) }, { "TacoBackDoor", new Vector3(-31.239f, 0.23f, 84.10281f) }, { "TacoFrontWindow", new Vector3(-26.84878f, 0.23f, 63.86666f) }, { "TacoRunToStaff", new Vector3(-34.48309f, 0.23f, 76.22535f) } } }, { "Laundromat", new Dictionary<string, Vector3> { { "LaundromatDoor", new Vector3(-23.53883f, 0.3f, 24.97166f) }, { "LaundromatCreep", new Vector3(-24.18913f, 0.6f, 23.33677f) }, { "LaundromatBoxes", new Vector3(-10.6364f, 0.8f, 27.53411f) } } }, { "Car Wash", new Dictionary<string, Vector3> { { "CarWashBusStop", new Vector3(-23.94017f, 0.2f, -24.21171f) }, { "CarWashBackDoor", new Vector3(-3.334698f, 0.35f, -22.07097f) }, { "CarWashRunToWindow", new Vector3(-6.237535f, 0.35f, -15.59119f) } } }, { "Post Office", new Dictionary<string, Vector3> { { "PostOfficeWindow1", new Vector3(52.59536f, 0.3f, -1.74566f) }, { "PostOfficeWindow2", new Vector3(42.58666f, 0.3f, -1.472795f) }, { "PostOfficeBack", new Vector3(45.09676f, 0.2f, -8.674371f) }, { "PostOfficeStreet", new Vector3(41.80392f, 0.2f, 8.459332f) } } } }; public Dictionary<string, Dictionary<string, List<Vector3>>> CharacterSpecials = new Dictionary<string, Dictionary<string, List<Vector3>>> { { "Taco Ticklers", new Dictionary<string, List<Vector3>> { { "TacoRunToStaff", new List<Vector3> { new Vector3(-34.48309f, 0.23f, 76.22535f), new Vector3(-34.48309f, 0.23f, 79.53841f) } } } }, { "Car Wash", new Dictionary<string, List<Vector3>> { { "CarWashRunToWindow", new List<Vector3> { new Vector3(-9.058268f, 0.35f, -10.47236f), new Vector3(-6.237535f, 0.35f, -15.59119f) } } } } }; private void OnLoadCompleteCb() { if (!registered) { coros.Add(MelonCoroutines.Start(Setup())); registered = true; } } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (buildIndex == 1) { if ((Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered) { Singleton<LoadManager>.Instance.onLoadComplete.AddListener(UnityAction.op_Implicit((Action)OnLoadCompleteCb)); } return; } if ((Object)(object)Singleton<LoadManager>.Instance != (Object)null && registered) { Singleton<LoadManager>.Instance.onLoadComplete.RemoveListener(UnityAction.op_Implicit((Action)OnLoadCompleteCb)); } registered = false; foreach (object coro in coros) { MelonCoroutines.Stop(coro); } coros.Clear(); } [IteratorStateMachine(typeof(<Setup>d__10))] public IEnumerator Setup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Setup>d__10(0) { <>4__this = this }; } private NPC SpawnAndInitializeNPC(string characterId, KeyValuePair<string, Vector3> kvp) { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) NPC nPC = NPCManager.GetNPC(characterId); GameObject val = Object.Instantiate<GameObject>(((Component)nPC).gameObject, NetworkSingleton<NPCManager>.Instance.NPCContainer); if ((Object)(object)val == (Object)null) { return null; } NPC component = val.GetComponent<NPC>(); string iD = "test_" + characterId + "_" + Guid.NewGuid().ToString().Substring(0, 8); component.ID = iD; component.FirstName = ""; component.LastName = ""; NavMeshAgent component2 = ((Component)component).GetComponent<NavMeshAgent>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } Rigidbody component3 = ((Component)component).GetComponent<Rigidbody>(); if ((Object)(object)component3 != (Object)null) { Object.Destroy((Object)(object)component3); } NetworkObject component4 = ((Component)component).GetComponent<NetworkObject>(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = false; } ((Behaviour)component.behaviour).enabled = false; component.CanOpenDoors = false; ((Behaviour)component.Movement).enabled = false; component.PlayerConversant = ((NetworkBehaviour)playerMain).NetworkObject; val.SetActive(true); component.SetVisible(true); component.Avatar.Effects.SetSicklySkinColor(true); component.Avatar.Effects.SetZombified(true, true); component.Avatar.EmotionManager.AddEmotionOverride("Zombie", "deal_rejected", 30f, 0); NPCManager.NPCRegistry.Add(component); val.transform.position = kvp.Value; Vector3 val2 = ((Component)playerMain).transform.position - ((Component)component).transform.position; val2.y = 0f; val.transform.rotation = Quaternion.LookRotation(val2); return component; } [IteratorStateMachine(typeof(<RunInsanity>d__12))] public IEnumerator RunInsanity() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RunInsanity>d__12(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<EventCoro>d__13))] private IEnumerator EventCoro(NPC npc, KeyValuePair<string, Vector3> kvPair, Property property) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EventCoro>d__13(0) { <>4__this = this, npc = npc, kvPair = kvPair, property = property }; } [IteratorStateMachine(typeof(<MoveAlongPath>d__14))] private IEnumerator MoveAlongPath(NPC npc, List<Vector3> path, float durationPerSegment) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MoveAlongPath>d__14(0) { <>4__this = this, npc = npc, path = path, durationPerSegment = durationPerSegment }; } }