Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of More Workers IL2Cpp v1.0.0
Khundian.S1.MoreWorkers-IL2Cpp.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; using Il2CppFishNet; using Il2CppFishNet.Managing; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.CharacterClasses; using Il2CppScheduleOne.Property; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using Khundian.S1.MoreWorkers; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.AI; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Khundian")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds in-game tools to author and adjust worker idle points per property, with visual markers, hotkeys, and support for extra hire locations like Motel Room, RV, and Sewer office, including in‑game movement of existing/default idle points.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6d3a2c4bce97cfcd364aafc69b9c83cb67129a6b")] [assembly: AssemblyProduct("Khundian.S1.MoreWorkers")] [assembly: AssemblyTitle("Khundian.S1.MoreWorkers-IL2Cpp")] [assembly: MelonInfo(typeof(MoreWorkersMod), "More Workers", "1.0.0", "Khundian", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyVersion("1.0.0.0")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Khundian.S1.MoreWorkers { internal static class AuthoringTools { private static object? _selectedInstance; private static string? _selectedName; private static int _selectedExistingIndex = -1; private static string? _selectedExistingProperty; private static int _selectedManualIndex = -1; private static string? _selectedManualProperty; private static int _selectedManualIdleIndex = -1; private static Texture2D? _bgTex; private const float MinManualIdleDistanceMeters = 0.25f; internal static int SelectedExistingIndex => _selectedExistingIndex; internal static string? SelectedExistingPropertyName => _selectedExistingProperty; internal static int SelectedManualIndex => _selectedManualIndex; internal static string? SelectedManualPropertyName => _selectedManualProperty; internal static int SelectedManualIdleIndex => _selectedManualIdleIndex; internal static void OnSceneLoaded() { _selectedInstance = null; _selectedName = null; _selectedExistingIndex = -1; _selectedExistingProperty = null; _selectedManualIndex = -1; _selectedManualProperty = null; _selectedManualIdleIndex = -1; } internal static void OnUpdate() { //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value || !MoreWorkersPreferences.EnableHotkeysEffective) { return; } MelonPreferences_Entry<KeyCode>? captureKey = MoreWorkersPreferences.CaptureKey; int num = ((captureKey == null) ? 290 : ((int)captureKey.Value)); MelonPreferences_Entry<KeyCode>? reloadKey = MoreWorkersPreferences.ReloadKey; num = ((reloadKey == null) ? 291 : ((int)reloadKey.Value)); KeyCode val = (KeyCode)num; MelonPreferences_Entry<KeyCode>? removeKey = MoreWorkersPreferences.RemoveKey; num = ((removeKey == null) ? 292 : ((int)removeKey.Value)); KeyCode val2 = (KeyCode)num; if (Input.GetKeyDown((KeyCode)num)) { if (IsClientOnly()) { Log.Msg("Authoring is host-only in multiplayer; ask the host to add idle points."); try { MoreWorkersSms.NotifyHostOnlyAuthoring(); return; } catch { return; } } _selectedInstance = null; _selectedName = null; if (!EnsureSelectionFromNearest()) { Log.Msg("No properties available for capture."); return; } Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { Log.Msg("Capture failed: no camera/player."); return; } Vector3 val3 = refTransform.position; Vector3 forward = refTransform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f) { forward = Vector3.forward; } float num2 = Mathf.Atan2(forward.x, forward.z) * 57.29578f; if (MoreWorkersPreferences.SnapToGroundEffective) { val3 = SnapToGroundPosition(val3, out var _); } object obj2 = _selectedInstance ?? TryResolveInstanceByName(_selectedName); if (obj2 != null && HasIdleWithinDistance(obj2, val3, 0.0625f)) { Log.Msg($"Cannot add idle point: too close (<{0.25f:F1}m) to an existing idle point for '{_selectedName}'."); try { MoreWorkersSms.NotifyIdlePointTooClose(_selectedName); return; } catch { return; } } if (ManualIdlePoints.AppendPoint(_selectedName, val3, num2)) { Log.Msg("Captured point -> '" + _selectedName + "'."); try { TryAppendLivePoint(_selectedInstance ?? TryResolveInstanceByName(_selectedName), val3, num2); } catch { } DebugMarkers.RebuildAll(); try { PropertyPatches.ReapplyCapacityForAll(); } catch { } } else { Log.Msg("Failed to append point for '" + _selectedName + "'."); } } if (Input.GetKeyDown(val)) { if (IsClientOnly()) { Log.Msg("Authoring reload is host-only in multiplayer; ask the host to refresh idle points."); try { MoreWorkersSms.NotifyHostOnlyAuthoring(); return; } catch { return; } } ManualIdlePoints.Reload(); DebugMarkers.RebuildAll(); _selectedInstance = null; _selectedName = null; try { EnsureSelectionFromNearest(); } catch { } Log.Msg("Reloaded points.json and rebuilt markers."); } if (Input.GetKeyDown(val2)) { if (IsClientOnly()) { Log.Msg("Authoring is host-only in multiplayer; ask the host to remove idle points."); try { MoreWorkersSms.NotifyHostOnlyAuthoring(); return; } catch { return; } } _selectedInstance = null; _selectedName = null; if (!EnsureSelectionFromNearest()) { Log.Msg("No properties available for remove."); return; } if (string.IsNullOrWhiteSpace(_selectedName)) { return; } string selectedName = _selectedName; object obj9 = _selectedInstance ?? TryResolveInstanceByName(selectedName); if (obj9 == null) { Log.Msg("Unable to resolve property instance for '" + selectedName + "'. Cannot remove idle point live."); return; } if (TryRemoveLastManualIdlePointLive(selectedName, obj9)) { DebugMarkers.RebuildAll(); try { PropertyPatches.ReapplyCapacityForAll(); } catch { } } } MelonPreferences_Entry<KeyCode>? overrideExistingKey = MoreWorkersPreferences.OverrideExistingKey; int num3 = ((overrideExistingKey == null) ? 289 : ((int)overrideExistingKey.Value)); bool flag = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); if (Input.GetKeyDown((KeyCode)num3)) { if (flag) { TrySelectIdlePoint(); } else { TryMoveSelectedIdlePoint(); } } } internal unsafe static void OnGUI() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_004d: 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_005e: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0379: 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_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Expected O, but got Unknown //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0356->IL0356: Incompatible stack types: Ref vs I4 //IL_0351->IL0356: Incompatible stack types: I4 vs Ref //IL_0351->IL0356: Incompatible stack types: Ref vs I4 //IL_037e->IL037e: Incompatible stack types: Ref vs I4 //IL_0379->IL037e: Incompatible stack types: I4 vs Ref //IL_0379->IL037e: Incompatible stack types: Ref vs I4 //IL_03a6->IL03a6: Incompatible stack types: Ref vs I4 //IL_03a1->IL03a6: Incompatible stack types: I4 vs Ref //IL_03a1->IL03a6: Incompatible stack types: Ref vs I4 MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value || !MoreWorkersPreferences.ShowOverlayHUDEffective) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } GUIStyle val = new GUIStyle(GUI.skin.label); val.fontSize = 20; val.normal.textColor = Color.white; GUIStyle val2 = new GUIStyle(val); val2.normal.textColor = new Color(0f, 0f, 0f, 0.6f); string text = _selectedName ?? "(None)"; Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 1E-06f) { ((Vector3)(ref forward)).Normalize(); } float value = Mathf.Atan2(forward.x, forward.z) * 57.29578f; string value2 = (MoreWorkersPreferences.SnapToGroundEffective ? "On" : "Off"); int num = 0; int num2 = 0; if (!string.IsNullOrWhiteSpace(_selectedName)) { num2 = ManualIdlePoints.GetForProperty(_selectedName)?.Count ?? 0; if (_selectedInstance != null) { num = GetExistingIdleCountFiltered(_selectedInstance, _selectedName); } else { Component val3 = TryResolveInstanceByName(_selectedName); if ((Object)(object)val3 != (Object)null) { num = GetExistingIdleCountFiltered(val3, _selectedName); } } } int value3 = num + num2; string value4 = string.Empty; DefaultInterpolatedStringHandler defaultInterpolatedStringHandler; if (_selectedManualIndex >= 0 && !string.IsNullOrWhiteSpace(_selectedManualProperty) && string.Equals(_selectedManualProperty, _selectedName, StringComparison.Ordinal)) { defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(19, 1); defaultInterpolatedStringHandler.AppendLiteral(" | Editing manual #"); defaultInterpolatedStringHandler.AppendFormatted(_selectedManualIndex); value4 = defaultInterpolatedStringHandler.ToStringAndClear(); } else if (_selectedExistingIndex >= 0 && !string.IsNullOrWhiteSpace(_selectedExistingProperty) && string.Equals(_selectedExistingProperty, _selectedName, StringComparison.Ordinal)) { defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(21, 1); defaultInterpolatedStringHandler.AppendLiteral(" | Editing existing #"); defaultInterpolatedStringHandler.AppendFormatted(_selectedExistingIndex); value4 = defaultInterpolatedStringHandler.ToStringAndClear(); } string text2 = "Authoring ON | Property: " + text; defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(27, 5); defaultInterpolatedStringHandler.AppendLiteral("Pos: "); defaultInterpolatedStringHandler.AppendFormatted(position.x, "F2"); defaultInterpolatedStringHandler.AppendLiteral(", "); defaultInterpolatedStringHandler.AppendFormatted(position.y, "F2"); defaultInterpolatedStringHandler.AppendLiteral(", "); defaultInterpolatedStringHandler.AppendFormatted(position.z, "F2"); defaultInterpolatedStringHandler.AppendLiteral(" | Yaw: "); defaultInterpolatedStringHandler.AppendFormatted(value, "F1"); defaultInterpolatedStringHandler.AppendLiteral("° | Snap: "); defaultInterpolatedStringHandler.AppendFormatted(value2); string text3 = defaultInterpolatedStringHandler.ToStringAndClear(); defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(32, 4); defaultInterpolatedStringHandler.AppendLiteral("Next idx: "); defaultInterpolatedStringHandler.AppendFormatted(value3); defaultInterpolatedStringHandler.AppendLiteral(" (existing "); defaultInterpolatedStringHandler.AppendFormatted(num); defaultInterpolatedStringHandler.AppendLiteral(" + manual "); defaultInterpolatedStringHandler.AppendFormatted(num2); defaultInterpolatedStringHandler.AppendLiteral(")"); defaultInterpolatedStringHandler.AppendFormatted(value4); string text4 = defaultInterpolatedStringHandler.ToStringAndClear(); defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(32, 3); defaultInterpolatedStringHandler.AppendLiteral("["); ref DefaultInterpolatedStringHandler reference = ref defaultInterpolatedStringHandler; MelonPreferences_Entry<KeyCode>? captureKey = MoreWorkersPreferences.CaptureKey; int num3; if (captureKey != null) { reference = ref *(DefaultInterpolatedStringHandler*)captureKey.Value; num3 = (int)(ref reference); } else { num3 = 290; reference = ref *(DefaultInterpolatedStringHandler*)num3; num3 = (int)(ref reference); } ((DefaultInterpolatedStringHandler*)num3)->AppendFormatted<KeyCode>((KeyCode)(ref reference)); defaultInterpolatedStringHandler.AppendLiteral("] Capture ["); ref DefaultInterpolatedStringHandler reference2 = ref defaultInterpolatedStringHandler; MelonPreferences_Entry<KeyCode>? reloadKey = MoreWorkersPreferences.ReloadKey; int num4; if (reloadKey != null) { reference2 = ref *(DefaultInterpolatedStringHandler*)reloadKey.Value; num4 = (int)(ref reference2); } else { num4 = 291; reference2 = ref *(DefaultInterpolatedStringHandler*)num4; num4 = (int)(ref reference2); } ((DefaultInterpolatedStringHandler*)num4)->AppendFormatted<KeyCode>((KeyCode)(ref reference2)); defaultInterpolatedStringHandler.AppendLiteral("] Reload ["); ref DefaultInterpolatedStringHandler reference3 = ref defaultInterpolatedStringHandler; MelonPreferences_Entry<KeyCode>? removeKey = MoreWorkersPreferences.RemoveKey; int num5; if (removeKey != null) { reference3 = ref *(DefaultInterpolatedStringHandler*)removeKey.Value; num5 = (int)(ref reference3); } else { num5 = 292; reference3 = ref *(DefaultInterpolatedStringHandler*)num5; num5 = (int)(ref reference3); } ((DefaultInterpolatedStringHandler*)num5)->AppendFormatted<KeyCode>((KeyCode)(ref reference3)); defaultInterpolatedStringHandler.AppendLiteral("] Remove"); string text5 = defaultInterpolatedStringHandler.ToStringAndClear(); float num6 = 10f; Rect safeArea = Screen.safeArea; float num7 = Mathf.Max(80f, ((Rect)(ref safeArea)).yMin + 40f); float num8 = (float)val.fontSize + 6f; string[] array = new string[4] { text2, text3, text4, text5 }; float num9 = 0f; for (int i = 0; i < array.Length; i++) { Vector2 val4 = val.CalcSize(new GUIContent(array[i])); if (val4.x > num9) { num9 = val4.x; } } safeArea = Screen.safeArea; float num10 = Mathf.Max(100f, ((Rect)(ref safeArea)).xMax - num6 - 10f); num9 = Mathf.Min(num9 + 2f, num10); float num11 = 6f; DrawOpaqueBackground(new Rect(num6 - num11, num7 - num11, num9 + num11 * 2f, num8 * (float)array.Length + num11 * 2f), new Color(0f, 0f, 0f, 0.6f)); DrawShadowedLabel(new Rect(num6, num7, num9, num8), text2, val, val2); num7 += num8; DrawShadowedLabel(new Rect(num6, num7, num9, num8), text3, val, val2); num7 += num8; DrawShadowedLabel(new Rect(num6, num7, num9, num8), text4, val, val2); num7 += num8; DrawShadowedLabel(new Rect(num6, num7, num9, num8), text5, val, val2); } private static void DrawShadowedLabel(Rect r, string text, GUIStyle style, GUIStyle shadow) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Rect val = r; ((Rect)(ref val)).x = ((Rect)(ref val)).x + 1f; ((Rect)(ref val)).y = ((Rect)(ref val)).y + 1f; GUI.Label(val, text, shadow); GUI.Label(r, text, style); } private static void DrawOpaqueBackground(Rect r, Color color) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_bgTex == (Object)null) { _bgTex = new Texture2D(1, 1, (TextureFormat)4, false); _bgTex.SetPixel(0, 0, Color.white); _bgTex.Apply(); } Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(r, (Texture)(object)_bgTex, (ScaleMode)0); GUI.color = color2; } catch { } } private static void TryMoveSelectedIdlePoint() { try { MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value) { return; } if (IsClientOnly()) { Log.Msg("Authoring is host-only in multiplayer; ask the host to move idle points."); try { MoreWorkersSms.NotifyHostOnlyAuthoring(); return; } catch { return; } } if (_selectedManualIndex >= 0 && !string.IsNullOrWhiteSpace(_selectedManualProperty)) { TryMoveSelectedManualIdlePoint(); } else if (_selectedExistingIndex >= 0 && !string.IsNullOrWhiteSpace(_selectedExistingProperty)) { TryMoveSelectedExistingIdlePoint(); } else { Log.Msg("No idle point selected. Use Shift+F8 to select one first."); } } catch { } } private static void TryAppendLivePoint(object? instanceObj, Vector3 pos, float yaw) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00c3: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if (instanceObj == null) { return; } try { Type type = instanceObj.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (!(((property != null) ? property.GetValue(instanceObj, null) : fieldInfo?.GetValue(instanceObj)) is Il2CppReferenceArray<Transform> val) || ((Il2CppArrayBase<Transform>)(object)val).Length == 0) { Component val2 = (Component)((instanceObj is Component) ? instanceObj : null); if ((Object)(object)val2 == (Object)null) { return; } Quaternion rotation = Quaternion.Euler(0f, yaw, 0f); Transform transform = new GameObject("EmployeeIdlePoint_0").transform; transform.SetParent(val2.transform, false); transform.position = pos; transform.rotation = rotation; try { if ((Object)(object)((Component)transform).gameObject != (Object)null) { ((Object)((Component)transform).gameObject).name = "EmployeeIdlePoint_0 (MW_MANUAL)"; } } catch { } Il2CppReferenceArray<Transform> val3 = new Il2CppReferenceArray<Transform>(1L); ((Il2CppArrayBase<Transform>)(object)val3)[0] = transform; if (property != null) { property.SetValue(instanceObj, val3, null); } else { fieldInfo.SetValue(instanceObj, val3); } return; } Transform val4 = null; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val).Length; i++) { Transform val5 = ((Il2CppArrayBase<Transform>)(object)val)[i]; if ((Object)(object)val5 != (Object)null) { val4 = val5; break; } } if ((Object)(object)val4 == (Object)null) { return; } Transform val6 = val4; for (int j = 0; j < ((Il2CppArrayBase<Transform>)(object)val).Length; j++) { Transform val7 = ((Il2CppArrayBase<Transform>)(object)val)[j]; if ((Object)(object)val7 != (Object)null) { Vector3 val8 = val7.position - pos; if (((Vector3)(ref val8)).sqrMagnitude <= 0.0625f) { return; } } } Quaternion val9 = Quaternion.Euler(0f, yaw, 0f); Transform val10 = Object.Instantiate<Transform>(val6, pos, val9); if ((Object)(object)val10 == (Object)null) { return; } Transform val11 = val10; try { if ((Object)(object)((Component)val11).gameObject != (Object)null) { GameObject gameObject = ((Component)val11).gameObject; GameObject gameObject2 = ((Component)val6).gameObject; ((Object)gameObject).name = (((gameObject2 != null) ? ((Object)gameObject2).name : null) ?? "IdlePoint") + " (MW_MANUAL)"; } } catch { } int length = ((Il2CppArrayBase<Transform>)(object)val).Length; Il2CppReferenceArray<Transform> val12 = new Il2CppReferenceArray<Transform>((long)(length + 1)); for (int k = 0; k < length; k++) { ((Il2CppArrayBase<Transform>)(object)val12)[k] = ((Il2CppArrayBase<Transform>)(object)val)[k]; } ((Il2CppArrayBase<Transform>)(object)val12)[length] = val10; if (property != null) { property.SetValue(instanceObj, val12, null); } else { fieldInfo.SetValue(instanceObj, val12); } } catch { } } private static int GetExistingIdleCount(object instance) { try { Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); return ((Il2CppArrayBase<Transform>)(object)(((property != null) ? property.GetValue(instance, null) : fieldInfo?.GetValue(instance)) as Il2CppReferenceArray<Transform>))?.Length ?? 0; } catch { return 0; } } private static int GetExistingIdleCountFiltered(object instance, string propertyName) { try { List<Vector3> idlePositions = GetIdlePositions(instance, excludeManualTagged: true); if (idlePositions == null || idlePositions.Count == 0) { return 0; } return idlePositions.Count; } catch { return 0; } } private static bool IsNearAny(in Vector3 pos, List<Vector3> list, float epsilon) { //IL_000a: 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_001a: Unknown result type (might be due to invalid IL or missing references) float num = epsilon * epsilon; for (int i = 0; i < list.Count; i++) { Vector3 val = list[i] - pos; if (((Vector3)(ref val)).sqrMagnitude <= num) { return true; } } return false; } private static void TryRaycastSelect() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) try { Camera main = Camera.main; RaycastHit val = default(RaycastHit); if ((Object)(object)main == (Object)null || !Physics.Raycast(main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)), ref val, 1000f, -1, (QueryTriggerInteraction)1)) { return; } Component val2 = FindPropertyComponentUpwards(((RaycastHit)(ref val)).transform); if ((Object)(object)val2 != (Object)null) { string propertyName = GetPropertyName(val2); if (!string.IsNullOrWhiteSpace(propertyName)) { _selectedInstance = val2; _selectedName = propertyName; Log.Msg("Selected property: '" + propertyName + "'."); } } } catch { } } private static void TrySelectIdlePoint() { //IL_018d: 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_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_0130: 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_042f: Unknown result type (might be due to invalid IL or missing references) try { MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value) { return; } _selectedInstance = null; _selectedName = null; if (!EnsureSelectionFromNearest()) { Log.Msg("No properties available to select an idle point."); } else { if (string.IsNullOrWhiteSpace(_selectedName)) { return; } string selectedName = _selectedName; object obj = _selectedInstance ?? TryResolveInstanceByName(selectedName); if (obj == null) { Log.Msg("Unable to resolve property instance for '" + selectedName + "'."); return; } Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { Log.Msg("Cannot select idle point: no camera/player reference available."); return; } int num = -1; float num2 = float.MaxValue; int num3 = -1; float num4 = float.MaxValue; try { Type type = obj.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (((property != null) ? property.GetValue(obj, null) : fieldInfo?.GetValue(obj)) is Il2CppReferenceArray<Transform> val && ((Il2CppArrayBase<Transform>)(object)val).Length > 0) { Vector3 position = refTransform.position; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val).Length; i++) { Transform val2 = ((Il2CppArrayBase<Transform>)(object)val)[i]; if ((Object)(object)val2 == (Object)null) { continue; } bool flag = false; try { GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject != (Object)null) { string name = ((Object)gameObject).name; if (!string.IsNullOrEmpty(name) && name.Contains("MW_MANUAL")) { flag = true; } } } catch { } float num5 = Vector3.Distance(position, val2.position); if (flag) { if (num5 < num2) { num2 = num5; num = i; } } else if (num5 < num4) { num4 = num5; num3 = i; } } } } catch { } int num6 = -1; if (num >= 0) { try { List<ManualIdlePoints.IdlePointWorld> forProperty = ManualIdlePoints.GetForProperty(selectedName); if (forProperty != null && forProperty.Count > 0) { Type type2 = obj.GetType(); BindingFlags bindingAttr2 = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property2 = type2.GetProperty("EmployeeIdlePoints", bindingAttr2); FieldInfo fieldInfo2 = ((property2 == null) ? type2.GetField("EmployeeIdlePoints", bindingAttr2) : null); if (((property2 != null) ? property2.GetValue(obj, null) : fieldInfo2?.GetValue(obj)) is Il2CppReferenceArray<Transform> val3 && num >= 0 && num < ((Il2CppArrayBase<Transform>)(object)val3).Length) { Transform val4 = ((Il2CppArrayBase<Transform>)(object)val3)[num]; if ((Object)(object)val4 != (Object)null) { Vector3 position2 = val4.position; float num7 = float.MaxValue; int num8 = -1; for (int j = 0; j < forProperty.Count; j++) { float num9 = Vector3.Distance(position2, forProperty[j].Position); if (num9 < num7) { num7 = num9; num8 = j; } } num6 = num8; } } } } catch { } } int num10 = -1; if (MoreWorkersPreferences.OverrideExistingIdlePointsEffective) { num10 = num3; } if (num6 >= 0 || num10 >= 0) { bool flag2; if (!MoreWorkersPreferences.OverrideExistingIdlePointsEffective) { flag2 = num6 >= 0; } else if (num6 >= 0 && num10 >= 0) { Vector3 position3 = refTransform.position; float num11 = float.MaxValue; float num12 = float.MaxValue; List<ManualIdlePoints.IdlePointWorld> forProperty2 = ManualIdlePoints.GetForProperty(selectedName); if (forProperty2 != null && num6 >= 0 && num6 < forProperty2.Count) { num11 = Vector3.Distance(position3, forProperty2[num6].Position); } try { Type type3 = obj.GetType(); BindingFlags bindingAttr3 = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property3 = type3.GetProperty("EmployeeIdlePoints", bindingAttr3); FieldInfo fieldInfo3 = ((property3 == null) ? type3.GetField("EmployeeIdlePoints", bindingAttr3) : null); if (((property3 != null) ? property3.GetValue(obj, null) : fieldInfo3?.GetValue(obj)) is Il2CppReferenceArray<Transform> val5 && num10 >= 0 && num10 < ((Il2CppArrayBase<Transform>)(object)val5).Length) { Transform val6 = ((Il2CppArrayBase<Transform>)(object)val5)[num10]; if ((Object)(object)val6 != (Object)null) { num12 = Vector3.Distance(position3, val6.position); } } } catch { } flag2 = num11 <= num12; } else { flag2 = num6 >= 0; } if (flag2 && num6 >= 0) { _selectedManualIndex = num6; _selectedManualProperty = selectedName; _selectedManualIdleIndex = num; _selectedExistingIndex = -1; _selectedExistingProperty = null; Log.Msg($"Selected manual idle point #{num6} for '{selectedName}'. Press F8 to move it."); } else { _selectedExistingIndex = num10; _selectedExistingProperty = selectedName; _selectedManualIndex = -1; _selectedManualProperty = null; Log.Msg($"Selected existing idle point #{num10} for '{selectedName}'. Press F8 to move it."); } try { DebugMarkers.RebuildAll(); return; } catch { return; } } Log.Msg("No idle points found for '" + selectedName + "' to edit."); _selectedExistingIndex = -1; _selectedExistingProperty = null; _selectedManualIndex = -1; _selectedManualProperty = null; _selectedManualIdleIndex = -1; } } catch { } } private static int FindNearestExistingIdleIndex(object instance, Vector3 refPos) { //IL_00cb: 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) try { Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (!(((property != null) ? property.GetValue(instance, null) : fieldInfo?.GetValue(instance)) is Il2CppReferenceArray<Transform> val) || ((Il2CppArrayBase<Transform>)(object)val).Length == 0) { return -1; } int result = -1; float num = float.MaxValue; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val).Length; i++) { Transform val2 = ((Il2CppArrayBase<Transform>)(object)val)[i]; if ((Object)(object)val2 == (Object)null) { continue; } try { GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject != (Object)null) { string name = ((Object)gameObject).name; if (!string.IsNullOrEmpty(name) && name.Contains("MW_MANUAL")) { continue; } } } catch { } float num2 = Vector3.Distance(refPos, val2.position); if (num2 < num) { num = num2; result = i; } } return result; } catch { return -1; } } private static int FindNearestManualIdleIndex(string propertyName, Vector3 refPos) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) try { List<ManualIdlePoints.IdlePointWorld> forProperty = ManualIdlePoints.GetForProperty(propertyName); if (forProperty == null || forProperty.Count == 0) { return -1; } int result = -1; float num = float.MaxValue; for (int i = 0; i < forProperty.Count; i++) { float num2 = Vector3.Distance(refPos, forProperty[i].Position); if (num2 < num) { num = num2; result = i; } } return result; } catch { return -1; } } private static void TryMoveSelectedExistingIdlePoint() { //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0377: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) try { MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value) { return; } if (IsClientOnly()) { Log.Msg("Authoring is host-only in multiplayer; ask the host to move existing idle points."); } else { if (!MoreWorkersPreferences.OverrideExistingIdlePointsEffective) { return; } if (_selectedExistingIndex < 0 || string.IsNullOrWhiteSpace(_selectedExistingProperty)) { Log.Msg("No existing idle point selected. Use Shift+F8 to select one first."); return; } string selectedExistingProperty = _selectedExistingProperty; object obj = _selectedInstance ?? TryResolveInstanceByName(selectedExistingProperty); if (obj == null) { Log.Msg("Unable to resolve property instance for '" + selectedExistingProperty + "'."); _selectedExistingIndex = -1; _selectedExistingProperty = null; return; } Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { Log.Msg("Cannot move existing idle point: no camera/player reference available."); return; } Vector3 val = refTransform.position; Vector3 forward = refTransform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f) { forward = Vector3.forward; } float num = Mathf.Atan2(forward.x, forward.z) * 57.29578f; if (MoreWorkersPreferences.SnapToGroundEffective) { val = SnapToGroundPosition(val, out var _); } try { Type type = obj.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (((property != null) ? property.GetValue(obj, null) : fieldInfo?.GetValue(obj)) is Il2CppReferenceArray<Transform> val2 && ((Il2CppArrayBase<Transform>)(object)val2).Length > 0) { float num2 = 0.0625f; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val2).Length; i++) { if (i == _selectedExistingIndex) { continue; } Transform val3 = ((Il2CppArrayBase<Transform>)(object)val2)[i]; if (!((Object)(object)val3 == (Object)null)) { Vector3 val4 = val3.position - val; if (((Vector3)(ref val4)).sqrMagnitude <= num2) { Log.Msg($"Cannot move existing idle point #{_selectedExistingIndex} for '{selectedExistingProperty}': too close (<{0.25f:F1}m) to another idle point."); return; } } } } } catch { } if (!ManualIdlePoints.UpsertExistingOverride(selectedExistingProperty, _selectedExistingIndex, val, num)) { Log.Msg($"Failed to update existing idle point #{_selectedExistingIndex} for '{selectedExistingProperty}'."); return; } try { Type type2 = obj.GetType(); BindingFlags bindingAttr2 = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property2 = type2.GetProperty("EmployeeIdlePoints", bindingAttr2); FieldInfo fieldInfo2 = ((property2 == null) ? type2.GetField("EmployeeIdlePoints", bindingAttr2) : null); if (((property2 != null) ? property2.GetValue(obj, null) : fieldInfo2?.GetValue(obj)) is Il2CppReferenceArray<Transform> val5 && _selectedExistingIndex >= 0 && _selectedExistingIndex < ((Il2CppArrayBase<Transform>)(object)val5).Length) { Transform val6 = ((Il2CppArrayBase<Transform>)(object)val5)[_selectedExistingIndex]; if ((Object)(object)val6 != (Object)null) { val6.position = val; val6.rotation = Quaternion.Euler(0f, num, 0f); } } } catch { } Log.Msg($"Moved existing idle point #{_selectedExistingIndex} for '{selectedExistingProperty}'."); _selectedExistingIndex = -1; _selectedExistingProperty = null; DebugMarkers.RebuildAll(); } } catch { } } private static void TryMoveSelectedManualIdlePoint() { //IL_0253: 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) //IL_00a9: 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_00b0: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) try { MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value) { return; } if (_selectedManualIndex < 0 || string.IsNullOrWhiteSpace(_selectedManualProperty) || _selectedManualIdleIndex < 0) { Log.Msg("No manual idle point selected. Use Shift+F8 to select one first."); return; } string selectedManualProperty = _selectedManualProperty; object obj = _selectedInstance ?? TryResolveInstanceByName(selectedManualProperty); if (obj == null) { Log.Msg("Unable to resolve property instance for '" + selectedManualProperty + "'."); _selectedManualIndex = -1; _selectedManualProperty = null; return; } Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { Log.Msg("Cannot move manual idle point: no camera/player reference available."); return; } Vector3 val = refTransform.position; Vector3 forward = refTransform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f) { forward = Vector3.forward; } float num = Mathf.Atan2(forward.x, forward.z) * 57.29578f; if (MoreWorkersPreferences.SnapToGroundEffective) { val = SnapToGroundPosition(val, out var _); } try { Type type = obj.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (((property != null) ? property.GetValue(obj, null) : fieldInfo?.GetValue(obj)) is Il2CppReferenceArray<Transform> val2 && ((Il2CppArrayBase<Transform>)(object)val2).Length > 0) { float num2 = 0.0625f; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val2).Length; i++) { Transform val3 = ((Il2CppArrayBase<Transform>)(object)val2)[i]; if (!((Object)(object)val3 == (Object)null) && i != _selectedManualIdleIndex) { Vector3 val4 = val3.position - val; if (((Vector3)(ref val4)).sqrMagnitude <= num2) { Log.Msg($"Cannot move manual idle point #{_selectedManualIndex} for '{selectedManualProperty}': too close (<{0.25f:F1}m) to another idle point."); return; } } } } } catch { } if (!ManualIdlePoints.UpdateManualPoint(selectedManualProperty, _selectedManualIndex, val, num)) { Log.Msg($"Failed to update manual idle point #{_selectedManualIndex} for '{selectedManualProperty}'."); return; } try { Type type2 = obj.GetType(); BindingFlags bindingAttr2 = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property2 = type2.GetProperty("EmployeeIdlePoints", bindingAttr2); FieldInfo fieldInfo2 = ((property2 == null) ? type2.GetField("EmployeeIdlePoints", bindingAttr2) : null); if (((property2 != null) ? property2.GetValue(obj, null) : fieldInfo2?.GetValue(obj)) is Il2CppReferenceArray<Transform> val5 && ((Il2CppArrayBase<Transform>)(object)val5).Length > 0 && _selectedManualIdleIndex >= 0 && _selectedManualIdleIndex < ((Il2CppArrayBase<Transform>)(object)val5).Length) { Transform val6 = ((Il2CppArrayBase<Transform>)(object)val5)[_selectedManualIdleIndex]; if ((Object)(object)val6 != (Object)null) { val6.position = val; val6.rotation = Quaternion.Euler(0f, num, 0f); } } } catch { } Log.Msg($"Moved manual idle point #{_selectedManualIndex} for '{selectedManualProperty}'."); _selectedManualIndex = -1; _selectedManualProperty = null; _selectedManualIdleIndex = -1; DebugMarkers.RebuildAll(); } catch { } } private static bool HasIdleWithinDistance(object instance, Vector3 pos, float minSqr) { //IL_0085: 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_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) try { Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (!(((property != null) ? property.GetValue(instance, null) : fieldInfo?.GetValue(instance)) is Il2CppReferenceArray<Transform> val) || ((Il2CppArrayBase<Transform>)(object)val).Length == 0) { return false; } for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val).Length; i++) { Transform val2 = ((Il2CppArrayBase<Transform>)(object)val)[i]; if (!((Object)(object)val2 == (Object)null)) { Vector3 val3 = val2.position - pos; if (((Vector3)(ref val3)).sqrMagnitude <= minSqr) { return true; } } } } catch { } return false; } private static bool IsClientOnly() { try { NetworkManager networkManager = InstanceFinder.NetworkManager; if ((Object)(object)networkManager == (Object)null) { return false; } return networkManager.IsClient && !networkManager.IsServer; } catch { return false; } } private static bool TryRemoveLastManualIdlePointLive(string propertyName, object instance) { if (string.IsNullOrWhiteSpace(propertyName)) { return false; } try { List<ManualIdlePoints.IdlePointWorld> forProperty = ManualIdlePoints.GetForProperty(propertyName); if (forProperty == null || forProperty.Count == 0) { Log.Msg("No manual points to remove for '" + propertyName + "'."); return false; } Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); if (!(((property != null) ? property.GetValue(instance, null) : fieldInfo?.GetValue(instance)) is Il2CppReferenceArray<Transform> val) || ((Il2CppArrayBase<Transform>)(object)val).Length == 0) { Log.Msg("Property '" + propertyName + "' has no live idle points; cannot remove idle point in this scene."); return false; } int num = -1; Transform val2 = null; for (int num2 = ((Il2CppArrayBase<Transform>)(object)val).Length - 1; num2 >= 0; num2--) { Transform val3 = ((Il2CppArrayBase<Transform>)(object)val)[num2]; if (!((Object)(object)val3 == (Object)null)) { bool flag = false; try { GameObject gameObject = ((Component)val3).gameObject; if ((Object)(object)gameObject != (Object)null) { string name = ((Object)gameObject).name; if (!string.IsNullOrEmpty(name) && name.Contains("MW_MANUAL")) { flag = true; } } } catch { } if (flag) { num = num2; val2 = val3; break; } } } if (num < 0 || (Object)(object)val2 == (Object)null) { Log.Msg("No MW_MANUAL idle transform found to remove for '" + propertyName + "'."); return false; } if (IsIdlePointInUseByEmployees(instance, val2)) { Log.Msg("Cannot remove idle point for '" + propertyName + "': an employee is assigned to it."); try { MoreWorkersSms.NotifyIdlePointInUse(propertyName); } catch { } return false; } if (!ManualIdlePoints.PopLast(propertyName)) { Log.Msg("Failed to update points.json while removing idle point for '" + propertyName + "'."); return false; } Il2CppReferenceArray<Transform> val4 = val; _ = ((Il2CppArrayBase<Transform>)(object)val4).Length; _ = 1; Il2CppReferenceArray<Transform> val5 = new Il2CppReferenceArray<Transform>((long)(((Il2CppArrayBase<Transform>)(object)val4).Length - 1)); int num3 = 0; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val4).Length; i++) { if (i != num) { ((Il2CppArrayBase<Transform>)(object)val5)[num3++] = ((Il2CppArrayBase<Transform>)(object)val4)[i]; } } if (property != null) { property.SetValue(instance, val5, null); } else { fieldInfo.SetValue(instance, val5); } try { GameObject gameObject2 = ((Component)val2).gameObject; if ((Object)(object)gameObject2 != (Object)null) { Object.Destroy((Object)(object)gameObject2); } } catch { } Log.Msg("Removed last manual idle point for '" + propertyName + "' (live + JSON)."); return true; } catch { return false; } } private static bool IsIdlePointInUseByEmployees(object propertyInstance, Transform candidate) { if (propertyInstance == null || (Object)(object)candidate == (Object)null) { return false; } try { Type type = propertyInstance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("Employees", bindingAttr); if (property == null) { return false; } object value = property.GetValue(propertyInstance, null); if (value == null) { return false; } if (value is IEnumerable enumerable) { foreach (object item in enumerable) { if (item != null) { Transform val = TryGetIdlePointForEmployee(item); if (!((Object)(object)val == (Object)null) && (Object)(object)val == (Object)(object)candidate) { return true; } } } return false; } Type type2 = value.GetType(); PropertyInfo property2 = type2.GetProperty("Count", bindingAttr); PropertyInfo property3 = type2.GetProperty("Item", bindingAttr, null, null, new Type[1] { typeof(int) }, null); if (property2 == null || property3 == null) { return false; } int num = 0; try { num = (int)(property2.GetValue(value, null) ?? ((object)0)); } catch { } if (num <= 0) { return false; } for (int i = 0; i < num; i++) { object obj2 = null; try { obj2 = property3.GetValue(value, new object[1] { i }); } catch { } if (obj2 != null) { Transform val2 = TryGetIdlePointForEmployee(obj2); if (!((Object)(object)val2 == (Object)null) && (Object)(object)val2 == (Object)(object)candidate) { return true; } } } } catch { } return false; } private static Transform? TryGetIdlePointForEmployee(object empObj) { if (empObj == null) { return null; } try { Type type = empObj.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("WaitOutside", bindingAttr); if (property == null) { return null; } object value = property.GetValue(empObj, null); if (value == null) { return null; } PropertyInfo property2 = value.GetType().GetProperty("IdlePoint", bindingAttr); if (property2 == null) { return null; } object? value2 = property2.GetValue(value, null); return (Transform?)((value2 is Transform) ? value2 : null); } catch { return null; } } private static void TrySelectNearestFromIndex() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) try { Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { return; } PropertyIndex.Entry[] array = PropertyIndex.Snapshot(); if (array.Length == 0) { return; } string text = null; Component selectedInstance = null; float num = float.MaxValue; foreach (PropertyIndex.Entry entry in array) { float num2 = float.MaxValue; if (entry.IdlePoints != null && entry.IdlePoints.Length != 0) { for (int j = 0; j < entry.IdlePoints.Length; j++) { float num3 = Vector3.Distance(refTransform.position, entry.IdlePoints[j]); if (num3 < num2) { num2 = num3; } } } else { num2 = Vector3.Distance(refTransform.position, entry.Anchor); } if (num2 < num) { num = num2; text = entry.Name; object? instance = entry.Instance; selectedInstance = (Component)((instance is Component) ? instance : null); } } if (!string.IsNullOrWhiteSpace(text)) { _selectedName = text; _selectedInstance = selectedInstance; } } catch { } } private static bool EnsureSelectionFromNearest() { //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) if (!string.IsNullOrWhiteSpace(_selectedName)) { return true; } Transform refTransform = GetRefTransform(); if ((Object)(object)refTransform == (Object)null) { return false; } PropertyIndex.Entry[] array = PropertyIndex.Snapshot(); if (array.Length != 0) { string text = null; Component selectedInstance = null; float num = float.MaxValue; foreach (PropertyIndex.Entry entry in array) { float num2 = float.MaxValue; if (entry.IdlePoints != null && entry.IdlePoints.Length != 0) { for (int j = 0; j < entry.IdlePoints.Length; j++) { float num3 = Vector3.Distance(refTransform.position, entry.IdlePoints[j]); if (num3 < num2) { num2 = num3; } } } else { num2 = Vector3.Distance(refTransform.position, entry.Anchor); } if (num2 < num) { num = num2; text = entry.Name; object? instance = entry.Instance; selectedInstance = (Component)((instance is Component) ? instance : null); } } if (!string.IsNullOrWhiteSpace(text)) { _selectedName = text; _selectedInstance = selectedInstance; return true; } } Type type = ResolvePropertyType(); if (type == null) { return false; } Component selectedInstance2 = null; string text2 = null; float num4 = float.MaxValue; foreach (object item in EnumerateProperties(type)) { string text3 = null; try { Component val = (Component)((item is Component) ? item : null); text3 = (((Object)(object)val != (Object)null) ? GetPropertyName(val) : GetPropertyNameViaObject(item)); } catch { } if (!string.IsNullOrWhiteSpace(text3)) { float num5 = DistanceToProperty(refTransform.position, item); if (num5 < num4) { num4 = num5; text2 = text3; selectedInstance2 = (Component)((item is Component) ? item : null); } } } if (!string.IsNullOrWhiteSpace(text2)) { _selectedInstance = selectedInstance2; _selectedName = text2; return true; } return false; } private static Transform? GetRefTransform() { try { GameObject val = GameObject.FindWithTag("Player") ?? GameObject.FindWithTag("LocalPlayer"); if ((Object)(object)val != (Object)null) { return val.transform; } } catch { } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { return ((Component)main).transform; } return null; } private static string? GetPropertyNameViaObject(object inst) { try { Type type = inst.GetType(); PropertyInfo property = type.GetProperty("PropertyName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value = property.GetValue(inst, null); return (value as string) ?? value?.ToString(); } FieldInfo field = type.GetField("PropertyName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value2 = field.GetValue(inst); return (value2 as string) ?? value2?.ToString(); } } catch { } return null; } private static Vector3? TryGetAnchor(object inst) { //IL_0016: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00bc: 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_00df: Unknown result type (might be due to invalid IL or missing references) try { Component val = (Component)((inst is Component) ? inst : null); if ((Object)(object)val != (Object)null) { return val.transform.position; } Type type = inst.GetType(); PropertyInfo property = type.GetProperty("EmployeeIdlePoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) : null); if (((property != null) ? property.GetValue(inst) : fieldInfo?.GetValue(inst)) is Il2CppReferenceArray<Transform> val2 && ((Il2CppArrayBase<Transform>)(object)val2).Length > 0) { Vector3 val3 = Vector3.zero; int num = 0; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val2).Length; i++) { Transform val4 = ((Il2CppArrayBase<Transform>)(object)val2)[i]; if ((Object)(object)val4 != (Object)null) { val3 += val4.position; num++; } } if (num > 0) { return val3 / (float)num; } } } catch { } return null; } private static List<Vector3>? GetIdlePositions(object inst, bool excludeManualTagged = false) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) try { Type type = inst.GetType(); PropertyInfo property = type.GetProperty("EmployeeIdlePoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) : null); if (((property != null) ? property.GetValue(inst) : fieldInfo?.GetValue(inst)) is Il2CppReferenceArray<Transform> val && ((Il2CppArrayBase<Transform>)(object)val).Length > 0) { List<Vector3> list = new List<Vector3>(((Il2CppArrayBase<Transform>)(object)val).Length); for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)val).Length; i++) { Transform val2 = ((Il2CppArrayBase<Transform>)(object)val)[i]; if ((Object)(object)val2 == (Object)null) { continue; } if (excludeManualTagged) { try { GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject != (Object)null) { string name = ((Object)gameObject).name; if (!string.IsNullOrEmpty(name) && name.Contains("MW_MANUAL")) { continue; } } } catch { } } list.Add(val2.position); } return list; } } catch { } return null; } private static float DistanceToProperty(Vector3 refPos, object? inst) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (inst == null) { return float.MaxValue; } try { List<Vector3> idlePositions = GetIdlePositions(inst, excludeManualTagged: true); if (idlePositions != null && idlePositions.Count > 0) { float num = float.MaxValue; for (int i = 0; i < idlePositions.Count; i++) { float num2 = Vector3.Distance(refPos, idlePositions[i]); if (num2 < num) { num = num2; } } return num; } Component val = (Component)((inst is Component) ? inst : null); if ((Object)(object)val != (Object)null) { return Vector3.Distance(refPos, val.transform.position); } Vector3? val2 = TryGetAnchor(inst); if (val2.HasValue) { return Vector3.Distance(refPos, val2.Value); } } catch { } return float.MaxValue; } private static void TrySelectNearestToCamera() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00cf: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) try { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 1E-06f) { ((Vector3)(ref forward)).Normalize(); } Type type = ResolvePropertyType(); if (type == null) { return; } float num = -1f; float num2 = float.MaxValue; Component val = null; float num3 = float.MaxValue; Component val2 = null; foreach (object item in EnumerateProperties(type)) { Component val3 = (Component)((item is Component) ? item : null); if ((Object)(object)val3 == (Object)null) { continue; } Vector3 val4 = val3.transform.position - position; float magnitude = ((Vector3)(ref val4)).magnitude; if (!(magnitude <= 0.0001f)) { Vector3 val5 = val4 / magnitude; val5.y = 0f; if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { ((Vector3)(ref val5)).Normalize(); } float num4 = Vector3.Dot(val5, forward); if (magnitude < num3) { num3 = magnitude; val2 = val3; } if (num4 > 0.35f && ((Object)(object)val == (Object)null || magnitude < num2 || (Mathf.Approximately(magnitude, num2) && num4 > num))) { val = val3; num2 = magnitude; num = num4; } } } Component val6 = val ?? val2; if ((Object)(object)val6 != (Object)null) { string propertyName = GetPropertyName(val6); if (!string.IsNullOrWhiteSpace(propertyName)) { _selectedInstance = val6; _selectedName = propertyName; Log.Msg("Selected nearest property: '" + propertyName + "'."); } } } catch { } } private static Type? ResolvePropertyType() { return FindTypeByNames("ScheduleOne.Property.Property", "Il2CppScheduleOne.Property.Property"); } private static Component? TryResolveInstanceByName(string name) { try { PropertyIndex.Entry[] array = PropertyIndex.Snapshot(); for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i].Name, name, StringComparison.OrdinalIgnoreCase)) { object? instance = array[i].Instance; Component val = (Component)((instance is Component) ? instance : null); if ((Object)(object)val != (Object)null) { return val; } } } } catch { } try { Type type = ResolvePropertyType(); if (type == null) { return null; } foreach (object item in EnumerateProperties(type)) { Component val2 = (Component)((item is Component) ? item : null); string text = (((Object)(object)val2 != (Object)null) ? GetPropertyName(val2) : GetPropertyNameViaObject(item)); if (!string.IsNullOrWhiteSpace(text) && string.Equals(text, name, StringComparison.OrdinalIgnoreCase)) { return val2; } } } catch { } return null; } private static Type? FindTypeByNames(params string[] names) { try { string[] array = names; for (int i = 0; i < array.Length; i++) { Type type = Type.GetType(array[i], throwOnError: false); if (type != null) { return type; } } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { array = names; foreach (string name in array) { Type type2 = assembly.GetType(name, throwOnError: false); if (type2 != null) { return type2; } } } } catch { } return null; } private static IEnumerable<object> EnumerateProperties(Type type) { object obj = null; try { BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo fieldInfo = type.GetField("Properties", bindingAttr) ?? type.GetField("OwnedProperties", bindingAttr); if (fieldInfo != null) { obj = fieldInfo.GetValue(null); } if (obj == null) { PropertyInfo propertyInfo = type.GetProperty("Properties", bindingAttr) ?? type.GetProperty("OwnedProperties", bindingAttr); if (propertyInfo != null) { obj = propertyInfo.GetValue(null, null); } } } catch { } if (!(obj is IEnumerable enumerable)) { yield break; } foreach (object item in enumerable) { if (item != null) { yield return item; } } } private static Component? FindPropertyComponentUpwards(Transform t) { Transform val = t; int num = 0; while ((Object)(object)val != (Object)null && num < 12) { Component[] array; try { array = Il2CppArrayBase<Component>.op_Implicit(((Component)val).GetComponents<Component>()); } catch { array = Array.Empty<Component>(); } Component[] array2 = array; foreach (Component val2 in array2) { if ((Object)(object)val2 == (Object)null) { continue; } try { if (!string.IsNullOrWhiteSpace(GetPropertyName(val2))) { return val2; } } catch { } } val = val.parent; num++; } return null; } private static string? GetPropertyName(Component c) { try { Type type = ((object)c).GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; object obj = null; PropertyInfo property = type.GetProperty("PropertyName", bindingAttr); if (property != null) { obj = property.GetValue(c, null); } else { FieldInfo field = type.GetField("PropertyName", bindingAttr); if (field != null) { obj = field.GetValue(c); } } string text = obj as string; if (text == null && obj != null) { text = obj.ToString(); } return text; } catch { return null; } } private static Vector3 SnapToGroundPosition(Vector3 pos, out bool onNav) { //IL_009a: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) onNav = false; try { float num = Math.Max(0.1f, MoreWorkersPreferences.SnapRadiusMetersEffective); NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, num, -1)) { onNav = true; return ((NavMeshHit)(ref val)).position; } RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(pos + Vector3.up * 2f, Vector3.down), ref val2, 10f, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point + Vector3.up * 0.02f; } return new Vector3(pos.x, pos.y + 0.02f, pos.z); } catch { return pos; } } } internal static class DebugMarkers { private const string GlobalRootName = "MoreWorkers_DebugMarkers_Global"; private const string LocalRootName = "MoreWorkers_DebugMarkers"; private static Material? _matExisting; private static Material? _matManualOk; private static Material? _matManualBad; private static Material? _matHighlight; private static readonly Color ExistingColor = new Color(0.2f, 0.6f, 1f, 0.85f); private static readonly Color ManualOkColor = new Color(0.2f, 0.9f, 0.3f, 0.9f); private static readonly Color ManualBadColor = new Color(1f, 0.25f, 0.25f, 0.95f); private static readonly Color HighlightColor = new Color(1f, 0.95f, 0.25f, 0.95f); private static void EnsureMaterials() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!Need(_matExisting) && !Need(_matManualOk) && !Need(_matManualBad) && !Need(_matHighlight)) { return; } Shader val = Shader.Find("Unlit/Color"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Standard"); } if (!((Object)(object)val == (Object)null)) { if (Need(_matExisting)) { _matExisting = new Material(val); _matExisting.color = ExistingColor; } if (Need(_matManualOk)) { _matManualOk = new Material(val); _matManualOk.color = ManualOkColor; } if (Need(_matManualBad)) { _matManualBad = new Material(val); _matManualBad.color = ManualBadColor; } if (Need(_matHighlight)) { _matHighlight = new Material(val); _matHighlight.color = HighlightColor; } } static bool Need(Material? m) { return (Object)(object)m == (Object)null; } } public static int RebuildAll() { try { MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value) { ClearAll(); return 0; } if (!MoreWorkersPreferences.VisualizeIdlePointsEffective) { ClearAll(); return 0; } int num = 0; PropertyIndex.Entry[] array = PropertyIndex.Snapshot(); HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); int num2 = 0; int num3 = 0; int num4 = 0; Type type = ResolvePropertyType(); if (type != null) { foreach (object item in EnumerateProperties(type)) { if (item != null) { DrawForInstance(item, type); string text = SafeGet<string>(item, type, "PropertyName"); if (!string.IsNullOrWhiteSpace(text)) { hashSet.Add(text); } num2++; } } num += num2; } if (array != null && array.Length != 0) { foreach (PropertyIndex.Entry entry in array) { if (entry == null) { continue; } object? instance = entry.Instance; Component val = (Component)((instance is Component) ? instance : null); if ((Object)(object)val == (Object)null) { continue; } string text2 = SafeGet<string>(val, ((object)val).GetType(), "PropertyName") ?? entry.Name; if (string.IsNullOrWhiteSpace(text2) || !hashSet.Contains(text2)) { DrawForInstance(val); if (!string.IsNullOrWhiteSpace(text2)) { hashSet.Add(text2); } num3++; } } num += num3; foreach (PropertyIndex.Entry entry2 in array) { if (entry2 != null && !(entry2.Instance is Component)) { string name = entry2.Name; if (!string.IsNullOrWhiteSpace(name) && !hashSet.Contains(name)) { DrawForNameOnly(name, entry2.IdlePoints); hashSet.Add(name); num4++; } } } } if (num2 + num3 == 0) { int num5 = ProbeSceneAndDraw(hashSet); num += num5; if (num > 0) { return num; } } if (num > 0) { return num; } if (type == null) { type = ResolvePropertyType(); } if (type == null) { return 0; } foreach (object item2 in EnumerateProperties(type)) { DrawForInstance(item2, type); num++; } return num; } catch (Exception value) { Log.Warning($"Marker rebuild failed: {value}"); return 0; } } public static void ClearAll() { try { GameObject val = GameObject.Find("MoreWorkers_DebugMarkers_Global"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } try { Il2CppArrayBase<Transform> val2 = Object.FindObjectsOfType<Transform>(true); for (int i = 0; i < val2.Length; i++) { Transform val3 = val2[i]; if (!((Object)(object)val3 == (Object)null) && string.Equals(((Object)val3).name, "MoreWorkers_DebugMarkers", StringComparison.Ordinal)) { for (int num = val3.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)val3.GetChild(num)).gameObject); } Object.Destroy((Object)(object)((Component)val3).gameObject); } } } catch { } } catch (Exception value) { Log.Warning($"Marker clear failed: {value}"); } } public static void DrawForInstance(object instance) { DrawForInstance(instance, instance.GetType()); } private static void DrawForInstance(object instance, Type type) { //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0595: 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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_048c: 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) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: 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_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: 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_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) MelonPreferences_Entry<bool>? authoringMode = MoreWorkersPreferences.AuthoringMode; if (authoringMode == null || !authoringMode.Value || !MoreWorkersPreferences.VisualizeIdlePointsEffective) { return; } EnsureMaterials(); string text = SafeGet<string>(instance, type, "PropertyName") ?? "(unknown)"; Transform orCreateParent = GetOrCreateParent(instance, text); for (int num = orCreateParent.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)orCreateParent.GetChild(num)).gameObject); } List<Vector3> list = null; List<ManualIdlePoints.IdlePointWorld> forProperty = ManualIdlePoints.GetForProperty(text); if (forProperty != null && forProperty.Count > 0) { list = new List<Vector3>(forProperty.Count); for (int i = 0; i < forProperty.Count; i++) { Vector3 val = forProperty[i].Position; if (MoreWorkersPreferences.SnapToGroundEffective) { val = SnapToGroundPosition(val, out var _); } list.Add(val); } } int num2 = 0; Vector3 anchor = default(Vector3); bool flag = false; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo property = type.GetProperty("EmployeeIdlePoints", bindingAttr); FieldInfo fieldInfo = ((property == null) ? type.GetField("EmployeeIdlePoints", bindingAttr) : null); Il2CppReferenceArray<Transform> val2 = ((property != null) ? property.GetValue(instance) : fieldInfo?.GetValue(instance)) as Il2CppReferenceArray<Transform>; Quaternion rotation; if (val2 != null) { int num3 = 0; for (int j = 0; j < ((Il2CppArrayBase<Transform>)(object)val2).Length; j++) { Transform val3 = ((Il2CppArrayBase<Transform>)(object)val2)[j]; if ((Object)(object)val3 == (Object)null) { continue; } bool flag2 = false; try { GameObject gameObject = ((Component)val3).gameObject; if ((Object)(object)gameObject != (Object)null) { string name = ((Object)gameObject).name; if (!string.IsNullOrEmpty(name) && name.Contains("MW_MANUAL")) { flag2 = true; } } } catch { } if (!flag2 && (list == null || !IsNearAny(val3.position, list, 0.08f))) { bool flag3 = AuthoringTools.SelectedExistingIndex == j && !string.IsNullOrWhiteSpace(AuthoringTools.SelectedExistingPropertyName) && string.Equals(AuthoringTools.SelectedExistingPropertyName, text, StringComparison.Ordinal); if ((Object)(object)_matExisting != (Object)null) { Material mat = (flag3 ? (_matHighlight ?? _matExisting) : _matExisting); Vector3 pos = val3.position + Vector3.up * 0.05f; rotation = val3.rotation; MakeMarker(orCreateParent, pos, Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f), mat); } if (MoreWorkersPreferences.ShowIndexLabelsEffective) { Color color = (flag3 ? HighlightColor : ExistingColor); MakeLabel(orCreateParent, val3.position + Vector3.up * 0.35f, j, color); } if (!flag && (Object)(object)val3 != (Object)null) { anchor = val3.position; flag = true; } num3++; } } num2 = num3; } int num4 = 0; if (val2 != null) { for (int k = 0; k < ((Il2CppArrayBase<Transform>)(object)val2).Length; k++) { Transform val4 = ((Il2CppArrayBase<Transform>)(object)val2)[k]; if ((Object)(object)val4 == (Object)null) { continue; } bool flag4 = false; try { GameObject gameObject2 = ((Component)val4).gameObject; if ((Object)(object)gameObject2 != (Object)null) { string name2 = ((Object)gameObject2).name; if (!string.IsNullOrEmpty(name2) && name2.Contains("MW_MANUAL")) { flag4 = true; } } } catch { } if (flag4) { Vector3 val5 = val4.position; bool onNav2 = false; if (MoreWorkersPreferences.SnapToGroundEffective) { val5 = SnapToGroundPosition(val5, out onNav2); } Material val6 = (onNav2 ? _matManualOk : _matManualBad); bool flag5 = AuthoringTools.SelectedManualIdleIndex >= 0 && !string.IsNullOrWhiteSpace(AuthoringTools.SelectedManualPropertyName) && string.Equals(AuthoringTools.SelectedManualPropertyName, text, StringComparison.Ordinal) && AuthoringTools.SelectedManualIdleIndex == k; Color val7 = (onNav2 ? ManualOkColor : ManualBadColor); Color color2 = (flag5 ? HighlightColor : val7); if ((Object)(object)val6 != (Object)null) { Material mat2 = (Material)(flag5 ? ((object)(_matHighlight ?? val6)) : ((object)val6)); Vector3 pos2 = val5 + Vector3.up * 0.05f; rotation = val4.rotation; MakeMarker(orCreateParent, pos2, Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f), mat2); } if (MoreWorkersPreferences.ShowIndexLabelsEffective) { int index = num2 + num4; MakeLabel(orCreateParent, val5 + Vector3.up * 0.35f, index, color2); } if (!flag) { anchor = val5; flag = true; } num4++; } } } else if (forProperty != null) { foreach (ManualIdlePoints.IdlePointWorld item in forProperty) { Vector3 val8 = item.Position; bool onNav3 = false; if (MoreWorkersPreferences.SnapToGroundEffective) { val8 = SnapToGroundPosition(val8, out onNav3); } Material val9 = (onNav3 ? _matManualOk : _matManualBad); if ((Object)(object)val9 != (Object)null) { Vector3 pos3 = val8 + Vector3.up * 0.05f; rotation = item.Rotation; MakeMarker(orCreateParent, pos3, Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f), val9); } if (MoreWorkersPreferences.ShowIndexLabelsEffective) { int index2 = num2 + num4; Color color3 = (onNav3 ? ManualOkColor : ManualBadColor); MakeLabel(orCreateParent, val8 + Vector3.up * 0.35f, index2, color3); } if (!flag) { anchor = val8; flag = true; } num4++; } } if (!flag) { Component val10 = (Component)((instance is Component) ? instance : null); if ((Object)(object)val10 != (Object)null) { anchor = val10.transform.position; flag = true; } } if (!flag) { return; } Vector3[] array = null; if (val2 != null && ((Il2CppArrayBase<Transform>)(object)val2).Length > 0) { List<Vector3> list2 = new List<Vector3>(((Il2CppArrayBase<Transform>)(object)val2).Length); for (int l = 0; l < ((Il2CppArrayBase<Transform>)(object)val2).Length; l++) { Transform val11 = ((Il2CppArrayBase<Transform>)(object)val2)[l]; if ((Object)(object)val11 != (Object)null) { list2.Add(val11.position); } } array = list2.ToArray(); } if (array == null && forProperty != null && forProperty.Count > 0) { List<Vector3> list3 = new List<Vector3>(forProperty.Count); foreach (ManualIdlePoints.IdlePointWorld item2 in forProperty) { list3.Add(item2.Position); } array = list3.ToArray(); } PropertyIndex.Register(instance, text, anchor, array); } private static void DrawForNameOnly(string propertyName, Vector3[]? existingPoints) { //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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or m