Decompiled source of Straftat CMR v1.0.1
StraftatCMR.dll
Decompiled 15 hours 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using FishNet.Object; using HarmonyLib; using StraftatCMR.Patches; using StraftatCMR.SDK; using StraftatCMR.Utils; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("StraftatModsNKM")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StraftatModsNKM")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ae8d4ff5-7e0d-4526-9d74-9156aba82e03")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace StraftatCMR { public class DevConsole : MonoBehaviour { private bool showConsole = false; private string input = ""; private Vector2 scroll; private List<string> logs = new List<string>(); private List<string> commandHistory = new List<string>(); private int historyIndex = -1; private string currentInput = ""; private Rect consoleRect = new Rect(10f, 10f, 1800f, 1200f); private bool inputFocused = false; private string controlName = "ConsoleInput"; private GUIStyle scrollViewStyle; private GUIStyle labelStyle; private GUIStyle boxStyle; private bool stylesInitialized = false; private float totalContentHeight = 0f; private bool forceScrollToBottom = false; private static DevConsole instance; private ManualLogSource logger; private List<string> availableCommands; private int inputControlID; private bool forceCursorToEnd = false; private void Awake() { instance = this; logger = Logger.CreateLogSource("DevConsole"); Logger.Listeners.Add((ILogListener)(object)new ConsoleLogListener()); SimpleObjectFinder.Initialize(logger); AddLog("[CONSOLE] Dev Console initialized. Press ~ to toggle."); InitializeCommands(); } private void InitializeCommands() { availableCommands = new List<string> { "clear", "help", "history", "echo", "fps", "scene", "objects", "clientid", "ownerid", "hostid", "prefabs", "disable_mods_popout", "cmr_findhiddenobject" }; availableCommands.Sort(); } private void Update() { if (((ButtonControl)Keyboard.current.backquoteKey).wasPressedThisFrame) { showConsole = !showConsole; if (showConsole) { inputFocused = true; forceCursorToEnd = true; } } if (showConsole && ((ButtonControl)Keyboard.current.enterKey).wasPressedThisFrame && !string.IsNullOrEmpty(input)) { HandleCommand(input); input = ""; historyIndex = -1; currentInput = ""; inputFocused = true; forceCursorToEnd = true; } if (showConsole) { if (((ButtonControl)Keyboard.current.upArrowKey).wasPressedThisFrame) { NavigateHistory(-1); forceCursorToEnd = true; Event.current.Use(); } else if (((ButtonControl)Keyboard.current.downArrowKey).wasPressedThisFrame) { NavigateHistory(1); forceCursorToEnd = true; Event.current.Use(); } else if (((ButtonControl)Keyboard.current.tabKey).wasPressedThisFrame) { AutoCompleteCommand(); forceCursorToEnd = true; Event.current.Use(); } } } private void OnGUI() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (showConsole) { consoleRect = GUI.Window(1234, consoleRect, new WindowFunction(ConsoleWindow), "Straftat Dev Console"); } } private void InitializeStyles() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown if (!stylesInitialized) { scrollViewStyle = new GUIStyle(GUI.skin.scrollView); labelStyle = new GUIStyle(GUI.skin.label) { wordWrap = true, alignment = (TextAnchor)0, fontSize = 24 }; boxStyle = new GUIStyle(GUI.skin.box) { fontSize = 20 }; stylesInitialized = true; } } private void ConsoleWindow(int windowID) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_002e: Invalid comparison between Unknown and I4 //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01cf: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Invalid comparison between Unknown and I4 //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Invalid comparison between Unknown and I4 //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown InitializeStyles(); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); Rect rect = GUILayoutUtility.GetRect(1760f, 1000f); if ((int)Event.current.type == 7) { float num = 0f; foreach (string log in logs) { float num2 = labelStyle.CalcHeight(new GUIContent(log), 1720f); num += num2; } totalContentHeight = num; if (forceScrollToBottom) { scroll.y = Mathf.Max(0f, totalContentHeight - 1000f); forceScrollToBottom = false; } } scroll = GUI.BeginScrollView(rect, scroll, new Rect(0f, 0f, 1720f, totalContentHeight), false, totalContentHeight > 1000f); float num3 = 0f; Rect val = default(Rect); for (int i = 0; i < logs.Count; i++) { float num4 = labelStyle.CalcHeight(new GUIContent(logs[i]), 1720f); ((Rect)(ref val))..ctor(0f, num3, 1720f, num4); GUI.Label(val, logs[i], labelStyle); num3 += num4; } GUI.EndScrollView(); GUILayout.Space(20f); inputControlID = GUIUtility.GetControlID((FocusType)1); GUI.SetNextControlName(controlName); GUIStyle val2 = new GUIStyle(GUI.skin.textField) { fontSize = 24 }; input = GUILayout.TextField(input, val2, Array.Empty<GUILayoutOption>()); if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 13 && GUI.GetNameOfFocusedControl() == controlName) { ExecuteCommand(); Event.current.Use(); } GUILayout.EndVertical(); if (inputFocused) { GUI.FocusControl(controlName); inputFocused = false; } if ((int)Event.current.type == 7 && GUIUtility.keyboardControl == inputControlID && forceCursorToEnd) { TextEditor val3 = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), inputControlID); if (val3 != null) { val3.cursorIndex = val3.text.Length; val3.selectIndex = val3.text.Length; val3.OnFocus(); } forceCursorToEnd = false; } GUI.DragWindow(); } private void ExecuteCommand() { if (!string.IsNullOrEmpty(input)) { HandleCommand(input); input = ""; historyIndex = -1; currentInput = ""; inputFocused = true; forceCursorToEnd = true; } } private void NavigateHistory(int direction) { if (commandHistory.Count != 0) { if (historyIndex == -1) { currentInput = input; } historyIndex += direction; if (historyIndex < -1) { historyIndex = -1; } else if (historyIndex >= commandHistory.Count) { historyIndex = commandHistory.Count - 1; } if (historyIndex == -1) { input = currentInput; } else { input = commandHistory[commandHistory.Count - 1 - historyIndex]; } inputFocused = true; forceCursorToEnd = true; } } private void AutoCompleteCommand() { if (string.IsNullOrWhiteSpace(input)) { AddLog("[AUTOCOMPLETE] Доступные команды: " + string.Join(", ", availableCommands)); inputFocused = true; forceCursorToEnd = true; return; } string currentPartialCommand = input.ToLower().Trim(); List<string> list = availableCommands.Where((string cmd) => cmd.StartsWith(currentPartialCommand)).ToList(); if (list.Count == 1) { input = list[0]; inputFocused = true; forceCursorToEnd = true; } else if (list.Count > 1) { AddLog("[AUTOCOMPLETE] Варианты: " + string.Join(", ", list)); string longestCommonPrefix = GetLongestCommonPrefix(list); if (longestCommonPrefix.Length > currentPartialCommand.Length) { input = longestCommonPrefix; } inputFocused = true; forceCursorToEnd = true; } else { AddLog("[AUTOCOMPLETE] Совпадений не найдено."); inputFocused = true; forceCursorToEnd = true; } } private string GetLongestCommonPrefix(List<string> words) { if (words == null || words.Count == 0) { return ""; } if (words.Count == 1) { return words[0]; } string text = words[0]; for (int i = 1; i < words.Count; i++) { while (words[i].IndexOf(text, StringComparison.OrdinalIgnoreCase) != 0) { text = text.Substring(0, text.Length - 1); if (string.IsNullOrEmpty(text)) { return ""; } } } return text; } private FirstPersonController GetPlayerController() { GameObject val = FindPlayerWithOwnerId(); if ((Object)(object)val == (Object)null) { AddLog("[ERROR] Игрок с подходящим OwnerId не найден."); return null; } FirstPersonController component = val.GetComponent<FirstPersonController>(); if ((Object)(object)component == (Object)null) { AddLog("[ERROR] FirstPersonController не найден на игроке."); return null; } return component; } private void SetPlayerGravity(float value) { FirstPersonController playerController = GetPlayerController(); if ((Object)(object)playerController != (Object)null) { FieldInfo field = typeof(FirstPersonController).GetField("gravity", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(playerController, value); AddLog($"[SUCCESS] Гравитация установлена: {value}"); } else { AddLog("[ERROR] Поле gravity не найдено."); } } } private void TogglePlayerFly() { FirstPersonController playerController = GetPlayerController(); if ((Object)(object)playerController != (Object)null) { FieldInfo field = typeof(FirstPersonController).GetField("flymode", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { bool flag = (bool)field.GetValue(playerController); field.SetValue(playerController, !flag); AddLog("[SUCCESS] Режим полета: " + ((!flag) ? "включен" : "выключен")); } else { AddLog("[ERROR] Поле flymode не найдено."); } } } private void SetPlayerSprintSpeed(float value) { FirstPersonController playerController = GetPlayerController(); if ((Object)(object)playerController != (Object)null) { FieldInfo field = typeof(FirstPersonController).GetField("sprintSpeed", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(playerController, value); AddLog($"[SUCCESS] Скорость бега установлена: {value}"); } else { AddLog("[ERROR] Поле sprintSpeed не найдено."); } } } private void SetPlayerWalkSpeed(float value) { FirstPersonController playerController = GetPlayerController(); if ((Object)(object)playerController != (Object)null) { FieldInfo field = typeof(FirstPersonController).GetField("walkSpeed", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(playerController, value); AddLog($"[SUCCESS] Скорость ходьбы установлена: {value}"); } else { AddLog("[ERROR] Поле walkSpeed не найдено."); } } } private void HandleCommand(string cmd) { //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(cmd)) { return; } AddLog("> " + cmd); if (commandHistory.Count == 0 || commandHistory[commandHistory.Count - 1] != cmd) { commandHistory.Add(cmd); if (commandHistory.Count > 50) { commandHistory.RemoveAt(0); } } string[] array = cmd.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { return; } string text = array[0].ToLower(); switch (text) { case "prefabs": ListAvailablePrefabs(); break; case "clear": logs.Clear(); AddLog("[CONSOLE] Логи очищены"); break; case "help": ShowHelp(); break; case "history": ShowHistory(); break; case "echo": if (array.Length > 1) { AddLog(string.Join(" ", array.Skip(1))); } break; case "fps": ShowFPS(); break; case "scene": { Scene activeScene = SceneManager.GetActiveScene(); AddLog("[INFO] Текущая сцена: " + ((Scene)(ref activeScene)).name); break; } case "objects": if (array.Length > 1) { FindObjects(array[1]); } else { AddLog("[CMD] Использование: objects <имя>"); } break; case "clientid": case "ownerid": case "hostid": AddLog($"[INFO] Static CLIENT_HOST_ID: {StraftatRebalance.ClientHostId}"); break; case "disable_mods_popout": if (array.Length > 1) { if (bool.TryParse(array[1], out var result)) { SetDisableModsPopout(result); break; } AddLog("[ERROR] Используйте true или false"); AddLog("[CMD] Пример: disable_mods_popout true"); } else { AddLog($"[INFO] disable_mods_popout: {StraftatRebalance.disableModsPopout}"); AddLog("[CMD] Использование: disable_mods_popout <true/false>"); } break; case "cmr_findhiddenobject": if (array.Length > 1) { string text2 = string.Join(" ", array.Skip(1)); AddLog("[CMR] Ищем объект: '" + text2 + "'"); SimpleObjectFinder.FindObjectsByName(text2); } else { AddLog("[CMR] Использование: cmr_findhiddenobject <имя_объекта>"); AddLog("[CMR] Пример: cmr_findhiddenobject weapon"); AddLog("[CMR] Пример: cmr_findhiddenobject glock"); AddLog("[CMR] Пример: cmr_findhiddenobject AR15"); } break; default: AddLog("[ERROR] Неизвестная команда: " + text + ". Введите 'help' для списка команд."); break; } } private void SetDisableModsPopout(bool value) { StraftatRebalance.disableModsPopout = value; PlayerPrefs.SetInt("CMR_DisableModsPopout", value ? 1 : 0); PlayerPrefs.Save(); if (value) { DestroyModsPopup(); AddLog("[SUCCESS] disable_mods_popout включен. Попап модов будет удален при обнаружении."); } else { AddLog("[SUCCESS] disable_mods_popout выключен."); } } public static void DestroyModsPopup() { //IL_0004: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) try { Scene val = default(Scene); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (((Scene)(ref sceneAt)).name == "DontDestroyOnLoad") { val = sceneAt; break; } } if (!((Scene)(ref val)).IsValid()) { AddLog("[WARNING] Сцена DontDestroyOnLoad не найдена. Поиск во всех объектах..."); GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array2 = array; foreach (GameObject val2 in array2) { if (((Object)val2).name == "InfoPopup" && (Object)(object)val2.transform.parent != (Object)null && ((Object)val2.transform.parent).name == "--PopupWriting--") { Object.DestroyImmediate((Object)(object)val2); AddLog("[SUCCESS] InfoPopup удален (глобальный поиск)."); return; } } AddLog("[WARNING] InfoPopup не найден."); return; } GameObject[] rootGameObjects = ((Scene)(ref val)).GetRootGameObjects(); GameObject[] array3 = rootGameObjects; foreach (GameObject val3 in array3) { if (!(((Object)val3).name == "---USER INTERFACE---")) { continue; } Transform val4 = val3.transform.Find("--PopupWriting--"); if ((Object)(object)val4 != (Object)null) { Transform val5 = val4.Find("InfoPopup"); if ((Object)(object)val5 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val5).gameObject); AddLog("[SUCCESS] InfoPopup удален из DontDestroyOnLoad."); return; } } } AddLog("[WARNING] InfoPopup не найден по пути ---USER INTERFACE---/--PopupWriting--/InfoPopup"); } catch (Exception ex) { AddLog("[ERROR] Ошибка при удалении InfoPopup: " + ex.Message); } } private void SpawnPrefabByInstanceId(int instanceId) { //IL_005e: 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_0066: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) //IL_0095: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = FindPlayerWithOwnerId(); if ((Object)(object)val == (Object)null) { AddLog("[ERROR] Игрок с подходящим OwnerId не найден или вы не являетесь владельцем."); return; } GameObject val2 = FindPrefabInHideAndDontSave(instanceId); if ((Object)(object)val2 == (Object)null) { AddLog($"[ERROR] Префаб с Instance ID {instanceId} не найден в сцене HideAndDontSave."); return; } Vector3 position = val.transform.position; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(position.x, position.y + 3f, position.z); Scene scene = val.scene; GameObject val4 = Object.Instantiate<GameObject>(val2); if (val4.scene != scene) { SceneManager.MoveGameObjectToScene(val4, scene); } val4.transform.position = val3; AddLog($"[SUCCESS] Заспавнен префаб {((Object)val2).name} (ID: {instanceId}) в позиции {val3}"); AddLog("[INFO] Объект перемещен в сцену: " + ((Scene)(ref scene)).name); } catch (Exception ex) { AddLog("[ERROR] Ошибка при спавне префаба: " + ex.Message); logger.LogError((object)$"SpawnPrefabByInstanceId exception: {ex}"); } } private GameObject FindPlayerWithOwnerId() { GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name == "PlayerIK(Clone)") { NetworkBehaviour component = val.GetComponent<NetworkBehaviour>(); if ((Object)(object)component != (Object)null && component.OwnerId == StraftatRebalance.ClientHostId) { AddLog($"[INFO] Найден игрок {((Object)val).name} с OwnerId: {component.OwnerId}"); return val; } } } AddLog($"[WARNING] Игрок PlayerIK(Clone) с OwnerId = {StraftatRebalance.ClientHostId} не найден"); return null; } private GameObject FindPrefabInHideAndDontSave(int instanceId) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002e: Unknown result type (might be due to invalid IL or missing references) Scene val = default(Scene); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (((Scene)(ref sceneAt)).name == "HideAndDontSave") { val = sceneAt; break; } } if (!((Scene)(ref val)).IsValid()) { AddLog("[WARNING] Сцена HideAndDontSave не найдена. Ищем во всех сценах..."); GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array2 = array; foreach (GameObject val2 in array2) { if (((Object)val2).GetInstanceID() == instanceId) { AddLog($"[INFO] Найден префаб {((Object)val2).name} с Instance ID: {instanceId} (глобальный поиск)"); return val2; } } return null; } GameObject[] rootGameObjects = ((Scene)(ref val)).GetRootGameObjects(); GameObject[] array3 = rootGameObjects; foreach (GameObject obj in array3) { GameObject val3 = FindGameObjectByInstanceIdRecursive(obj, instanceId); if ((Object)(object)val3 != (Object)null) { AddLog($"[INFO] Найден префаб {((Object)val3).name} с Instance ID: {instanceId} в сцене HideAndDontSave"); return val3; } } return null; } private GameObject FindGameObjectByInstanceIdRecursive(GameObject obj, int targetInstanceId) { if (((Object)obj).GetInstanceID() == targetInstanceId) { return obj; } for (int i = 0; i < obj.transform.childCount; i++) { GameObject gameObject = ((Component)obj.transform.GetChild(i)).gameObject; GameObject val = FindGameObjectByInstanceIdRecursive(gameObject, targetInstanceId); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void ListAvailablePrefabs() { //IL_0004: 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_002f: 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) try { Scene val = default(Scene); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (((Scene)(ref sceneAt)).name == "HideAndDontSave") { val = sceneAt; break; } } if (!((Scene)(ref val)).IsValid()) { AddLog("[ERROR] Сцена HideAndDontSave не найдена."); return; } AddLog("[PREFABS] Доступные префабы в сцене HideAndDontSave:"); GameObject[] rootGameObjects = ((Scene)(ref val)).GetRootGameObjects(); List<string> list = new List<string>(); GameObject[] array = rootGameObjects; foreach (GameObject obj in array) { CollectPrefabsRecursive(obj, list); } if (list.Count == 0) { AddLog("[INFO] В сцене HideAndDontSave префабы не найдены."); return; } list.Sort((string a, string b) => a.CompareTo(b)); foreach (string item in list) { AddLog(" " + item); } AddLog($"[INFO] Всего найдено префабов: {list.Count}"); } catch (Exception ex) { AddLog("[ERROR] Ошибка при получении списка префабов: " + ex.Message); logger.LogError((object)$"ListAvailablePrefabs exception: {ex}"); } } private void CollectPrefabsRecursive(GameObject obj, List<string> prefabList) { string item = $"{((Object)obj).name} (ID: {((Object)obj).GetInstanceID()})"; prefabList.Add(item); for (int i = 0; i < obj.transform.childCount; i++) { GameObject gameObject = ((Component)obj.transform.GetChild(i)).gameObject; CollectPrefabsRecursive(gameObject, prefabList); } } private void ShowHelp() { AddLog("[HELP] Доступные команды:"); AddLog(" prefabs - Показать все доступные префабы в HideAndDontSave с их ID"); AddLog(" clear - Очистить консоль"); AddLog(" help - Показать эту справку"); AddLog(" history - Показать историю команд"); AddLog(" echo <текст> - Вывести текст"); AddLog(" fps - Показать текущий FPS"); AddLog(" scene - Показать текущую сцену"); AddLog(" objects <имя> - Найти объекты по имени"); AddLog(" clientid/hostid/ownerid - Показать CLIENT_HOST_ID"); AddLog(" disable_mods_popout <true/false> - Отключить попап модов (сохраняется)"); AddLog(" cmr_findhiddenobject <имя> - Найти объект всеми способами"); } private void ShowHistory() { if (commandHistory.Count == 0) { AddLog("[HISTORY] История команд пуста"); return; } AddLog("[HISTORY] Последние команды:"); for (int i = Math.Max(0, commandHistory.Count - 10); i < commandHistory.Count; i++) { AddLog($" {i + 1}: {commandHistory[i]}"); } } private void ShowFPS() { float num = 1f / Time.deltaTime; AddLog($"[INFO] FPS: {num:F1}"); } private void FindObjects(string name) { //IL_0053: 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) GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); IEnumerable<GameObject> enumerable = source.Where((GameObject obj) => ((Object)obj).name.ToLower().Contains(name.ToLower())).Take(20); int num = 0; foreach (GameObject item in enumerable) { string name2 = ((Object)item).name; Scene scene = item.scene; AddLog($" {name2} (Scene: {((Scene)(ref scene)).name}) ID: {((Object)item).GetInstanceID()}"); num++; } if (num == 0) { AddLog("[INFO] Объекты с именем '" + name + "' не найдены"); } else { AddLog($"[INFO] Найдено объектов: {num} (показаны первые 20)"); } } public static void AddLog(string message) { if ((Object)(object)instance != (Object)null) { string text = DateTime.Now.ToString("HH:mm:ss"); instance.logs.Add("[" + text + "] " + message); if (instance.logs.Count > 1000) { instance.logs.RemoveAt(0); } instance.forceScrollToBottom = true; } } private void OnDestroy() { if (Logger.Listeners == null) { return; } List<ConsoleLogListener> list = Logger.Listeners.OfType<ConsoleLogListener>().ToList(); foreach (ConsoleLogListener item in list) { Logger.Listeners.Remove((ILogListener)(object)item); } } } public class ConsoleLogListener : ILogListener, IDisposable { public void LogEvent(object sender, LogEventArgs eventArgs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((int)eventArgs.Level >= 16) { LogLevel level = eventArgs.Level; string arg = ((object)(LogLevel)(ref level)).ToString().ToUpper(); ILogSource source = eventArgs.Source; string arg2 = ((source != null) ? source.SourceName : null) ?? "Unknown"; DevConsole.AddLog($"[{arg}] [{arg2}] {eventArgs.Data}"); } } public void Dispose() { } } internal class FirstPersonControllerMonitorAimPatch { [HarmonyPatch(typeof(FirstPersonController))] internal class FirstPersonControllerUpdatePatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void Postfix(FirstPersonController __instance) { //IL_028f: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)__instance).GetInstanceID(); bool isScopeAiming = __instance.isScopeAiming; NetworkBehaviour component = ((Component)__instance).GetComponent<NetworkBehaviour>(); if ((Object)(object)component == (Object)null || !component.IsClient || !component.IsOwner) { return; } bool isFastFireMode = _currentFireMode.ContainsKey(instanceID) && _currentFireMode[instanceID]; if (!_previousAimingStates.TryGetValue(instanceID, out var value)) { _previousAimingStates[instanceID] = isScopeAiming; _currentFireMode[instanceID] = false; ApplyHKAimStats(__instance, isScopeAiming, _currentFireMode[instanceID]); if ((Object)(object)_modeSwitchSound == (Object)null) { LoadEmbeddedAudioClip("StraftatCMR.Audio.SwitchMode.wav"); } UpdateModeTextVisibilityAndContent(component.IsClient && component.IsOwner, isHKG11EquippedAndOwned: false, _currentFireMode[instanceID]); return; } if (isScopeAiming != value) { ApplyHKAimStats(__instance, isScopeAiming, _currentFireMode[instanceID]); _previousAimingStates[instanceID] = isScopeAiming; } GameObject val = null; Transform val2 = ((Component)__instance).transform; while ((Object)(object)val2 != (Object)null) { if (((Object)val2).name.Equals("PlayerIK(Clone)")) { val = ((Component)val2).gameObject; break; } val2 = val2.parent; } Weapon val3 = null; if ((Object)(object)val != (Object)null) { val3 = val.GetComponentInChildren<Weapon>(true); } bool flag = false; if ((Object)(object)val3 != (Object)null && ((Object)val3).name.Contains("HK_G11")) { NetworkBehaviour component2 = ((Component)val3).GetComponent<NetworkBehaviour>(); if ((Object)(object)component2 != (Object)null && component2.IsClient && component2.IsOwner) { flag = true; } } UpdateModeTextVisibilityAndContent(component.IsClient && component.IsOwner, flag, isFastFireMode); if (!isScopeAiming && flag && Keyboard.current != null && ((ButtonControl)Keyboard.current.xKey).wasPressedThisFrame) { _currentFireMode[instanceID] = !_currentFireMode[instanceID]; isFastFireMode = _currentFireMode[instanceID]; StraftatRebalance.Instance.mls.LogInfo((object)("Fire mode switched to: " + (isFastFireMode ? "Fast" : "Default"))); if ((Object)(object)_modeSwitchSound != (Object)null) { AudioSource.PlayClipAtPoint(_modeSwitchSound, ((Component)__instance).transform.position, 1f); StraftatRebalance.Instance.mls.LogInfo((object)"Played mode switch sound via PlayClipAtPoint."); } else { StraftatRebalance.Instance.mls.LogWarning((object)"AudioClip for mode switch is null. Sound not played via PlayClipAtPoint. Check embedded resource loading."); } ApplyHKAimStats(__instance, isScopeAiming, isFastFireMode); UpdateModeTextVisibilityAndContent(component.IsClient && component.IsOwner, flag, isFastFireMode); } } private static void UpdateModeTextVisibilityAndContent(bool isLocalPlayerOwned, bool isHKG11EquippedAndOwned, bool isFastFireMode) { if ((Object)(object)StraftatRebalance.Instance == (Object)null) { return; } if ((Object)(object)StraftatRebalance.Instance.ModeTextGameObject == (Object)null) { StraftatRebalance.Instance.mls.LogWarning((object)"ModeTextGameObject is NULL in UpdateModeTextVisibilityAndContent. Cannot manage visibility."); return; } if ((Object)(object)StraftatRebalance.Instance.ModeTextIndicator == (Object)null) { StraftatRebalance.Instance.mls.LogWarning((object)"ModeTextIndicator is NULL in UpdateModeTextVisibilityAndContent. Cannot update text."); } if (isLocalPlayerOwned && isHKG11EquippedAndOwned) { if (!StraftatRebalance.Instance.ModeTextGameObject.activeSelf) { StraftatRebalance.Instance.ModeTextGameObject.SetActive(true); StraftatRebalance.Instance.mls.LogInfo((object)"ModeText parent block shown (HK_G11 equipped/owned by local player)."); } if ((Object)(object)StraftatRebalance.Instance.ModeTextIndicator != (Object)null) { if (!((Component)StraftatRebalance.Instance.ModeTextIndicator).gameObject.activeSelf) { ((Component)StraftatRebalance.Instance.ModeTextIndicator).gameObject.SetActive(true); StraftatRebalance.Instance.mls.LogDebug((object)"ModeTextIndicator (child 'text' GameObject) explicitly activated."); } if (isFastFireMode) { StraftatRebalance.Instance.ModeTextIndicator.text = "Mode: Single"; } else { StraftatRebalance.Instance.ModeTextIndicator.text = "Mode: Auto"; } } } else { if (StraftatRebalance.Instance.ModeTextGameObject.activeSelf) { StraftatRebalance.Instance.ModeTextGameObject.SetActive(false); StraftatRebalance.Instance.mls.LogInfo((object)"ModeText parent block hidden (Not local player, or HK not equipped/owned)."); } if ((Object)(object)StraftatRebalance.Instance.ModeTextIndicator != (Object)null && ((Component)StraftatRebalance.Instance.ModeTextIndicator).gameObject.activeSelf) { ((Component)StraftatRebalance.Instance.ModeTextIndicator).gameObject.SetActive(false); StraftatRebalance.Instance.mls.LogDebug((object)"ModeTextIndicator (child 'text' GameObject) explicitly deactivated."); } } } private static void LoadEmbeddedAudioClip(string resourceName) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourceName); if (stream == null) { StraftatRebalance.Instance.mls.LogError((object)("Could not find embedded resource: " + resourceName + ". Available resources: " + string.Join(", ", executingAssembly.GetManifestResourceNames()))); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, (int)stream.Length); int num = 44; if (array.Length < num) { StraftatRebalance.Instance.mls.LogError((object)("Audio file " + resourceName + " is too small to be a valid WAV (less than 44 bytes header).")); return; } int num2 = 2; int num3 = 44100; int num4 = (array.Length - num) / 2; float[] array2 = new float[num4]; for (int i = 0; i < num4; i++) { short num5 = (short)((array[num + i * 2 + 1] << 8) | array[num + i * 2]); array2[i] = (float)num5 / 32768f; } _modeSwitchSound = AudioClip.Create(Path.GetFileNameWithoutExtension(resourceName), num4 / num2, num2, num3, false); _modeSwitchSound.SetData(array2, 0); StraftatRebalance.Instance.mls.LogInfo((object)$"Successfully loaded embedded audio clip: {resourceName} (Length: {_modeSwitchSound.length}s, Channels: {_modeSwitchSound.channels}, Freq: {_modeSwitchSound.frequency})"); } private static void ApplyHKAimStats(FirstPersonController fpcInstance, bool isScopeAiming, bool isFastFireMode) { NetworkBehaviour component = ((Component)fpcInstance).GetComponent<NetworkBehaviour>(); if ((Object)(object)component == (Object)null || !component.IsClient || !component.IsOwner) { return; } GameObject val = null; Transform val2 = ((Component)fpcInstance).transform; while ((Object)(object)val2 != (Object)null) { if (((Object)val2).name.Equals("PlayerIK(Clone)")) { val = ((Component)val2).gameObject; break; } val2 = val2.parent; } if ((Object)(object)val == (Object)null) { StraftatRebalance.Instance.mls.LogWarning((object)"PlayerIK(Clone) root object not found for FPC instance in ApplyHKAimStats."); return; } Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if (!((Object)(object)componentInChildren == (Object)null) && ((Object)componentInChildren).name.Contains("HK_G11")) { NetworkBehaviour component2 = ((Component)componentInChildren).GetComponent<NetworkBehaviour>(); if ((Object)(object)component2 == (Object)null || !component2.IsClient || !component2.IsOwner) { StraftatRebalance.Instance.mls.LogWarning((object)("HK_G11 found but not owned by local client in ApplyHKAimStats. Weapon: " + ((Object)componentInChildren).name)); } else if (isScopeAiming) { componentInChildren.onePressShoot = false; componentInChildren.aimBurstGun = false; componentInChildren.timeBetweenBullets = 2f; componentInChildren.timeBetweenFire = 2f; componentInChildren.damage = 100f; StraftatRebalance.Instance.mls.LogInfo((object)$"HK (Aiming): Stats applied for {((Object)componentInChildren).name} (Owner: {component.OwnerId})."); } else if (isFastFireMode) { componentInChildren.onePressShoot = true; componentInChildren.aimBurstGun = false; componentInChildren.timeBetweenBullets = 0.07f; componentInChildren.timeBetweenFire = 0.07f; componentInChildren.damage = 1.4f; StraftatRebalance.Instance.mls.LogInfo((object)$"HK (Not Aiming - Fast Mode): Stats applied for {((Object)componentInChildren).name} (Owner: {component.OwnerId})."); } else { componentInChildren.onePressShoot = false; componentInChildren.aimBurstGun = false; componentInChildren.timeBetweenBullets = 0.135f; componentInChildren.timeBetweenFire = 0.135f; componentInChildren.damage = 1f; StraftatRebalance.Instance.mls.LogInfo((object)$"HK (Not Aiming - Default Mode): Stats applied for {((Object)componentInChildren).name} (Owner: {component.OwnerId})."); } } } } private static Dictionary<int, bool> _previousAimingStates = new Dictionary<int, bool>(); private static Dictionary<int, bool> _currentFireMode = new Dictionary<int, bool>(); private static AudioClip _modeSwitchSound; } [BepInPlugin("straftatcmr.rebalance", "Straftat CMR", "1.0.1")] public class StraftatRebalance : BaseUnityPlugin { private const string modGUID = "straftatcmr.rebalance"; private const string modName = "Straftat CMR"; private const string modVersion = "1.0.1"; private ManualLogSource _pluginLogger; private readonly Harmony harmony = new Harmony("straftatcmr.rebalance"); private static int modsPopupDestroyCount = 0; private const int MAX_DESTROY_COUNT = 1; private Dictionary<string, TMP_Text> _textsToMonitor = new Dictionary<string, TMP_Text>(); public static StraftatRebalance Instance; public TMP_Text ModeTextIndicator; public GameObject ModeTextGameObject; public static int ClientHostId = 32767; public static bool disableModsPopout = false; private GameObject _mainMenuRoot; private bool _inMainMenu = true; internal ManualLogSource mls; private void Awake() { ((Component)this).gameObject.AddComponent<DevConsole>(); UIPatches.Initialize(_pluginLogger); Instance = this; _pluginLogger = ((BaseUnityPlugin)this).Logger; UIPatches.Initialize(mls); TextPatcher.Initialize(_pluginLogger); mls = Logger.CreateLogSource("Straftat CMR"); mls.LogInfo((object)"Straftat CMR is loaded! blep"); harmony.PatchAll(typeof(StraftatRebalance)); NewWeaponPatches.PatchPMRadiusByPrefabCriteria(mls); harmony.PatchAll(typeof(GammaPredictedProjectileDamagePatch)); harmony.PatchAll(typeof(ClaymoreSoundPatch)); harmony.PatchAll(typeof(SahurPatch)); harmony.PatchAll(typeof(BlankStateWeaponPatch)); harmony.PatchAll(typeof(PhoenixWeaponPatch)); NewWeaponPatches.PatchShrapnelByPrefabCriteria(mls); harmony.PatchAll(typeof(APMineSoundPatch)); harmony.PatchAll(typeof(FirstPersonControllerMonitorAimPatch.FirstPersonControllerUpdatePatch)); NewWeaponPatches.PatchQCW05ByPrefabCriteria(mls); NewWeaponPatches.PatchBenderByPrefabCriteria(mls); NewWeaponPatches.PatchBigFattyBroByPrefabCriteria(mls); NewWeaponPatches.PatchHillH15ByPrefabCriteria(mls); NewWeaponPatches.PatchM2000ByPrefabCriteria(mls); NewWeaponPatches.PatchSilenzzioByPrefabCriteria(mls); NewWeaponPatches.PatchClaymoreByPrefabCriteria(mls); NewWeaponPatches.PatchPXMineByPrefabCriteria(mls); NewWeaponPatches.PatchKaka46ByPrefabCriteria(mls); NewWeaponPatches.PatchDispenserByPrefabCriteria(mls); NewWeaponPatches.PatchGunByPrefabCriteria(mls); NewWeaponPatches.PatchRevolverByPrefabCriteria(mls); NewWeaponPatches.PatchGustByPrefabCriteria(mls); NewWeaponPatches.PatchSmithCarbineByPrefabCriteria(mls); NewWeaponPatches.PatchFG42ByPrefabCriteria(mls); NewWeaponPatches.PatchBaseballBatByPrefabCriteria(mls); NewWeaponPatches.PatchStylusByPrefabCriteria(mls); NewWeaponPatches.PatchRocketLauncherByPrefabCriteria(mls); NewWeaponPatches.PatchKesoByPrefabCriteria(mls); NewWeaponPatches.PatchKatanaByPrefabCriteria(mls); NewWeaponPatches.PatchGlandByPrefabCriteria(mls); NewWeaponPatches.PatchGland2ByPrefabCriteria(mls); NewWeaponPatches.PatchNuggetByPrefabCriteria(mls); NewWeaponPatches.PatchGammaGen1ByPrefabCriteria(mls); NewWeaponPatches.PatchGammaGen2ByPrefabCriteria(mls); NewWeaponPatches.DisableSphereInHandGrenade2ByPrefabCriteria(mls); NewWeaponPatches.DisableSphereInPhysicsHandGrenadeByPrefabCriteria(mls); NewWeaponPatches.DisableSphereInStunGrenadeByPrefabCriteria(mls); NewWeaponPatches.DisableSphereInStunMineObjectByPrefabCriteria(mls); NewWeaponPatches.PatchAR15ByPrefabCriteria(mls); NewWeaponPatches.PatchGlockByPrefabCriteria(mls); NewWeaponPatches.PatchBlankStateByPrefabCriteria(mls); NewWeaponPatches.PatchPhoenixByPrefabCriteria(mls); NewWeaponPatches.PatchTaserByPrefabCriteria(mls); NewWeaponPatches.PatchObusByPrefabCriteria(mls); NewWeaponPatches.PatchDualLauncherByPrefabCriteria(mls); NewWeaponPatches.PatchBFGByPrefabCriteria(mls); NewWeaponPatches.PatchHKG11ByPrefabCriteria(mls); NewWeaponPatches.PatchNizehByPrefabCriteria(mls); NewWeaponPatches.PatchSKSByPrefabCriteria(mls); NewWeaponPatches.PatchCrisisByPrefabCriteria(mls); NewWeaponPatches.PatchMac10ByPrefabCriteria(mls); NewWeaponPatches.PatchKanyeObusByPrefabCriteria(mls); NewWeaponPatches.PatchKanyeWestByPrefabCriteria(mls); NewWeaponPatches.PatchShotgunByPrefabCriteria(mls); NewWeaponPatches.PatchSMGByPrefabCriteria(mls); NewWeaponPatches.PatchPulseByPrefabCriteria(mls); NewWeaponPatches.PatchCouperetByPrefabCriteria(mls); NewWeaponPatches.PatchAPMineByPrefabCriteria(mls); NewWeaponPatches.PatchAPMine2ByPrefabCriteria(mls); mls.LogInfo((object)"Straftat CMR is fully initialized! blep"); } private void Start() { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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) disableModsPopout = PlayerPrefs.GetInt("CMR_DisableModsPopout", 0) == 1; if (disableModsPopout) { mls.LogInfo((object)"[CONFIG] disable_mods_popout загружен: включен"); } TextPatcher.ApplyTextPatch(new TextPatcher.TextPatchInfo { TargetObjectName = "StraftatText", ParentPath = "---USER INTERFACE---/--MAIN MENU--/--STARTUP MENU--", NewText = "STRAFTAT: CMR", ContinuousMonitor = false }); TextPatcher.ApplyTextPatch(new TextPatcher.TextPatchInfo { TargetObjectName = "StraftatText (2)", ParentPath = "---USER INTERFACE---/--MAIN MENU--/--STARTUP MENU--", NewText = "--- press any key to blep ---", ContinuousMonitor = false }); TextPatcher.ApplyTextPatch(new TextPatcher.TextPatchInfo { TargetObjectName = "version", ParentPath = "---USER INTERFACE---/--MAIN MENU--/--STARTUP MENU--", NewText = "- version 1.3.4b -\r\nCMR 1.0.1", ContinuousMonitor = false }); Transform val = TextPatcher.FindRootGameObject("---USER INTERFACE---"); if ((Object)(object)val != (Object)null) { mls.LogInfo((object)"Found ---USER INTERFACE--- root."); Transform val2 = TextPatcher.FindDescendant(val, "---MINIMAL UI---"); if ((Object)(object)val2 != (Object)null) { mls.LogInfo((object)"Found ---MINIMAL UI---."); Transform val3 = TextPatcher.FindDescendant(val2, "HealthDisplay"); if ((Object)(object)val3 != (Object)null) { mls.LogInfo((object)"Found HealthDisplay. Cloning for ModeText."); GameObject val4 = Object.Instantiate<GameObject>(((Component)val3).gameObject); ((Object)val4).name = "ModeText"; val4.transform.SetParent(val, false); ModeTextGameObject = val4; RectTransform component = val4.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = new Vector2(-1613.105f, -442.4104f); component.sizeDelta = new Vector2(200f, 30f); mls.LogInfo((object)$"ModeText RectTransform set to anchoredPosition: {component.anchoredPosition}, sizeDelta: {component.sizeDelta}"); } else { mls.LogWarning((object)"RectTransform component not found on ModeText cloned object!"); } Transform val5 = TextPatcher.FindDescendant(val4.transform, "text"); if ((Object)(object)val5 != (Object)null) { mls.LogInfo((object)"Found child 'text' GameObject under ModeText."); ModeTextIndicator = ((Component)val5).GetComponent<TMP_Text>(); if ((Object)(object)ModeTextIndicator != (Object)null) { ModeTextIndicator.text = "Mode: Initializing..."; mls.LogInfo((object)"ModeText indicator (TMP_Text) created and initialized on child 'text'."); } else { mls.LogWarning((object)"Child 'text' found for ModeText, but TMP_Text component not found on it!"); } } else { mls.LogWarning((object)"Child 'text' GameObject not found under ModeText! Cannot find TMP_Text component."); } if ((Object)(object)ModeTextIndicator == (Object)null) { mls.LogError((object)"Failed to find or assign ModeTextIndicator. ModeText functionality will be limited."); } if ((Object)(object)ModeTextGameObject != (Object)null) { ModeTextGameObject.SetActive(false); mls.LogInfo((object)"ModeText parent object initially set to inactive to prevent showing in menu."); } else { mls.LogError((object)"ModeTextGameObject was NULL after cloning. Cannot set inactive."); } } else { mls.LogWarning((object)"HealthDisplay not found under ---MINIMAL UI--- for ModeText cloning. Path: ---USER INTERFACE---/---MINIMAL UI---/HealthDisplay"); } } else { mls.LogWarning((object)"---MINIMAL UI--- not found under ---USER INTERFACE--- for ModeText cloning."); } Transform obj = TextPatcher.FindDescendant(val, "--MAIN MENU--"); _mainMenuRoot = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)_mainMenuRoot == (Object)null) { mls.LogWarning((object)"Could not find --MAIN MENU-- GameObject. Main menu detection might be unreliable when using DontDestroyOnLoad."); Transform obj2 = TextPatcher.FindDescendant(val, "--STARTUP MENU--"); _mainMenuRoot = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)_mainMenuRoot != (Object)null) { mls.LogInfo((object)"Found --STARTUP MENU-- as fallback for main menu detection."); } else { mls.LogError((object)"Neither --MAIN MENU-- nor --STARTUP MENU-- found for main menu detection!"); } } else { mls.LogInfo((object)"Found --MAIN MENU-- for main menu detection."); } } else { mls.LogWarning((object)"---USER INTERFACE--- root object not found for ModeText cloning."); } } private void Update() { TextPatcher.UpdateMonitoredTexts(); if (disableModsPopout && Time.frameCount % 1 == 0 && modsPopupDestroyCount < 1) { DevConsole.DestroyModsPopup(); modsPopupDestroyCount++; } if ((Object)(object)_mainMenuRoot != (Object)null && (Object)(object)ModeTextGameObject != (Object)null) { bool activeInHierarchy = _mainMenuRoot.activeInHierarchy; if (activeInHierarchy == _inMainMenu) { return; } _inMainMenu = activeInHierarchy; if (_inMainMenu) { if (ModeTextGameObject.activeSelf) { ModeTextGameObject.SetActive(false); mls.LogInfo((object)"ModeText parent block hidden (Detected Main Menu activation)."); } } else { mls.LogInfo((object)"Detected exit from Main Menu. ModeText visibility now controlled by FPC patch."); } } else if (!((Object)(object)_mainMenuRoot == (Object)null)) { } } } } namespace StraftatCMR.Utils { internal class NewWeaponPatches { private static AudioClip _apMineGhepClip; private static bool _clipLoadStarted; internal static void PatchKatanaByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("katana") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Katana prefab candidates", "Katana", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[Katana PREFAB PATCH] No Katana prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "Katana", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "kuz-yakich"; log.LogInfo((object)"[Katana PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[Katana PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchPMRadiusByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("proximitymine") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} ProximityMine prefab candidates", "PM Radius", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[PM Radius PREFAB PATCH] No ProximityMine prefabs found"); return; } GameObject[] array2 = array; foreach (GameObject val in array2) { log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Checking ProximityMine: {1} (ID: {2})", "PM Radius", ((Object)val).name, ((Object)val).GetInstanceID())); Transform val2 = val.transform.Find("radius"); if ((Object)(object)val2 != (Object)null) { GameObject gameObject = ((Component)val2).gameObject; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found radius child: {1} (ID: {2})", "PM Radius", ((Object)gameObject).name, ((Object)gameObject).GetInstanceID())); gameObject.SetActive(false); log.LogInfo((object)"[PM Radius PREFAB PATCH] Radius object hidden successfully"); continue; } Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); Transform[] array3 = componentsInChildren.Where((Transform t) => ((Object)t).name.ToLower() == "radius").ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} radius children via recursive search", "PM Radius", array3.Length)); Transform[] array4 = array3; foreach (Transform val3 in array4) { GameObject gameObject2 = ((Component)val3).gameObject; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found radius child (recursive): {1} (ID: {2})", "PM Radius", ((Object)gameObject2).name, ((Object)gameObject2).GetInstanceID())); gameObject2.SetActive(false); log.LogInfo((object)"[PM Radius PREFAB PATCH] Radius object hidden successfully"); } if (array3.Length == 0) { log.LogWarning((object)("[PM Radius PREFAB PATCH] No 'radius' child found in " + ((Object)val).name)); } } } internal static void PatchShrapnelByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("shrapnel") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Shrapnel prefab candidates", "Shrapnel", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[Shrapnel PREFAB PATCH] No Shrapnel prefabs found with zero position criteria"); return; } GameObject[] array2 = array; foreach (GameObject val in array2) { log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "Shrapnel", ((Object)val).name, ((Object)val).GetInstanceID())); ShrapnelBallistic val2 = val.GetComponent<ShrapnelBallistic>(); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren<ShrapnelBallistic>(true); } if ((Object)(object)val2 != (Object)null) { log.LogInfo((object)"[Shrapnel PREFAB PATCH] Found ShrapnelBallistic component"); FieldInfo field = typeof(ShrapnelBallistic).GetField("damage", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { float num = (float)field.GetValue(val2); float num2 = 1.5f; field.SetValue(val2, num2); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Shrapnel damage changed from {1} to {2}", "Shrapnel", num, num2)); } else { log.LogError((object)"[Shrapnel PREFAB PATCH] Failed to find 'damage' field in ShrapnelBallistic"); } } else { log.LogWarning((object)("[Shrapnel PREFAB PATCH] ShrapnelBallistic component NOT found in " + ((Object)val).name)); } } } internal static void PatchQCW05ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("qcw05") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} {2} prefab candidates", "QCW05", array.Length, "QCW05")); if (array.Length == 0) { log.LogWarning((object)"[QCW05 PREFAB PATCH] No QCW05 prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "QCW05", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.damage = 0.8f; log.LogInfo((object)"[QCW05 PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[QCW05 PREFAB PATCH] Weapon component NOT found"); } } internal static void PatchBenderByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("bender") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} {2} prefab candidates", "Bender", array.Length, "Bender")); if (array.Length == 0) { log.LogWarning((object)"[Bender PREFAB PATCH] No Bender prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "Bender", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.damage = 1.6f; log.LogInfo((object)"[Bender PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[Bender PREFAB PATCH] Weapon component NOT found"); } } internal static void PatchBigFattyBroByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("bigfattybro") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} BigFattyBro prefab candidates", "BIGFATTYBRO", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[BIGFATTYBRO PREFAB PATCH] No BigFattyBro prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "BIGFATTYBRO", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.movementFactor = 1.5f; componentInChildren.damage = 2.8f; componentInChildren.headMultiplier = 1.57f; log.LogInfo((object)"[BIGFATTYBRO PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[BIGFATTYBRO PREFAB PATCH] Weapon component NOT found"); } MeleeWeapon componentInChildren2 = val.GetComponentInChildren<MeleeWeapon>(true); if ((Object)(object)componentInChildren2 != (Object)null) { FieldInfo field = typeof(MeleeWeapon).GetField("baseAttackDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field2 = typeof(MeleeWeapon).GetField("secondAttackDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field2 != null) { float num = (float)field.GetValue(componentInChildren2); float num2 = (float)field2.GetValue(componentInChildren2); if (num != 2.8f || num2 != 2.8f) { field.SetValue(componentInChildren2, 2.8f); field2.SetValue(componentInChildren2, 2.8f); } } log.LogInfo((object)"[BIGFATTYBRO PREFAB PATCH] MeleeWeapon component patched successfully"); } else { log.LogWarning((object)"[BIGFATTYBRO PREFAB PATCH] MeleeWeapon component NOT found"); } ItemBehaviour componentInChildren3 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren3 != (Object)null) { componentInChildren3.weaponName = "buvala"; log.LogInfo((object)"[BIGFATTYBRO PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[BIGFATTYBRO PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchHillH15ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("hill_h15") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Hill H15 prefab candidates", "HILL_H15", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[HILL_H15 PREFAB PATCH] No Hill H15 prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "HILL_H15", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.damage = 0.4f; log.LogInfo((object)"[HILL_H15 PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[HILL_H15 PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "Hill Coleman"; log.LogInfo((object)"[HILL_H15 PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[HILL_H15 PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchM2000ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("m2000") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} M2000 prefab candidates", "M2000", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[M2000 PREFAB PATCH] No M2000 prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "M2000", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "WLEL2000"; log.LogInfo((object)"[M2000 PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[M2000 PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchSilenzzioByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("silenzzio") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Silenzzio prefab candidates", "SILENZZIO", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[SILENZZIO PREFAB PATCH] No Silenzzio prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "SILENZZIO", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "salozao"; log.LogInfo((object)"[SILENZZIO PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[SILENZZIO PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchClaymoreByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("claymore") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Claymore prefab candidates", "CLAYMORE", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[CLAYMORE PREFAB PATCH] No Claymore prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "CLAYMORE", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "S.L.A.M."; log.LogInfo((object)"[CLAYMORE PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[CLAYMORE PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchGlandByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("gland") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Gland Grenade prefab candidates", "GLAND GRENADE", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[GLAND GRENADE PREFAB PATCH] No Gland Grenade prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "GLAND GRENADE", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "Blep Grenade"; log.LogInfo((object)"[GLAND GRENADE PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[GLAND GRENADE PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchGland2ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("glandgrenade") && go.tag == "Grenade" && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0078; } } result = 0; goto IL_0078; IL_0078: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} GlandGrenade prefab candidates", "GlandGrenade", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[GlandGrenade PREFAB PATCH] No GlandGrenade prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "GlandGrenade", ((Object)val).name, ((Object)val).GetInstanceID())); PhysicsGrenade componentInChildren = val.GetComponentInChildren<PhysicsGrenade>(true); if ((Object)(object)componentInChildren != (Object)null) { FieldInfo field = typeof(PhysicsGrenade).GetField("explosionRadius", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field2 = typeof(PhysicsGrenade).GetField("numberOfRays", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field2 != null) { float num = (float)field.GetValue(componentInChildren); float num2 = (float)field2.GetValue(componentInChildren); if (num != 16f || num2 != 400f) { field.SetValue(componentInChildren, 16f); log.LogInfo((object)"[GlandGrenade PREFAB PATCH] ExplosionRadius set to 3"); field2.SetValue(componentInChildren, 400); log.LogInfo((object)"[GlandGrenade PREFAB PATCH] NumberOfRays set to 400"); } } log.LogInfo((object)"[GlandGrenade PREFAB PATCH] PhysicsGrenade component patched successfully"); } else { log.LogWarning((object)"[GlandGrenade PREFAB PATCH] PhysicsGrenade component NOT found"); } } internal static void PatchNuggetByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("nugget") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Nugget prefab candidates", "NUGGET", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[NUGGET PREFAB PATCH] No Nugget prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "NUGGET", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.currentAmmo = 12; componentInChildren.jumpFactor = 3f; log.LogInfo((object)"[NUGGET PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[NUGGET PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "SERUM"; log.LogInfo((object)"[NUGGET PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[NUGGET PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchGammaGen1ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("gamma") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Gamma prefab candidates", "Gamma", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[Gamma PREFAB PATCH] No Gamma prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "Gamma", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.movementFactor = 0.7f; componentInChildren.timeBetweenFire = 0.135f; log.LogInfo((object)"[Gamma PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[Gamma PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "Ghep gen 1"; log.LogInfo((object)"[Gamma PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[Gamma PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchGammaGen2ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("gammagen2") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} GammaGen2 prefab candidates", "GammaGen2", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[GammaGen2 PREFAB PATCH] No GammaGen2 prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "GammaGen2", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.timeBetweenFire = 0.07f; componentInChildren.movementFactor = 1.1f; log.LogInfo((object)"[GammaGen2 PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[GammaGen2 PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "Ghep gen 2"; log.LogInfo((object)"[GammaGen2 PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[GammaGen2 PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void DisableSphereInHandGrenade2ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject val = ((IEnumerable<GameObject>)source).FirstOrDefault((Func<GameObject, bool>)delegate(GameObject go) { //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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name == "HandGrenade 2" && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0061; } } result = 0; goto IL_0061; IL_0061: return (byte)result != 0; }); if ((Object)(object)val != (Object)null) { Transform obj = val.transform.Find("Sphere (1)"); GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); log.LogInfo((object)"[Sphere (1) PREFAB PATCH] Sphere (1) disabled in HandGrenade 2"); } } } internal static void DisableSphereInPhysicsHandGrenadeByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject val = ((IEnumerable<GameObject>)source).FirstOrDefault((Func<GameObject, bool>)delegate(GameObject go) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.Contains("PhysicsHandGrenade") && go.tag == "Grenade" && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0073; } } result = 0; goto IL_0073; IL_0073: return (byte)result != 0; }); if ((Object)(object)val != (Object)null) { Transform val2 = val.transform.Find("Graph"); object obj; if (val2 == null) { obj = null; } else { Transform obj2 = val2.Find("Sphere (1)"); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); log.LogInfo((object)("[Sphere (1) PREFAB PATCH] Sphere (1) disabled in " + ((Object)val).name + "/Graph")); } else { log.LogWarning((object)("[Sphere (1) PREFAB PATCH] Sphere (1) NOT found in " + ((Object)val).name + "/Graph")); } } else { log.LogWarning((object)"[Sphere (1) PREFAB PATCH] PhysicsHandGrenade prefab NOT found"); } } internal static void DisableSphereInStunGrenadeByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject val = ((IEnumerable<GameObject>)source).FirstOrDefault((Func<GameObject, bool>)delegate(GameObject go) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.Contains("StunGrenade") && go.tag == "Grenade" && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0073; } } result = 0; goto IL_0073; IL_0073: return (byte)result != 0; }); if ((Object)(object)val != (Object)null) { Transform val2 = val.transform.Find("Graph"); object obj; if (val2 == null) { obj = null; } else { Transform obj2 = val2.Find("Sphere (1)"); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); log.LogInfo((object)("[Sphere (1) PREFAB PATCH] Sphere (1) disabled in " + ((Object)val).name + "/Graph")); } else { log.LogWarning((object)("[Sphere (1) PREFAB PATCH] Sphere (1) NOT found in " + ((Object)val).name + "/Graph")); } } else { log.LogWarning((object)"[Sphere (1) PREFAB PATCH] StunGrenade prefab NOT found"); } } internal static void DisableSphereInStunMineObjectByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject val = ((IEnumerable<GameObject>)source).FirstOrDefault((Func<GameObject, bool>)delegate(GameObject go) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.Contains("StunMineObject") && go.tag == "Mine" && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0073; } } result = 0; goto IL_0073; IL_0073: return (byte)result != 0; }); if ((Object)(object)val != (Object)null) { Transform val2 = val.transform.Find("RadiusParent"); object obj; if (val2 == null) { obj = null; } else { Transform obj2 = val2.Find("radius"); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); log.LogInfo((object)("[radius PREFAB PATCH] radius disabled in " + ((Object)val).name + "/RadiusParent")); } else { log.LogWarning((object)("[radius PREFAB PATCH] radius NOT found in " + ((Object)val).name + "/RadiusParent")); } } else { log.LogWarning((object)"[radius PREFAB PATCH] StunMineObject prefab NOT found"); } } internal static void PatchPXMineByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("proximity") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Proximity Mine prefab candidates", "PROXIMITY MINE", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[PROXIMITY MINE PREFAB PATCH] No Proximity Mine prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "PROXIMITY MINE", ((Object)val).name, ((Object)val).GetInstanceID())); ItemBehaviour componentInChildren = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.weaponName = "set and plant!"; log.LogInfo((object)"[PROXIMITY MINE PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[PROXIMITY MINE PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchKaka46ByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Equals("ak-k") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Kaka46 prefab candidates", "KAKA46", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[KAKA46 PREFAB PATCH] No Kaka46 prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "KAKA46", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headMultiplier = 3f; log.LogInfo((object)"[KAKA46 PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[KAKA46 PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "Kaka-K3"; log.LogInfo((object)"[KAKA46 PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[KAKA46 PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchDispenserByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name.ToLower().Contains("dispenser") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0066; } } result = 0; goto IL_0066; IL_0066: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Dispenser prefab candidates", "DISPENSER", array.Length)); if (array.Length == 0) { log.LogWarning((object)"[DISPENSER PREFAB PATCH] No Dispenser prefabs found with zero position criteria"); return; } GameObject val = array[0]; log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Patching: {1} (ID: {2})", "DISPENSER", ((Object)val).name, ((Object)val).GetInstanceID())); Weapon componentInChildren = val.GetComponentInChildren<Weapon>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.damage = 0.9f; log.LogInfo((object)"[DISPENSER PREFAB PATCH] Weapon component patched successfully"); } else { log.LogWarning((object)"[DISPENSER PREFAB PATCH] Weapon component NOT found"); } ItemBehaviour componentInChildren2 = val.GetComponentInChildren<ItemBehaviour>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.weaponName = "Decimort"; log.LogInfo((object)"[DISPENSER PREFAB PATCH] ItemBehaviour component patched successfully"); } else { log.LogWarning((object)"[DISPENSER PREFAB PATCH] ItemBehaviour component NOT found"); } } internal static void PatchGunByPrefabCriteria(ManualLogSource log) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array = source.Where(delegate(GameObject go) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)go != (Object)null && ((Object)go).name == "Gun" && go.layer == LayerMask.NameToLayer("HeldWeapon") && go.transform.position == Vector3.zero) { Scene scene = go.scene; if (!((Scene)(ref scene)).IsValid() && (Object)(object)go.transform.parent == (Object)null) { result = ((!go.activeInHierarchy) ? 1 : 0); goto IL_0073; } } result = 0; goto IL_0073; IL_0073: return (byte)result != 0; }).ToArray(); log.LogInfo((object)string.Format("[{0} PREFAB PATCH] Found {1} Gun prefab candidates", "Gun", array.Length));