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 Flashlightier LC v1.1.1
plugins/Flashlightier_LC.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FlashlightierLC.Config; using FlashlightierLC.Patches; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("LethalCompanyModding")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Allows modifying various values of the flashlight/pro flashlight")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+5241234f31cedeea3a790f3404e8985021cfc5a6")] [assembly: AssemblyProduct("Flashlightier_LC")] [assembly: AssemblyTitle("dev.mamallama.lcmod.flashlightier")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/RobynLlama/Flashlightier-LC")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } } [BepInPlugin("dev.mamallama.lcmod.flashlightier", "Flashlightier_LC", "1.1.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static FlashlightConfig Flashlights; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Plugin Flashlightier_LC is loaded!"); Flashlights = new FlashlightConfig(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("dev.mamallama.lcmod.flashlightier"); val.PatchAll(typeof(FlashLightItem_Patches)); val.PatchAll(typeof(PlayerControllerB_Patches)); } } internal static class LCMPluginInfo { public const string PLUGIN_GUID = "dev.mamallama.lcmod.flashlightier"; public const string PLUGIN_NAME = "Flashlightier_LC"; public const string PLUGIN_VERSION = "1.1.1"; } namespace FlashlightierLC { internal static class LightExt { internal static void ModifyLight(this Light self, FlashlightDefinition def) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (def.Enabled.Value) { self.colorTemperature = def.ColorTemp.Value; self.intensity = def.Intensity.Value; self.spotAngle = def.Size.Value; self.useColorTemperature = def.UseColorTempValue.Value; if (!self.useColorTemperature) { self.color = def.LightColor; } } } internal static void ModifyFlashlight(this FlashlightItem self, FlashlightDefinition def) { if (def.Enabled.Value) { self.initialIntensity = def.Intensity.Value; self.flashlightBulb.ModifyLight(def); } } } } namespace FlashlightierLC.Patches { public class FlashLightItem_Patches { [HarmonyPatch(typeof(FlashlightItem), "Start")] [HarmonyPostfix] public static void OnStart(FlashlightItem __instance) { switch (__instance.flashlightTypeID) { case 0: __instance.ModifyFlashlight(Plugin.Flashlights.ProFlashlight); break; case 1: __instance.ModifyFlashlight(Plugin.Flashlights.SmallFlashlight); break; } } } public class PlayerControllerB_Patches { [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] public static void OnStart(PlayerControllerB __instance) { __instance.allHelmetLights[0].ModifyLight(Plugin.Flashlights.ProFlashlight); __instance.allHelmetLights[1].ModifyLight(Plugin.Flashlights.SmallFlashlight); } } } namespace FlashlightierLC.Config { internal class FlashlightConfig { public readonly FlashlightDefinition SmallFlashlight; public readonly FlashlightDefinition ProFlashlight; internal FlashlightConfig(ConfigFile Config) { SmallFlashlight = new FlashlightDefinition(Config.Bind<bool>("SmallFlash", "ReplaceEnabled", false, "Is this mod enabled for small flashlights?"), Config.Bind<int>("SmallFlash", "Color", 4678, "The temperature color of the light's beam.\n 2700 is a very warm orange\n 4650 is the in-game weak flashlight\n 5000-6500 is roughly daylight or a fluorescent light\n 8000 is the in-game pro flashlight "), Config.Bind<float>("SmallFlash", "Intensity", 397f, "The light's intensity.\nIf you have sensitive eyes lowering this to 275 can help"), Config.Bind<float>("SmallFlash", "Size", 55.4f, "The width of the beam as an angle."), Config.Bind<bool>("SmallFlash", "UseColorTempValue", true, "The game uses color temp to describe the light\nSetting this to false uses the RGB color instead"), Config.Bind<string>("SmallFlash", "LightColor", "128,128,128", "The color to use for the light.\nFollows the format 'Red,Green,Blue'\nIf you don't know what to put here google 'color picker'")); ProFlashlight = new FlashlightDefinition(Config.Bind<bool>("ProFlash", "ReplaceEnabled", false, "Is this mod enabled for pro flashlights?"), Config.Bind<int>("ProFlash", "Color", 8088, "The temperature color of the light's beam.\n 2700 is a very warm orange\n 4650 is the in-game weak flashlight\n 5000-6500 is roughly daylight or a fluorescent light\n 8000 is the in-game pro flashlight "), Config.Bind<float>("ProFlash", "Intensity", 486f, "The light's intensity.\nIf you have sensitive eyes lowering this to 275 can help"), Config.Bind<float>("ProFlash", "Size", 73f, "The width of the beam as an angle."), Config.Bind<bool>("ProFlash", "UseColorTempValue", true, "The game uses color temp to describe the light\nSetting this to false uses the RGB color instead"), Config.Bind<string>("ProFlash", "LightColor", "128,128,128", "The color to use for the light.\nFollows the format 'Red,Green,Blue'\nIf you don't know what to put here google 'color picker'")); Config.Save(); } } internal class FlashlightDefinition { public readonly ConfigEntry<bool> Enabled; public readonly ConfigEntry<bool> UseColorTempValue; public readonly ConfigEntry<int> ColorTemp; public readonly ConfigEntry<float> Intensity; public readonly ConfigEntry<float> Size; public readonly ConfigEntry<string> LightColorString; public readonly Color LightColor; internal FlashlightDefinition(ConfigEntry<bool> Enabled, ConfigEntry<int> ColorTemp, ConfigEntry<float> Intensity, ConfigEntry<float> Size, ConfigEntry<bool> UseColorTempValue, ConfigEntry<string> LightColorString) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) this.Enabled = Enabled; this.ColorTemp = ColorTemp; this.Intensity = Intensity; this.Size = Size; this.UseColorTempValue = UseColorTempValue; this.LightColorString = LightColorString; (float Red, float Green, float Blue) tupleFromString = GetTupleFromString(LightColorString.Value); float item = tupleFromString.Red; float item2 = tupleFromString.Green; float item3 = tupleFromString.Blue; LightColor = new Color(item, item2, item3); } internal static (float Red, float Green, float Blue) GetTupleFromString(string Input) { string[] array = Input.Split(','); if (array.Length < 3) { throw new Exception("Unable to parse color value, not enough values"); } if (!float.TryParse(array[0], out var result)) { throw new Exception("Unable to parse color value red | " + array[0]); } if (!float.TryParse(array[1], out var result2)) { throw new Exception("Unable to parse color value green | " + array[1]); } if (!float.TryParse(array[2], out var result3)) { throw new Exception("Unable to parse color value blue | " + array[2]); } result = Math.Clamp(result, 0f, 255f); result2 = Math.Clamp(result2, 0f, 255f); result3 = Math.Clamp(result3, 0f, 255f); result /= 255f; result2 /= 255f; result3 /= 255f; return (result, result2, result3); } } }