Please disclose if your mod was created primarily 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 DBDCompany v1.0.0
DBDCompany_1.0.0.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("DBDCompany")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DBDCompany")] [assembly: AssemblyTitle("DBDCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace DBDCompany { public static class PluginInfo { public const string PLUGIN_GUID = "DBDCompany"; public const string PLUGIN_NAME = "DBDCompany"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DBDCompany.Patches { [BepInPlugin("DBDCompany", "DBDCompany", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle DBDCompany; private void Awake() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } } namespace SquishPlugin { [HarmonyPatch(typeof(EnemyAI), "Update")] internal class EnemyAIPatch { [MethodImpl(MethodImplOptions.NoInlining)] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static void Update(EnemyAI instance) { instance.Update(); } } [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatcher { private static MethodInfo CalculateAnimationSpeed = AccessTools.Method(typeof(JesterAI), "CalculateAnimationSpeed", (Type[])null, (Type[])null); private static MethodInfo SetJesterInitialValues = AccessTools.Method(typeof(JesterAI), "SetJesterInitialValues", (Type[])null, (Type[])null); private static MethodInfo BaseUpdate = AccessTools.Method(typeof(EnemyAI), "Update", (Type[])null, (Type[])null); private static FieldInfo previousState = AccessTools.Field(typeof(JesterAI), "previousState"); private static FieldInfo inKillAnimation = AccessTools.Field(typeof(JesterAI), "inKillAnimation"); private static FieldInfo targetingPlayer = AccessTools.Field(typeof(JesterAI), "targetingPlayer"); private static FieldInfo noPlayersToChaseTimer = AccessTools.Field(typeof(JesterAI), "noPlayersToChaseTimer"); private static FieldInfo popUpTimer = AccessTools.Field(typeof(JesterAI), "popUpTimer"); [HarmonyPatch("SetJesterInitialValues")] [HarmonyPostfix] public static void PatchedSetJesterInitialValues(JesterAI __instance) { popUpTimer.SetValue(__instance, 40f); __instance.farAudio.dopplerLevel = 0f; } [HarmonyPatch("Update")] [HarmonyPrefix] public static bool JesterAIUpdate(JesterAI __instance) { //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead) { return false; } CalculateAnimationSpeed.Invoke(__instance, new object[1] { __instance.maxAnimSpeed }); switch (((EnemyAI)__instance).currentBehaviourStateIndex) { case 0: if ((int)previousState.GetValue(__instance) != 0) { previousState.SetValue(__instance, 0); __instance.mainCollider.isTrigger = false; SetJesterInitialValues.Invoke(__instance, null); } if (!((NetworkBehaviour)__instance).IsOwner) { break; } if (((EnemyAI)__instance).stunNormalizedTimer > 0f) { __instance.beginCrankingTimer -= Time.deltaTime * 15f; } if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null) { __instance.beginCrankingTimer -= Time.deltaTime; if (__instance.beginCrankingTimer <= 0f) { ((EnemyAI)__instance).SwitchToBehaviourState(1); } } break; case 1: if ((int)previousState.GetValue(__instance) != 1) { previousState.SetValue(__instance, 1); ((EnemyAI)__instance).creatureAnimator.SetBool("turningCrank", true); __instance.farAudio.clip = __instance.popGoesTheWeaselTheme; __instance.farAudio.Play(); ((EnemyAI)__instance).agent.speed = 0f; } if (((EnemyAI)__instance).stunNormalizedTimer > 0f) { __instance.farAudio.Pause(); ((EnemyAI)__instance).creatureAnimator.SetFloat("CrankSpeedMultiplier", 0f); } else { if (!__instance.farAudio.isPlaying) { __instance.farAudio.UnPause(); } ((EnemyAI)__instance).creatureAnimator.SetFloat("CrankSpeedMultiplier", 1f); __instance.popUpTimer -= Time.deltaTime; if (__instance.popUpTimer <= 0f && ((NetworkBehaviour)__instance).IsOwner) { ((EnemyAI)__instance).SwitchToBehaviourState(2); } } if (!((NetworkBehaviour)__instance).IsOwner) { } break; case 2: if ((int)previousState.GetValue(__instance) != 2) { previousState.SetValue(__instance, 2); __instance.farAudio.Stop(); ((EnemyAI)__instance).creatureAnimator.SetBool("poppedOut", true); ((EnemyAI)__instance).creatureAnimator.SetFloat("CrankSpeedMultiplier", 1f); ((EnemyAI)__instance).creatureSFX.PlayOneShot(__instance.popUpSFX); WalkieTalkie.TransmitOneShotAudio(((EnemyAI)__instance).creatureSFX, __instance.popUpSFX, 1f); ((EnemyAI)__instance).creatureVoice.clip = __instance.screamingSFX; ((EnemyAI)__instance).creatureVoice.Play(); ((EnemyAI)__instance).agent.speed = 0f; __instance.mainCollider.isTrigger = true; ((EnemyAI)__instance).agent.stoppingDistance = 0f; } if (((NetworkBehaviour)__instance).IsOwner && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && ((EnemyAI)__instance).CheckLineOfSightForPosition(((Component)((EnemyAI)__instance).targetPlayer.gameplayCamera).transform.position, 80f, 80, -1f, (Transform)null)) { __instance.headRigTarget.rotation = Quaternion.Lerp(__instance.headRigTarget.rotation, Quaternion.LookRotation(((Component)((EnemyAI)__instance).targetPlayer.gameplayCamera).transform.position - ((Component)__instance.headRigTarget).transform.position, Vector3.up), 5f * Time.deltaTime); } else { __instance.headRigTarget.rotation = Quaternion.Lerp(__instance.headRigTarget.rotation, Quaternion.LookRotation(__instance.lookForwardTarget.position - ((Component)__instance.headRigTarget).transform.position, Vector3.up), 5f * Time.deltaTime); } if (!((NetworkBehaviour)__instance).IsOwner) { break; } if ((bool)inKillAnimation.GetValue(__instance) || ((EnemyAI)__instance).stunNormalizedTimer > 0f) { ((EnemyAI)__instance).agent.speed = 0f; } else { ((EnemyAI)__instance).agent.speed = Mathf.Clamp(((EnemyAI)__instance).agent.speed + Time.deltaTime * 1.45f, 0f, 18f); } ((EnemyAI)__instance).creatureAnimator.SetBool("stunned", ((EnemyAI)__instance).stunNormalizedTimer > 0f); if (!(bool)targetingPlayer.GetValue(__instance)) { bool flag = false; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && StartOfRound.Instance.allPlayerScripts[i].isInsideFactory) { flag = true; } } if (!flag) { noPlayersToChaseTimer.SetValue(__instance, (float)noPlayersToChaseTimer.GetValue(__instance) - Time.deltaTime); if ((float)noPlayersToChaseTimer.GetValue(__instance) <= 0f) { ((EnemyAI)__instance).SwitchToBehaviourState(0); } } } else { noPlayersToChaseTimer.SetValue(__instance, 5f); } break; } EnemyAIPatch.Update((EnemyAI)(object)__instance); return false; } } }