Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ReservedRadarBoosterSlot v1.0.5
ReservedRadarBoosterSlot.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using ReservedItemSlotCore; using ReservedItemSlotCore.Data; using ReservedRadarBoosterSlot.Compat; using ReservedRadarBoosterSlot.Input; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ReservedRadarBoosterSlot { internal class Metadata { public const string GUID = "snacksbr.lethalcompany.reservedradarboosterslot"; public const string NAME = "ReservedRadarBoosterSlot"; public const string VERSION = "1.0.5"; } [BepInPlugin("snacksbr.lethalcompany.reservedradarboosterslot", "ReservedRadarBoosterSlot", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Plugin Instance; private readonly Harmony harmony = new Harmony("snacksbr.lethalcompany.reservedradarboosterslot"); internal static readonly ManualLogSource mls = Logger.CreateLogSource("ReservedRadarBoosterSlot"); public static ReservedItemSlotData RadarSlot; public static ReservedItemData RadarItemData; private void Awake() { //IL_0013: 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_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown Instance = this; Settings.Init(); RadarItemData = new ReservedItemData("Radar-booster", (PlayerBone)0, default(Vector3), default(Vector3)); RadarSlot = ReservedItemSlotData.CreateReservedItemSlotData("RadarSlot", 667, 100); RadarSlot.purchasePrice = Settings.RadarPrice.Value; RadarSlot.AddItemToReservedItemSlot(RadarItemData); try { Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { ex.Types.Where((Type t) => t != null); } if (Settings.DeployRadarBooster.Value && InputUtils_Compat.Enabled) { InputUtils_Compat.Init(); } harmony.PatchAll(); } } public static class Settings { public static Dictionary<string, ConfigEntryBase> ConfigEntries = new Dictionary<string, ConfigEntryBase>(); public static ConfigEntry<string> DeployRadarBoosterKey; public static ConfigEntry<bool> DeployRadarBooster; public static ConfigEntry<int> RadarPrice; public static void Init() { DeployRadarBoosterKey = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<string>("ReservedRadarBoosterSlot", "DropRadarBoosterKey", "<Keyboard>/r", "Keybind to drop the Radar Booster on the ground. (will be ignored if InputUtils is present)"); DeployRadarBooster = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("ReservedRadarBoosterSlot", "DeployRadarBooster", true, "Enable the keybind to activate and drop the Radar Booster."); RadarPrice = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<int>("ReservedPeeperSlot", "RadarPrice", 0, "Price for the Radar Slot. If set to 0 the slot will unlock automatically"); ConfigEntries.Add(((ConfigEntryBase)DeployRadarBoosterKey).Definition.Key, (ConfigEntryBase)(object)DeployRadarBoosterKey); ConfigEntries.Add(((ConfigEntryBase)DeployRadarBooster).Definition.Key, (ConfigEntryBase)(object)DeployRadarBooster); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ReservedRadarBoosterSlot"; public const string PLUGIN_NAME = "ReservedRadarBoosterSlot"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ReservedRadarBoosterSlot.Input { internal class IngameKeybinds : LcInputActions { public static IngameKeybinds Instance = new IngameKeybinds(); [InputAction("<Keyboard>/r", Name = "[ReservedRadarBoosterSlot]\nDrop Radar Booster")] public InputAction DropRadarBoosterAction { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } [HarmonyPatch] internal static class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; private static InputAction DropRadarBoosterAction; public static PlayerControllerB LocalPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Settings.DeployRadarBooster.Value) { if (InputUtils_Compat.Enabled) { Asset = InputUtils_Compat.Asset; ActionMap = Asset.actionMaps[0]; DropRadarBoosterAction = IngameKeybinds.Instance.DropRadarBoosterAction; } else { Asset = ScriptableObject.CreateInstance<InputActionAsset>(); ActionMap = new InputActionMap("ReservedRadarBoosterSlot"); InputActionSetupExtensions.AddActionMap(Asset, ActionMap); DropRadarBoosterAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedRadarBoosterSlot.DropRadarBoosterAction", (InputActionType)0, Settings.DeployRadarBoosterKey.Value, "Press", (string)null, (string)null, (string)null); } } } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { if (Settings.DeployRadarBooster.Value) { Asset.Enable(); DropRadarBoosterAction.performed += OnDropRadarBoosterPerformed; } } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { if (Settings.DeployRadarBooster.Value) { Asset.Disable(); DropRadarBoosterAction.performed -= OnDropRadarBoosterPerformed; } } private static void OnDropRadarBoosterPerformed(CallbackContext context) { if ((Object)(object)LocalPlayerController == (Object)null || !LocalPlayerController.isPlayerControlled || (((NetworkBehaviour)LocalPlayerController).IsServer && !LocalPlayerController.isHostPlayerObject)) { return; } try { if (SessionManager.unlockedReservedItemSlotsDict.TryGetValue(Plugin.RadarSlot.slotName, out var value)) { List<ReservedItemSlotData> list = new List<ReservedItemSlotData>(1) { value }; if (list.Count > 0) { ReservedHotbarManager.ForceToggleReservedHotbar(list.ToArray()); ((MonoBehaviour)LocalPlayerController).StartCoroutine(ShuffleItems()); } } } catch (Exception ex) { Plugin.mls.LogError((object)ex.Message); Plugin.mls.LogError((object)ex.StackTrace); TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "Error when dropping Radar Booster"; } } private static IEnumerator ShuffleItems() { yield return (object)new WaitForSeconds(0.2f); if ((Object)(object)LocalPlayerController.currentlyHeldObjectServer != (Object)null) { ((RadarBoosterItem)LocalPlayerController.currentlyHeldObjectServer).EnableRadarBooster(true); yield return (object)new WaitForSeconds(0.1f); LocalPlayerController.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } yield return (object)new WaitForSeconds(0.1f); ReservedHotbarManager.FocusReservedHotbarSlots(false, -1); } } } namespace ReservedRadarBoosterSlot.Compat { public static class InputUtils_Compat { internal static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils"); internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); public static InputAction DropRadarBoosterAction => IngameKeybinds.Instance.DropRadarBoosterAction; internal static void Init() { if (Enabled && IngameKeybinds.Instance == null) { IngameKeybinds.Instance = new IngameKeybinds(); } } } }