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 Peeper v1.0.3
BepInEx/plugins/Peeper/Peeper.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using CustomItemBehaviourLibrary.AbstractItems; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Peeper.Behaviour; using Peeper.Misc; using Peeper.NetcodePatcher; using Peeper.Util; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [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)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 Peeper { [BepInPlugin("com.github.WhiteSpike.Peeper", "Peeper", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string ITEM_NAME = "Peeper"; internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.Peeper"); internal static readonly ManualLogSource mls = Logger.CreateLogSource("Peeper"); public static PluginConfig Config; private void Awake() { //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) Config = new PluginConfig(((BaseUnityPlugin)this).Config); IEnumerable<Type> enumerable; try { enumerable = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { enumerable = ex.Types.Where((Type t) => t != null); } foreach (Type item in enumerable) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "peeperItem"); AssetBundle val = AssetBundle.LoadFromFile(text); string text2 = "Assets/Peeper/"; Item val2 = ScriptableObject.CreateInstance<Item>(); ((Object)val2).name = "PeeperItemProperties"; val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.DROP_AHEAD_PLAYER); val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.GRABBED_BEFORE_START); val2.canBeInspected = false; val2.creditsWorth = SyncedEntry<int>.op_Implicit(Config.PRICE); val2.restingRotation = new Vector3(0f, 0f, 0f); val2.rotationOffset = new Vector3(100f, 0f, 225f); val2.positionOffset = new Vector3(-1f, 0.1f, 0.9f); val2.weight = 1f + (float)(SyncedEntry<int>.op_Implicit(Config.WEIGHT) - 1) / 100f; val2.twoHanded = SyncedEntry<bool>.op_Implicit(Config.TWO_HANDED); val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png"); val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "Peeper.prefab"); val2.dropSFX = val.LoadAsset<AudioClip>(text2 + "Drop.ogg"); val2.grabSFX = val.LoadAsset<AudioClip>(text2 + "Grab.ogg"); val2.pocketSFX = val.LoadAsset<AudioClip>(text2 + "Pocket.ogg"); val2.throwSFX = val.LoadAsset<AudioClip>(text2 + "Throw.ogg"); val2.highestSalePercentage = SyncedEntry<int>.op_Implicit(Config.HIGHEST_SALE_PERCENTAGE); val2.itemName = "Peeper"; val2.itemSpawnsOnGround = true; val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE); val2.requiresBattery = false; val2.batteryUsage = 0f; PeeperBehaviour peeperBehaviour = val2.spawnPrefab.AddComponent<PeeperBehaviour>(); ((GrabbableObject)peeperBehaviour).itemProperties = val2; ((GrabbableObject)peeperBehaviour).grabbable = true; ((GrabbableObject)peeperBehaviour).grabbableToEnemies = true; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); TerminalNode val3 = SetupInfoNode(); Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth); mls.LogInfo((object)"Peeper 1.0.0 has been loaded successfully."); } internal static TerminalNode SetupInfoNode() { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = val.displayText + GetDisplayInfo() + "\n"; val.clearPreviousText = true; return val; } public static string GetDisplayInfo() { return "Looks at Coil-Heads for you.\n"; } } public static class PluginInfo { public const string PLUGIN_GUID = "Peeper"; public const string PLUGIN_NAME = "MoreShipUpgrades"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Peeper.Util { internal static class Constants { internal const string ITEM_SCAN_NODE_KEY_FORMAT = "Enable scan node of {0}"; internal const bool ITEM_SCAN_NODE_DEFAULT = true; internal const string ITEM_SCAN_NODE_DESCRIPTION = "Shows a scan node on the item when scanning"; internal const string PEEPER_PRICE_KEY = "Peeper price"; internal const int PEEPER_PRICE_DEFAULT = 500; internal const string PEEPER_PRICE_DESCRIPTION = "Price for Peeper."; internal const string PEEPER_WEIGHT_KEY = "Item weight"; internal const int PEEPER_WEIGHT_DEFAULT = 15; internal const string PEEPER_WEIGHT_DESCRIPTION = "Weight (in lbs)"; internal const string PEEPER_TWO_HANDED_KEY = "Two Handed Item"; internal const bool PEEPER_TWO_HANDED_DEFAULT = false; internal const string PEEPER_TWO_HANDED_DESCRIPTION = "One or two handed item."; internal const string PEEPER_CONDUCTIVE_KEY = "Conductive"; internal const bool PEEPER_CONDUCTIVE_DEFAULT = true; internal const string PEEPER_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)"; internal const string PEEPER_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping"; internal const bool PEEPER_DROP_AHEAD_PLAYER_DEFAULT = true; internal const string PEEPER_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront."; internal const string PEEPER_GRABBED_BEFORE_START_KEY = "Grabbable before game start"; internal const bool PEEPER_GRABBED_BEFORE_START_DEFAULT = true; internal const string PEEPER_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not"; internal const string PEEPER_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage"; internal const int PEEPER_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50; internal const string PEEPER_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale."; internal const string PEEPER_MAXIMUM_RANGE_KEY = "Maximum Spot Range"; internal const int PEEPER_MAXIMUM_RANGE_DEFAULT = 60; internal const string PEEPER_MAXIMUM_RANGE_DESCRIPTION = "How far the Peeper item can spot a Coil-Head entity to stop it from moving"; internal static readonly string PEEPER_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Peeper"); } } namespace Peeper.Misc { [DataContract] public class PluginConfig : SyncedConfig2<PluginConfig> { [field: SyncedEntryField] public SyncedEntry<bool> SCAN_NODE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> PRICE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> WEIGHT { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> TWO_HANDED { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> DROP_AHEAD_PLAYER { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> GRABBED_BEFORE_START { get; set; } [field: SyncedEntryField] public SyncedEntry<bool> CONDUCTIVE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> HIGHEST_SALE_PERCENTAGE { get; set; } [field: SyncedEntryField] public SyncedEntry<int> MAXIMUM_RANGE { get; set; } public PluginConfig(ConfigFile cfg) : base("com.github.WhiteSpike.Peeper") { string text = "Peeper"; PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Peeper price", 500, "Price for Peeper."); WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 15, "Weight (in lbs)"); TWO_HANDED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Two Handed Item", false, "One or two handed item."); SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.PEEPER_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning"); DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", true, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront."); CONDUCTIVE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Conductive", true, "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)"); GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", true, "Allows wether the item can be grabbed before hand or not"); HIGHEST_SALE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Highest Sale Percentage", 50, "Maximum percentage of sale allowed when this item is selected for a sale."); MAXIMUM_RANGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum Spot Range", 60, "How far the Peeper item can spot a Coil-Head entity to stop it from moving"); ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this); } } internal static class Metadata { public const string GUID = "com.github.WhiteSpike.Peeper"; public const string NAME = "Peeper"; public const string VERSION = "1.0.0"; } } namespace Peeper.Behaviour { internal class PeeperBehaviour : LookoutBehaviour { private Animator animator; public override void Start() { ((LookoutBehaviour)this).Start(); base.maximumRange = SyncedEntry<int>.op_Implicit(Plugin.Config.MAXIMUM_RANGE); animator = ((Component)this).GetComponent<Animator>(); } protected override void SetActive(bool enable) { ((LookoutBehaviour)this).SetActive(enable); animator.SetBool("Grounded", enable); } protected override void __initializeVariables() { ((LookoutBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PeeperBehaviour"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace Peeper.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }