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 FishInABarrel v1.0.4
FishInABarrel.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using FishInABarrel.NetcodePatcher; using FishInABarrel.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [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: AssemblyCompany("FishInABarrel")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FishInABarrel")] [assembly: AssemblyTitle("FishInABarrel")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace FishInABarrel { [BepInPlugin("jarediscoding.fishinabarrel", "FishInABarrel", "1.0.4")] public class BasePlugin : BaseUnityPlugin { private static BasePlugin Instance; private const string ModGUID = "jarediscoding.fishinabarrel"; private const string ModName = "FishInABarrel"; private const string ModVersion = "1.0.4"; public static ManualLogSource LogSource; private readonly Harmony harmony = new Harmony("jarediscoding.fishinabarrel"); private static readonly Type[] PatchList = new Type[12] { typeof(BlobAIPatch), typeof(BoomBoxItemPatch), typeof(FlashlightItemPatch), typeof(HUDManagerPatch), typeof(PlayerControllerBPatch), typeof(RedLocustBeesPatch), typeof(RoundManagerPatch), typeof(ShipTeleporterPatch), typeof(ShotgunItemPatch), typeof(StartOfRoundPatch), typeof(TerminalPatch), typeof(TimeOfDayPatch) }; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } LogSource = Logger.CreateLogSource("jarediscoding.fishinabarrel"); Type[] patchList = PatchList; foreach (Type type in patchList) { harmony.PatchAll(type); LogSource.LogDebug((object)$"{type} complete"); } SceneManager.sceneLoaded += StorePatch.OnLoaded; LogSource.LogDebug((object)"FishInABarrel.Patches.StorePatch complete"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type2 in array) { MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } LogSource.LogInfo((object)"Load complete"); } } } namespace FishInABarrel.Patches { [HarmonyPatch(typeof(BlobAI))] internal class BlobAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void PostUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (GameNetworkManager.Instance.isHostingGame) { BlobAI val = Object.FindObjectOfType<BlobAI>(); ((EnemyAI)val).enemyType.canDie = true; ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)val); } } } [HarmonyPatch(typeof(BoomboxItem))] internal class BoomBoxItemPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(ref Item ___itemProperties) { ___itemProperties.requiresBattery = false; } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(ref Item ___itemProperties) { ___itemProperties.requiresBattery = false; } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static bool PreUpdate(ref HUDElement ___Clock) { ___Clock.targetAlpha = 1f; return true; } [HarmonyPatch("DisplayDaysLeft")] [HarmonyPostfix] public static void PostDisplayDaysLeft() { ((TMP_Text)HUDManager.Instance.profitQuotaDaysLeftText).text = "999 Days Left"; ((TMP_Text)HUDManager.Instance.profitQuotaDaysLeftText2).text = "999 Days Left"; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void PostUpdate(ref float ___sprintMeter) { ___sprintMeter = 1f; } [HarmonyPrefix] [HarmonyPatch("DespawnHeldObject")] private static bool PreDespawnHeldObject() { if (((object)GameNetworkManager.Instance.localPlayerController.ItemSlots[GameNetworkManager.Instance.localPlayerController.currentItemSlot]).GetType() == typeof(KeyItem)) { return false; } return true; } } [HarmonyPatch(typeof(RedLocustBees))] internal class RedLocustBeesPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void PostUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (GameNetworkManager.Instance.isHostingGame) { RedLocustBees val = Object.FindObjectOfType<RedLocustBees>(); ((EnemyAI)val).enemyType.canDie = true; ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)val); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPrefix] [HarmonyPatch("LoadNewLevel")] private static bool PreLoadNewLevel(ref SelectableLevel newLevel) { foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies) { enemy.rarity = 0; } foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies) { outsideEnemy.rarity = 0; } return true; } } [HarmonyPatch(typeof(ShipTeleporter))] internal class ShipTeleporterPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void PostAwake(bool ___isInverseTeleporter, ref float ___cooldownAmount, ref float ___cooldownTime) { if (___isInverseTeleporter) { ___cooldownAmount = 0f; ___cooldownTime = 0f; } } [HarmonyPrefix] [HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")] public static bool PreTeleportPlayerOutWithInverseTeleporter(int playerObj, ref Vector3 teleportPos, ShipTeleporter __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) MethodInfo method = typeof(ShipTeleporter).GetMethod("teleportBodyOut", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(ShipTeleporter).GetMethod("SetPlayerTeleporterId", BindingFlags.Instance | BindingFlags.NonPublic); if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead) { ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method.Invoke(__instance, new object[2] { playerObj, teleportPos })); return false; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; method2.Invoke(__instance, new object[2] { val, -1 }); 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) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } return false; } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] public static void PostItemActivate(ShotgunItem __instance) { __instance.shellsLoaded = 999; } [HarmonyPatch("ShootGun")] [HarmonyPostfix] public static void PostShootGun(ShotgunItem __instance) { __instance.shellsLoaded = 999; } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private static readonly string INVERSE_TP = "Inverse Teleporter"; private static bool isInitialized; private static bool isLoaded; private static int inverseTeleporterID = -1; [HarmonyPatch("SetDiscordStatusDetails")] [HarmonyPostfix] private static void PostUpdate(ref StartOfRound __instance) { if (isLoaded || !((NetworkBehaviour)__instance).IsHost) { return; } if (!isInitialized) { for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++) { UnlockableItem val = __instance.unlockablesList.unlockables[i]; string text = val.unlockableName.ToLower(); if (text.Equals(INVERSE_TP.ToLower())) { inverseTeleporterID = i; } } isInitialized = true; } if (inverseTeleporterID != -1) { MethodInfo method = ((object)__instance).GetType().GetMethod("UnlockShipObject", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(__instance, new object[1] { inverseTeleporterID }); } isLoaded = true; } } internal class StorePatch { public static void OnLoaded(Scene scene, LoadSceneMode mode) { Item val = Object.Instantiate<Item>(GetItem("Shotgun")); ((Object)val).name = "Shotgun"; val.isScrap = false; val.creditsWorth = 10; TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val2).name = "ShotgunInfoNode"; val2.displayText = "Like shooting fish in a barrel\n\n"; val2.clearPreviousText = true; val2.maxCharactersToType = 25; Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, 10); } private static Item GetItem(string Value) { Item[] array = Resources.FindObjectsOfTypeAll<Item>(); Item[] array2 = array; foreach (Item val in array2) { if (((Object)val).name == Value) { return val; } } return null; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("BeginUsingTerminal")] [HarmonyPostfix] private static void PostBeginUsingTerminal(ref int ___groupCredits) { ___groupCredits = 9999; } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPatch("UpdateProfitQuotaCurrentTime")] [HarmonyPostfix] private static void PostUpdateProfitQuotaCurrentTime() { TimeOfDay.Instance.timeUntilDeadline = (int)(TimeOfDay.Instance.totalTime * (float)TimeOfDay.Instance.quotaVariables.deadlineDaysAmount); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "LIKE FISH\n IN A\n BARREL"; } } } namespace FishInABarrel.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }