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 InsaniusThingus v1.0.0
BepInEx/plugins/GayMod.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GayMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f680a5f14b93324d94188e9303445aa7329ed08f")] [assembly: AssemblyProduct("GayMod")] [assembly: AssemblyTitle("GayMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Gay { [BepInPlugin("dev.megagay.infinitetimegaymod", "InfiniteTimeMod", "0.0.1")] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.megagay.infinitetimegaymod"; public const string modName = "InfiniteTimeMod"; public const string modVersion = "0.0.1"; private Harmony harmony = new Harmony("dev.megagay.infinitetimegaymod"); internal static ManualLogSource logger = Logger.CreateLogSource("dev.megagay.infinitetimegaymod"); private void Awake() { harmony.PatchAll(); logger.LogInfo((object)"Plugin InfiniteTimeMod is loaded!"); logger.LogInfo((object)"\n ██▓ ███▄ █ ██████ ▄▄▄ ███▄ █ ██▓▓█████ ██████ ▄▄▄█████▓\r\n▓██▒ ██ ▀█ █ ▒██ ▒ ▒████▄ ██ ▀█ █ ▓██▒▓█ ▀ ▒██ ▒ ▓ ██▒ ▓▒\r\n▒██▒▓██ ▀█ ██▒░ ▓██▄ ▒██ ▀█▄ ▓██ ▀█ ██▒▒██▒▒███ ░ ▓██▄ ▒ ▓██░ ▒░\r\n░██░▓██▒ ▐▌██▒ ▒ ██▒░██▄▄▄▄██ ▓██▒ ▐▌██▒░██░▒▓█ ▄ ▒ ██▒░ ▓██▓ ░ \r\n░██░▒██░ ▓██░▒██████▒▒ ▓█ ▓██▒▒██░ ▓██░░██░░▒████▒▒██████▒▒ ▒██▒ ░ \r\n░▓ ░ ▒░ ▒ ▒ ▒ ▒▓▒ ▒ ░ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ░▓ ░░ ▒░ ░▒ ▒▓▒ ▒ ░ ▒ ░░ \r\n ▒ ░░ ░░ ░ ▒░░ ░▒ ░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░ ▒ ░ ░ ░ ░░ ░▒ ░ ░ ░ \r\n ▒ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ \r\n ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \r\n \r\n ▄████▄ ▒█████ ███▄ ▄███▓ ██▓███ ▄▄▄ ███▄ █▓██ ██▓ \r\n▒██▀ ▀█ ▒██▒ ██▒▓██▒▀█▀ ██▒▓██░ ██▒▒████▄ ██ ▀█ █ ▒██ ██▒ \r\n▒▓█ ▄ ▒██░ ██▒▓██ ▓██░▓██░ ██▓▒▒██ ▀█▄ ▓██ ▀█ ██▒ ▒██ ██░ \r\n▒▓▓▄ ▄██▒▒██ ██░▒██ ▒██ ▒██▄█▓▒ ▒░██▄▄▄▄██ ▓██▒ ▐▌██▒ ░ ▐██▓░ \r\n▒ ▓███▀ ░░ ████▓▒░▒██▒ ░██▒▒██▒ ░ ░ ▓█ ▓██▒▒██░ ▓██░ ░ ██▒▓░ \r\n░ ░▒ ▒ ░░ ▒░▒░▒░ ░ ▒░ ░ ░▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ██▒▒▒ \r\n ░ ▒ ░ ▒ ▒░ ░ ░ ░░▒ ░ ▒ ▒▒ ░░ ░░ ░ ▒░▓██ ░▒░ \r\n░ ░ ░ ░ ▒ ░ ░ ░░ ░ ▒ ░ ░ ░ ▒ ▒ ░░ \r\n░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \r\n░ ░ ░ "); } private void PatchAll() { harmony.PatchAll(); } } } namespace InsaneAIPlugin { public static class PluginInfo { public const string PLUGIN_GUID = "GayMod"; public const string PLUGIN_NAME = "GayMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace InsaneAIPlugin.Patches { [HarmonyPatch] public class CoilHeadPatches { [HarmonyPatch(typeof(SpringManAI), "Update")] [HarmonyPrefix] public static void InsaneCoilHeadPatch(SpringManAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { __instance.currentChaseSpeed = 1450f; if ((Object)(object)((EnemyAI)__instance).agent != (Object)null) { ((EnemyAI)__instance).agent.acceleration = 1000f; } } } } } namespace InsaniusThingus.Patches { [HarmonyPatch] public class BlobPatches { [HarmonyPatch(typeof(BlobAI), "HitEnemy")] [HarmonyPrefix] public static void PermanentAngerPatch(BlobAI __instance) { __instance.angeredTimer = 10000f; } [HarmonyPatch(typeof(BlobAI), "Update")] [HarmonyPostfix] public static void InsaneSpeedPatch(BlobAI __instance) { if (!(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { if ((Object)(object)((EnemyAI)__instance).agent != (Object)null) { ((EnemyAI)__instance).agent.speed = 3.5f; } if (__instance.angeredTimer > 0f) { __instance.angeredTimer = 10000f; __instance.currentSlimeRange = __instance.slimeRange + 10f; } } } [HarmonyPatch(typeof(BlobAI), "DetectNoise")] [HarmonyPrefix] public static bool BoomboxImmunityPatch(BlobAI __instance) { return false; } } [HarmonyPatch] public class BrackenPatches { [HarmonyPatch(typeof(FlowermanAI), "LookAtFlowermanTrigger")] [HarmonyPrefix] public static bool BrackenPatch(FlowermanAI __instance, int playerObj) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 2) { return false; } __instance.angerMeter = 1000f; __instance.EnterAngerModeServerRpc(1000f); ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(2); ((EnemyAI)__instance).agent.speed = 12f; PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; if ((Object)(object)val != (Object)null) { ((EnemyAI)__instance).SetMovingTowardsTargetPlayer(val); } return false; } } [HarmonyPatch(typeof(HoarderBugAI))] public class HoarderBugPatches { [HarmonyPatch("DetectAndLookAtPlayers")] [HarmonyPostfix] public static void RelentlessChasePatch(HoarderBugAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 2) { __instance.timeSinceSeeingAPlayer = 0f; } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void InsaneSpeedPatch(HoarderBugAI __instance) { if (((EnemyAI)__instance).isEnemyDead) { return; } if (((EnemyAI)__instance).stunNormalizedTimer > 0f) { ((EnemyAI)__instance).agent.speed = 0f; return; } switch (((EnemyAI)__instance).currentBehaviourStateIndex) { case 0: case 1: ((EnemyAI)__instance).agent.speed = 15f; ((EnemyAI)__instance).agent.acceleration = 15f; break; case 2: ((EnemyAI)__instance).agent.speed = 20f; break; } } [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] public static bool InsaneDamagePatch(HoarderBugAI __instance, Collider other) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (__instance.inChase && __instance.timeSinceHittingPlayer >= 0.5f) { PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { __instance.timeSinceHittingPlayer = 0f; val.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); __instance.HitPlayerServerRpc(); } } return false; } } [HarmonyPatch] public class ButlerPatches { [HarmonyPatch(typeof(ButlerEnemyAI), "Start")] [HarmonyPostfix] public static void ImmediateBerserkerPatch(ButlerEnemyAI __instance) { if (((NetworkBehaviour)__instance).IsServer) { __instance.berserkModeTimer = 10000f; PlayerControllerB closestPlayer = ((EnemyAI)__instance).GetClosestPlayer(false, false, false); if ((Object)(object)closestPlayer != (Object)null) { ((EnemyAI)__instance).targetPlayer = closestPlayer; __instance.watchingPlayer = closestPlayer; ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(2); __instance.SwitchOwnershipAndSetToStateServerRpc(2, closestPlayer.actualClientId, __instance.berserkModeTimer); } } } [HarmonyPatch(typeof(ButlerEnemyAI), "Update")] [HarmonyPostfix] public static void BuffSpeedPatch(ButlerEnemyAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && ((EnemyAI)__instance).currentBehaviourStateIndex == 2 && (Object)(object)((EnemyAI)__instance).agent != (Object)null) { __instance.berserkModeTimer = 10000f; ((EnemyAI)__instance).agent.speed = 11f; ((EnemyAI)__instance).agent.acceleration = 50f; } } } [HarmonyPatch] public class ClaySurgeonPatches { [HarmonyPatch(typeof(ClaySurgeonAI), "Start")] [HarmonyPostfix] public static void MaxSpeedPatch(ClaySurgeonAI __instance) { __instance.startingInterval = 0.2f; __instance.endingInterval = 0.2f; __instance.currentInterval = 0.2f; } [HarmonyPatch(typeof(ClaySurgeonAI), "DanceBeat")] [HarmonyPrefix] public static void HyperJumpPatch(ClaySurgeonAI __instance) { __instance.jumpSpeed = 7f; } } [HarmonyPatch] public class EyelessDogPatches { [HarmonyPatch(typeof(MouthDogAI), "Update")] [HarmonyPrefix] public static void SeeAndSnapPatch(MouthDogAI __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsOwner && !((EnemyAI)__instance).isEnemyDead && !__instance.inKillAnimation && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && (((EnemyAI)__instance).currentBehaviourStateIndex == 0 || ((EnemyAI)__instance).currentBehaviourStateIndex == 1)) { PlayerControllerB val = ((EnemyAI)__instance).CheckLineOfSightForClosestPlayer(120f, 20, -1, 0f); if ((Object)(object)val != (Object)null) { __instance.EnrageDogOnLocalClient(((Component)val).transform.position, 0f, false, true); } } } [HarmonyPatch(typeof(MouthDogAI), "EnrageDogOnLocalClient")] [HarmonyPrefix] public static void PerfectAccuracyPatch(MouthDogAI __instance, ref Vector3 targetPosition, ref bool approximatePosition, bool fullyEnrage) { approximatePosition = false; } } [HarmonyPatch] public class ForestGiantPatches { [HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")] [HarmonyPrefix] public static bool InstantSpottingPatch(ForestGiantAI __instance) { if (((EnemyAI)__instance).isEnemyDead || ((EnemyAI)__instance).inSpecialAnimation || __instance.inEatingPlayerAnimation || ((EnemyAI)__instance).currentBehaviourStateIndex == 2) { return true; } PlayerControllerB closestPlayer = ((EnemyAI)__instance).GetClosestPlayer(false, true, false); if ((Object)(object)closestPlayer != (Object)null) { __instance.chasingPlayerInLOS = true; __instance.noticePlayerTimer = 0f; __instance.lostPlayerInChase = false; if (((EnemyAI)__instance).currentBehaviourStateIndex != 1 || (Object)(object)__instance.chasingPlayer != (Object)(object)closestPlayer) { __instance.chasingPlayer = closestPlayer; __instance.FindAndTargetNewPlayerOnLocalClient(closestPlayer); if (((NetworkBehaviour)__instance).IsServer) { ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(1); __instance.BeginChasingNewPlayerClientRpc((int)closestPlayer.playerClientId); } } } else { __instance.chasingPlayerInLOS = false; if (((EnemyAI)__instance).currentBehaviourStateIndex == 1) { ((EnemyAI)__instance).SwitchToBehaviourState(0); } } return false; } } [HarmonyPatch(typeof(DressGirlAI))] public class GirlPatches { [HarmonyPatch("Update")] [HarmonyPostfix] public static void RapidSwitchHauntPatch(DressGirlAI __instance) { if (!((NetworkBehaviour)__instance).IsOwner || ((EnemyAI)__instance).isEnemyDead) { return; } if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 && !__instance.staringInHaunt) { __instance.chaseTimer += Time.deltaTime; if (__instance.chaseTimer > 15f) { __instance.chaseTimer = 0f; __instance.ChoosePlayerToHaunt(); } } else { __instance.chaseTimer = 0f; } } } [HarmonyPatch] public class JesterPatches { [HarmonyPatch(typeof(JesterAI), "Start")] [HarmonyPostfix] public static void InstantChasePatch(JesterAI __instance) { if (((NetworkBehaviour)__instance).IsServer) { __instance.beginCrankingTimer = 20f; __instance.popUpTimer = 20f; ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(2); ((EnemyAI)__instance).SwitchToBehaviourServerRpc(2); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPostfix] public static void BuffChasePatch(JesterAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && ((EnemyAI)__instance).currentBehaviourStateIndex == 2 && (Object)(object)((EnemyAI)__instance).agent != (Object)null) { ((EnemyAI)__instance).agent.speed = 25f; ((EnemyAI)__instance).agent.acceleration = 100f; } } [HarmonyPatch(typeof(JesterAI), "DoAIInterval")] [HarmonyPrefix] public static bool RelentlessChasePatch(JesterAI __instance) { if (((EnemyAI)__instance).isEnemyDead || ((EnemyAI)__instance).currentBehaviourStateIndex != 2) { return true; } PlayerControllerB closestPlayer = ((EnemyAI)__instance).GetClosestPlayer(false, false, false); if ((Object)(object)closestPlayer != (Object)null) { __instance.noPlayersToChaseTimer = 5f; if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)(object)closestPlayer) { ((EnemyAI)__instance).targetPlayer = closestPlayer; ((EnemyAI)__instance).SetMovingTowardsTargetPlayer(closestPlayer); if (((NetworkBehaviour)__instance).IsServer) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(closestPlayer.actualClientId); } } } return true; } } [HarmonyPatch] public class JetpackPatches { [HarmonyPatch(typeof(JetpackItem), "ExplodeJetpackClientRpc")] [HarmonyPrefix] public static bool InsaneBlowPatch(JetpackItem __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!__instance.jetpackBroken) { __instance.jetpackBroken = true; ((GrabbableObject)__instance).itemUsedUp = true; Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 20f, 30f, 150, 500f, (GameObject)null, false); } return false; } } [HarmonyPatch(typeof(GiantKiwiAI))] public class KiwiPatches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void InsaneStartPatch(GiantKiwiAI __instance) { __instance.chaseAccelerationMultiplier = 4f; } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] public static void InsaneAIPatch(GiantKiwiAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 && (__instance.idleBehaviour == 1 || __instance.idleBehaviour == 2)) { __instance.idleBehaviour = 0; __instance.ChangeIdleBehaviorClientRpc(0); } if (((EnemyAI)__instance).currentBehaviourStateIndex == 2) { __instance.timeSinceSeeingThreat = 0f; __instance.timeSpentChasingThreat = 0f; } } } } [HarmonyPatch(typeof(Landmine))] public class LandminePatches { [HarmonyPatch("OnTriggerEnter")] [HarmonyPostfix] public static void InstantDetonationPatch(Landmine __instance, Collider other) { if (!__instance.hasExploded && __instance.mineActivated && ((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController && !component.isPlayerDead) { __instance.TriggerMineOnLocalClientByExiting(); } } } [HarmonyPatch("Detonate")] [HarmonyPrefix] public static bool BiggerExplosionPatch(Landmine __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) __instance.mineAudio.pitch = Random.Range(0.93f, 1.07f); __instance.mineAudio.PlayOneShot(__instance.mineDetonate, 1f); Landmine.SpawnExplosion(((Component)__instance).transform.position + Vector3.up, false, 10f, 15f, 50, 0f, (GameObject)null, false); return false; } } [HarmonyPatch] public class CaveDwellerPatches { [HarmonyPatch(typeof(CaveDwellerAI), "Start")] [HarmonyPostfix] public static void InsaneModePatch(CaveDwellerAI __instance) { if (!((EnemyAI)__instance).isEnemyDead) { __instance.growthSpeedMultiplier = 5f; __instance.isFakingBabyVoice = false; __instance.screamTime = 2f; __instance.cooldownTime = 2.1f; __instance.chaseSpeed = 18f; __instance.leapSpeed = 30f; __instance.sneakSpeed = 10f; } } } [HarmonyPatch(typeof(DoublewingAI))] public class ManticoilPatch { [HarmonyPatch("AlertBird")] [HarmonyPrefix] public static bool ExplodeOnAlertPatch(DoublewingAI __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || ((EnemyAI)__instance).daytimeEnemyLeaving || !((NetworkBehaviour)__instance).IsOwner) { return true; } Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 30f, 50f, 99, 500f, (GameObject)null, false); ((EnemyAI)__instance).KillEnemyOnOwnerClient(false); return false; } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] public class MaskedPlayerEnemyPatches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void InsaneStartPatch(MaskedPlayerEnemy __instance) { if (!((EnemyAI)__instance).isEnemyDead) { ((EnemyAI)__instance).enemyHP = 5; __instance.turnSpeedMultiplier = 20f; } } [HarmonyPatch("Update")] [HarmonyPostfix] public static void InsaneUpdatePatch(MaskedPlayerEnemy __instance) { if (((EnemyAI)__instance).isEnemyDead || ((EnemyAI)__instance).inSpecialAnimation) { return; } __instance.stopAndStareTimer = -1f; if (((EnemyAI)__instance).currentBehaviourStateIndex == 1) { ((EnemyAI)__instance).agent.speed = 7f; __instance.running = true; ((EnemyAI)__instance).creatureAnimator.SetBool("Running", true); } if (__instance.maskTypes == null) { return; } GameObject[] maskTypes = __instance.maskTypes; foreach (GameObject val in maskTypes) { if ((Object)(object)val != (Object)null && val.activeSelf) { val.SetActive(false); } } } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] public static void InsaneAIPatch(MaskedPlayerEnemy __instance) { if (!((EnemyAI)__instance).isEnemyDead && !((EnemyAI)__instance).inSpecialAnimation) { __instance.staminaTimer = 5f; if (((EnemyAI)__instance).currentBehaviourStateIndex == 1) { __instance.lostLOSTimer = 0f; } } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] public class InsaneNutcrackerPatch { [HarmonyPatch("Update")] [HarmonyPostfix] public static void ModifiedUpdatePatch(NutcrackerEnemyAI __instance) { if (((EnemyAI)__instance).isEnemyDead || ((EnemyAI)__instance).stunNormalizedTimer > 0f) { return; } if (((EnemyAI)__instance).currentBehaviourStateIndex == 0) { float num = 3f; if (__instance.timeSinceInspecting > num) { ((EnemyAI)__instance).SwitchToBehaviourState(1); } } if (((EnemyAI)__instance).currentBehaviourStateIndex == 1) { __instance.torsoTurnSpeed = 9000f; } if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && __instance.aimingGun && !__instance.reloadingGun) { ((EnemyAI)__instance).agent.speed = 2.25f; } } [HarmonyPatch("ReloadGunClientRpc")] [HarmonyPrefix] public static bool InstantReloadPatch(NutcrackerEnemyAI __instance) { if (((EnemyAI)__instance).isEnemyDead || (Object)(object)__instance.gun == (Object)null) { return true; } __instance.StopAimingGun(); __instance.gun.shellsLoaded = 2; ((EnemyAI)__instance).creatureSFX.PlayOneShot(((EnemyAI)__instance).enemyType.audioClips[2]); __instance.reloadingGun = false; return false; } [HarmonyPatch("AimGun")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> AimGunTranspiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); float num = 0.5f; for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Ldc_R4) { if (val.operand.Equals(1.3f)) { val.operand = num; } else if (val.operand.Equals(1.75f)) { val.operand = num; } } } return list; } } [HarmonyPatch] public class OldBirdPatches { [HarmonyPatch(typeof(RadMechAI), "Start")] [HarmonyPostfix] public static void PerfectAcquisitionPatch(RadMechAI __instance) { __instance.fov = 180f; } [HarmonyPatch(typeof(RadMechAI), "Update")] [HarmonyPrefix] public static void FullAutoMechPatch(RadMechAI __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead) { if ((Object)(object)__instance.focusedThreatTransform != (Object)null) { __instance.targetedThreat.lastSeenPosition = __instance.focusedThreatTransform.position + __instance.targetedThreat.threatScript.GetThreatVelocity(); } __instance.missileSpeed = 0.5f; __instance.gunArmSpeed = 120f; } } [HarmonyPatch(typeof(RadMechAI), "AimAndShootCycle")] [HarmonyPrefix] public static void RelentlessShootingPatch(RadMechAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && __instance.aimingGun && !((EnemyAI)__instance).inSpecialAnimation) { __instance.fireRate = 0.1f; __instance.shootCooldown = 0f; __instance.fireRateVariance = 0f; __instance.shootUptime = 1000f; __instance.shootDowntime = 0f; } } } [HarmonyPatch(typeof(PufferAI))] public class PufferPatches { [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] public static void AggressiveAIEnablerPatch(PufferAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && ((EnemyAI)__instance).currentBehaviourStateIndex == 1) { if (!__instance.didPuffAnimation && !__instance.inPuffingAnimation) { __instance.didPuffAnimation = true; __instance.inPuffingAnimation = true; __instance.ShakeTailServerRpc(); } else if (__instance.didPuffAnimation && !__instance.inPuffingAnimation) { ((EnemyAI)__instance).SwitchToBehaviourState(2); } } } [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] public static bool DeadlyBitePatch(PufferAI __instance, Collider other) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null && __instance.timeSinceHittingPlayer > 1f) { __instance.timeSinceHittingPlayer = 0f; val.DamagePlayer(10, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); __instance.BitePlayerServerRpc((int)val.playerClientId); } return false; } } [HarmonyPatch(typeof(ShotgunItem))] public class DangerousShotgunPatch { [HarmonyPatch("ShootGun")] [HarmonyPostfix] public static void ChaoticAfterEffectsPatch(ShotgunItem __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null)) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if (Random.Range(0, 100) < 50) { playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)7, 0, false, __instance.shotgunRayPoint.forward * -3f); } } } [HarmonyPatch("StartReloadGun")] [HarmonyPrefix] public static bool RiskyReloadPatch(ShotgunItem __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) { return true; } if (Random.Range(0, 100) < 10) { __instance.gunAudio.PlayOneShot(__instance.noAmmoSFX); __instance.gunShootParticle.Play(true); HUDManager.Instance.ShakeCamera((ScreenShakeType)1); ((GrabbableObject)__instance).playerHeldBy.DamagePlayer(19, true, true, (CauseOfDeath)3, 0, false, default(Vector3)); Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 8f, 524288); Collider[] array2 = array; IHittable val2 = default(IHittable); foreach (Collider val in array2) { if (((Component)((Component)val).transform).TryGetComponent<IHittable>(ref val2)) { val2.Hit(2, ((Component)__instance).transform.forward, ((GrabbableObject)__instance).playerHeldBy, true, -1); } } return false; } return true; } } [HarmonyPatch] public class SnareFleaPatches { [HarmonyPatch(typeof(CentipedeAI), "Update")] [HarmonyPrefix] public static void EagleVisionPatch(CentipedeAI __instance) { if (((NetworkBehaviour)__instance).IsOwner && ((EnemyAI)__instance).currentBehaviourStateIndex == 1 && __instance.clingingToCeiling && !__instance.triggeredFall && !((Object)(object)__instance.clingingToPlayer != (Object)null)) { PlayerControllerB val = ((EnemyAI)__instance).CheckLineOfSightForClosestPlayer(180f, 500, -1, 0f); if ((Object)(object)val != (Object)null) { __instance.triggeredFall = true; ((EnemyAI)__instance).targetPlayer = val; ((EnemyAI)__instance).movingTowardsTargetPlayer = true; __instance.TriggerCentipedeFallServerRpc(NetworkManager.Singleton.LocalClientId); } } } [HarmonyPatch(typeof(CentipedeAI), "Update")] [HarmonyPostfix] public static void RelentlessChasePatch(CentipedeAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 2) { __instance.chaseTimer = 0f; } } [HarmonyPatch(typeof(CentipedeAI), "DamagePlayerOnIntervals")] [HarmonyPrefix] public static bool FastKillPatch(CentipedeAI __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (__instance.inDroppingOffPlayerAnim || (Object)(object)__instance.clingingToPlayer == (Object)null) { return false; } if (__instance.damagePlayerInterval <= 0f) { __instance.clingingToPlayer.DamagePlayer(20, true, true, (CauseOfDeath)5, 0, false, default(Vector3)); __instance.damagePlayerInterval = 0.5f; } else { __instance.damagePlayerInterval -= Time.deltaTime; } return false; } [HarmonyPatch(typeof(CentipedeAI), "GetHitAndRunAwayServerRpc")] [HarmonyPrefix] public static bool NoRunningAwayPatch() { return false; } [HarmonyPatch(typeof(CentipedeAI), "SetEnemyStunned")] [HarmonyPrefix] public static bool NoStunPatch(CentipedeAI __instance) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 3) { return false; } return true; } } [HarmonyPatch(typeof(SandSpiderAI))] public class SandSpiderPatches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void InsaneStartPatch(SandSpiderAI __instance) { __instance.maxWebTrapsToPlace = 20; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void InsaneUpdatePatch(SandSpiderAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).currentBehaviourStateIndex == 2) { if (((EnemyAI)__instance).stunNormalizedTimer <= 0f) { ((EnemyAI)__instance).agent.speed = 5.04f; __instance.spiderSpeed = 5.04f; } __instance.chaseTimer = 12.5f; } } } [HarmonyPatch] public class SpikeTrapPatches { [HarmonyPatch(typeof(SpikeRoofTrap), "SpikeTrapSlam")] [HarmonyPrefix] public static void SpeedUpSlamPatch(SpikeRoofTrap __instance) { if ((Object)(object)__instance.spikeTrapAnimator != (Object)null) { __instance.spikeTrapAnimator.speed = 10f; } } [HarmonyPatch(typeof(SpikeRoofTrap), "SlamSpikeTrapSequence")] [HarmonyFinalizer] public static void ResetSpeedPatch(SpikeRoofTrap __instance) { if ((Object)(object)__instance.spikeTrapAnimator != (Object)null) { __instance.spikeTrapAnimator.speed = 1f; } } } [HarmonyPatch(typeof(CrawlerAI))] public class CrawlerPatches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void SlightBuffPatch(CrawlerAI __instance) { __instance.SpeedIncreaseRate = 10f; } } [HarmonyPatch] public class TulipSnakePatches { private static PlayerControllerB playerWhoWasClungTo; [HarmonyPatch(typeof(FlowerSnakeEnemy), "Start")] [HarmonyPostfix] public static void HyperBuffPatch(FlowerSnakeEnemy __instance) { if ((Object)(object)((EnemyAI)__instance).agent != (Object)null) { ((EnemyAI)__instance).agent.speed = 10f; ((EnemyAI)__instance).agent.acceleration = 100f; } __instance.leapTimeMultiplier = 1f; __instance.leapSpeedMultiplier = 3f; } [HarmonyPatch(typeof(FlowerSnakeEnemy), "OnCollideWithPlayer")] [HarmonyPrefix] public static bool InstantClingPatch(FlowerSnakeEnemy __instance, Collider other) { if ((Object)(object)__instance.clingingToPlayer != (Object)null || ((EnemyAI)__instance).isEnemyDead || __instance.waitingForHitPlayerRPC) { return false; } if (Time.realtimeSinceStartup - __instance.collideWithPlayerInterval < 0.25f) { return false; } __instance.collideWithPlayerInterval = Time.realtimeSinceStartup; PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null && !Object.op_Implicit((Object)(object)val.inAnimationWithEnemy) && (!val.isInElevator || !StartOfRound.Instance.shipIsLeaving)) { __instance.waitingForHitPlayerRPC = true; __instance.FSHitPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } return false; } [HarmonyPatch(typeof(FlowerSnakeEnemy), "SetClingToPlayer")] [HarmonyPrefix] public static void PermanentLeechPatch(FlowerSnakeEnemy __instance, PlayerControllerB playerToCling, ref float clingTime) { clingTime = 10000f; playerToCling.carryWeight += 3f; } [HarmonyPatch(typeof(FlowerSnakeEnemy), "StopClingingOnLocalClient")] [HarmonyPrefix] public static void SavePlayerRefPatch(FlowerSnakeEnemy __instance) { playerWhoWasClungTo = __instance.clingingToPlayer; } [HarmonyPatch(typeof(FlowerSnakeEnemy), "StopClingingOnLocalClient")] [HarmonyPostfix] public static void FixWeightPatch() { if ((Object)(object)playerWhoWasClungTo != (Object)null) { playerWhoWasClungTo.carryWeight = Mathf.Max(playerWhoWasClungTo.carryWeight - 2.97f, 1f); playerWhoWasClungTo = null; } } } }