Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of loaforcsSoundAPI LethalCompany v1.0.2
BepInEx/plugins/loaforcsSoundAPI_LethalCompany/me.loaforc.soundapi.lethalcompany.dll
Decompiled a year agousing 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JetBrains.Annotations; using LethalLevelLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using loaforcsSoundAPI.Core; using loaforcsSoundAPI.Core.Data; using loaforcsSoundAPI.Core.Networking; using loaforcsSoundAPI.Core.Util; using loaforcsSoundAPI.Core.Util.Extensions; using loaforcsSoundAPI.LethalCompany.Conditions; using loaforcsSoundAPI.LethalCompany.Conditions.Contexts; using loaforcsSoundAPI.LethalCompany.Conditions.Dungeon; using loaforcsSoundAPI.LethalCompany.Conditions.OtherMods.LethalLevelLoader; using loaforcsSoundAPI.LethalCompany.Conditions.Player; using loaforcsSoundAPI.LethalCompany.Conditions.Ship; using loaforcsSoundAPI.LethalCompany.Reporting; using loaforcsSoundAPI.Reporting; using loaforcsSoundAPI.Reporting.Data; using loaforcsSoundAPI.SoundPacks.Data.Conditions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("me.loaforc.soundapi.lethalcompany")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+799f0a730cce74f31e8891ad62a782dcdbf6bdb6")] [assembly: AssemblyProduct("loaforcsSoundAPI.LethalCompany")] [assembly: AssemblyTitle("me.loaforc.soundapi.lethalcompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 loaforcsSoundAPI.LethalCompany { [BepInPlugin("me.loaforc.soundapi.lethalcompany", "loaforcsSoundAPI.LethalCompany", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class loaforcsSoundAPILethalCompany : BaseUnityPlugin { internal static ManualLogSource Logger { get; private set; } private void Awake() { Logger = Logger.CreateLogSource("me.loaforc.soundapi.lethalcompany"); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; SoundAPI.RegisterAll(Assembly.GetExecutingAssembly()); if (CheckSoftDep("imabatby.lethallevelloader")) { RegisterLLLConditions(); } if (SoundReportHandler.CurrentReport != null) { LethalCompanySoundReport.Init(); } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.soundapi.lethalcompany"); ((BaseUnityPlugin)this).Config.Save(); Logger.LogInfo((object)"Done."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterLLLConditions() { Logger.LogInfo((object)"LethalLevelLoader found, registering conditions on SoundAPI side."); SoundAPI.RegisterCondition("LethalLevelLoader:dungeon:has_tag", (Func<Condition>)(() => (Condition)(object)new LLLTagCondition<ExtendedDungeonFlow>(delegate { if (!Object.op_Implicit((Object)(object)RoundManager.Instance)) { return null; } if (!Object.op_Implicit((Object)(object)RoundManager.Instance.dungeonGenerator)) { return null; } ExtendedDungeonFlow val2 = default(ExtendedDungeonFlow); return (!PatchedContent.TryGetExtendedContent(RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow, ref val2)) ? null : val2; }))); SoundAPI.RegisterCondition("LethalLevelLoader:moon:has_tag", (Func<Condition>)(() => (Condition)(object)new LLLTagCondition<ExtendedLevel>(delegate { if (!Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return null; } ExtendedLevel val = default(ExtendedLevel); return (!PatchedContent.TryGetExtendedContent(StartOfRound.Instance.currentLevel, ref val)) ? null : val; }))); } internal static bool CheckSoftDep(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } } public class NGONetworkAdapter : NetworkAdapter { public override string Name => "Unity Netcode for GameObjects"; public override void OnRegister() { } } public static class SoundFixesConfig { private const string SECTION = "SoundFixes"; public static AdaptiveConfigEntry PlayShipSpeakerOnClientJoin { get; private set; } public static void Bind(ConfigFile config) { PlayShipSpeakerOnClientJoin = ConfigFileExtensions.BindAdaptive(config, "SoundFixes", "PlayShipSpeakerOnClientJoin", false, "Vanilla does not play the ship speaker when clients join a lobby for the first time."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "me.loaforc.soundapi.lethalcompany"; public const string PLUGIN_NAME = "loaforcsSoundAPI.LethalCompany"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace loaforcsSoundAPI.LethalCompany.Reporting { internal static class LethalCompanySoundReport { internal static readonly List<string> foundDungeonTypes = new List<string>(); internal static readonly List<string> foundMoonNames = new List<string>(); internal static readonly List<ReverbPreset> foundReverbPresets = new List<ReverbPreset>(); internal static readonly List<FootstepSurface> foundFootstepSurfaces = new List<FootstepSurface>(); internal static void Init() { SoundReportHandler.AddReportSection("Lethal Company", (Action<StreamWriter, SoundReport>)delegate(StreamWriter stream, SoundReport _) { stream.WriteLine("Version: `1.0.2` <br/>"); SoundReportHandler.WriteList("Found Dungeon Types", stream, (ICollection<string>)foundDungeonTypes); SoundReportHandler.WriteList("Found Moon Names", stream, (ICollection<string>)foundMoonNames); SoundReportHandler.WriteList("Found Reverb Presets", stream, (ICollection<string>)foundReverbPresets.Select(ReverbPresetToHumanReadable).ToList()); SoundReportHandler.WriteList("Found Footstep Surfaces", stream, (ICollection<string>)foundFootstepSurfaces.Select((FootstepSurface it) => it.surfaceTag).ToList()); SoundReportHandler.WriteEnum<PlayerLocationCondition.LocationType>("Player Location Types", stream); SoundReportHandler.WriteEnum<ApparatusStateCondition.StateType>("Apparatus State Types", stream); SoundReportHandler.WriteEnum<DayMode>("Time Of Day Types", stream); SoundReportHandler.WriteEnum<ShipStateCondition.ShipStateType>("Ship State Types", stream); if (loaforcsSoundAPILethalCompany.CheckSoftDep("imabatby.lethallevelloader")) { WriteLLLDataToReport(stream); } }); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void WriteLLLDataToReport(StreamWriter stream) { List<string> tags = new List<string>(); loaforcsSoundAPILethalCompany.Logger.LogDebug((object)"writing lll data!!"); List<ExtendedMod> list = PatchedContent.ExtendedMods.ToList(); list.Add(PatchedContent.VanillaMod); foreach (ExtendedMod item in list) { foreach (ExtendedContent extendedContent in item.ExtendedContents) { tags.AddRange(from it in extendedContent.ContentTags select it.contentTagName into it where !tags.Contains(it) select it); } } SoundReportHandler.WriteList("Found Lethal Level Loader Tags (CASE-SENSITIVE)", stream, (ICollection<string>)tags); } private static string ReverbPresetToHumanReadable(ReverbPreset preset) { string text = ((Object)preset).name + "<br/>\n"; text += $"hasEcho: {preset.hasEcho} <br/>\n"; text += $"changeRoom: {preset.changeRoom}, room: {preset.room} <br/>\n"; text += $"changeDecayTime: {preset.changeDecayTime}, decayTime: {preset.decayTime} <br/>\n"; text += $"changeDryLevel: {preset.changeDryLevel}, dryLevel: {preset.dryLevel} <br/>\n"; text += $"changeHighFreq: {preset.changeHighFreq}, highFreq: {preset.highFreq} <br/>\n"; return text + $"changeLowFreq: {preset.changeLowFreq}, lowFreq: {preset.lowFreq} <br/>\n"; } } } namespace loaforcsSoundAPI.LethalCompany.Patches { [HarmonyPatch(typeof(LungProp))] internal static class ApparatusPatch { [HarmonyPatch("EquipItem")] [HarmonyPrefix] [HarmonyWrapSafe] private static void OnApparatusPull(LungProp __instance) { if (__instance.isLungDocked) { ApparatusStateCondition.CurrentApparatusPulled = true; } } } [HarmonyPatch(typeof(AudioReverbTrigger))] internal static class AudioReverbTriggerPatch { [HarmonyPatch("ChangeAudioReverbForPlayer")] [HarmonyPostfix] [HarmonyWrapSafe] private static void LogFoundReverbPreset(AudioReverbTrigger __instance) { if (SoundReportHandler.CurrentReport != null && !((Object)(object)__instance.reverbPreset == (Object)null)) { ListExtensions.AddUnique<ReverbPreset>(LethalCompanySoundReport.foundReverbPresets, __instance.reverbPreset); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerPatch { [HarmonyPatch("Start")] private static void UpdatePlayerContexts(PlayerControllerB __instance) { PlayerContext currentContext = new PlayerContext(__instance); AudioSourceAdditionalData.GetOrCreate(__instance.movementAudio).CurrentContext = (IContext)(object)currentContext; AudioSourceAdditionalData.GetOrCreate(__instance.statusEffectAudio).CurrentContext = (IContext)(object)currentContext; AudioSourceAdditionalData.GetOrCreate(__instance.waterBubblesAudio).CurrentContext = (IContext)(object)currentContext; } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { [HarmonyPatch("GenerateNewFloor")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Reporting() { if (SoundReportHandler.CurrentReport != null) { string name = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name; string name2 = ((Object)StartOfRound.Instance.currentLevel).name; ListExtensions.AddUnique<string>(LethalCompanySoundReport.foundDungeonTypes, name); ListExtensions.AddUnique<string>(LethalCompanySoundReport.foundMoonNames, name2); } } [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyWrapSafe] private static void ListenForPowerChanges() { ((UnityEvent<bool>)(object)RoundManager.Instance.onPowerSwitch).AddListener((UnityAction<bool>)delegate(bool power) { DungeonPowerStateCondition.CurrentPowerState = power; }); } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPrefix] [HarmonyPatch("EndOfGame")] [HarmonyWrapSafe] private static void ResetApparatusState() { ApparatusStateCondition.CurrentApparatusPulled = false; } [HarmonyPostfix] [HarmonyPatch("Awake")] [HarmonyWrapSafe] private static void ReportFootstepSurfaces() { if (SoundReportHandler.CurrentReport != null) { FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces; foreach (FootstepSurface val in footstepSurfaces) { ListExtensions.AddUnique<FootstepSurface>(LethalCompanySoundReport.foundFootstepSurfaces, val); } } } } } namespace loaforcsSoundAPI.LethalCompany.Conditions { [SoundAPICondition("LethalCompany:apparatus_state", false, null)] public class ApparatusStateCondition : Condition { public enum StateType { PULLED, PLUGGED_IN } internal static bool CurrentApparatusPulled; public StateType? Value { get; internal set; } public override bool Evaluate(IContext context) { StateType stateType = ((!CurrentApparatusPulled) ? StateType.PLUGGED_IN : StateType.PULLED); return stateType == Value.GetValueOrDefault(); } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.Ship { [SoundAPICondition("LethalCompany:ship:state", false, null)] public class ShipStateCondition : Condition { public enum ShipStateType { IN_ORBIT, LANDED } public ShipStateType Value { get; internal set; } public override bool Evaluate(IContext context) { if (!Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return false; } if (StartOfRound.Instance.inShipPhase) { return Value == ShipStateType.IN_ORBIT; } return Value == ShipStateType.LANDED; } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.Player { [SoundAPICondition("LethalCompany:player:audio_reverb", false, null)] public class AudioReverbCondition : Condition { public bool? HasEcho { get; private set; } [CanBeNull] public string Name { get; private set; } public override bool Evaluate(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!Object.op_Implicit((Object)(object)localPlayerController)) { return false; } if (!Object.op_Implicit((Object)(object)localPlayerController.reverbPreset)) { return false; } if (HasEcho.HasValue && HasEcho == localPlayerController.reverbPreset.hasEcho) { return true; } if (Name != null && string.Equals(Name, ((Object)localPlayerController.reverbPreset).name, StringComparison.InvariantCultureIgnoreCase)) { return true; } return false; } } [SoundAPICondition("LethalCompany:player:is_alone", false, null)] public class PlayerAloneCondition : Condition<PlayerContext> { public bool? Value { get; internal set; } protected override bool EvaluateWithContext(PlayerContext context) { if (!Object.op_Implicit((Object)(object)context.Player)) { return false; } return context.Player.isPlayerAlone == (Value ?? true); } protected override bool EvaluateFallback(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } return ((Condition<PlayerContext>)this).EvaluateWithContext(new PlayerContext(GameNetworkManager.Instance.localPlayerController)); } } [SoundAPICondition("LethalCompany:player:health", false, null)] public class PlayerHealthCondition : Condition<PlayerContext> { public string Value { get; private set; } protected override bool EvaluateWithContext(PlayerContext context) { if (!Object.op_Implicit((Object)(object)context.Player)) { return false; } if (context.Player.isPlayerDead) { return false; } return ((Condition)this).EvaluateRangeOperator(context.Player.health, Value); } protected override bool EvaluateFallback(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } return ((Condition<PlayerContext>)this).EvaluateWithContext(new PlayerContext(GameNetworkManager.Instance.localPlayerController)); } public override List<ValidationResult> Validate() { ValidationResult item = default(ValidationResult); if (!((Condition)this).ValidateRangeOperator(Value, ref item)) { return new List<ValidationResult>(1) { item }; } return new List<ValidationResult>(); } } [SoundAPICondition("LethalCompany:player:insanity", false, null)] public class PlayerInsanityCondition : Condition<PlayerContext> { public string Value { get; internal set; } protected override bool EvaluateWithContext(PlayerContext context) { if (!Object.op_Implicit((Object)(object)context.Player)) { return false; } if (context.Player.isPlayerDead) { return false; } return ((Condition)this).EvaluateRangeOperator(context.Player.insanityLevel, Value); } protected override bool EvaluateFallback(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } return ((Condition<PlayerContext>)this).EvaluateWithContext(new PlayerContext(GameNetworkManager.Instance.localPlayerController)); } public override List<ValidationResult> Validate() { ValidationResult item = default(ValidationResult); if (!((Condition)this).ValidateRangeOperator(Value, ref item)) { return new List<ValidationResult>(1) { item }; } return new List<ValidationResult>(); } } [SoundAPICondition("LethalCompany:player:location", false, null)] public class PlayerLocationCondition : Condition<PlayerContext> { public enum LocationType { INSIDE, ON_SHIP, OUTSIDE } public LocationType Value { get; internal set; } protected override bool EvaluateWithContext(PlayerContext context) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)context.Player)) { return false; } if (context.Player.isPlayerDead) { return false; } if (context.Player.isInsideFactory) { return Value == LocationType.INSIDE; } Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)context.Player).transform.position)) { return Value == LocationType.ON_SHIP; } return Value == LocationType.OUTSIDE; } protected override bool EvaluateFallback(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } return ((Condition<PlayerContext>)this).EvaluateWithContext(new PlayerContext(GameNetworkManager.Instance.localPlayerController)); } } [SoundAPICondition("LethalCompany:player:standing_on", false, null)] public class PlayerStandingOnCondition : Condition<PlayerContext> { public string Value { get; internal set; } protected override bool EvaluateWithContext(PlayerContext context) { if (!Object.op_Implicit((Object)(object)context.Player)) { return false; } return string.Equals(Value, StartOfRound.Instance.footstepSurfaces[context.Player.currentFootstepSurfaceIndex].surfaceTag, StringComparison.InvariantCultureIgnoreCase); } protected override bool EvaluateFallback(IContext context) { if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance)) { return false; } return ((Condition<PlayerContext>)this).EvaluateWithContext(new PlayerContext(GameNetworkManager.Instance.localPlayerController)); } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.OtherMods.LethalLevelLoader { public class LLLTagCondition<T> : Condition where T : ExtendedContent { [NonSerialized] private Func<T> _generator; public string Value { get; internal set; } public LLLTagCondition(Func<T> generator) { _generator = generator; ((Condition)this)..ctor(); } public override bool Evaluate(IContext context) { T val = _generator(); if (Object.op_Implicit((Object)(object)val)) { return ((ExtendedContent)val).TryGetTag(Value); } return false; } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.Moon { [SoundAPICondition("LethalCompany:moon:current_time", false, null)] public class CurrentTimeCondition : Condition { public string Value { get; internal set; } public override bool Evaluate(IContext context) { Object.op_Implicit((Object)(object)TimeOfDay.Instance); return false; } public override List<ValidationResult> Validate() { ValidationResult item = default(ValidationResult); if (!((Condition)this).ValidateRangeOperator(Value, ref item)) { return new List<ValidationResult>(1) { item }; } return new List<ValidationResult>(); } } [SoundAPICondition("LethalCompany:moon:name", false, null)] public class MoonNameCondition : Condition { public string Value { get; internal set; } public override bool Evaluate(IContext context) { if (!Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return false; } if (!Object.op_Implicit((Object)(object)StartOfRound.Instance.currentLevel)) { return false; } string name = ((Object)StartOfRound.Instance.currentLevel).name; return string.Equals(Value, name, StringComparison.InvariantCultureIgnoreCase); } } [SoundAPICondition("LethalCompany:moon:time_of_day", false, null)] public class TimeOfDayCondition : Condition { public string Value { get; internal set; } public override bool Evaluate(IContext context) { if (!Object.op_Implicit((Object)(object)TimeOfDay.Instance)) { return false; } return string.Equals(Value, ((object)(DayMode)(ref TimeOfDay.Instance.dayMode)).ToString(), StringComparison.InvariantCultureIgnoreCase); } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.Dungeon { [SoundAPICondition("LethalCompany:dungeon:name", false, null)] public class DungeonNameCondition : Condition { public string Value { get; internal set; } public override bool Evaluate(IContext context) { if (!Object.op_Implicit((Object)(object)RoundManager.Instance)) { return false; } if (!Object.op_Implicit((Object)(object)RoundManager.Instance.dungeonGenerator)) { return false; } if (!Object.op_Implicit((Object)(object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow)) { return false; } string name = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name; return string.Equals(Value, name, StringComparison.InvariantCultureIgnoreCase); } } [SoundAPICondition("LethalCompany:dungeon:power_state", false, null)] public class DungeonPowerStateCondition : Condition { internal static bool CurrentPowerState; public bool? Value { get; internal set; } public override bool Evaluate(IContext context) { return CurrentPowerState == (Value ?? true); } } } namespace loaforcsSoundAPI.LethalCompany.Conditions.Contexts { public class PlayerContext : IContext { [CompilerGenerated] private PlayerControllerB <player>P; public PlayerControllerB Player => <player>P; public PlayerContext(PlayerControllerB player) { <player>P = player; base..ctor(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }