using System;
using System.Collections.Generic;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.VisualScripting;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("SlapItNow")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AxelFHidden")]
[assembly: AssemblyTitle("AxelFHidden")]
[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 AxelFHidden
{
[BepInPlugin("SlapItNow.AxelFHidden", "AxelFHidden", "22.0.1")]
public class AxelFHidden : BaseUnityPlugin
{
internal static class Assets
{
internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();
private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>();
public static void LoadAssetBundlesFromFolder(string folderName)
{
folderName = Path.Combine(Path.GetDirectoryName(PInfo.Location), folderName);
string[] files = Directory.GetFiles(folderName);
foreach (string text in files)
{
AssetBundle val = AssetBundle.LoadFromFile(text);
int count = AssetBundles.Count;
AssetBundles.Add(val);
string[] allAssetNames = val.GetAllAssetNames();
foreach (string text2 in allAssetNames)
{
string text3 = text2.ToLowerInvariant();
if (text3.StartsWith("assets/"))
{
text3 = text3.Remove(0, "assets/".Length);
}
Logger.LogInfo((object)$"paring [{text3}] with [{count}]");
AssetIndices[text3] = count;
}
Logger.LogInfo((object)("Loaded AssetBundle: " + Path.GetFileName(text)));
}
}
public static T Load<T>(string assetName) where T : Object
{
try
{
assetName = assetName.ToLowerInvariant();
if (assetName.Contains(":"))
{
string[] array = assetName.Split(':');
assetName = array[1].ToLowerInvariant();
}
if (assetName.StartsWith("assets/"))
{
assetName = assetName.Remove(0, "assets/".Length);
}
int index = AssetIndices[assetName];
return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
}
catch (Exception arg)
{
Logger.LogInfo((object)$"Couldn't load asset [{assetName}] reason: {arg}");
return default(T);
}
}
}
internal class AxelFHiddenAudioSource : MonoBehaviour
{
public AudioSource Source { get; private set; }
public void Awake()
{
Source = ((Component)this).gameObject.AddComponent<AudioSource>();
Source.playOnAwake = false;
Source.loop = true;
Source.outputAudioMixerGroup = AudioManager.instance.MasterMixer.outputAudioMixerGroup;
Source.clip = axelf;
}
}
public static AudioClip axelf;
internal static AxelFHidden Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
public static PluginInfo PInfo { get; private set; }
private void Awake()
{
PInfo = ((BaseUnityPlugin)this).Info;
Instance = this;
Assets.LoadAssetBundlesFromFolder("assetbundles");
axelf = Assets.Load<AudioClip>("crazyfrog-axelf.ogg");
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
[HarmonyPatch(typeof(EnemyHidden))]
internal static class HiddenEnemyPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void Awake_Postfix(EnemyHidden __instance)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
AudioSource source = ComponentHolderProtocol.AddComponent<AxelFHidden.AxelFHiddenAudioSource>((Object)(object)__instance).Source;
AudioSource source2 = __instance.enemyHiddenAnim.soundBreatheOut.Source;
source.spatialBlend = source2.spatialBlend;
source.minDistance = source2.minDistance;
source.maxDistance = source2.maxDistance;
source.rolloffMode = source2.rolloffMode;
source.dopplerLevel = source2.dopplerLevel;
source.volume = source2.volume * 0.08f;
source.pitch = source2.pitch;
source.panStereo = source2.panStereo;
source.reverbZoneMix = source2.reverbZoneMix;
source.priority = source2.priority;
}
[HarmonyPostfix]
[HarmonyPatch("StatePlayerPickup")]
private static void Pickup_Postfix(EnemyHidden __instance)
{
if (__instance.stateTimer <= 0f)
{
((Component)__instance).GetComponent<AxelFHidden.AxelFHiddenAudioSource>().Source.Play();
}
}
[HarmonyPostfix]
[HarmonyPatch("UpdateStateRPC")]
private static void UpdateStateRPC_Postfix(EnemyHidden __instance, State _state)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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: Invalid comparison between Unknown and I4
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
AudioSource source = ((Component)__instance).GetComponent<AxelFHidden.AxelFHiddenAudioSource>().Source;
if (!Object.op_Implicit((Object)(object)source))
{
return;
}
if ((int)_state != 6)
{
if ((_state - 10 <= 1 || (int)_state == 13) && source.isPlaying)
{
source.Stop();
}
}
else if (!source.isPlaying)
{
source.Play();
}
}
[HarmonyPrefix]
[HarmonyPatch("OnDeath")]
private static void Death_Prefix(EnemyHidden __instance)
{
AudioSource source = ((Component)__instance).GetComponent<AxelFHidden.AxelFHiddenAudioSource>().Source;
if (Object.op_Implicit((Object)(object)source) && source.isPlaying)
{
source.Stop();
}
}
}
}