Please disclose if your mod was created primarily 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 LethalFlashlights v2.0.0
LethalFlashlights.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Unity.Netcode; 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 = "")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("LethalFlashlights")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Flashlights have a 10% chance to have a minor but fatal malfunction")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")] [assembly: AssemblyProduct("LethalFlashlights")] [assembly: AssemblyTitle("LethalFlashlights")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] namespace LethalModding { public static class FlashlightPatch { private static ManualLogSource logger = Logger.CreateLogSource("FlashlightPatch"); public static void Explosion(FlashlightItem __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) float value = LethalFlashlights.configExplosionRate.Value; Random random = new Random(); float num = random.Next(0, 10000) / 100; if (num <= value) { logger.LogInfo((object)"Plugin LethalFlashlights: Flashlight failure"); PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; Vector3 value2 = ((playerHeldBy != null) ? new Vector3?(((Component)playerHeldBy).transform.position) : null).Value; logger.LogDebug((object)string.Format("Plugin {0}: Explosion spawned at {1}", "LethalFlashlights", value2)); Landmine.SpawnExplosion(value2, true, 3f, 5f); } } [HarmonyPatch(typeof(GrabbableObject), "ActivateItemServerRpc")] [HarmonyPostfix] private static void ServerRpcPatch(GrabbableObject __instance) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (networkManager != null && networkManager.IsListening && (networkManager.IsServer || networkManager.IsHost)) { FlashlightItem val = (FlashlightItem)(object)((__instance is FlashlightItem) ? __instance : null); if (val != null && (Object)(object)__instance.playerHeldBy != (Object)null) { logger.LogDebug((object)"Plugin LethalFlashlights: Flashlight detected"); Explosion(val); } } } } [BepInPlugin("LethalFlashlights", "LethalFlashlights", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalFlashlights : BaseUnityPlugin { public static AssetBundle MainAssetBundle; public static ConfigEntry<float> configExplosionRate; private void Awake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalFlashlights is loaded!"); configExplosionRate = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ExplosionRate", 10f, "Changes the likelihood of your flashlight exploding"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalFlashlights: Config generated!"); FloatStepSliderConfigItem val = new FloatStepSliderConfigItem(configExplosionRate, new FloatStepSliderOptions { RequiresRestart = false, Min = 0f, Max = 100f, Step = 0.01f }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalFlashlights: Created config slider!"); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); Harmony.CreateAndPatchAll(typeof(FlashlightPatch), "LethalFlashlights"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalFlashlights"; public const string PLUGIN_NAME = "LethalFlashlights"; public const string PLUGIN_VERSION = "2.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }