using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
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("Tyler1Hidden")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tyler1Hidden")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a0cb083-58fc-4fa0-9d0d-96ad03b346dd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Tyler1Hidden
{
[BepInPlugin("SteamBlizzard.Tyler1Hidden", "Tyler1 Hidden", "1.0.0")]
public class Tyler1HiddenBase : BaseUnityPlugin
{
private const string modUID = "SteamBlizzard.Tyler1Hidden";
private const string modName = "Tyler1 Hidden";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("SteamBlizzard.Tyler1Hidden");
internal static Tyler1HiddenBase instance;
internal ManualLogSource logger;
internal static List<AudioClip> sounds;
internal static AssetBundle bundle;
private void Awake()
{
logger = Logger.CreateLogSource("Tyler1 Hidden");
logger.LogInfo((object)"Loading Tyler1 Hidden mod...");
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
else
{
Object.Destroy((Object)(object)this);
}
harmony.PatchAll();
sounds = new List<AudioClip>();
string location = ((BaseUnityPlugin)instance).Info.Location;
location = location.TrimEnd("Tyler1Hidden.dll".ToCharArray());
bundle = AssetBundle.LoadFromFile(location + "tyler1hidden");
if ((Object)(object)bundle == (Object)null)
{
logger.LogError((object)"Failed to load asset bundle!");
return;
}
sounds = bundle.LoadAllAssets<AudioClip>().ToList();
logger.LogInfo((object)("Loaded " + sounds.Count + " sounds from asset bundle! First sound: " + ((Object)sounds[0]).name));
logger.LogInfo((object)"Successfully started Tyler1 Hidden mod!");
}
}
}
namespace Tyler1Hidden.Patches
{
[HarmonyPatch(typeof(EnemyHidden))]
internal class EnemyHiddenPatch
{
private static Sound sound = new Sound();
private static bool initialized = false;
[HarmonyPatch("StatePlayerPickup")]
[HarmonyPostfix]
private static void statePlayerPickupPatch(EnemyHidden __instance, ref EnemyHiddenAnim ___enemyHiddenAnim)
{
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Invalid comparison between Unknown and I4
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
if (!initialized)
{
if (___enemyHiddenAnim.soundBreatheOutFast == null)
{
Tyler1HiddenBase.instance.logger.LogError((object)"Breathe out sound is null!");
return;
}
if (sound == null)
{
Tyler1HiddenBase.instance.logger.LogError((object)"Sound to copy to is null!");
return;
}
Sound.CopySound(___enemyHiddenAnim.soundBreatheOutFast, sound);
sound.Sounds = Tyler1HiddenBase.sounds.ToArray();
sound.PitchRandom = 0f;
sound.VolumeRandom = 0f;
sound.Volume = 1f;
AudioSource val = ((Component)__instance).gameObject.AddComponent<AudioSource>();
val.clip = Tyler1HiddenBase.sounds[0];
val.volume = 1f;
val.spatialBlend = 1f;
val.rolloffMode = (AudioRolloffMode)1;
val.minDistance = 1f;
val.maxDistance = 10f;
sound.Source = val;
initialized = true;
Tyler1HiddenBase.instance.logger.LogInfo((object)"Initialized Tyler1 Help sound!");
}
if ((int)__instance.currentState == 7)
{
sound.Play(__instance.playerPickupTransform.position, 1f, 1f, 1f, 1f);
}
}
}
}