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 HarmonyLib;
using Microsoft.CodeAnalysis;
using SpawnerArmExtras;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.ProBuilder;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SpawnerArmExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1")]
[assembly: AssemblyProduct("SpawnerArmExtras")]
[assembly: AssemblyTitle("SpawnerArmExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class util
{
public static T GetField<T>(string name, Type classType, object instance)
{
FieldInfo field = classType.GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
return (T)field.GetValue(instance);
}
public static void SetField<T>(string name, T newValue, Type classType, object instance)
{
FieldInfo field = classType.GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
field.SetValue(instance, newValue);
}
public static Texture2D LoadEmbeddedTexture(string resourceName)
{
//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))
{
return val;
}
Plugin.Logger.LogError((object)"Failed to load embedded texture");
return null;
}
}
namespace SpawnerArmExtrasPatches
{
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).gameObject.GetComponent<Animator>();
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;
}
}
}
}
public class BlackHoleFromMortar : MonoBehaviour
{
public EnemyIdentifier source = null;
public void Update()
{
if ((Object)(object)source == (Object)null)
{
((Component)this).gameObject.GetComponent<BlackHoleProjectile>().Explode();
}
}
}
public class DisgraceSpawned : MonoBehaviour
{
[CompilerGenerated]
private sealed class <Dash>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int times;
public DisgraceSpawned <>4__this;
private Vector3 <distance>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Dash>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_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)
//IL_0078: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.01f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (times > 0)
{
<distance>5__1 = ((Component)<>4__this.mf).transform.position - ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
Transform transform = ((Component)<>4__this).transform;
transform.position -= 0.1f * <distance>5__1;
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.Dash(times - 1));
}
else
{
Object.Instantiate<GameObject>(Plugin.Explosion, ((Component)<>4__this).transform.position, ((Component)<>4__this).transform.rotation);
<>4__this.dashing = false;
<>4__this.dashCooldown = 0f;
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public bool dashing = false;
public float dashCooldown = 0f;
public float dashCooldownMax = 0.6f;
public float randomizedSpeed;
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>();
follow.speed = 12f;
looker = ((Component)mf).gameObject.AddComponent<AlwaysLookAtCamera>();
mf.localScale = new Vector3(0.1f, 0.0875f, 0.0005f);
randomizedSpeed = Random.Range(-1f, 1f);
renderer = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
eid = ((Component)this).gameObject.GetComponent<EnemyIdentifier>();
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);
}
}
switch (util.GetField<int>("difficulty", typeof(EnemyIdentifier), eid))
{
case 5:
case 1109:
difficultySpeedModifier = 1.15f;
break;
case 4:
difficultySpeedModifier = 1f;
break;
case 3:
difficultySpeedModifier = 0.9f;
break;
case 2:
difficultySpeedModifier = 0.75f;
break;
case 1:
difficultySpeedModifier = 0.5f;
break;
case 0:
difficultySpeedModifier = 0.4f;
break;
}
dashCooldownMax /= difficultySpeedModifier;
}
[IteratorStateMachine(typeof(<Dash>d__11))]
public IEnumerator Dash(int times)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Dash>d__11(0)
{
<>4__this = this,
times = times
};
}
public void Update()
{
//IL_0057: 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_0067: 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_006f: 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_0178: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
if (eid.dead)
{
Object.Destroy((Object)(object)this);
}
if (!dashing && !BlindEnemies.Blind)
{
dashCooldown += Time.deltaTime;
}
NewMovement instance = MonoSingleton<NewMovement>.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 && !eid.dead)
{
dashing = true;
((MonoBehaviour)this).StartCoroutine(Dash(10));
}
if (num > 0.9f)
{
follow.speed = (3f + randomizedSpeed * 0.375f) * difficultySpeedModifier;
((Renderer)renderer).material.color = new Color(0.9f, 0.5f, 0.6f);
}
else
{
follow.speed = (8f + randomizedSpeed) * difficultySpeedModifier;
((Renderer)renderer).material.color = new Color(0.5f, 0.9f, 0.6f);
}
if (eid.dead)
{
((Renderer)renderer).material.color = ((Renderer)renderer).material.color / 3f;
}
if (BlindEnemies.Blind)
{
((Behaviour)follow).enabled = false;
((Behaviour)looker).enabled = false;
}
else
{
((Behaviour)follow).enabled = true;
((Behaviour)looker).enabled = true;
}
}
}
public class FromOneTimeParry : MonoBehaviour
{
public OneTimeParry source;
public void Awake()
{
source = null;
}
}
public class OneTimeParry : MonoBehaviour
{
[CompilerGenerated]
private sealed class <GotParried>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public OneTimeParry <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GotParried>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Object.Destroy((Object)(object)((Component)<>4__this.mine).gameObject);
<>4__this.disableObject.SetActive(false);
if ((Object)(object)<>4__this.mach != (Object)null)
{
Machine mach = <>4__this.mach;
mach.health -= <>4__this.subtractHealth;
}
Object.Destroy((Object)(object)<>4__this);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Landmine mine;
public GameObject disableObject;
public Machine mach;
public float subtractHealth;
public void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
mine = Object.Instantiate<GameObject>(Plugin.Landmine, ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<Landmine>();
((Component)mine).transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
((Component)mine).gameObject.AddComponent<FromOneTimeParry>().source = this;
Rigidbody component = ((Component)mine).gameObject.GetComponent<Rigidbody>();
component.isKinematic = true;
util.SetField("activated", newValue: true, typeof(Landmine), mine);
AudioSource component2 = ((Component)mine).gameObject.GetComponent<AudioSource>();
component2.volume = 0f;
util.SetField<AudioClip>("activatedBeep", null, typeof(Landmine), mine);
Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshCollider>());
Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<ProBuilderMesh>());
Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshRenderer>());
Object.Destroy((Object)(object)((Component)mine).gameObject.GetComponent<MeshFilter>());
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<AlwaysLookAtCamera>();
val.position = ((Component)this).transform.position;
val.localScale *= 3f;
}
[IteratorStateMachine(typeof(<GotParried>d__5))]
public IEnumerator GotParried()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GotParried>d__5(0)
{
<>4__this = this
};
}
public void Update()
{
if (util.GetField<bool>("parried", typeof(Landmine), mine))
{
((MonoBehaviour)this).StartCoroutine(GotParried());
}
}
}
public class WatchtowerSpawned : MonoBehaviour
{
[CompilerGenerated]
private sealed class <Shoot>d__12 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int times;
public WatchtowerSpawned <>4__this;
private Vector3 <playerPosition>5__1;
private Vector3 <playerVelocity>5__2;
private Vector3 <projectileOrigin>5__3;
private Vector3 <toTarget>5__4;
private float <a>5__5;
private float <b>5__6;
private float <c>5__7;
private float <discriminant>5__8;
private float <t>5__9;
private Vector3 <predictedPosition>5__10;
private float <sqrtDisc>5__11;
private float <t1>5__12;
private float <t2>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Shoot>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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)
//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_006f: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_00de: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: 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_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (times > 0)
{
<playerPosition>5__1 = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
<playerVelocity>5__2 = ((Component)MonoSingleton<NewMovement>.Instance).gameObject.GetComponent<Rigidbody>().velocity;
<projectileOrigin>5__3 = <>4__this.shootPoint.position;
<toTarget>5__4 = <playerPosition>5__1 - <projectileOrigin>5__3;
<a>5__5 = Vector3.Dot(<playerVelocity>5__2, <playerVelocity>5__2) - <>4__this.projectileSpeed * <>4__this.projectileSpeed;
<b>5__6 = 2f * Vector3.Dot(<playerVelocity>5__2, <toTarget>5__4);
<c>5__7 = Vector3.Dot(<toTarget>5__4, <toTarget>5__4);
<discriminant>5__8 = <b>5__6 * <b>5__6 - 4f * <a>5__5 * <c>5__7;
<t>5__9 = 0f;
if (<discriminant>5__8 > 0f)
{
<sqrtDisc>5__11 = Mathf.Sqrt(<discriminant>5__8);
<t1>5__12 = (0f - <b>5__6 + <sqrtDisc>5__11) / (2f * <a>5__5);
<t2>5__13 = (0f - <b>5__6 - <sqrtDisc>5__11) / (2f * <a>5__5);
<t>5__9 = Mathf.Max(<t1>5__12, <t2>5__13);
if (<t>5__9 < 0f)
{
<t>5__9 = Mathf.Min(<t1>5__12, <t2>5__13);
}
if (<t>5__9 < 0f)
{
<t>5__9 = 0f;
}
}
<predictedPosition>5__10 = <playerPosition>5__1 + <playerVelocity>5__2 * <t>5__9;
<>4__this.currentProjectile = Object.Instantiate<GameObject>(<>4__this.projectile, <>4__this.shootPoint.position, <>4__this.shootPoint.rotation).GetComponent<Projectile>();
((Component)<>4__this.currentProjectile).transform.LookAt(<predictedPosition>5__10);
<>4__this.currentProjectile.safeEnemyType = (EnemyType)35;
<>4__this.currentProjectile.speed = <>4__this.projectileSpeed;
<>2__current = (object)new WaitForSeconds(0.1f / <>4__this.difficultySpeedModifier);
<>1__state = 1;
return true;
}
<>4__this.shooting = false;
<>4__this.shootCooldown = 0f;
break;
case 1:
<>1__state = -1;
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.Shoot(times - 1));
break;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public bool shooting;
public Transform shootPoint;
public EnemyIdentifier eid;
public OneTimeParry otp;
public float shootCooldown = 0f;
public float shootCooldownMax = 1.5f;
public int shootCount = 6;
public GameObject projectile = Plugin.Projectile;
public Projectile currentProjectile;
public float projectileSpeed = 110f;
public float difficultySpeedModifier = 1f;
public void Start()
{
shootPoint = ((Component)this).gameObject.GetComponent<MortarLauncher>().shootPoint;
eid = ((Component)this).gameObject.GetComponent<EnemyIdentifier>();
otp = ((Component)((Component)shootPoint).transform.Find("Sphere (1)")).gameObject.AddComponent<OneTimeParry>();
otp.disableObject = ((Component)otp).gameObject;
otp.mach = ((Component)this).gameObject.GetComponent<Machine>();
otp.subtractHealth = 10f;
switch (util.GetField<int>("difficulty", typeof(EnemyIdentifier), eid))
{
case 5:
case 1109:
difficultySpeedModifier = 1.15f;
shootCount = 6;
break;
case 4:
difficultySpeedModifier = 1f;
shootCount = 6;
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;
}
shootCooldownMax /= difficultySpeedModifier;
projectileSpeed *= difficultySpeedModifier;
}
[IteratorStateMachine(typeof(<Shoot>d__12))]
public IEnumerator Shoot(int times)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Shoot>d__12(0)
{
<>4__this = this,
times = times
};
}
public void Update()
{
if (!shooting && !BlindEnemies.Blind)
{
shootCooldown += Time.deltaTime;
}
if (shootCooldown >= shootCooldownMax && !shooting && !BlindEnemies.Blind)
{
shooting = true;
((MonoBehaviour)this).StartCoroutine(Shoot(shootCount));
}
}
}
public class HidePreviewIfNotInHand : MonoBehaviour
{
public void Update()
{
if (Object.op_Implicit((Object)(object)((Component)this).transform.parent) && ((Object)((Component)this).transform.parent).name == "Holder")
{
((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
}
else
{
((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
}
}
}
[HarmonyPatch(typeof(SpawnMenu))]
public class SpawnMenuPatch
{
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_0044: 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<GameObject>(obj);
val2.transform.position = new Vector3(0f, 0f, 0f);
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_0052: 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<GameObject>(val2);
val3.transform.position = new Vector3(0f, 0f, 0f);
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_0032: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
Object.DontDestroyOnLoad((Object)(object)val);
val.AddComponent<HidePreviewIfNotInHand>();
GameObject val2 = Object.Instantiate<GameObject>(obj);
val2.transform.position = new Vector3(0f, 0f, 0f);
val2.transform.SetParent(val.transform);
DisableVertexLighting(val2);
return val;
}
public static void DisableVertexLighting(GameObject obj)
{
SkinnedMeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer val in componentsInChildren)
{
Material[] materials = ((Renderer)val).materials;
foreach (Material val2 in materials)
{
val2.DisableKeyword("VERTEX_LIGHTING");
}
}
MeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val3 in componentsInChildren2)
{
Material[] materials2 = ((Renderer)val3).materials;
foreach (Material val4 in materials2)
{
val4.DisableKeyword("VERTEX_LIGHTING");
}
}
}
public static Color MakeColor(string enemy = "")
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0061: 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_0078: 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_008f: 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)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
return (Color)(enemy switch
{
"husk" => new Color(0.898f, 0.6588f, 0.6588f),
"machine" => new Color(0.4784f, 0.6196f, 0.851f),
"demon" => new Color(0.5176f, 0.9059f, 0.5098f),
"angel" => new Color(1f, 0.9091f, 0.4481f),
_ => new Color(0.75f, 0.75f, 0.75f),
});
}
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(ref SpawnMenu __instance, ref SpawnableObjectsDatabase ___objects)
{
//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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_00dc: 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_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: Unknown result type (might be due to invalid IL or missing references)
//IL_0509: Unknown result type (might be due to invalid IL or missing references)
//IL_0535: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_054c: Unknown result type (might be due to invalid IL or missing references)
//IL_0554: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0609: Unknown result type (might be due to invalid IL or missing references)
//IL_0665: Unknown result type (might be due to invalid IL or missing references)
//IL_068e: Unknown result type (might be due to invalid IL or missing references)
//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0715: Unknown result type (might be due to invalid IL or missing references)
//IL_074f: Unknown result type (might be due to invalid IL or missing references)
//IL_076b: Unknown result type (might be due to invalid IL or missing references)
//IL_079b: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.addedEnemies)
{
SpawnableObject val = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val).name = "Wicked";
val.gameObject = MakeGameObject("WickedSpawned", Plugin.Wicked);
val.backgroundColor = MakeColor();
val.spawnableObjectType = (SpawnableObjectDataType)1;
val.enemyType = (EnemyType)10;
val.gridIcon = MakeIcon(Plugin.WickedIcon);
((Object)val.gridIcon).name = "WickedIcon";
SpawnableObject val2 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val2).name = "Minos";
val2.gameObject = MakeGameObject("MinosSpawned", Plugin.Minos);
val2.gameObject.transform.GetChild(0).position = new Vector3(150f, -580f, 0f);
val2.backgroundColor = MakeColor("husk");
val2.spawnableObjectType = (SpawnableObjectDataType)1;
val2.enemyType = (EnemyType)11;
val2.gridIcon = MakeIcon(Plugin.MinosIcon);
((Object)val2.gridIcon).name = "MinosIcon";
SpawnableObject val3 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val3).name = "MinosArm";
val3.gameObject = MakeGameObject("MinosArmSpawned", Plugin.MinosArm);
val3.gameObject.transform.GetChild(0).position = new Vector3(165f, 0f, 0f);
val3.backgroundColor = MakeColor("husk");
val3.spawnableObjectType = (SpawnableObjectDataType)1;
val3.enemyType = (EnemyType)11;
val3.spawnOffset = 20f;
val3.gridIcon = MakeIcon(Plugin.MinosArmIcon);
((Object)val3.gridIcon).name = "MinosArmIcon";
SpawnableObject val4 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val4).name = "Minotaur";
val4.gameObject = MakeGameObject("MinotaurSpawned", Plugin.Minotaur);
val4.backgroundColor = MakeColor("demon");
val4.spawnableObjectType = (SpawnableObjectDataType)1;
val4.enemyType = (EnemyType)32;
val4.gridIcon = MakeIcon(Plugin.MinotaurIcon);
((Object)val4.gridIcon).name = "MinotaurIcon";
SpawnableObject val5 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val5).name = "DroneGhost";
val5.gameObject = MakeGameObject("DroneGhostSpawned", Plugin.DroneGhost);
((Component)val5.gameObject.transform.Find("DroneGhostFromCorpse(Clone)/Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(false);
val5.backgroundColor = MakeColor("machine");
val5.spawnableObjectType = (SpawnableObjectDataType)1;
val5.enemyType = (EnemyType)1;
val5.spawnOffset = 2f;
val5.gridIcon = MakeIcon(Plugin.DroneGhostIcon);
((Object)val5.gridIcon).name = "DroneGhostIcon";
SpawnableObject val6 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val6).name = "DroneFlesh";
val6.gameObject = MakeGameObject("DroneFleshSpawned", Plugin.DroneFlesh);
val6.backgroundColor = MakeColor();
val6.spawnableObjectType = (SpawnableObjectDataType)1;
val6.enemyType = (EnemyType)1;
val6.spawnOffset = 2f;
val6.gridIcon = MakeIcon(Plugin.DroneFleshIcon);
((Object)val6.gridIcon).name = "DroneFleshIcon";
SpawnableObject val7 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val7).name = "DroneFleshCamera";
val7.gameObject = MakeGameObject("DroneFleshCameraSpawned", Plugin.DroneFleshCamera);
val7.backgroundColor = MakeColor();
val7.spawnableObjectType = (SpawnableObjectDataType)1;
val7.enemyType = (EnemyType)1;
val7.spawnOffset = 2f;
val7.gridIcon = MakeIcon(Plugin.DroneFleshCameraIcon);
((Object)val7.gridIcon).name = "DroneFleshCameraIcon";
SpawnableObject val8 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val8).name = "DroneSkull";
val8.gameObject = MakeGameObject("DroneSkullSpawned", Plugin.DroneSkull);
val8.backgroundColor = MakeColor();
val8.spawnableObjectType = (SpawnableObjectDataType)1;
val8.enemyType = (EnemyType)1;
val8.spawnOffset = 2f;
val8.gridIcon = MakeIcon(Plugin.DroneSkullIcon);
((Object)val8.gridIcon).name = "DroneSkullIcon";
SpawnableObject val9 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val9).name = "BlackHoleMortar";
val9.gameObject = MakeGameObject("BlackHoleMortarSpawned", Plugin.CentaurMortar);
val9.backgroundColor = MakeColor("machine");
val9.spawnableObjectType = (SpawnableObjectDataType)1;
val9.enemyType = (EnemyType)35;
val9.gridIcon = MakeIcon(Plugin.BlackHoleMortarIcon);
((Object)val9.gridIcon).name = "BlackHoleMortarIcon";
SpawnableObject val10 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val10).name = "Disgrace";
val10.gameObject = MakeGameObject("DisgraceSpawned", Plugin.Spider);
val10.gameObject.transform.Find("Spider(Clone)/Body/MaliciousFace").localScale = new Vector3(0.1f, 0.0875f, 0.0005f);
((Renderer)val10.gameObject.GetComponentInChildren<SkinnedMeshRenderer>()).material.color = new Color(0.5f, 0.9f, 0.6f);
val10.gameObject.transform.GetChild(0).position = new Vector3(0f, -4f, 0f);
val10.backgroundColor = MakeColor("default");
val10.spawnableObjectType = (SpawnableObjectDataType)1;
val10.enemyType = (EnemyType)4;
val10.gridIcon = MakeIcon(Plugin.DisgraceIcon);
((Object)val10.gridIcon).name = "DisgraceIcon";
SpawnableObject val11 = ScriptableObject.CreateInstance<SpawnableObject>();
((Object)val11).name = "Watchtower";
val11.gameObject = MakeGameObject("WatchtowerSpawned", Plugin.CentaurTower);
val11.gameObject.transform.GetChild(0).localScale = new Vector3(10f, 25f, 10f);
Transform val12 = val11.gameObject.transform.GetChild(0).Find("Armature/Pole_Top/Sphere (1)");
val12.localScale = new Vector3(0.2f, 0.2f, 0.2f);
Object.Destroy((Object)(object)((Component)val12).GetComponent<ObjectActivator>());
Object.Destroy((Object)(object)((Component)val12).GetComponent<ScaleTransform>());
((Component)val12).gameObject.SetActive(false);
Transform val13 = val12.Find("Sphere (1)");
((Renderer)((Component)val13).GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0f);
Object.Destroy((Object)(object)((Component)val13).GetComponent<ScaleTransform>());
val13.localScale = new Vector3(1f, 1f, 1f);
val11.backgroundColor = MakeColor("machine");
val11.spawnableObjectType = (SpawnableObjectDataType)1;
val11.enemyType = (EnemyType)35;
val11.gridIcon = MakeIcon(Plugin.WatchtowerIcon);
((Object)val11.gridIcon).name = "WatchtowerIcon";
val11.preview = MakePreview("Watchtower Preview", Plugin.CentaurTowerPreview);
val11.preview.transform.GetChild(0).localScale = new Vector3(1.5f, 3.75f, 1.5f);
Transform val14 = val11.preview.transform.GetChild(0).Find("Armature/Pole_Top/Sphere (1)");
val14.localPosition = new Vector3(-0.45f, 0f, 0f);
val14.localScale = new Vector3(0.08f, 0.2f, 0.2f);
((Renderer)((Component)val14.Find("Sphere (1)")).GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0f);
List<SpawnableObject> list = ___objects.enemies.ToList();
list.AddRange((IEnumerable<SpawnableObject>)(object)new SpawnableObject[11]
{
val, val2, val3, val4, val5, val6, val7, val8, val9, val10,
val11
});
___objects.enemies = list.ToArray();
Plugin.addedEnemies = true;
}
}
}
[HarmonyPatch(typeof(MinosArm), "Retreat")]
public class MinosArmPatch
{
public static void Prefix(ref MinosArm __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("MinosArmSpawned"))
{
Object.Destroy((Object)(object)((Component)__instance).gameObject);
}
}
}
[HarmonyPatch(typeof(Wicked))]
public class WickedPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Wicked), "Start")]
public static void StartPostfix(ref Wicked __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("WickedSpawned"))
{
((Component)__instance).gameObject.AddComponent<WickedSpawned>();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Wicked), "Update")]
public static bool UpdatePrefix(ref Wicked __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("WickedSpawned") && !((Component)__instance).gameObject.GetComponent<WickedSpawned>().active)
{
return false;
}
if (BlindEnemies.Blind)
{
return false;
}
__instance.playerSpotTime = 999f;
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Wicked), "OnCollisionEnter")]
public static bool OnCollisionEnterPrefix(ref Wicked __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("WickedSpawned"))
{
WickedSpawned component = ((Component)__instance).gameObject.GetComponent<WickedSpawned>();
if (!component.active)
{
return false;
}
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Wicked), "GetHit")]
public static bool GetHitPrefix(ref Wicked __instance)
{
if (!((Component)__instance).gameObject.activeInHierarchy)
{
return false;
}
WickedSpawned component = ((Component)__instance).gameObject.GetComponent<WickedSpawned>();
if (((Object)((Component)__instance).transform.parent).name.Contains("WickedSpawned") && (Object)(object)component != (Object)null)
{
if (!component.immune)
{
component.active = false;
((Component)__instance).gameObject.GetComponent<Animator>().speed = 0f;
((Component)__instance).gameObject.GetComponent<NavMeshAgent>().speed = 0f;
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(KillAllEnemies))]
public class KillAllEnemiesPatch
{
public static void KillEnemy<T>() where T : MonoBehaviour
{
T[] array = Object.FindObjectsByType<T>((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<Wicked>();
KillAllEnemiesPatch.KillEnemy<GhostDrone>();
KillAllEnemiesPatch.KillEnemy<MinosArm>();
FromOneTimeParry[] array = Object.FindObjectsByType<FromOneTimeParry>((FindObjectsSortMode)0);
foreach (FromOneTimeParry fromOneTimeParry in array)
{
Object.Destroy((Object)(object)((Component)fromOneTimeParry).gameObject);
}
}
}
[HarmonyPatch(typeof(GhostDrone), "Start")]
public class GhostDronePatch
{
public static void Postfix(ref GhostDrone __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("DroneGhostSpawned"))
{
((Component)((Component)__instance).transform.Find("Armature/Root/GhostDrone_GlowPlane")).gameObject.SetActive(true);
}
}
}
[HarmonyPatch(typeof(MinotaurChase))]
public class MinotaurChasePatch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(MinotaurChase), "Start")]
public static void StartPrefix(ref MinotaurChase __instance, ref bool ___trackTarget, ref EnemyIdentifier ___eid)
{
//IL_002a: 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)
if (((Object)((Component)__instance).transform.parent).name.Contains("MinotaurSpawned"))
{
__instance.leashPosition = ((Component)__instance).transform.position;
___trackTarget = false;
___eid = ((Component)__instance).GetComponent<EnemyIdentifier>();
___eid.isBoss = false;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MinotaurChase), "Update")]
public static bool UpdatePrefix(ref MinotaurChase __instance, ref bool ___trackTarget, ref EnemyIdentifier ___eid)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("MinotaurSpawned") && ___eid.health <= 0f)
{
Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent).gameObject);
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SwordsMachine))]
public class SwordsMachinePatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(SwordsMachine), "Awake")]
public static void AwakePostfix(ref SwordsMachine __instance, ref EnemyIdentifier ___eid, ref Machine ___mach, ref bool ___bossVersion)
{
Plugin.Logger.LogWarning((object)1);
string text = "";
if ((Object)(object)((Component)__instance).transform.parent != (Object)null)
{
text = ((Object)((Component)__instance).transform.parent).name;
}
Plugin.Logger.LogWarning((object)2);
if (text.Contains("Tundra") && text.Contains("Spawned"))
{
Plugin.Logger.LogWarning((object)3);
__instance.bothPhases = true;
Plugin.Logger.LogWarning((object)4);
List<string> list = ___eid.weaknesses.ToList();
Plugin.Logger.LogWarning((object)"4a");
list.AddRange(new string[3] { "explosion", "ffexplosion", "fire" });
Plugin.Logger.LogWarning((object)"4b");
___eid.weaknesses = list.ToArray();
Plugin.Logger.LogWarning((object)5);
List<float> list2 = ___eid.weaknessMultipliers.ToList();
Plugin.Logger.LogWarning((object)"5a");
list2.AddRange(new float[3] { 1.75f, 1.75f, 1.75f });
Plugin.Logger.LogWarning((object)"5b");
___eid.weaknessMultipliers = list2.ToArray();
Plugin.Logger.LogWarning((object)6);
___mach.health = 50f;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SwordsMachine), "Start")]
public static void StartPostfix(ref SwordsMachine __instance, ref EnemyIdentifier ___eid, ref bool ___bossVersion)
{
string text = "";
if ((Object)(object)((Component)__instance).transform.parent != (Object)null)
{
text = ((Object)((Component)__instance).transform.parent).name;
}
if (text.Contains("Tundra") && text.Contains("Spawned"))
{
___bossVersion = false;
Object.Destroy((Object)(object)((Component)__instance).GetComponent<BossHealthBar>());
}
}
}
[HarmonyPatch(typeof(Flammable), "Burn")]
public class FlammablePatch
{
public static void Postfix(ref Flammable __instance, ref GameObject ___currentFire)
{
//IL_0061: 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_006e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_00dd: 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_00ef: 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)
if ((Object)(object)___currentFire != (Object)null && ((Object)___currentFire.transform.parent).name == "Marble_Head_2" && ((Object)((Component)__instance).transform.parent.parent.parent.parent).name.Contains("DisgraceSpawned"))
{
Vector3 localScale = ___currentFire.transform.localScale;
___currentFire.transform.localScale = new Vector3(localScale.x, localScale.y / 200f, localScale.z);
}
if ((Object)(object)___currentFire != (Object)null && ((Object)((Component)__instance).transform.parent.parent.parent).name.Contains("WatchtowerSpawned"))
{
Vector3 localScale2 = ___currentFire.transform.localScale;
___currentFire.transform.localScale = new Vector3(localScale2.x, localScale2.y * 0.3f, localScale2.z * 0.3f);
}
}
}
[HarmonyPatch(typeof(MortarLauncher), "ShootHoming")]
public class MortarLauncherBlackHolePatch
{
public static bool Prefix(ref MortarLauncher __instance, ref EnemyIdentifier ___eid, ref Animator ___anim)
{
//IL_006a: 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)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
if (((Object)((Component)__instance).transform.parent).name.Contains("BlackHoleMortarSpawned"))
{
BlackHoleFromMortar[] array = Object.FindObjectsByType<BlackHoleFromMortar>((FindObjectsSortMode)0);
foreach (BlackHoleFromMortar blackHoleFromMortar in array)
{
if ((Object)(object)blackHoleFromMortar.source == (Object)(object)___eid)
{
return false;
}
}
BlackHoleProjectile component = Object.Instantiate<GameObject>(Plugin.BlackHole, __instance.shootPoint.position, __instance.shootPoint.rotation).GetComponent<BlackHoleProjectile>();
Transform transform = ((Component)component).transform;
transform.localScale *= 3f;
component.safeType = (EnemyType)35;
component.Activate();
((Component)component).gameObject.AddComponent<BlackHoleFromMortar>().source = ___eid;
if (Object.op_Implicit((Object)(object)___anim))
{
___anim.Play("Shoot", 0, 0f);
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SpiderBody))]
public class SpiderBodyPatch
{
[CompilerGenerated]
private sealed class <DisgraceDeath>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform tr;
private Vector3 <pos>5__1;
private Quaternion <rot>5__2;
private Transform <gib>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisgraceDeath>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<gib>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0052: 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_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_0073: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<pos>5__1 = tr.position;
<rot>5__2 = tr.rotation;
Object.Instantiate<GameObject>(Plugin.Explosion, <pos>5__1, <rot>5__2);
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<gib>5__3 = Object.Instantiate<GameObject>(Plugin.DisgraceBrainGib, <pos>5__1 + new Vector3(0f, -3f, 0f), <rot>5__2).transform;
<gib>5__3.localScale = new Vector3(1.5f, 1.5f, 4.5f);
Object.Destroy((Object)(object)((Component)tr.parent.parent).gameObject);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<DisgraceDeath>d__0))]
public static IEnumerator DisgraceDeath(Transform tr)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisgraceDeath>d__0(0)
{
tr = tr
};
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SpiderBody), "Start")]
public static void StartPostfix(ref SpiderBody __instance)
{
if (((Object)((Component)__instance).transform.parent.parent).name.Contains("DisgraceSpawned"))
{
__instance.health = 20f;
((Component)__instance).gameObject.AddComponent<DisgraceSpawned>();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SpiderBody), "Die")]
public static bool DiePrefix(ref SpiderBody __instance)
{
if (((Object)((Component)__instance).transform.parent.parent).name.Contains("DisgraceSpawned"))
{
((MonoBehaviour)__instance).StartCoroutine(DisgraceDeath(((Component)__instance).transform));
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SpiderBody), "Update")]
public static bool UpdatePrefix(ref SpiderBody __instance)
{
if (((Object)((Component)__instance).transform.parent.parent).name.Contains("DisgraceSpawned"))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(MortarLauncher))]
public class MortarLauncherWatchtowerPatch
{
[CompilerGenerated]
private sealed class <ShowSphere>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform tr;
private Transform <objSphere>5__1;
private Transform <subSphere>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ShowSphere>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<objSphere>5__1 = null;
<subSphere>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_007d: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.85f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<objSphere>5__1 = tr.Find("Armature/Pole_Top/Sphere (1)");
((Component)<objSphere>5__1).gameObject.SetActive(true);
<objSphere>5__1.localScale = new Vector3(0.08f, 0.2f, 0.2f);
<objSphere>5__1.localPosition = new Vector3(-0.45f, 0f, 0f);
<subSphere>5__2 = <objSphere>5__1.Find("Sphere (1)");
((Component)<subSphere>5__2).gameObject.SetActive(true);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<ShowSphere>d__0))]
public static IEnumerator ShowSphere(Transform tr)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ShowSphere>d__0(0)
{
tr = tr
};
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MortarLauncher), "Start")]
public static void StartPostfix(ref MortarLauncher __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("WatchtowerSpawned"))
{
((Component)__instance).gameObject.GetComponent<Machine>().health = 30f;
((Component)__instance).gameObject.AddComponent<WatchtowerSpawned>();
((MonoBehaviour)__instance).StartCoroutine(ShowSphere(((Component)__instance).transform));
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MortarLauncher), "Update")]
public static bool UpdatePrefix(ref MortarLauncher __instance)
{
if (((Object)((Component)__instance).transform.parent).name.Contains("WatchtowerSpawned"))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Landmine))]
public class LandminePatch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(Landmine), "Parry")]
public static bool SetColorPrefix(ref Landmine __instance, ref bool ___parried)
{
FromOneTimeParry component = ((Component)__instance).gameObject.GetComponent<FromOneTimeParry>();
if ((Object)(object)component != (Object)null)
{
___parried = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(DroneFlesh), "Start")]
public class DroneFleshPatch
{
public static void Postfix(ref DroneFlesh __instance)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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)
string name = ((Object)((Component)__instance).transform.parent).name;
if ((!name.Contains("DroneFlesh") && !name.Contains("DroneSkull")) || !name.Contains("Spawned"))
{
return;
}
FleshPrison[] array = Object.FindObjectsByType<FleshPrison>((FindObjectsSortMode)0);
FleshPrison val = null;
FleshPrison[] array2 = array;
foreach (FleshPrison val2 in array2)
{
if ((Object)(object)val == (Object)null)
{
val = val2;
}
else if (Vector3.Distance(((Component)__instance).transform.position, ((Component)val2).transform.position) < Vector3.Distance(((Component)__instance).transform.position, ((Component)val).transform.position))
{
val = val2;
}
}
if ((Object)(object)val == (Object)null)
{
return;
}
val.currentDrones.Add(__instance);
if (util.GetField<bool>("healing", typeof(FleshPrison), val))
{
LineToPoint val3 = default(LineToPoint);
if (Object.Instantiate<GameObject>(val.healingTargetEffect, ((Component)__instance).transform).TryGetComponent<LineToPoint>(ref val3))
{
val3.targets[1] = val.rotationBone;
}
Rigidbody val4 = default(Rigidbody);
if (((Component)__instance).TryGetComponent<Rigidbody>(ref val4))
{
val4.isKinematic = true;
}
}
}
}
}
namespace SpawnerArmExtras
{
[BepInPlugin("billy.spawnerarmextras", "SpawnerArmExtras", "2.0.1")]
public class Plugin : BaseUnityPlugin
{
private static readonly Harmony Harmony = new Harmony("billy.spawnerarmextras");
internal static ManualLogSource Logger;
public static bool addedEnemies = false;
public static GameObject Wicked;
public static Texture2D WickedIcon;
public static GameObject Minos;
public static Texture2D MinosIcon;
public static GameObject MinosArm;
public static Texture2D MinosArmIcon;
public static GameObject Minotaur;
public static Texture2D MinotaurIcon;
public static GameObject DroneGhost;
public static Texture2D DroneGhostIcon;
public static GameObject DroneFlesh;
public static Texture2D DroneFleshIcon;
public static GameObject DroneFleshCamera;
public static Texture2D DroneFleshCameraIcon;
public static GameObject DroneSkull;
public static Texture2D DroneSkullIcon;
public static GameObject CentaurMortar;
public static Texture2D BlackHoleMortarIcon;
public static GameObject BlackHole;
public static GameObject Spider;
public static Texture2D DisgraceIcon;
public static GameObject Explosion;
public static GameObject DisgraceBrainGib;
public static GameObject CentaurTower;
public static Texture2D WatchtowerIcon;
public static GameObject CentaurTowerPreview;
public static GameObject Projectile;
public static GameObject Landmine;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin SpawnerArmExtras is loaded!");
LoadAssets();
Harmony.PatchAll();
}
public T Ass<T>(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<T>((object)path).WaitForCompletion();
}
public void LoadAssets()
{
Wicked = Ass<GameObject>("Assets/Prefabs/Enemies/Wicked.prefab");
WickedIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.WickedIcon.png");
Minos = Ass<GameObject>("Assets/Prefabs/Enemies/MinosBoss.prefab");
MinosIcon = Ass<Texture2D>("Assets/Textures/UI/Spawn Menu/Minos.png");
MinosArm = Ass<GameObject>("Assets/Prefabs/Enemies/MinosArm.prefab");
MinosArmIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.MinosArmIcon.png");
Minotaur = Ass<GameObject>("Assets/Prefabs/Enemies/MinotaurChase.prefab");
MinotaurIcon = Ass<Texture2D>("Assets/Textures/UI/Spawn Menu/Minotaur.png");
DroneGhost = Ass<GameObject>("Assets/Prefabs/Enemies/DroneGhostFromCorpse.prefab");
DroneGhostIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneGhostIcon.png");
DroneFlesh = Ass<GameObject>("Assets/Prefabs/Enemies/DroneFlesh.prefab");
DroneFleshIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneFleshIcon.png");
DroneFleshCamera = Ass<GameObject>("Assets/Prefabs/Enemies/DroneFleshCamera Variant.prefab");
DroneFleshCameraIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneFleshCameraIcon.png");
DroneSkull = Ass<GameObject>("Assets/Prefabs/Enemies/DroneSkull Variant.prefab");
DroneSkullIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DroneSkullIcon.png");
CentaurMortar = Ass<GameObject>("Assets/Prefabs/Enemies/CentaurMortar.prefab");
BlackHoleMortarIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.BlackHoleMortarIcon.png");
BlackHole = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Black Hole Enemy.prefab");
Spider = Ass<GameObject>("Assets/Prefabs/Enemies/Spider.prefab");
DisgraceIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.DisgraceIcon.png");
Explosion = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
DisgraceBrainGib = Ass<GameObject>("Assets/Prefabs/Gibs/Gib_BrainChunk.prefab");
CentaurTower = Ass<GameObject>("Assets/Prefabs/Enemies/CentaurTower.prefab");
WatchtowerIcon = util.LoadEmbeddedTexture("SpawnerArmExtras.assets.WatchtowerIcon.png");
CentaurTowerPreview = Ass<GameObject>("Assets/Prefabs/Spawner Previews/CentaurTower Preview.prefab");
Projectile = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab");
Landmine = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Landmine.prefab");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SpawnerArmExtras";
public const string PLUGIN_NAME = "SpawnerArmExtras";
public const string PLUGIN_VERSION = "2.0.1";
}
}