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 BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using OpenShot.Core; using OpenShot.Events; using OpenShot.UI; using Shooterlatro.Gameplay; using Shooterlatro.Player; using TMPro; using UnityEngine; using UnityEngine.Events; 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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("OpenShot")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OpenShot")] [assembly: AssemblyTitle("OpenShot")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 OpenShot { [BepInPlugin("com.liamgaming.openshot", "OpenShot API", "1.0.0")] public class OpenShotPlugin : BaseUnityPlugin { public const string PluginGuid = "com.liamgaming.openshot"; public const string PluginName = "OpenShot API"; public const string PluginVersion = "1.0.0"; private Harmony harmony; public static OpenShotPlugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"[OpenShot API] Initializing API..."); SaveAPI.Initialize(); GameEvents.Initialize(); AssetLoader.LoadAllBundles(); LocalizationAPI.LoadLanguage("en"); GameObject val = new GameObject("OpenShotAPIs"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent(); val.AddComponent(); val.AddComponent(); UpdateChecker updateChecker = val.AddComponent(); AudioAPI.Initialize(val); InputAPI.Initialize(val); updateChecker.CheckForUpdate("LiamGaming-OpenShot", "1.1.0"); AttributeScanner.ScanAndRegister(); harmony = new Harmony("com.liamgaming.openshot"); harmony.PatchAll(typeof(OpenShotPlugin).Assembly); Log.LogInfo((object)"[OpenShot API] Successfully loaded and patched."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } } namespace OpenShot.UI { public static class UIHelper { private static GUIStyle labelStyle; private static GUIStyle buttonStyle; private static Texture2D MakeTex(int width, int height, Color col) { //IL_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } public static void InitializeStyles() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0098: 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_00a9: 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_00d5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown if (labelStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 15, wordWrap = true }; val.normal.textColor = new Color(0.9f, 0.9f, 0.9f); labelStyle = val; } if (buttonStyle == null) { GUIStyle val2 = new GUIStyle(GUI.skin.button) { fontSize = 15, fontStyle = (FontStyle)1, padding = new RectOffset(15, 15, 10, 10) }; val2.normal.textColor = Color.white; val2.normal.background = MakeTex(2, 2, new Color(0.15f, 0.15f, 0.15f, 0.95f)); val2.hover.textColor = new Color(0f, 1f, 0.8f); val2.hover.background = MakeTex(2, 2, new Color(0.25f, 0.25f, 0.25f, 1f)); val2.active.textColor = Color.black; val2.active.background = MakeTex(2, 2, new Color(0f, 1f, 0.8f, 1f)); buttonStyle = val2; } } public static void DrawLabel(string text) { InitializeStyles(); GUILayout.Label(text, labelStyle, Array.Empty()); } public static bool DrawButton(string text) { InitializeStyles(); return GUILayout.Button(text, buttonStyle, Array.Empty()); } public static void DrawHeader(string text) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; GUILayout.Label(text, val, Array.Empty()); GUILayout.Space(10f); } public static bool DrawSettings(object settingsObj) { bool result = false; if (settingsObj == null) { return false; } Type type = settingsObj.GetType(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(fieldInfo.Name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); if (fieldInfo.FieldType == typeof(bool)) { bool flag = (bool)fieldInfo.GetValue(settingsObj); bool flag2 = GUILayout.Toggle(flag, "", Array.Empty()); if (flag2 != flag) { fieldInfo.SetValue(settingsObj, flag2); result = true; } } else if (fieldInfo.FieldType == typeof(string)) { string text = ((string)fieldInfo.GetValue(settingsObj)) ?? ""; string text2 = GUILayout.TextField(text, Array.Empty()); if (text2 != text) { fieldInfo.SetValue(settingsObj, text2); result = true; } } else if (fieldInfo.FieldType == typeof(int)) { int num = (int)fieldInfo.GetValue(settingsObj); string s = GUILayout.TextField(num.ToString(), Array.Empty()); if (int.TryParse(s, out var result2) && result2 != num) { fieldInfo.SetValue(settingsObj, result2); result = true; } } else if (fieldInfo.FieldType == typeof(float)) { float num2 = (float)fieldInfo.GetValue(settingsObj); string s2 = GUILayout.TextField(num2.ToString(), Array.Empty()); if (float.TryParse(s2, out var result3) && result3 != num2) { fieldInfo.SetValue(settingsObj, result3); result = true; } } GUILayout.EndHorizontal(); } return result; } } public class ModMenu : MonoBehaviour { private bool isVisible = false; private Rect windowRect = new Rect((float)(Screen.width / 2 - 200), (float)(Screen.height / 2 - 250), 400f, 500f); private Vector2 scrollPosition; private static readonly List ModDrawCallbacks = new List(); public static ModMenu Instance { get; private set; } public static void RegisterTab(Action drawCallback) { ModDrawCallbacks.Add(drawCallback); } private void Awake() { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void Update() { if (Input.GetKeyDown((KeyCode)282)) { isVisible = !isVisible; ToggleGameState(isVisible); } } private void ToggleGameState(bool showMenu) { if (showMenu) { Time.timeScale = 0f; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Time.timeScale = 1f; Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } 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_0037: Expected O, but got Unknown //IL_0032: 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) if (isVisible) { windowRect = GUILayout.Window(1001, windowRect, new WindowFunction(DrawWindow), "OpenShot Mod Menu", Array.Empty()); } } private void DrawWindow(int windowID) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty()); UIHelper.DrawHeader("Installed Mods"); foreach (Action modDrawCallback in ModDrawCallbacks) { GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty()); try { modDrawCallback(); } catch (Exception ex) { GUILayout.Label("Error drawing mod UI: " + ex.Message, Array.Empty()); } GUILayout.EndVertical(); GUILayout.Space(10f); } if (ModDrawCallbacks.Count == 0) { UIHelper.DrawLabel("No mods have registered menu elements yet."); } GUILayout.EndScrollView(); if (UIHelper.DrawButton("Close Menu (F1)")) { isVisible = false; ToggleGameState(showMenu: false); } GUI.DragWindow(); } } public class DevConsole : MonoBehaviour { private bool isVisible = false; private string input = ""; private Vector2 scrollPosition; private Rect windowRect = new Rect(10f, 10f, 600f, 300f); private static List logs = new List(); private static Dictionary> commands = new Dictionary>(); public static DevConsole Instance { get; private set; } public static void RegisterCommand(string commandName, Action handler) { commands[commandName.ToLower()] = handler; } public static void Log(string message) { logs.Add($"[{DateTime.Now:HH:mm:ss}] {message}"); if (logs.Count > 100) { logs.RemoveAt(0); } } private void Awake() { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); RegisterCommand("help", delegate { Log("Available commands:"); foreach (string key in commands.Keys) { Log("- " + key); } }); RegisterCommand("clear", delegate { logs.Clear(); }); } private void Update() { if (Input.GetKeyDown((KeyCode)96) || Input.GetKeyDown((KeyCode)94)) { isVisible = !isVisible; if (isVisible) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } } private void OnGUI() { //IL_001f: 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_003f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (isVisible) { GUI.depth = -100; windowRect = GUILayout.Window(1002, windowRect, new WindowFunction(DrawConsole), "Developer Console", Array.Empty()); } } private void DrawConsole(int windowID) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_00c9: Invalid comparison between Unknown and I4 //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Invalid comparison between Unknown and I4 //IL_0141: Unknown result type (might be due to invalid IL or missing references) scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(230f) }); foreach (string log in logs) { GUILayout.Label(log, Array.Empty()); } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); GUI.SetNextControlName("ConsoleInput"); input = GUILayout.TextField(input, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if ((GUILayout.Button("Submit", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) || ((int)Event.current.type == 4 && (int)Event.current.keyCode == 13)) && !string.IsNullOrWhiteSpace(input)) { Log("> " + input); ExecuteCommand(input); input = ""; } GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private void ExecuteCommand(string inputLine) { string[] array = inputLine.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { return; } string text = array[0].ToLower(); if (commands.ContainsKey(text)) { string[] array2 = new string[array.Length - 1]; Array.Copy(array, 1, array2, 0, array2.Length); try { commands[text](array2); return; } catch (Exception ex) { Log("Error executing command: " + ex.Message); return; } } Log("Unknown command: " + text); } } public class MainMenuInjector : MonoBehaviour { private bool injected = false; private GameObject modsButton; private GameObject originalMenuRoot; private GameObject modSubmenuRoot; private static Dictionary custom3DButtons = new Dictionary(); public static void Register3DButton(string label, Action onClick) { if (!custom3DButtons.ContainsKey(label)) { custom3DButtons.Add(label, onClick); } } private void Start() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { injected = false; ((MonoBehaviour)this).Invoke("TryInjectMainMenu", 1f); } private void TryInjectMainMenu() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown if (injected) { return; } TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll(); GameObject val = null; TextMeshProUGUI[] array2 = array; foreach (TextMeshProUGUI val2 in array2) { if (((TMP_Text)val2).text != null && ((TMP_Text)val2).text.ToUpper().Contains("COLLECTIONS")) { Button componentInParent = ((Component)val2).GetComponentInParent