using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using API;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using OldBulkheadDoorHarmony.BepInEx;
using UnityEngine;
using UnityEngine.Analytics;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("OldBulkheadDoorHarmony")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+88ce26c8c772a06ee28d6abc92b7580b5b9f3b3b")]
[assembly: AssemblyProduct("OldBulkheadDoorHarmony")]
[assembly: AssemblyTitle("OldBulkheadDoorHarmony")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace OldBulkheadDoorHarmony
{
[HarmonyPatch]
internal static class Sound
{
private static CellSoundPlayer? _TempPlayer;
private static CellSoundPlayer sound;
private static CellSoundPlayer _EmptySoundPlayer
{
get
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (_TempPlayer == null)
{
_TempPlayer = new CellSoundPlayer();
_TempPlayer.UpdatePosition(new Vector3(0f, -9999999f, 0f));
}
return _TempPlayer;
}
}
private static IEnumerator PlaySound(CellSoundPlayer player, uint soundID, float delay)
{
yield return (object)new WaitForSeconds(delay);
if (player != null)
{
player.Post(soundID, false);
}
}
private static bool TryGetValidBulkheadAnim(LG_SecurityDoor door, out LG_SecurityDoor_Anim doorAnim)
{
doorAnim = null;
iLG_Door_Animation anim = door.m_anim;
if (anim == null)
{
return false;
}
LG_SecurityDoor_Anim val = ((Il2CppObjectBase)anim).TryCast<LG_SecurityDoor_Anim>();
if ((Object)(object)val == (Object)null)
{
return false;
}
if (!val.m_isBulkheadDoor)
{
return false;
}
if (val.m_bulkheadLightStrips == null)
{
return false;
}
doorAnim = val;
return true;
}
private static IEnumerator TurnOnStrip(Renderer strip, float delay)
{
yield return (object)new WaitForSeconds(delay);
if ((Object)(object)strip != (Object)null)
{
strip.material.SetColor("_EmissiveColor", Color.white);
}
}
[HarmonyPatch(typeof(LG_SecurityDoor), "OnDoorIsOpened")]
[HarmonyPostfix]
private static void Postfix_OnDoorIsOpened(LG_SecurityDoor __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
//IL_0037: Expected I4, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Expected O, but got Unknown
try
{
if ((int)__instance.m_securityDoorType != 2)
{
return;
}
LG_LayerType linksToLayerType = __instance.LinksToLayerType;
LG_LayerType val = linksToLayerType;
switch ((int)val)
{
case 0:
MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)__instance, PlaySound(__instance.m_sound, 2600464124u, 2.5f));
break;
case 1:
MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)__instance, PlaySound(__instance.m_sound, 2059166368u, 2.5f));
break;
case 2:
MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)__instance, PlaySound(__instance.m_sound, 1528229518u, 2.5f));
break;
}
if (TryGetValidBulkheadAnim(__instance, out LG_SecurityDoor_Anim doorAnim))
{
for (int i = 0; i < ((Il2CppArrayBase<Renderer>)(object)doorAnim.m_bulkheadLightStrips).Length; i++)
{
Renderer strip = ((Il2CppArrayBase<Renderer>)(object)doorAnim.m_bulkheadLightStrips)[i];
MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)__instance, TurnOnStrip(strip, 1f + 0.2f * (float)i));
}
}
}
catch (Exception data)
{
APILogger.Error(data);
}
}
[HarmonyPatch(typeof(LG_SecurityDoor), "OnDoorOpenStarted")]
[HarmonyPrefix]
private static void Prefix_OnDoorOpenStarted(LG_SecurityDoor __instance)
{
sound = __instance.m_sound;
__instance.m_sound = _EmptySoundPlayer;
}
[HarmonyPatch(typeof(LG_SecurityDoor), "OnDoorOpenStarted")]
[HarmonyPostfix]
private static void Postfix_OnDoorOpenStarted(LG_SecurityDoor __instance)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
__instance.m_sound = sound;
try
{
if (!TryGetValidBulkheadAnim(__instance, out LG_SecurityDoor_Anim doorAnim))
{
return;
}
foreach (Renderer item in (Il2CppArrayBase<Renderer>)(object)doorAnim.m_bulkheadLightStrips)
{
item.material.SetColor("_EmissiveColor", Color.black);
}
}
catch (Exception data)
{
APILogger.Error(data);
}
}
}
}
namespace OldBulkheadDoorHarmony.BepInEx
{
public static class Module
{
public const string GUID = "randomuserhi.OldBulkheadDoorHarmony";
public const string Name = "OldBulkheadDoorHarmony";
public const string Version = "0.0.1";
}
public static class ConfigManager
{
public static ConfigFile configFile;
private static ConfigEntry<bool> debug;
public static bool Debug
{
get
{
return debug.Value;
}
set
{
debug.Value = value;
}
}
static ConfigManager()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
string text = Path.Combine(Paths.ConfigPath, "OldBulkheadDoorHarmony.cfg");
configFile = new ConfigFile(text, true);
debug = configFile.Bind<bool>("Debug", "enable", false, "Enables debug messages when true.");
}
}
[BepInPlugin("randomuserhi.OldBulkheadDoorHarmony", "OldBulkheadDoorHarmony", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
private static Harmony? harmony;
public override void Load()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
APILogger.Log("Plugin is loaded!");
harmony = new Harmony("randomuserhi.OldBulkheadDoorHarmony");
harmony.PatchAll();
APILogger.Log("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled"));
}
}
}
namespace API
{
[HarmonyPatch(typeof(GameDataInit))]
internal class GameDataInit_Patches
{
[HarmonyPatch("Initialize")]
[HarmonyWrapSafe]
[HarmonyPostfix]
public static void Initialize_Postfix()
{
Analytics.enabled = false;
}
}
internal static class APILogger
{
private static readonly ManualLogSource logger;
static APILogger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
logger = new ManualLogSource("Rand-API");
Logger.Sources.Add((ILogSource)(object)logger);
}
private static string Format(string module, object msg)
{
return $"[{module}]: {msg}";
}
public static void Info(string module, object data)
{
logger.LogMessage((object)Format(module, data));
}
public static void Verbose(string module, object data)
{
logger.LogDebug((object)Format(module, data));
}
public static void Log(object data)
{
logger.LogDebug((object)Format("OldBulkheadDoorHarmony", data));
}
public static void Debug(object data)
{
if (ConfigManager.Debug)
{
Log(data);
}
}
public static void Warn(object data)
{
logger.LogWarning((object)Format("OldBulkheadDoorHarmony", data));
}
public static void Error(object data)
{
logger.LogError((object)Format("OldBulkheadDoorHarmony", data));
}
}
}