using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FMOD; using FMOD.Studio; using FMODUnity; using HarmonyLib; using ImGuiNET; using Mono.Cecil; using MonoMod.Utils.Cil; using Receiver2; using Receiver2ModdingKit.CustomRounds; using Receiver2ModdingKit.CustomSounds; using Receiver2ModdingKit.Editor; using Receiver2ModdingKit.Gamemodes; using Receiver2ModdingKit.Helpers; using Receiver2ModdingKit.Logging; using Receiver2ModdingKit.ModInstaller; using Receiver2ModdingKit.Thunderstore; using Rewired; using RewiredConsts; using SharpCompress.Archives; using SharpCompress.Common; using SharpCompress.Readers; using SimpleJSON; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Wolfire; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Receiver2ModdingKit { public static class ModPersistentData { private const string k_PersistentDataKeyName = "mod_persistent_data"; private static JSONObject persistent_data = new JSONObject(); public static void AddPersistentData(PluginInfo pluginInfo, JSONObject data) { ((JSONNode)persistent_data).Add(pluginInfo.Metadata.GUID, (JSONNode)(object)data); } public static JSONObject GetPersistentData(PluginInfo pluginInfo) { return ((JSONNode)persistent_data)[pluginInfo.Metadata.GUID].AsObject; } [HarmonyPatch(typeof(PersistentPlayerData), "Serialize")] [HarmonyPostfix] private static void AddDataToSave(JSONObject __result) { try { ((JSONNode)__result).Add("mod_persistent_data", (JSONNode)(object)persistent_data); } catch { } } [HarmonyPatch(typeof(PersistentPlayerData), "Deserialize")] [HarmonyPostfix] private static void RetrieveDataFromSave(JSONNode jn) { try { persistent_data = jn["mod_persistent_data"].AsObject; } catch { } } } internal class EditorInput { public static bool GetKeyDown(KeyCode key) { return false; } public static bool GetKeyUp(KeyCode key) { return false; } public static bool GetKey(KeyCode key) { return false; } public static Vector3 GetMousePos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Vector3.zero; } public static Ray MouseRay() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return default(Ray); } } public static class Extensions { internal static JSONObject current_gun_data; internal static bool lah_force_bullet_display; internal static Queue> pose_spring_overrides = new Queue>(); internal static bool unlock_cursor; internal static bool confine_cursor; internal static bool freeze_camera_rotation; internal static Type konType = null; public static Harmony getConsoleColorHarmonyInstance; public static Harmony logEventArgsToStringHarmonyInstance; public static ConsoleColor BackgroundColor { get { return (ConsoleColor)(konType?.GetProperty("BackgroundColor").GetMethod.Invoke(null, null)); } set { konType?.GetProperty("BackgroundColor").SetMethod.Invoke(null, new object[1] { value }); } } public static ShellCasingScript GetBullet(this LocalAimHandler lah, Preset cartridge_dimension) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown return lah.GetBullet((Preset[])(object)new Preset[1] { (Preset)(int)cartridge_dimension }); } public static ShellCasingScript GetBullet(this LocalAimHandler lah, uint cartridge_dimension) { return lah.GetBullet((Preset[])(object)new Preset[1] { (Preset)cartridge_dimension }); } public static ShellCasingScript GetBullet(this LocalAimHandler lah, Preset[] cartridge_dimensions) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if ((Object)(object)lah == (Object)null) { Debug.LogError((object)"(Extension) LocalAimHandler.GetBullet(): This LocalAimHandler instance is null"); return null; } if (cartridge_dimensions == null) { Debug.LogError((object)"(Extension) LocalAimHandler.GetBullet(): You have to provide a CartridgeSpec array"); return null; } object obj = ReflectionManager.LAH_Get_Last_Bullet.Invoke(lah, new object[1] { cartridge_dimensions }); if (obj == null) { return null; } return (ShellCasingScript)ReflectionManager.LAH_BulletInventory_item.GetValue(obj); } public static ShellCasingScript GetBullet(this LocalAimHandler lah, uint[] cartridge_dimensions) { return lah.GetBullet(cartridge_dimensions.Cast().ToArray()); } public static void ShowBullets(this LocalAimHandler lah, bool show_bullets) { lah_force_bullet_display = show_bullets; } public static void ForceCursorUnlock(bool unlock, bool confine) { unlock_cursor = unlock; confine_cursor = confine; } public static void ShakeBullets(this LocalAimHandler lah) { if ((Object)(object)lah != (Object)null) { ReflectionManager.LAH_bullet_shake_time.SetValue(lah, Time.time); } } public static float GetSpringState(this LocalAimHandler lah, PoseSpring spring) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lah == (Object)null) { Debug.LogError((object)"(Extension) LocalAimHandler.GetSpringState(): This LocalAimHandler instance is null"); return 0f; } return ((Spring)ReflectionManager.LAH_pose_springs[spring].GetValue(lah)).state; } public static void OverrideSpringState(this LocalAimHandler lah, PoseSpring spring, float amount) { pose_spring_overrides.Enqueue(new Tuple(spring, amount)); } public static bool TryGetChild(this DirectoryInfo dir, string child_directory_name, out DirectoryInfo child_directory) { string path = Path.Combine(dir.FullName, child_directory_name); child_directory = new DirectoryInfo(path); return Directory.Exists(path); } public static void Disable(this ActiveItem active_item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) active_item.item_type = (Type)6; } public static void SetItemSpawn(this ActiveItem active_item, InventoryItem item, JSONObject persistentData = null) { active_item.SetItemSpawn(((Object)(object)item != (Object)null) ? item.InternalName : "", persistentData); } public static void SetItemSpawn(this ActiveItem active_item, string item_internal_name, JSONObject persistentData = null) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) active_item.item_type = (Type)11; active_item.internal_name = item_internal_name; if ((JSONNode)(object)persistentData != (object)null) { active_item.persistent_data = persistentData; } } public static bool AddItemsToSpawnList(this ReceiverCoreScript core_script, params InventoryItem[] items) { if (ModLoader.rcs_prefab_list_locked) { ModLoader.prefab_list_queue.AddRange(items); return false; } core_script.generic_prefabs = core_script.generic_prefabs.Concat(items).ToArray(); return true; } public static JSONObject GetCheckpointData(this ReceiverCoreScript core_script) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) return (JSONObject)(((object)current_gun_data) ?? ((object)new JSONObject())); } public static void RemovePersistentListeners(this UnityEventBase unity_event) { if (unity_event.GetPersistentEventCount() != 0) { object value = ReflectionManager.UEB_persistent_calls.GetValue(unity_event); ReflectionManager.PCG_Clear.Invoke(value, new object[0]); } } public static void MoveTo(this FileInfo source_file, string destination_file, bool overwrite) { if (overwrite && File.Exists(destination_file)) { File.Delete(destination_file); } source_file.MoveTo(destination_file); } public static BepInPlugin GetBepInAttribute(this BaseUnityPlugin plugin) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return (BepInPlugin)Attribute.GetCustomAttribute(((object)plugin).GetType(), typeof(BepInPlugin)); } public static bool TryFindObjectOfType(out T result) where T : Object { return (Object)(object)(result = Object.FindObjectOfType()) != (Object)null; } public static bool TryFindObjectsOfType(out T[] result) where T : Object { return (result = Object.FindObjectsOfType()) != null; } public static List ToCodeInstructions(this MethodInfo methodInfo, Dictionary replaceInstructionWith = null) { List originalInstructions = PatchProcessor.GetOriginalInstructions((MethodBase)methodInfo, (ILGenerator)null); if (replaceInstructionWith != null) { for (int i = 0; i < originalInstructions.Count; i++) { if (replaceInstructionWith.TryGetValue(originalInstructions[i], out var value)) { originalInstructions[i] = value; } } } return originalInstructions; } public static List ToCodeInstructionsClipLast(this MethodInfo methodInfo, out List