using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("BetterDoorWarning")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("On scan within the ship, items in the ship will be organized.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ddb3d21ad2b9075c1feb674e545c0b2628b1e7d3")]
[assembly: AssemblyProduct("BetterDoorWarning")]
[assembly: AssemblyTitle("BetterDoorWarning")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BetterDoorWarning
{
[HarmonyPatch]
internal class BetterDoorWarningFunctions
{
[HarmonyPatch(typeof(EntranceTeleport), "Update")]
private static class Patch
{
private static BetterDoorWarningFunctions betterDoorWarningFunctions = new BetterDoorWarningFunctions();
[HarmonyPrefix]
private static void Update(EntranceTeleport __instance)
{
//IL_0077: 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_00cd: 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)
__instance.enemyNearLastCheck = true;
if ((Object)(object)__instance.triggerScript == (Object)null || !__instance.isEntranceToBuilding)
{
return;
}
if ((double)__instance.checkForEnemiesInterval <= 0.0)
{
if (!__instance.gotExitPoint)
{
if (__instance.FindExitPoint())
{
__instance.gotExitPoint = true;
}
return;
}
__instance.checkForEnemiesInterval = 1f;
bool flag = false;
bool flag2 = false;
for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++)
{
if ((double)Vector3.Distance(((Component)RoundManager.Instance.SpawnedEnemies[i]).transform.position, ((Component)__instance.exitPoint).transform.position) < 7.699999809265137 && !RoundManager.Instance.SpawnedEnemies[i].isEnemyDead)
{
flag = true;
break;
}
if ((double)Vector3.Distance(((Component)RoundManager.Instance.SpawnedEnemies[i]).transform.position, ((Component)__instance.exitPoint).transform.position) < 7.699999809265137 && RoundManager.Instance.SpawnedEnemies[i].isEnemyDead)
{
flag2 = true;
break;
}
}
if (flag && !betterDoorWarningFunctions.lastCheckEnemy)
{
betterDoorWarningFunctions.lastCheckEnemy = true;
__instance.triggerScript.hoverTip = "[Near activity detected - He Alive]";
}
else if (flag2 && !betterDoorWarningFunctions.lastCheckEnemy)
{
betterDoorWarningFunctions.lastCheckEnemy = true;
__instance.triggerScript.hoverTip = "[Near activity detected - He Dead]";
}
else if (__instance.enemyNearLastCheck)
{
betterDoorWarningFunctions.lastCheckEnemy = false;
__instance.triggerScript.hoverTip = "Enter: [LMB]";
}
}
else
{
__instance.checkForEnemiesInterval -= Time.deltaTime;
}
}
}
private bool lastCheckEnemy;
}
[BepInPlugin("BetterDoorWarning", "BetterDoorWarning", "1.0.1")]
internal class BetterDoorWarning : BaseUnityPlugin
{
public static BetterDoorWarning instance;
private const string GUID = "BetterDoorWarning";
private const string NAME = "BetterDoorWarning";
private const string VERSION = "1.0.1";
public static void Log(string message)
{
((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
}
public static void LogError(string message)
{
((BaseUnityPlugin)instance).Logger.LogError((object)message);
}
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterDoorWarning is loaded!");
new Harmony("BetterDoorWarning").PatchAll(Assembly.GetExecutingAssembly());
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BetterDoorWarning";
public const string PLUGIN_NAME = "BetterDoorWarning";
public const string PLUGIN_VERSION = "1.0.0";
}
}