using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using HarmonyLib.Tools;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LCSpringManSoundPackMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Replace Coil-head's sounds with voice clips and sound effects from the video game ARMS!")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
[assembly: AssemblyProduct("LCSpringManSoundPackMod")]
[assembly: AssemblyTitle("LCSpringManSoundPackMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.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 LCSpringManSoundPackMod
{
[BepInPlugin("LCSpringManSoundPackMod", "LCSpringManSoundPackMod", "1.2.1")]
public class Plugin : BaseUnityPlugin
{
public class Config
{
public static ConfigEntry<bool> configARMS;
public static ConfigEntry<bool> configSneakers;
public Config(ConfigFile cfg)
{
configARMS = cfg.Bind<bool>("Use Only ARMS Sounds", "Use Only ARMS Sounds", true, "Select whether to use only ARMS sound effects for Coil-head's spring noises (true), or add the ARMS sounds to the total list of sounds (false). False allows other mods to replace Coil-head's vanilla sounds on top of this mod.");
configSneakers = cfg.Bind<bool>("Use Sneaker Sounds", "Use Sneaker Sounds", false, "Select whether to replace Coil-head's footsteps with the sounds of squeaky sneakers (true), or keep Coil-head's vanilla footstep sounds (false). False allows you to not go insane quite as fast.");
}
}
public static Plugin instance;
internal static ManualLogSource Logger;
public static AssetBundle SpringManAssetBundle;
public static bool AlreadyAddedSpringNoises;
public static Config MyConfig { get; internal set; }
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin LCSpringManSoundPackMod is loaded!");
Harmony val = new Harmony("LCSpringManSoundPackMod");
val.PatchAll();
HarmonyFileLog.Enabled = false;
MyConfig = new Config(((BaseUnityPlugin)this).Config);
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
SpringManAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "springmanassetbundle"));
if ((Object)(object)SpringManAssetBundle == (Object)null)
{
Logger.LogError((object)"Failed to load SpringManAssetBundle");
return;
}
Logger.LogInfo((object)"Loaded SpringManAssetBundle");
if (Config.configARMS.Value)
{
Logger.LogInfo((object)"Config [Use Only ARMS Sounds] is TRUE. Using only ARMS sounds...");
}
else
{
Logger.LogInfo((object)"Config [Use Only ARMS Sounds] is FALSE. Adding ARMS sounds to total list of sounds, and ignoring kill-sound...");
}
if (Config.configSneakers.Value)
{
Logger.LogInfo((object)"Config [Use Sneakers Sounds] is TRUE. Tying shoelaces...");
}
else
{
Logger.LogInfo((object)"Config [Use Sneaker Sounds] is FALSE. Using regular Coil-head footstep sounds...");
}
}
public static AudioClip LoadAudioClip(string FileName)
{
return SpringManAssetBundle.LoadAsset<AudioClip>("Assets/" + FileName + ".ogg");
}
}
[HarmonyPatch(typeof(StartOfRound), "Start")]
public class NewStartOfRoundStart
{
[HarmonyPostfix]
public static void Postfix(StartOfRound __instance)
{
Plugin.Logger.LogDebug((object)"Setting Coil-head sounds...");
SelectableLevel val = null;
SelectableLevel[] levels = __instance.levels;
foreach (SelectableLevel val2 in levels)
{
if (((Object)val2).name == "RendLevel")
{
val = val2;
break;
}
}
if ((Object)(object)val == (Object)null)
{
return;
}
Plugin.Logger.LogDebug((object)"Found Rend successfully.");
EnemyType val3 = null;
foreach (SpawnableEnemyWithRarity enemy in val.Enemies)
{
if (((Object)enemy.enemyType).name == "SpringMan")
{
val3 = enemy.enemyType;
}
}
if (!((Object)(object)val3 == (Object)null))
{
Plugin.Logger.LogDebug((object)"Found Coil-head successfully.");
AudioClip[] springNoises = val3.enemyPrefab.GetComponent<SpringManAI>().springNoises;
if (Plugin.Config.configARMS.Value)
{
springNoises[0] = Plugin.LoadAudioClip("SpringMan1");
springNoises[1] = Plugin.LoadAudioClip("SpringMan2");
springNoises[2] = Plugin.LoadAudioClip("SpringMan3");
springNoises[3] = Plugin.LoadAudioClip("ARMS1");
springNoises[4] = Plugin.LoadAudioClip("ARMS2");
((Component)__instance.playerRagdolls[2].transform.GetChild(8)).GetComponent<AudioSource>().clip = Plugin.LoadAudioClip("KillPlayerSpringMan");
}
else if (!Plugin.AlreadyAddedSpringNoises)
{
List<AudioClip> list = springNoises.ToList();
list.Add(Plugin.LoadAudioClip("SpringMan1"));
list.Add(Plugin.LoadAudioClip("SpringMan2"));
list.Add(Plugin.LoadAudioClip("SpringMan3"));
list.Add(Plugin.LoadAudioClip("ARMS1"));
list.Add(Plugin.LoadAudioClip("ARMS2"));
val3.enemyPrefab.GetComponent<SpringManAI>().springNoises = list.ToArray();
Plugin.AlreadyAddedSpringNoises = true;
}
if (Plugin.Config.configSneakers.Value)
{
AudioClip[] randomClips = ((Component)val3.enemyPrefab.transform.GetChild(0).GetChild(2)).GetComponent<PlayAudioAnimationEvent>().randomClips;
randomClips[0] = Plugin.LoadAudioClip("Sneaker1");
randomClips[1] = Plugin.LoadAudioClip("Sneaker2");
randomClips[2] = Plugin.LoadAudioClip("Sneaker3");
randomClips[3] = Plugin.LoadAudioClip("Sneaker4");
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LCSpringManSoundPackMod";
public const string PLUGIN_NAME = "LCSpringManSoundPackMod";
public const string PLUGIN_VERSION = "1.2.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}