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 Deep Lethal Galactic UNFINISHED v0.1.2
DLGMod.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using DLGMod.StartPatches; using HarmonyLib; 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("DLGMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DLGMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bcc02f41-881a-4161-b4d1-19abd8fe6da7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DLGMod { [BepInPlugin("XRTG074TheDeveloper.DeepLethalGalactic", "Deep Lethal Galactic", "0.0.0.1")] public class DLGModMain : BaseUnityPlugin { internal const string GUID = "XRTG074TheDeveloper.DeepLethalGalactic"; internal readonly Harmony harmonyInstance = new Harmony("XRTG074TheDeveloper.DeepLethalGalactic"); internal static ManualLogSource logger; internal static string filesPath; internal static List<AudioClip> MissionControlQuotesSFX; internal static List<AudioClip> swarmSFX; internal static int playersAmount; private void Awake() { logger = Logger.CreateLogSource("XRTG074TheDeveloper.DeepLethalGalactic"); MissionControlQuotesSFX = new List<AudioClip>(); filesPath = ((BaseUnityPlugin)this).Info.Location; filesPath = filesPath.TrimEnd("DLGMod.dll".ToCharArray()); AssetBundle val = AssetBundle.LoadFromFile(filesPath + "SoundBundles\\MissionControlQuotes\\mission_control_quotes"); if ((Object)(object)val != (Object)null) { MissionControlQuotesSFX = val.LoadAllAssets<AudioClip>().ToList(); } val = AssetBundle.LoadFromFile(filesPath + "SoundBundles\\Swarms\\swarm"); if ((Object)(object)val != (Object)null) { swarmSFX = val.LoadAllAssets<AudioClip>().ToList(); } harmonyInstance.PatchAll(typeof(WelcomeSpeechPatch)); harmonyInstance.PatchAll(typeof(AmmunitionPatch)); harmonyInstance.PatchAll(typeof(ChatCommandsPatch)); harmonyInstance.PatchAll(typeof(SwarmPatch)); } internal static void SendAmmunition(int _playersAmount) { playersAmount = _playersAmount; AmmunitionPatch.shouldBeSent = true; } internal static void SendResupply(int _playersAmount) { playersAmount = _playersAmount; AmmunitionPatch.shouldBeSent = true; AmmunitionPatch.resupplyOrdered = true; } } } namespace DLGMod.StartPatches { [HarmonyPatch(typeof(StartOfRound))] internal class WelcomeSpeechPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StarterSetUp(StartOfRound __instance) { __instance.shipIntroSpeechSFX = DLGModMain.MissionControlQuotesSFX[2]; } [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] public static void CheckChosenLevel(StartOfRound __instance) { if (__instance.currentLevelID != 3) { DLGModMain.SendAmmunition(__instance.connectedPlayersAmount + 1); } } } [HarmonyPatch(typeof(Terminal))] internal class AmmunitionPatch { internal static bool shouldBeSent; internal static bool resupplyOrdered; [HarmonyPatch("Update")] [HarmonyPostfix] public static void SendAmmunition(Terminal __instance) { if (!shouldBeSent || !((NetworkBehaviour)__instance).IsHost) { return; } Item val = Resources.FindObjectsOfTypeAll<AllItemsList>()[0].itemsList[59]; Item val2 = Resources.FindObjectsOfTypeAll<AllItemsList>()[0].itemsList[60]; __instance.buyableItemsList[0] = val; __instance.buyableItemsList[1] = val2; List<int> list = new List<int>(); if (!resupplyOrdered) { for (int i = 0; i < DLGModMain.playersAmount; i++) { list.Add(0); list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); } __instance.orderedItemsFromTerminal = list; __instance.numberOfItemsInDropship = list.Count; } else { for (int j = 0; j < DLGModMain.playersAmount; j++) { list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); list.Add(1); } __instance.orderedItemsFromTerminal = list; __instance.numberOfItemsInDropship = list.Count; resupplyOrdered = false; } shouldBeSent = false; } } [HarmonyPatch(typeof(HUDManager))] internal class ChatCommandsPatch { internal static bool isConfirmation; [HarmonyPatch("AddPlayerChatMessageClientRpc")] [HarmonyPostfix] public static void GetMessage(ref string chatMessage, ref int playerId, HUDManager __instance) { if (((NetworkBehaviour)__instance).IsHost && playerId != -1) { if (chatMessage == "/resupply" && !isConfirmation) { isConfirmation = true; __instance.AddTextToChatOnServer("Please confrim resupply order by sending '/confirm' message or deny it by sending any other", -1); } else if (chatMessage == "/confirm" && isConfirmation) { isConfirmation = false; __instance.AddTextToChatOnServer(__instance.playersManager.allPlayerScripts[playerId].playerUsername + " ordered a resupply!", -1); DLGModMain.SendResupply(DLGModMain.playersAmount); } else if (isConfirmation && chatMessage != "/resupply") { isConfirmation = false; __instance.AddTextToChatOnServer("Order is cancelled by " + __instance.playersManager.allPlayerScripts[playerId].playerUsername, -1); } } } [HarmonyPatch("AddTextMessageClientRpc")] [HarmonyPrefix] public static void GetSwarmMessage(ref string chatMessage) { DLGModMain.logger.LogInfo((object)chatMessage); TimeOfDay val = Object.FindObjectOfType<TimeOfDay>(); switch (chatMessage) { case "SWARM!": val.TimeOfDayMusic.volume = 1f; val.TimeOfDayMusic.PlayOneShot(DLGModMain.MissionControlQuotesSFX[1], 1f); val.TimeOfDayMusic.PlayOneShot(DLGModMain.swarmSFX[1], 1f); break; case "THEY ARE HERE!!!": val.TimeOfDayMusic.clip = DLGModMain.swarmSFX[0]; val.TimeOfDayMusic.Play(); val.TimeOfDayMusic.loop = true; SwarmPatch.isSwarmSFXLooped = true; break; case "SWARM IS ALMOST OVER": val.TimeOfDayMusic.PlayOneShot(DLGModMain.MissionControlQuotesSFX[0], 1f); val.TimeOfDayMusic.loop = false; SwarmPatch.isSwarmSFXLooped = false; SwarmPatch.isSwarmSFXFading = true; break; } } } [HarmonyPatch(typeof(TimeOfDay))] internal class SwarmPatch { internal static float chance = 0f; internal static bool isSwarm = false; internal static bool isSwarmSFXLooped = false; internal static bool isSwarmSFXFading = false; internal static HUDManager hudManager = Object.FindObjectOfType<HUDManager>(); [HarmonyPatch("SyncTimeClientRpc")] [HarmonyPostfix] public static void test(TimeOfDay __instance) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsHost) { return; } RoundManager val = Object.FindObjectOfType<RoundManager>(); int num = Random.Range(30, 100); int num2 = 0; DLGModMain.logger.LogInfo((object)__instance.TimeOfDayMusic.loop); EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(); foreach (EnemyAI val2 in array) { if (!val2.isEnemyDead && (val2.enemyType.enemyName == "Crawler" || val2.enemyType.enemyName == "Bunker Spider")) { num2++; } } if ((float)num <= chance && num2 < 3) { for (int j = 0; j < DLGModMain.playersAmount * 9; j++) { int num3 = ((Random.Range(1, 4) == 1) ? 1 : 4); EnemyVent val3 = val.allEnemyVents[Random.Range(1, val.allEnemyVents.Length)]; val.SpawnEnemyOnServer(((Component)val3).transform.position, ((Component)val3).transform.eulerAngles.y, num3); } isSwarm = true; hudManager.AddTextToChatOnServer("SWARM!", -1); chance = 0f; } else if (num2 >= 3) { chance += 0.25f; } else { if (isSwarm) { hudManager.AddTextToChatOnServer("SWARM IS ALMOST OVER", -1); isSwarm = false; } chance += 10f; } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void ChangeSwarmSFX(TimeOfDay __instance) { if (isSwarm && !__instance.TimeOfDayMusic.isPlaying && !isSwarmSFXLooped) { hudManager.AddTextToChatOnServer("THEY ARE HERE!!!", -1); } if (!isSwarm && __instance.TimeOfDayMusic.isPlaying && isSwarmSFXFading) { if (__instance.TimeOfDayMusic.volume > 0f) { AudioSource timeOfDayMusic = __instance.TimeOfDayMusic; timeOfDayMusic.volume -= 0.08f * Time.deltaTime; } else { __instance.TimeOfDayMusic.Stop(); isSwarmSFXFading = false; } } } } }