using System; using System.Collections.Generic; using System.Diagnostics; 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 REPOLib.Modules; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("linkoid")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EnemySpawning")] [assembly: AssemblyTitle("EnemySpawning")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Nacho.Repo.EnemySpawning { [HarmonyPatch(typeof(ChatManager))] internal class ChatManagerPatch { [HarmonyPatch("MessageSend")] [HarmonyPrefix] private static void MessageSend_Prefix(ChatManager __instance) { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClient()) { return; } if (((TMP_Text)__instance.chatText).text.Contains("list modded")) { foreach (EnemySetup registeredEnemy in Enemies.RegisteredEnemies) { foreach (GameObject spawnObject in registeredEnemy.spawnObjects) { EnemySpawning.Logger.LogInfo((object)((Object)spawnObject).name); } } } if (!((TMP_Text)__instance.chatText).text.Contains("spawn ")) { return; } string text = ((TMP_Text)__instance.chatText).text.Replace("|", string.Empty); string[] array = text.Split(' '); if (array.Length <= 1 || text.Contains("gnome") || text.Contains("bang")) { return; } string text2 = string.Join(" ", array.Skip(1)); string text3 = "Enemies/Enemy - " + text2; GameObject val = null; foreach (EnemySetup registeredEnemy2 in Enemies.RegisteredEnemies) { foreach (GameObject spawnObject2 in registeredEnemy2.spawnObjects) { if (((Object)spawnObject2).name.Contains(text2)) { val = spawnObject2; } } } if (!((Object)(object)val != (Object)null) && !Object.op_Implicit((Object)(object)Resources.Load(text3))) { return; } if ((Object)(object)val == (Object)null) { val = Resources.Load(text3); } EnemySetup val2 = ScriptableObject.CreateInstance(); val2.spawnObjects = new List { val }; LevelPoint val3 = null; float num = 500f; foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints) { if (Vector3.Distance(((Component)levelPathPoint).transform.position, ((Component)PlayerController.instance).transform.position) < num) { val3 = levelPathPoint; num = Vector3.Distance(((Component)levelPathPoint).transform.position, ((Component)PlayerController.instance).transform.position); } } if ((Object)(object)val3 != (Object)null) { EnemySpawning.Instance.AboutToSpawn = true; RunManager.instance.EnemiesSpawnedRemoveStart(); LevelGenerator.Instance.EnemySpawn(val2, ((Component)val3).transform.position); EnemyDirector.instance.DebugResult(); EnemySpawning.Logger.LogInfo((object)(text2 + " spawned")); RunManager.instance.EnemiesSpawnedRemoveEnd(); } } } [BepInPlugin("Nacho.Repo.EnemySpawning", "Enemy Spawning", "1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EnemySpawning : BaseUnityPlugin { internal static EnemySpawning Instance; public bool AboutToSpawn; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) Instance = this; Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll(); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; } } [HarmonyPatch(typeof(SemiFunc))] internal class SemiFuncPatch { [HarmonyPatch("EnemySpawn")] [HarmonyPrefix] private static bool SemiFunc_Prefix(ref bool __result) { if (EnemySpawning.Instance.AboutToSpawn) { __result = true; EnemySpawning.Instance.AboutToSpawn = false; return false; } return true; } } }