using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AlwaysMusicChance.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AlwaysMusicChance")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("100% Specimen Chase Music Chance")]
[assembly: AssemblyTitle("AlwaysMusicChance")]
[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 AlwaysMusicChance
{
[BepInPlugin("AlwaysMusicChance", "100% Specimen Chase Music Chance", "1.0.0")]
public class MusicChancePlugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private readonly Harmony harmony = new Harmony("AlwaysMusicChance");
private static MusicChancePlugin Instance;
private void Awake()
{
Logger = Logger.CreateLogSource("AlwaysMusicChance");
Logger.LogInfo((object)"Plugin AlwaysMusicChance is loaded!");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll(typeof(MusicChancePlugin));
harmony.PatchAll(typeof(MusicChancePatch));
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "AlwaysMusicChance";
public const string PLUGIN_NAME = "100% Specimen Chase Music Chance";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AlwaysMusicChance.Patches
{
internal class MusicChancePatch
{
[HarmonyPatch(typeof(WakeGel), "Spawned")]
[HarmonyPostfix]
private static void Spec2Patch(WakeGel __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec3Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec3Patch(Spec3Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.specMusic);
}
[HarmonyPatch(typeof(Spec4Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec4Patch(Spec4Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(EMSpec4Controller), "Spawned")]
[HarmonyPostfix]
private static void EMSpec4Patch(EMSpec4Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec5Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec5Patch(Spec5Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec6Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec6Patch(Spec6Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec8Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec8Patch(Spec8Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec10Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec10Patch(Spec10Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec11Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec11Patch(Spec11Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(Spec13Controller), "Spawned")]
[HarmonyPostfix]
private static void Spec13Patch(Spec13Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(UnknownSpecimen2Controller), "Spawned")]
[HarmonyPostfix]
private static void UnknownSpec2Patch(UnknownSpecimen2Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(UnknownSpecimen3Controller), "Spawned")]
[HarmonyPostfix]
private static void UnknownSpec3Patch(UnknownSpecimen3Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(UnknownSpecimen4Controller), "Spawned")]
[HarmonyPostfix]
private static void UnknownSpec4Patch(UnknownSpecimen4Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
[HarmonyPatch(typeof(EMKHMonster4Controller), "Spawned")]
[HarmonyPostfix]
private static void Monster4Patch(EMKHMonster4Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.chaseMusic);
}
[HarmonyPatch(typeof(EMKHMonster6Controller), "Spawned")]
[HarmonyPostfix]
private static void Monster6Patch(EMKHMonster6Controller __instance)
{
EnsureTrack(((Component)__instance).gameObject, __instance.music);
}
private static void EnsureTrack(GameObject spec, AudioClip track)
{
if (ServiceLocator.GetService<AmbientSoundsController>().npcMusics.ContainsValue(track))
{
MusicChancePlugin.Logger.LogInfo((object)"Track was intended to play - doing nothing");
return;
}
MusicChancePlugin.Logger.LogInfo((object)"Track was intended to skip - forced it to play");
ServiceLocator.GetService<AmbientSoundsController>().PlayNpcMusic(spec, track);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}