using System;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using STSharedAudioLib;
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("LCSimonTendoPlaylistsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Creates playlists for objects that get sounds from multiple mods of mine.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LCSimonTendoPlaylistsMod")]
[assembly: AssemblyTitle("LCSimonTendoPlaylistsMod")]
[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 LCSimonTendoPlaylistsMod
{
public class Config
{
public static ConfigEntry<bool> Examples;
public Config(ConfigFile cfg)
{
Examples = cfg.Bind<bool>("Examples", "Add Extra Songs", false, "If true, adds some Boombox songs to the Disco Ball and Record Player, to demonstrate how this mod and STSharedAudioLib work.");
}
}
[BepInPlugin("LCSimonTendoPlaylistsMod", "LCSimonTendoPlaylistsMod", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static Config MyConfig { get; internal set; }
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin LCSimonTendoPlaylistsMod is loaded!");
Harmony val = new Harmony("LCSimonTendoPlaylistsMod");
val.PatchAll();
MyConfig = new Config(((BaseUnityPlugin)this).Config);
if (Config.Examples.Value)
{
Logger.LogInfo((object)"Config [Examples] is set to TRUE. A few boombox songs will be added to the Disco Ball and Record Player.");
}
}
public static void PrintNewAudioClip(GameObject objectPlaying, AudioClip clipPlaying)
{
Logger.LogDebug((object)(((Object)objectPlaying).name + " - now playing: " + ((Object)clipPlaying).name));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LCSimonTendoPlaylistsMod";
public const string PLUGIN_NAME = "LCSimonTendoPlaylistsMod";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LCSimonTendoPlaylistsMod.Patches
{
public class AnimatedItemPatch
{
[HarmonyPatch]
public class NewAnimatedItem
{
[HarmonyPrefix]
[HarmonyPatch(typeof(AnimatedItem), "Start")]
public static void StartPostfix(AnimatedItem __instance)
{
if (((Object)((Component)__instance).gameObject).name == "OldPhone(Clone)")
{
__instance.grabAudio = SharedAudioMethods.AudioClipGetRandomByWeight(SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", StartOfRoundPatch.OldPhoneObject, false, true), false);
Plugin.PrintNewAudioClip(((Component)__instance).gameObject, __instance.grabAudio);
}
}
}
}
public class AnimatedObjectTriggerPatch
{
[HarmonyPatch]
public class NewAnimatedObjectTrigger
{
[HarmonyPrefix]
[HarmonyPatch(typeof(AnimatedObjectTrigger), "PlayAudio")]
public static void PlayAudioPrefix(AnimatedObjectTrigger __instance)
{
Transform parent = ((Component)__instance).gameObject.transform.parent;
if (((parent != null) ? ((Object)parent).name : null) == "RecordPlayerContainer(Clone)" && !__instance.thisAudioSource.isPlaying)
{
AudioClip clip = (__instance.playWhileTrue = SharedAudioMethods.AudioClipGetNextInAudioList(((Component)StartOfRoundPatch.RecordPlayerObject.transform.GetChild(3)).gameObject.GetComponent<AnimatedObjectTrigger>().thisAudioSource.clip, SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", StartOfRoundPatch.RecordPlayerObject, false, true), false));
((Component)StartOfRoundPatch.RecordPlayerObject.transform.GetChild(3)).gameObject.GetComponent<AnimatedObjectTrigger>().thisAudioSource.clip = clip;
Plugin.PrintNewAudioClip(((Component)((Component)__instance).transform.parent).gameObject, __instance.playWhileTrue);
}
Transform parent2 = ((Component)__instance).gameObject.transform.parent;
if (((parent2 != null) ? ((Object)parent2).name : null) == "PlushiePJManContainer(Clone)")
{
__instance.boolFalseAudios[0] = SharedAudioMethods.AudioClipGetRandomByWeight(SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", StartOfRoundPatch.PlushieObject, false, true), false);
Plugin.PrintNewAudioClip(((Component)((Component)__instance).transform.parent).gameObject, __instance.boolFalseAudios[0]);
}
}
}
}
public class CozyLightsPatch
{
[HarmonyPatch]
public class NewCozyLights
{
[HarmonyPrefix]
[HarmonyPatch(typeof(CozyLights), "SetAudio")]
public static void SetAudioPrefix(CozyLights __instance, bool ___cozyLightsOn)
{
Transform parent = ((Component)__instance).gameObject.transform.parent;
if (((parent != null) ? ((Object)parent).name : null) == "DiscoBallContainer(Clone)" && ___cozyLightsOn && !__instance.turnOnAudio.isPlaying)
{
AudioClip clip = SharedAudioMethods.AudioClipGetNextInAudioList(((Component)StartOfRoundPatch.DiscoBallObject.transform.GetChild(0)).gameObject.GetComponent<CozyLights>().turnOnAudio.clip, StartOfRoundPatch.DiscoBallObject, false);
__instance.turnOnAudio.clip = clip;
((Component)StartOfRoundPatch.DiscoBallObject.transform.GetChild(0)).gameObject.GetComponent<CozyLights>().turnOnAudio.clip = clip;
Plugin.PrintNewAudioClip(((Component)((Component)__instance).transform.parent).gameObject, __instance.turnOnAudio.clip);
}
}
}
}
public class ShipBuildModeManagerPatch
{
[HarmonyPatch]
public class NewShipBuildModeManager
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipBuildModeManager), "PlaceShipObject")]
public static void PlaceShipObjectPrefix(ref PlaceableShipObject placeableObject)
{
Transform parent = ((Component)placeableObject).gameObject.transform.parent;
if (((parent != null) ? ((Object)parent).name : null) == "PlushiePJManContainer(Clone)")
{
placeableObject.placeObjectSFX = SharedAudioMethods.AudioClipGetRandomByWeight(SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", StartOfRoundPatch.PlushieObject, false, true), false);
Plugin.PrintNewAudioClip(((Component)((Component)placeableObject).transform.parent).gameObject, placeableObject.placeObjectSFX);
}
}
}
}
public class StartOfRoundPatch
{
[HarmonyPatch]
public class NewStartOfRound
{
[HarmonyPrefix]
[HarmonyPatch(typeof(StartOfRound), "Start")]
public static void StartPrefix(StartOfRound __instance)
{
foreach (Item items in __instance.allItemsList.itemsList)
{
if (((Object)items).name == "Phone")
{
OldPhoneObject = items.spawnPrefab;
SharedAudioMethods.AudioClipAddNew(items.spawnPrefab.GetComponent<AnimatedItem>().grabAudio, SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", OldPhoneObject, false, true), true, 100, false);
}
}
foreach (UnlockableItem unlockable in __instance.unlockablesList.unlockables)
{
if (unlockable.unlockableName == "Disco Ball")
{
DiscoBallObject = unlockable.prefabObject;
SharedAudioMethods.AudioClipAddNew(((Component)DiscoBallObject.transform.GetChild(0)).GetComponent<CozyLights>().turnOnAudio.clip, SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", DiscoBallObject, false, true), false, 100, false);
if (Config.Examples.Value)
{
SharedAudioMethods.AudioClipAddNew(__instance.allItemsList.itemsList[1].spawnPrefab.GetComponent<BoomboxItem>().musicAudios[2], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", DiscoBallObject, false, true), true, 100, false);
SharedAudioMethods.AudioClipAddNew(__instance.allItemsList.itemsList[1].spawnPrefab.GetComponent<BoomboxItem>().musicAudios[4], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", DiscoBallObject, false, true), true, 100, false);
}
}
else if (unlockable.unlockableName == "Record player")
{
RecordPlayerObject = unlockable.prefabObject;
SharedAudioMethods.AudioClipAddNew(((Component)RecordPlayerObject.transform.GetChild(3)).GetComponent<AnimatedObjectTrigger>().playWhileTrue, SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", RecordPlayerObject, false, true), true, 100, false);
if (Config.Examples.Value)
{
SharedAudioMethods.AudioClipAddNew(__instance.allItemsList.itemsList[1].spawnPrefab.GetComponent<BoomboxItem>().musicAudios[0], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", RecordPlayerObject, false, true), true, 100, false);
SharedAudioMethods.AudioClipAddNew(__instance.allItemsList.itemsList[1].spawnPrefab.GetComponent<BoomboxItem>().musicAudios[1], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", RecordPlayerObject, false, true), true, 100, false);
SharedAudioMethods.AudioClipAddNew(__instance.allItemsList.itemsList[1].spawnPrefab.GetComponent<BoomboxItem>().musicAudios[3], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", RecordPlayerObject, false, true), true, 100, false);
}
}
else if (unlockable.unlockableName == "Plushie pajama man")
{
PlushieObject = unlockable.prefabObject;
SharedAudioMethods.AudioClipAddNew(((Component)PlushieObject.transform.GetChild(2)).GetComponent<AnimatedObjectTrigger>().boolFalseAudios[0], SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", PlushieObject, false, true), true, 100, false);
}
}
}
}
public static GameObject OldPhoneObject;
public static GameObject DiscoBallObject;
public static GameObject RecordPlayerObject;
public static GameObject PlushieObject;
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}