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 LampaliCompali v1.0.0
LampaliCompali.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using LampaliCompali.Patches; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LampaliCompali")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LampaliCompali")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("21c54bc4-f21a-4549-aaca-7dbef5d96a98")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LampaliCompali { public static class ConfigSettings { public static ConfigEntry<string> videoPath; public static void BindConfigSettings() { LampaliCompaliBase.Log("BindingConfigs"); videoPath = ((BaseUnityPlugin)LampaliCompaliBase.Instance).Config.Bind<string>("LampaliCompali", "CustomVideoPath", "Brave-LampaliCompali/television_video.mp4", "Absolute or local video path. Use forward slashes in your path. Local paths are local to the BepInEx/plugins folder, and should not begin with a slash."); } } [BepInPlugin("Bravebomb.LampaliCompali", "Lampali Compali", "1.0.0.0")] public class LampaliCompaliBase : BaseUnityPlugin { private const string modGUID = "Bravebomb.LampaliCompali"; private const string modName = "Lampali Compali"; private const string modVersion = "1.0.0.0"; private Harmony harmony; public static LampaliCompaliBase Instance; public static string filePath; private void Awake() { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } ConfigSettings.BindConfigSettings(); filePath = ConfigSettings.videoPath.Value; if (filePath.Length <= 0 || Enumerable.Contains(filePath, ' ')) { filePath = ((ConfigEntryBase)ConfigSettings.videoPath).DefaultValue.ToString(); } filePath = filePath.Replace('/', Path.DirectorySeparatorChar); if (!Path.IsPathRooted(filePath)) { filePath = Path.Combine(Paths.PluginPath, filePath.TrimStart(new char[1] { '/' })); } Log("Using path from config: " + filePath); harmony = new Harmony("Bravebomb.LampaliCompali"); harmony.PatchAll(typeof(LampaliCompaliBase)); harmony.PatchAll(typeof(TelevesionPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LampaliCompali mod loaded"); } public static void Log(string message) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)message); } } } namespace LampaliCompali.Patches { [HarmonyPatch] internal class TelevesionPatch { [HarmonyPatch(typeof(TVScript), "TVFinishedClip")] [HarmonyPrefix] public static bool TVFinishedClip() { return false; } [HarmonyPatch(typeof(TVScript), "Update")] [HarmonyPrefix] public static bool Update() { return false; } [HarmonyPatch(typeof(TVScript), "TurnTVOnOff")] [HarmonyPrefix] public static bool TurnTVOnOff(bool on, TVScript __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 __instance.tvOn = on; if ((int)__instance.video.source != 1 || __instance.video.url == "") { __instance.video.clip = null; __instance.tvSFX.clip = null; __instance.video.url = "file://" + LampaliCompaliBase.filePath; __instance.video.source = (VideoSource)1; __instance.video.controlledAudioTrackCount = 1; __instance.video.audioOutputMode = (VideoAudioOutputMode)1; __instance.video.SetTargetAudioSource((ushort)0, __instance.tvSFX); __instance.video.Prepare(); __instance.video.Stop(); __instance.tvSFX.Stop(); } if (on) { LampaliCompaliBase.Log("Turning on TV"); SetTVScreenMaterial(__instance, b: true); __instance.video.Play(); __instance.tvSFX.Play(); __instance.tvSFX.PlayOneShot(__instance.switchTVOn); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOn, 1f); } else { LampaliCompaliBase.Log("Turning off TV"); SetTVScreenMaterial(__instance, b: false); __instance.tvSFX.Stop(); __instance.tvSFX.PlayOneShot(__instance.switchTVOff); __instance.video.Stop(); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOff, 1f); } return false; } public static void SetTVScreenMaterial(TVScript instance, bool b) { MethodInfo method = ((object)instance).GetType().GetMethod("SetTVScreenMaterial", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(instance, new object[1] { b }); } } }