using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("FairRandomSpawns")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FairRandomSpawns")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4b33232a-3270-4550-86a0-a64486f06749")]
[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 FairRandomSpawns;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Toshizuno-FairRandomSpawns", "FairRandomSpawns", "1.0.0")]
public class FairRandomSpawns : BaseUnityPlugin
{
[HarmonyPatch]
internal class FairSpawnPatch
{
[HarmonyTargetMethod]
private static MethodBase TargetMethod()
{
return AccessTools.Method(AccessTools.TypeByName("ControlCompany.Core.ControlCenter"), "SpawnControllableEnemy", (Type[])null, (Type[])null);
}
private static void Prefix(ref Vector3 position, ref Quaternion rotation, object __instance)
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_0063: 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)
if ((bool)AccessTools.Field(AccessTools.TypeByName("ControlCompany.Core.ControlCenter"), "isGhostIndoors").GetValue(__instance))
{
RoundManager.Instance.RefreshEnemyVents();
EnemyVent val = RoundManager.Instance.allEnemyVents[new Random().Next(RoundManager.Instance.allEnemyVents.Count())];
position = val.floorNode.position;
rotation = val.floorNode.rotation;
}
else
{
position = GameObject.FindGameObjectsWithTag("OutsideAINode")[new Random().Next(GameObject.FindGameObjectsWithTag("OutsideAINode").Count())].transform.position;
}
}
}
public const string PLUGIN_GUID = "Toshizuno-FairRandomSpawns";
public const string PLUGIN_NAME = "FairRandomSpawns";
public const string PLUGIN_VERSION = "1.0.0";
private readonly Harmony FairRandomSpawnsHarmony = new Harmony("Toshizuno-FairRandomSpawns");
private static FairRandomSpawns Instance;
internal readonly ManualLogSource FairRandomSpawnsManualLogSource = Logger.CreateLogSource("Toshizuno-FairRandomSpawns");
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
FairRandomSpawnsManualLogSource.LogFatal((object)"Harmonizing FairRandomSpawns...");
FairRandomSpawnsHarmony.PatchAll(typeof(FairRandomSpawns));
FairRandomSpawnsManualLogSource.LogFatal((object)"FairRandomSpawns is now harmonized.");
FairRandomSpawnsManualLogSource.LogFatal((object)"Harmonizing FairSpawnPatch...");
FairRandomSpawnsHarmony.PatchAll(typeof(FairSpawnPatch));
FairRandomSpawnsManualLogSource.LogFatal((object)"FairSpawnPatch is now harmonized.");
}
}