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 MagicFlashlight v1.2.2
MagicFlashlight.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using MagicFlashlight.Patches; 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: AssemblyTitle("MagicFlashlight")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MagicFlashlight")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a9cd05c8-41c3-431a-9e01-970215e27f0f")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.2.2.0")] namespace MagicFlashlight { [BepInPlugin("MagicFlashlight", "Lethal Company - Magic Flashlight", "1.2.2.0")] public class MagicFlashlightBase : BaseUnityPlugin { private const string modGUID = "MagicFlashlight"; private const string modName = "Lethal Company - Magic Flashlight"; private const string modVersion = "1.2.2.0"; private readonly Harmony harmony = new Harmony("MagicFlashlight"); private static MagicFlashlightBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("MagicFlashlight"); mls.LogInfo((object)"Lethal Company - Magic Flashlight 1.2.2.0 has awakened"); harmony.PatchAll(typeof(MagicFlashlightBase)); harmony.PatchAll(typeof(FlashlightPatch)); harmony.PatchAll(typeof(ShipTeleporterPatch)); harmony.PatchAll(typeof(ItemDropshipPatch)); harmony.PatchAll(typeof(StartingCreditsPatch)); mls.LogInfo((object)"Lethal Company - Magic Flashlight 1.2.2.0 patching has completed."); } } } namespace MagicFlashlight.Patches { [HarmonyPatch(typeof(FlashlightItem))] public class FlashlightPatch { [HarmonyPatch("SwitchFlashlight")] [HarmonyPrefix] private static void SwitchFlashlightPatch(FlashlightItem __instance, ref bool on) { //IL_006c: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (on && __instance.flashlightTypeID == 1 && ((GrabbableObject)__instance).insertedBattery.charge > 0f) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (!playerHeldBy.isInHangarShipRoom) { Random random = new Random(); Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, RoundManager.Instance.navHit, random, -1); Vector3 position2 = ((Component)playerHeldBy).gameObject.transform.position; __instance.flashlightAudio.PlayOneShot(__instance.flashlightClips[Random.Range(0, __instance.flashlightClips.Length)]); Landmine.SpawnExplosion(position2, true, 0f, 0f, 50, 0f, (GameObject)null, false); playerHeldBy.TeleportPlayer(position, false, 0f, false, true); ((GrabbableObject)__instance).insertedBattery.charge = 0f; Landmine.SpawnExplosion(position, true, 0f, 0f, 50, 0f, (GameObject)null, false); } on = false; } } } [HarmonyPatch(typeof(ItemDropship))] public class ItemDropshipPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void Update(ItemDropship __instance) { bool flag = false; if (((NetworkBehaviour)__instance).IsServer && !__instance.deliveringOrder && !flag) { __instance.shipTimer = 40f; flag = true; } } } [HarmonyPatch(typeof(ShipTeleporter))] public class ShipTeleporterPatch { [HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")] [HarmonyPrefix] private static bool dontDropItemsInverseTeleporter(ShipTeleporter __instance, ref int playerObj, ref Vector3 teleportPos) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) MethodInfo method = ((object)__instance).GetType().GetMethod("SetPlayerTeleporterId", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = ((object)__instance).GetType().GetMethod("TeleportBodyOut", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method3 = ((object)__instance).GetType().GetMethod("SpikeTrapsReactToInverseTeleport", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method4 = ((object)__instance).GetType().GetMethod("SetCaveReverb", BindingFlags.Instance | BindingFlags.NonPublic); if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead) { object[] parameters = new object[2] { playerObj, teleportPos }; ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method2.Invoke(__instance, parameters)); return false; } method3.Invoke(__instance, null); object[] parameters2 = new object[1] { StartOfRound.Instance.allPlayerScripts[playerObj] }; method4.Invoke(__instance, parameters2); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; object[] parameters3 = new object[2] { val, -1 }; method.Invoke(__instance, parameters3); if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val); } val.isInElevator = false; val.isInHangarShipRoom = false; val.isInsideFactory = true; val.averageVelocity = 0f; val.velocityLastFrame = Vector3.zero; StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true); StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play(); __instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX); StartOfRound.Instance.allPlayerScripts[playerObj].movementAudio.PlayOneShot(__instance.teleporterBeamUpSFX); if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Debug.Log((object)"Teleporter shaking camera"); HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } return false; } } [HarmonyPatch(typeof(TimeOfDay))] public class StartingCreditsPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake(TimeOfDay __instance) { if (__instance.quotaVariables != null) { __instance.quotaVariables.startingCredits = 500; } } } }