using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Configgy; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Sandbox; using ULTRAKILL.Cheats; using ULTRAKILL.Enemy; using ULTRAKILL.Portal; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.ProBuilder; using UnityEngine.SceneManagement; using plog.Models; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SpawnerArmExtras")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("6.0.3.0")] [assembly: AssemblyInformationalVersion("6.0.3+c7dd3ee3b1c00c36027615cfa1102f97786d5efc")] [assembly: AssemblyProduct("SpawnerArmExtras")] [assembly: AssemblyTitle("SpawnerArmExtras")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("6.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 SpawnerArmExtras { public class BlackHoleFromMortar : MonoBehaviour { public EnemyIdentifier source = null; public void Update() { if ((Object)(object)source == (Object)null) { ((Component)this).GetComponent().Explode(); } } } [HarmonyPatch(typeof(BlackHoleProjectile), "Explode")] public class BlackHoleFromMortarPatch { public static void Prefix(BlackHoleProjectile __instance) { BlackHoleFromMortar component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.source == (Object)null)) { MortarLauncher component2 = ((Component)component.source).GetComponent(); if (component2 != null) { component2.cooldown = 2f; } } } } public class DisgraceSpawned : MonoBehaviour { public bool dashing = false; public float dashCooldown = 0f; public float dashCooldownMax = 0.6f; public float randomizedSpeed; public Color red = new Color(0.9f, 0.5f, 0.6f); public Color green = new Color(0.5f, 0.9f, 0.6f); public Transform mf; public Follow follow; public AlwaysLookAtCamera looker; public SkinnedMeshRenderer renderer; public EnemyIdentifier eid; public float difficultySpeedModifier; public void Start() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) mf = ((Component)this).transform.Find("MaliciousFace"); follow = ((Component)this).gameObject.AddComponent(); follow.speed = 12f; looker = ((Component)mf).gameObject.AddComponent(); mf.localScale = new Vector3(0.1f, 0.0875f, 0.0005f); randomizedSpeed = Random.Range(-1.6f, 1.6f); renderer = ((Component)this).GetComponentInChildren(); eid = ((Component)this).GetComponent(); for (int i = 0; i < ((Component)this).transform.parent.childCount; i++) { Transform child = ((Component)this).transform.parent.GetChild(i); if (((Object)child).name.Contains("Leg")) { ((Component)child).gameObject.SetActive(false); } } int difficulty = eid.difficulty; if (1 == 0) { } float num = difficulty switch { 4 => 1f, 3 => 0.9f, 2 => 0.75f, 1 => 0.5f, 0 => 0.4f, _ => 1.15f, }; if (1 == 0) { } difficultySpeedModifier = num; dashCooldownMax /= difficultySpeedModifier; } public IEnumerator Dash(int times) { yield return (object)new WaitForSeconds(0.01f); if (times > 0) { Vector3 distance = ((Component)mf).transform.position - ((Component)MonoSingleton.Instance).transform.position; Transform transform = ((Component)this).transform; transform.position -= 0.1f * distance; ((MonoBehaviour)this).StartCoroutine(Dash(times - 1)); } else { Object.Instantiate(EnemyAssets.Prefabs["Explosion"], ((Component)this).transform.position, ((Component)this).transform.rotation); dashing = false; dashCooldown = 0f; } } public void Update() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (eid.dead) { Object.Destroy((Object)(object)this); } if (!dashing) { dashCooldown += Time.deltaTime; } NewMovement instance = MonoSingleton.Instance; Vector3 val = ((Component)mf).transform.position - ((Component)instance).transform.position; float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)instance.cc).transform.forward); if (((Vector3)(ref val)).magnitude <= 12f && dashCooldown >= dashCooldownMax && !dashing && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active && !eid.dead) { dashing = true; ((MonoBehaviour)this).StartCoroutine(Dash(10)); } if (num > 0.9f) { follow.speed = (3f + randomizedSpeed * 0.375f) * difficultySpeedModifier; ((Renderer)renderer).material.color = red; } else { follow.speed = (8f + randomizedSpeed) * difficultySpeedModifier; ((Renderer)renderer).material.color = green; } if (eid.dead) { ((Renderer)renderer).material.color = ((Renderer)renderer).material.color / 3f; } if (BlindEnemies.Blind || EnemyIgnorePlayer.Active) { ((Behaviour)follow).enabled = false; ((Behaviour)looker).enabled = false; } else { ((Behaviour)follow).enabled = true; ((Behaviour)looker).enabled = true; } } } public class FuchsiaSetValues : MonoBehaviour { public float cycleOffsetTime = 0f; public float lasersRotation = 0f; public bool pushForceFollowsRotation = false; } public class FuchsiaSpawned : MonoBehaviour { public Transform lasersTransform; public Transform[] lasers = (Transform[])(object)new Transform[2]; public Transform[] lasersMelee = (Transform[])(object)new Transform[2]; public bool rotatingLasers = true; public FuchsiaState state = FuchsiaState.Nothing; public float nextCycleTime = 0f; public float cycleOffsetTime = 0f; public float timeModulo; public bool telegraphing = true; [SerializeField] private bool canPushUp = false; [SerializeField] private bool canPushDown = true; public Transform model; public Transform wings; public Transform crown; public bool finishedSetup = false; public float meleeTriggerDistance = 16f; public bool alreadyInMeleeZone = false; public float meleeZoneEndDistance = 16f; public float meleePushDistance = 18f; public bool pushForceFollowsRotation = false; public const float pushForceDefault = 65f; public float pushForce = 65f; public const float prePushDelayDefault = 0.5f; public const float pushDurationDefault = 0.3f; public const float preMeleeFireDelayDefault = 0.35f; public const float meleeFireDurationDefault = 0.25f; public const float postMeleeFireDelayDefault = 0.2f; public const float didntDoMeleeTimeDefault = 0.2f; public float prePushDelay = 0.5f; public float pushDuration = 0.3f; public float preMeleeFireDelay = 0.35f; public float meleeFireDuration = 0.25f; public float postMeleeFireDelay = 0.2f; public float didntDoMeleeTime = 0.2f; public float pushStartTimepoint; public float meleeFireStartTimepoint; public bool didMeleePushAction = false; public bool parried = false; public bool checkingForParry = false; public bool unparriableAttack = false; public float difficultySpeedModifier = 1f; public EnemyIdentifier eid; public Rigidbody rigidbody; public Enemy enemy; public AlwaysLookAtCamera looker; public RealEnemyTypeSaver realEnemyTypeSaver; public BoxCollider collider; public Drone drone; public DroneFlesh droneFlesh; public Vector3 originalPosition; public Quaternion originalRotation; public bool originalTransformSet = false; public float LasersRotation { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Quaternion localRotation = lasersTransform.localRotation; return ((Quaternion)(ref localRotation)).eulerAngles.z; } set { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Transform obj = lasersTransform; Quaternion localRotation = lasersTransform.localRotation; float x = ((Quaternion)(ref localRotation)).eulerAngles.x; localRotation = lasersTransform.localRotation; obj.localRotation = Quaternion.Euler(x, ((Quaternion)(ref localRotation)).eulerAngles.y, value); } } public float CycleOffsetTime { get { return cycleOffsetTime; } set { cycleOffsetTime = value; } } public bool CanPushUp { get { return canPushUp; } set { AllowPushUp(value); } } public bool CanPushDown { get { return canPushDown; } set { AllowPushDown(value); } } public bool PushForceFollowsRotation { get { return pushForceFollowsRotation; } set { pushForceFollowsRotation = value; } } public void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) eid = ((Component)this).GetComponent(); enemy = ((Component)this).GetComponent(); realEnemyTypeSaver = ((Component)this).GetComponent(); collider = ((Component)this).GetComponent(); rigidbody = ((Component)this).GetComponent(); SetupWeaknesses(); if (!originalTransformSet) { originalPosition = ((Component)this).transform.position; originalRotation = ((Component)this).transform.rotation; originalTransformSet = true; } if (!finishedSetup) { RemoveParts(); AddParts(); SetupLasers(); AddLooker(); finishedSetup = true; } else { RetextureAll(); } Telegraph(newValue: true); CheckSetValues(); } public void CheckSetValues() { FuchsiaSetValues component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { CycleOffsetTime = component.cycleOffsetTime; LasersRotation = component.lasersRotation; PushForceFollowsRotation = component.pushForceFollowsRotation; } } public void SetupWeaknesses() { eid.weaknesses[0] = "nail"; eid.weaknessMultipliers[0] = 1.25f; Util.ArrayAdd(ref eid.weaknesses, "explosion"); Util.ArrayAdd(ref eid.weaknessMultipliers, 0.75f); Util.ArrayAdd(ref eid.weaknesses, "railcannon"); Util.ArrayAdd(ref eid.weaknessMultipliers, 1.65f); eid.immuneToFriendlyFire = true; } public void RemoveParts() { drone = ((Component)this).GetComponent(); droneFlesh = ((Component)this).GetComponent(); ((Behaviour)drone).enabled = false; ((Behaviour)droneFlesh).enabled = false; ((Component)((Component)this).transform.Find("HardDamageBeam")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("Particle System")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("Particle System (1)")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("AlwaysLookAtCamera")).gameObject.SetActive(false); } public void AddParts() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) model = ((Component)this).transform.Find("Gib_Eyeball"); model.localScale = 3.81f * Vector3.one; Transform transform = Object.Instantiate(EnemyAssets.Prefabs["Virtue"], model).transform; ((Component)transform).gameObject.SetActive(false); transform.localPosition = Vector3.zero; DisableVirtue(transform); Transform val = transform.Find("DivineOrthos"); val.localScale = 6f * Vector3.one; val.localRotation = Quaternion.Euler(90f, 0f, 0f); Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name != "Wings" && (Object)(object)val2 != (Object)(object)val) { ((Component)val2).gameObject.SetActive(false); } else if (((Object)val2).name == "Wings") { wings = val2; } } ((Component)transform).gameObject.SetActive(true); AllowPushUp(CanPushUp); crown = Object.Instantiate(EnemyAssets.Prefabs["Virtue"].transform.Find("DivineOrthos/Orthos_Root/Crown"), model); crown.localScale = 0.08f * Vector3.one; crown.localPosition = new Vector3(-0.02f, -0.04f, 0.2f); AllowPushDown(CanPushDown); RetextureAll(); } public void DisableVirtue(Transform virtue) { ((Component)virtue).gameObject.layer = LayerMask.NameToLayer("Default"); ((Component)virtue).tag = "Untagged"; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Collider)((Component)virtue).GetComponent()).enabled = false; ((Collider)((Component)virtue).GetComponent()).isTrigger = true; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; ((Behaviour)((Component)virtue).GetComponent()).enabled = false; Collider component = ((Component)virtue.Find("Sphere")).GetComponent(); component.enabled = false; Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue).GetComponent()); Object.Destroy((Object)(object)((Component)virtue.Find("Sphere")).gameObject); Object.Destroy((Object)(object)((Component)virtue.Find("ParticleEffects")).gameObject); Object.Destroy((Object)(object)((Component)virtue.Find("SpawnEffect Projectile")).gameObject); } public void RetextureAll() { RetextureMeshRenderer(model, EnemyAssets.Textures["Fuchsia"]); RetextureMeshRenderer(crown, EnemyAssets.Textures["FuchsiaCrown"]); RetextureSkinnedMeshRenderer(wings, EnemyAssets.Textures["FuchsiaWings"]); } public void RetextureMeshRenderer(Transform tr, Texture2D texture) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (!((Object)(object)tr == (Object)null)) { MeshRenderer component = ((Component)tr).GetComponent(); Material val = Object.Instantiate(((Renderer)component).material); val.mainTexture = (Texture)(object)texture; ((Renderer)component).material = val; MaterialPropertyBlock val2 = new MaterialPropertyBlock(); ((Renderer)component).GetPropertyBlock(val2); val2.SetTexture("_MainTex", (Texture)(object)texture); ((Renderer)component).SetPropertyBlock(val2); val.EnableKeyword("ENEMY"); } } public void RetextureSkinnedMeshRenderer(Transform tr, Texture2D texture) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (!((Object)(object)tr == (Object)null)) { SkinnedMeshRenderer component = ((Component)tr).GetComponent(); Material val = Object.Instantiate(((Renderer)component).material); val.mainTexture = (Texture)(object)texture; ((Renderer)component).material = val; MaterialPropertyBlock val2 = new MaterialPropertyBlock(); ((Renderer)component).GetPropertyBlock(val2); val2.SetTexture("_MainTex", (Texture)(object)texture); ((Renderer)component).SetPropertyBlock(val2); } } public void SetupLasers() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) lasersTransform = new GameObject("Lasers").transform; lasersTransform.SetParent(((Component)this).transform); lasersTransform.localPosition = new Vector3(0f, 0f, 0.8f); lasersTransform.localRotation = Quaternion.identity; lasers[0] = Object.Instantiate(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform; lasers[1] = Object.Instantiate(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform; lasersMelee[0] = Object.Instantiate(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform; lasersMelee[1] = Object.Instantiate(EnemyAssets.Prefabs["ProvidenceBeam"], lasersTransform).transform; ConfigureLaserBeam(lasers[0], "Laser 0"); ConfigureLaserBeam(lasers[1], "Laser 1"); ConfigureLaserBeam(lasersMelee[0], "Melee Laser 0"); ConfigureLaserBeam(lasersMelee[1], "Melee Laser 1"); Renderer[] componentsInChildren = ((Component)lasersTransform).GetComponentsInChildren(true); foreach (Renderer item in componentsInChildren) { eid.buffUnaffectedRenderers.Add(item); } MeleeUnfire(); } public void ConfigureLaserBeam(Transform laser, string laserName, bool startup = false) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) ((Object)laser).name = laserName; ContinuousBeam component = ((Component)laser).GetComponent(); component.canHitEnemy = false; component.safeEnemyType = (EnemyType)1; component.beamWidth = 3f; component.originalWidth = 3f; component.startup = startup; component.startUpSpeed = 300f; Object.Destroy((Object)(object)((Component)component).GetComponent()); } public void AddLooker() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) looker = ((Component)this).gameObject.AddComponent(); looker.overrideTarget = ((Component)MonoSingleton.Instance).transform; ((Behaviour)looker).enabled = false; ((Component)this).transform.rotation = originalRotation; } public void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) lasersTransform.localScale = 0.25f * Vector3.one; drone.difficulty = Enemy.InitializeDifficulty(eid); drone.bsm = MonoSingleton.Instance; drone.gz = GoreZone.ResolveGoreZone(((Component)this).transform); drone.kib = ((Component)this).GetComponent(); MeshRenderer component = ((Component)((Component)this).transform.Find("Gib_Eyeball")).GetComponent(); ((Renderer)component).material.EnableKeyword("ENEMY"); StartDifficulty(); ((MonoBehaviour)this).StartCoroutine(StartFiring()); } public IEnumerator StartIdling() { yield return (object)new WaitForSeconds(1f); Idle(); } public IEnumerator StartFiring() { yield return (object)new WaitForSeconds(1f); Fire(); } public void StartDifficulty() { int difficulty = eid.difficulty; if (1 == 0) { } float num = difficulty switch { 4 => 1f, 3 => 0.8f, 2 => 0.65f, 1 => 0.45f, 0 => 0.3f, _ => 1.15f, }; if (1 == 0) { } difficultySpeedModifier = num; prePushDelay = 0.5f / difficultySpeedModifier; pushDuration = 0.3f / difficultySpeedModifier; preMeleeFireDelay = 0.35f / difficultySpeedModifier; meleeFireDuration = 0.25f / difficultySpeedModifier; postMeleeFireDelay = 0.2f / difficultySpeedModifier; didntDoMeleeTime = 0.2f / difficultySpeedModifier; } public void Update() { if ((Object)(object)eid == (Object)null || eid.health <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (eid.hooked) { MonoSingleton.Instance.StopThrow(1f, true); } if (checkingForParry && !enemy.parryable && !unparriableAttack) { parried = true; } if (((Behaviour)drone).enabled) { ((Behaviour)drone).enabled = false; } if (((Behaviour)droneFlesh).enabled) { ((Behaviour)droneFlesh).enabled = false; } } public void FixedUpdate() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) timeModulo = (Time.fixedTime - cycleOffsetTime) * GetTotalSpeedModifier() % (MathF.PI * 2f); if (rotatingLasers) { RotateLasers(); } if (!rigidbody.isKinematic) { rigidbody.isKinematic = true; } switch (state) { case FuchsiaState.Idle: ((Behaviour)looker).enabled = false; ((Component)this).transform.rotation = originalRotation; if (Time.fixedTime >= nextCycleTime) { Fire(); } else { CheckMelee(); } break; case FuchsiaState.Firing: ((Behaviour)looker).enabled = false; ((Component)this).transform.rotation = originalRotation; CheckMelee(); break; case FuchsiaState.MeleePushing: MeleePushingMove(); break; case FuchsiaState.MeleeFiring: ((Component)this).transform.position = originalPosition; MeleeFireMoveLasers(); break; case FuchsiaState.MeleeStart: break; } } public void Idle() { nextCycleTime = Time.fixedTime - cycleOffsetTime - (Time.fixedTime - cycleOffsetTime) % MathF.PI + MathF.PI / 2f + cycleOffsetTime; state = FuchsiaState.Idle; } public void RotateLasers() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) lasers[0].localRotation = GetLaserRotation(); lasers[1].localRotation = GetLaserRotation(firstLaser: false); } public Quaternion GetLaserRotation(bool firstLaser = true) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) float num = ((!firstLaser) ? (45f * Mathf.Sin(MathF.PI + timeModulo)) : (45f * Mathf.Sin(timeModulo))); return Quaternion.Euler(num, 0f, 0f); } public float GetTotalSpeedModifier() { float num = 1f; float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier); if (eid.speedBuff || OptionsManager.forceRadiance) { num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2); } if (eid.puppet) { num *= 0.75f; } return num; } public void Fire() { MeleeUnfire(); if (telegraphing) { Telegraph(newValue: false); } state = FuchsiaState.Firing; ((Component)lasers[0]).gameObject.SetActive(true); ((Component)lasers[1]).gameObject.SetActive(true); } public void Unfire() { ((Component)lasers[0]).gameObject.SetActive(false); ((Component)lasers[1]).gameObject.SetActive(false); } public void Telegraph(bool newValue) { telegraphing = newValue; Transform[] array = lasers; foreach (Transform val in array) { ((Component)val).gameObject.SetActive(true); ((Behaviour)((Component)val).GetComponent()).enabled = !newValue; ((Renderer)((Component)val).GetComponent()).enabled = !newValue; ((Component)val.Find("Ring (1)")).gameObject.SetActive(!newValue); } } public void AllowPushUp(bool newValue = true) { canPushUp = newValue; Transform obj = wings; if (obj != null) { ((Component)obj).gameObject.SetActive(newValue); } UpdateRealEnemyType(); } public void AllowPushDown(bool newValue = true) { canPushDown = newValue; Transform obj = crown; if (obj != null) { ((Component)obj).gameObject.SetActive(newValue); } UpdateRealEnemyType(); } public void UpdateRealEnemyType() { RealEnemyType type = RealEnemyType.FuchsiaPushUpPushDown; if (CanPushUp && !CanPushDown) { type = RealEnemyType.FuchsiaPushUp; } else if (!CanPushUp && CanPushDown) { type = RealEnemyType.FuchsiaPushDown; } else if (!CanPushUp && !CanPushDown) { type = RealEnemyType.Fuchsia; } realEnemyTypeSaver.type = type; GameObject[] activateOnDeath = eid.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "RealEnemyTypeSaver") { RealEnemyTypeSaver component = val.GetComponent(); component.type = type; break; } } } public void CheckMelee() { if (IsInDistance(meleeTriggerDistance) && IsInView() && !alreadyInMeleeZone) { alreadyInMeleeZone = true; ((MonoBehaviour)this).StartCoroutine(MeleeFull()); } else if (!IsInDistance(meleeZoneEndDistance)) { alreadyInMeleeZone = false; } } public bool IsInDistance(float targetDistance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton.Instance).transform.position); if (num > targetDistance || BlindEnemies.Blind || EnemyIgnorePlayer.Active) { return false; } return true; } public bool IsInView() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)MonoSingleton.Instance).transform.position - ((Component)this).transform.position; bool flag = Physics.Raycast(((Component)this).transform.position, val, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1))); return !flag; } public void MeleePushingMove() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) float num = Time.fixedTime - pushStartTimepoint; float num2 = 0.5f * pushDuration; if (num < num2) { ((Component)this).transform.position = Vector3.Lerp(originalPosition, ((Component)MonoSingleton.Instance).transform.position, num / num2); } else if (num >= num2) { if (!didMeleePushAction) { MeleePushAction(); didMeleePushAction = true; } ((Component)this).transform.position = Vector3.Lerp(((Component)MonoSingleton.Instance).transform.position, originalPosition, (num - num2) / num2); } } public IEnumerator MeleeFull() { Unfire(); state = FuchsiaState.MeleeStart; looker.speed = 0f; ((Behaviour)looker).enabled = true; if (!unparriableAttack) { enemy.parryable = true; } checkingForParry = true; ParryFlash(); yield return (object)new WaitForSeconds(prePushDelay); checkingForParry = false; enemy.parryable = false; ((Collider)collider).enabled = false; bool startedMeleePush = MeleePushStart(); bool parriedThis = parried; parried = false; if (startedMeleePush) { ((Component)this).transform.LookAt(((Component)MonoSingleton.Instance).transform); yield return (object)new WaitForSeconds(pushDuration); ((Collider)collider).enabled = true; looker.speed = 40f; yield return (object)new WaitForSeconds(preMeleeFireDelay); didMeleePushAction = false; MeleeFire(); yield return (object)new WaitForSeconds(meleeFireDuration); MeleeUnfire(); ((Behaviour)looker).enabled = false; ((Component)this).transform.rotation = originalRotation; yield return (object)new WaitForSeconds(postMeleeFireDelay); } else { yield return (object)new WaitForSeconds(didntDoMeleeTime); ((Collider)collider).enabled = true; didMeleePushAction = false; ((Behaviour)looker).enabled = false; ((Component)this).transform.rotation = originalRotation; } unparriableAttack = parriedThis && eid.difficulty >= 4 && !unparriableAttack; RotateLasers(); Fire(); } public void ParryFlash() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Transform transform = Object.Instantiate((!unparriableAttack) ? MonoSingleton.Instance.parryableFlash : MonoSingleton.Instance.unparryableFlash, lasersTransform.position, lasersTransform.rotation, lasersTransform).transform; transform.localScale *= 12.5f; transform.localPosition += 0.3f * Vector3.forward; } public bool MeleePushStart() { //IL_003f: 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) if ((!parried && !IsInDistance(meleePushDistance)) || !IsInView()) { return false; } pushStartTimepoint = Time.fixedTime; originalPosition = ((Component)this).transform.position; state = FuchsiaState.MeleePushing; return true; } public void MeleePushAction() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = MonoSingleton.Instance.Rigidbody; val.velocity = Vector3.zero; if (CanPushUp && !CanPushDown) { MeleePushDirection(); } else if (CanPushDown && !CanPushUp) { MeleePushDirection(up: false); } else if (CanPushUp && CanPushDown) { if (((Component)val).transform.position.y + 1.5f >= originalPosition.y) { MeleePushDirection(); } else { MeleePushDirection(up: false); } } else { MonoSingleton.Instance.GetHurt(20, true, 1f, false, false, 0.35f, false); } } public void MeleePushDirection(bool up = true) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (MonoSingleton.Instance.gc.heavyFall) { MonoSingleton.Instance.fallSpeed = 0f; MonoSingleton.Instance.gc.heavyFall = false; } float num = (up ? pushForce : (0f - pushForce)); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, num, 0f); if (pushForceFollowsRotation) { val = originalRotation * val; } MonoSingleton.Instance.Rigidbody.AddForce(val, (ForceMode)2); } public void MeleeFire() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Unfire(); state = FuchsiaState.MeleeFiring; meleeFireStartTimepoint = Time.fixedTime; rotatingLasers = false; lasersMelee[0].localRotation = Quaternion.Euler(22.5f, 0f, 0f); lasersMelee[1].localRotation = Quaternion.Euler(-22.5f, 0f, 0f); ((Component)lasersMelee[0]).gameObject.SetActive(true); ((Component)lasersMelee[1]).gameObject.SetActive(true); } public void MeleeUnfire() { ((Component)lasersMelee[0]).gameObject.SetActive(false); ((Component)lasersMelee[1]).gameObject.SetActive(false); rotatingLasers = true; } public void MeleeFireMoveLasers() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) float num = Time.fixedTime - meleeFireStartTimepoint; float num2 = 0.33f * meleeFireDuration; if (num < num2) { lasersMelee[0].rotation = Quaternion.Lerp(lasersMelee[0].rotation, ((Component)this).transform.rotation, num / num2); lasersMelee[1].rotation = Quaternion.Lerp(lasersMelee[1].rotation, ((Component)this).transform.rotation, num / num2); } else if (num >= num2) { lasersMelee[0].rotation = ((Component)this).transform.rotation; lasersMelee[1].rotation = ((Component)this).transform.rotation; } else if (num >= 2f * num2 && (((Component)lasersMelee[0]).gameObject.activeSelf || ((Component)lasersMelee[1]).gameObject.activeSelf)) { Unfire(); } } } public enum FuchsiaState { Nothing, Idle, Firing, MeleeStart, MeleePushing, MeleeFiring } public class IdolStart : MonoBehaviour { public Idol idol; public void Start() { idol = ((Component)this).GetComponent(); if (((Object)this).name.Contains("Enrager")) { StartEnrager(); } else if (((Object)this).name.Contains("Lumen")) { StartLumen(); } else if (((Object)this).name.Contains("Puppeteer")) { StartPuppeteer(); } else if (((Object)this).name.Contains("Sander")) { StartSander(); } PostStart(); } public void PostStart() { RealEnemyTypeSaver component = ((Component)this).GetComponent(); RealEnemyType realEnemyType; if ((Object)(object)component != (Object)null) { realEnemyType = component.type; } else { Transform val = Util.FindParentWithNameContaining("Spawned", ((Component)this).transform); if ((Object)(object)val == (Object)null) { return; } realEnemyType = IdollikePatch.GetIdolType(((Object)val).name); } if (!RealEnemyTypeSaver.IdollikeTypes.Contains(realEnemyType)) { return; } Transform val2 = ((Component)this).transform.Find("SpawnEffect Idol"); if ((Object)(object)val2 != (Object)null) { SpawnEffectPitch orAddComponent = ComponentExtensions.GetOrAddComponent((Component)(object)val2); SpawnEffectPitch spawnEffectPitch = orAddComponent; if (1 == 0) { } float pitchMultiplier = realEnemyType switch { RealEnemyType.Enrager => 1.2f, RealEnemyType.Lumen => 1.2f, RealEnemyType.Puppeteer => 0.8f, RealEnemyType.Sander => 0.8f, _ => 1f, }; if (1 == 0) { } spawnEffectPitch.pitchMultiplier = pitchMultiplier; } } public void StartEnrager() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("EnragerSpawned", ((Component)idol).transform); if (!((Object)(object)val == (Object)null)) { if (idol.eid.overrideFullName == "IDOL") { idol.eid.overrideFullName = "ENRAGER"; } Util.UpdateEnemyHealthbar(idol.eid); ComponentExtensions.GetOrAddComponent((Component)(object)idol).type = RealEnemyType.Enrager; ComponentExtensions.GetOrAddComponent((Component)(object)idol).puppetName = ((Object)idol).name; ((Component)idol.halo).gameObject.SetActive(false); EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren(); GameObject val2 = Object.Instantiate(MonoSingleton.Instance.enrageEffect, ((Component)componentInChildren).transform.parent); val2.transform.localPosition = new Vector3(0f, 0.5f, 0f); val2.transform.localScale = 0.667f * Vector3.one; MeshRenderer component = ((Component)componentInChildren).GetComponent(); ((Renderer)component).material.color = new Color(1f, 0.35f, 0f); idol.beam.endColor = new Color(1f, 0.75f, 0f); idol.beam.startColor = Color.red; DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren(); ((Component)componentInChildren2).GetComponent().color = new Color(0.6557f, 0f, 0f, 0.502f); Transform child = ((Component)componentInChildren2).transform.GetChild(0); ((Component)child).GetComponent().color = new Color(1f, 0.2f, 0f, 0.749f); } } public void StartLumen() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("LumenSpawned", ((Component)idol).transform); if (!((Object)(object)val == (Object)null)) { if (idol.eid.overrideFullName == "IDOL") { idol.eid.overrideFullName = "LUMEN"; } Util.UpdateEnemyHealthbar(idol.eid); ComponentExtensions.GetOrAddComponent((Component)(object)idol).type = RealEnemyType.Lumen; ComponentExtensions.GetOrAddComponent((Component)(object)idol).puppetName = ((Object)idol).name; Collider component = ((Component)idol).GetComponent(); Vector3 val2; if (!Object.op_Implicit((Object)(object)component)) { val2 = ((Component)idol).transform.position; } else { Bounds bounds = component.bounds; val2 = ((Bounds)(ref bounds)).center; } Vector3 val3 = val2; Object.Instantiate(MonoSingleton.Instance.radianceEffect, val3, Quaternion.identity); ((Renderer)idol.beam).material = idol.radiantBeam; idol.halo.sprite = idol.radiantHalo; idol.halo.color = Color.white; EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren(); MeshRenderer component2 = ((Component)componentInChildren).GetComponent(); ((Renderer)component2).material.color = new Color(0.6f, 0.5f, 1.5f); idol.beam.endColor = new Color(0.6f, 0.6f, 1f); idol.beam.startColor = new Color(0.6f, 0.6f, 1f); DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren(); ((Component)componentInChildren2).GetComponent().color = new Color(0.7f, 0.5f, 1f, 0.502f); Transform child = ((Component)componentInChildren2).transform.GetChild(0); ((Component)child).GetComponent().color = new Color(0.4f, 0.3f, 1f, 0.749f); } } public void StartPuppeteer() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("PuppeteerSpawned", ((Component)idol).transform); if (!((Object)(object)val == (Object)null)) { if (idol.eid.overrideFullName == "IDOL") { idol.eid.overrideFullName = "PUPPETEER"; } Util.UpdateEnemyHealthbar(idol.eid); ComponentExtensions.GetOrAddComponent((Component)(object)idol).type = RealEnemyType.Puppeteer; ComponentExtensions.GetOrAddComponent((Component)(object)idol).puppetName = ((Object)idol).name; ComponentExtensions.GetOrAddComponent((Component)(object)idol); EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren(); MeshRenderer component = ((Component)componentInChildren).GetComponent(); ((Renderer)component).material.color = new Color(1f, 0f, 0.35f); idol.beam.endColor = new Color(1f, 0f, 0.35f); idol.beam.startColor = new Color(1f, 0f, 0.6f); idol.halo.color = new Color(1f, 0.65f, 0.85f); idol.haloColor = new Color(1f, 0.65f, 0.85f); DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren(); ((Component)componentInChildren2).GetComponent().color = new Color(0.8f, 0f, 0.6f, 0.502f); Transform child = ((Component)componentInChildren2).transform.GetChild(0); ((Component)child).GetComponent().color = new Color(1f, 0f, 0.3f, 0.749f); } } public void StartSander() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("SanderSpawned", ((Component)idol).transform); if (!((Object)(object)val == (Object)null)) { if (idol.eid.overrideFullName == "IDOL") { idol.eid.overrideFullName = "SANDER"; } Util.UpdateEnemyHealthbar(idol.eid); ComponentExtensions.GetOrAddComponent((Component)(object)idol).type = RealEnemyType.Sander; ComponentExtensions.GetOrAddComponent((Component)(object)idol).puppetName = ((Object)idol).name; EnemySimplifier componentInChildren = ((Component)idol).GetComponentInChildren(); MeshRenderer component = ((Component)componentInChildren).GetComponent(); ((Renderer)component).material.color = new Color(1f, 0.9f, 0.55f); idol.beam.endColor = new Color(1f, 0.9f, 0.55f); idol.beam.startColor = new Color(1f, 0.9f, 0.55f); idol.halo.color = new Color(1f, 0.9f, 0.55f); idol.haloColor = new Color(1f, 0.9f, 0.55f); DistantSprite componentInChildren2 = ((Component)idol).GetComponentInChildren(); ((Component)componentInChildren2).GetComponent().color = new Color(1f, 0.9f, 0.55f, 0.502f); Transform child = ((Component)componentInChildren2).transform.GetChild(0); ((Component)child).GetComponent().color = new Color(1f, 0.9f, 0.55f, 0.749f); SandifySelf(); } } private void SandifySelf() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) EnemyIdentifier eid = idol.eid; if (eid.puppet) { eid.InstaKill(); return; } EnemyIdentifierIdentifier[] componentsInChildren = ((Component)eid).GetComponentsInChildren(); EnemyIdentifierIdentifier[] array = componentsInChildren; Bounds bounds; foreach (EnemyIdentifierIdentifier val in array) { GameObject val2 = Object.Instantiate(MonoSingleton.Instance.sandDrip, ((Component)val).transform.position, ((Component)val).transform.rotation); Collider component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { Transform transform = val2.transform; bounds = component.bounds; transform.localScale = ((Bounds)(ref bounds)).size; } val2.transform.SetParent(((Component)val).transform, true); } Collider component2 = ((Component)eid).GetComponent(); Vector3 val3; if (Object.op_Implicit((Object)(object)component2)) { bounds = component2.bounds; val3 = ((Bounds)(ref bounds)).center; } else { val3 = ((Component)idol).transform.position; } Object.Instantiate(MonoSingleton.Instance.sandificationEffect, val3, Quaternion.identity); } } public class FromOneTimeParry : MonoBehaviour { public OneTimeParry source; public Enemy enemy; public void Awake() { source = null; } public void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source != (Object)null) { ((Component)this).transform.position = ((Component)source).transform.position; } if ((Object)(object)enemy == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class OneTimeParry : MonoBehaviour { public Landmine mine; public GameObject deactivateOnParry; public Enemy enemy; public float subtractHealth; public void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) mine = Object.Instantiate(EnemyAssets.Prefabs["Landmine"], ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent(); ((Component)mine).transform.localScale = Vector3.one; FromOneTimeParry fromOneTimeParry = ((Component)mine).gameObject.AddComponent(); fromOneTimeParry.source = this; fromOneTimeParry.enemy = enemy; Rigidbody component = ((Component)mine).gameObject.GetComponent(); component.isKinematic = true; mine.activated = true; AudioSource component2 = ((Component)mine).gameObject.GetComponent(); component2.volume = 0f; mine.activatedBeep = null; Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent()); Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent()); Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent()); Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent()); Object.Destroy((Object)(object)((Component)((Component)mine).transform.Find("LightCylinder")).gameObject); ((Component)((Component)mine).transform.Find("ParryZone")).gameObject.SetActive(true); Transform val = ((Component)mine).transform.Find("ParryZone/V2Flash"); ((Component)val).gameObject.AddComponent(); val.position = ((Component)mine).transform.position; val.localScale *= 3f; } public void Update() { if (mine.parried) { ((MonoBehaviour)this).StartCoroutine(GotParried()); } } public IEnumerator GotParried() { yield return (object)new WaitForSeconds(0.1f); Object.Destroy((Object)(object)((Component)mine).gameObject); deactivateOnParry.SetActive(false); Enemy obj = enemy; if (obj != null) { obj.health -= subtractHealth; } Enemy obj2 = enemy; if (obj2 != null) { EnemyIdentifier eid = obj2.eid; if (eid != null) { eid.health -= subtractHealth; } } Enemy obj3 = enemy; if (obj3 != null && obj3.health <= 0f) { Enemy obj4 = enemy; if (obj4 != null) { EnemyIdentifier eid2 = obj4.eid; if (eid2 != null) { eid2.SimpleDamage(0f); } } } Object.Destroy((Object)(object)this); } } public class PermanentRage : MonoBehaviour { } public class PuppeteerSetValues : MonoBehaviour { public bool killPuppetsOnDeath = true; public float cooldownMultiplier = 1f; } public class PuppeteerSpawned : MonoBehaviour { public bool KillPuppetsOnDeath = true; public float CooldownMultiplier = 1f; public Idol idol; public float cooldown = 6f; public float cooldownMax = 6f; public List caughtEnemies = new List(); public void Awake() { idol = ((Component)this).GetComponent(); int difficulty = idol.difficulty; if (1 == 0) { } float num = difficulty switch { 4 => 6f, 3 => 8f, 2 => 9.5f, 1 => 11f, 0 => 13f, _ => 6f, }; if (1 == 0) { } cooldownMax = num; CheckSetValues(); cooldown = cooldownMax * CooldownMultiplier; } public void CheckSetValues() { PuppeteerSetValues component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { KillPuppetsOnDeath = component.killPuppetsOnDeath; CooldownMultiplier = component.cooldownMultiplier; } } public void Update() { if ((Object)(object)idol == (Object)null || (Object)(object)idol.target == (Object)null) { cooldown = cooldownMax * CooldownMultiplier; return; } cooldown += Time.deltaTime; if (!(cooldown < cooldownMax * CooldownMultiplier)) { cooldown = 0f; SpawnPuppet(idol.target); } } public void SpawnPuppet(EnemyIdentifier eid) { int num = AddCaughtEnemy(eid); if (num != -1) { InstantiatePuppetSpawnable(num); } } public int AddCaughtEnemy(EnemyIdentifier eid) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown if ((Object)(object)MonoSingleton.Instance == (Object)null) { Plugin.Logger.LogWarning((object)"EnemyTracker instance not found. Cannot track enemy death."); } else { if (MonoSingleton.Instance.spawnedEnemies.TryGetValue(((Object)eid).GetInstanceID(), out var value)) { CaughtEnemy val = new CaughtEnemy(eid, value); GameObject[] activateOnDeath = val.original.activateOnDeath; foreach (GameObject val2 in activateOnDeath) { if (((Object)val2).name == "RealEnemyTypeSaver") { RealEnemyType type = val2.GetComponent().type; if (EnemyAssets.SpawnableObjects.ContainsKey(type) && (Object)(object)EnemyAssets.SpawnableObjects[type] != (Object)null) { ((SavedGeneric)val.savedEnemy).Spawnable = EnemyAssets.SpawnableObjects[type]; } } } caughtEnemies.Add(val); return caughtEnemies.IndexOf(val); } Plugin.Logger.LogWarning((object)("Enemy " + ((Object)eid).name + " not found in spawned enemies. Cannot track death.")); } return -1; } public void InstantiatePuppetSpawnable(int puppetIndex) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) SavedEnemy savedEnemy = caughtEnemies[puppetIndex].savedEnemy; SpawnableInstance val = SpawnableObjectExtensions.InstantiateSpawnable(((SavedGeneric)savedEnemy).Spawnable, (SavedGeneric)(object)savedEnemy, ((Component)this).transform.parent, true); ((Component)val).transform.position = caughtEnemies[puppetIndex].position; ((Component)val).transform.rotation = caughtEnemies[puppetIndex].rotation; val.ApplyAlterOptions((IEnumerable)(object)new AlterOption[1] { new AlterOption { targetKey = "puppeted", useBool = true, boolValue = true } }); if (idol.eid.healthBuff || idol.eid.speedBuff || idol.eid.damageBuff) { EnemyIdentifier componentInChildren = ((Component)val).GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.radianceTier = idol.eid.radianceTier; if (idol.eid.healthBuff) { componentInChildren.healthBuff = true; componentInChildren.healthBuffRequests++; componentInChildren.healthBuffModifier = idol.eid.healthBuffModifier; } if (idol.eid.speedBuff) { componentInChildren.speedBuff = true; componentInChildren.speedBuffRequests++; componentInChildren.speedBuffModifier = idol.eid.speedBuffModifier; } if (idol.eid.damageBuff) { componentInChildren.damageBuff = true; componentInChildren.damageBuffRequests++; componentInChildren.damageBuffModifier = idol.eid.damageBuffModifier; } } } caughtEnemies[puppetIndex].UpdatePuppet(((Component)val).gameObject); } public void KillPuppets() { if (caughtEnemies == null || caughtEnemies.Count == 0) { return; } foreach (CaughtEnemy caughtEnemy in caughtEnemies) { if (caughtEnemy != null && !((Object)(object)caughtEnemy.puppet == (Object)null)) { EnemyIdentifier componentInChildren = caughtEnemy.puppet.GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.InstaKill(); } } } } } public class ShockwaveShufflerSetValues : MonoBehaviour { public float cooldown = 4f; public float cooldownOffset = 0f; public float shockwaveSpeed = 40f; public float shockwaveMaxSize = 100f; public float shockwaveHeightMultiplier = 1f; } public class ShockwaveShufflerSpawned : MonoBehaviour { public float Cooldown = 4f; public float CooldownOffset = 0f; public float ShockwaveSpeed = 40f; public float ShockwaveMaxSize = 100f; public float ShockwaveHeightMultiplier = 1f; public float nextCycleTime; public bool didFlash = false; public float flashPreAttackTime = 0.75f; public bool finishedSetup = false; public float animationFirstHalfTime = 0.05f; public float animationHoldTime = 0.35f; public float animationSecondHalfTime = 0.3f; public float animationStartTimepoint; public bool doingAnimation = false; public Transform model; public Transform modelRoot; public Transform modelCenter; public Transform modelBottleneck; public Transform modelTip; public Transform modelTopBlock; public Vector3 modelRootPosition; public Vector3 modelCenterPosition; public Vector3 modelBottleneckPosition; public Vector3 modelTipPosition; public Vector3 modelTopBlockPosition; public Vector3 modelRootPositionAnim; public Vector3 modelCenterPositionAnim; public Vector3 modelBottleneckPositionAnim; public Vector3 modelTipPositionAnim; public Vector3 modelTopBlockPositionAnim; public EnemyIdentifier eid; public Rigidbody rigidbody; public Drone drone; public DroneFlesh droneFlesh; public void Awake() { eid = ((Component)this).GetComponent(); eid.weaknesses = Array.Empty(); eid.weaknessMultipliers = Array.Empty(); rigidbody = ((Component)this).GetComponent(); if (!finishedSetup) { RemoveParts(); AddModel(); finishedSetup = true; } else { ModelProcessParts(); } CheckSetValues(); } public void CheckSetValues() { ShockwaveShufflerSetValues component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { Cooldown = component.cooldown; CooldownOffset = component.cooldownOffset; ShockwaveSpeed = component.shockwaveSpeed; ShockwaveMaxSize = component.shockwaveMaxSize; ShockwaveHeightMultiplier = component.shockwaveHeightMultiplier; } } public void RemoveParts() { drone = ((Component)this).GetComponent(); droneFlesh = ((Component)this).GetComponent(); ((Behaviour)drone).enabled = false; ((Behaviour)droneFlesh).enabled = false; ((Component)((Component)this).transform.Find("Audio Source")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("Particle System")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("Particle System (1)")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("AlwaysLookAtCamera")).gameObject.SetActive(false); ((Component)((Component)this).transform.Find("Gib_Eyeball")).gameObject.SetActive(false); } public void AddModel() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = 1.5f * Vector3.one; model = Object.Instantiate(EnemyAssets.Prefabs["ShockwaveShuffler"], ((Component)this).transform.position, ((Component)this).transform.rotation).transform; model.SetParent(((Component)this).transform); ((Component)model).tag = "Untagged"; ((Component)model).gameObject.layer = LayerMask.NameToLayer("Default"); NavMeshModifier componentInChildren = ((Component)model).GetComponentInChildren(); ((Behaviour)componentInChildren).enabled = false; ((Component)((Component)componentInChildren).transform.Find("NavMeshBlocker")).gameObject.SetActive(false); ModelReposition(); model.localScale = new Vector3(0.75f, 0.125f, 0.75f); model.localPosition = new Vector3(0f, 1f, 0f); model.Rotate(0f, 0f, 180f); ModelProcessParts(); } public void ModelReposition() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) modelRoot = model.Find("Root"); modelRootPosition = new Vector3(-2.5f, 0f, 2.5f); modelRootPositionAnim = new Vector3(-2.5f, 4f, 2.5f); modelRoot.localPosition = modelRootPosition; modelCenter = model.Find("Center"); modelCenterPosition = new Vector3(0f, 1f, 0f); modelCenterPositionAnim = new Vector3(0f, 4.25f, 0f); modelCenter.localPosition = modelCenterPosition; modelBottleneck = model.Find("Bottleneck"); modelBottleneckPosition = new Vector3(0f, 1f, 0f); modelBottleneck.localPosition = modelBottleneckPosition; modelTip = model.Find("Tip"); modelTipPosition = new Vector3(0f, 1f, 0f); modelTipPositionAnim = new Vector3(0f, -1f, 0f); modelTip.localPosition = modelTipPosition; modelTopBlock = model.Find("Top Block"); modelTopBlockPosition = new Vector3(-2.5f, 12f, 2.5f); modelTopBlockPositionAnim = new Vector3(-2.5f, 8.5f, 2.5f); modelTopBlock.localPosition = modelTopBlockPosition; } public void ModelProcessParts() { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.layer = LayerMask.NameToLayer("BigCorpse"); ((Component)this).gameObject.AddComponent(); MeshRenderer[] componentsInChildren = ((Component)model).GetComponentsInChildren(true); foreach (MeshRenderer val in componentsInChildren) { ((Component)val).tag = "Body"; ((Component)val).gameObject.layer = LayerMask.NameToLayer("BigCorpse"); RetextureMeshRenderer(val); for (int j = 0; j < ((Renderer)val).materials.Length; j++) { ((Renderer)val).materials[j] = Object.Instantiate(((Renderer)val).materials[j]); ((Renderer)val).materials[j].EnableKeyword("ENEMY"); ((Renderer)val).materials[j].SetFloat("ENEMY", 1f); if (Util.IsSandbox()) { ((Renderer)val).materials[j].DisableKeyword("VERTEX_LIGHTING"); ((Renderer)val).materials[j].SetFloat("VERTEX_LIGHTING", 0f); } else { ((Renderer)val).materials[j].EnableKeyword("EMISSIVE"); } } ComponentExtensions.GetOrAddComponent((Component)(object)val); } BoxCollider component = ((Component)((Component)this).transform).GetComponent(); component.size = new Vector3(4f, 2f, 4f); Transform val2 = ((Component)this).transform.Find("Sphere"); ((Collider)((Component)val2).GetComponent()).enabled = false; ComponentExtensions.GetOrAddComponent((Component)(object)val2).size = new Vector3(2f, 1f, 2f); } public void RetextureMeshRenderer(MeshRenderer mr) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown if ((Object)(object)mr == (Object)null) { return; } for (int i = 0; i < ((Renderer)mr).materials.Length; i++) { Material val = ((Renderer)mr).materials[i]; if (!((Object)(object)val.mainTexture == (Object)null)) { string name = ((Object)val.mainTexture).name; if (EnemyAssets.Textures.ContainsKey(name) && (Object)(object)EnemyAssets.Textures[name] != (Object)null) { Material val2 = Object.Instantiate(val); val2.mainTexture = (Texture)(object)EnemyAssets.Textures[name]; ((Renderer)mr).materials[i] = val2; MaterialPropertyBlock val3 = new MaterialPropertyBlock(); ((Renderer)mr).GetPropertyBlock(val3); val3.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures[name]); ((Renderer)mr).SetPropertyBlock(val3); } } } } public void Start() { drone.difficulty = Enemy.InitializeDifficulty(eid); drone.bsm = MonoSingleton.Instance; drone.gz = GoreZone.ResolveGoreZone(((Component)this).transform); drone.kib = ((Component)this).GetComponent(); if ((Object)(object)((Component)this).GetComponent() == (Object)null) { CooldownOffset = Time.time % Cooldown; if (!BlindEnemies.Blind && !EnemyIgnorePlayer.Active) { CreateShockwave(); } } GetNextCycleTime(); } public void Update() { if ((Object)(object)eid == (Object)null || eid.health <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (doingAnimation) { DoAnimation(); } if (BlindEnemies.Blind || EnemyIgnorePlayer.Active) { GetNextCycleTime(); } else { bool flag = nextCycleTime - Time.time <= flashPreAttackTime; bool flag2 = nextCycleTime - Time.time <= 0.5f * flashPreAttackTime; if (flag && !didFlash && !flag2) { Flash(); } if (Time.time >= nextCycleTime) { if (didFlash) { CreateShockwave(); } GetNextCycleTime(); } } if (((Behaviour)drone).enabled) { ((Behaviour)drone).enabled = false; } if (((Behaviour)droneFlesh).enabled) { ((Behaviour)droneFlesh).enabled = false; } } public void FixedUpdate() { if (!rigidbody.isKinematic) { rigidbody.isKinematic = true; } } public void GetNextCycleTime() { float num = Cooldown / GetTotalSpeedModifier(); float num2 = CooldownOffset / GetTotalSpeedModifier(); float num3 = Mathf.Floor((Time.time - num2) / num); nextCycleTime = num2 + num * (num3 + 1f); didFlash = false; } public float GetTotalSpeedModifier() { float num = 1f; float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier); if (eid.speedBuff || OptionsManager.forceRadiance) { num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2); } if (eid.puppet) { num *= 0.75f; } return num; } public void CreateShockwave() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown animationStartTimepoint = Time.time; doingAnimation = true; GameObject val = Object.Instantiate(EnemyAssets.Prefabs["ShockwaveMagenta"], ((Component)this).transform.position, ((Component)this).transform.rotation); Vector3 localScale = val.transform.localScale; val.transform.localScale = new Vector3(localScale.x, localScale.y * ShockwaveHeightMultiplier, localScale.z); PhysicalShockwave component = val.GetComponent(); component.noDamageToEnemy = true; component.enemyType = (EnemyType)42; component.speed = ShockwaveSpeed; component.maxSize = ShockwaveMaxSize; component.target = new EnemyTarget(((Component)MonoSingleton.Instance).transform); val.AddComponent(); MeshCollider[] componentsInChildren = val.GetComponentsInChildren(true); MeshCollider[] array = componentsInChildren; foreach (MeshCollider val2 in array) { ((Component)val2).gameObject.layer = LayerMask.NameToLayer("Default"); } } public void Flash() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Transform transform = Object.Instantiate(MonoSingleton.Instance.unparryableFlash, model.position, Quaternion.identity).transform; transform.localScale *= 20f; transform.LookAt(((Component)MonoSingleton.Instance).transform); ((Component)transform).GetComponent().volume = 0.5f; didFlash = true; } public void DoAnimation() { float num = Time.time - animationStartTimepoint; float num2 = animationFirstHalfTime; float num3 = animationFirstHalfTime + animationHoldTime; float num4 = animationFirstHalfTime + animationHoldTime + animationSecondHalfTime; if (num < num2) { DoAnimationFirstPart(num); } else if (num < num3) { DoAnimationHold(); } else if (num < num4) { DoAnimationSecondPart(num, num3); } else if (num >= num4) { DoAnimationEnd(); } } public void DoAnimationFirstPart(float currentAnimationTime) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) modelRoot.localPosition = Vector3.Lerp(modelRootPosition, modelRootPositionAnim, currentAnimationTime / animationFirstHalfTime); modelCenter.localPosition = Vector3.Lerp(modelCenterPosition, modelCenterPositionAnim, currentAnimationTime / animationFirstHalfTime); modelBottleneck.localPosition = Vector3.Lerp(modelBottleneckPosition, modelBottleneckPositionAnim, currentAnimationTime / animationFirstHalfTime); modelTip.localPosition = Vector3.Lerp(modelTipPosition, modelTipPositionAnim, currentAnimationTime / animationFirstHalfTime); modelTopBlock.localPosition = Vector3.Lerp(modelTopBlockPosition, modelTopBlockPositionAnim, currentAnimationTime / animationFirstHalfTime); } public void DoAnimationHold() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0050: Unknown result type (might be due to invalid IL or missing references) modelRoot.localPosition = modelRootPositionAnim; modelCenter.localPosition = modelCenterPositionAnim; modelBottleneck.localPosition = modelBottleneckPositionAnim; modelTip.localPosition = modelTipPositionAnim; modelTopBlock.localPosition = modelTopBlockPositionAnim; } public void DoAnimationSecondPart(float currentAnimationTime, float holdTimeFull) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) modelRoot.localPosition = Vector3.Lerp(modelRootPositionAnim, modelRootPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime); modelCenter.localPosition = Vector3.Lerp(modelCenterPositionAnim, modelCenterPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime); modelBottleneck.localPosition = Vector3.Lerp(modelBottleneckPositionAnim, modelBottleneckPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime); modelTip.localPosition = Vector3.Lerp(modelTipPositionAnim, modelTipPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime); modelTopBlock.localPosition = Vector3.Lerp(modelTopBlockPositionAnim, modelTopBlockPosition, (currentAnimationTime - holdTimeFull) / animationSecondHalfTime); } public void DoAnimationEnd() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) doingAnimation = false; modelRoot.localPosition = modelRootPosition; modelCenter.localPosition = modelCenterPosition; modelBottleneck.localPosition = modelBottleneckPosition; modelTip.localPosition = modelTipPosition; modelTopBlock.localPosition = modelTopBlockPosition; } } public class TrueMagentaShockwave : MonoBehaviour { } public class WatchtowerSpawned : MonoBehaviour { public bool shooting; public EnemyIdentifier eid; public Transform shootPoint; public Transform sphere; public OneTimeParry otp; public bool finishedSetup = false; public bool firstShoot = true; public float shootCooldown = 0f; public float shootCooldownMax = 1.5f; public float flashPreAttackTime = 0.5f; public bool didFlash = false; public const float shootCooldownMaxDefault = 1.5f; public int shootCount = 6; public float projectileSpeed = 100f; public const float projectileSpeedDefault = 100f; public float difficultySpeedModifier = 1f; public GameObject projectile = EnemyAssets.Prefabs["Projectile"]; public Projectile currentProjectile; public List currentSeries = new List(); public bool seriesParried; public void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) shootPoint = ((Component)this).GetComponent().shootPoint; eid = ((Component)this).GetComponent(); if (!finishedSetup) { ((Component)this).transform.localScale = new Vector3(10f, 10f, 10f); if (((Object)((Component)this).transform.parent).name.Contains("Automated Gore Zone")) { ((Component)this).transform.localScale = new Vector3(15f, 20f, 15f); } StartSpheres(); sphere = ((Component)shootPoint).transform.Find("Sphere (1)"); otp = ((Component)sphere).gameObject.AddComponent(); otp.deactivateOnParry = ((Component)otp).gameObject; otp.enemy = ((Component)this).GetComponent(); otp.subtractHealth = 12f; finishedSetup = true; } StartColliders(); StartDifficulty(); } public void StartSpheres() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find("Armature/Pole_Top/Sphere (1)"); val.localScale = new Vector3(0.2f, 0.2f, 0.2f); Object.Destroy((Object)(object)((Component)val).GetComponent()); Object.Destroy((Object)(object)((Component)val).GetComponent()); ((Component)val).gameObject.SetActive(false); Transform val2 = val.Find("Sphere (1)"); ((Renderer)((Component)val2).GetComponent()).material.color = new Color(1f, 1f, 0f); Object.Destroy((Object)(object)((Component)val2).GetComponent()); val2.localScale = Vector3.one; ComponentExtensions.GetOrAddComponent((Component)(object)val2); ((Renderer)((Component)val2).GetComponent()).material.EnableKeyword("ENEMY"); } public void StartDifficulty() { switch (eid.difficulty) { case 4: difficultySpeedModifier = 1f; shootCount = 5; break; case 3: difficultySpeedModifier = 0.85f; shootCount = 4; break; case 2: difficultySpeedModifier = 0.65f; shootCount = 4; break; case 1: difficultySpeedModifier = 0.4f; shootCount = 3; break; case 0: difficultySpeedModifier = 0.3f; shootCount = 3; break; default: difficultySpeedModifier = 1.15f; shootCount = 6; break; } shootCooldownMax = 1.5f / difficultySpeedModifier; projectileSpeed = 100f * difficultySpeedModifier; } public void StartColliders() { CapsuleCollider component = ((Component)((Component)this).transform.Find("Armature/Pole_Top")).GetComponent(); component.height = 0.6f; component.radius = 0.06f; CapsuleCollider component2 = ((Component)((Component)this).transform.Find("Armature/Pole_Middle")).GetComponent(); component2.height = 0.66f; component2.radius = 0.08f; CapsuleCollider component3 = ((Component)((Component)this).transform.Find("Armature/Pole_Bottom")).GetComponent(); component3.height = 0.66f; component3.radius = 0.1f; } public void Update() { if (!shooting) { shootCooldown += Time.deltaTime * eid.totalSpeedModifier; } float num = flashPreAttackTime / difficultySpeedModifier / GetTotalSpeedModifier(); if (firstShoot) { didFlash = true; firstShoot = false; } else if (!didFlash && shootCooldown >= shootCooldownMax - num) { FlashSmall(); } if (shootCooldown >= shootCooldownMax && !shooting && didFlash && !BlindEnemies.Blind && !EnemyIgnorePlayer.Active) { shooting = true; currentSeries = new List(); seriesParried = false; didFlash = false; shootCooldown = 0f; ((MonoBehaviour)this).StartCoroutine(ShootTimes(shootCount)); } if (currentSeries.Count > 1 && !seriesParried) { CheckParriedProjectile(); } } public float GetTotalSpeedModifier() { float num = 1f; float num2 = Mathf.Max(OptionsManager.radianceTier, eid.radianceTier); if (eid.speedBuff || OptionsManager.forceRadiance) { num *= eid.speedBuffModifier * ((num2 > 1f) ? (0.75f + num2 / 4f) : num2); } if (eid.puppet) { num *= 0.75f; } return num; } public void CheckParriedProjectile() { bool flag = false; Projectile val = null; foreach (Projectile item in currentSeries) { if (!Object.op_Implicit((Object)(object)item) || !item.parried) { continue; } val = item; seriesParried = true; flag = true; break; } if (!flag) { return; } foreach (Projectile item2 in currentSeries) { if (!((Object)(object)item2 == (Object)(object)val) && Object.op_Implicit((Object)(object)item2) && !((Object)(object)((Component)item2).transform == (Object)null)) { MakeProjectileUnparriable(item2); } } } public void FlashSmall() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Transform transform = Object.Instantiate(MonoSingleton.Instance.parryableFlash, ((Component)sphere).transform.position, Quaternion.identity).transform; transform.localScale *= 20f; transform.LookAt(((Component)MonoSingleton.Instance).transform); ((Component)transform).GetComponent().volume = 0.45f; didFlash = true; } public IEnumerator ShootTimes(int times) { if (times <= 0) { shooting = false; shootCooldown = 0f; } else { ShootProjectile(); yield return (object)new WaitForSeconds(0.1f / difficultySpeedModifier); ((MonoBehaviour)this).StartCoroutine(ShootTimes(times - 1)); } } public void ShootProjectile() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Vector3 predictedPosition = GetPredictedPosition(); currentProjectile = Object.Instantiate(projectile, shootPoint.position, shootPoint.rotation).GetComponent(); ((Component)currentProjectile).transform.LookAt(predictedPosition); Projectile obj = currentProjectile; obj.damage *= eid.totalDamageModifier; currentProjectile.safeEnemyType = (EnemyType)35; currentProjectile.speed = projectileSpeed; currentProjectile.enemyDamageMultiplier = 0.2f; currentSeries.Add(currentProjectile); if (seriesParried) { MakeProjectileUnparriable(currentProjectile); } } public Vector3 GetPredictedPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)MonoSingleton.Instance).transform.position; Vector3 playerVelocity = MonoSingleton.Instance.GetPlayerVelocity(false); Vector3 position2 = shootPoint.position; Vector3 val = position - position2; float num = Vector3.Dot(playerVelocity, playerVelocity) - projectileSpeed * projectileSpeed; float num2 = 2f * Vector3.Dot(playerVelocity, val); float num3 = Vector3.Dot(val, val); float num4 = num2 * num2 - 4f * num * num3; float num5 = 0f; if (num4 > 0f) { float num6 = Mathf.Sqrt(num4); float num7 = (0f - num2 + num6) / (2f * num); float num8 = (0f - num2 - num6) / (2f * num); num5 = Mathf.Max(num7, num8); if (num5 < 0f) { num5 = Mathf.Min(num7, num8); } if (num5 < 0f) { num5 = 0f; } } return position + playerVelocity * num5; } public void MakeProjectileUnparriable(Projectile proj) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)proj) && !((Object)(object)((Component)proj).transform == (Object)null)) { proj.unparryable = true; proj.enemyDamageMultiplier = 0f; Light component = ((Component)proj).GetComponent(); if (component != null) { component.color = new Color(0.5f, 0f, 0.85f, 1f); } TrailRenderer component2 = ((Component)proj).GetComponent(); if (component2 != null) { component2.endColor = new Color(0.65f, 0f, 0.95f, 1f); } if (component2 != null) { component2.startColor = new Color(0.4f, 0f, 0.7f, 1f); } if (component2 != null) { component2.endWidth = 0.75f; } MeshRenderer component3 = ((Component)((Component)proj).transform.Find("AlwaysLookAtCamera/ChargeEffect")).GetComponent(); if (component3 != null) { ((Renderer)component3).material.color = new Color(0.7f, 0f, 0.95f, 1f); } MeshRenderer component4 = ((Component)proj).GetComponent(); Material val = Object.Instantiate(((Renderer)component4).material); val.mainTexture = (Texture)(object)EnemyAssets.Textures["ProjectilePurple"]; ((Renderer)component4).material = val; MaterialPropertyBlock val2 = new MaterialPropertyBlock(); ((Renderer)component4).GetPropertyBlock(val2); val2.SetTexture("_MainTex", (Texture)(object)EnemyAssets.Textures["ProjectilePurple"]); ((Renderer)component4).SetPropertyBlock(val2); ComponentExtensions.GetOrAddComponent((Component)(object)proj).color = new Color(0.75f, 0.2f, 1f, 1f); } } } [HarmonyPatch(typeof(MortarLauncher))] public class BlackHoleMortarLauncherPatch { [HarmonyPostfix] [HarmonyPatch(typeof(MortarLauncher), "Start")] public static void StartPostfix(MortarLauncher __instance) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("BlackHoleLauncherSpawned", ((Component)__instance).transform); if (!((Object)(object)val == (Object)null)) { if (__instance.eid.overrideFullName == "EARTHMOVER MORTAR") { __instance.eid.overrideFullName = "BLACK HOLE LAUNCHER"; } Util.SetEnemyHealth(__instance.eid, 27f); Util.UpdateEnemyHealthbar(__instance.eid); ComponentExtensions.GetOrAddComponent((Component)(object)__instance).puppetName = ((Object)__instance).name; SkinnedMeshRenderer componentInChildren = ((Component)__instance).GetComponentInChildren(); ((Renderer)componentInChildren).material.color = new Color(0.65f, 0f, 0.8f, 1f); ComponentExtensions.GetOrAddComponent((Component)(object)__instance).type = RealEnemyType.BlackHoleLauncher; } } [HarmonyPrefix] [HarmonyPatch(typeof(MortarLauncher), "ShootHoming")] public static bool ShootHomingPrefix(MortarLauncher __instance) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) Transform val = Util.FindParentWithNameContaining("BlackHoleLauncherSpawned", ((Component)__instance).transform); if ((Object)(object)val == (Object)null) { return true; } BlackHoleFromMortar[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (BlackHoleFromMortar blackHoleFromMortar in array) { if ((Object)(object)blackHoleFromMortar.source == (Object)(object)__instance.eid) { return false; } } BlackHoleProjectile component = Object.Instantiate(EnemyAssets.Prefabs["BlackHole"], __instance.shootPoint.position, __instance.shootPoint.rotation).GetComponent(); Transform transform = ((Component)component).transform; transform.localScale *= 3f; component.safeType = (EnemyType)35; component.Activate(); component.speed = 8f * __instance.eid.totalDamageModifier; int difficulty = __instance.eid.difficulty; if (1 == 0) { } float num = difficulty switch { 4 => 1f, 3 => 0.8f, 2 => 0.7f, 1 => 0.6f, 0 => 0.5f, _ => 1.1f, }; if (1 == 0) { } float num2 = num; component.speed *= num2; SpriteRenderer componentInChildren = ((Component)component).GetComponentInChildren(true); ((Renderer)componentInChildren).material.renderQueue = 3001; ((Component)component).gameObject.AddComponent().source = __instance.eid; if (Object.op_Implicit((Object)(object)__instance.anim)) { __instance.anim.Play("Shoot", 0, 0f); } return false; } } [HarmonyPatch(typeof(MaliciousFace))] public class DisgraceMaliciousFacePatch { public static IEnumerator DisgraceDeath(Transform tr) { yield return (object)new WaitForSeconds(1f); Vector3 pos = tr.position; Quaternion rot = tr.rotation; Object.Instantiate(EnemyAssets.Prefabs["Explosion"], pos, rot); yield return (object)new WaitForSeconds(0.1f); Transform gib = Object.Instantiate(EnemyAssets.Prefabs["BrainGib"], pos + new Vector3(0f, -3f, 0f), rot).transform; gib.localScale = new Vector3(1.5f, 1.5f, 4.5f); Object.Destroy((Object)(object)((Component)tr.parent.parent).gameObject); } [HarmonyPostfix] [HarmonyPatch(typeof(MaliciousFace), "Start")] public static void StartPostfix(MaliciousFace __instance) { Transform val = Util.FindParentWithNameContaining("DisgraceSpawned", ((Component)__instance).transform); if (!((Object)(object)val == (Object)null)) { if (__instance.eid.overrideFullName == "MALICIOUS FACE") { __instance.eid.overrideFullName = "DISGRACE"; } Util.SetEnemyHealth(__instance.eid, 20f); Util.UpdateEnemyHealthbar(__instance.eid); ((Component)__instance).gameObject.AddComponent(); ((Component)__instance).gameObject.AddComponent().type = RealEnemyType.Disgrace; } } [HarmonyPrefix] [HarmonyPatch(typeof(MaliciousFace), "Die")] public static bool DiePrefix(MaliciousFace __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { return true; } ((MonoBehaviour)__instance).StartCoroutine(DisgraceDeath(((Component)__instance).transform)); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(MaliciousFace), "Update")] public static bool UpdatePrefix(MaliciousFace __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { return true; } return false; } } [HarmonyPatch(typeof(DroneFlesh))] public class FuchsiaDroneFleshPatch { [HarmonyPostfix] [HarmonyPatch(typeof(DroneFlesh), "Start")] public static void StartPostfix(DroneFlesh __instance) { Transform val = Util.FindParentWithNameContaining("FuchsiaSpawned", ((Component)__instance).transform); if (!((Object)(object)val == (Object)null)) { if (__instance.eid.overrideFullName == "FLESH SPAWN") { __instance.eid.overrideFullName = "FUCHSIA"; } Util.SetEnemyHealth(__instance.eid, 16f); Util.UpdateEnemyHealthbar(__instance.eid); bool flag = (Object)(object)Util.FindParentWithNameContaining("PushUp", ((Component)__instance).transform) != (Object)null; bool flag2 = (Object)(object)Util.FindParentWithNameContaining("PushDown", ((Component)__instance).transform) != (Object)null; RealEnemyType type = RealEnemyType.FuchsiaPushUpPushDown; if (flag && !flag2) { type = RealEnemyType.FuchsiaPushUp; } else if (!flag && flag2) { type = RealEnemyType.FuchsiaPushDown; } else if (!flag && !flag2) { type = RealEnemyType.Fuchsia; } FuchsiaSpawned fuchsiaSpawned = ((Component)__instance).gameObject.AddComponent(); fuchsiaSpawned.CanPushUp = flag; fuchsiaSpawned.CanPushDown = flag2; ComponentExtensions.GetOrAddComponent((Component)(object)__instance).type = type; ComponentExtensions.GetOrAddComponent((Component)(object)__instance).puppetName = ((Object)__instance).name; } } } [HarmonyPatch(typeof(Idol))] public class IdollikePatch { public static EnemyType[] EnrageableTypes; public static RealEnemyType[] DontEnrageRealTypes; public static RealEnemyType GetIdolType(string spawnedName) { RealEnemyType result = RealEnemyType.Default; if (spawnedName.Contains("Enrager")) { result = RealEnemyType.Enrager; } else if (spawnedName.Contains("Lumen")) { result = RealEnemyType.Lumen; } else if (spawnedName.Contains("Puppeteer")) { result = RealEnemyType.Puppeteer; } else if (spawnedName.Contains("Sander")) { result = RealEnemyType.Sander; } return result; } [HarmonyPostfix] [HarmonyPatch(typeof(Idol), "Awake")] public static void AwakePostfix(Idol __instance) { ComponentExtensions.GetOrAddComponent((Component)(object)__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(Idol), "Update")] public static bool UpdatePrefix(Idol __instance) { //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) RealEnemyTypeSaver component = ((Component)__instance).GetComponent(); RealEnemyType value; if ((Object)(object)component != (Object)null) { value = component.type; } else { Transform val = Util.FindParentWithNameContaining("Spawned", ((Component)__instance).transform); if ((Object)(object)val == (Object)null) { return true; } value = GetIdolType(((Object)val).name); } if (!RealEnemyTypeSaver.IdollikeTypes.Contains(value)) { return true; } if (Object.op_Implicit((Object)(object)__instance.overrideTarget) && (Object)(object)__instance.target != (Object)(object)__instance.overrideTarget && !__instance.overrideTarget.dead && ((Component)__instance.overrideTarget).gameObject.activeInHierarchy) { __instance.ChangeTarget(__instance.overrideTarget); } if ((Object)(object)__instance.target != (Object)null && !__instance.target.dead) { LineRendererPortalHelper component2 = ((Component)__instance.beam).GetComponent(); if (component2 != null) { ((Behaviour)component2).enabled = true; } if (((Renderer)__instance.beam).enabled != Object.op_Implicit((Object)(object)__instance.target)) { ((Renderer)__instance.beam).enabled = Object.op_Implicit((Object)(object)__instance.target); } } else { LineRendererPortalHelper component3 = ((Component)__instance.beam).GetComponent(); if (component3 != null) { ((Behaviour)component3).enabled = false; } ((Renderer)__instance.beam).enabled = false; } if (Object.op_Implicit((Object)(object)__instance.target)) { Vector3 position = ((Component)__instance.beam).transform.position; Vector3 val2 = ((Component)__instance.target).transform.position + __instance.beamOffset; __instance.beam.SetPosition(0, position); __instance.beam.SetPosition(1, val2); PortalTraversalV2[] array = null; TargetDataRef val3 = default(TargetDataRef); if (__instance.vision.TrySee(__instance.beamQuery, ref val3)) { Matrix4x4 portalMatrix = ((TargetDataRef)(ref val3)).portalMatrix; Vector3 val4 = ((TargetDataRef)(ref val3)).position + ((Matrix4x4)(ref portalMatrix)).MultiplyVector(__instance.beamOffset) - position; float magnitude = ((Vector3)(ref val4)).magnitude; val4 /= magnitude; LayerMask val5 = LayerMaskDefaults.Get((LMD)1); PhysicsCastResult val6 = default(PhysicsCastResult); Vector3 val7 = default(Vector3); PortalPhysicsV2.Raycast(position, val4, magnitude, LayerMask.op_Implicit(val5), ref val6, ref array, ref val7, (QueryTriggerInteraction)0); } PortalUtils.GenerateLineRendererSegments((MonoBehaviour)(object)__instance, __instance.beam, array); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(Idol), "ChangeTarget")] public static bool ChangeTargetPrefix(EnemyIdentifier newTarget, Idol __instance) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) RealEnemyTypeSaver component = ((Component)__instance).GetComponent(); RealEnemyType realEnemyType; if ((Object)(object)component != (Object)null) { realEnemyType = component.type; } else { Transform val = Util.FindParentWithNameContaining("Spawned", ((Component)__instance).transform); if ((Object)(object)val == (Object)null) { return true; } realEnemyType = GetIdolType(((Object)val).name); } if (!RealEnemyTypeSaver.IdollikeTypes.Contains(realEnemyType)) { return true; } if (Object.op_Implicit((Object)(object)__instance.target)) { TargetUnaction(__instance, realEnemyType); } if (!Object.op_Implicit((Object)(object)newTarget)) { __instance.target = null; return false; } __instance.target = newTarget; TargetAction(__instance, realEnemyType); Collider val2 = default(Collider); if (((Component)__instance.target).TryGetComponent(ref val2)) { Bounds bounds = val2.bounds; __instance.beamOffset = ((Bounds)(ref bounds)).center - ((Component)__instance.target).transform.position; } return false; } public static void TargetAction(Idol __instance, RealEnemyType idolType) { switch (idolType) { case RealEnemyType.Enrager: Enrage(__instance.target); break; case RealEnemyType.Lumen: { EnemyIdentifier target2 = __instance.target; if (target2 != null) { target2.BuffAll(); } break; } case RealEnemyType.Puppeteer: break; case RealEnemyType.Sander: { EnemyIdentifier target = __instance.target; if (target != null) { target.Sandify(false); } break; } } } public static void TargetUnaction(Idol __instance, RealEnemyType idolType) { switch (idolType) { case RealEnemyType.Enrager: Enrage(__instance.target, unEnrage: true); break; case RealEnemyType.Lumen: { EnemyIdentifier target2 = __instance.target; if (target2 != null) { target2.UnbuffAll(); } break; } case RealEnemyType.Puppeteer: break; case RealEnemyType.Sander: { EnemyIdentifier target = __instance.target; if (target != null) { target.Desandify(false); } break; } } } public static void Enrage(EnemyIdentifier target, bool unEnrage = false) { GabrielBase val = default(GabrielBase); EnemyScript val2; if (((Component)target).TryGetComponent(ref val)) { val2 = (EnemyScript)(object)val; } else { val2 = ((Component)target).GetComponent()?.script; if ((Object)(object)val2 == (Object)null) { return; } } Type type = ((object)val2).GetType(); if (unEnrage) { Object.Destroy((Object)(object)((Component)val2).GetComponent()); } else { ComponentExtensions.GetOrAddComponent((Component)(object)val2); } string name = (unEnrage ? "UnEnrage" : "Enrage"); MethodInfo method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[0], null); FieldInfo field = type.GetField("crazyModeHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field2 = type.GetField("spearCooldown", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!unEnrage) { field?.SetValue(val2, target.health + 1f); field2?.SetValue(val2, 1f); } if (field == null) { method?.Invoke(val2, null); } if (method == null) { type.GetMethod("EnrageNow", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(val2, null); } type.GetField("rageLeft", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val2, unEnrage ? 0f : 9999f); } public static bool IsTargetUnfit(EnemyIdentifier target, RealEnemyType idolType) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 switch (idolType) { case RealEnemyType.Enrager: { RealEnemyTypeSaver realEnemyTypeSaver = default(RealEnemyTypeSaver); if (((Component)target).TryGetComponent(ref realEnemyTypeSaver)) { return DontEnrageRealTypes.Contains(realEnemyTypeSaver.type); } return (IsEnraged(target) && (int)target.enemyType != 33) || !EnrageableTypes.Contains(target.enemyType); } case RealEnemyType.Lumen: return target.damageBuff || target.healthBuff || target.speedBuff; case RealEnemyType.Puppeteer: return target.puppet; case RealEnemyType.Sander: return target.sandified || target.puppet; default: return false; } } public static bool IsEnraged(EnemyIdentifier target) { EnemyScript val = ((Component)target).GetComponent()?.script; if ((Object)(object)val == (Object)null) { return true; } Type type = ((object)val).GetType(); bool? flag = (bool?)type.GetProperty("isEnraged", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val); if (!flag.HasValue) { flag = (bool?)type.GetField("enraged", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val); } if (!flag.HasValue) { flag = (bool?)type.GetField("crazyMode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val); } if (!flag.HasValue) { flag = false; } return flag.Value; } [HarmonyPrefix] [HarmonyPatch(typeof(Idol), "PickNewTarget")] [HarmonyPriority(200)] public static bool PickNewTargetPrefix(ref bool ignoreIfAlreadyTargeting, Idol __instance, bool __runOriginal) { //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Invalid comparison between Unknown and I4 //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) if (!__runOriginal) { return false; } RealEnemyTypeSaver component = ((Component)__instance).GetComponent(); RealEnemyType realEnemyType; if ((Object)(object)component != (Object)null) { realEnemyType = component.type; } else { Transform val = Util.FindParentWithNameContaining("Spawned", ((Component)__instance).transform); if ((Object)(object)val == (Object)null) { return true; } realEnemyType = GetIdolType(((Object)val).name); } if (!RealEnemyTypeSaver.IdollikeTypes.Contains(realEnemyType)) { return true; } ignoreIfAlreadyTargeting = true; bool flag = (Object)(object)__instance.target == (Object)null || __instance.target.dead; bool flag2 = (Object)(object)__instance.overrideTarget == (Object)null || ((object)__instance.overrideTarget).Equals((object?)null); if (!flag || !flag2) { return false; } List currentEnemies = MonoSingleton.Instance.GetCurrentEnemies(); if (currentEnemies == null || currentEnemies.Count <= 0) { return false; } bool flag3 = false; float num = float.PositiveInfinity; __instance.tempTarget = null; int num2 = ((!Object.op_Implicit((Object)(object)__instance.target) || __instance.target.dead) ? 1 : Mathf.Max(MonoSingleton.Instance.GetEnemyRank(__instance.target), 2)); TargetDataRef val2 = default(TargetDataRef); for (int num3 = 7; num3 > num2; num3--) { for (int i = 0; i < currentEnemies.Count; i++) { bool flag4 = IsTargetUnfit(currentEnemies[i], realEnemyType); if (currentEnemies[i].health <= 0f || ((Object)(object)currentEnemies[i] != (Object)(object)__instance.target && (flag4 || (int)currentEnemies[i].enemyType == 21))) { continue; } int enemyRank = MonoSingleton.Instance.GetEnemyRank(currentEnemies[i]); if (enemyRank == num3 || (enemyRank <= 2 && num3 == 2)) { float num4 = (__instance.vision.TrySee(__instance.nearestQuery, ref val2) ? TargetDataExtensions.DistanceTo(val2, ((Component)__instance).transform.position) : Vector3.Distance(MonoSingleton.Instance.GetPlayer().position, ((Component)currentEnemies[i]).transform.position)); if (num4 < num) { __instance.tempTarget = currentEnemies[i]; flag3 = true; num = num4; } } } if (flag3) { __instance.ChangeTarget(__instance.tempTarget); break; } } return false; } static IdollikePatch() { EnemyType[] array = new EnemyType[13]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); EnrageableTypes = (EnemyType[])(object)array; DontEnrageRealTypes = new RealEnemyType[10] { RealEnemyType.BlackHoleLauncher, RealEnemyType.Disgrace, RealEnemyType.Watchtower, RealEnemyType.FuchsiaPushUpPushDown, RealEnemyType.FuchsiaPushUp, RealEnemyType.FuchsiaPushDown, RealEnemyType.Fuchsia, RealEnemyType.ShockwaveShuffler, RealEnemyType.Phaser, RealEnemyType.Quaternion }; } } [HarmonyPatch(typeof(V2), "UnEnrage")] public class V2PermanentRagePatch { public static bool Prefix(V2 __instance) { PermanentRage component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } return false; } } [HarmonyPatch(typeof(PhysicalShockwave))] public class PhysicalShockwavePatch { [HarmonyPrefix] [HarmonyPatch(typeof(PhysicalShockwave), "CheckCollision")] public static bool CheckCollisionPrefix(Collider col, PhysicalShockwave __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { return true; } if (__instance.hasHurtPlayer || !((Component)col).gameObject.CompareTag("Player")) { return false; } __instance.hasHurtPlayer = true; if ((int)MonoSingleton.Instance.playerType == 0) { NewMovement instance = MonoSingleton.Instance; if ((Object)(object)instance != (Object)null) { instance.GetHurt(__instance.damage, true, 1f, false, false, 0.35f, true); instance.LaunchFromPoint(((Component)instance).transform.position + Vector3.down, 30f, 30f); } } else if (__instance.damage == 0) { MonoSingleton.Instance.Jump(false, 1f); } else { MonoSingleton.Instance.Explode(false); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(PhysicalShockwave), "SimpleCollisionCheck")] public static bool SimpleCollisionCheckPrefix(Collider col, PhysicalShockwave __instance, ref bool __result) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { return true; } bool flag = !__instance.hasHurtPlayer && ((Component)col).gameObject.CompareTag("Player"); bool flag2 = ((Component)col).gameObject.layer == 10; Landmine val = default(Landmine); bool flag3 = !__instance.enemy && Object.op_Implicit((Object)(object)col.attachedRigidbody) && ((Component)col.attachedRigidbody).TryGetComponent(ref val); __result = flag || flag2 || flag3; return false; } } [HarmonyPatch(typeof(Idol))] public class PuppeteerIdolPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Idol), "Death")] public static void DeathPrefix(Idol __instance) { PuppeteerSpawned component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && !__instance.dead && component.KillPuppetsOnDeath) { component.KillPuppets(); } } } [HarmonyPatch(typeof(DroneFlesh))] public class ShockwaveShufflerDroneFleshPatch { [HarmonyPostfix] [HarmonyPatch(typeof(DroneFlesh), "Start")] public static void StartPostfix(DroneFlesh __instance) { Transform val = Util.FindParentWithNameContaining("ShockwaveShufflerSpawned", ((Component)__instance).transform); if (!((Object)(object)val == (Object)null)) { if (__instance.eid.overrideFullName == "FLESH SPAWN") { __instance.eid.overrideFullName = "SHOCKWAVE SHUFFLER"; } Util.SetEnemyHealth(__instance.eid, 15f); Util.UpdateEnemyHealthbar(__instance.eid); ((Component)__instance).gameObject.AddComponent(); ComponentExtensions.GetOrAddComponent((Component)(object)__instance).type = RealEnemyType.ShockwaveShuffler; ComponentExtensions.GetOrAddComponent((Component)(object)__instance).puppetName = ((Object)__instance).name; } } } [HarmonyPatch(typeof(MortarLauncher))] public class WatchtowerMortarLauncherPatch { public static IEnumerator ShowSphere(Transform tr) { yield return (object)new WaitForSeconds(0.85f); Transform objSphere = tr.Find("Armature/Pole_Top/Sphere (1)"); ((Component)objSphere).gameObject.SetActive(true); objSphere.localScale = new Vector3(0.15f, 0.2f, 0.2f); objSphere.localPosition = new Vector3(-0.45f, 0f, 0f); Transform subSphere = objSphere.Find("Sphere (1)"); ((Component)subSphere).gameObject.SetActive(true); } [HarmonyPostfix] [HarmonyPatch(typeof(MortarLauncher), "Start")] public static void StartPostfix(MortarLauncher __instance) { Transform val = Util.FindParentWithNameContaining("WatchtowerSpawned", ((Component)__instance).transform); if (!((Object)(object)val == (Object)null)) { if (__instance.eid.overrideFullName == "EARTHMOVER TOWER") { __instance.eid.overrideFullName = "WATCHTOWER"; } Util.SetEnemyHealth(__instance.eid, 30f); Util.UpdateEnemyHealthbar(__instance.eid); ((Component)__instance).gameObject.AddComponent(); ComponentExtensions.GetOrAddComponent((Component)(object)__instance).type = RealEnemyType.Watchtower; ComponentExtensions.GetOrAddComponent((Component)(object)__instance).puppetName = ((Object)__instance).name; ((MonoBehaviour)__instance).StartCoroutine(ShowSphere(((Component)__instance).transform)); } } [HarmonyPrefix] [HarmonyPatch(typeof(MortarLauncher), "Update")] public static bool UpdatePrefix(MortarLauncher __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { return true; } return false; } } public static class EnemyAssets { public static Dictionary Prefabs = new Dictionary { ["Wicked"] = null, ["Agony"] = null, ["Tundra"] = null, ["Minos"] = null, ["MinosArm"] = null, ["Minotaur"] = null, ["DroneGhost"] = null, ["DroneFlesh"] = null, ["DroneFleshCamera"] = null, ["DroneSkull"] = null, ["CentaurMortar"] = null, ["BlackHole"] = null, ["MaliciousFace"] = null, ["Explosion"] = null, ["BrainGib"] = null, ["CentaurTower"] = null, ["CentaurTowerPreview"] = null, ["Projectile"] = null, ["Landmine"] = null, ["ProvidenceBeam"] = null, ["Virtue"] = null, ["ShockwaveShuffler"] = null, ["ShockwaveMagenta"] = null, ["Idol"] = null, ["IdolPreview"] = null }; public static Dictionary Icons = new Dictionary { ["Wicked"] = null, ["AgonyTundra"] = null, ["Agony"] = null, ["Tundra"] = null, ["Minos"] = null, ["MinosArm"] = null, ["Minotaur"] = null, ["DroneGhost"] = null, ["DroneFlesh"] = null, ["DroneFleshCamera"] = null, ["DroneSkull"] = null, ["BlackHoleLauncher"] = null, ["Disgrace"] = null, ["Watchtower"] = null, ["Fuchsia PushUp PushDown"] = null, ["Fuchsia PushUp"] = null, ["Fuchsia PushDown"] = null, ["Fuchsia"] = null, ["ShockwaveShuffler"] = null, ["Enrager"] = null, ["Lumen"] = null, ["Puppeteer"] = null, ["Sander"] = null }; public static Dictionary Textures = new Dictionary { ["ProjectilePurple"] = null, ["Fuchsia"] = null, ["FuchsiaCrown"] = null, ["FuchsiaWings"] = null, ["smooth-wall"] = null, ["smooth-wall-hierohor"] = null, ["smooth-wall-hierovert"] = null, ["tube-hierohor"] = null, ["tube-hierovert"] = null, ["tube-smooth"] = null, ["tube-smoothlines"] = null }; public static Dictionary SpawnableObjects = new Dictionary { [RealEnemyType.Wicked] = null, [RealEnemyType.AgonyTundra] = null, [RealEnemyType.Agony] = null, [RealEnemyType.Tundra] = null, [RealEnemyType.Minos] = null, [RealEnemyType.MinosArm] = null, [RealEnemyType.Minotaur] = null, [RealEnemyType.DroneGhost] = null, [RealEnemyType.Eye] = null, [RealEnemyType.EyeYellow] = null, [RealEnemyType.EyeMalicious] = null, [RealEnemyType.BlackHoleLauncher] = null, [RealEnemyType.Disgrace] = null, [RealEnemyType.Watchtower] = null, [RealEnemyType.FuchsiaPushUpPushDown] = null, [RealEnemyType.FuchsiaPushUp] = null, [RealEnemyType.FuchsiaPushDown] = null, [RealEnemyType.Fuchsia] = null, [RealEnemyType.ShockwaveShuffler] = null, [RealEnemyType.Enrager] = null, [RealEnemyType.Lumen] = null, [RealEnemyType.Puppeteer] = null, [RealEnemyType.Sander] = null }; public static T Ass(string path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync((object)path).WaitForCompletion(); } public static void LoadAssets() { Plugin.Logger.LogInfo((object)"Getting Something Wicked assets... (1/10)"); Icons["Wicked"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.WickedIcon.png", "WickedIcon"); Prefabs["Wicked"] = Ass("Assets/Prefabs/Enemies/Wicked.prefab"); AddRealEnemyType(Prefabs["Wicked"], RealEnemyType.Wicked); Plugin.Logger.LogInfo((object)"Getting Swordsmachine Agony and Tundra assets... (2/10)"); Icons["AgonyTundra"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.AgonyTundraIcon.png", "AgonyTundraIcon"); Icons["Agony"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.AgonyIcon.png", "AgonyIcon"); Prefabs["Agony"] = Ass("Assets/Prefabs/Enemies/SwordsMachine Agony.prefab"); AddRealEnemyType(Prefabs["Agony"], RealEnemyType.Agony); Icons["Tundra"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.TundraIcon.png", "TundraIcon"); Prefabs["Tundra"] = Ass("Assets/Prefabs/Enemies/SwordsMachine Tundra.prefab"); AddRealEnemyType(Prefabs["Tundra"], RealEnemyType.Tundra); Plugin.Logger.LogInfo((object)"Getting Minos assets... (3/10)"); Icons["Minos"] = Ass("Assets/Textures/UI/Spawn Menu/Minos.png"); Prefabs["Minos"] = Ass("Assets/Prefabs/Enemies/MinosBoss.prefab"); AddRealEnemyType(Prefabs["Minos"], RealEnemyType.Minos); Icons["MinosArm"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.MinosArmIcon.png", "MinosArmIcon"); Prefabs["MinosArm"] = Ass("Assets/Prefabs/Enemies/MinosArm.prefab"); AddRealEnemyType(Prefabs["MinosArm"], RealEnemyType.MinosArm); Icons["Minotaur"] = Ass("Assets/Textures/UI/Spawn Menu/Minotaur.png"); Prefabs["Minotaur"] = Ass("Assets/Prefabs/Enemies/MinotaurChase.prefab"); AddRealEnemyType(Prefabs["Minotaur"], RealEnemyType.Minotaur); Plugin.Logger.LogInfo((object)"Getting Drone assets... (4/10)"); Icons["DroneGhost"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.DroneGhostIcon.png", "DroneGhostIcon"); Prefabs["DroneGhost"] = Ass("Assets/Prefabs/Enemies/DroneGhostFromCorpse.prefab"); AddRealEnemyType(Prefabs["DroneGhost"], RealEnemyType.DroneGhost); Icons["DroneFlesh"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.DroneFleshIcon.png", "DroneFleshIcon"); Prefabs["DroneFlesh"] = Ass("Assets/Prefabs/Enemies/DroneFlesh.prefab"); AddRealEnemyType(Prefabs["DroneFlesh"], RealEnemyType.Eye); Icons["DroneFleshCamera"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.DroneFleshCameraIcon.png", "DroneFleshCameraIcon"); Prefabs["DroneFleshCamera"] = Ass("Assets/Prefabs/Enemies/DroneFleshCamera Variant.prefab"); AddRealEnemyType(Prefabs["DroneFleshCamera"], RealEnemyType.EyeYellow); Icons["DroneSkull"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.DroneSkullIcon.png", "DroneSkullIcon"); Prefabs["DroneSkull"] = Ass("Assets/Prefabs/Enemies/DroneSkull Variant.prefab"); AddRealEnemyType(Prefabs["DroneSkull"], RealEnemyType.EyeMalicious); Plugin.Logger.LogInfo((object)"Getting Black Hole Launcher assets... (5/10)"); Icons["BlackHoleLauncher"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.BlackHoleLauncherIcon.png", "BlackHoleLauncherIcon"); Prefabs["CentaurMortar"] = Ass("Assets/Prefabs/Enemies/CentaurMortar.prefab"); Prefabs["CentaurMortarPreview"] = Ass("Assets/Prefabs/Spawner Previews/CentaurMortar Preview.prefab"); Prefabs["BlackHole"] = Ass("Assets/Prefabs/Attacks and Projectiles/Black Hole Enemy.prefab"); Plugin.Logger.LogInfo((object)"Getting Disgrace assets... (6/10)"); Icons["Disgrace"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.DisgraceIcon.png", "DisgraceIcon"); Prefabs["MaliciousFace"] = Ass("Assets/Prefabs/Enemies/Malicious Face.prefab"); Prefabs["Explosion"] = Ass("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab"); Prefabs["BrainGib"] = Ass("Assets/Prefabs/Gibs/Gib_BrainChunk.prefab"); Plugin.Logger.LogInfo((object)"Getting Watchtower assets... (7/10)"); Icons["Watchtower"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.WatchtowerIcon.png", "WatchtowerIcon"); Prefabs["CentaurTower"] = Ass("Assets/Prefabs/Enemies/CentaurTower.prefab"); Prefabs["CentaurTowerPreview"] = Ass("Assets/Prefabs/Spawner Previews/CentaurTower Preview.prefab"); Prefabs["Projectile"] = Ass("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab"); Prefabs["Landmine"] = Ass("Assets/Prefabs/Attacks and Projectiles/Landmine.prefab"); Textures["ProjectilePurple"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.ProjectilePurple.png", "ProjectilePurple"); Plugin.Logger.LogInfo((object)"Getting Fuchsia assets... (8/10)"); Icons["Fuchsia PushUp PushDown"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.FuchsiaIcon PushUp PushDown.png", "FuchsiaIcon PushUp PushDown"); Icons["Fuchsia PushUp"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.FuchsiaIcon PushUp.png", "FuchsiaIcon PushUp"); Icons["Fuchsia PushDown"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.FuchsiaIcon PushDown.png", "FuchsiaIcon PushDown"); Icons["Fuchsia"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.FuchsiaIcon.png", "FuchsiaIcon"); Prefabs["ProvidenceBeam"] = Ass("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Providence Beam.prefab"); Prefabs["Virtue"] = Ass("Assets/Prefabs/Enemies/Virtue.prefab"); Textures["Fuchsia"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.FuchsiaTexture.png", "FuchsiaTexture"); Textures["FuchsiaCrown"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.FuchsiaCrown.png", "FuchsiaCrown"); Textures["FuchsiaWings"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.FuchsiaWings.png", "FuchsiaWings"); Plugin.Logger.LogInfo((object)"Getting Shockwave Shuffler assets... (9/10)"); Icons["ShockwaveShuffler"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.ShockwaveShufflerIcon.png", "ShockwaveShufflerIcon"); Prefabs["ShockwaveShuffler"] = Ass("Assets/Prefabs/Levels/Decorations/EgyptPillar.prefab"); Prefabs["ShockwaveMagenta"] = Ass("Assets/Prefabs/Attacks and Projectiles/PhysicalShockwaveMagenta.prefab"); Textures["smooth-wall"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.smooth-wall.png", "smooth-wall"); Textures["smooth-wall-hierohor"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.smooth-wall-hierohor.png", "smooth-wall-hierohor"); Textures["smooth-wall-hierovert"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.smooth-wall-hierovert.png", "smooth-wall-hierovert"); Textures["tube-hierohor"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.tube-hierohor.png", "tube-hierohor"); Textures["tube-hierovert"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.tube-hierovert.png", "tube-hierovert"); Textures["tube-smooth"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.tube-smooth.png", "tube-smooth"); Textures["tube-smoothlines"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Textures.tube-smoothlines.png", "tube-smoothlines"); Plugin.Logger.LogInfo((object)"Getting Enrager, Lumen, Puppeteer and Sander assets... (10/10)"); Prefabs["Idol"] = Ass("Assets/Prefabs/Enemies/Idol.prefab"); Prefabs["IdolPreview"] = Ass("Assets/Prefabs/Spawner Previews/Idol Preview Variant.prefab"); Icons["Enrager"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.EnragerIcon.png", "EnragerIcon"); Icons["Lumen"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.LumenIcon.png", "LumenIcon"); Icons["Puppeteer"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.PuppeteerIcon.png", "PuppeteerIcon"); Icons["Sander"] = Util.LoadEmbeddedTexture("SpawnerArmExtras.Assets.Icons.SanderIcon.png", "SanderIcon"); } public static void AddRealEnemyType(GameObject obj, RealEnemyType realEnemyType) { obj.AddComponent().type = realEnemyType; } } public class HidePreviewIfNotInHand : MonoBehaviour { private Transform parent; private GameObject thingToHide; public void Start() { parent = ((Component)this).transform.parent; thingToHide = ((Component)((Component)this).transform.GetChild(0)).gameObject; } public void Update() { if (Object.op_Implicit((Object)(object)parent) && ((Object)parent).name == "Holder") { thingToHide.SetActive(true); } else { thingToHide.SetActive(false); } } } public class ProjectileExplosionColor : MonoBehaviour { public Color color = new Color(1f, 0.269f, 0f, 1f); } public class PuppetName : MonoBehaviour { public string puppetName = ""; public void Start() { SaveForPuppet(); } public void SaveForPuppet() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown EnemyIdentifier componentInChildren = ((Component)this).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return; } GameObject[] activateOnDeath = componentInChildren.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "PuppetName") { return; } } GameObject val2 = new GameObject("PuppetName"); PuppetName puppetName = val2.AddComponent(); puppetName.puppetName = this.puppetName; Util.ArrayAdd(ref componentInChildren.activateOnDeath, val2); } } public enum RealEnemyType { Default, Wicked, AgonyTundra, Agony, Tundra, Minos, MinosArm, Minotaur, DroneGhost, Eye, EyeYellow, EyeMalicious, BlackHoleLauncher, Disgrace, Watchtower, FuchsiaPushUpPushDown, FuchsiaPushUp, FuchsiaPushDown, Fuchsia, ShockwaveShuffler, Enrager, Lumen, Puppeteer, Sander, Blight, Phaser, Quaternion } public class RealEnemyTypeSaver : MonoBehaviour { public RealEnemyType type = RealEnemyType.Default; public bool isCustomEnemy = false; public static RealEnemyType[] IdollikeTypes = new RealEnemyType[4] { RealEnemyType.Enrager, RealEnemyType.Lumen, RealEnemyType.Puppeteer, RealEnemyType.Sander }; public static RealEnemyType[] CustomEnemyTypes = new RealEnemyType[15] { RealEnemyType.BlackHoleLauncher, RealEnemyType.Disgrace, RealEnemyType.Watchtower, RealEnemyType.FuchsiaPushUpPushDown, RealEnemyType.FuchsiaPushUp, RealEnemyType.FuchsiaPushDown, RealEnemyType.Fuchsia, RealEnemyType.ShockwaveShuffler, RealEnemyType.Enrager, RealEnemyType.Lumen, RealEnemyType.Puppeteer, RealEnemyType.Sander, RealEnemyType.Blight, RealEnemyType.Phaser, RealEnemyType.Quaternion }; public void Awake() { if (CustomEnemyTypes.Contains(type)) { isCustomEnemy = true; } } public void Start() { SaveForPuppet(); } public void SaveForPuppet() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown EnemyIdentifier componentInChildren = ((Component)this).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return; } GameObject[] activateOnDeath = componentInChildren.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "RealEnemyTypeSaver") { return; } } GameObject val2 = new GameObject("RealEnemyTypeSaver"); RealEnemyTypeSaver realEnemyTypeSaver = val2.AddComponent(); realEnemyTypeSaver.type = type; Util.ArrayAdd(ref componentInChildren.activateOnDeath, val2); } } public class SpawnEffectPitch : MonoBehaviour { public float pitchMultiplier = 1f; } public class WickedSpawned : MonoBehaviour { public bool active = true; public float freezeTimeMax = 5f; public float freezeTime = 0f; public bool immune = false; public float immuneTimeMax = 5f; public float immuneTime = 5f; public Animator anim; public float defaultAnimSpeed = 1f; public void Start() { anim = ((Component)this).GetComponent(); defaultAnimSpeed = anim.speed; } public void Update() { if (!active) { immuneTime = 0f; freezeTime += Time.deltaTime; if (freezeTime >= freezeTimeMax) { freezeTime = 0f; active = true; anim.speed = defaultAnimSpeed; } } else { immuneTime += Time.deltaTime; if (immuneTime < immuneTimeMax) { immune = true; } else { immune = false; } } } } [HarmonyPatch(typeof(BlackHoleProjectile))] public class BlackHoleProjectilePatch { [HarmonyPrefix] [HarmonyPatch(typeof(BlackHoleProjectile), "ShootTargetLightning")] public static bool ShootTargetLightningPrefix(BlackHoleProjectile __instance) { BlackHoleFromMortar component = ((Component)__instance).GetComponent(); return (Object)(object)component == (Object)null; } [HarmonyPostfix] [HarmonyPatch(typeof(BlackHoleProjectile), "Start")] public static void StartPostfix(BlackHoleProjectile __instance) { SimplePortalTraveler orAddComponent = ComponentExtensions.GetOrAddComponent((Component)(object)__instance); orAddComponent.travellerType = (PortalTravellerType)(__instance.enemy ? 4 : 2); } } [HarmonyPatch] public class DeadcaughtEnemyPatch { [HarmonyPostfix] [HarmonyPatch(typeof(Deathcatcher), "EnemyDeath")] public static void EnemyDeathPostfix(EnemyIdentifier eid, Deathcatcher __instance) { if (__instance.deadCaughtEnemies.Count == 0) { return; } List deadCaughtEnemies = __instance.deadCaughtEnemies; CaughtEnemy val = deadCaughtEnemies[deadCaughtEnemies.Count - 1]; GameObject[] activateOnDeath = val.original.activateOnDeath; foreach (GameObject val2 in activateOnDeath) { if (((Object)val2).name == "RealEnemyTypeSaver") { RealEnemyType type = val2.GetComponent().type; if (EnemyAssets.SpawnableObjects.ContainsKey(type) && (Object)(object)EnemyAssets.SpawnableObjects[type] != (Object)null) { ((SavedGeneric)val.savedEnemy).Spawnable = EnemyAssets.SpawnableObjects[type]; } } } List deadCaughtEnemies2 = __instance.deadCaughtEnemies; deadCaughtEnemies2[deadCaughtEnemies2.Count - 1] = val; } [HarmonyPrefix] [HarmonyPatch(typeof(CaughtEnemy), "UpdatePuppet")] public static void UpdatePuppetPrefix(GameObject newPuppet, CaughtEnemy __instance) { ReaddComponents(newPuppet, __instance.original); } public static void ReaddComponents(GameObject puppet, EnemyIdentifier original) { for (int i = 0; i < original.activateOnDeath.Length; i++) { GameObject val = original.activateOnDeath[i]; string name = ((Object)val).name; string text = name; if (!(text == "PuppetName")) { if (text == "RealEnemyTypeSaver") { RealEnemyTypeSaver component = val.GetComponent(); RealEnemyTypeSaver orAddComponent = GameObjectExtensions.GetOrAddComponent(puppet); orAddComponent.type = component.type; ((Object)val).name = "TO_DELETE"; } continue; } PuppetName component2 = val.GetComponent(); PuppetName orAddComponent2 = GameObjectExtensions.GetOrAddComponent(puppet); orAddComponent2.puppetName = component2.puppetName; if (orAddComponent2.puppetName != "") { ((Object)puppet).name = orAddComponent2.puppetName; } ((Object)val).name = "TO_DELETE"; } DeleteObjects(original); } public static void DeleteObjects(EnemyIdentifier original) { int num = 0; while (num < original.activateOnDeath.Length) { GameObject val = original.activateOnDeath[num]; if ((Object)(object)val == (Object)null || ((val != null) ? ((Object)val).name : null) != "TO_DELETE") { num++; continue; } Object.Destroy((Object)(object)val); List list = original.activateOnDeath.ToList(); list.RemoveAt(num); original.activateOnDeath = list.ToArray(); } } } [HarmonyPatch(typeof(DroneFlesh), "Start")] public class DroneFleshPatch { public static void Postfix(DroneFlesh __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)((Component)__instance).transform.parent).name; if (!name.Contains("Spawned") || (!name.Contains("DroneFlesh") && !name.Contains("DroneSkull"))) { return; } FleshPrison[] array = Object.FindObjectsByType((FindObjectsSortMode)0); if (array.Length == 0) { return; } FleshPrison val = array[0]; FleshPrison[] array2 = array; foreach (FleshPrison val2 in array2) { float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)val2).transform.position); float num2 = Vector3.Distance(((Component)__instance).transform.position, ((Component)val).transform.position); if (num < num2) { val = val2; } } val.currentDrones.Add(__instance); if (val.healing) { LineToPoint val3 = default(LineToPoint); if (Object.Instantiate(val.healingTargetEffect, ((Component)__instance).transform).TryGetComponent(ref val3)) { val3.targets[1] = val.rotationBone; } Rigidbody val4 = default(Rigidbody); if (((Component)__instance).TryGetComponent(ref val4)) { val4.isKinematic = true; } } } } [HarmonyPatch(typeof(EnemySpawnableInstance), "Awake")] public class EnemySpawnableInstancePatch { public static void Postfix(EnemySpawnableInstance __instance) { bool flag = ((Object)__instance).name.Contains("Spawned"); bool flag2 = (Object)(object)((Component)__instance).transform.parent == (Object)null; if (flag && flag2) { Object.Destroy((Object)(object)__instance); } } } public class FireSizeReduced : MonoBehaviour { } [HarmonyPatch(typeof(Flammable), "Burn")] public class FlammablePatch { public static void Postfix(Flammable __instance) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.currentFire == (Object)null) && !((Object)(object)__instance.currentFire.GetComponent() != (Object)null)) { if ((Object)(object)Util.FindParentWithNameContaining("DisgraceSpawned", ((Component)__instance).transform) != (Object)null) { Vector3 localScale = __instance.currentFire.transform.localScale; __instance.currentFire.transform.localScale = new Vector3(localScale.x, localScale.y * 0.5f, localScale.z); GameObjectExtensions.GetOrAddComponent(__instance.currentFire); } else if ((Object)(object)Util.FindParentWithNameContaining("WatchtowerSpawned", ((Component)__instance).transform) != (Object)null) { Vector3 localScale2 = __instance.currentFire.transform.localScale; __instance.currentFire.transform.localScale = new Vector3(localScale2.x * 0.6f, localScale2.y * 0.75f, localScale2.z * 0.6f); GameObjectExtensions.GetOrAddComponent(__instance.currentFire); } else if ((Object)(object)Util.FindParentWithNameContaining("Very Cancerous Rodent", ((Component)__instance).transform) != (Object)null) { Transform transform = __instance.currentFire.transform; transform.localScale *= 0.25f; GameObjectExtensions.GetOrAddComponent(__instance.currentFire); } else if ((Object)(object)Util.FindParentWithNameContaining("FuchsiaSpawned", ((Component)__instance).transform) != (Object)null) { Transform transform2 = __instance.currentFire.transform; transform2.localScale *= 0.35f; GameObjectExtensions.GetOrAddComponent(__instance.currentFire); } } } } [HarmonyPatch(typeof(GhostDrone))] public class GhostDronePatch { [HarmonyPostfix] [HarmonyPatch(typeof(GhostDrone), "Start")] public static void StartPostfix(GhostDrone __instance) { if (!((Object)(object)Util.FindParentWithNameContaining("DroneGhostSpawned", ((Component)__instance).transform) == (Object)null)) { ((Component)((Component)__instance).transform.Find("Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(true); } } } [HarmonyPatch(typeof(GoreZone), "ResolveGoreZone")] public class GoreZonePatch { public static bool Prefix(Transform transform, ref GoreZone __result) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!((Object)transform.root).name.Contains("Spawned")) { return true; } if (Object.op_Implicit((Object)(object)GoreZone._globalRootAutomaticGz)) { transform.SetParent(((Component)GoreZone._globalRootAutomaticGz).transform); __result = GoreZone._globalRootAutomaticGz; return false; } GoreZone val = new GameObject("Automated Gore Zone").AddComponent(); transform.SetParent(((Component)val).transform); GoreZone._globalRootAutomaticGz = val; __result = val; return false; } } [HarmonyPatch(typeof(KillAllEnemies))] public class KillAllEnemiesPatch { public static void KillEnemy() where T : MonoBehaviour { T[] array = Object.FindObjectsByType((FindObjectsSortMode)0); T[] array2 = array; foreach (T val in array2) { Object.Destroy((Object)(object)((Component)(object)val).gameObject); } } [HarmonyPrefix] [HarmonyPatch(typeof(KillAllEnemies), "Enable")] public static void EnablePrefix(CheatsManager manager) { KillAllEnemiesPatch.KillEnemy(); KillAllEnemiesPatch.KillEnemy(); KillAllEnemiesPatch.KillEnemy(); FromOneTimeParry[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (FromOneTimeParry fromOneTimeParry in array) { Object.Destroy((Object)(object)((Component)fromOneTimeParry).gameObject); } } } [HarmonyPatch(typeof(Landmine))] public class LandminePatch { [HarmonyPrefix] [HarmonyPatch(typeof(Landmine), "Parry")] public static bool SetColorPrefix(Landmine __instance) { FromOneTimeParry component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } __instance.parried = true; return false; } } [HarmonyPatch(typeof(MinosArm), "Retreat")] public class MinosArmPatch { public static void Prefix(MinosArm __instance) { if (!((Object)(object)Util.FindParentWithNameContaining("MinosArmSpawned", ((Component)__instance).transform) == (Object)null)) { Object.Destroy((Object)(object)((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(MinotaurChase))] public class MinotaurChasePatch { [HarmonyPrefix] [HarmonyPatch(typeof(MinotaurChase), "Start")] public static void StartPrefix(MinotaurChase __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Util.FindParentWithNameContaining("MinotaurSpawned", ((Component)__instance).transform) == (Object)null)) { __instance.leashPosition = ((Component)__instance).transform.position; __instance.trackTarget = false; __instance.eid = ((Component)__instance).GetComponent(); __instance.eid.isBoss = false; } } [HarmonyPrefix] [HarmonyPatch(typeof(MinotaurChase), "Update")] public static bool UpdatePrefix(MinotaurChase __instance) { if (!((Object)(object)Util.FindParentWithNameContaining("MinotaurSpawned", ((Component)__instance).transform) != (Object)null) || !(__instance.eid.health <= 0f)) { return true; } Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent).gameObject); return false; } } [HarmonyPatch] public class OutlinePatch { [HarmonyPostfix] [HarmonyPatch(typeof(DroneFlesh), "Start")] public static void DroneFleshPostfix(DroneFlesh __instance) { if (((Object)__instance).name.Contains("DroneFlesh")) { MeshRenderer component = ((Component)((Component)__instance).transform.Find("Gib_Eyeball")).GetComponent(); ((Renderer)component).material.EnableKeyword("ENEMY"); } } } [HarmonyPatch(typeof(Projectile), "CreateExplosionEffect")] public class ProjectilePatch { public static bool Prefix(Projectile __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) ProjectileExplosionColor component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if ((Object)(object)__instance.explosionEffect == (Object)null) { return false; } GameObject val = Object.Instantiate(__instance.explosionEffect, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); Explosion[] componentsInChildren = val.GetComponentsInChildren(); Explosion[] array = componentsInChildren; foreach (Explosion val2 in array) { val2.sourceWeapon = __instance.sourceWeapon ?? val2.sourceWeapon; if (val2.damage != 0 && ((!__instance.friendly && !__instance.playerBullet) || (float)val2.damage < __instance.damage)) { val2.damage = (int)__instance.damage; } if (!__instance.friendly && !__instance.playerBullet) { val2.enemy = true; } val2.boosted = __instance.boosted; } ParticleSystem component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { MainModule main = component2.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ((MinMaxGradient)(ref startColor)).color = component.color; ((MinMaxGradient)(ref startColor)).colorMax = component.color; component2.startColor = component.color; } if (!val.activeSelf) { val.SetActive(true); } val.transform.SetParent(((Component)__instance).transform.parent, true); if (__instance.boosted || __instance.parried) { MonoSingleton.Instance.TryIgniteAt(((Component)__instance).transform.position, 3); } return false; } } [HarmonyPatch(typeof(SpawnableObjectExtensions), "InstantiateSpawnable")] public class SpawnableObjectExtensionsPatch { public static bool Prefix(SpawnableObject spawnable, SavedGeneric saved, Transform parent, bool newSizing, ref SpawnableInstance __result) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Invalid comparison between Unknown and I4 //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) SavedBlock val = (SavedBlock)(object)((saved is SavedBlock) ? saved : null); GameObject val2; bool flag; if (val != null) { val2 = SandboxUtils.CreateFinalBlock(spawnable, ((SavedGeneric)val).Position.ToVector3(), val.BlockSize.ToVector3(), spawnable.isWater); flag = true; if ((Object)(object)parent != (Object)null) { val2.transform.SetParent(parent, true); } } else { val2 = Object.Instantiate(spawnable.gameObject, parent, true); flag = false; } val2.transform.position = saved.Position.ToVector3(); if (!flag && !newSizing) { val2.transform.localScale = saved.Scale.ToVector3(); } KeepInBounds val3 = default(KeepInBounds); if (val2.TryGetComponent(ref val3)) { val3.ForceApproveNewPosition(); } SpawnableInstance val5; if ((int)spawnable.spawnableObjectType == 1) { SavedEnemy val4 = (SavedEnemy)(object)((saved is SavedEnemy) ? saved : null); if (val4 == null) { SpawnableObjectExtensions.Log.Error("Provided SavedGeneric object is not of type SavedEnemy, while SpawnableObject.spawnableObjectType is Enemy.", (IEnumerable)null, (string)null, (object)null); throw new ArgumentException("Invalid SavedGeneric type for Enemy spawnable object."); } val5 = (SpawnableInstance)(object)val2.GetComponentInChildren(true); if ((Object)(object)val5 == (Object)null) { val5 = (SpawnableInstance)(object)GameObjectExtensions.GetOrAddComponent(val2); } EnemySpawnableInstance val6 = (EnemySpawnableInstance)val5; ((SpawnableInstance)val6).sourceObject = spawnable; if ((Object)(object)val6.eid == (Object)null) { EnemySimplifier[] componentsInChildren = val2.GetComponentsInChildren(true); EnemySimplifier[] array = componentsInChildren; foreach (EnemySimplifier val7 in array) { val7.Awake(); val7.eid = val2.GetComponentInChildren(true); Dictionary materialDict = val7.materialDict; if (materialDict[(MaterialState)3] == null) { Material val8 = (materialDict[(MaterialState)3] = val7.materialDict[(MaterialState)2]); } } ((SpawnableInstance)val6).Awake(); Enemy componentInChildren = val2.GetComponentInChildren(true); if (componentInChildren != null) { componentInChildren.Awake(); } Transform val10 = Util.FindParentWithNameContaining("Spawned", val2.transform); if ((Object)(object)val10 != (Object)null) { ((Component)val10).gameObject.SetActive(true); if ((Object)(object)val10.parent != (Object)null && ((Object)val10.parent).name.Contains("Spawned")) { ((Component)val10.parent).gameObject.SetActive(true); } } } val6.eid.checkingSpawnStatus = false; val6.RestoreRadiance(val4.Radiance); } else { val5 = GameObjectExtensions.GetOrAddComponent(val2); val5.sourceObject = spawnable; } SavedPhysical val11 = (SavedPhysical)(object)((saved is SavedPhysical) ? saved : null); if (val11 != null && val11.Kinematic) { val5.Pause(true); } if (!flag && newSizing) { val5.SetSize(saved.Scale.ToVector3()); } val5.disallowManipulation = saved.DisallowManipulation; val5.disallowFreezing = saved.DisallowFreezing; SpawnableObjectExtensions.ApplyData(val2, saved.Data); if ((int)spawnable.spawnableObjectType == 1 && Object.op_Implicit((Object)(object)MonoSingleton.Instance)) { MonoSingleton.Instance.EnsurePositionWithinBounds(val2.transform.position); } __result = val5; return false; } } [HarmonyPatch(typeof(SpawnEffect), "Start")] public class SpawnEffectPatch { public static void Postfix(SpawnEffect __instance) { AudioSource component = ((Component)__instance).GetComponent(); SpawnEffectPitch component2 = ((Component)__instance).GetComponent(); if (!((Object)(object)component2 == (Object)null) && !((Object)(object)component == (Object)null)) { AudioSourceExtensions.SetPitch(component, AudioSourceExtensions.GetPitch(component) * component2.pitchMultiplier); } } } [HarmonyPatch(typeof(Wicked))] public class WickedPatch { [HarmonyPostfix] [HarmonyPatch(typeof(Wicked), "Start")] public static void StartPostfix(Wicked __instance) { if (!((Object)(object)Util.FindParentWithNameContaining("WickedSpawned", ((Component)__instance).transform) == (Object)null)) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPrefix] [HarmonyPatch(typeof(Wicked), "Update")] public static bool UpdatePrefix(Wicked __instance) { WickedSpawned component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && !component.active) { return false; } if (BlindEnemies.Blind || EnemyIgnorePlayer.Active) { return false; } __instance.playerSpotTime = 999f; return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Wicked), "OnCollisionEnter")] public static bool OnCollisionEnterPrefix(Wicked __instance) { if ((Object)(object)Util.FindParentWithNameContaining("WickedSpawned", ((Component)__instance).transform) == (Object)null) { return true; } WickedSpawned component = ((Component)__instance).gameObject.GetComponent(); if (!component.active) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Wicked), "GetHit")] public static bool GetHitPrefix(Wicked __instance) { if (!((Component)__instance).gameObject.activeInHierarchy) { return false; } WickedSpawned component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if (!component.immune) { component.active = false; ((Component)__instance).gameObject.GetComponent().speed = 0f; ((Component)__instance).gameObject.GetComponent().speed = 0f; } return false; } } [HarmonyPatch] public class NavMeshStuff { [HarmonyPrefix] [HarmonyPatch(typeof(SandboxNavmesh), "Rebake")] public static bool SandboxNavmeshRebakePrefix(SandboxNavmesh __instance) { if (Util.IsSandbox()) { return true; } BrushBlock[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); BrushBlock[] array2 = array; foreach (BrushBlock val in array2) { if (!((Object)(object)((Component)val).transform.parent == (Object)(object)((Component)__instance.surface).transform)) { ((Component)val).transform.SetParent(((Component)__instance.surface).transform); } } SandboxProp[] array3 = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); SandboxProp[] array4 = array3; foreach (SandboxProp val2 in array4) { if (!((Object)(object)((Component)val2).transform.parent == (Object)(object)((Component)__instance.surface).transform) && (!((Object)val2).name.Contains("Altar") || !((Object)(object)((Component)val2).GetComponent() == (Object)null))) { ((Component)val2).transform.SetParent(((Component)__instance.surface).transform); } } __instance.surface.BuildNavMesh(); SandboxNavmesh.Log.Info("Navmesh built", (IEnumerable)null, (string)null, (object)null); __instance.isDirty = false; MonoSingleton.Instance.HideNavmeshNotice(); if (__instance.navmeshBuilt != null) { __instance.navmeshBuilt.Invoke(); } MonoSingleton.Instance.RenderCheatsInfo(); return false; } } [HarmonyPatch(typeof(PresenceController), "SceneManagerOnsceneLoaded")] public class PresencePatch { public static bool Prefix(Scene _, LoadSceneMode mode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((int)mode == 1) { return false; } string currentScene = SceneHelper.CurrentScene; PresenceController.Log.Info("Scene loaded: " + currentScene, (IEnumerable)null, (string)null, (object)null); DiscordController.Instance.FetchSceneActivity(currentScene); SteamController.Instance.FetchSceneActivity(currentScene); if ((Object)(object)MapInfoBase.Instance != (Object)null && currentScene == "uk_construct") { if (!MonoSingleton.Instance.trackingTimeInSandbox) { PresenceController.Log.Info("Starting sandbox time tracking", (IEnumerable)null, (string)null, (object)null); MonoSingleton.Instance.trackingTimeInSandbox = true; MonoSingleton.Instance.timeInSandbox = TimeSince.op_Implicit(0f); } } else if (MonoSingleton.Instance.trackingTimeInSandbox) { PresenceController.Log.Info("Submitting sandbox time", (IEnumerable)null, (string)null, (object)null); MonoSingleton.Instance.trackingTimeInSandbox = false; SteamController.Instance.UpdateTimeInSandbox(TimeSince.op_Implicit(MonoSingleton.Instance.timeInSandbox)); } return false; } } [HarmonyPatch] public class SandboxOnlyStuff { [HarmonyPrefix] [HarmonyPatch(typeof(SpawnMenu), "RebuildMenu")] public static void SpawnMenuRebuildMenuPrefix() { MapInfoBase.Instance.sandboxTools = true; } [HarmonyPrefix] [HarmonyPatch(typeof(CheatsManager), "Start")] [HarmonyPriority(200)] public static bool CheatsManagerStartPrefix(CheatsManager __instance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown __instance.RebuildIcons(); __instance.RegisterCheat((ICheat)new KeepEnabled(), "meta"); if ((Object)(object)MapInfoBase.Instance != (Object)null) { __instance.RegisterCheat((ICheat)new ExperimentalArmRotation(), "sandbox"); __instance.RegisterCheat((ICheat)new QuickSave(), "sandbox"); __instance.RegisterCheat((ICheat)new QuickLoad(), "sandbox"); __instance.RegisterCheat((ICheat)new ManageSaves(), "sandbox"); __instance.RegisterCheat((ICheat)new ClearMap(), "sandbox"); __instance.RegisterCheat((ICheat)new RebuildNavmesh(), "sandbox"); __instance.RegisterCheats((ICheat[])(object)new ICheat[2] { (ICheat)new Snapping(), (ICheat)new SpawnPhysics() }, "sandbox"); } __instance.RegisterCheats((ICheat[])(object)new ICheat[4] { (ICheat)new SummonSandboxArm(), (ICheat)new TeleportMenu(), (ICheat)new FullBright(), (ICheat)new Invincibility() }, "general"); __instance.RegisterCheats((ICheat[])(object)new ICheat[3] { (ICheat)new Noclip(), (ICheat)new Flight(), (ICheat)new InfiniteWallJumps() }, "movement"); __instance.RegisterCheats((ICheat[])(object)new ICheat[2] { (ICheat)new NoWeaponCooldown(), (ICheat)new InfinitePowerUps() }, "weapons"); __instance.RegisterCheats((ICheat[])(object)new ICheat[6] { (ICheat)new BlindEnemies(), (ICheat)new EnemiesHateEnemies(), (ICheat)new EnemyIgnorePlayer(), (ICheat)new DisableEnemySpawns(), (ICheat)new InvincibleEnemies(), (ICheat)new KillAllEnemies() }, "enemies"); __instance.RegisterCheats((ICheat[])(object)new ICheat[2] { (ICheat)new HideWeapons(), (ICheat)new HideUI() }, "visual"); bool flag = false; if (GameProgressSaver.GetClashModeUnlocked() && !flag) { __instance.RegisterCheat((ICheat)new CrashMode(), "special"); } if (GameProgressSaver.GetGhostDroneModeUnlocked()) { __instance.RegisterCheat((ICheat)new GhostDroneMode(), "special"); } __instance.RegisterCheats((ICheat[])(object)new ICheat[8] { (ICheat)new PlayerParentingDebug(), (ICheat)new StateDebug(), (ICheat)new GunControlDebug(), (ICheat)new SandboxArmDebug(), (ICheat)new EnemyIdentifierDebug(), (ICheat)new ForceBossBars(), (ICheat)new SpreadGasoline(), (ICheat)new DeathCatcherDebug() }, "debug"); __instance.RegisterCheat((ICheat)new PauseTimedBombs(), "debug"); MonoSingleton.Instance.RestoreBinds(__instance.allRegisteredCheats); __instance.RebuildMenu(); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SandboxSaver), "Clear")] public static bool SandboxSaverClearPrefix() { if (Util.IsSandbox()) { return true; } DefaultSandboxCheckpoint instance = MonoSingleton.Instance; if (!((Object)(object)instance == (Object)null)) { MonoSingleton.Instance.currentCheckPoint = instance.checkpoint; } SpawnableInstance[] array = Object.FindObjectsOfType(); SpawnableInstance[] array2 = array; foreach (SpawnableInstance val in array2) { if (((Behaviour)val).enabled) { Object.Destroy((Object)(object)((Component)val).gameObject); } } Resources.UnloadUnusedAssets(); MonoSingleton.Instance.ResetSizeToDefault(); MonoSingleton.Instance.activeSave = null; MonoSingleton.Instance.RefreshCheatStates(); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SandboxSaver), "Load")] public static bool SandboxSaverLoadPrefix(string name, SandboxSaver __instance) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if (Util.IsSandbox()) { return true; } SandboxSaver.Log.Info("Loading save: " + name, (IEnumerable)null, (string)null, (object)null); SandboxSaver.SetupDirs(); SandboxSaver.Clear(); __instance.activeSave = name; MonoSingleton.Instance.RefreshCheatStates(); __instance.RebuildObjectList(); SandboxSaveData val = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(SandboxSaver.SavePath, name + ".pitr"))); SandboxSaver.Log.Fine($"Loaded {val.Blocks.Length} blocks\nLoaded {val.Props.Length} props", (IEnumerable)null, (string)null, (object)null); SandboxSaver.Log.Fine("Save Version: " + val.SaveVersion, (IEnumerable)null, (string)null, (object)null); Vector3? val2 = null; Vector3 position = ((Component)MonoSingleton.Instance).transform.position; SavedProp[] props = val.Props; SavedProp[] array = props; foreach (SavedProp val3 in array) { __instance.RecreateProp(val3, val.SaveVersion > 1); if (!(((SavedGeneric)val3).ObjectIdentifier != "ultrakill.spawn-point")) { if (!val2.HasValue) { val2 = ((SavedGeneric)val3).Position.ToVector3(); } else if (Vector3.Distance(position, ((SavedGeneric)val3).Position.ToVector3()) < Vector3.Distance(position, val2.Value)) { val2 = ((SavedGeneric)val3).Position.ToVector3(); } } } if (val2.HasValue) { ((Component)MonoSingleton.Instance).transform.position = val2.Value; MonoSingleton.Instance.rb.velocity = Vector3.zero; } SavedBlock[] blocks = val.Blocks; SavedBlock[] array2 = blocks; foreach (SavedBlock val4 in array2) { __instance.RecreateBlock(val4); } MonoSingleton.Instance.Rebake(); List list = new List(); SavedEnemy[] enemies = val.Enemies; SavedEnemy[] array3 = enemies; foreach (SavedEnemy val5 in array3) { EnemySpawnableInstance val6 = __instance.RecreateEnemy((SavedGeneric)(object)val5, val.SaveVersion > 1); ((SpawnableInstance)val6).Pause(false); list.Add(val6); } ((MonoBehaviour)__instance).StartCoroutine(__instance.PostLoadAndBake(list)); return false; } } [BepInPlugin("billy.spawnerarmextras", "SpawnerArmExtras", "6.0.3")] public class Plugin : BaseUnityPlugin { private ConfigBuilder config; [Configgable("", "Enable custom Navmesh outside Sandbox", 0, "Enabling this will let you update enemy navigation after placing props in normal levels (requires level restart)")] public static ConfigToggle IsSandboxNavmeshEnabled = new ConfigToggle(true); private static readonly Harmony Harmony = new Harmony("billy.spawnerarmextras"); internal static ManualLogSource Logger; public static bool addedEnemies = false; public void Awake() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; EnemyAssets.LoadAssets(); Harmony.PatchAll(); Logger.LogInfo((object)"Plugin SpawnerArmExtras is loaded!"); SceneManager.activeSceneChanged += SceneManagerActiveSceneChanged; SceneManager.sceneLoaded += SceneManagerSceneLoaded; config = new ConfigBuilder("billy.spawnerarmextras", "SpawnerArmExtras"); config.BuildAll(); } public static void SceneManagerSceneLoaded(Scene scene, LoadSceneMode mode) { if (!Util.IsStartingScene()) { SpawnMenuPatch.MakeAllSpawnables(); } } public static void SceneManagerActiveSceneChanged(Scene arg0, Scene arg1) { if (((ConfigValueElement)(object)IsSandboxNavmeshEnabled).Value && !Util.IsSandbox() && !Util.IsStartingScene()) { SceneHelper instance = MonoSingleton.Instance; if (instance != null) { ((MonoBehaviour)instance).StartCoroutine(AddSandboxNavMesh()); } } } public static IEnumerator AddSandboxNavMesh() { yield return (object)new WaitForSeconds(1f); GameObject obj = new GameObject("SandboxNavMesh"); obj.SetActive(false); NavMeshSurface surface = obj.AddComponent(); surface.useGeometry = (NavMeshCollectGeometry)1; surface.collectObjects = (CollectObjects)2; surface.voxelSize = 0.1667f; surface.layerMask = LayerMask.op_Implicit(16777664); SandboxNavmesh snm = obj.AddComponent(); snm.surface = surface; obj.SetActive(true); yield return (object)new WaitForSeconds(0.1f); } } [HarmonyPatch(typeof(SpawnMenu))] public class SpawnMenuPatch { public static readonly Color ColorDefault = new Color(0.75f, 0.75f, 0.75f); public static readonly Color ColorHusk = new Color(0.898f, 0.6588f, 0.6588f); public static readonly Color ColorMachine = new Color(0.4784f, 0.6196f, 0.851f); public static readonly Color ColorDemon = new Color(0.5176f, 0.9059f, 0.5098f); public static readonly Color ColorAngel = new Color(1f, 0.9091f, 0.4481f); public static GameObject MakeGameObject(string name, GameObject obj) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); val.layer = LayerMask.NameToLayer("EnemyTrigger"); GameObject val2 = Object.Instantiate(obj); ((Object)val2).name = name + "(Clone)"; val2.transform.position = Vector3.zero; val2.transform.SetParent(val.transform); DisableVertexLighting(val2); return val; } public static GameObject MakeGameObjectCombined(string name, GameObject[] objs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); val.layer = LayerMask.NameToLayer("EnemyTrigger"); foreach (GameObject val2 in objs) { GameObject val3 = Object.Instantiate(val2); val3.transform.position = Vector3.zero; val3.transform.SetParent(val.transform); DisableVertexLighting(val3); } return val; } public static GameObject MakePreview(string name, GameObject obj) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent(); GameObject val2 = Object.Instantiate(obj); val2.transform.position = Vector3.zero; val2.transform.SetParent(val.transform); DisableVertexLighting(val2); return val; } public static void DisableVertexLighting(GameObject obj) { SkinnedMeshRenderer[] componentsInChildren = obj.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val in componentsInChildren) { Material[] materials = ((Renderer)val).materials; foreach (Material val2 in materials) { val2.DisableKeyword("VERTEX_LIGHTING"); } } MeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren(); foreach (MeshRenderer val3 in componentsInChildren2) { Material[] materials2 = ((Renderer)val3).materials; foreach (Material val4 in materials2) { val4.DisableKeyword("VERTEX_LIGHTING"); } } } public static Sprite MakeIcon(Texture2D tex) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) return Sprite.Create(tex, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)); } [HarmonyPrefix] [HarmonyPatch(typeof(SpawnMenu), "Awake")] public static void AwakePrefix(SpawnMenu __instance) { if (Plugin.addedEnemies) { return; } MakeAllSpawnables(); List list = __instance.objects.enemies.ToList(); List list2 = new List(); foreach (RealEnemyType key in EnemyAssets.SpawnableObjects.Keys) { if ((Object)(object)EnemyAssets.SpawnableObjects[key] != (Object)null) { list2.Add(EnemyAssets.SpawnableObjects[key]); } } list.AddRange(list2); __instance.objects.enemies = list.ToArray(); Plugin.addedEnemies = true; SpawnableObject[] sandboxTools = __instance.objects.sandboxTools; foreach (SpawnableObject val in sandboxTools) { val.sandboxOnly = false; } SpawnableObject[] sandboxObjects = __instance.objects.sandboxObjects; foreach (SpawnableObject val2 in sandboxObjects) { val2.sandboxOnly = false; } SpawnableObject[] specialSandbox = __instance.objects.specialSandbox; foreach (SpawnableObject val3 in specialSandbox) { val3.sandboxOnly = false; } } public static void MakeAllSpawnables() { RealEnemyType[] array = EnemyAssets.SpawnableObjects.Keys.ToArray(); RealEnemyType[] array2 = array; foreach (RealEnemyType realEnemyType in array2) { if ((Object)(object)EnemyAssets.SpawnableObjects[realEnemyType] == (Object)null) { EnemyAssets.SpawnableObjects[realEnemyType] = MakeSpawnableFromType(realEnemyType); } } } public static SpawnableObject MakeSpawnableFromType(RealEnemyType realEnemyType) { if (1 == 0) { } SpawnableObject result = (SpawnableObject)(realEnemyType switch { RealEnemyType.Wicked => MakeSpawnableWicked(), RealEnemyType.AgonyTundra => MakeSpawnableAgonyTundra(), RealEnemyType.Agony => MakeSpawnableAgony(), RealEnemyType.Tundra => MakeSpawnableTundra(), RealEnemyType.Minos => MakeSpawnableMinos(), RealEnemyType.MinosArm => MakeSpawnableMinosArm(), RealEnemyType.Minotaur => MakeSpawnableMinotaur(), RealEnemyType.DroneGhost => MakeSpawnableDroneGhost(), RealEnemyType.Eye => MakeSpawnableDroneFlesh(), RealEnemyType.EyeYellow => MakeSpawnableDroneFleshCamera(), RealEnemyType.EyeMalicious => MakeSpawnableDroneSkull(), RealEnemyType.BlackHoleLauncher => MakeSpawnableBlackHoleLauncher(), RealEnemyType.Disgrace => MakeSpawnableDisgrace(), RealEnemyType.Watchtower => MakeSpawnableWatchtower(), RealEnemyType.FuchsiaPushUpPushDown => MakeSpawnableFuchsia(pushUp: true, pushDown: true), RealEnemyType.FuchsiaPushUp => MakeSpawnableFuchsia(pushUp: true, pushDown: false), RealEnemyType.FuchsiaPushDown => MakeSpawnableFuchsia(pushUp: false, pushDown: true), RealEnemyType.Fuchsia => MakeSpawnableFuchsia(pushUp: false, pushDown: false), RealEnemyType.ShockwaveShuffler => MakeSpawnableShockwaveShuffler(), RealEnemyType.Enrager => MakeSpawnableIdollike(RealEnemyType.Enrager), RealEnemyType.Lumen => MakeSpawnableIdollike(RealEnemyType.Lumen), RealEnemyType.Puppeteer => MakeSpawnableIdollike(RealEnemyType.Puppeteer), RealEnemyType.Sander => MakeSpawnableIdollike(RealEnemyType.Sander), _ => null, }); if (1 == 0) { } return result; } public static void SetSpawnableDefaults(SpawnableObject spawnable, string identifier = "ultrakill.mannequin") { spawnable.iconKey = ""; spawnable.identifier = identifier; spawnable.defaultSettings = Array.Empty(); spawnable.description = "description"; spawnable.strategy = "strategy"; spawnable.type = "type"; } public static SpawnableObject MakeSpawnableWicked() { //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) //IL_004a: 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) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Wicked"; val.objectName = "Wicked"; val.gameObject = MakeGameObject("WickedSpawned", EnemyAssets.Prefabs["Wicked"]); val.backgroundColor = ColorDefault; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)10; val.gridIcon = MakeIcon(EnemyAssets.Icons["Wicked"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableAgonyTundra() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "AgonyTundra"; val.objectName = "AgonyTundra"; val.gameObject = MakeGameObjectCombined("AgonyTundraSpawned", (GameObject[])(object)new GameObject[2] { EnemyAssets.Prefabs["Agony"], EnemyAssets.Prefabs["Tundra"] }); Enemy componentInChildren = ((Component)val.gameObject.transform.GetChild(0)).GetComponentInChildren(); Enemy componentInChildren2 = ((Component)val.gameObject.transform.GetChild(1)).GetComponentInChildren(); componentInChildren.symbiotic = true; componentInChildren2.symbiotic = true; componentInChildren.symbiote = componentInChildren2; componentInChildren2.symbiote = componentInChildren; val.gameObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f); ((Component)componentInChildren).transform.localPosition = new Vector3(0f, 0f, -2f); ((Component)componentInChildren2).transform.localPosition = new Vector3(0f, 0f, 2f); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)7; val.gridIcon = MakeIcon(EnemyAssets.Icons["AgonyTundra"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableAgony() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Agony"; val.objectName = "Agony"; val.gameObject = MakeGameObject("AgonySpawned", EnemyAssets.Prefabs["Agony"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, -45f, 0f); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)7; val.gridIcon = MakeIcon(EnemyAssets.Icons["Agony"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableTundra() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Tundra"; val.objectName = "Tundra"; val.gameObject = MakeGameObject("TundraSpawned", EnemyAssets.Prefabs["Tundra"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, -135f, 0f); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)7; val.gridIcon = MakeIcon(EnemyAssets.Icons["Tundra"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableMinos() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Minos"; val.objectName = "Minos"; val.gameObject = MakeGameObject("MinosSpawned", EnemyAssets.Prefabs["Minos"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f); val.gameObject.transform.GetChild(0).position = new Vector3(0f, -580f, 150f); val.backgroundColor = ColorHusk; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)11; val.gridIcon = MakeIcon(EnemyAssets.Icons["Minos"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableMinosArm() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "MinosArm"; val.objectName = "MinosArm"; val.gameObject = MakeGameObject("MinosArmSpawned", EnemyAssets.Prefabs["MinosArm"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 270f, 0f); val.gameObject.transform.GetChild(0).position = new Vector3(0f, 0f, 180f); val.backgroundColor = ColorHusk; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)11; val.spawnOffset = 20f; val.gridIcon = MakeIcon(EnemyAssets.Icons["MinosArm"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableMinotaur() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Minotaur"; val.objectName = "Minotaur"; val.gameObject = MakeGameObject("MinotaurSpawned", EnemyAssets.Prefabs["Minotaur"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorDemon; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)32; val.gridIcon = MakeIcon(EnemyAssets.Icons["Minotaur"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableDroneGhost() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "DroneGhost"; val.objectName = "DroneGhost"; val.gameObject = MakeGameObject("DroneGhostSpawned", EnemyAssets.Prefabs["DroneGhost"]); ((Component)val.gameObject.transform.Find("DroneGhostSpawned(Clone)/Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(false); val.backgroundColor = ColorMachine; val.enemyType = (EnemyType)1; val.spawnOffset = 2f; val.gridIcon = MakeIcon(EnemyAssets.Icons["DroneGhost"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableDroneFlesh() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "DroneFlesh"; val.objectName = "DroneFlesh"; val.gameObject = MakeGameObject("DroneFleshSpawned", EnemyAssets.Prefabs["DroneFlesh"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorDefault; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)1; val.spawnOffset = 2f; val.gridIcon = MakeIcon(EnemyAssets.Icons["DroneFlesh"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableDroneFleshCamera() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "DroneFleshCamera"; val.objectName = "DroneFleshCamera"; val.gameObject = MakeGameObject("DroneFleshCameraSpawned", EnemyAssets.Prefabs["DroneFleshCamera"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorDefault; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)1; val.spawnOffset = 2f; val.gridIcon = MakeIcon(EnemyAssets.Icons["DroneFleshCamera"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableDroneSkull() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "DroneSkull"; val.objectName = "DroneSkull"; val.gameObject = MakeGameObject("DroneSkullSpawned", EnemyAssets.Prefabs["DroneSkull"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorDefault; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)1; val.spawnOffset = 2f; val.gridIcon = MakeIcon(EnemyAssets.Icons["DroneSkull"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableBlackHoleLauncher() { //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) //IL_004a: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "BlackHoleLauncher"; val.objectName = "BlackHoleLauncher"; val.gameObject = MakeGameObject("BlackHoleLauncherSpawned", EnemyAssets.Prefabs["CentaurMortar"]); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)35; val.gridIcon = MakeIcon(EnemyAssets.Icons["BlackHoleLauncher"]); val.preview = MakePreview("BlackHoleLauncher Preview", EnemyAssets.Prefabs["CentaurMortarPreview"]); SkinnedMeshRenderer componentInChildren = val.preview.GetComponentInChildren(true); ((Renderer)componentInChildren).material.color = new Color(0.65f, 0f, 0.8f, 1f); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableDisgrace() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Disgrace"; val.objectName = "Disgrace"; val.gameObject = MakeGameObject("DisgraceSpawned", EnemyAssets.Prefabs["MaliciousFace"]); val.gameObject.transform.Find("DisgraceSpawned(Clone)/Body/MaliciousFace").localScale = new Vector3(0.1f, 0.0875f, 0.0005f); ((Renderer)val.gameObject.GetComponentInChildren()).material.color = new Color(0.5f, 0.9f, 0.6f); val.gameObject.transform.GetChild(0).position = new Vector3(0f, -4f, 0f); val.backgroundColor = ColorDefault; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)4; val.gridIcon = MakeIcon(EnemyAssets.Icons["Disgrace"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableWatchtower() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Watchtower"; val.objectName = "Watchtower"; val.gameObject = MakeGameObject("WatchtowerSpawned", EnemyAssets.Prefabs["CentaurTower"]); val.gameObject.transform.localScale = new Vector3(1.5f, 2f, 1.5f); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)35; val.gridIcon = MakeIcon(EnemyAssets.Icons["Watchtower"]); val.preview = MakePreview("Watchtower Preview", EnemyAssets.Prefabs["CentaurTowerPreview"]); val.preview.transform.GetChild(0).localScale = new Vector3(2.25f, 3f, 2.25f); Transform val2 = val.preview.transform.GetChild(0).Find("Armature/Pole_Top/Sphere (1)"); val2.localPosition = new Vector3(-0.45f, 0f, 0f); val2.localScale = new Vector3(0.15f, 0.2f, 0.2f); ((Renderer)((Component)val2.Find("Sphere (1)")).GetComponent()).material.color = new Color(1f, 1f, 0f); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableFuchsia(bool pushUp, bool pushDown) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) string text = ""; if (pushUp) { text += " PushUp"; } if (pushDown) { text += " PushDown"; } SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "Fuchsia" + text; val.objectName = "Fuchsia" + text; val.gameObject = MakeGameObject("FuchsiaSpawned" + text, EnemyAssets.Prefabs["DroneFleshCamera"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorAngel; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)1; val.spawnOffset = 5f; val.gridIcon = MakeIcon(EnemyAssets.Icons["Fuchsia" + text]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableShockwaveShuffler() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) SpawnableObject val = ScriptableObject.CreateInstance(); ((Object)val).name = "ShockwaveShuffler"; val.objectName = "ShockwaveShuffler"; val.gameObject = MakeGameObject("ShockwaveShufflerSpawned", EnemyAssets.Prefabs["DroneFlesh"]); val.gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f); val.backgroundColor = ColorMachine; val.spawnableObjectType = (SpawnableObjectDataType)1; val.enemyType = (EnemyType)42; val.spawnOffset = 1.5f; val.gridIcon = MakeIcon(EnemyAssets.Icons["ShockwaveShuffler"]); SetSpawnableDefaults(val); return val; } public static SpawnableObject MakeSpawnableIdollike(RealEnemyType realEnemyType) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } string text = realEnemyType switch { RealEnemyType.Enrager => "Enrager", RealEnemyType.Lumen => "Lumen", RealEnemyType.Puppeteer => "Puppeteer", RealEnemyType.Sander => "Sander", _ => "_", }; if (1 == 0) { } string text2 = text; if (1 == 0) { } Color val = (Color)(realEnemyType switch { RealEnemyType.Enrager => new Color(1f, 0.35f, 0f), RealEnemyType.Lumen => new Color(0.6f, 0.5f, 1.5f), RealEnemyType.Puppeteer => new Color(1f, 0f, 0.35f), RealEnemyType.Sander => new Color(1f, 0.9f, 0.55f), _ => Color.white, }); if (1 == 0) { } Color color = val; SpawnableObject val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = text2; val2.objectName = text2; val2.gameObject = MakeGameObject(text2 + "Spawned", EnemyAssets.Prefabs["Idol"]); val2.backgroundColor = ColorDemon; val2.spawnableObjectType = (SpawnableObjectDataType)1; val2.enemyType = (EnemyType)21; val2.spawnOffset = 0f; val2.gridIcon = MakeIcon(EnemyAssets.Icons[text2]); val2.preview = MakePreview(text2 + " Preview", EnemyAssets.Prefabs["IdolPreview"]); MeshRenderer component = ((Component)val2.preview.transform.GetChild(0).GetChild(0)).GetComponent(); ((Renderer)component).material.color = color; SetSpawnableDefaults(val2); return val2; } } public class Util { public static bool IsSandbox() { return SceneHelper.CurrentScene == "uk_construct"; } public static bool IsStartingScene() { return SceneHelper.CurrentScene == "Bootstrap" || SceneHelper.CurrentScene == "Intro" || SceneHelper.CurrentScene == "Main Menu"; } public static Texture2D LoadEmbeddedTexture(string resourceName, string textureName) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Logger.LogError((object)("Embedded resource '" + resourceName + "' not found")); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { ((Object)val).name = textureName; ((Texture)val).filterMode = (FilterMode)0; return val; } Plugin.Logger.LogError((object)"Failed to load embedded texture"); return null; } public static Transform FindParentWithNameContaining(string searchedSubstring, Transform target) { while ((Object)(object)target != (Object)null) { if (((Object)target).name.Contains(searchedSubstring)) { return target; } target = target.parent; } return null; } public static T[] ArrayAdd(ref T[] array, T element, int index = -1) { if (index == -1) { index = array.Length; } List list = array.ToList(); list.Insert(index, element); array = list.ToArray(); return array; } public static void SetEnemyHealth(EnemyIdentifier eid, float newHealth) { eid.health = newHealth; Enemy component = ((Component)eid).GetComponent(); if (component != null) { component.health = newHealth; } if (component != null) { component.originalHealth = newHealth; } } public static void UpdateEnemyHealthbar(EnemyIdentifier eid) { BossHealthBar component = ((Component)eid).GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); CreateHealthBar(eid); BossHealthBar component2 = ((Component)eid).GetComponent(); if (component2 != null) { component2.Awake(); } } } public static BossHealthBar CreateHealthBar(EnemyIdentifier eid) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) BossHealthBar val = ((Component)eid).gameObject.AddComponent(); EnemyType enemyType = eid.enemyType; EnemyType val2 = enemyType; if ((int)val2 != 17) { if ((int)val2 == 30) { val.SetSecondaryBarColor(new Color(1f, 64f / 85f, 0f)); val.secondaryBar = true; } } else { val.SetSecondaryBarColor(Color.green); val.secondaryBar = true; } return val; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "SpawnerArmExtras"; public const string PLUGIN_NAME = "SpawnerArmExtras"; public const string PLUGIN_VERSION = "6.0.3"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }