using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EnableAllEnemies.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EnableAllEnemies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnableAllEnemies")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b9a8ecbd-0dad-4d0d-858b-6f51f38e79e0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EnableAllEnemies
{
[BepInPlugin("Charell.EnableAllEnemies", "EnableAllEnemies", "1.0.0")]
public class EAE : BaseUnityPlugin
{
private const string modGUID = "Charell.EnableAllEnemies";
private const string modName = "EnableAllEnemies";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Charell.EnableAllEnemies");
public static EAE Instance;
internal ManualLogSource mls;
internal SelectableLevel CurrentLevel;
internal RoundManager CurrentRound;
internal List<SpawnableEnemyWithRarity> IndoorEnemyList = Instance.FixIndoorEnemySpawns();
internal List<SpawnableEnemyWithRarity> OutdoorEnemyList = Instance.FixOutdoorEnemySpawns();
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Charell.EnableAllEnemies");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
mls.LogInfo((object)"All enemies will be enabled on every moon!");
harmony.PatchAll(typeof(EAE));
harmony.PatchAll(typeof(EnableEnemies));
harmony.PatchAll(typeof(WaitForLevelGen));
harmony.PatchAll(typeof(CustomSoundsPatch));
harmony.PatchAll(typeof(PlayerPatch));
}
public List<SpawnableEnemyWithRarity> FixIndoorEnemySpawns()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0064: 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_0072: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Expected O, but got Unknown
//IL_0136: 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_0144: Expected O, but got Unknown
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Expected O, but got Unknown
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Expected O, but got Unknown
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Expected O, but got Unknown
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Expected O, but got Unknown
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Expected O, but got Unknown
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Expected O, but got Unknown
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Expected O, but got Unknown
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Expected O, but got Unknown
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Expected O, but got Unknown
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Expected O, but got Unknown
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Expected O, but got Unknown
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Expected O, but got Unknown
//IL_0428: Unknown result type (might be due to invalid IL or missing references)
//IL_042d: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Expected O, but got Unknown
//IL_047e: Unknown result type (might be due to invalid IL or missing references)
//IL_0485: Expected O, but got Unknown
//IL_0494: Unknown result type (might be due to invalid IL or missing references)
//IL_0499: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Expected O, but got Unknown
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Expected O, but got Unknown
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Expected O, but got Unknown
//IL_0556: Unknown result type (might be due to invalid IL or missing references)
//IL_055d: Expected O, but got Unknown
//IL_056c: Unknown result type (might be due to invalid IL or missing references)
//IL_0571: Unknown result type (might be due to invalid IL or missing references)
//IL_057a: Expected O, but got Unknown
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05c9: Expected O, but got Unknown
//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Expected O, but got Unknown
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
JesterAI val = null;
DressGirlAI val2 = null;
SandSpiderAI val3 = null;
CrawlerAI val4 = null;
BlobAI val5 = null;
CentipedeAI val6 = null;
FlowermanAI val7 = null;
HoarderBugAI val8 = null;
LassoManAI val9 = null;
PufferAI val10 = null;
SpringManAI val11 = null;
NutcrackerEnemyAI val12 = null;
ButlerEnemyAI val13 = null;
ClaySurgeonAI val14 = null;
Object[] array = Resources.FindObjectsOfTypeAll(typeof(JesterAI));
foreach (Object val15 in array)
{
val = (JesterAI)val15;
}
SpawnableEnemyWithRarity val16 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val != (Object)null)
{
val16.enemyType = ((EnemyAI)val).enemyType;
}
list.Add(val16);
Object[] array2 = Resources.FindObjectsOfTypeAll(typeof(DressGirlAI));
foreach (Object val17 in array2)
{
val2 = (DressGirlAI)val17;
}
SpawnableEnemyWithRarity val18 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val2 != (Object)null)
{
val18.enemyType = ((EnemyAI)val2).enemyType;
}
list.Add(val18);
Object[] array3 = Resources.FindObjectsOfTypeAll(typeof(SandSpiderAI));
foreach (Object val19 in array3)
{
val3 = (SandSpiderAI)val19;
}
SpawnableEnemyWithRarity val20 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val3 != (Object)null)
{
val20.enemyType = ((EnemyAI)val3).enemyType;
}
list.Add(val20);
Object[] array4 = Resources.FindObjectsOfTypeAll(typeof(CrawlerAI));
foreach (Object val21 in array4)
{
val4 = (CrawlerAI)val21;
}
SpawnableEnemyWithRarity val22 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val4 != (Object)null)
{
val22.enemyType = ((EnemyAI)val4).enemyType;
}
list.Add(val22);
Object[] array5 = Resources.FindObjectsOfTypeAll(typeof(BlobAI));
foreach (Object val23 in array5)
{
val5 = (BlobAI)val23;
}
SpawnableEnemyWithRarity val24 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val5 != (Object)null)
{
val24.enemyType = ((EnemyAI)val5).enemyType;
}
list.Add(val24);
Object[] array6 = Resources.FindObjectsOfTypeAll(typeof(CentipedeAI));
foreach (Object val25 in array6)
{
val6 = (CentipedeAI)val25;
}
SpawnableEnemyWithRarity val26 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val6 != (Object)null)
{
val26.enemyType = ((EnemyAI)val6).enemyType;
}
list.Add(val26);
Object[] array7 = Resources.FindObjectsOfTypeAll(typeof(FlowermanAI));
foreach (Object val27 in array7)
{
val7 = (FlowermanAI)val27;
}
SpawnableEnemyWithRarity val28 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val7 != (Object)null)
{
val28.enemyType = ((EnemyAI)val7).enemyType;
}
list.Add(val28);
Object[] array8 = Resources.FindObjectsOfTypeAll(typeof(HoarderBugAI));
foreach (Object val29 in array8)
{
val8 = (HoarderBugAI)val29;
}
SpawnableEnemyWithRarity val30 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val8 != (Object)null)
{
val30.enemyType = ((EnemyAI)val8).enemyType;
}
list.Add(val30);
Object[] array9 = Resources.FindObjectsOfTypeAll(typeof(LassoManAI));
foreach (Object val31 in array9)
{
val9 = (LassoManAI)val31;
}
SpawnableEnemyWithRarity val32 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val9 != (Object)null)
{
val32.enemyType = ((EnemyAI)val9).enemyType;
}
list.Add(val32);
Object[] array10 = Resources.FindObjectsOfTypeAll(typeof(PufferAI));
foreach (Object val33 in array10)
{
val10 = (PufferAI)val33;
}
SpawnableEnemyWithRarity val34 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val10 != (Object)null)
{
val34.enemyType = ((EnemyAI)val10).enemyType;
}
list.Add(val34);
Object[] array11 = Resources.FindObjectsOfTypeAll(typeof(SpringManAI));
foreach (Object val35 in array11)
{
val11 = (SpringManAI)val35;
}
SpawnableEnemyWithRarity val36 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val11 != (Object)null)
{
val36.enemyType = ((EnemyAI)val11).enemyType;
}
list.Add(val36);
Object[] array12 = Resources.FindObjectsOfTypeAll(typeof(NutcrackerEnemyAI));
foreach (Object val37 in array12)
{
val12 = (NutcrackerEnemyAI)val37;
}
SpawnableEnemyWithRarity val38 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val12 != (Object)null)
{
val38.enemyType = ((EnemyAI)val12).enemyType;
}
list.Add(val38);
Object[] array13 = Resources.FindObjectsOfTypeAll(typeof(ButlerEnemyAI));
foreach (Object val39 in array13)
{
val13 = (ButlerEnemyAI)val39;
}
SpawnableEnemyWithRarity val40 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val13 != (Object)null)
{
val40.enemyType = ((EnemyAI)val13).enemyType;
}
list.Add(val40);
Object[] array14 = Resources.FindObjectsOfTypeAll(typeof(ClaySurgeonAI));
foreach (Object val41 in array14)
{
val14 = (ClaySurgeonAI)val41;
}
SpawnableEnemyWithRarity val42 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val14 != (Object)null)
{
val42.enemyType = ((EnemyAI)val14).enemyType;
}
list.Add(val42);
return list;
}
public List<SpawnableEnemyWithRarity> FixOutdoorEnemySpawns()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_004f: 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_005d: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//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_012f: Expected O, but got Unknown
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Expected O, but got Unknown
//IL_018b: 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_0199: Expected O, but got Unknown
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Expected O, but got Unknown
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Expected O, but got Unknown
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Expected O, but got Unknown
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Expected O, but got Unknown
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
DressGirlAI val = null;
SandWormAI val2 = null;
MouthDogAI val3 = null;
BaboonBirdAI val4 = null;
DocileLocustBeesAI val5 = null;
DoublewingAI val6 = null;
ForestGiantAI val7 = null;
Object[] array = Resources.FindObjectsOfTypeAll(typeof(DressGirlAI));
foreach (Object val8 in array)
{
val = (DressGirlAI)val8;
}
SpawnableEnemyWithRarity val9 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val != (Object)null)
{
val9.enemyType = ((EnemyAI)val).enemyType;
}
list.Add(val9);
Object[] array2 = Resources.FindObjectsOfTypeAll(typeof(SandWormAI));
foreach (Object val10 in array2)
{
val2 = (SandWormAI)val10;
}
SpawnableEnemyWithRarity val11 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val2 != (Object)null)
{
val11.enemyType = ((EnemyAI)val2).enemyType;
}
list.Add(val11);
Object[] array3 = Resources.FindObjectsOfTypeAll(typeof(MouthDogAI));
foreach (Object val12 in array3)
{
val3 = (MouthDogAI)val12;
}
SpawnableEnemyWithRarity val13 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val3 != (Object)null)
{
val13.enemyType = ((EnemyAI)val3).enemyType;
}
list.Add(val13);
Object[] array4 = Resources.FindObjectsOfTypeAll(typeof(BaboonBirdAI));
foreach (Object val14 in array4)
{
val4 = (BaboonBirdAI)val14;
}
SpawnableEnemyWithRarity val15 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val4 != (Object)null)
{
val15.enemyType = ((EnemyAI)val4).enemyType;
}
list.Add(val15);
Object[] array5 = Resources.FindObjectsOfTypeAll(typeof(DocileLocustBeesAI));
foreach (Object val16 in array5)
{
val5 = (DocileLocustBeesAI)val16;
}
SpawnableEnemyWithRarity val17 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val5 != (Object)null)
{
val17.enemyType = ((EnemyAI)val5).enemyType;
}
list.Add(val17);
Object[] array6 = Resources.FindObjectsOfTypeAll(typeof(DoublewingAI));
foreach (Object val18 in array6)
{
val6 = (DoublewingAI)val18;
}
SpawnableEnemyWithRarity val19 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val6 != (Object)null)
{
val19.enemyType = ((EnemyAI)val6).enemyType;
}
list.Add(val19);
Object[] array7 = Resources.FindObjectsOfTypeAll(typeof(ForestGiantAI));
foreach (Object val20 in array7)
{
val7 = (ForestGiantAI)val20;
}
SpawnableEnemyWithRarity val21 = new SpawnableEnemyWithRarity
{
rarity = 1
};
if ((Object)(object)val7 != (Object)null)
{
val21.enemyType = ((EnemyAI)val7).enemyType;
}
list.Add(val21);
return list;
}
}
public static class ENEMIES
{
public static string JESTER = "Jester";
public static string GIRL = "Girl";
public static string SPIDER = "Bunker Spider";
public static string THUMPER = "Crawler";
public static string BLOB = "Blob";
public static string BRACKEN = "Flowerman";
public static string YIPPEE = "Hoarding bug";
public static string LASSO = "Lasso";
public static string SPORELIZARD = "Puffer";
public static string COILHEAD = "Spring";
public static string NUTCRACKER = "Nutcracker";
public static string BUTLER = "Butler";
public static string CLAYSURGEON = "Clay Surgeon";
}
}
namespace EnableAllEnemies.Patches
{
[HarmonyPatch(typeof(StartOfRound))]
internal class CustomSoundsPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(StartOfRound __instance)
{
}
}
[HarmonyPatch(typeof(RoundManager))]
internal class EnableEnemies
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void RoundManagerStart(RoundManager __instance)
{
EAE.Instance.CurrentRound = __instance;
EAE.Instance.CurrentRound.currentEnemyPower = 10f;
EAE.Instance.CurrentRound.scrapAmountMultiplier = 5f;
}
[HarmonyPatch("LoadNewLevel")]
[HarmonyPrefix]
private static void ModifyLevel(ref SelectableLevel newLevel)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
newLevel.Enemies = EAE.Instance.FixIndoorEnemySpawns();
newLevel.OutsideEnemies = EAE.Instance.FixOutdoorEnemySpawns();
newLevel.currentWeather = (LevelWeatherType)5;
newLevel.DaySpeedMultiplier = 2f;
EAE.Instance.CurrentLevel = newLevel;
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePlayer(ref float ___sprintMeter, ref float ___movementSpeed, ref float ___climbSpeed)
{
___movementSpeed = 5f;
___climbSpeed = 10f;
}
}
internal class SpawnEnemiesAtStart
{
private static SpawnableEnemyWithRarity e;
private static int A;
internal static void SpawnEnemyAtRandomLocation(SpawnableEnemyWithRarity enemy, int Amount = 1)
{
//IL_004b: 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)
e = enemy;
A = Amount;
try
{
for (int i = 0; i < A; i++)
{
EnemyVent val = EAE.Instance.CurrentRound.allEnemyVents[Random.Range(0, EAE.Instance.CurrentRound.allEnemyVents.Length)];
EAE.Instance.CurrentRound.SpawnEnemyOnServer(val.floorNode.position, val.floorNode.eulerAngles.y, EAE.Instance.CurrentLevel.Enemies.IndexOf(e));
}
EAE.Instance.mls.LogInfo((object)$"Successfully spawned {Amount}x {enemy.enemyType.enemyName}");
}
catch (Exception ex)
{
EAE.Instance.mls.LogError((object)("Failed to spawn enemies.\n ERROR :\n " + ex.Message));
}
}
}
[HarmonyPatch(typeof(RoundManager))]
internal class WaitForLevelGen
{
private static bool spawned;
[HarmonyPatch("FinishGeneratingNewLevelClientRpc")]
[HarmonyPrefix]
private static void SpawnEnemy()
{
if (spawned)
{
return;
}
EAE.Instance.mls.LogError((object)"Tries to spawn enemy now");
foreach (SpawnableEnemyWithRarity enemy in EAE.Instance.CurrentLevel.Enemies)
{
if (enemy.enemyType.enemyName.ToLower() == ENEMIES.JESTER.ToLower())
{
SpawnEnemiesAtStart.SpawnEnemyAtRandomLocation(enemy);
spawned = true;
}
}
}
}
}