using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using FishNet.Connection; using FishNet.Managing; using FishNet.Managing.Object; using FishNet.Object; using HarmonyLib; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using NACopsV1; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using ScheduleOne; using ScheduleOne.AvatarFramework; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.Building.Doors; using ScheduleOne.Combat; using ScheduleOne.Core.Items.Framework; using ScheduleOne.DevUtilities; using ScheduleOne.Doors; using ScheduleOne.Economy; using ScheduleOne.Employees; using ScheduleOne.EntityFramework; using ScheduleOne.GameTime; using ScheduleOne.ItemFramework; using ScheduleOne.Law; using ScheduleOne.Management; using ScheduleOne.Map; using ScheduleOne.Money; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Behaviour; using ScheduleOne.ObjectScripts; using ScheduleOne.Persistence; using ScheduleOne.PlayerScripts; using ScheduleOne.Police; using ScheduleOne.Product; using ScheduleOne.Property; using ScheduleOne.Quests; using ScheduleOne.Storage; using ScheduleOne.UI; using ScheduleOne.UI.Handover; using ScheduleOne.UI.MainMenu; using ScheduleOne.Vision; using ScheduleOne.VoiceOver; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(NACops), "NACopsV1", "2.0.2", "XOWithSauce", null)] [assembly: MelonColor] [assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("XOWithSauce")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright XOWithSauce 2026 Source MIT")] [assembly: AssemblyDescription("Schedule I NACops Mod")] [assembly: AssemblyFileVersion("2.0.2.0")] [assembly: AssemblyInformationalVersion("2.0.2")] [assembly: AssemblyProduct("NACops")] [assembly: AssemblyTitle("NACopsV1")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/XOWithSauce/schedule-nacops")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 NACopsV1 { public class FootPatrolGenerator { public static Dictionary> generatedPatrolInstances = new Dictionary>(); public static ConfigLoader.FootPatrolsSerialized serPatrols; public static PatrolInstance[] GeneratePatrol(LawActivitySettings template, string day = "") { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (generatedPatrolInstances.Count == 0) { DebugModule.Log("Generating new patrol routes", "GeneratePatrol"); Transform parent = ((Component)Singleton.Instance).transform.Find("PatrolRoutes"); if (serPatrols == null) { serPatrols = ConfigLoader.LoadPatrolsConfig(); } foreach (SerializedFootPatrol loadedPatrol in serPatrols.loadedPatrols) { GameObject val = new GameObject(loadedPatrol.name); DebugModule.Log("Generate object for patrol: " + loadedPatrol.name, "GeneratePatrol"); DebugModule.Log("- Days: " + string.Join(" ", loadedPatrol.days), "GeneratePatrol"); FootPatrolRoute val2 = val.AddComponent(); ((Object)val2).name = loadedPatrol.name; val2.StartWaypointIndex = 0; Transform[] array = (Transform[])(object)new Transform[loadedPatrol.waypoints.Count]; for (int i = 0; i < loadedPatrol.waypoints.Count; i++) { GameObject val3 = new GameObject((i == 0) ? "Waypoint" : $"Waypoint ({i})"); val3.transform.position = loadedPatrol.waypoints[i]; val3.transform.parent = val.transform; array[i] = val3.transform; } val2.Waypoints = array; val.transform.parent = parent; PatrolInstance val4 = new PatrolInstance(); val4.StartTime = loadedPatrol.startTime; val4.EndTime = loadedPatrol.endTime; val4.Members = loadedPatrol.members; val4.Route = val2; val4.OnlyIfCurfewEnabled = loadedPatrol.onlyIfCurfew; val4.IntensityRequirement = loadedPatrol.intensityRequirement; val.transform.parent = parent; val.SetActive(true); generatedPatrolInstances.Add(val4, loadedPatrol.days); } } if (day == "") { int num = template.Patrols.Length; int count = generatedPatrolInstances.Count; int num2 = num + count; PatrolInstance[] array2 = (PatrolInstance[])(object)new PatrolInstance[num2]; Array.Copy(template.Patrols, array2, num); int num3 = num; foreach (KeyValuePair> generatedPatrolInstance in generatedPatrolInstances) { if (num3 >= num2) { break; } array2[num3] = generatedPatrolInstance.Key; num3++; } return array2; } int num4 = template.Patrols.Length; int num5 = 0; foreach (KeyValuePair> generatedPatrolInstance2 in generatedPatrolInstances) { if (generatedPatrolInstance2.Value.Contains(day)) { num5++; } } if (num5 == 0) { return template.Patrols; } int num6 = num4 + num5; PatrolInstance[] array3 = (PatrolInstance[])(object)new PatrolInstance[num6]; Array.Copy(template.Patrols, array3, num4); int num7 = num4; foreach (KeyValuePair> generatedPatrolInstance3 in generatedPatrolInstances) { if (num7 >= num6) { break; } if (generatedPatrolInstance3.Value.Contains(day)) { array3[num7] = generatedPatrolInstance3.Key; num7++; } } DebugModule.Log($" {day}: Added {num5} patrols ({num4} -> {num6})", "GeneratePatrol"); return array3; } } [Serializable] public class SerializedFootPatrol { public int startTime = 1900; public int endTime = 500; public int members = 1; public int intensityRequirement = 1; public bool onlyIfCurfew; public string name = "NACops Extra Loop"; public List days; public List waypoints = new List(); } public class SentryGenerator { public static Dictionary> generatedSentryInstances = new Dictionary>(); public static ConfigLoader.SentrysSerialized serSentries; public static SentryInstance[] GenerateSentry(LawActivitySettings template, string day = "") { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown if (generatedSentryInstances.Count == 0) { DebugModule.Log("Generating new sentry spots", "GenerateSentry"); Transform val = ((Component)Singleton.Instance).transform.Find("Sentry Locations"); if ((Object)(object)val == (Object)null) { DebugModule.Log(" Sentry Locations transform is null", "GenerateSentry"); } DebugModule.Log(" Load Sentry Config", "GenerateSentry"); if (serSentries == null) { serSentries = ConfigLoader.LoadSentryConfig(); } DebugModule.Log(" Loaded Patrols config count: " + serSentries.loadedSentrys.Count, "GenerateSentry"); foreach (SerializedSentry loadedSentry in serSentries.loadedSentrys) { GameObject val2 = new GameObject(loadedSentry.name); DebugModule.Log("Generate object for patrol: " + loadedSentry.name, "GenerateSentry"); DebugModule.Log("- Days: " + string.Join(" ", loadedSentry.days), "GenerateSentry"); SentryLocation val3 = val2.AddComponent(); val3.Routes = new List(); SentryRoute val4 = new SentryRoute(); GameObject val5 = new GameObject("Stand point"); val5.transform.parent = val2.transform; val5.transform.SetPositionAndRotation(loadedSentry.standPosition1, Quaternion.Euler(loadedSentry.pos1Rotation)); GameObject val6 = new GameObject("Stand point (1)"); val6.transform.parent = val2.transform; val6.transform.SetPositionAndRotation(loadedSentry.standPosition2, Quaternion.Euler(loadedSentry.pos2Rotation)); val4.RoutePoints = (Transform[])(object)new Transform[2] { val5.transform, val6.transform }; val4.MinutesPerPoint = 60; val3.Routes.Add(val4); ((Component)val3).gameObject.SetActive(true); SentryInstance val7 = new SentryInstance(); val7.StartTime = loadedSentry.startTime; val7.EndTime = loadedSentry.endTime; val7.Members = loadedSentry.members; val7._potentialLocations = (SentryLocation[])(object)new SentryLocation[1] { val3 }; val7.OnlyIfCurfewEnabled = loadedSentry.onlyIfCurfew; val7.IntensityRequirement = loadedSentry.intensityRequirement; val2.transform.parent = val; val2.SetActive(true); generatedSentryInstances.Add(val7, loadedSentry.days); } } if (day == "") { int num = template.Sentries.Length; int count = generatedSentryInstances.Count; int num2 = num + count; SentryInstance[] array = (SentryInstance[])(object)new SentryInstance[num2]; Array.Copy(template.Sentries, array, num); int num3 = num; foreach (KeyValuePair> generatedSentryInstance in generatedSentryInstances) { if (num3 >= num2) { break; } array[num3] = generatedSentryInstance.Key; num3++; } return array; } int num4 = template.Sentries.Length; int num5 = 0; foreach (KeyValuePair> generatedSentryInstance2 in generatedSentryInstances) { if (generatedSentryInstance2.Value.Contains(day)) { num5++; } } if (num5 == 0) { return template.Sentries; } int num6 = num4 + num5; SentryInstance[] array2 = (SentryInstance[])(object)new SentryInstance[num6]; Array.Copy(template.Sentries, array2, num4); int num7 = num4; foreach (KeyValuePair> generatedSentryInstance3 in generatedSentryInstances) { if (num7 >= num6) { break; } if (generatedSentryInstance3.Value.Contains(day)) { array2[num7] = generatedSentryInstance3.Key; num7++; } } DebugModule.Log($" {day}: Added {num5} sentries ({num4} -> {num6})", "GenerateSentry"); return array2; } } [Serializable] public class SerializedSentry { public int startTime = 1900; public int endTime = 500; public int members = 1; public int intensityRequirement = 1; public bool onlyIfCurfew; public string name; public List days; public Vector3 standPosition1; public Vector3 pos1Rotation; public Vector3 standPosition2; public Vector3 pos2Rotation; } public class VehiclePatrolGenerator { public static Dictionary> generatedVehiclePatrolInstances = new Dictionary>(); public static ConfigLoader.VehiclePatrolsSerialized serVehiclePatrols; public static VehiclePatrolInstance[] GenerateVehiclePatrol(LawActivitySettings template, string day = "") { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (generatedVehiclePatrolInstances.Count == 0) { DebugModule.Log("Generating new vehicle patrol routes", "GenerateVehiclePatrol"); Transform parent = ((Component)Singleton.Instance).transform.Find("VehiclePatrolRoutes"); if (serVehiclePatrols == null) { serVehiclePatrols = ConfigLoader.LoadVehiclePatrolsConfig(); } foreach (SerializedVehiclePatrol loadedVehiclePatrol in serVehiclePatrols.loadedVehiclePatrols) { GameObject val = new GameObject(loadedVehiclePatrol.name); DebugModule.Log("Generate object for patrol: " + loadedVehiclePatrol.name, "GenerateVehiclePatrol"); DebugModule.Log("- Days: " + string.Join(" ", loadedVehiclePatrol.days), "GenerateVehiclePatrol"); VehiclePatrolRoute val2 = val.AddComponent(); ((Object)val2).name = loadedVehiclePatrol.name; val2.StartWaypointIndex = 0; Transform[] array = (Transform[])(object)new Transform[loadedVehiclePatrol.waypoints.Count]; for (int i = 0; i < loadedVehiclePatrol.waypoints.Count; i++) { GameObject val3 = new GameObject((i == 0) ? "Waypoint" : $"Waypoint ({i})"); val3.transform.position = loadedVehiclePatrol.waypoints[i]; val3.transform.parent = val.transform; array[i] = val3.transform; } val2.Waypoints = array; val.transform.parent = parent; VehiclePatrolInstance val4 = new VehiclePatrolInstance(); val4.StartTime = loadedVehiclePatrol.startTime; val4.Route = val2; val4.IntensityRequirement = loadedVehiclePatrol.intensityRequirement; val4.OnlyIfCurfewEnabled = loadedVehiclePatrol.onlyIfCurfew; val.transform.parent = parent; val.SetActive(true); generatedVehiclePatrolInstances.Add(val4, loadedVehiclePatrol.days); } } if (day == "") { int num = template.VehiclePatrols.Length; int count = generatedVehiclePatrolInstances.Count; int num2 = num + count; VehiclePatrolInstance[] array2 = (VehiclePatrolInstance[])(object)new VehiclePatrolInstance[num2]; Array.Copy(template.VehiclePatrols, array2, num); int num3 = num; foreach (KeyValuePair> generatedVehiclePatrolInstance in generatedVehiclePatrolInstances) { if (num3 >= num2) { break; } array2[num3] = generatedVehiclePatrolInstance.Key; num3++; } return array2; } int num4 = template.VehiclePatrols.Length; int num5 = 0; foreach (KeyValuePair> generatedVehiclePatrolInstance2 in generatedVehiclePatrolInstances) { if (generatedVehiclePatrolInstance2.Value.Contains(day)) { num5++; } } if (num5 == 0) { return template.VehiclePatrols; } int num6 = num4 + num5; VehiclePatrolInstance[] array3 = (VehiclePatrolInstance[])(object)new VehiclePatrolInstance[num6]; Array.Copy(template.VehiclePatrols, array3, num4); int num7 = num4; foreach (KeyValuePair> generatedVehiclePatrolInstance3 in generatedVehiclePatrolInstances) { if (num7 >= num6) { break; } if (generatedVehiclePatrolInstance3.Value.Contains(day)) { array3[num7] = generatedVehiclePatrolInstance3.Key; num7++; } } DebugModule.Log($" {day}: Added {num5} vehicle patrols ({num4} -> {num6})", "GenerateVehiclePatrol"); return array3; } } [Serializable] public class SerializedVehiclePatrol { public int startTime = 2300; public int intensityRequirement = 1; public bool onlyIfCurfew; public string name = "NACops Vehicle Extra Loop"; public List days; public List waypoints = new List(); } [HarmonyPatch(typeof(Customer), "ProcessHandover")] public static class Customer_ProcessHandover_Patch { [CompilerGenerated] private sealed class d__5 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer offc; public bool instant; public Player target; private int 5__2; private int 5__3; private NPC 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = NACops.Wait1; <>1__state = 1; return true; case 1: <>1__state = -1; if (!NACops.registered) { return false; } 5__2 = 0; 5__3 = 20; 5__4 = ((Component)((NetworkBehaviour)offc).NetworkObject).GetComponent(); if (instant || !((Object)(object)target != (Object)null) || !((Object)(object)5__4 != (Object)null)) { break; } goto IL_00cb; case 2: { <>1__state = -1; if (!NACops.registered) { return false; } goto IL_00cb; } IL_00cb: if (5__2 <= 5__3 || target.IsArrested || 5__4.Health.IsDead || 5__4.Health.IsKnockedOut) { 5__2++; <>2__current = NACops.Wait1; <>1__state = 2; return true; } break; } try { if (NACops.currentSummoned.Contains(offc)) { NACops.currentSummoned.Remove(offc); } if ((Object)(object)5__4 != (Object)null && NPCManager.NPCRegistry.Contains(5__4)) { NPCManager.NPCRegistry.Remove(5__4); } if ((Object)(object)5__4 != (Object)null && (Object)(object)((Component)5__4).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)5__4).gameObject); } } catch (Exception ex) { MelonLogger.Error((object)ex); } DebugModule.Log("Disposed summoned bustcop", "DisposeSummoned"); 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(); } } [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer offc; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (offc.PursuitBehaviour.arrestingEnabled) { offc.PursuitBehaviour.arrestingEnabled = false; } 5__3 += 0.1f; } else { <>1__state = -1; 5__2 = 8f; 5__3 = 0f; } if (!NACops.registered) { return false; } if (!(5__3 >= 5__2)) { <>2__current = NACops.Wait01; <>1__state = 1; return true; } offc.PursuitBehaviour.arrestingEnabled = true; 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(); } } [CompilerGenerated] private sealed class d__1 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public bool handoverByPlayer; public Customer __instance; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!handoverByPlayer) { return false; } if (NACops.currentConfig.BuyBusts) { NACops.coros.Add(MelonCoroutines.Start(SummonBustCop(__instance))); } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer offc; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; ((NPC)offc).Behaviour.CombatBehaviour.SetWeapon(((Object)(object)offc.TaserPrefab != (Object)null) ? offc.TaserPrefab.AssetPath : string.Empty); if ((Object)(object)((NPC)offc).Behaviour.CombatBehaviour.currentWeapon == (Object)null) { return false; } AvatarWeapon currentWeapon = ((NPC)offc).Behaviour.CombatBehaviour.currentWeapon; AvatarRangedWeapon val = (AvatarRangedWeapon)(object)((currentWeapon is AvatarRangedWeapon) ? currentWeapon : null); if ((Object)(object)val != (Object)null) { val.CanShootWhileMoving = true; val.MagazineSize = 20; val.MaxFireRate = 0.3f; ((AvatarWeapon)val).MaxUseRange = 24f; val.ReloadTime = 0.2f; val.RaiseTime = 0.1f; val.HitChance_MaxRange = 0.6f; val.HitChance_MinRange = 0.9f; ((AvatarWeapon)val).CooldownDuration = 0.3f; } <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer customer; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00ef: 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) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown if (<>1__state != 0) { return false; } <>1__state = -1; int value = Mathf.RoundToInt(customer.NPC.RelationData.RelationDelta * 10f); var (num, num2) = ThresholdUtils.Evaluate(NACops.thresholdConfig.BuyBustProbability, value); if (!NACops.currentConfig.DebugMode && Random.Range(num, num2) < 0.5f) { return false; } PoliceOfficer val = OfficerOverrides.SpawnOfficerRuntime(autoDeactivate: false); ((NPC)val).Movement.PauseMovement(); AvatarUtility.SetRandomAvatar(val); ((NPC)val).Behaviour.ScheduleManager.DisableSchedule(); NACops.currentSummoned.Add(val); Player val2 = null; Vector3 val3 = ((Component)customer).transform.position + ((Component)customer).transform.forward * 3f; Vector3 val4 = default(Vector3); if (((NPC)val).Movement.GetClosestReachablePoint(val3, ref val4) && val4 != Vector3.zero) { NACops.coros.Add(MelonCoroutines.Start(SetTaser(val))); ((NPC)val).Movement.Warp(val4); ((NPC)val).Movement.ResumeMovement(); Vector3 centerPoint = ((NPC)val).CenterPoint; DebugModule.Log("Drug bust officer spawned now at " + ((object)(Vector3)(ref centerPoint)).ToString(), "SummonBustCop"); ((VOEmitter)val.ChatterVO).Play((EVOLineType)2); ((NPC)val).Movement.FacePoint(((Component)customer).transform.position, 0.5f); float num3 = default(float); val2 = Player.GetClosestPlayer(val4, ref num3, (List)null); val2.CrimeData.SetPursuitLevel((EPursuitLevel)3); val.BeginFootPursuit(val2.PlayerCode); ((Behaviour)val.PursuitBehaviour).Enable_Networked(); NACops.coros.Add(MelonCoroutines.Start(LateEnableArrest(val))); val2.CrimeData.AddCrime((Crime)new AttemptingToSell(), 10); } else { DebugModule.Log("Failed to Get closest reachable position for drug bust", "SummonBustCop"); NACops.coros.Add(MelonCoroutines.Start(DisposeSummoned(val, instant: true, val2))); } NACops.coros.Add(MelonCoroutines.Start(DisposeSummoned(val, instant: false, val2))); 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(); } } [HarmonyPrefix] public static bool Prefix(Customer __instance, EHandoverOutcome outcome, Contract contract, List items, bool handoverByPlayer, bool giveBonuses = true) { NACops.coros.Add(MelonCoroutines.Start(PreProcessHandover(__instance, handoverByPlayer))); return true; } [IteratorStateMachine(typeof(d__1))] public static IEnumerator PreProcessHandover(Customer __instance, bool handoverByPlayer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { __instance = __instance, handoverByPlayer = handoverByPlayer }; } [IteratorStateMachine(typeof(d__2))] public static IEnumerator SummonBustCop(Customer customer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { customer = customer }; } [IteratorStateMachine(typeof(d__3))] public static IEnumerator LateEnableArrest(PoliceOfficer offc) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { offc = offc }; } [IteratorStateMachine(typeof(d__4))] public static IEnumerator SetTaser(PoliceOfficer offc) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { offc = offc }; } [IteratorStateMachine(typeof(d__5))] public static IEnumerator DisposeSummoned(PoliceOfficer offc, bool instant, Player target) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { offc = offc, instant = instant, target = target }; } } public class UnityContractResolver : DefaultContractResolver { protected override JsonObjectContract CreateObjectContract(Type objectType) { JsonObjectContract val = ((DefaultContractResolver)this).CreateObjectContract(objectType); if (objectType == typeof(Vector3)) { for (int num = ((Collection)(object)val.Properties).Count - 1; num >= 0; num--) { JsonProperty val2 = ((Collection)(object)val.Properties)[num]; if (val2.PropertyName == "normalized" || val2.PropertyName == "magnitude" || val2.PropertyName == "sqrMagnitude") { ((Collection)(object)val.Properties).RemoveAt(num); } } } return val; } } public static class ConfigLoader { [Serializable] public class ModConfig { public bool DebugMode; public bool RaidsEnabled = true; public bool ExtraOfficerPatrols = true; public bool ExtraVehiclePatrols = true; public bool ExtraOfficerSentries = true; public bool NoOpenCarryWeapons = true; public bool PrivateInvestigator = true; public bool WeedInvestigator = true; public bool CorruptCops = true; public bool SnitchingSamples = true; public bool BuyBusts = true; public bool NearbyCrazyCops = true; public bool LethalCops = true; public bool RacistCops; } [Serializable] public class NAOfficerConfig { public int ModAddedVehicleCount = 3; public int ModAddedOfficersCount = 8; public bool CanEnterBuildings = true; public bool OverrideArresting = true; public float ArrestTime = 1.25f; public float ArrestRange = 3.5f; public bool OverrideMovement = true; public float MovementSpeedMultiplier = 1.7f; public bool OverrideWeapon = true; public string WeaponPath = "Avatar/Equippables/M1911"; public float WeaponDamage = 46f; public int WeaponMagSize = 20; public float WeaponFireRate = 0.33f; public float WeaponMaxRange = 25f; public float WeaponReloadTime = 0.5f; public float WeaponRaiseTime = 0.2f; public float WeaponHitChanceMax = 0.3f; public float WeaponHitChanceMin = 0.8f; public bool OverrideMaxHealth = true; public float OfficerMaxHealth = 175f; public bool OverrideBodySearch = true; public float BodySearchDuration = 6f; public float BodySearchChance = 1f; public bool OverrideCombatBeh = true; public float CombatGiveUpRange = 40f; public float CombatGiveUpTime = 60f; public float CombatSearchTime = 60f; public float CombatMoveSpeed = 6.8f; public int CombatEndAfterHits = 40; } [Serializable] public class RaidConfig { public float TraverseToPropertySpeed = 0.47f; public float ClearPropertySpeed = 0.38f; public int MaxDestroyIters = 4; public int RaidCopsCount = 3; public int DaysUntilCanRaid = 8; public int PropertyHeatThreshold = 14; } [Serializable] public class FootPatrolsSerialized { public List loadedPatrols = new List(); } [Serializable] public class VehiclePatrolsSerialized { public List loadedVehiclePatrols = new List(); } [Serializable] public class SentrysSerialized { public List loadedSentrys = new List(); } private static string modConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "config.json"); private static string officerConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "officer.json"); private static string patrolsConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "Spawn", "patrols.json"); private static string sentrysConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "Spawn", "sentrys.json"); private static string vehiclePatrolsConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "Spawn", "vehiclepatrols.json"); private static string eventFrequencyConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "progression.json"); private static string raidConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "raid.json"); private static string propertyHeatConfig = Path.Combine(MelonEnvironment.ModsDirectory, "NACops", "HeatData"); public static ModConfig LoadModConfig() { ModConfig modConfig; if (File.Exists(ConfigLoader.modConfig)) { try { modConfig = JsonConvert.DeserializeObject(File.ReadAllText(ConfigLoader.modConfig)); } catch (Exception ex) { modConfig = new ModConfig(); MelonLogger.Warning("Failed to read NACops Mod config: " + ex); } } else { MelonLogger.Warning("Missing NACops Mod config, creating directory and template."); modConfig = new ModConfig(); Save(modConfig); } return modConfig; } public static void Save(ModConfig config) { try { string contents = JsonConvert.SerializeObject((object)config, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(modConfig)); File.WriteAllText(modConfig, contents); MelonLogger.Warning(" NACops Mod config, written to: " + modConfig); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Mod config: " + ex); } } public static NAOfficerConfig LoadOfficerConfig() { NAOfficerConfig nAOfficerConfig; if (File.Exists(officerConfig)) { try { nAOfficerConfig = JsonConvert.DeserializeObject(File.ReadAllText(officerConfig)); nAOfficerConfig.ModAddedOfficersCount = Mathf.Clamp(nAOfficerConfig.ModAddedOfficersCount, 0, 20); } catch (Exception ex) { nAOfficerConfig = new NAOfficerConfig(); MelonLogger.Warning("Failed to read NACops config: " + ex); } } else { MelonLogger.Warning("Missing NACops Officers config, creating directory and template."); nAOfficerConfig = new NAOfficerConfig(); Save(nAOfficerConfig); } return nAOfficerConfig; } public static void Save(NAOfficerConfig config) { try { string contents = JsonConvert.SerializeObject((object)config); Directory.CreateDirectory(Path.GetDirectoryName(officerConfig)); File.WriteAllText(officerConfig, contents); MelonLogger.Warning(" NACops Officers config, written to: " + officerConfig); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Officers config: " + ex); } } public static FootPatrolsSerialized LoadPatrolsConfig() { FootPatrolsSerialized footPatrolsSerialized; if (File.Exists(patrolsConfig)) { try { footPatrolsSerialized = JsonConvert.DeserializeObject(File.ReadAllText(patrolsConfig)); List list = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }; foreach (SerializedFootPatrol loadedPatrol in footPatrolsSerialized.loadedPatrols) { loadedPatrol.members = Mathf.Clamp(loadedPatrol.members, 1, 4); loadedPatrol.name = (string.IsNullOrEmpty(loadedPatrol.name) ? "NaCopsPatrol " : loadedPatrol.name); loadedPatrol.intensityRequirement = Mathf.Clamp(loadedPatrol.intensityRequirement, 0, 10); if (!TimeManager.IsValid24HourTime(loadedPatrol.startTime.ToString())) { MelonLogger.Warning("FootPatrolsConfig '" + loadedPatrol.name + "' has invalid start time"); loadedPatrol.startTime = 1900; } if (!TimeManager.IsValid24HourTime(loadedPatrol.endTime.ToString())) { MelonLogger.Warning("FootPatrolsConfig '" + loadedPatrol.name + "' has invalid end time"); loadedPatrol.endTime = 2330; } if (loadedPatrol.waypoints.Count == 0) { MelonLogger.Warning("FootPatrolsConfig is missing Waypoints for " + loadedPatrol.name); } for (int num = loadedPatrol.days.Count - 1; num != -1; num--) { if (loadedPatrol.days[num] != string.Empty) { loadedPatrol.days[num] = loadedPatrol.days[num].ToLower(); if (!list.Contains(loadedPatrol.days[num])) { MelonLogger.Warning("FootPatrolsConfig '" + loadedPatrol.name + "' has invalid weekday: '" + loadedPatrol.days[num] + "'"); loadedPatrol.days.RemoveAt(num); } } else { loadedPatrol.days.RemoveAt(num); } } } } catch (Exception ex) { footPatrolsSerialized = new FootPatrolsSerialized(); MelonLogger.Warning("Failed to read FootPatrolsSerialized config: " + ex); } } else { footPatrolsSerialized = new FootPatrolsSerialized(); footPatrolsSerialized.loadedPatrols = new List(); Save(footPatrolsSerialized); } return footPatrolsSerialized; } public static void Save(FootPatrolsSerialized config) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { JsonSerializerSettings val = new JsonSerializerSettings { ContractResolver = (IContractResolver)(object)new UnityContractResolver() }; string contents = JsonConvert.SerializeObject((object)config, (Formatting)1, val); Directory.CreateDirectory(Path.GetDirectoryName(patrolsConfig)); File.WriteAllText(patrolsConfig, contents); MelonLogger.Warning(" Foot Patrols Config has been saved!"); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Foot Patrols config: " + ex); } } public static VehiclePatrolsSerialized LoadVehiclePatrolsConfig() { VehiclePatrolsSerialized vehiclePatrolsSerialized; if (File.Exists(vehiclePatrolsConfig)) { try { vehiclePatrolsSerialized = JsonConvert.DeserializeObject(File.ReadAllText(vehiclePatrolsConfig)); List list = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }; foreach (SerializedVehiclePatrol loadedVehiclePatrol in vehiclePatrolsSerialized.loadedVehiclePatrols) { loadedVehiclePatrol.name = (string.IsNullOrEmpty(loadedVehiclePatrol.name) ? "NaCopsVehiclePatrol " : loadedVehiclePatrol.name); loadedVehiclePatrol.intensityRequirement = Mathf.Clamp(loadedVehiclePatrol.intensityRequirement, 0, 10); if (!TimeManager.IsValid24HourTime(loadedVehiclePatrol.startTime.ToString())) { MelonLogger.Warning("Vehicle Patrol Config '" + loadedVehiclePatrol.name + "' has invalid start time"); loadedVehiclePatrol.startTime = 1900; } if (loadedVehiclePatrol.waypoints.Count == 0) { MelonLogger.Warning("Vehicle Patrol Config is missing Waypoints for " + loadedVehiclePatrol.name); } for (int num = loadedVehiclePatrol.days.Count - 1; num != -1; num--) { if (loadedVehiclePatrol.days[num] != string.Empty) { loadedVehiclePatrol.days[num] = loadedVehiclePatrol.days[num].ToLower(); if (!list.Contains(loadedVehiclePatrol.days[num])) { MelonLogger.Warning("Vehicle Patrol Config '" + loadedVehiclePatrol.name + "' has invalid weekday: '" + loadedVehiclePatrol.days[num] + "'"); loadedVehiclePatrol.days.RemoveAt(num); } } else { loadedVehiclePatrol.days.RemoveAt(num); } } } } catch (Exception ex) { vehiclePatrolsSerialized = new VehiclePatrolsSerialized(); MelonLogger.Warning("Failed to read Vehicle Patrol config: " + ex); } } else { vehiclePatrolsSerialized = new VehiclePatrolsSerialized(); vehiclePatrolsSerialized.loadedVehiclePatrols = new List(); Save(vehiclePatrolsSerialized); } return vehiclePatrolsSerialized; } public static void Save(VehiclePatrolsSerialized config) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { JsonSerializerSettings val = new JsonSerializerSettings { ContractResolver = (IContractResolver)(object)new UnityContractResolver() }; string contents = JsonConvert.SerializeObject((object)config, (Formatting)1, val); Directory.CreateDirectory(Path.GetDirectoryName(vehiclePatrolsConfig)); File.WriteAllText(vehiclePatrolsConfig, contents); MelonLogger.Warning(" Vehicle Patrols config has been saved!"); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Vehicle Patrols config: " + ex); } } public static SentrysSerialized LoadSentryConfig() { SentrysSerialized sentrysSerialized; if (File.Exists(sentrysConfig)) { try { sentrysSerialized = JsonConvert.DeserializeObject(File.ReadAllText(sentrysConfig)); List list = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }; foreach (SerializedSentry loadedSentry in sentrysSerialized.loadedSentrys) { loadedSentry.members = Mathf.Clamp(loadedSentry.members, 1, 2); loadedSentry.name = (string.IsNullOrEmpty(loadedSentry.name) ? "NACopsSentry " : loadedSentry.name); loadedSentry.intensityRequirement = Mathf.Clamp(loadedSentry.intensityRequirement, 0, 10); if (!TimeManager.IsValid24HourTime(loadedSentry.startTime.ToString())) { MelonLogger.Warning("Sentry Config '" + loadedSentry.name + "' has invalid start time"); loadedSentry.startTime = 1900; } if (!TimeManager.IsValid24HourTime(loadedSentry.endTime.ToString())) { MelonLogger.Warning("Sentry Config '" + loadedSentry.name + "' has invalid end time"); loadedSentry.endTime = 2330; } for (int num = loadedSentry.days.Count - 1; num != -1; num--) { if (loadedSentry.days[num] != string.Empty) { loadedSentry.days[num] = loadedSentry.days[num].ToLower(); if (!list.Contains(loadedSentry.days[num])) { MelonLogger.Warning("Sentry Config '" + loadedSentry.name + "' has invalid weekday: '" + loadedSentry.days[num] + "'"); loadedSentry.days.RemoveAt(num); } } else { loadedSentry.days.RemoveAt(num); } } } } catch (Exception ex) { sentrysSerialized = new SentrysSerialized(); MelonLogger.Warning("Failed to read SentrysSerialized config: " + ex); } } else { sentrysSerialized = new SentrysSerialized(); sentrysSerialized.loadedSentrys = new List(); Save(sentrysSerialized); } return sentrysSerialized; } public static void Save(SentrysSerialized config) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { JsonSerializerSettings val = new JsonSerializerSettings { ContractResolver = (IContractResolver)(object)new UnityContractResolver() }; string contents = JsonConvert.SerializeObject((object)config, (Formatting)1, val); Directory.CreateDirectory(Path.GetDirectoryName(sentrysConfig)); File.WriteAllText(sentrysConfig, contents); MelonLogger.Warning(" Sentry config has been saved!"); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Sentry config: " + ex); } } public static string SanitizeAndFormatName(string orgName) { string text = orgName; if (text != null) { text = text.Replace(" ", "_").ToLower(); text = text.Replace(",", ""); text = text.Replace(".", ""); text = text.Replace("<", ""); text = text.Replace(">", ""); text = text.Replace(":", ""); text = text.Replace("\"", ""); text = text.Replace("/", ""); text = text.Replace("\\", ""); text = text.Replace("|", ""); text = text.Replace("?", ""); text = text.Replace("*", ""); } return text + ".json"; } public static PropertiesHeatSerialized LoadPropertyHeats() { string path = SanitizeAndFormatName(Singleton.Instance.ActiveSaveInfo?.OrganisationName); PropertiesHeatSerialized propertiesHeatSerialized; if (File.Exists(Path.Combine(propertyHeatConfig, path))) { try { propertiesHeatSerialized = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(propertyHeatConfig, path))); } catch (Exception ex) { propertiesHeatSerialized = new PropertiesHeatSerialized(); propertiesHeatSerialized.loadedPropertyHeats = new List(); string[] array = new string[6] { "sweatshop", "bungalow", "storageunit", "dockswarehouse", "barn", "manor" }; foreach (string propertyCode in array) { PropertyHeat propertyHeat = new PropertyHeat(); propertyHeat.propertyCode = propertyCode; propertiesHeatSerialized.loadedPropertyHeats.Add(propertyHeat); } MelonLogger.Warning("Failed to read NACops Property Heat config: " + ex); } } else { MelonLogger.Warning("Missing NACops Property Heat config, creating directory and template."); propertiesHeatSerialized = new PropertiesHeatSerialized(); Save(propertiesHeatSerialized, generateTemplate: true); } return propertiesHeatSerialized; } public static void Save(PropertiesHeatSerialized config, bool generateTemplate = false) { if (generateTemplate) { config.loadedPropertyHeats = new List(); string[] array = new string[6] { "sweatshop", "bungalow", "storageunit", "dockswarehouse", "barn", "manor" }; foreach (string propertyCode in array) { PropertyHeat propertyHeat = new PropertyHeat(); propertyHeat.propertyCode = propertyCode; config.loadedPropertyHeats.Add(propertyHeat); } } try { string path = SanitizeAndFormatName(Singleton.Instance.ActiveSaveInfo?.OrganisationName); string path2 = Path.Combine(propertyHeatConfig, path); string contents = JsonConvert.SerializeObject((object)config, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(path2)); File.WriteAllText(path2, contents); if (generateTemplate) { MelonLogger.Warning(" NACops Property Heat config, written to: " + propertyHeatConfig); } } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Property Heat config: " + ex); } } public static ThresholdMappings LoadFrequencyConfig() { ThresholdMappings thresholdMappings; if (File.Exists(eventFrequencyConfig)) { try { thresholdMappings = JsonConvert.DeserializeObject(File.ReadAllText(eventFrequencyConfig)); foreach (MinMaxThreshold item in thresholdMappings.LethalCopFrequency) { if (item.MinOf < 0) { item.MinOf = 0; } if (item.Min >= item.Max) { MelonLogger.Warning("Found invalid value in progression.json at LethalCopFreq Min value, must be smaller than Max value"); if (item.Max > 0f) { item.Min = item.Max * 0.5f; } } } foreach (MinMaxThreshold item2 in thresholdMappings.LethalCopRange) { if (item2.MinOf < 0) { item2.MinOf = 0; } if (item2.Min >= item2.Max) { MelonLogger.Warning("Found invalid value in progression.json at LethalCopRange Min value, must be smaller than Max value"); if (item2.Max > 0f) { item2.Min = item2.Max * 0.5f; } } } foreach (MinMaxThreshold item3 in thresholdMappings.NearbyCrazyFrequency) { if (item3.MinOf < 0) { item3.MinOf = 0; } if (item3.Min >= item3.Max) { MelonLogger.Warning("Found invalid value in progression.json at NearbyCrazFreq Min value, must be smaller than Max value"); if (item3.Max > 0f) { item3.Min = item3.Max * 0.5f; } } } foreach (MinMaxThreshold item4 in thresholdMappings.NearbyCrazyRange) { if (item4.MinOf < 0) { item4.MinOf = 0; } if (item4.Min >= item4.Max) { MelonLogger.Warning("Found invalid value in progression.json at NearbyCrazRange Min value, must be smaller than Max value"); if (item4.Max > 0f) { item4.Min = item4.Max * 0.5f; } } } foreach (MinMaxThreshold item5 in thresholdMappings.PIFrequency) { if (item5.MinOf < 0) { item5.MinOf = 0; } if (item5.Min >= item5.Max) { MelonLogger.Warning("Found invalid value in progression.json at PIFreq Min value, must be smaller than Max value"); if (item5.Max > 0f) { item5.Min = item5.Max * 0.5f; } } } foreach (MinMaxThreshold item6 in thresholdMappings.SnitchProbability) { if (item6.MinOf < 0) { item6.MinOf = 0; } if (item6.Min >= item6.Max) { MelonLogger.Warning("Found invalid value in progression.json at SnitchProbability Min value, must be smaller than Max value"); if (item6.Max > 0f) { item6.Min = item6.Max * 0.5f; } } } foreach (MinMaxThreshold item7 in thresholdMappings.BuyBustProbability) { if (item7.MinOf < 0) { item7.MinOf = 0; } if (item7.Min >= item7.Max) { MelonLogger.Warning("Found invalid value in progression.json at BuyBustProbability Min value, must be smaller than Max value"); if (item7.Max > 0f) { item7.Min = item7.Max * 0.5f; } } } } catch (Exception ex) { thresholdMappings = new ThresholdMappings(); MelonLogger.Warning("Failed to read NACops Event Frequency config: " + ex); } } else { MelonLogger.Warning("Missing NACops Event Frequency config, creating directory and template."); thresholdMappings = new ThresholdMappings(); Save(thresholdMappings); } return thresholdMappings; } public static void Save(ThresholdMappings config) { try { string contents = JsonConvert.SerializeObject((object)config, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(eventFrequencyConfig)); File.WriteAllText(eventFrequencyConfig, contents); MelonLogger.Warning(" NACops Event Frequency config, written to: " + eventFrequencyConfig); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Event Frequency config: " + ex); } } public static RaidConfig LoadRaidConfig() { RaidConfig raidConfig; if (File.Exists(ConfigLoader.raidConfig)) { try { raidConfig = JsonConvert.DeserializeObject(File.ReadAllText(ConfigLoader.raidConfig)); raidConfig.TraverseToPropertySpeed = Mathf.Clamp(raidConfig.TraverseToPropertySpeed, 0.1f, 1f); raidConfig.ClearPropertySpeed = Mathf.Clamp(raidConfig.ClearPropertySpeed, 0.1f, 1f); raidConfig.MaxDestroyIters = Mathf.Clamp(raidConfig.MaxDestroyIters, 1, 10); raidConfig.RaidCopsCount = Mathf.Clamp(raidConfig.RaidCopsCount, 1, 10); raidConfig.DaysUntilCanRaid = Mathf.Clamp(raidConfig.DaysUntilCanRaid, 1, 20); raidConfig.PropertyHeatThreshold = Mathf.Clamp(raidConfig.PropertyHeatThreshold, 1, 100); } catch (Exception ex) { raidConfig = new RaidConfig(); MelonLogger.Warning("Failed to read NACops Raid config: " + ex); } } else { MelonLogger.Warning("Missing NACops Raid config, creating directory and template."); raidConfig = new RaidConfig(); Save(raidConfig); } return raidConfig; } public static void Save(RaidConfig config) { try { string contents = JsonConvert.SerializeObject((object)config, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(raidConfig)); File.WriteAllText(raidConfig, contents); MelonLogger.Warning(" NACops Raid config, written to: " + raidConfig); } catch (Exception ex) { MelonLogger.Warning("Failed to save NACops Raid config: " + ex); } } } public static class ConsoleModule { [Flags] public enum CommandSupport { None = 0, List = 1, Spawn = 2, SpawnNoIndex = 4, Visualize = 8, Build = 0x10 } public abstract class ConsoleCommandBase { public virtual string Name { get; } public virtual CommandSupport SupportedMethods { get; } public virtual void List() { DebugModule.Log("Not implemented", "List"); } public virtual void Spawn(int index) { DebugModule.Log("Not implemented", "Spawn"); } public virtual void Visualize(int index) { DebugModule.Log("Not implemented", "Visualize"); } public virtual void Build(string arg) { DebugModule.Log("Build Argument: " + arg + " Not implemented", "Build"); } protected static void CleanVisual() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown if (DebugModule.pathVisualizer != null && DebugModule.pathVisualizer.Count > 0) { foreach (GameObject item in DebugModule.pathVisualizer) { Object.Destroy((Object)(object)item); } } DebugModule.pathVisualizer.Clear(); if ((Object)(object)DebugModule.lineRenderMat == (Object)null) { DebugModule.lineRenderMat = new Material(Shader.Find("Sprites/Default")); } } protected static void DrawPath(string name, Vector3[] points) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0039: 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) GameObject val = new GameObject("Path_" + name); DebugModule.pathVisualizer.Add(val); LineRenderer obj = val.AddComponent(); ((Renderer)obj).material = DebugModule.lineRenderMat; obj.widthMultiplier = 0.5f; obj.startColor = Color.blue; obj.endColor = Color.red; obj.positionCount = points.Length; obj.SetPositions(points); } } public class FootPatrolTarget : ConsoleCommandBase { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public PatrolInstance instance; public int originalStart; public int originalEnd; } [CompilerGenerated] private sealed class d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FootPatrolTarget <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; FootPatrolTarget footPatrolTarget = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; Transform centerPointTransform = Player.Local.CenterPointTransform; GameObject val = new GameObject("Path"); DebugModule.pathVisualizer.Add(val); footPatrolTarget.recordedPathNodes.Add(Player.Local.CenterPointTransform.position); LineRenderer val2 = val.AddComponent(); ((Renderer)val2).material = DebugModule.lineRenderMat; val2.widthMultiplier = 0.5f; val2.startColor = Color.blue; val2.endColor = Color.red; val2.positionCount = footPatrolTarget.recordedPathNodes.Count; val2.SetPositions(footPatrolTarget.recordedPathNodes.ToArray()); while (NACops.registered && isBuilding) { if (Vector3.Distance(centerPointTransform.position, footPatrolTarget.recordedPathNodes[footPatrolTarget.recordedPathNodes.Count - 1]) > 6f) { footPatrolTarget.BuildNode(val2); } } <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; 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 List recordedPathNodes = new List(); public string currentPathName; public override string Name => "footpatrol"; public override CommandSupport SupportedMethods => CommandSupport.List | CommandSupport.Spawn | CommandSupport.Visualize | CommandSupport.Build; public override void List() { string text = ""; int num = 0; text += "\nIndex: Name"; foreach (PatrolInstance key in FootPatrolGenerator.generatedPatrolInstances.Keys) { text += $"\n{num}: {((Object)key.Route).name}"; num++; } text += "\n-------"; DebugModule.Log(text, "List"); } public override void Spawn(int index) { <>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0(); List list = FootPatrolGenerator.generatedPatrolInstances.Keys.ToList(); if (index < list.Count) { CS$<>8__locals0.instance = list[index]; if (CS$<>8__locals0.instance.ActiveGroup != null) { DebugModule.Log("Foot patrol group is already active", "Spawn"); return; } CS$<>8__locals0.originalStart = CS$<>8__locals0.instance.StartTime; CS$<>8__locals0.originalEnd = CS$<>8__locals0.instance.EndTime; CS$<>8__locals0.instance.StartTime = NetworkSingleton.Instance.CurrentTime; CS$<>8__locals0.instance.EndTime = TimeManager.AddMinutesTo24HourTime(CS$<>8__locals0.originalStart, 240); CS$<>8__locals0.instance.StartPatrol(); DebugModule.Log("Patrol " + ((Object)CS$<>8__locals0.instance.Route).name + " Spawned", "Spawn"); NACops.coros.Add(MelonCoroutines.Start(EndSoon())); } [IteratorStateMachine(typeof(<>c__DisplayClass5_0.<g__EndSoon|0>d))] IEnumerator EndSoon() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass5_0.<g__EndSoon|0>d(0) { <>4__this = CS$<>8__locals0 }; } } public override void Visualize(int index) { ConsoleCommandBase.CleanVisual(); List list = FootPatrolGenerator.generatedPatrolInstances.Keys.ToList(); if (index >= 0 && index < list.Count) { FootPatrolRoute route = list[index].Route; Vector3[] points = route.Waypoints.Select((Transform waypoint) => waypoint.position + Vector3.up * 8f).ToArray(); ConsoleCommandBase.DrawPath(((Object)route).name, points); DebugModule.Log("Patrol " + ((Object)route).name + " Visualized", "Visualize"); } } public override void Build(string arg) { if (arg.ToLower() == "start") { BuildStart(); } else if (isBuilding) { BuildEnd(); } } public void BuildStart() { if (isBuilding) { DebugModule.Log("Already building a path or a sentry!\n Use: nacops build " + Name + " stop\n to stop building", "BuildStart"); return; } isBuilding = true; currentPathName = $"{Name}_{Guid.NewGuid()}"; DebugModule.Log("Started building path with name " + currentPathName + "\nWalk around to create new path nodes!", "BuildStart"); NACops.coros.Add(MelonCoroutines.Start(FollowPlayer())); } [IteratorStateMachine(typeof(d__11))] public IEnumerator FollowPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this }; } public void BuildNode(LineRenderer lineRenderer) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) recordedPathNodes.Add(Player.Local.CenterPointTransform.position); lineRenderer.positionCount = recordedPathNodes.Count; lineRenderer.SetPositions(recordedPathNodes.ToArray()); } public void BuildEnd() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) isBuilding = false; ConsoleCommandBase.CleanVisual(); if (recordedPathNodes.Count == 0) { DebugModule.Log("No recorded nodes found.", "BuildEnd"); return; } if (recordedPathNodes.Count < 4) { DebugModule.Log("Build more path nodes to save.", "BuildEnd"); recordedPathNodes.Clear(); return; } SerializedFootPatrol serializedFootPatrol = new SerializedFootPatrol(); serializedFootPatrol.startTime = 1900; serializedFootPatrol.endTime = 500; serializedFootPatrol.members = 1; serializedFootPatrol.intensityRequirement = 1; serializedFootPatrol.onlyIfCurfew = false; serializedFootPatrol.name = currentPathName; serializedFootPatrol.days = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }; List list = new List(); list.Add(recordedPathNodes[0]); foreach (Vector3 recordedPathNode in recordedPathNodes) { if (Vector3.Distance(recordedPathNode, list[list.Count - 1]) > 24f) { list.Add(recordedPathNode); } } serializedFootPatrol.waypoints = new List(list); FootPatrolGenerator.serPatrols.loadedPatrols.Add(serializedFootPatrol); DebugModule.Log("Finished building: " + currentPathName, "BuildEnd"); DebugModule.Log($"Recorded path nodes: {recordedPathNodes.Count}\n Reload the game to apply changes.", "BuildEnd"); ConfigLoader.Save(FootPatrolGenerator.serPatrols); recordedPathNodes.Clear(); } } public class VehiclePatrolTarget : ConsoleCommandBase { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public VehiclePatrolInstance instance; public int originalStart; } [CompilerGenerated] private sealed class d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public VehiclePatrolTarget <>4__this; private Transform 5__2; private LineRenderer 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005f: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; VehiclePatrolTarget vehiclePatrolTarget = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; 5__2 = Player.Local.CenterPointTransform; GameObject val = new GameObject("Path"); DebugModule.pathVisualizer.Add(val); vehiclePatrolTarget.recordedPathNodes.Add(Player.Local.CenterPointTransform.position); 5__3 = val.AddComponent(); ((Renderer)5__3).material = DebugModule.lineRenderMat; 5__3.widthMultiplier = 0.5f; 5__3.startColor = Color.blue; 5__3.endColor = Color.red; 5__3.positionCount = vehiclePatrolTarget.recordedPathNodes.Count; 5__3.SetPositions(vehiclePatrolTarget.recordedPathNodes.ToArray()); goto IL_0139; } case 1: <>1__state = -1; if (Vector3.Distance(5__2.position, vehiclePatrolTarget.recordedPathNodes[vehiclePatrolTarget.recordedPathNodes.Count - 1]) > 6f) { vehiclePatrolTarget.BuildNode(5__3); } goto IL_0139; case 2: { <>1__state = -1; return false; } IL_0139: if (NACops.registered && isBuilding) { <>2__current = NACops.Wait1; <>1__state = 1; return true; } <>2__current = null; <>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(); } } public List recordedPathNodes = new List(); public string currentPathName; public override string Name => "vehiclepatrol"; public override CommandSupport SupportedMethods => CommandSupport.List | CommandSupport.Spawn | CommandSupport.Visualize | CommandSupport.Build; public override void List() { string text = ""; int num = 0; text += "\nIndex: Name"; foreach (VehiclePatrolInstance key in VehiclePatrolGenerator.generatedVehiclePatrolInstances.Keys) { text += $"\n{num}: {((Object)key.Route).name}"; num++; } text += "\n-------"; DebugModule.Log(text, "List"); } public override void Spawn(int index) { <>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0(); List list = VehiclePatrolGenerator.generatedVehiclePatrolInstances.Keys.ToList(); if (index < list.Count) { CS$<>8__locals0.instance = list[index]; if ((Object)(object)CS$<>8__locals0.instance.activeOfficer != (Object)null) { DebugModule.Log("Vehicle patrol is already active", "Spawn"); return; } CS$<>8__locals0.originalStart = CS$<>8__locals0.instance.StartTime; CS$<>8__locals0.instance.StartTime = NetworkSingleton.Instance.CurrentTime; CS$<>8__locals0.instance.StartPatrol(); DebugModule.Log("Vehicle Patrol " + ((Object)CS$<>8__locals0.instance.Route).name + " Spawned", "Spawn"); NACops.coros.Add(MelonCoroutines.Start(EndSoon())); } [IteratorStateMachine(typeof(<>c__DisplayClass5_0.<g__EndSoon|0>d))] IEnumerator EndSoon() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass5_0.<g__EndSoon|0>d(0) { <>4__this = CS$<>8__locals0 }; } } public override void Visualize(int index) { ConsoleCommandBase.CleanVisual(); List list = VehiclePatrolGenerator.generatedVehiclePatrolInstances.Keys.ToList(); if (index >= 0 && index < list.Count) { VehiclePatrolRoute route = list[index].Route; Vector3[] points = route.Waypoints.Select((Transform waypoint) => waypoint.position + Vector3.up * 8f).ToArray(); ConsoleCommandBase.DrawPath(((Object)route).name, points); DebugModule.Log("Veicle Patrol " + ((Object)route).name + " Visualized", "Visualize"); } } public override void Build(string arg) { if (arg.ToLower() == "start") { BuildStart(); } else if (isBuilding) { BuildEnd(); } } public void BuildStart() { if (isBuilding) { DebugModule.Log("Already building a path or a sentry!\n Use: nacops build " + Name + " stop\n to stop building", "BuildStart"); return; } isBuilding = true; currentPathName = $"{Name}_{Guid.NewGuid()}"; DebugModule.Log("Started building path with name " + currentPathName + "\nWalk on the road to create new path nodes!", "BuildStart"); NACops.coros.Add(MelonCoroutines.Start(FollowPlayer())); } [IteratorStateMachine(typeof(d__11))] public IEnumerator FollowPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this }; } public void BuildNode(LineRenderer lineRenderer) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) recordedPathNodes.Add(Player.Local.CenterPointTransform.position); lineRenderer.positionCount = recordedPathNodes.Count; lineRenderer.SetPositions(recordedPathNodes.ToArray()); } public void BuildEnd() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) isBuilding = false; ConsoleCommandBase.CleanVisual(); if (recordedPathNodes.Count == 0) { DebugModule.Log("No recorded nodes found.", "BuildEnd"); return; } if (recordedPathNodes.Count < 4) { DebugModule.Log("Build more path nodes to save.", "BuildEnd"); recordedPathNodes.Clear(); return; } SerializedVehiclePatrol serializedVehiclePatrol = new SerializedVehiclePatrol(); serializedVehiclePatrol.startTime = 1900; serializedVehiclePatrol.intensityRequirement = 1; serializedVehiclePatrol.onlyIfCurfew = false; serializedVehiclePatrol.name = currentPathName; serializedVehiclePatrol.days = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }; List list = new List(); list.Add(recordedPathNodes[0]); foreach (Vector3 recordedPathNode in recordedPathNodes) { if (Vector3.Distance(recordedPathNode, list[list.Count - 1]) > 24f) { list.Add(recordedPathNode); } } serializedVehiclePatrol.waypoints = new List(list); VehiclePatrolGenerator.serVehiclePatrols.loadedVehiclePatrols.Add(serializedVehiclePatrol); DebugModule.Log("Finished building: " + currentPathName, "BuildEnd"); DebugModule.Log($"Recorded path nodes: {recordedPathNodes.Count}\n Reload the game to apply changes.", "BuildEnd"); ConfigLoader.Save(VehiclePatrolGenerator.serVehiclePatrols); recordedPathNodes.Clear(); } } public class SentryTarget : ConsoleCommandBase { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public SentryInstance instance; public int originalStart; public int originalEnd; } [CompilerGenerated] private sealed class d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SentryTarget <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SentryTarget sentryTarget = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; sentryTarget.recordedPathNodes.Add(Player.Local.CenterPointTransform.position); isBuilding = false; if (sentryTarget.recordedPathNodes.Count == 0) { DebugModule.Log("No recorded nodes found.", "BuildEnd"); return false; } if (sentryTarget.recordedPathNodes.Count != 2) { DebugModule.Log("Build more sentry nodes to save.", "BuildEnd"); sentryTarget.recordedPathNodes.Clear(); return false; } SerializedSentry item = new SerializedSentry { startTime = 1900, endTime = 500, members = 1, intensityRequirement = 1, onlyIfCurfew = false, name = sentryTarget.currentPathName, days = new List { "mon", "tue", "wed", "thu", "fri", "sat", "sun" }, standPosition1 = sentryTarget.recordedPathNodes[0], standPosition2 = sentryTarget.recordedPathNodes[1] }; SentryGenerator.serSentries.loadedSentrys.Add(item); DebugModule.Log("Finished building: " + sentryTarget.currentPathName, "BuildEnd"); DebugModule.Log($"Recorded path nodes: {sentryTarget.recordedPathNodes.Count}\n Reload the game to apply changes.", "BuildEnd"); ConfigLoader.Save(SentryGenerator.serSentries); sentryTarget.recordedPathNodes.Clear(); <>2__current = NACops.Wait5; <>1__state = 1; return true; } case 1: <>1__state = -1; ConsoleCommandBase.CleanVisual(); 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 List recordedPathNodes = new List(); public string currentPathName; public override string Name => "sentry"; public override CommandSupport SupportedMethods => CommandSupport.List | CommandSupport.Spawn | CommandSupport.Visualize | CommandSupport.Build; public override void List() { string text = ""; int num = 0; text += "\nIndex: Name"; foreach (SentryInstance key in SentryGenerator.generatedSentryInstances.Keys) { text += $"\n{num}: {((Object)((Component)key._potentialLocations[0]).gameObject).name}"; num++; } text += "\n-------"; DebugModule.Log(text, "List"); } public override void Spawn(int index) { <>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0(); List list = SentryGenerator.generatedSentryInstances.Keys.ToList(); if (index < list.Count) { CS$<>8__locals0.instance = list[index]; if (CS$<>8__locals0.instance._potentialLocations[0].AssignedOfficers.Count > 0) { DebugModule.Log("Sentry is already active", "Spawn"); return; } CS$<>8__locals0.originalStart = CS$<>8__locals0.instance.StartTime; CS$<>8__locals0.originalEnd = CS$<>8__locals0.instance.EndTime; CS$<>8__locals0.instance.StartTime = NetworkSingleton.Instance.CurrentTime; CS$<>8__locals0.instance.EndTime = TimeManager.AddMinutesTo24HourTime(CS$<>8__locals0.originalStart, 240); CS$<>8__locals0.instance.StartEntry(); DebugModule.Log("Sentry " + ((Object)((Component)CS$<>8__locals0.instance._potentialLocations[0]).gameObject).name + " Spawned", "Spawn"); NACops.coros.Add(MelonCoroutines.Start(EndSoon())); } [IteratorStateMachine(typeof(<>c__DisplayClass5_0.<g__EndSoon|0>d))] IEnumerator EndSoon() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass5_0.<g__EndSoon|0>d(0) { <>4__this = CS$<>8__locals0 }; } } public override void Visualize(int index) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005f: 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: 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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) ConsoleCommandBase.CleanVisual(); List list = SentryGenerator.generatedSentryInstances.Keys.ToList(); if (index >= 0 && index < list.Count) { SentryInstance val = list[index]; for (int i = 0; i < val._potentialLocations[0].Routes.Count; i++) { Vector3 position = val._potentialLocations[0].Routes[0].RoutePoints[i].position; Vector3[] points = (Vector3[])(object)new Vector3[2] { position, position + Vector3.up * 8f }; ConsoleCommandBase.DrawPath($"{((Object)((Component)val._potentialLocations[0]).gameObject).name}_{i}", points); } DebugModule.Log("Sentry " + ((Object)((Component)val._potentialLocations[0]).gameObject).name + " Visualized", "Visualize"); } } public override void Build(string arg) { if (arg.ToLower() == "start") { BuildStart(); } else if (isBuilding) { NACops.coros.Add(MelonCoroutines.Start(BuildEnd())); } } public void BuildStart() { if (isBuilding) { DebugModule.Log("Already building a path or sentry!\n Use: nacops build " + Name + " stop\n to stop building", "BuildStart"); return; } isBuilding = true; currentPathName = $"{Name}_{Guid.NewGuid()}"; DebugModule.Log(currentPathName + ": Set 1st Sentry Point\n Walk to 2nd sentry point and type:\nnacops build " + Name + " stop", "BuildStart"); MakeVertBeam(); } public void MakeVertBeam() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_008b: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) Transform centerPointTransform = Player.Local.CenterPointTransform; GameObject val = new GameObject("Path"); DebugModule.pathVisualizer.Add(val); recordedPathNodes.Add(Player.Local.CenterPointTransform.position); LineRenderer val2 = val.AddComponent(); ((Renderer)val2).material = DebugModule.lineRenderMat; val2.widthMultiplier = 0.5f; val2.startColor = Color.blue; val2.endColor = Color.red; val2.positionCount = 2; Vector3[] positions = (Vector3[])(object)new Vector3[2] { centerPointTransform.position, centerPointTransform.position + Vector3.up * 5f }; val2.SetPositions(positions); } [IteratorStateMachine(typeof(d__12))] public IEnumerator BuildEnd() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } } public class RaidTarget : ConsoleCommandBase { public override string Name => "raid"; public override CommandSupport SupportedMethods => CommandSupport.List | CommandSupport.Spawn; public override void List() { lock (NACops.heatConfigLock) { List list = new List(NACops.heatConfig); string text = ""; int num = 0; text += "\nIndex: Name"; foreach (PropertyHeat item in list) { text += $"\n{num}: {item.propertyCode}\n DaysSinceRaid: {item.daysSinceLastRaid}\n Heat: {item.propertyHeat}"; num++; } text += "\n-------"; DebugModule.Log(text, "List"); } } public override void Spawn(int index) { if (index < 0 || index >= NACops.heatConfig.Count) { return; } Property val = null; foreach (Property property in Property.Properties) { if (property.PropertyCode == NACops.heatConfig[index].propertyCode) { val = property; } } if (Object.op_Implicit((Object)(object)val)) { if ((Object)(object)val.NPCSpawnPoint == (Object)null) { DebugModule.Log("No valid destination for property: " + val.propertyName, "Spawn"); } else if (val is Business) { DebugModule.Log("Cant start raid on a business", "Spawn"); } else { NACops.coros.Add(MelonCoroutines.Start(RaidPropertyEvent.BeginRaidEvent(val))); } } } public override void Visualize(int index) { DebugModule.Log("Not supported", "Visualize"); } } public class InvestigatorTarget : ConsoleCommandBase { public override string Name => "investigator"; public override CommandSupport SupportedMethods => CommandSupport.SpawnNoIndex; public override void List() { DebugModule.Log("Not supported", "List"); } public override void Spawn(int index) { DebugModule.Log("Spawning Private Investigator", "Spawn"); NACops.coros.Add(MelonCoroutines.Start(PrivateInvestigator.HandlePIMonitor())); } public override void Visualize(int index) { DebugModule.Log("Not supported", "Visualize"); } } public static bool isBuilding = false; public static bool isLoggingEnabled = false; public static readonly HashSet ConsoleMethodNames = new HashSet { "Help", "List", "Spawn", "Visualize", "BuildStart", "BuildEnd", "RunCommand" }; } public static class DebugModule { public static int origCount = 0; public static Material lineRenderMat; public static List pathVisualizer = new List(); public static Dictionary consoleTargets = new Dictionary { { "footpatrol", new ConsoleModule.FootPatrolTarget() }, { "vehiclepatrol", new ConsoleModule.VehiclePatrolTarget() }, { "sentry", new ConsoleModule.SentryTarget() }, { "raid", new ConsoleModule.RaidTarget() }, { "investigator", new ConsoleModule.InvestigatorTarget() } }; public static void Log(string msg, [CallerMemberName] string memberName = "") { if (ConsoleModule.isLoggingEnabled || ConsoleModule.ConsoleMethodNames.Contains(memberName)) { MelonLogger.Msg("[" + memberName + "] " + msg); } } public static void RunCommand(List args) { if (args.Count == 2 && args[1].ToLower() == "help") { Help(); return; } if (args.Count == 3 && args[1].ToLower() == "enable" && args[2].ToLower() == "logs") { ConsoleModule.isLoggingEnabled = true; return; } if (args.Count < 3) { Log("Usage: nacops (action) (target) (index or argument)\n Try: nacops help", "RunCommand"); return; } string text = args[1].ToLower(); string text2 = args[2].ToLower(); int result = ((args.Count > 3 && int.TryParse(args[3], out result)) ? result : (-1)); if (result == -1 && args.Count > 3 && !(args[3].ToLower() == "start")) { _ = args[3].ToLower() == "stop"; } if (!consoleTargets.TryGetValue(text2, out var value)) { Log("Unknown command target '" + text2 + "'", "RunCommand"); return; } ConsoleModule.CommandSupport commandSupport = text switch { "list" => ConsoleModule.CommandSupport.List, "spawn" => ConsoleModule.CommandSupport.Spawn | ConsoleModule.CommandSupport.SpawnNoIndex, "visualize" => ConsoleModule.CommandSupport.Visualize, "build" => ConsoleModule.CommandSupport.Build, _ => ConsoleModule.CommandSupport.None, }; if ((value.SupportedMethods & commandSupport) == 0) { Log($"Command target '{text2}' does not support requested method '{commandSupport}'", "RunCommand"); return; } switch (commandSupport) { case ConsoleModule.CommandSupport.List: value.List(); break; case ConsoleModule.CommandSupport.Spawn | ConsoleModule.CommandSupport.SpawnNoIndex: value.Spawn(result); break; case ConsoleModule.CommandSupport.Visualize: value.Visualize(result); break; case ConsoleModule.CommandSupport.Build: value.Build(args[3]); break; } } public static void Help() { string text = ""; text += "\nSupported Commands:"; text += "\n\n# ENABLE FULL LOGGING"; text += "\nnacops enable logs"; foreach (ConsoleModule.ConsoleCommandBase value in consoleTargets.Values) { text = text + "\n\n# " + value.Name.ToUpper(); if (value.SupportedMethods.HasFlag(ConsoleModule.CommandSupport.List)) { text = text + "\nnacops list " + value.Name; } if (value.SupportedMethods.HasFlag(ConsoleModule.CommandSupport.Spawn)) { text = text + "\nnacops spawn " + value.Name + " (index)"; } if (value.SupportedMethods.HasFlag(ConsoleModule.CommandSupport.SpawnNoIndex)) { text = text + "\nnacops spawn " + value.Name; } if (value.SupportedMethods.HasFlag(ConsoleModule.CommandSupport.Visualize)) { text = text + "\nnacops visualize " + value.Name + " (index)"; } if (value.SupportedMethods.HasFlag(ConsoleModule.CommandSupport.Build)) { text = text + "\nnacops build " + value.Name + " start"; text = text + "\nnacops build " + value.Name + " stop"; } } Log(text, "Help"); } } [HarmonyPatch(typeof(Console), "SubmitCommand", new Type[] { typeof(List) })] public static class Console_SubmitCommand_ListString_Patch { public static bool Prefix(Console __instance, List args) { if (args.Count == 0) { return true; } if (args[0].ToLower() == "nacops") { DebugModule.RunCommand(args); return true; } return true; } } [HarmonyPatch(typeof(Console), "SubmitCommand", new Type[] { typeof(string) })] public static class Console_SubmitCommand_String_Patch { public static bool Prefix(Console __instance, string args) { return true; } } [HarmonyPatch(typeof(Player), "ConsumeProduct")] public static class Player_ConsumeProduct_Patch { [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer offc; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)offc == (Object)null) { return false; } <>2__current = NACops.Wait30; <>1__state = 1; return true; case 1: <>1__state = -1; DebugModule.Log(" apprehender clear", "ApprehenderOfficerClear"); if (NACops.currentDrugApprehender.Contains(offc)) { NACops.currentDrugApprehender.Remove(offc); } 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(); } } [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ProductItemInstance product; public Player player; private PoliceOfficer 5__2; private float 5__3; private bool 5__4; private bool 5__5; private HashSet.Enumerator <>7__wrap5; private PoliceOfficer 5__7; private int 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>7__wrap5 = default(HashSet.Enumerator); 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (!NACops.currentConfig.WeedInvestigator) { return false; } bool flag = false; bool num2 = product is WeedInstance; bool flag2 = product is MethInstance; bool flag3 = product is CocaineInstance; bool flag4 = product is ShroomInstance; flag = num2 || flag2 || flag3 || flag4; DebugModule.Log("Is Supported Instance for Apprehender: " + flag, "DrugConsumedCoro"); if (flag) { DebugModule.Log("Instance casted, check officers count: " + NACops.allActiveOfficers.Count, "DrugConsumedCoro"); 5__2 = null; 5__3 = 49f; 5__4 = false; <>7__wrap5 = NACops.allActiveOfficers.GetEnumerator(); <>1__state = -3; goto IL_02d7; } goto IL_0653; } case 1: <>1__state = -3; if (!BaseUtility.GUIDInUse.Contains(((NPC)5__7).BakedGUID) && !NACops.currentDrugApprehender.Contains(5__7) && !NACops.currentSummoned.Contains(5__7) && !(Vector3.Distance(((Component)5__7).transform.position, ((Component)player).transform.position) > 50f) && !((NPC)5__7).Health.IsDead && !((NPC)5__7).Health.IsKnockedOut) { if (((NPC)5__7).Awareness.VisionCone.IsPlayerVisible(player) && ((NPC)5__7).Movement.CanMove() && !((NPC)5__7).IsInVehicle && !((NPC)5__7).isInBuilding) { 5__7.BeginFootPursuit(player.PlayerCode); NACops.coros.Add(MelonCoroutines.Start(BaseUtility.GiveFalseCharges(3, player))); 5__4 = true; DebugModule.Log("Apprehend immediate direct", "DrugConsumedCoro"); goto IL_02e7; } float num = Vector3.Distance(((Component)5__7).transform.position, ((Component)player).transform.position); if (num < 5__3 && !((NPC)5__7).IsInVehicle && !((NPC)5__7).isInBuilding) { 5__3 = num; 5__2 = 5__7; } 5__7 = null; } goto IL_02d7; case 2: <>1__state = -1; if (((NPC)5__2).Awareness.VisionCone.IsPlayerVisible(player)) { DebugModule.Log("Apprehend immediate candidate", "DrugConsumedCoro"); 5__2.BeginBodySearch(player.PlayerCode); NACops.coros.Add(MelonCoroutines.Start(BaseUtility.GiveFalseCharges(3, player))); 5__5 = true; } if ((Object)(object)5__2 != (Object)null && !5__5) { 5__8 = 0; goto IL_0640; } goto IL_064c; case 3: <>1__state = -1; if (!NACops.registered) { return false; } if (!((NPC)5__2).Health.IsDead && !((NPC)5__2).Health.IsKnockedOut) { if (!((NPC)5__2).Awareness.VisionCone.IsPlayerVisible(player)) { <>2__current = NACops.Wait05; <>1__state = 4; return true; } 5__2.BeginBodySearch(player.PlayerCode); if (Random.Range(1f, 0f) > 0.8f) { NACops.coros.Add(MelonCoroutines.Start(BaseUtility.GiveFalseCharges(1, player))); } } goto IL_064c; case 4: <>1__state = -1; if (!NACops.registered) { return false; } if (!((NPC)5__2).Health.IsDead && !((NPC)5__2).Health.IsKnockedOut) { ((NPC)5__2).Movement.SetDestination(player.CenterPointTransform.position); <>2__current = NACops.Wait1; <>1__state = 5; return true; } goto IL_064c; case 5: <>1__state = -1; if (!NACops.registered) { return false; } if (!((NPC)5__2).Health.IsDead && !((NPC)5__2).Health.IsKnockedOut) { 5__8++; goto IL_0640; } goto IL_064c; case 6: { <>1__state = -1; return false; } IL_064c: 5__2 = null; goto IL_0653; IL_0640: if (5__8 <= 6) { DebugModule.Log("Apprehend Search suspect", "DrugConsumedCoro"); if (!NACops.registered) { return false; } if (5__8 <= 3 || !(Random.Range(1f, 0f) > 0.95f)) { ((NPC)5__2).Movement.FacePoint(player.CenterPointTransform.position, 0.3f); <>2__current = NACops.Wait05; <>1__state = 3; return true; } } goto IL_064c; IL_0653: DebugModule.Log("evaluate apprehender end", "DrugConsumedCoro"); evaluating = false; <>2__current = null; <>1__state = 6; return true; IL_02d7: if (<>7__wrap5.MoveNext()) { 5__7 = <>7__wrap5.Current; <>2__current = NACops.Wait01; <>1__state = 1; return true; } goto IL_02e7; IL_02e7: <>m__Finally1(); <>7__wrap5 = default(HashSet.Enumerator); if (((Object)(object)5__2 == (Object)null) | 5__4) { DebugModule.Log("No apprehender candidate found", "DrugConsumedCoro"); evaluating = false; return false; } NACops.currentDrugApprehender.Add(5__2); DebugModule.Log("Proceed apprehender candidate", "DrugConsumedCoro"); NACops.coros.Add(MelonCoroutines.Start(ApprehenderOfficerClear(5__2))); 5__5 = false; ((NPC)5__2).Movement.FacePoint(((Component)player).transform.position, 0.4f); <>2__current = NACops.Wait05; <>1__state = 2; return true; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap5).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool evaluating; public static bool Prefix(Player __instance, ProductItemInstance product) { DebugModule.Log("ConsumePrefix", "Prefix"); if (!evaluating && NACops.currentDrugApprehender.Count < 1) { evaluating = true; DebugModule.Log("CorosBegin", "Prefix"); NACops.coros.Add(MelonCoroutines.Start(DrugConsumedCoro(__instance, product))); } return true; } [IteratorStateMachine(typeof(d__2))] public static IEnumerator DrugConsumedCoro(Player player, ProductItemInstance product) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { player = player, product = product }; } [IteratorStateMachine(typeof(d__3))] public static IEnumerator ApprehenderOfficerClear(PoliceOfficer offc) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { offc = offc }; } } public static class LethalCops { [CompilerGenerated] private sealed class d__6 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private float 5__2; private List.Enumerator <>7__wrap2; private Player 5__4; private PoliceOfficer 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = default(List.Enumerator); 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0281: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: { <>1__state = -1; if (!NACops.networkManager.IsServer) { result = false; break; } (float min, float max) tuple3 = ThresholdUtils.Evaluate(NACops.thresholdConfig.LethalCopFrequency, NetworkSingleton.Instance.ElapsedDays); minWait = tuple3.min; maxWait = tuple3.max; randWaits = new List { new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)) }; DebugModule.Log("Nearby Lethal Cop Enabled", "RunNearbyLethalCops"); goto IL_00cf; } case 1: { <>1__state = -1; if (!NACops.registered) { result = false; break; } var (num, num2) = ThresholdUtils.Evaluate(NACops.thresholdConfig.LethalCopFrequency, NetworkSingleton.Instance.ElapsedDays); if (num != minWait || num2 != maxWait) { randWaits.Clear(); for (int i = 0; i < 3; i++) { randWaits.Add(new WaitForSeconds(Random.Range(num, num2))); } } (float min, float max) tuple2 = ThresholdUtils.Evaluate(NACops.thresholdConfig.LethalCopRange, (int)NetworkSingleton.Instance.LifetimeEarnings); minRange = tuple2.min; maxRange = tuple2.max; 5__2 = Random.Range(minRange, maxRange); <>7__wrap2 = Player.PlayerList.GetEnumerator(); <>1__state = -3; goto IL_033e; } case 2: { <>1__state = -3; if (!NACops.registered) { result = false; <>m__Finally1(); break; } if (((NPC)5__5).Awareness.VisionCone.IsPlayerVisible(5__4)) { 5__4.CrimeData.SetPursuitLevel((EPursuitLevel)4); 5__5.BeginFootPursuit(5__4.PlayerCode); } if (BaseUtility.GUIDInUse.Contains(((NPC)5__5).BakedGUID)) { BaseUtility.GUIDInUse.Remove(((NPC)5__5).BakedGUID); } 5__5 = null; 5__4 = null; goto IL_033e; } IL_00cf: DebugModule.Log("Nearby Lethal Cop Evaluate", "RunNearbyLethalCops"); currentAwait = randWaits[Random.Range(0, randWaits.Count)]; <>2__current = currentAwait; <>1__state = 1; result = true; break; IL_033e: while (true) { if (<>7__wrap2.MoveNext()) { 5__4 = <>7__wrap2.Current; 5__4.CrimeData.CheckNearestOfficer(); 5__5 = 5__4.CrimeData.NearestOfficer; if (!((Object)(object)5__5 == (Object)null) && BaseUtility.CanProceed(5__5, 5__4, 5__2)) { BaseUtility.GUIDInUse.Add(((NPC)5__5).BakedGUID); ((NPC)5__5).Movement.FacePoint(((Component)Player.Local).transform.position, 0.4f); <>2__current = NACops.Wait05; <>1__state = 2; result = true; goto end_IL_0008; } continue; } <>m__Finally1(); <>7__wrap2 = default(List.Enumerator); break; } goto IL_00cf; end_IL_0008: break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static float minWait; private static float maxWait; private static float minRange; private static float maxRange; private static List randWaits; private static WaitForSeconds currentAwait; [IteratorStateMachine(typeof(d__6))] public static IEnumerator RunNearbyLethalCops() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0); } } public static class NearbyCrazyCops { [CompilerGenerated] private sealed class d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer officer; public Player player; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((VOEmitter)officer.ChatterVO).Play((EVOLineType)13); ((NPC)officer).Movement.FacePoint(((Component)player).transform.position, 0.4f); <>2__current = NACops.Wait05; <>1__state = 1; return true; case 1: { <>1__state = -1; if (!NACops.registered) { return false; } if (((NPC)officer).Awareness.VisionCone.IsPlayerVisible(player) && !player.CrimeData.BodySearchPending) { officer.BeginBodySearch(player.PlayerCode); if (Random.Range(0f, 1f) > 0.8f) { NACops.coros.Add(MelonCoroutines.Start(BaseUtility.GiveFalseCharges(2, player))); } if (BaseUtility.GUIDInUse.Contains(((NPC)officer).BakedGUID)) { BaseUtility.GUIDInUse.Remove(((NPC)officer).BakedGUID); } return false; } Vector3 val = default(Vector3); ((NPC)officer).Movement.GetClosestReachablePoint(player.CenterPointTransform.position, ref val); if (val != Vector3.zero && ((NPC)officer).Movement.CanMove() && ((NPC)officer).Movement.CanGetTo(val, 1f)) { ((NPC)officer).Movement.SetDestination(val); } if (BaseUtility.GUIDInUse.Contains(((NPC)officer).BakedGUID)) { BaseUtility.GUIDInUse.Remove(((NPC)officer).BakedGUID); } <>2__current = null; <>1__state = 2; return true; } case 2: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__6 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!NACops.registered) { return false; } DebugModule.Log("Nearby Crazy Cop Evaluate", "RunNearbyCrazyCops"); Object.FindObjectsOfType(true); var (num2, num3) = ThresholdUtils.Evaluate(NACops.thresholdConfig.NearbyCrazyFrequency, NetworkSingleton.Instance.ElapsedDays); if (num2 != minWait || num3 != maxWait) { randWaits.Clear(); for (int i = 0; i < 3; i++) { randWaits.Add(new WaitForSeconds(Random.Range(num2, num3))); } } (float min, float max) tuple2 = ThresholdUtils.Evaluate(NACops.thresholdConfig.NearbyCrazyRange, (int)NetworkSingleton.Instance.LifetimeEarnings); minRange = tuple2.min; maxRange = tuple2.max; float num4 = Random.Range(minRange, maxRange); foreach (Player player in Player.PlayerList) { player.CrimeData.CheckNearestOfficer(); PoliceOfficer nearestOfficer = player.CrimeData.NearestOfficer; if (!((Object)(object)nearestOfficer == (Object)null) && BaseUtility.CanProceed(nearestOfficer, player, num4, ignoreVehicle: true)) { BaseUtility.GUIDInUse.Add(((NPC)nearestOfficer).BakedGUID); if (((NPC)nearestOfficer).IsInVehicle && player.IsInVehicle) { nearestOfficer.VehiclePursuitBehaviour.AssignTarget(player); nearestOfficer.VehiclePursuitBehaviour.beginAsSighted = true; ((Behaviour)nearestOfficer.VehiclePursuitBehaviour).Activate(); } else if (!((NPC)nearestOfficer).IsInVehicle) { NACops.coros.Add(MelonCoroutines.Start(GreedyBodySearchFind(nearestOfficer, player, num4))); } break; } } } else { <>1__state = -1; if (!NACops.networkManager.IsServer) { return false; } DebugModule.Log("Nearby Crazy Cop Enabled", "RunNearbyCrazyCops"); (float min, float max) tuple3 = ThresholdUtils.Evaluate(NACops.thresholdConfig.NearbyCrazyFrequency, NetworkSingleton.Instance.ElapsedDays); minWait = tuple3.min; maxWait = tuple3.max; randWaits = new List { new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)) }; } currentAwait = randWaits[Random.Range(0, randWaits.Count)]; <>2__current = currentAwait; <>1__state = 1; 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(); } } private static float minWait; private static float maxWait; private static float minRange; private static float maxRange; private static List randWaits; private static WaitForSeconds currentAwait; [IteratorStateMachine(typeof(d__6))] public static IEnumerator RunNearbyCrazyCops() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0); } [IteratorStateMachine(typeof(d__7))] public static IEnumerator GreedyBodySearchFind(PoliceOfficer officer, Player player, float minDistance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { officer = officer, player = player }; } } public static class BuildInfo { public const string Name = "NACopsV1"; public const string Description = "Crazyyyy cops"; public const string Author = "XOWithSauce"; public const string Company = null; public const string Version = "2.0.2"; public const string DownloadLink = null; } public class NACops : MelonMod { [HarmonyPatch(typeof(SaveManager), "Save", new Type[] { typeof(string) })] public static class SaveManager_Save_String_Patch { public static bool Prefix(SaveManager __instance, string saveFolderPath) { if (!isSaving) { isSaving = true; lock (heatConfigLock) { ConfigLoader.Save(new PropertiesHeatSerialized { loadedPropertyHeats = new List(heatConfig) }); } } isSaving = false; return true; } } [HarmonyPatch(typeof(SaveManager), "Save", new Type[] { })] public static class SaveManager_Save_Patch { public static bool Prefix(SaveManager __instance) { return true; } } [HarmonyPatch(typeof(LoadManager), "ExitToMenu")] public static class LoadManager_ExitToMenu_Patch { public static bool Prefix(LoadManager __instance, SaveInfo autoLoadSave = null, Data mainMenuPopup = null, bool preventLeaveLobby = false) { ExitPreTask(); return true; } } [HarmonyPatch(typeof(DeathScreen), "LoadSaveClicked")] public static class DeathScreen_LoadSaveClicked_Patch { public static bool Prefix(DeathScreen __instance) { ExitPreTask(); return true; } } [CompilerGenerated] private static class <>O { public static UnityAction <0>__OnPlayerArrested; public static Action <1>__OnDayPassEvaluateRaid; } [CompilerGenerated] private sealed class d__34 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (!currentConfig.RaidsEnabled) { return false; } TimeManager instance = NetworkSingleton.Instance; instance.onSleepEnd = (Action)Delegate.Combine(instance.onSleepEnd, new Action(RaidPropertyEvent.OnDayPassEvaluateRaid)); 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(); } } [CompilerGenerated] private sealed class d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { PoliceOfficer[] array; switch (<>1__state) { default: return false; case 0: <>1__state = -1; DebugModule.Log("Officers Init", "OfficersInit"); if (officerConfig.ModAddedOfficersCount != 0) { <>2__current = MelonCoroutines.Start(OfficerOverrides.ExtendOfficerPool()); <>1__state = 1; return true; } goto IL_005d; case 1: <>1__state = -1; goto IL_005d; case 2: { <>1__state = -1; return false; } IL_005d: allActiveOfficers.Clear(); array = Object.FindObjectsOfType(true); foreach (PoliceOfficer item in array) { allActiveOfficers.Add(item); } coros.Add(MelonCoroutines.Start(OfficerOverrides.SetOfficers())); <>2__current = null; <>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 d__33 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006c: 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_0077: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (!currentConfig.NoOpenCarryWeapons) { return false; } PlayerSingleton.instance.onEquippedSlotChanged = (Action)Delegate.Combine(PlayerSingleton.instance.onEquippedSlotChanged, new Action(NoticeOpenCarry.OnSlotChanged)); UnityEvent onArrested = Player.Local.onArrested; object obj = <>O.<0>__OnPlayerArrested; if (obj == null) { UnityAction val = NoticeOpenCarry.OnPlayerArrested; <>O.<0>__OnPlayerArrested = val; obj = (object)val; } onArrested.AddListener((UnityAction)obj); NoticeOpenCarry.SetWeaponsLegalStatus(); DebugModule.Log("Enabled No Open Carry Weapons", "OpenCarryInit"); <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__36 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; DebugModule.Log("Coros begin", "RunCoros"); if (currentConfig.NearbyCrazyCops) { coros.Add(MelonCoroutines.Start(NearbyCrazyCops.RunNearbyCrazyCops())); } if (currentConfig.LethalCops) { coros.Add(MelonCoroutines.Start(LethalCops.RunNearbyLethalCops())); } if (currentConfig.RacistCops) { coros.Add(MelonCoroutines.Start(RacistOfficers.EvaluateOfficersVision())); } if (currentConfig.PrivateInvestigator) { coros.Add(MelonCoroutines.Start(PrivateInvestigator.RunInvestigator())); } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func)(() => Singleton.Instance.IsGameLoaded)); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = Wait5; <>1__state = 2; return true; case 2: <>1__state = -1; currentConfig = ConfigLoader.LoadModConfig(); officerConfig = ConfigLoader.LoadOfficerConfig(); heatConfig = ConfigLoader.LoadPropertyHeats().loadedPropertyHeats; thresholdConfig = ConfigLoader.LoadFrequencyConfig(); raidConfig = ConfigLoader.LoadRaidConfig(); networkManager = Object.FindObjectOfType(true); RaidPropertyEvent.SetRaidSprite(); BaseUtility.SetPoliceNPC(); <>2__current = MelonCoroutines.Start(AddDayPassRaid()); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = MelonCoroutines.Start(StationInit()); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = MelonCoroutines.Start(OfficersInit()); <>1__state = 5; return true; case 5: <>1__state = -1; coros.Add(MelonCoroutines.Start(OpenCarryInit())); coros.Add(MelonCoroutines.Start(RunCoros())); 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(); } } [CompilerGenerated] private sealed class d__35 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; DebugModule.Log("Generating Law settings", "StationInit"); DebugModule.Log("Apply Custom to All Days", "StationInit"); foreach (KeyValuePair item in new Dictionary { { "mon", Singleton.Instance.MondaySettings }, { "tue", Singleton.Instance.TuesdaySettings }, { "wed", Singleton.Instance.WednesdaySettings }, { "thu", Singleton.Instance.ThursdaySettings }, { "fri", Singleton.Instance.FridaySettings }, { "sat", Singleton.Instance.SaturdaySettings }, { "sun", Singleton.Instance.SundaySettings } }) { DebugModule.Log("Generating patrols, vehicle patrols and sentries for day: " + item.Key, "StationInit"); _ = item.Key; LawActivitySettings val = new LawActivitySettings(); val.Curfews = item.Value.Curfews; val.Checkpoints = item.Value.Checkpoints; if (currentConfig.ExtraOfficerPatrols) { DebugModule.Log("Gen patrol", "StationInit"); val.Patrols = FootPatrolGenerator.GeneratePatrol(item.Value, item.Key); } else { val.Patrols = item.Value.Patrols; } if (currentConfig.ExtraVehiclePatrols) { DebugModule.Log("Gen vehicle patrol", "StationInit"); val.VehiclePatrols = VehiclePatrolGenerator.GenerateVehiclePatrol(item.Value, item.Key); } else { val.VehiclePatrols = item.Value.VehiclePatrols; } if (currentConfig.ExtraOfficerSentries) { DebugModule.Log("Gen sentries", "StationInit"); val.Sentries = SentryGenerator.GenerateSentry(item.Value, item.Key); } else { val.Sentries = item.Value.Sentries; } generatedLawSettings.Add(val); switch (item.Key) { case "mon": Singleton.Instance.MondaySettings = val; break; case "tue": Singleton.Instance.TuesdaySettings = val; break; case "wed": Singleton.Instance.WednesdaySettings = val; break; case "thu": Singleton.Instance.ThursdaySettings = val; break; case "fri": Singleton.Instance.FridaySettings = val; break; case "sat": Singleton.Instance.SaturdaySettings = val; break; case "sun": Singleton.Instance.SundaySettings = val; break; } } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; 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 ConfigLoader.ModConfig currentConfig; public static ConfigLoader.NAOfficerConfig officerConfig; public static ThresholdMappings thresholdConfig; public static ConfigLoader.RaidConfig raidConfig; public static object heatConfigLock = new object(); public static List heatConfig; public static bool isSaving = false; public static List coros = new List(); public static readonly HashSet allActiveOfficers = new HashSet(); public static HashSet currentDrugApprehender = new HashSet(); public static HashSet currentSummoned = new HashSet(); public static int currentPICount = 0; public static bool registered = false; public static bool lastSaveLoad = false; public static bool firstTimeLoad = false; public static NetworkObject policeBase; public static NetworkManager networkManager; public static List generatedLawSettings = new List(); public static WaitForSeconds Wait01 = new WaitForSeconds(0.1f); public static WaitForSeconds Wait05 = new WaitForSeconds(0.5f); public static WaitForSeconds Wait1 = new WaitForSeconds(1f); public static WaitForSeconds Wait2 = new WaitForSeconds(2f); public static WaitForSeconds Wait5 = new WaitForSeconds(5f); public static WaitForSeconds Wait30 = new WaitForSeconds(30f); public static NACops Instance { get; private set; } public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); Instance = this; MelonLogger.Msg("NACops Mod Loaded"); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (buildIndex == 1 && (Object)(object)Singleton.Instance != (Object)null && !registered && !firstTimeLoad) { firstTimeLoad = true; Singleton.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb)); } if (buildIndex != 1 && registered) { ExitPreTask(); } } private void OnLoadCompleteCb() { if (!registered) { registered = true; coros.Add(MelonCoroutines.Start(Setup())); } } [IteratorStateMachine(typeof(d__31))] public static IEnumerator Setup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__31(0); } [IteratorStateMachine(typeof(d__32))] public static IEnumerator OfficersInit() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__32(0); } [IteratorStateMachine(typeof(d__33))] public static IEnumerator OpenCarryInit() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__33(0); } [IteratorStateMachine(typeof(d__34))] public static IEnumerator AddDayPassRaid() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__34(0); } [IteratorStateMachine(typeof(d__35))] public static IEnumerator StationInit() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__35(0); } [IteratorStateMachine(typeof(d__36))] public static IEnumerator RunCoros() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__36(0); } private static void ExitPreTask() { registered = false; foreach (object coro in coros) { if (coro != null) { MelonCoroutines.Stop(coro); } } allActiveOfficers.Clear(); coros.Clear(); currentSummoned.Clear(); currentDrugApprehender.Clear(); Player_ConsumeProduct_Patch.evaluating = false; OfficerOverrides.generatedOfficerPool.Clear(); generatedLawSettings.Clear(); FootPatrolGenerator.generatedPatrolInstances.Clear(); FootPatrolGenerator.serPatrols = null; VehiclePatrolGenerator.generatedVehiclePatrolInstances.Clear(); VehiclePatrolGenerator.serVehiclePatrols = null; SentryGenerator.generatedSentryInstances.Clear(); SentryGenerator.serSentries = null; networkManager = null; currentPICount = 0; NoticeOpenCarry.HasSetBrandishing = false; NoticeOpenCarry.IsCheckingSlot = false; PrivateInvestigator.investigatorObjectIDs.Clear(); if (RuntimeImpostor.createdTextures.Count > 0) { foreach (Texture2D value in RuntimeImpostor.createdTextures.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } RuntimeImpostor.createdTextures.Clear(); } heatConfig.Clear(); RaidPropertyEvent.ResetRaidEvent(); } } public static class NoticeOpenCarry { public static readonly List weaponIDs = new List { "baseballbat", "fryingpan", "machete", "revolver", "goldenm1911", "m1911", "pumpshotgun" }; public static bool HasSetBrandishing = false; public static bool IsCheckingSlot = false; public static void CheckSlotItem() { DebugModule.Log("Checking slot: " + PlayerSingleton.Instance.EquippedSlotIndex, "CheckSlotItem"); int equippedSlotIndex = PlayerSingleton.Instance.EquippedSlotIndex; if (equippedSlotIndex >= 0 && equippedSlotIndex < 8) { ItemInstance itemInstance = Player.Local.Inventory[equippedSlotIndex].ItemInstance; if (itemInstance != null) { if (weaponIDs.Contains(((BaseItemInstance)itemInstance).ID)) { SetNoticable(enabled: true); } else { SetNoticable(enabled: false); } } else { SetNoticable(enabled: false); } } else { SetNoticable(enabled: false); } IsCheckingSlot = false; DebugModule.Log("Checked slot", "CheckSlotItem"); } public static void OnSlotChanged(int _) { if (!IsCheckingSlot) { IsCheckingSlot = true; CheckSlotItem(); } } public static void OnPlayerArrested() { ((EntityVisibility)Player.Local.VisualState).RemoveState("Brandishing", 0f); } public static void SetNoticable(bool enabled) { if (enabled && !HasSetBrandishing) { HasSetBrandishing = true; ((EntityVisibility)Player.Local.VisualState).ApplyState("Brandishing", (EVisualState)9, 0f); DebugModule.Log("Player Brandishing", "SetNoticable"); } else if (!enabled && HasSetBrandishing) { HasSetBrandishing = false; DebugModule.Log("RemoveState Brandishing", "SetNoticable"); ((EntityVisibility)Player.Local.VisualState).RemoveState("Brandishing", 0f); } } public static void SetWeaponsLegalStatus() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) Func func = Registry.GetItem; foreach (string weaponID in weaponIDs) { ((BaseItemDefinition)func(weaponID)).legalStatus = (ELegalStatus)4; } } } [HarmonyPatch(typeof(PursuitBehaviour), "UpdateArrest")] public static class PursuitBehaviour_UpdateArrest_Patch { public static bool Prefix(PursuitBehaviour __instance, float tick) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!NACops.officerConfig.OverrideArresting) { return true; } if ((Object)(object)__instance.TargetPlayer == (Object)null) { return false; } if (!__instance.arrestingEnabled) { return false; } if (Vector3.Distance(((Behaviour)__instance).Npc.CenterPoint, __instance.TargetPlayer.Avatar.CenterPoint) < NACops.officerConfig.ArrestRange && ((CombatBehaviour)__instance).IsTargetRecentlyVisible) { __instance.timeWithinArrestRange += tick; if (__instance.timeWithinArrestRange > 0.5f) { __instance.wasInArrestCircleLastFrame = true; } } else { if (__instance.wasInArrestCircleLastFrame) { __instance.leaveArrestCircleCount++; __instance.wasInArrestCircleLastFrame = false; } __instance.timeWithinArrestRange = Mathf.Clamp(__instance.timeWithinArrestRange - tick, 0f, float.MaxValue); } if (((NetworkBehaviour)__instance.TargetPlayer).IsOwner && __instance.timeWithinArrestRange / NACops.officerConfig.ArrestTime > __instance.TargetPlayer.CrimeData.CurrentArrestProgress) { __instance.TargetPlayer.CrimeData.SetArrestProgress(__instance.timeWithinArrestRange / NACops.officerConfig.ArrestTime); } return false; } } public static class OfficerOverrides { [CompilerGenerated] private sealed class d__1 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; PoliceStation val = PoliceStation.PoliceStations.FirstOrDefault(); if (((NPCEnterableBuilding)val).Doors.Length == 0) { DebugModule.Log("Station doors is empty, failed to extend officer pool", "ExtendOfficerPool"); return false; } for (int i = 0; i < val.OfficerPool.Count; i++) { generatedOfficerPool.Add(val.OfficerPool[i]); } for (int j = 0; j < NACops.officerConfig.ModAddedOfficersCount; j++) { PoliceOfficer val2 = SpawnOfficerRuntime(j); ((NPCEnterableBuilding)val).NPCEnteredBuilding((NPC)(object)val2, ((NPCEnterableBuilding)val).Doors[0]); generatedOfficerPool.Add(val2); PoliceOfficer.Officers.Add(val2); } val.OfficerPool = generatedOfficerPool; <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private HashSet.Enumerator <>7__wrap1; private PoliceOfficer 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(HashSet.Enumerator); 5__3 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; foreach (PoliceOfficer allActiveOfficer in NACops.allActiveOfficers) { if ((Object)(object)allActiveOfficer.belt != (Object)null) { continue; } for (int i = 0; i < ((NPC)allActiveOfficer).Avatar.appliedAccessories.Length; i++) { if (!((Object)(object)((NPC)allActiveOfficer).Avatar.appliedAccessories[i] == (Object)null) && ((NPC)allActiveOfficer).Avatar.appliedAccessories[i].AssetPath == "Avatar/Accessories/Waist/PoliceBelt/PoliceBelt") { PoliceBelt component = ((Component)((NPC)allActiveOfficer).Avatar.appliedAccessories[i]).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { allActiveOfficer.belt = component; } else { DebugModule.Log("Belt component is null and cant assign", "SetOfficers"); } break; } } } DebugModule.Log("Set officers foreach stats for " + NACops.allActiveOfficers.Count, "SetOfficers"); <>7__wrap1 = NACops.allActiveOfficers.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; 5__3.Leniency = 0.1f; 5__3.Suspicion = 1f; AvatarUtility.SetRandomAvatar(5__3); if (NACops.officerConfig.CanEnterBuildings) { ((NPC)5__3).Movement.Agent.areaMask = 57; } if (NACops.officerConfig.OverrideBodySearch) { 5__3.BodySearchDuration = NACops.officerConfig.BodySearchDuration; 5__3.BodySearchChance = NACops.officerConfig.BodySearchChance; } if (NACops.officerConfig.OverrideMovement) { ((NPC)5__3).Movement.MoveSpeedMultiplier = NACops.officerConfig.MovementSpeedMultiplier; } if (NACops.officerConfig.OverrideCombatBeh) { ((NPC)5__3).Behaviour.CombatBehaviour.GiveUpRange = NACops.officerConfig.CombatGiveUpRange; ((NPC)5__3).Behaviour.CombatBehaviour.DefaultSearchTime = NACops.officerConfig.CombatSearchTime; ((NPC)5__3).Behaviour.CombatBehaviour.DefaultMovementSpeed = NACops.officerConfig.CombatMoveSpeed; ((NPC)5__3).Behaviour.CombatBehaviour.GiveUpAfterSuccessfulHits = NACops.officerConfig.CombatEndAfterHits; } if (NACops.officerConfig.OverrideMaxHealth) { ((NPC)5__3).Health.MaxHealth = NACops.officerConfig.OfficerMaxHealth; ((NPC)5__3).Health.Health = NACops.officerConfig.OfficerMaxHealth; if (((NPC)5__3).Health.IsDead || ((NPC)5__3).Health.IsKnockedOut) { ((NPC)5__3).Health.Revive(); } } if (NACops.officerConfig.OverrideWeapon) { AvatarRangedWeapon val = null; AvatarEquippable gunPrefab = 5__3.GunPrefab; val = (AvatarRangedWeapon)(object)((gunPrefab is AvatarRangedWeapon) ? gunPrefab : null); if ((Object)(object)val != (Object)null) { val.CanShootWhileMoving = true; val.MagazineSize = NACops.officerConfig.WeaponMagSize; val.MaxFireRate = NACops.officerConfig.WeaponFireRate; ((AvatarWeapon)val).MaxUseRange = NACops.officerConfig.WeaponMaxRange; val.ReloadTime = NACops.officerConfig.WeaponReloadTime; val.RaiseTime = NACops.officerConfig.WeaponRaiseTime; val.HitChance_MaxRange = NACops.officerConfig.WeaponHitChanceMax; val.HitChance_MinRange = NACops.officerConfig.WeaponHitChanceMin; ((AvatarWeapon)val).CooldownDuration = NACops.officerConfig.WeaponFireRate; val.Damage = NACops.officerConfig.WeaponDamage; } if ((Object)(object)val != (Object)null && (Object)(object)((NPC)5__3).Behaviour.CombatBehaviour.DefaultWeapon == (Object)null) { ((NPC)5__3).Behaviour.CombatBehaviour.DefaultWeapon = (AvatarWeapon)(object)val; } DebugModule.Log(" Overridden weapon", "SetOfficers"); } 5__3 = null; break; } if (<>7__wrap1.MoveNext()) { 5__3 = <>7__wrap1.Current; <>2__current = NACops.Wait01; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = default(HashSet.Enumerator); DebugModule.Log("Officer properties complete", "SetOfficers"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List generatedOfficerPool = new List(); [IteratorStateMachine(typeof(d__1))] public static IEnumerator ExtendOfficerPool() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0); } public static PoliceOfficer SpawnOfficerRuntime(int i, bool autoDeactivate = true) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = Object.Instantiate(NACops.policeBase); PoliceOfficer component = ((Component)val).gameObject.GetComponent(); component.AutoDeactivate = autoDeactivate; NPC component2 = ((Component)val).gameObject.GetComponent(); component2.ID = $"NACops_RuntimeOfficer_{i}"; component2.FirstName = "Officer"; component2.LastName = ""; ((Component)component2).transform.parent = NetworkSingleton.Instance.NPCContainer; NPCManager.NPCRegistry.Add(component2); NACops.networkManager.ServerManager.Spawn(val, (NetworkConnection)null, default(Scene)); ((Component)val).gameObject.SetActive(true); ((Object)val).name = $"NACops_RuntimeOfficer_{i}"; return component; } public static PoliceOfficer SpawnOfficerRuntime(bool autoDeactivate = true) { return SpawnOfficerRuntime(Random.Range(1000, 6000), autoDeactivate); } [IteratorStateMachine(typeof(d__4))] public static IEnumerator SetOfficers() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0); } } public static class RacistOfficers { [CompilerGenerated] private sealed class d__0 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private List 5__2; private List.Enumerator <>7__wrap2; private Player 5__4; private HashSet.Enumerator <>7__wrap4; private PoliceOfficer 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || (uint)(num - 2) <= 1u) { try { if (num == -4 || num == 2) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } 5__2 = null; <>7__wrap2 = default(List.Enumerator); 5__4 = null; <>7__wrap4 = default(HashSet.Enumerator); 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!NACops.networkManager.IsServer) { return false; } DebugModule.Log("Racist officers enabled", "EvaluateOfficersVision"); 5__2 = new List(); foreach (Player player in Player.PlayerList) { if (!player.Avatar.IsWhite()) { 5__2.Add(player); } } if (5__2.Count == 0) { return false; } goto IL_03ec; case 1: <>1__state = -1; <>7__wrap2 = 5__2.GetEnumerator(); <>1__state = -3; goto IL_03ca; case 2: <>1__state = -4; if (!Object.op_Implicit((Object)(object)((NPC)5__6).Behaviour.activeBehaviour) || (!((Object)(object)((NPC)5__6).Behaviour.activeBehaviour == (Object)(object)5__6.PursuitBehaviour) && !((Object)(object)((NPC)5__6).Behaviour.activeBehaviour == (Object)(object)5__6.VehiclePursuitBehaviour))) { if (Vector3.Distance(((NPC)5__6).CenterPoint, 5__4.CenterPointTransform.position) < 80f) { if (5__6.PursuitBehaviour.arrestingEnabled) { NACops.coros.Add(MelonCoroutines.Start(TempDisableArrest(5__6))); } if ((int)5__4.CrimeData.CurrentPursuitLevel != 4) { 5__4.CrimeData.SetPursuitLevel((EPursuitLevel)4); } if (((NPC)5__6).isInBuilding) { ((NPC)5__6).ExitBuilding((NPCEnterableBuilding)(object)PoliceStation.PoliceStations[0]); } if (!((NPC)5__6).IsInVehicle && (Object)(object)((NPC)5__6).Behaviour.activeBehaviour != (Object)(object)5__6.PursuitBehaviour) { 5__6.BeginFootPursuit(5__4.PlayerCode); } else if (((NPC)5__6).IsInVehicle && (Object)(object)((NPC)5__6).Behaviour.activeBehaviour != (Object)(object)5__6.VehiclePursuitBehaviour) { 5__6.VehiclePursuitBehaviour.AssignTarget(5__4); 5__6.VehiclePursuitBehaviour.StartPursuit(); } } 5__6 = null; } goto IL_0383; case 3: <>1__state = -3; 5__4 = null; goto IL_03ca; case 4: { <>1__state = -1; return false; } IL_03ca: while (<>7__wrap2.MoveNext()) { 5__4 = <>7__wrap2.Current; if ((Object)(object)5__4.CurrentProperty != (Object)null) { continue; } bool flag = false; foreach (PoliceOfficer allActiveOfficer in NACops.allActiveOfficers) { if (!((NPC)allActiveOfficer).Health.IsDead && !((NPC)allActiveOfficer).Health.IsKnockedOut && ((NPC)allActiveOfficer).Awareness.VisionCone.IsPlayerVisible(5__4)) { flag = true; break; } } if (!flag) { continue; } goto IL_0193; } <>m__Finally1(); <>7__wrap2 = default(List.Enumerator); goto IL_03ec; IL_0383: if (<>7__wrap4.MoveNext()) { 5__6 = <>7__wrap4.Current; <>2__current = NACops.Wait05; <>1__state = 2; return true; } <>m__Finally2(); <>7__wrap4 = default(HashSet.Enumerator); <>2__current = NACops.Wait30; <>1__state = 3; return true; IL_03ec: if (NACops.registered) { <>2__current = NACops.Wait2; <>1__state = 1; return true; } <>2__current = null; <>1__state = 4; return true; IL_0193: <>7__wrap4 = NACops.allActiveOfficers.GetEnumerator(); <>1__state = -4; goto IL_0383; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } private void <>m__Finally2() { <>1__state = -3; ((IDisposable)<>7__wrap4).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__1 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PoliceOfficer offc; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = NACops.Wait30; <>1__state = 1; return true; case 1: <>1__state = -1; offc.PursuitBehaviour.arrestingEnabled = true; <>2__current = false; <>1__state = 2; return true; case 2: <>1__state = -1; 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(); } } [IteratorStateMachine(typeof(d__0))] public static IEnumerator EvaluateOfficersVision() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(0); } [IteratorStateMachine(typeof(d__1))] public static IEnumerator TempDisableArrest(PoliceOfficer offc) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { offc = offc }; } } public static class PrivateInvestigator { [CompilerGenerated] private sealed class <>c__DisplayClass12_0 { public UnityAction afterAction; public PoliceOfficer offc; } [CompilerGenerated] private sealed class d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass12_0 <>8__1; private Player 5__2; private float 5__3; private int 5__4; private int 5__5; private float 5__6; private float 5__7; private Dictionary 5__8; private float 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: 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_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0a38: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Unknown result type (might be due to invalid IL or missing references) //IL_0a5d: Unknown result type (might be due to invalid IL or missing references) //IL_0a6f: Expected I4, but got Unknown //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_0900: 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_0911: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_09bd: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass12_0(); 5__2 = Player.GetRandomPlayer(true, true); NACops.currentPICount++; <>8__1.offc = OfficerOverrides.SpawnOfficerRuntime(autoDeactivate: false); ((NPC)<>8__1.offc).Behaviour.ScheduleManager.DisableSchedule(); ((NPC)<>8__1.offc).Movement.PauseMovement(); NACops.currentSummoned.Add(<>8__1.offc); investigatorObjectIDs.Add(((Object)((Component)((Component)<>8__1.offc).transform.root).gameObject).GetInstanceID()); ((NPC)<>8__1.offc).Movement.SpeedController.AddSpeedControl(new SpeedControl("combat", 5, 0.55f)); <>8__1.offc.ChatterEnabled = false; <>2__current = AvatarUtility.PIAvatar(<>8__1.offc); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = BaseUtility.AttemptWarp(<>8__1.offc, 5__2.CenterPointTransform); <>1__state = 2; return true; case 2: { <>1__state = -1; ((NPC)<>8__1.offc).Movement.ResumeMovement(); 5__3 = 0f; 5__4 = 0; 5__5 = 0; 5__6 = 15f; 5__7 = 0f; bool flag = false; <>8__1.afterAction = null; <>8__1.afterAction = new UnityAction(AfterInvestigation); ((Behaviour)<>8__1.offc.PursuitBehaviour).onBegin.AddListener(<>8__1.afterAction); ((Behaviour)((NPC)<>8__1.offc).Awareness).enabled = false; ISightable val5 = (ISightable)(object)5__2; Dictionary dictionary = new Dictionary(); if (val5 == null) { DebugModule.Log("Warning sightable is null", "HandlePIMonitor"); } else if (((NPC)<>8__1.offc).Awareness.VisionCone.stateSettings.ContainsKey(val5)) { foreach (KeyValuePair item in ((NPC)<>8__1.offc).Awareness.VisionCone.stateSettings[val5]) { if (!PIdisabledVisualStates.Contains(item.Key)) { dictionary.Add(item.Key, item.Value); } } } if (dictionary.Count == 0) { DebugModule.Log("Something failed while applying visual state modification", "HandlePIMonitor"); } else if (val5 != null) { ((NPC)<>8__1.offc).Awareness.VisionCone.stateSettings[val5] = dictionary; } ((Behaviour)((NPC)<>8__1.offc).Awareness).enabled = true; 5__8 = new Dictionary(); goto IL_0322; } case 3: <>1__state = -1; if (!NACops.registered) { return false; } 5__9 = Vector3.Distance(((Component)<>8__1.offc).transform.position, ((Component)5__2).transform.position); if (((NPC)<>8__1.offc).Movement.CanMove() && !(5__3 >= maxInvestigationTime) && (int)5__2.CrimeData.CurrentPursuitLevel == 0) { 5__3 += 5f; 5__7 += 5f; bool flag; if (((Behaviour)((NPC)<>8__1.offc).Awareness.VisionCone).enabled && ((NPC)<>8__1.offc).Awareness.VisionCone.IsPlayerVisible(5__2)) { flag = true; 5__5++; } else { flag = false; } if (((NPC)<>8__1.offc).Movement.CanGetTo(((Component)5__2).transform.position, 100f) && 5__9 >= 90f && 5__9 < 150f) { DebugModule.Log("PI Should Warp - dist " + 5__9, "HandlePIMonitor"); if (!(5__7 < 5__6)) { DebugModule.Log("PI Try Warp - dist " + 5__9, "HandlePIMonitor"); ((NPC)<>8__1.offc).Movement.PauseMovement(); <>2__current = BaseUtility.AttemptWarp(<>8__1.offc, 5__2.CenterPointTransform); <>1__state = 4; return true; } } else if (((NPC)<>8__1.offc).Movement.CanGetTo(((Component)5__2).transform.position, 100f) && 5__9 >= 25f && 5__9 < 110f) { Vector3 val = SampleNearby(5__2.CenterPointTransform.position); Vector3 val2 = default(Vector3); ((NPC)<>8__1.offc).Movement.GetClosestReachablePoint(val, ref val2); if (!(val2 == Vector3.zero)) { if (5__9 > 55f) { DebugModule.Log("PI Traverse - dist " + 5__9, "HandlePIMonitor"); if (((NPC)<>8__1.offc).Movement.IsPaused) { ((NPC)<>8__1.offc).Movement.ResumeMovement(); } ((NPC)<>8__1.offc).Movement.SetDestination(val2); } else { float num = Vector3.Distance(val2, 5__2.CenterPointTransform.position); bool flag2 = CanSeeFromPosition(val2, 5__2.CenterPointTransform.position, num); if ((!flag && num < 5__9) || flag2) { DebugModule.Log($"PI Traversing Better Distance:{!flag && num < 5__9} | Can See:{flag2}", "HandlePIMonitor"); if (((NPC)<>8__1.offc).Movement.IsPaused) { ((NPC)<>8__1.offc).Movement.ResumeMovement(); } ((NPC)<>8__1.offc).Movement.SetDestination(val2); } } } } else { if (!((NPC)<>8__1.offc).Movement.CanGetTo(((Component)5__2).transform.position, 100f) || !(5__9 <= 25f)) { DebugModule.Log("PI Exit condition", "HandlePIMonitor"); goto IL_09d8; } DebugModule.Log("PI Monitoring", "HandlePIMonitor"); if ((flag || (Object)(object)5__2.CurrentProperty != (Object)null || 5__9 <= 15f) && !((NPC)<>8__1.offc).Movement.IsPaused) { ((NPC)<>8__1.offc).Movement.PauseMovement(); } ((NPC)<>8__1.offc).Movement.FacePoint(((Component)5__2).transform.position, 0.3f); if (Random.Range(0f, 1f) > 0.95f) { NACops.coros.Add(MelonCoroutines.Start(BaseUtility.GiveFalseCharges(1, 5__2))); } 5__4++; if ((Object)(object)5__2.CurrentProperty != (Object)null) { if (5__8.ContainsKey(5__2.CurrentProperty.PropertyCode)) { 5__8[5__2.CurrentProperty.PropertyCode]++; } else { 5__8.Add(5__2.CurrentProperty.PropertyCode, 1); } } if (!flag && ((Object)(object)5__2.CurrentProperty == (Object)null || Random.Range(0f, 1f) > 0.8f)) { Vector3 val3 = SampleNearby(5__2.CenterPointTransform.position); Vector3 val4 = default(Vector3); ((NPC)<>8__1.offc).Movement.GetClosestReachablePoint(val3, ref val4); if (!(val4 == Vector3.zero)) { float num2 = Vector3.Distance(val4, 5__2.CenterPointTransform.position); bool flag3 = CanSeeFromPosition(val4, 5__2.CenterPointTransform.position, num2); if (num2 < 5__9 || flag3) { DebugModule.Log($"PI Traversing Better Distance:{num2 < 5__9} | Can See:{flag3}", "HandlePIMonitor"); if (((NPC)<>8__1.offc).Movement.IsPaused) { ((NPC)<>8__1.offc).Movement.ResumeMovement(); } ((NPC)<>8__1.offc).Movement.SetDestination(val4); } } } } goto IL_0322; } goto IL_09d8; case 4: <>1__state = -1; ((NPC)<>8__1.offc).Movement.ResumeMovement(); DebugModule.Log("PI New dist " + 5__9, "HandlePIMonitor"); 5__7 = 0f; goto IL_0322; case 5: { <>1__state = -1; if (!NACops.registered) { return false; } DebugModule.Log("Despawning PI", "HandlePIMonitor"); try { int instanceID = ((Object)<>8__1.offc).GetInstanceID(); if (RuntimeImpostor.createdTextures.ContainsKey(instanceID)) { if ((Object)(object)RuntimeImpostor.createdTextures[instanceID] != (Object)null) { Object.Destroy((Object)(object)RuntimeImpostor.createdTextures[instanceID]); } RuntimeImpostor.createdTextures.Remove(instanceID); } if (NACops.currentSummoned.Contains(<>8__1.offc)) { NACops.currentSummoned.Remove(<>8__1.offc); } NACops.currentPICount--; NPC component = ((Component)<>8__1.offc).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && NPCManager.NPCRegistry.Contains(component)) { NPCManager.NPCRegistry.Remove(component); } if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)component).gameObject); } } catch (Exception ex) { MelonLogger.Error((object)ex); } return false; } IL_0322: <>2__current = NACops.Wait5; <>1__state = 3; return true; IL_09d8: if (5__8.Count > 0) { lock (NACops.heatConfigLock) { foreach (PropertyHeat item2 in NACops.heatConfig) { if (5__8.ContainsKey(item2.propertyCode)) { EPursuitLevel currentPursuitLevel = 5__2.CrimeData.CurrentPursuitLevel; int num3 = 5__8[item2.propertyCode]; float num4 = 1f; switch (currentPursuitLevel - 2) { case 0: num4 = 1.2f; break; case 1: num4 = 1.45f; break; case 2: num4 = 1.7f; break; } if (num3 >= 12 && 5__4 > 4 && 5__5 >= 1 && (Object)(object)5__2.CurrentProperty != (Object)null && 5__2.CurrentProperty.PropertyCode == item2.propertyCode) { DebugModule.Log("Property heat increased +++", "HandlePIMonitor"); item2.propertyHeat += Mathf.RoundToInt(Random.Range(6f, 9f) * num4); } else if (num3 >= 6 && 5__4 > 2 && 5__5 >= 1 && (Object)(object)5__2.CurrentProperty != (Object)null && 5__2.CurrentProperty.PropertyCode == item2.propertyCode) { item2.propertyHeat += Mathf.RoundToInt(Random.Range(4f, 6f) * num4); DebugModule.Log("Property heat increased ++", "HandlePIMonitor"); } else if (item2.propertyHeat < 8 && num3 >= 3 && 5__4 >= 2 && 5__5 >= 2) { item2.propertyHeat += Mathf.RoundToInt(Random.Range(2f, 4f) * num4); DebugModule.Log("Property heat increased +", "HandlePIMonitor"); } else if (item2.propertyHeat > 5 && 5__3 > 60f && 5__4 > 4) { item2.propertyHeat += Mathf.RoundToInt(Random.Range(1f, 5f) * num4); DebugModule.Log("Property heat decreased", "HandlePIMonitor"); } } } } } DebugModule.Log("PI Finished", "HandlePIMonitor"); DebugModule.Log("Sighted amnt: " + 5__5, "HandlePIMonitor"); DebugModule.Log("Proximity delta: " + 5__4, "HandlePIMonitor"); DebugModule.Log("Investigation:", "HandlePIMonitor"); foreach (KeyValuePair item3 in 5__8) { DebugModule.Log($"{item3.Key} - Investigation delta: {item3.Value}", "HandlePIMonitor"); } AfterInvestigation(); <>2__current = NACops.Wait30; <>1__state = 5; return true; } void AfterInvestigation() { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown if (((<>c__DisplayClass12_0)this).afterAction != null) { ((Behaviour)((<>c__DisplayClass12_0)this).offc.PursuitBehaviour).onBegin.RemoveListener(((<>c__DisplayClass12_0)this).afterAction); ((NPC)((<>c__DisplayClass12_0)this).offc).Awareness.SetAwarenessActive(false); ((<>c__DisplayClass12_0)this).afterAction = null; if (!((NPC)((<>c__DisplayClass12_0)this).offc).Health.IsDead && !((NPC)((<>c__DisplayClass12_0)this).offc).Health.IsKnockedOut) { if (((Behaviour)((NPC)((<>c__DisplayClass12_0)this).offc).Awareness.VisionCone).enabled) { ((NPC)((<>c__DisplayClass12_0)this).offc).Awareness.SetAwarenessActive(false); } if ((Object)(object)((NPC)((<>c__DisplayClass12_0)this).offc).Behaviour.activeBehaviour != (Object)null && ((Object)(object)((NPC)((<>c__DisplayClass12_0)this).offc).Behaviour.activeBehaviour == (Object)(object)((NPC)((<>c__DisplayClass12_0)this).offc).Behaviour.CombatBehaviour || (Object)(object)((NPC)((<>c__DisplayClass12_0)this).offc).Behaviour.activeBehaviour == (Object)(object)((<>c__DisplayClass12_0)this).offc.PursuitBehaviour)) { ((Behaviour)((<>c__DisplayClass12_0)this).offc.PursuitBehaviour).Disable(); } ((NPC)((<>c__DisplayClass12_0)this).offc).Movement.SpeedController.AddSpeedControl(new SpeedControl("combat", 5, 0.85f)); ((NPC)((<>c__DisplayClass12_0)this).offc).Movement.SetDestination(((NPCEnterableBuilding)PoliceStation.PoliceStations[0]).Doors[0].AccessPoint); if (((NPC)((<>c__DisplayClass12_0)this).offc).Movement.IsPaused) { ((NPC)((<>c__DisplayClass12_0)this).offc).Movement.ResumeMovement(); } } } } } 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 d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!NACops.registered) { return false; } var (num2, num3) = ThresholdUtils.Evaluate(NACops.thresholdConfig.PIFrequency, NetworkSingleton.Instance.ElapsedDays); if (num2 != minWait || num3 != maxWait) { randWaits.Clear(); for (int i = 0; i < 3; i++) { randWaits.Add(new WaitForSeconds(Random.Range(num2, num3))); } } DebugModule.Log("PI Evaluate", "RunInvestigator"); EDay currentDay = NetworkSingleton.Instance.CurrentDay; if (!((object)(EDay)(ref currentDay)).ToString().Contains("Saturday") && !((object)(EDay)(ref currentDay)).ToString().Contains("Sunday") && NACops.currentPICount < 1) { DebugModule.Log("PI Proceed", "RunInvestigator"); NACops.coros.Add(MelonCoroutines.Start(HandlePIMonitor())); } } else { <>1__state = -1; DebugModule.Log("Private Investigator Enabled", "RunInvestigator"); playerLayer = LayerMask.NameToLayer("Player"); obstacleLayerMask = LayerMask.GetMask(new string[3] { "Terrain", "Default", "Vehicle" }); (float min, float max) tuple2 = ThresholdUtils.Evaluate(NACops.thresholdConfig.PIFrequency, (int)NetworkSingleton.Instance.LifetimeEarnings); minWait = tuple2.min; maxWait = tuple2.max; randWaits = new List { new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)), new WaitForSeconds(Random.Range(minWait, maxWait)) }; } currentAwait = randWaits[Random.Range(0, randWaits.Count)]; <>2__current = currentAwait; <>1__state = 1; 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(); } } public static readonly List randomMaleNames = new List { "James", "William", "David", "Richard", "John", "Robert" }; public static readonly List randomFemaleNames = new List { "Jessica", "Susan", "Linda", "Mary" }; public static readonly List PIdisabledVisualStates = new List { (EVisualState)9, (EVisualState)2, (EVisualState)5, (EVisualState)7, (EVisualState)1 }; public static float maxInvestigationTime = 240f; private static float minWait; private static float maxWait; private static List randWaits; private static WaitForSeconds currentAwait; private static int playerLayer = -1; private static int obstacleLayerMask = -1; public static List investigatorObjectIDs = new List(); [IteratorStateMachine(typeof(d__11))] public static IEnumerator RunInvestigator() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0); } [IteratorStateMachine(typeof(d__12))] public static IEnumerator HandlePIMonitor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0); } public static bool CanSeeFromPosition(Vector3 pos, Vector3 target, float distance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Vector3 val = pos + Vector3.up * 1.75f; Vector3 val2 = target - val; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, distance + 2f)) { if ((obstacleLayerMask & (1 << ((Component)((RaycastHit)(ref val3)).collider).gameObject.layer)) != 0) { DebugModule.Log("New Destination cannot see", "CanSeeFromPosition"); return false; } if (((Component)((RaycastHit)(ref val3)).collider).gameObject.layer == playerLayer) { DebugModule.Log("New Destination can see", "CanSeeFromPosition"); return true; } } else { DebugModule.Log("No Raycast hits for sightline check", "CanSeeFromPosition"); } return false; } public static Vector3 SampleNearby(Vector3 target) { //IL_006a: 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) float num = Random.Range(6f, 24f); float num2 = Random.Range(6f, 24f); num *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); num2 *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); return target + new Vector3(num, 0f, num2); } } [Serializable] public class PropertyHeat { public string propertyCode; public int propertyHeat; public int daysSinceLastRaid; } [Serializable] public class PropertiesHeatSerialized { public List loadedPropertyHeats = new List(); } public static class RaidPropertyEvent { public enum ERaidType { PropertyRaid, BusinessRaid, Other } public enum EOfficerRaidRole { Undecided, DestroyGrowEquipment, DestroyLabEquipment, SearchContainer } public enum ERaidDestroyType { None, DestroyPot, DestroyShroomBed, DestroyDryingRack, DestroyLabOven, DestroyChemistryStation, DestroyCauldron, DestroyMixing } public class RaidOfficer { public string Name; public PoliceOfficer officer; public EOfficerRaidRole role; public Property targetProperty; public BuildableItem currentTargetObj; public int destroyedItems; public int currentActionIter; } [CompilerGenerated] private sealed class <>c__DisplayClass31_0 { public List currentHeats; public string selectedCode; internal bool b__3(PropertyHeat x) { return x.propertyCode == selectedCode; } } [CompilerGenerated] private sealed class <>c__DisplayClass31_1 { public Property property; internal bool b__1(PropertyHeat x) { return x.propertyCode == property.propertyCode; } } [CompilerGenerated] private sealed class <>c__DisplayClass31_2 { public int i; public <>c__DisplayClass31_0 CS$<>8__locals1; internal bool b__2(Property x) { return x.PropertyCode == CS$<>8__locals1.currentHeats[i].propertyCode; } } [CompilerGenerated] private sealed class <>c__DisplayClass42_0 { public ITransitEntity entity; public Action walkCallback; public bool callbackConsumed; public RaidOfficer offc; public ERaidDestroyType destroyType; public BuildableItem destroyTarget; public int targetInstanceID; internal void b__0(Pot t) { entity = ((Component)t).GetComponent(); } internal void b__1(MushroomBed t) { entity = ((Component)t).GetComponent(); } internal void b__2(DryingRack t) { entity = ((Component)t).GetComponent(); } internal void b__3(LabOven t) { entity = ((Component)t).GetComponent(); } internal void b__4(ChemistryStation t) { entity = ((Component)t).GetComponent(); } internal void b__5(Cauldron t) { entity = ((Component)t).GetComponent(); } internal void b__6(MixingStationMk2 t) { entity = ((Component)t).GetComponent(); } internal void b__7(PlaceableStorageEntity t) { entity = ((Component)t).GetComponent(); } } [CompilerGenerated] private sealed class <>c__DisplayClass54_0 { public RaidOfficer offc; internal bool b__0() { if (NACops.registered && offc != null && !((Object)(object)offc.officer == (Object)null) && !((NPC)offc.officer).Health.IsDead && !((NPC)offc.officer).Health.IsKnockedOut && !((Object)(object)((NPC)offc.officer).Behaviour.activeBehaviour == (Object)null)) { if ((Object)(object)((NPC)offc.officer).Behaviour.activeBehaviour != (Object)(object)((NPC)offc.officer).Behaviour.CombatBehaviour) { return (Object)(object)((NPC)offc.officer).Behaviour.activeBehaviour != (Object)(object)offc.officer.PursuitBehaviour; } return false; } return true; } } [CompilerGenerated] private sealed class d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Property property; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!raidActive) { raidActive = true; SpawnRaidCops(property); <>2__current = NACops.Wait1; <>1__state = 1; return true; } DebugModule.Log("Raid is already active", "BeginRaidEvent"); goto IL_00cc; case 1: <>1__state = -1; DebugModule.Log("Sending raid to " + property.propertyName + " (" + property.propertyCode + ")", "BeginRaidEvent"); NACops.coros.Add(MelonCoroutines.Start(TraverseCurrentToProperty(property))); goto IL_00cc; case 2: { <>1__state = -1; return false; } IL_00cc: <>2__current = null; <>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 d__53 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (offc == null || (Object)(object)offc.officer == (Object)null || (Object)(object)((Component)offc.officer).gameObject == (Object)null || !currentRaidOfficers.Contains(offc)) { DebugModule.Log("Raid Officer already marked for despawn", "Despawn"); return false; } if (raidOfficersAlive > 0) { raidOfficersAlive--; } deadRaidOfficers.Add(offc); if (((NPC)offc.officer).Movement.CanMove()) { ((NPC)offc.officer).Movement.SetDestination(((NPCEnterableBuilding)PoliceStation.PoliceStations[0]).Doors[0].AccessPoint); } <>2__current = NACops.Wait30; <>1__state = 1; return true; case 1: { <>1__state = -1; if (!NACops.registered) { return false; } if (NACops.currentSummoned.Contains(offc.officer)) { NACops.currentSummoned.Remove(offc.officer); } DebugModule.Log("Despawning " + offc.Name, "Despawn"); NPC component = ((Component)offc.officer).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && NPCManager.NPCRegistry.Contains(component)) { NPCManager.NPCRegistry.Remove(component); } if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)component).gameObject); } if (currentRaidOfficers.Contains(offc)) { currentRaidOfficers.Remove(offc); } if (currentRaidOfficers.Count == 0) { DebugModule.Log("Last raid cop despawned", "Despawn"); if (raidActive) { ResetRaidEvent(); } } 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(); } } [CompilerGenerated] private sealed class d__42 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; private <>c__DisplayClass42_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass42_0(); <>8__1.offc = offc; <>8__1.destroyType = ERaidDestroyType.None; <>8__1.destroyTarget = null; if (<>8__1.offc.role == EOfficerRaidRole.DestroyGrowEquipment) { List buildablesOfType = <>8__1.offc.targetProperty.GetBuildablesOfType(); List buildablesOfType2 = <>8__1.offc.targetProperty.GetBuildablesOfType(); List buildablesOfType3 = <>8__1.offc.targetProperty.GetBuildablesOfType(); if (buildablesOfType != null && buildablesOfType.Count > 0 && buildablesOfType.Count >= buildablesOfType2.Count && buildablesOfType.Count >= buildablesOfType3.Count) { DebugModule.Log("select pots", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyPot; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType, containers: false); } else if (buildablesOfType2 != null && buildablesOfType2.Count > 0 && buildablesOfType2.Count >= buildablesOfType.Count && buildablesOfType2.Count >= buildablesOfType3.Count) { DebugModule.Log("select shroombeds", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyShroomBed; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType2, containers: false); } else { if (buildablesOfType3 == null || buildablesOfType3.Count <= 0) { DebugModule.Log("no selectable item types left", <>8__1.offc.Name); <>8__1.offc.currentActionIter = maxActionIters; BeginRoleAction(<>8__1.offc); return false; } DebugModule.Log("select drying racks", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyDryingRack; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType3, containers: false); } } else if (<>8__1.offc.role == EOfficerRaidRole.DestroyLabEquipment) { List buildablesOfType4 = <>8__1.offc.targetProperty.GetBuildablesOfType(); List buildablesOfType5 = <>8__1.offc.targetProperty.GetBuildablesOfType(); List buildablesOfType6 = <>8__1.offc.targetProperty.GetBuildablesOfType(); List buildablesOfType7 = <>8__1.offc.targetProperty.GetBuildablesOfType(); if (buildablesOfType4 != null && buildablesOfType4.Count > 0) { DebugModule.Log("select mixing station mk2", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyMixing; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType4, containers: false); } else if (buildablesOfType5 != null && buildablesOfType5.Count > 0 && buildablesOfType5.Count >= buildablesOfType6.Count && buildablesOfType5.Count >= buildablesOfType7.Count) { DebugModule.Log("select lab ovens", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyLabOven; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType5, containers: false); } else if (buildablesOfType6 != null && buildablesOfType6.Count > 0 && buildablesOfType6.Count >= buildablesOfType5.Count && buildablesOfType6.Count >= buildablesOfType7.Count) { DebugModule.Log("select chem stations", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyChemistryStation; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType6, containers: false); } else { if (buildablesOfType7 == null || buildablesOfType7.Count <= 0) { DebugModule.Log("no selectable item types left", <>8__1.offc.Name); <>8__1.offc.currentActionIter = maxActionIters; BeginRoleAction(<>8__1.offc); return false; } DebugModule.Log("select cauldrons", <>8__1.offc.Name); <>8__1.destroyType = ERaidDestroyType.DestroyCauldron; <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType7, containers: false); } } else if (<>8__1.offc.role == EOfficerRaidRole.SearchContainer) { List buildablesOfType8 = <>8__1.offc.targetProperty.GetBuildablesOfType(); if (buildablesOfType8 == null || buildablesOfType8.Count <= 0) { DebugModule.Log("no selectable item types left", <>8__1.offc.Name); <>8__1.offc.currentActionIter = maxActionIters; BeginRoleAction(<>8__1.offc); return false; } DebugModule.Log("select storage entities", <>8__1.offc.Name); <>8__1.destroyTarget = RaidPropertyEvent.GetValidBuildable(buildablesOfType8, containers: true); } if ((Object)(object)<>8__1.destroyTarget == (Object)null) { DebugModule.Log("Destroy Target is null after search", <>8__1.offc.Name); <>2__current = NACops.Wait05; <>1__state = 1; return true; } <>8__1.entity = null; switch (<>8__1.destroyType) { case ERaidDestroyType.DestroyPot: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(Pot t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyShroomBed: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(MushroomBed t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyDryingRack: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(DryingRack t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyLabOven: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(LabOven t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyChemistryStation: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(ChemistryStation t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyCauldron: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(Cauldron t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.DestroyMixing: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(MixingStationMk2 t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; case ERaidDestroyType.None: RaidPropertyEvent.Casted(<>8__1.destroyTarget, (Action)delegate(PlaceableStorageEntity t) { <>8__1.entity = ((Component)t).GetComponent(); }); break; } Transform val = null; if (<>8__1.entity != null) { val = NavMeshUtility.GetReachableAccessPoint(<>8__1.entity, (NPC)(object)<>8__1.offc.officer); } if ((Object)(object)val != (Object)null) { DebugModule.Log("Reachable Access Point found", <>8__1.offc.Name); <>8__1.offc.currentTargetObj = <>8__1.destroyTarget; <>8__1.targetInstanceID = ((Object)<>8__1.destroyTarget).GetInstanceID(); DebugModule.Log($"Set {<>8__1.offc.Name} {<>8__1.offc.role} {((Object)<>8__1.destroyTarget).name} ({<>8__1.targetInstanceID})", "DestroyEquipment"); <>8__1.walkCallback = null; <>8__1.callbackConsumed = false; <>8__1.walkCallback = OnTraverseToEntityEnded; if (((NPC)<>8__1.offc.officer).Movement.IsPaused) { ((NPC)<>8__1.offc.officer).Movement.ResumeMovement(); } if (!((NPC)<>8__1.offc.officer).Movement.CanGetTo(val.position, 1f)) { <>2__current = NACops.Wait05; <>1__state = 3; return true; } if (!((NPC)<>8__1.offc.officer).Movement.CanMove()) { <>2__current = NACops.Wait05; <>1__state = 5; return true; } ((NPC)<>8__1.offc.officer).Movement.SetDestination(val.position, <>8__1.walkCallback, true, 2f, 1f); NACops.coros.Add(MelonCoroutines.Start(WaitEndSetDestination(<>8__1.offc, IsWalkCallbackConsumed))); return false; } DebugModule.Log("No reachable access point found for " + <>8__1.entity.Name, <>8__1.offc.Name); <>2__current = NACops.Wait05; <>1__state = 2; return true; } case 1: <>1__state = -1; if (!NACops.registered) { return false; } BeginRoleAction(<>8__1.offc); return false; case 2: <>1__state = -1; if (!NACops.registered) { return false; } BeginRoleAction(<>8__1.offc); return false; case 3: <>1__state = -1; DebugModule.Log("Officer cant pathfind to target position", <>8__1.offc.Name); <>2__current = RemoveToBeDestroyed(<>8__1.destroyTarget, <>8__1.destroyType); <>1__state = 4; return true; case 4: <>1__state = -1; BeginRoleAction(<>8__1.offc); return false; case 5: <>1__state = -1; DebugModule.Log("Officer cant move!", <>8__1.offc.Name); <>2__current = RemoveToBeDestroyed(<>8__1.destroyTarget, <>8__1.destroyType); <>1__state = 6; return true; case 6: <>1__state = -1; BeginRoleAction(<>8__1.offc); return false; } bool IsWalkCallbackConsumed() { return ((<>c__DisplayClass42_0)this).callbackConsumed; } void OnTraverseToEntityEnded(WalkResult result) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (((<>c__DisplayClass42_0)this).walkCallback != null && !((<>c__DisplayClass42_0)this).callbackConsumed) { ((<>c__DisplayClass42_0)this).walkCallback = null; ((<>c__DisplayClass42_0)this).callbackConsumed = true; NACops.coros.Add(MelonCoroutines.Start(WaitRunCallback(((<>c__DisplayClass42_0)this).offc, result, ((<>c__DisplayClass42_0)this).destroyType, ((<>c__DisplayClass42_0)this).destroyTarget, ((<>c__DisplayClass42_0)this).targetInstanceID))); } else { DebugModule.Log("Walk callback was null when traverse to entity ended!", ((<>c__DisplayClass42_0)this).offc.Name); } } } 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 d__59 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Image image; private float 5__2; private float 5__3; private float 5__4; private float 5__5; private Color 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 1f; 5__3 = 0f; 5__4 = ((Graphic)image).rectTransform.sizeDelta.x; 5__5 = ((Graphic)image).rectTransform.sizeDelta.y; 5__6 = ((Graphic)image).color; goto IL_011d; case 1: <>1__state = -1; goto IL_011d; case 2: { <>1__state = -1; if (!NACops.registered) { return false; } ((Graphic)image).rectTransform.sizeDelta = new Vector2(5__4, 5__5); ((Graphic)image).color = 5__6; return false; } IL_011d: if (5__3 < 5__2) { 5__3 += Time.deltaTime; float num = 5__3 / 5__2; ((Graphic)image).color = SetAlpha(((Graphic)image).color, Mathf.SmoothStep(1f, 0f, num)); ((Graphic)image).rectTransform.sizeDelta = new Vector2(Mathf.SmoothStep(5__4, 0f, num), Mathf.SmoothStep(5__5, 0f, num)); <>2__current = null; <>1__state = 1; return true; } <>2__current = NACops.Wait5; <>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 d__61 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float delayUntilStart; public bool fadeIn; public float durInOut; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delayUntilStart); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 0f; if (fadeIn) { notificationGroup.alpha = 0f; ((Component)raidSlider).gameObject.SetActive(true); } goto IL_00f3; case 2: <>1__state = -1; goto IL_00f3; case 3: { <>1__state = -1; if (!fadeIn) { ((Component)raidSlider).gameObject.SetActive(false); notificationGroup.alpha = 1f; } return false; } IL_00f3: if (5__2 < durInOut) { 5__2 += Time.deltaTime; float num = 5__2 / durInOut; if (fadeIn) { notificationGroup.alpha = Mathf.SmoothStep(0f, 1f, num); } else { notificationGroup.alpha = Mathf.SmoothStep(1f, 0f, num); } <>2__current = null; <>1__state = 2; return true; } if (fadeIn) { notificationGroup.alpha = 1f; } else { notificationGroup.alpha = 0f; } <>2__current = NACops.Wait01; <>1__state = 3; 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 d__58 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Image image; private float 5__2; private float 5__3; private float 5__4; private float 5__5; private Color 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 2f; 5__3 = 0f; 5__4 = ((Graphic)image).rectTransform.sizeDelta.x; 5__5 = ((Graphic)image).rectTransform.sizeDelta.y; 5__6 = ((Graphic)image).color; goto IL_0168; case 1: <>1__state = -1; goto IL_0168; case 2: { <>1__state = -1; if (!NACops.registered) { return false; } ((Graphic)image).rectTransform.sizeDelta = new Vector2(5__4, 5__5); ((Graphic)image).color = 5__6; return false; } IL_0168: if (5__3 < 5__2) { 5__3 += Time.deltaTime; float num = 5__3 / 5__2; ((Graphic)image).color = new Color(Mathf.SmoothStep(5__6.r, 1f, num), Mathf.SmoothStep(5__6.g, 0f, num), Mathf.SmoothStep(5__6.b, 0f, num), Mathf.SmoothStep(5__6.a, 0f, num)); ((Graphic)image).rectTransform.sizeDelta = new Vector2(Mathf.SmoothStep(5__4, 5__4 * 1.5f, num), Mathf.SmoothStep(5__5, 5__5 * 1.5f, num)); <>2__current = null; <>1__state = 1; return true; } <>2__current = NACops.Wait5; <>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 d__40 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; private List 5__2; private List.Enumerator <>7__wrap2; private Employee 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__40(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 2: try { } finally { <>m__Finally1(); } break; case -4: case 4: try { } finally { <>m__Finally2(); } break; } 5__2 = null; <>7__wrap2 = default(List.Enumerator); 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; if (employeesScared) { result = false; break; } employeesScared = true; <>2__current = NACops.Wait5; <>1__state = 1; result = true; break; case 1: <>1__state = -1; if (!NACops.registered || !raidActive) { result = false; break; } 5__2 = new List(offc.targetProperty.Employees); if (5__2.Count == 0) { result = false; break; } <>7__wrap2 = 5__2.GetEnumerator(); <>1__state = -3; goto IL_014e; case 2: <>1__state = -3; if (!NACops.registered) { result = false; <>m__Finally1(); break; } ((NPC)5__4).Behaviour.FleeBehaviour.SetPointToFlee(5__4.AssignedProperty.EmployeeIdlePoints[0].position); ((Behaviour)((NPC)5__4).Behaviour.FleeBehaviour).Activate(); 5__4 = null; goto IL_014e; case 3: <>1__state = -1; if (!NACops.registered) { result = false; break; } <>7__wrap2 = 5__2.GetEnumerator(); <>1__state = -4; goto IL_0284; case 4: <>1__state = -4; if (!NACops.registered) { result = false; <>m__Finally2(); break; } if ((Object)(object)((NPC)5__4).Behaviour.activeBehaviour != (Object)null && (Object)(object)((NPC)5__4).Behaviour.activeBehaviour == (Object)(object)((NPC)5__4).Behaviour.FleeBehaviour) { ((Behaviour)((NPC)5__4).Behaviour.FleeBehaviour).Deactivate(); ((NPC)5__4).Movement.SetDestination(5__4.WaitOutside.IdlePoint); } 5__4 = null; goto IL_0284; case 5: { <>1__state = -1; result = false; break; } IL_0284: if (<>7__wrap2.MoveNext()) { 5__4 = <>7__wrap2.Current; <>2__current = NACops.Wait05; <>1__state = 4; result = true; } else { <>m__Finally2(); <>7__wrap2 = default(List.Enumerator); <>2__current = null; <>1__state = 5; result = true; } break; IL_014e: if (<>7__wrap2.MoveNext()) { 5__4 = <>7__wrap2.Current; <>2__current = NACops.Wait05; <>1__state = 2; result = true; } else { <>m__Finally1(); <>7__wrap2 = default(List.Enumerator); <>2__current = NACops.Wait30; <>1__state = 3; result = true; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } private void <>m__Finally2() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__37 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; public Vector3 groupPosition; private NPCMovement 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!NACops.registered) { return false; } 5__4 += 0.5f; if (!officersArrived.Contains(offc)) { _ = 5__2.CurrentDestination; if (5__2.CurrentDestination == Vector3.zero) { DebugModule.Log("Raid Cop path is failing to V3.zero", "MonitorTraversal"); } if (!CanContinue(offc)) { DebugModule.Log("Officer cant continue while traversal", "MonitorTraversal"); if (distancesToProperty.ContainsKey(offc)) { distancesToProperty.Remove(offc); } } else { if (distancesToProperty.ContainsKey(offc)) { distancesToProperty[offc] = Vector3.Distance(5__2.FootPosition, groupPosition); } if (!(Vector3.Distance(5__2.FootPosition, groupPosition) < 5f) && !(5__4 >= 5__3)) { if (!5__2.HasDestination && 5__2.CanMove()) { DebugModule.Log("Officer does not have destination but can continue, reset", "MonitorTraversal"); ((NPC)offc.officer).Movement.SetDestination(groupPosition); if (5__2.IsPaused) { 5__2.ResumeMovement(); } } goto IL_007e; } DebugModule.Log("Officer arrived", "MonitorTraversal"); 5__2.EndSetDestination((WalkResult)4); officersArrived.Add(offc); OnArrivedAtProperty(offc); if (officersArrived.Count >= raidOfficersAlive) { DebugModule.Log("Last Officer arrived", "MonitorTraversal"); } } } return false; } <>1__state = -1; 5__2 = ((NPC)offc.officer).Movement; if (!distancesToProperty.ContainsKey(offc)) { distancesToProperty.Add(offc, Vector3.Distance(5__2.FootPosition, groupPosition)); } 5__3 = 130f; 5__4 = 0f; goto IL_007e; IL_007e: <>2__current = NACops.Wait05; <>1__state = 1; 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 d__45 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public WalkResult result; public RaidOfficer offc; public BuildableItem destroyTarget; public ERaidDestroyType type; public int targetInstanceID; private StorageEntity 5__2; private EAccessSettings 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; DebugModule.Log($"Walk to entity Ended: {result}", offc.Name); if ((int)result != 4) { if (!CanContinue(offc)) { DebugModule.Log("Officer interrupted during traverse to entity", "OnWalkToEntity"); RemoveToBeDestroyed(destroyTarget, type); return false; } DebugModule.Log("Officer failed traverse and can continue", offc.Name); RemoveToBeDestroyed(destroyTarget, type); BeginRoleAction(offc); return false; } <>2__current = NACops.Wait2; <>1__state = 1; return true; case 1: { <>1__state = -1; if (!CanContinue(offc)) { RemoveToBeDestroyed(destroyTarget, type); DebugModule.Log("Officer cant continue after waiting at entity", offc.Name); return false; } if ((Object)(object)destroyTarget == (Object)null || destroyTarget.IsDestroyed) { DebugModule.Log($"Destroy Target is null: {(Object)(object)destroyTarget == (Object)null}\nor IsDestroyed: {destroyTarget.IsDestroyed}", offc.Name); BeginRoleAction(offc); return false; } string name = ((BaseItemInstance)destroyTarget.ItemInstance).Name; switch (type) { case ERaidDestroyType.DestroyPot: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(Pot _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyShroomBed: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(MushroomBed _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyDryingRack: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(DryingRack _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyLabOven: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(LabOven _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyChemistryStation: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(ChemistryStation _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyCauldron: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(Cauldron _) { ResetEntityConfig(_.Configuration); }); break; case ERaidDestroyType.DestroyMixing: RaidPropertyEvent.Casted(destroyTarget, (Action)delegate(MixingStationMk2 _) { ResetEntityConfig(((MixingStation)_).Configuration); }); break; } if (offc.role != EOfficerRaidRole.SearchContainer) { if (offc.role != 0) { ((NPC)offc.officer).SetAnimationTrigger("GrabItem"); DestroyBuiltItem(destroyTarget, targetInstanceID); offc.destroyedItems++; offc.currentTargetObj = null; DebugModule.Log($"Succesfully Destroyed Target: {name} | Total: {offc.destroyedItems}", offc.Name); BeginRoleAction(offc); return false; } <>2__current = null; <>1__state = 4; return true; } ref StorageEntity reference = ref 5__2; BuildableItem obj = destroyTarget; reference = ((PlaceableStorageEntity)((obj is PlaceableStorageEntity) ? obj : null)).StorageEntity; if ((Object)(object)5__2 == (Object)null) { DebugModule.Log("Storage is null after arriving!", offc.Name); BeginRoleAction(offc); return false; } 5__3 = 5__2.AccessSettings; 5__2.AccessSettings = (EAccessSettings)0; 5__4 = 0; goto IL_04bb; } case 2: <>1__state = -1; if (!CanContinue(offc)) { 5__2.AccessSettings = 5__3; DebugModule.Log("Officer interrupted during storage emptying", offc.Name); return false; } if (!5__2.ItemSlots[5__4].IsLocked && 5__2.ItemSlots[5__4].ItemInstance != null && (int)((BaseItemDefinition)5__2.ItemSlots[5__4].ItemInstance.Definition).legalStatus != 0) { <>2__current = NACops.Wait05; <>1__state = 3; return true; } goto IL_04ab; case 3: <>1__state = -1; if (!CanContinue(offc)) { 5__2.AccessSettings = 5__3; DebugModule.Log("Officer interrupted during storage emptying", offc.Name); return false; } ((NPC)offc.officer).SetAnimationTrigger("GrabItem"); 5__2.ItemSlots[5__4].ClearItemInstanceRequested(); goto IL_04ab; case 4: { <>1__state = -1; return false; } IL_04bb: if (5__4 < 5__2.ItemSlots.Count) { <>2__current = NACops.Wait05; <>1__state = 2; return true; } 5__2.AccessSettings = 5__3; offc.destroyedItems++; offc.currentTargetObj = null; DebugModule.Log($"Succesfully Emptied Storage: {5__2.StorageEntityName} | Total: {offc.destroyedItems}", offc.Name); BeginRoleAction(offc); return false; IL_04ab: 5__4++; goto IL_04bb; } } 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 d__57 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Property property; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__57(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0508: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0401: 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_042b: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!NACops.registered) { return false; } if (!officersReady && raidActive) { fillRt.anchoredPosition = new Vector2(0f, 0f); handleRt.anchoredPosition = new Vector2(25f, 0f); float num2 = 0f; float num3 = 0f; if (distancesToProperty.Count > 0) { num3 = 5__2 * (float)distancesToProperty.Count; foreach (float value in distancesToProperty.Values) { num2 += value; } } float num4 = Mathf.Clamp01(num2 / num3); if (!(num4 < 0.05f)) { ((Graphic)sliderFillImage).color = new Color(1f, num4, num4); raidSlider.value = num4; goto IL_0517; } raidSlider.value = 0f; ((Graphic)sliderFillImage).color = Color.red; DebugModule.Log("Detected all arrived", "RaidNotification"); NACops.coros.Add(MelonCoroutines.Start(HighlightHomeIcon(homeImage))); NACops.coros.Add(MelonCoroutines.Start(FadeScaleIcon(handleGunImage))); } NACops.coros.Add(MelonCoroutines.Start(FadeUI(2f, 2.5f, fadeIn: false))); distancesToProperty.Clear(); return false; } <>1__state = -1; if ((Object)(object)raidSlider == (Object)null) { HUD val = Object.FindObjectOfType(); GameObject val2 = new GameObject("RaidSlider"); val2.SetActive(false); notificationGroup = val2.AddComponent(); val2.transform.SetParent(((Component)val.canvas).transform, false); raidSlider = val2.AddComponent(); raidSlider.maxValue = 1f; raidSlider.minValue = 0f; RectTransform component = val2.GetComponent(); component.anchoredPosition = new Vector2(0f, 350f); component.anchorMax = new Vector2(0.5f, 0.5f); component.anchorMin = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(600f, 30f); GameObject val3 = new GameObject("Fill", new Type[1] { typeof(Image) }); GameObject val4 = new GameObject("Handle", new Type[1] { typeof(Image) }); GameObject val5 = new GameObject("HomeIcon", new Type[1] { typeof(Image) }); GameObject val6 = new GameObject("Text", new Type[1] { typeof(TextMeshProUGUI) }); val3.transform.SetParent(((Component)raidSlider).transform); val4.transform.SetParent(((Component)raidSlider).transform); val5.transform.SetParent(((Component)raidSlider).transform); val6.transform.SetParent(((Component)raidSlider).transform); fillRt = val3.GetComponent(); raidSlider.fillRect = fillRt; sliderFillImage = val3.GetComponent(); fillRt.anchoredPosition3D = new Vector3(0f, 0f, 0f); fillRt.anchoredPosition = new Vector2(0f, 0f); fillRt.offsetMax = new Vector2(0f, -7.5f); fillRt.offsetMin = new Vector2(0f, 7.5f); fillRt.pivot = new Vector2(0.5f, 0.5f); fillRt.sizeDelta = new Vector2(0f, -15f); handleRt = val4.GetComponent(); raidSlider.handleRect = handleRt; handleGunImage = val4.GetComponent(); handleGunImage.overrideSprite = m1911Sprite; handleRt.anchoredPosition3D = new Vector3(25f, 0f, 0f); handleRt.anchoredPosition = new Vector2(25f, 0f); handleRt.offsetMax = new Vector2(50f, 12.5f); handleRt.offsetMin = new Vector2(0f, -12.5f); handleRt.sizeDelta = new Vector2(50f, 25f); RectTransform component2 = val5.GetComponent(); component2.anchoredPosition = new Vector2(-350f, 0f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.offsetMax = new Vector2(-325f, 25f); component2.offsetMin = new Vector2(-375f, -25f); component2.sizeDelta = new Vector2(50f, 50f); homeImage = val5.GetComponent(); homeImage.overrideSprite = homeSprite; RectTransform component3 = val6.GetComponent(); component3.anchoredPosition = new Vector2(0f, 30f); component3.anchorMax = new Vector2(0.5f, 0.5f); component3.anchorMin = new Vector2(0.5f, 0.5f); component3.offsetMax = new Vector2(300f, 55f); component3.offsetMin = new Vector2(-300f, 5f); component3.sizeDelta = new Vector2(600f, 50f); raidText = val6.GetComponent(); ((TMP_Text)raidText).fontSize = 20f; ((TMP_Text)raidText).alignment = (TextAlignmentOptions)258; ((TMP_Text)raidText).horizontalAlignment = (HorizontalAlignmentOptions)2; } raidSlider.value = 1f; ((Graphic)sliderFillImage).color = Color.white; ((TMP_Text)raidText).text = "The police are raiding " + property.PropertyName + "!"; NACops.coros.Add(MelonCoroutines.Start(FadeUI(4f, 2.5f, fadeIn: true))); 5__2 = Vector3.Distance(((NPC)currentRaidOfficers[0].officer).CenterPoint, currentRaidOfficers[0].targetProperty.NPCSpawnPoint.position); goto IL_0517; IL_0517: <>2__current = NACops.Wait05; <>1__state = 1; 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 d__49 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BuildableItem item; public bool containerNotSearched; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; lock (toBeDestroyedLock) { if ((Object)(object)item != (Object)null) { int instanceID = ((Object)item).GetInstanceID(); if (toBeDestroyed.Contains(instanceID)) { toBeDestroyed.Remove(instanceID); } if (containerNotSearched && searchedContainers.Contains(instanceID)) { searchedContainers.Remove(instanceID); } } } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__50 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ERaidDestroyType type; public BuildableItem item; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (type != 0) { <>2__current = RemoveToBeDestroyed(item, containerNotSearched: false); <>1__state = 1; return true; } <>2__current = RemoveToBeDestroyed(item, containerNotSearched: true); <>1__state = 2; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } 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(); } } [CompilerGenerated] private sealed class d__36 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Property property; private float 5__2; private int 5__3; private Transform 5__4; private List.Enumerator <>7__wrap4; private RaidOfficer 5__6; private Vector3 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__4 = null; <>7__wrap4 = default(List.Enumerator); 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; NACops.coros.Add(MelonCoroutines.Start(RaidNotification(property))); DebugModule.Log("Traverse Raid Cops", "TraverseCurrentToProperty"); 5__2 = 1.35f; 5__3 = 0; 5__4 = null; if (property.propertyCode == "manor") { 5__4 = ((Component)property).transform.Find("Manor Gate"); } else { 5__4 = property.NPCSpawnPoint; } <>7__wrap4 = currentRaidOfficers.GetEnumerator(); <>1__state = -3; goto IL_0247; case 1: <>1__state = -3; if (!NACops.registered) { result = false; <>m__Finally1(); break; } ((NPC)5__6.officer).Movement.ObstacleAvoidanceEnabled = true; ((NPC)5__6.officer).Movement.Agent.avoidancePriority = 10; ((NPC)5__6.officer).Movement.ResumeMovement(); ((NPC)5__6.officer).Movement.SetDestination(5__7, (Action)null, 4f, 5f); NACops.coros.Add(MelonCoroutines.Start(MonitorTraversal(5__6, 5__7))); 5__3++; 5__6 = null; goto IL_0247; case 2: { <>1__state = -1; result = false; break; } IL_0247: if (<>7__wrap4.MoveNext()) { 5__6 = <>7__wrap4.Current; Vector3 val = Vector3.zero; switch (5__3 % 4) { case 0: val = Vector3.forward; break; case 1: val = Vector3.right; break; case 2: val = Vector3.left; break; case 3: val = Vector3.back; break; } ((NPC)5__6.officer).Movement.GetClosestReachablePoint(5__4.position + val * 5__2, ref 5__7); DebugModule.Log(((object)(Vector3)(ref 5__7)).ToString(), "TraverseCurrentToProperty"); <>2__current = NACops.Wait1; <>1__state = 1; result = true; } else { <>m__Finally1(); <>7__wrap4 = default(List.Enumerator); <>2__current = null; <>1__state = 2; result = true; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap4).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__54 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; private <>c__DisplayClass54_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__54(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass54_0(); <>8__1.offc = offc; <>2__current = (object)new WaitUntil((Func)(() => !NACops.registered || <>8__1.offc == null || (Object)(object)<>8__1.offc.officer == (Object)null || ((NPC)<>8__1.offc.officer).Health.IsDead || ((NPC)<>8__1.offc.officer).Health.IsKnockedOut || (Object)(object)((NPC)<>8__1.offc.officer).Behaviour.activeBehaviour == (Object)null || ((Object)(object)((NPC)<>8__1.offc.officer).Behaviour.activeBehaviour != (Object)(object)((NPC)<>8__1.offc.officer).Behaviour.CombatBehaviour && (Object)(object)((NPC)<>8__1.offc.officer).Behaviour.activeBehaviour != (Object)(object)<>8__1.offc.officer.PursuitBehaviour))); <>1__state = 1; return true; case 1: <>1__state = -1; if (!NACops.registered) { return false; } DebugModule.Log("Combat ended or dead, despawn", <>8__1.offc.Name); if (<>8__1.offc != null && !deadRaidOfficers.Contains(<>8__1.offc)) { NACops.coros.Add(MelonCoroutines.Start(Despawn(<>8__1.offc))); } 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(); } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass31_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass31_0(); <>2__current = NACops.Wait5; <>1__state = 1; return true; case 1: <>1__state = -1; if (!NACops.registered) { return false; } <>2__current = (object)new WaitUntil((Func)(() => !NACops.isSaving && !Singleton.Instance.IsSaving)); <>1__state = 2; return true; case 2: <>1__state = -1; if (!NACops.registered) { return false; } <>2__current = NACops.Wait5; <>1__state = 3; return true; case 3: <>1__state = -1; if (!NACops.registered) { return false; } DebugModule.Log("Sleep ended Evaluate Raid", "WaitDayPass"); lock (NACops.heatConfigLock) { using (List.Enumerator enumerator = Property.OwnedProperties.GetEnumerator()) { while (enumerator.MoveNext()) { <>c__DisplayClass31_1 CS$<>8__locals0 = new <>c__DisplayClass31_1 { property = enumerator.Current }; PropertyHeat propertyHeat = NACops.heatConfig.Find((PropertyHeat x) => x.propertyCode == CS$<>8__locals0.property.propertyCode); if (propertyHeat != null) { propertyHeat.daysSinceLastRaid++; if (propertyHeat.propertyHeat > 12) { propertyHeat.propertyHeat--; } } } } <>8__1.currentHeats = new List(NACops.heatConfig); if (<>8__1.currentHeats == null) { DebugModule.Log("Failed to update heats", "WaitDayPass"); return false; } ListExtensions.Shuffle((IList)<>8__1.currentHeats, -1); <>8__1.selectedCode = string.Empty; <>c__DisplayClass31_2 CS$<>8__locals1 = new <>c__DisplayClass31_2(); CS$<>8__locals1.CS$<>8__locals1 = <>8__1; CS$<>8__locals1.i = CS$<>8__locals1.CS$<>8__locals1.currentHeats.Count - 1; while (CS$<>8__locals1.i >= 0) { if (CS$<>8__locals1.CS$<>8__locals1.currentHeats[CS$<>8__locals1.i].daysSinceLastRaid >= NACops.raidConfig.DaysUntilCanRaid && CS$<>8__locals1.CS$<>8__locals1.currentHeats[CS$<>8__locals1.i].propertyHeat >= NACops.raidConfig.PropertyHeatThreshold) { Property val = Property.OwnedProperties.Find((Property x) => x.PropertyCode == CS$<>8__locals1.CS$<>8__locals1.currentHeats[CS$<>8__locals1.i].propertyCode); if (IsPropertyValidForRaid(val)) { CS$<>8__locals1.CS$<>8__locals1.selectedCode = val.propertyCode; NACops.coros.Add(MelonCoroutines.Start(BeginRaidEvent(val))); break; } } CS$<>8__locals1.i--; } if (<>8__1.selectedCode != string.Empty) { PropertyHeat propertyHeat2 = NACops.heatConfig.Find((PropertyHeat x) => x.propertyCode == <>8__1.selectedCode); if (propertyHeat2 != null) { propertyHeat2.daysSinceLastRaid = 0; propertyHeat2.propertyHeat = 0; } } } <>2__current = null; <>1__state = 4; return true; case 4: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__46 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Func checkConsumed; public RaidOfficer offc; private int 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 15; 5__3 = 0; break; case 1: <>1__state = -1; if (checkConsumed()) { return false; } if (!NACops.registered) { return false; } 5__3 += 5; break; } if (5__3 < 5__2) { <>2__current = NACops.Wait5; <>1__state = 1; return true; } if (!checkConsumed()) { if ((Object)(object)offc.currentTargetObj != (Object)null && Vector3.Distance(((NPC)offc.officer).CenterPoint, ((Component)offc.currentTargetObj).transform.position) < 2f) { ((NPC)offc.officer).Movement.EndSetDestination((WalkResult)4); } else { ((NPC)offc.officer).Movement.EndSetDestination((WalkResult)1); } } 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(); } } [CompilerGenerated] private sealed class d__39 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RaidOfficer offc; private int 5__2; private int