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 System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using HarmonyLib.Public.Patching; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalNetworkAPI; using LethalNetworkAPI.Utils; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Utils; using ReadyCompany.Config; using ReadyCompany.Patches; using ReadyCompany.Util; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Interactions; using UnityEngine.InputSystem.Utilities; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [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("LethalCompanyInputUtils")] [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.AccessibilityModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ProfilerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityTestProtocolModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Enova.ReadyCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+4cf556d64ab61e03cd2f65d0f79d62f38f9b5b1e")] [assembly: AssemblyProduct("ReadyCompany")] [assembly: AssemblyTitle("Enova.ReadyCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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.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 ReadyCompany { public class InteractionBarUI : MonoBehaviour { private Image image = null; internal IInputInteraction? ReadyInteraction; internal IInputInteraction? UnreadyInteraction; public static InteractionBarUI Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } image = ((Component)this).GetComponent(); } private void Update() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (ReadyCompany.InputActions == null) { return; } float percentage = 0f; if (ReadyInteraction != null) { LNetworkVariable readyStatus = ReadyHandler.ReadyStatus; if (readyStatus != null) { ReadyMap value = readyStatus.Value; if (value != null && !value.LocalPlayerReady) { ((Graphic)image).color = ReadyCompany.Config.ReadyBarColor.Value; IInputInteraction? readyInteraction = ReadyInteraction; MultiTapInteraction val = (MultiTapInteraction)(object)((readyInteraction is MultiTapInteraction) ? readyInteraction : null); if (val != null) { percentage = (float)val.m_CurrentTapCount / (float)val.tapCount; } else { IInputInteraction? readyInteraction2 = ReadyInteraction; HoldInteraction val2 = (HoldInteraction)(object)((readyInteraction2 is HoldInteraction) ? readyInteraction2 : null); if (val2 != null) { percentage = (float)(Time.realtimeSinceStartupAsDouble - val2.m_TimePressed) / val2.durationOrDefault; } } goto IL_016e; } } } if (UnreadyInteraction != null) { LNetworkVariable readyStatus = ReadyHandler.ReadyStatus; if (readyStatus != null) { ReadyMap value = readyStatus.Value; if (value != null && value.LocalPlayerReady) { ((Graphic)image).color = ReadyCompany.Config.UnreadyBarColor.Value; IInputInteraction? unreadyInteraction = UnreadyInteraction; MultiTapInteraction val3 = (MultiTapInteraction)(object)((unreadyInteraction is MultiTapInteraction) ? unreadyInteraction : null); if (val3 != null) { percentage = (float)val3.m_CurrentTapCount / (float)val3.tapCount; } else { IInputInteraction? unreadyInteraction2 = UnreadyInteraction; HoldInteraction val4 = (HoldInteraction)(object)((unreadyInteraction2 is HoldInteraction) ? unreadyInteraction2 : null); if (val4 != null) { percentage = (float)(Time.realtimeSinceStartupAsDouble - val4.m_TimePressed) / val4.durationOrDefault; } } } } } goto IL_016e; IL_016e: UpdatePercentage(percentage); } public void UpdatePercentage(float percentage) { image.fillAmount = percentage; } } [BepInPlugin("Enova.ReadyCompany", "ReadyCompany", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.sigurd.csync", "5.0.0")] public class ReadyCompany : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static GenericButtonHandler <>9__18_0; public static CanModifyDelegate <>9__18_1; public static CanModifyDelegate <>9__18_2; internal void b__18_0() { Config.LoadCustomSounds(); } internal CanModifyResult b__18_1() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit(Config.ReadyInteractionPreset.Value == InteractionPreset.Custom); } internal CanModifyResult b__18_2() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return CanModifyResult.op_Implicit(Config.UnreadyInteractionPreset.Value == InteractionPreset.Custom); } } internal static ReadyCompanyConfig Config; public static ReadyCompany Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } internal static ReadyInputs? InputActions { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Config = new ReadyCompanyConfig(((BaseUnityPlugin)this).Config); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { InitializeLethalConfig(); } if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { InitializeLobbyCompatibility(); } ReadyHandler.InitializeEvents(); Patch(); Logger.LogInfo((object)"Enova.ReadyCompany v1.1.1 has loaded!"); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitializeLethalConfig() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00ee: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_01b0: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01fc: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(Config.RequireReadyToStart.Entry, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(Config.AutoStartWhenReady.Entry, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); ConfigEntry entry = Config.PercentageForReady.Entry; IntSliderOptions val3 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions)val3).Min = 0; ((BaseRangeOptions)val3).Max = 100; IntSliderConfigItem val4 = new IntSliderConfigItem(entry, val3); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); EnumDropDownConfigItem val5 = new EnumDropDownConfigItem(Config.StatusPlacement, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(Config.ShowPopup, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(Config.PlaySound, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); ConfigEntry soundVolume = Config.SoundVolume; IntSliderOptions val8 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions)val8).Min = 0; ((BaseRangeOptions)val8).Max = 100; IntSliderConfigItem val9 = new IntSliderConfigItem(soundVolume, val8); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val9); object obj = <>c.<>9__18_0; if (obj == null) { GenericButtonHandler val10 = delegate { Config.LoadCustomSounds(); }; <>c.<>9__18_0 = val10; obj = (object)val10; } GenericButtonConfigItem val11 = new GenericButtonConfigItem("Customization", "Reload Custom Sounds", "Reloads any custom sounds from disk.", "Reload", (GenericButtonHandler)obj); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11); EnumDropDownConfigItem val12 = new EnumDropDownConfigItem(Config.ReadyInteractionPreset, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12); EnumDropDownConfigItem val13 = new EnumDropDownConfigItem(Config.UnreadyInteractionPreset, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val13); ConfigEntry customReadyInteractionString = Config.CustomReadyInteractionString; TextInputFieldOptions val14 = new TextInputFieldOptions { RequiresRestart = false }; object obj2 = <>c.<>9__18_1; if (obj2 == null) { CanModifyDelegate val15 = () => CanModifyResult.op_Implicit(Config.ReadyInteractionPreset.Value == InteractionPreset.Custom); <>c.<>9__18_1 = val15; obj2 = (object)val15; } ((BaseOptions)val14).CanModifyCallback = (CanModifyDelegate)obj2; TextInputFieldConfigItem val16 = new TextInputFieldConfigItem(customReadyInteractionString, val14); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val16); ConfigEntry customUnreadyInteractionString = Config.CustomUnreadyInteractionString; TextInputFieldOptions val17 = new TextInputFieldOptions { RequiresRestart = false }; object obj3 = <>c.<>9__18_2; if (obj3 == null) { CanModifyDelegate val18 = () => CanModifyResult.op_Implicit(Config.UnreadyInteractionPreset.Value == InteractionPreset.Custom); <>c.<>9__18_2 = val18; obj3 = (object)val18; } ((BaseOptions)val17).CanModifyCallback = (CanModifyDelegate)obj3; TextInputFieldConfigItem val19 = new TextInputFieldConfigItem(customUnreadyInteractionString, val17); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val19); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitializeLobbyCompatibility() { PluginHelper.RegisterPlugin("Enova.ReadyCompany", new Version("1.1.1"), (CompatibilityLevel)2, (VersionStrictness)2); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Enova.ReadyCompany"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); JoinPatches.Init(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class ReadyHandler { private const string READY_STATUS_SIG = "Enova.ReadyCompany_readyStatusVar"; private const string READY_EVENT_SIG = "Enova.ReadyCompany_playerReadyEvent"; internal const string LEVER_DISABLED_TIP = "[ Lobby must be ready to start ]"; internal const string LEVER_WARNING_TIP = "[ WARNING: Lobby Not Ready ]"; private static readonly LNetworkMessage readyUpMessage = LNetworkMessage.Connect("Enova.ReadyCompany_playerReadyEvent", (Action)ReadyUpFromClient, (Action)null, (Action)null); private static readonly Dictionary _playerReadyMap = new Dictionary(); public static LNetworkVariable ReadyStatus { get; } = LNetworkVariable.Connect("Enova.ReadyCompany_readyStatusVar", (ReadyMap)null, (LNetworkVariableWritePerms)0, (Action)ReadyStatusChanged); internal static bool ShouldPlaySound { get; set; } public static bool InVotingPhase { get { if ((Object)(object)StartOfRound.Instance == (Object)null || !LNetworkUtils.IsConnected) { return false; } if (!StartOfRound.Instance.shipLeftAutomatically && !StartOfRound.Instance.newGameIsLoading && !StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.firingPlayersCutsceneRunning) { HUDManager instance = HUDManager.Instance; if ((instance == null || !((Behaviour)instance.loadingText).enabled) && ((StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipHasLanded) || (!StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap && !StartOfRound.Instance.currentLevel.planetHasTime && StartOfRound.Instance.shipHasLanded))) { return true; } } return false; } } public static ulong? ActualLocalClientId => StartOfRound.Instance?.localPlayerController?.actualClientId; public static int? LocalPlayerId { get { if (!ActualLocalClientId.HasValue) { return null; } StartOfRound instance = StartOfRound.Instance; if (instance != null) { instance.ClientPlayerList.TryGetValue(ActualLocalClientId.Value, out var value); if (true) { return value; } } return null; } } internal static bool LocalPlayerAbleToVote { get { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; int result; if (val != null && !val.isTypingChat && !val.inTerminalMenu && !val.inSpecialMenu) { QuickMenuManager quickMenuManager = val.quickMenuManager; if (quickMenuManager != null) { result = ((!quickMenuManager.isMenuOpen) ? 1 : 0); goto IL_0043; } } result = 0; goto IL_0043; IL_0043: return (byte)result != 0; } } internal static bool LocalPlayerDead { get { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; return val != null && val.isPlayerDead && !val.isPlayerControlled; } } public static event Action? NewReadyStatus; internal static void InitializeEvents() { ReadyStatus.Value = new ReadyMap(_playerReadyMap); SceneManager.sceneLoaded += OnSceneLoaded; NewReadyStatus += HUDPatches.UpdateTextBasedOnStatus; } private static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { InitializeInputActions(); SceneManager.sceneLoaded -= OnSceneLoaded; } private static void InitializeInputActions() { if (ReadyCompany.InputActions == null) { ReadyCompany.InputActions = new ReadyInputs(); ReadyCompany.InputActions.ReadyInput.performed += ReadyInputPerformed; ReadyCompany.InputActions.ReadyInput.started += delegate(CallbackContext context) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) InteractionBarUI.Instance.ReadyInteraction = InputStateChanged(context); }; ReadyCompany.InputActions.ReadyInput.canceled += delegate { InteractionBarUI.Instance.ReadyInteraction = InputStateChanged(null); }; ReadyCompany.InputActions.UnreadyInput.performed += UnreadyInputPerformed; ReadyCompany.InputActions.UnreadyInput.started += delegate(CallbackContext context) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) InteractionBarUI.Instance.UnreadyInteraction = InputStateChanged(context); }; ReadyCompany.InputActions.UnreadyInput.canceled += delegate { InteractionBarUI.Instance.UnreadyInteraction = InputStateChanged(null); }; ReadyCompany.Config.UpdateCustomInteractionStringsBasedOnPresets(); ReadyCompany.Config.UpdateBindingsInteractions(); } } private static IInputInteraction? InputStateChanged(CallbackContext? context) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } if (!LocalPlayerAbleToVote) { context?.Reset(); return null; } object result; if (!context.HasValue) { result = null; } else { CallbackContext valueOrDefault = context.GetValueOrDefault(); result = ((CallbackContext)(ref valueOrDefault)).interaction; } return (IInputInteraction?)result; } public static bool IsLobbyReady(ReadyMap? map) { return map != null && map.LobbySize > 0 && (float)map.PlayersReady / (float)map.LobbySize >= (float)ReadyCompany.Config.PercentageForReady.Value / 100f; } public static bool IsLobbyReady() { return IsLobbyReady(ReadyStatus.Value); } public static void ResetReadyUp() { ReadyCompany.Logger.LogDebug((object)$"ReadyUp reset: {ReadyStatus.Value}"); if ((Object)(object)NetworkManager.Singleton != (Object)null && LNetworkUtils.IsHostOrServer) { ReadyCompany.Logger.LogDebug((object)"Real reset!"); _playerReadyMap.Clear(); UpdateReadyMap(); } StartMatchLeverPatches.HasShownReadyWarning = false; ForceReadyStatusChanged(); ReadyCompany.Logger.LogDebug((object)$"Reset done: {ReadyStatus.Value}"); } internal static void OnClientConnected() { UpdateReadyMap(); } internal static void OnClientDisconnected() { UpdateReadyMap(); } private static void ReadyStatusChanged(ReadyMap oldValue, ReadyMap? newValue) { if (newValue == null) { ReadyCompany.Logger.LogDebug((object)"ReadyStatusChanged newValue is null"); return; } ReadyCompany.Logger.LogDebug((object)$"Readyup about to change: {newValue}"); ReadyStatusChangedReal(newValue); } internal static void ReadyStatusChangedReal(ReadyMap newValue) { if (!((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)HUDManager.Instance == (Object)null)) { ReadyCompany.Logger.LogDebug((object)$"Readyup changed: {newValue}"); PopupReadyStatus(newValue); ReadyHandler.NewReadyStatus?.Invoke(newValue); UpdateShipLever(newValue); } } internal static void ForceReadyStatusChanged() { if (LNetworkUtils.IsConnected) { ShouldPlaySound = false; ReadyStatusChangedReal(ReadyStatus.Value); } } internal static void PopupReadyStatus(ReadyMap map) { if (!((Object)(object)HUDManager.Instance == (Object)null) && InVotingPhase && map.LobbySize > 0) { AudioClip[] sfx = (AudioClip[])((!IsLobbyReady(map) || ReadyCompany.Config.CustomLobbyReadySounds.Count <= 0) ? ((ReadyCompany.Config.CustomPopupSounds.Count > 0) ? ((Array)ReadyCompany.Config.CustomPopupSounds.ToArray()) : ((Array)HUDManager.Instance.tipsSFX)) : ReadyCompany.Config.CustomLobbyReadySounds.ToArray()); string briefStatusDisplay = GetBriefStatusDisplay(map); CustomDisplayTip(IsLobbyReady() ? "Lobby is Ready!" : "Lobby not ready yet!", briefStatusDisplay, sfx); CustomDisplaySpectatorTip(briefStatusDisplay); } } private static void CustomDisplaySpectatorTip(string body) { HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance == (Object)null)) { ((TMP_Text)instance.spectatorTipText).text = body; ((Behaviour)instance.spectatorTipText).enabled = true; } } private static void CustomDisplayTip(string headerText, string bodyText, AudioClip[]? sfx = null) { HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null) { return; } if (ReadyCompany.Config.ShowPopup.Value) { ((TMP_Text)instance.tipsPanelHeader).text = headerText; ((TMP_Text)instance.tipsPanelBody).text = bodyText; instance.tipsPanelAnimator.SetTrigger("TriggerHint"); } if (ReadyCompany.Config.PlaySound.Value && ShouldPlaySound) { if (sfx == null) { sfx = instance.tipsSFX; } if (sfx.Length == 0) { sfx = instance.tipsSFX; } Utils.PlayRandomClip(instance.UIAudio, sfx, (float)ReadyCompany.Config.SoundVolume.Value / 100f); } ShouldPlaySound = true; } internal static string GetBriefStatusDisplay(ReadyMap map) { if (map.LobbySize <= 0) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder().Append($"{map.PlayersReady} / {map.LobbySize} Players are ready.").Append("\n"); if (ReadyCompany.Config.DeadPlayersCanVote.Value || !LocalPlayerDead) { stringBuilder.Append(map.LocalPlayerReady ? (ReadyCompany.InputActions?.UnreadyInputName + " to Unready!") : (ReadyCompany.InputActions?.ReadyInputName + " to Ready Up!")).Append(map.LocalPlayerReady ? " ✓" : " ✖"); } return stringBuilder.ToString(); } internal static bool ShouldOverrideLeverState(ReadyMap map) { return ReadyCompany.Config.RequireReadyToStart.Value && InVotingPhase && !IsLobbyReady(map) && !StartOfRound.Instance.travellingToNewLevel; } internal static void UpdateShipLever(ReadyMap map) { if (!((Object)(object)StartOfRound.Instance == (Object)null) && map.LobbySize > 0) { StartMatchLever val = Object.FindObjectOfType(); val.updateInterval = 1E-09f; if (ReadyCompany.Config.AutoStartWhenReady.Value && InVotingPhase && !StartOfRound.Instance.travellingToNewLevel && IsLobbyReady(map)) { val.LeverAnimation(); val.PullLever(); } } } private static void ReadyUpFromClient(bool isReady, ulong clientId) { int key = TryGetPlayerIdFromClientId(clientId); _playerReadyMap[key] = isReady; UpdateReadyMap(); } public static void UpdateReadyMap() { if (LNetworkUtils.IsConnected && LNetworkUtils.IsHostOrServer) { VerifyReadyUpMap(); ReadyStatus.Value = new ReadyMap(_playerReadyMap); ReadyStatus.MakeDirty(); } } private static void VerifyReadyUpMap() { if (!InVotingPhase) { return; } StartOfRound roundManager = StartOfRound.Instance; int key; foreach (KeyValuePair item in _playerReadyMap.Where((KeyValuePair kvp) => kvp.Key != LocalPlayerId && !roundManager.ClientPlayerList.ContainsValue(kvp.Key)).ToList()) { item.Deconstruct(out key, out var _); int key2 = key; _playerReadyMap.Remove(key2); } if (!((Object)(object)roundManager != (Object)null)) { return; } foreach (KeyValuePair clientPlayer in roundManager.ClientPlayerList) { clientPlayer.Deconstruct(out var _, out key); int num = key; _playerReadyMap.TryAdd(num, value: false); if (!ReadyCompany.Config.DeadPlayersCanVote.Value) { PlayerControllerB val = roundManager.allPlayerScripts[num]; if (val.isPlayerDead && !val.isPlayerControlled) { _playerReadyMap[num] = true; } } } int? localPlayerId = LocalPlayerId; if (localPlayerId.HasValue) { _playerReadyMap.TryAdd(localPlayerId.Value, value: false); } } private static void ReadyInputPerformed(CallbackContext context) { if (!LNetworkUtils.IsConnected || !LocalPlayerAbleToVote) { return; } LNetworkVariable readyStatus = ReadyStatus; if (readyStatus != null) { ReadyMap value = readyStatus.Value; if (value != null && !value.LocalPlayerReady) { ReadyCompany.InputActions.UnreadyInput.Disable(); ReadyCompany.InputActions.UnreadyInput.Enable(); } } readyUpMessage.SendServer(true); } private static void UnreadyInputPerformed(CallbackContext context) { if (!LNetworkUtils.IsConnected || !LocalPlayerAbleToVote) { return; } LNetworkVariable readyStatus = ReadyStatus; if (readyStatus != null) { ReadyMap value = readyStatus.Value; if (value != null && value.LocalPlayerReady) { ReadyCompany.InputActions.ReadyInput.Disable(); ReadyCompany.InputActions.ReadyInput.Enable(); } } readyUpMessage.SendServer(false); } private static int TryGetPlayerIdFromClientId(ulong clientId) { StartOfRound instance = StartOfRound.Instance; int value; return (instance != null && instance.ClientPlayerList.TryGetValue(clientId, out value)) ? value : (-1); } } [Serializable] public class ReadyMap : Dictionary { public int PlayersReady => this.Count((KeyValuePair kvp) => kvp.Value); public int LobbySize => base.Count; public bool LocalPlayerReady { get { bool value = default(bool); return ReadyHandler.LocalPlayerId.HasValue && TryGetValue(ReadyHandler.LocalPlayerId.Value, out value) && value; } } public ReadyMap(IDictionary readyMap) : base((IDictionary)readyMap.ToDictionary((KeyValuePair k) => k.Key, (KeyValuePair e) => e.Value)) { } public override bool Equals(object? obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (obj.GetType() != GetType()) { return false; } ReadyMap first = (ReadyMap)obj; return first.SequenceEqual(this); } public override string ToString() { return string.Join(", ", base.Keys.Select((int k) => $"{k}: {base[k]}")); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Enova.ReadyCompany"; public const string PLUGIN_NAME = "ReadyCompany"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace ReadyCompany.Util { public static class AudioUtility { private static AudioClip? LoadFromDiskToAudioClip(string path, AudioType type) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 AudioClip result = null; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, type); try { audioClip.SendWebRequest(); try { while (!audioClip.isDone) { } if ((int)audioClip.result != 1) { ReadyCompany.Logger.LogError((object)("Failed to load WAV AudioClip from path: " + path + " Full error: " + audioClip.error)); } else { result = DownloadHandlerAudioClip.GetContent(audioClip); } } catch (Exception ex) { ReadyCompany.Logger.LogError((object)(ex.Message + ", " + ex.StackTrace)); } return result; } finally { ((IDisposable)audioClip)?.Dispose(); } } public static AudioClip? GetAudioClip(string path) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Invalid comparison between Unknown and I4 //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Invalid comparison between Unknown and I4 //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Invalid comparison between Unknown and I4 string fileName = Path.GetFileName(path); string[] array = path.Split('.'); AudioType val; if (array[^1].ToLower().Contains("wav")) { val = (AudioType)20; ReadyCompany.Logger.LogDebug((object)"File detected as a PCM WAVE file!"); } else if (array[^1].ToLower().Contains("ogg")) { val = (AudioType)14; ReadyCompany.Logger.LogDebug((object)"File detected as an Ogg Vorbis file!"); } else if (array[^1].ToLower().Contains("mp3")) { val = (AudioType)13; ReadyCompany.Logger.LogDebug((object)"File detected as a MPEG MP3 file!"); } else { val = (AudioType)20; ReadyCompany.Logger.LogWarning((object)("Failed to detect file type of a sound file! This may cause issues with other mod functionality. Sound defaulted to WAV. Sound: " + fileName)); } AudioClip val2 = null; ReadyCompany.Logger.LogDebug((object)("Loading AudioClip path: " + path)); AudioType val3 = val; AudioType val4 = val3; if ((int)val4 != 13) { if ((int)val4 != 14) { if ((int)val4 == 20) { val2 = LoadFromDiskToAudioClip(path, (AudioType)20); } } else { val2 = LoadFromDiskToAudioClip(path, (AudioType)14); } } else { val2 = LoadFromDiskToAudioClip(path, (AudioType)13); } ReadyCompany.Logger.LogDebug((object)$"Finished loading AudioClip {fileName} with length of {((val2 != null) ? new float?(val2.length) : null)}!"); if ((Object)(object)val2 == (Object)null) { return val2; } if (string.IsNullOrEmpty(val2.GetName())) { AudioType val5 = val; AudioType val6 = val5; if ((int)val6 != 13) { if ((int)val6 != 14) { if ((int)val6 == 20) { string text = fileName.Replace(".wav", ""); string[] array2 = text.Split('/'); if (array2.Length <= 1) { array2 = text.Split('\\'); } text = array2[^1]; ((Object)val2).name = text; } } else { string text = fileName.Replace(".ogg", ""); string[] array2 = text.Split('/'); if (array2.Length <= 1) { array2 = text.Split('\\'); } text = array2[^1]; ((Object)val2).name = text; } } else { string text = fileName.Replace(".mp3", ""); string[] array2 = text.Split('/'); if (array2.Length <= 1) { array2 = text.Split('\\'); } text = array2[^1]; ((Object)val2).name = text; } } return val2; } } public static class Utils { private static readonly MethodInfo BeginSendClientRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendClientRpc", (Type[])null, (Type[])null); private static readonly MethodInfo BeginSendServerRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendServerRpc", (Type[])null, (Type[])null); internal static bool TryGetRpcID(MethodInfo methodInfo, out uint rpcID) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Collection instructions = PatchManager.GetMethodPatcher((MethodBase)methodInfo).CopyOriginal().Definition.Body.Instructions; rpcID = 0u; for (int i = 0; i < instructions.Count; i++) { if (instructions[i].OpCode == OpCodes.Ldc_I4 && instructions[i - 1].OpCode == OpCodes.Ldarg_0) { rpcID = (uint)(int)instructions[i].Operand; } if (!(instructions[i].OpCode != OpCodes.Call)) { object operand = instructions[i].Operand; MethodReference val = (MethodReference)((operand is MethodReference) ? operand : null); if (val != null && (Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendClientRpc) || Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendServerRpc))) { ReadyCompany.Logger.LogDebug((object)$"Rpc Id found for {methodInfo.Name}: {rpcID}U"); return true; } } } ReadyCompany.Logger.LogFatal((object)("Cannot find Rpc ID for " + methodInfo.Name)); return false; } internal static void PlayRandomClip(AudioSource audioSource, AudioClip[] clipsArray, float oneShotVolume = 1f) { int num = Random.Range(0, Mathf.Min(1000, clipsArray.Length)); audioSource.PlayOneShot(clipsArray[num], oneShotVolume); } internal static void Reset(this CallbackContext context) { ((CallbackContext)(ref context)).action.Disable(); ((CallbackContext)(ref context)).action.Enable(); } internal static bool IsInside(this DirectoryInfo path, DirectoryInfo folder) { if (path.Parent == null) { return false; } if (string.Equals(path.Parent.FullName, folder.FullName, StringComparison.InvariantCultureIgnoreCase)) { return true; } return path.Parent.IsInside(folder); } internal static bool IsInside(this FileInfo path, DirectoryInfo folder) { if (path.Directory == null) { return false; } if (string.Equals(path.Directory.FullName, folder.FullName, StringComparison.InvariantCultureIgnoreCase)) { return true; } return path.Directory.IsInside(folder); } } } namespace ReadyCompany.Patches { [HarmonyPatch(typeof(HoldInteraction))] public class HoldInteractionPatches { [HarmonyPatch("Process")] [HarmonyPrefix] public static bool ProcessPrefix(HoldInteraction __instance, ref InputInteractionContext context) { if ((((InputInteractionContext)(ref context)).action == ReadyCompany.InputActions?.ReadyInput || ((InputInteractionContext)(ref context)).action == ReadyCompany.InputActions?.UnreadyInput) && !ReadyHandler.LocalPlayerAbleToVote) { ((InputInteractionContext)(ref context)).Canceled(); return false; } return true; } } [HarmonyPatch(typeof(HUDManager))] [HarmonyPriority(500)] [HarmonyWrapSafe] internal class HUDPatches { internal static TextMeshProUGUI? ReadyStatusTextMesh; private static RectTransform? _parentTransform; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Start(ref HUDManager __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Component)__instance.HUDElements[2].canvasGroup).transform.parent; if (!((Object)(object)parent == (Object)null)) { GameObject val = new GameObject("ReadyStatusDisplay", new Type[2] { typeof(TextMeshProUGUI), typeof(CanvasGroup) }); val.transform.SetParent(parent); __instance.HUDElements = CollectionExtensions.AddToArray(__instance.HUDElements, new HUDElement { canvasGroup = val.GetComponent(), targetAlpha = 1f }); _parentTransform = val.GetComponent(); RectTransform? parentTransform = _parentTransform; RectTransform? parentTransform2 = _parentTransform; RectTransform? parentTransform3 = _parentTransform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0f); parentTransform3.pivot = val2; Vector2 val5 = (parentTransform.anchorMax = (parentTransform2.anchorMin = val2)); _parentTransform.sizeDelta = new Vector2(208f, 38f); ((Transform)_parentTransform).localScale = Vector3.one; _parentTransform.anchoredPosition3D = new Vector3(0f, 115f, -0.075f); ReadyStatusTextMesh = val.GetComponent(); ((TMP_Text)ReadyStatusTextMesh).font = ((TMP_Text)__instance.controlTipLines[0]).font; ((TMP_Text)ReadyStatusTextMesh).fontSize = 16f; ((TMP_Text)ReadyStatusTextMesh).enableWordWrapping = false; ((Graphic)ReadyStatusTextMesh).color = ReadyCompany.Config.StatusColor.Value; ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)258; ((TMP_Text)ReadyStatusTextMesh).overflowMode = (TextOverflowModes)0; ((Behaviour)ReadyStatusTextMesh).enabled = true; ((TMP_Text)ReadyStatusTextMesh).text = ""; ((TMP_Text)__instance.tipsPanelHeader).m_fontAsset.fallbackFontAssetTable.Add(((TMP_Text)ReadyStatusTextMesh).font); ((TMP_Text)__instance.tipsPanelBody).m_fontAsset.fallbackFontAssetTable.Add(((TMP_Text)ReadyStatusTextMesh).font); GameObject val6 = new GameObject("InteractionBar", new Type[2] { typeof(Image), typeof(InteractionBarUI) }); RectTransform component = val6.GetComponent(); ((Vector2)(ref val5))..ctor(1f, 0f); component.pivot = val5; component.anchorMax = val5; component.anchorMin = Vector2.zero; component.anchoredPosition3D = new Vector3(-2f, 0f, 0f); component.sizeDelta = new Vector2(0f, 5f); Image component2 = val6.GetComponent(); component2.fillMethod = (FillMethod)0; component2.type = (Type)3; component2.sprite = CreateSpriteFromTexture(Texture2D.whiteTexture); ((Graphic)component2).color = Color.white; val6.transform.SetParent(((Component)_parentTransform).transform, false); UpdatePlacementBasedOnConfig(ReadyCompany.Config.StatusPlacement.Value); } } private static Sprite CreateSpriteFromTexture(Texture2D texture2D) { //IL_001a: 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) Sprite val = Sprite.Create(texture2D, new Rect(0f, 0f, (float)((Texture)texture2D).width, (float)((Texture)texture2D).height), new Vector2(0.5f, 0.5f)); ((Object)val).name = ((Object)texture2D).name; return val; } public static void UpdateTextBasedOnStatus(ReadyMap status) { if ((Object)(object)ReadyStatusTextMesh != (Object)null) { ((TMP_Text)ReadyStatusTextMesh).text = ReadyHandler.GetBriefStatusDisplay(status); ((Component)ReadyStatusTextMesh).gameObject.SetActive(ReadyHandler.InVotingPhase); } } public static void UpdatePlacementBasedOnConfig(StatusPlacement placement) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ReadyStatusTextMesh == (Object)null) && !((Object)(object)_parentTransform == (Object)null)) { Vector2 val = default(Vector2); switch (placement) { default: { RectTransform? parentTransform19 = _parentTransform; RectTransform? parentTransform20 = _parentTransform; RectTransform? parentTransform21 = _parentTransform; ((Vector2)(ref val))..ctor(0.5f, 0f); parentTransform21.pivot = val; Vector2 anchorMax = (parentTransform20.anchorMin = val); parentTransform19.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(0f, 110f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)258; break; } case StatusPlacement.BelowHotbar: { RectTransform? parentTransform16 = _parentTransform; RectTransform? parentTransform17 = _parentTransform; RectTransform? parentTransform18 = _parentTransform; ((Vector2)(ref val))..ctor(0.5f, 0f); parentTransform18.pivot = val; Vector2 anchorMax = (parentTransform17.anchorMin = val); parentTransform16.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(0f, 0f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)258; break; } case StatusPlacement.RightHotbar: { RectTransform? parentTransform13 = _parentTransform; RectTransform? parentTransform14 = _parentTransform; RectTransform? parentTransform15 = _parentTransform; ((Vector2)(ref val))..ctor(1f, 0f); parentTransform15.pivot = val; Vector2 anchorMax = (parentTransform14.anchorMin = val); parentTransform13.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(-75f, 55f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)257; break; } case StatusPlacement.LeftHotbar: { RectTransform? parentTransform10 = _parentTransform; RectTransform? parentTransform11 = _parentTransform; RectTransform? parentTransform12 = _parentTransform; ((Vector2)(ref val))..ctor(0f, 0f); parentTransform12.pivot = val; Vector2 anchorMax = (parentTransform11.anchorMin = val); parentTransform10.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(75f, 55f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)260; break; } case StatusPlacement.TopScreen: { RectTransform? parentTransform7 = _parentTransform; RectTransform? parentTransform8 = _parentTransform; RectTransform? parentTransform9 = _parentTransform; ((Vector2)(ref val))..ctor(0.5f, 1f); parentTransform9.pivot = val; Vector2 anchorMax = (parentTransform8.anchorMin = val); parentTransform7.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(0f, 0f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)258; break; } case StatusPlacement.BottomRightScreen: { RectTransform? parentTransform4 = _parentTransform; RectTransform? parentTransform5 = _parentTransform; RectTransform? parentTransform6 = _parentTransform; ((Vector2)(ref val))..ctor(1f, 0f); parentTransform6.pivot = val; Vector2 anchorMax = (parentTransform5.anchorMin = val); parentTransform4.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(0f, 0f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)260; break; } case StatusPlacement.BottomLeftScreen: { RectTransform? parentTransform = _parentTransform; RectTransform? parentTransform2 = _parentTransform; RectTransform? parentTransform3 = _parentTransform; ((Vector2)(ref val))..ctor(0f, 0f); parentTransform3.pivot = val; Vector2 anchorMax = (parentTransform2.anchorMin = val); parentTransform.anchorMax = anchorMax; _parentTransform.anchoredPosition3D = new Vector3(0f, 0f, -0.075f); ((TMP_Text)ReadyStatusTextMesh).alignment = (TextAlignmentOptions)257; break; } } } } } [HarmonyPatch(typeof(InputActionMap))] [HarmonyPriority(500)] [HarmonyWrapSafe] internal class InputActionMapPatches { [HarmonyPatch("OnBindingModified")] [HarmonyPostfix] public static void OnBindingModifiedPatch(ref InputActionMap __instance) { InputActionMap obj = __instance; ReadyInputs? inputActions = ReadyCompany.InputActions; if (obj != ((inputActions != null) ? inputActions.ReadyInput.actionMap : null)) { InputActionMap obj2 = __instance; ReadyInputs? inputActions2 = ReadyCompany.InputActions; if (obj2 != ((inputActions2 != null) ? inputActions2.UnreadyInput.actionMap : null)) { return; } } ReadyHandler.ForceReadyStatusChanged(); } } internal class JoinPatches { internal static void Init() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(StartOfRound), "SyncAlreadyHeldObjectsServerRpc", (Type[])null, (Type[])null); if (Utils.TryGetRpcID(methodInfo, out var rpcID)) { MethodInfo methodInfo2 = AccessTools.Method(typeof(StartOfRound), $"__rpc_handler_{rpcID}", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(JoinPatches), "ClientConnectionCompleted1", (Type[])null, (Type[])null); ReadyCompany.Harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null); } } private static void ClientConnectionCompleted1(NetworkBehaviour target, __RpcParams rpcParams) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) StartOfRound val = (StartOfRound)target; if (((NetworkBehaviour)val).IsServer) { ulong senderClientId = rpcParams.Server.Receive.SenderClientId; ReadyHandler.OnClientConnected(); } } } [HarmonyPatch(typeof(MenuManager))] [HarmonyPriority(500)] [HarmonyWrapSafe] internal class MenuManagerPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] public static void MainMenuLoaded() { ReadyHandler.ResetReadyUp(); } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPriority(500)] [HarmonyWrapSafe] internal class PlayerControllerBPatches { private static bool _localPlayerUsingControllerPreviously; [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] public static void PlayerLoadedPatch() { if (LNetworkUtils.IsConnected && LNetworkUtils.IsHostOrServer) { ReadyHandler.ShouldPlaySound = false; ReadyHandler.ResetReadyUp(); } } [HarmonyPatch("Look_performed")] [HarmonyPostfix] public static void LookPerformedPatch() { if (!((Object)(object)StartOfRound.Instance == (Object)null)) { if (StartOfRound.Instance.localPlayerUsingController != _localPlayerUsingControllerPreviously) { ReadyHandler.ForceReadyStatusChanged(); } _localPlayerUsingControllerPreviously = StartOfRound.Instance.localPlayerUsingController; } } } [HarmonyPatch(typeof(StartMatchLever))] [HarmonyAfter(new string[] { "imabatby.lethallevelloader" })] [HarmonyWrapSafe] internal class StartMatchLeverPatches { public static bool HasShownReadyWarning; private static bool _shouldOverrideLeverState; private static string _previousHoverTip; private static string _previousDisabledHoverTip; private static bool _previousInteractableState; private static bool _justWroteInteractableState; [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(InteractTrigger ___triggerScript) { _previousHoverTip = ___triggerScript.hoverTip; _previousDisabledHoverTip = ___triggerScript.disabledHoverTip; _previousInteractableState = ___triggerScript.interactable; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void UpdatePatch(InteractTrigger ___triggerScript) { _shouldOverrideLeverState = ReadyHandler.ShouldOverrideLeverState(ReadyHandler.ReadyStatus.Value); bool flag = string.Equals(___triggerScript.hoverTip, "[ WARNING: Lobby Not Ready ]") || string.Equals(___triggerScript.hoverTip, "[ Lobby must be ready to start ]"); bool flag2 = string.Equals(___triggerScript.disabledHoverTip, "[ WARNING: Lobby Not Ready ]") || string.Equals(___triggerScript.disabledHoverTip, "[ Lobby must be ready to start ]"); if (!flag && !flag2) { _previousHoverTip = ___triggerScript.hoverTip; _previousDisabledHoverTip = ___triggerScript.disabledHoverTip; _previousInteractableState = ___triggerScript.interactable; } if (_previousInteractableState != ___triggerScript.interactable && !_justWroteInteractableState) { _previousInteractableState = ___triggerScript.interactable; } if (_shouldOverrideLeverState) { bool flag3 = (_previousInteractableState ? LNetworkUtils.IsHostOrServer : _previousInteractableState); ___triggerScript.hoverTip = (___triggerScript.disabledHoverTip = (flag3 ? "[ WARNING: Lobby Not Ready ]" : "[ Lobby must be ready to start ]")); ___triggerScript.interactable = flag3; _justWroteInteractableState = true; } else if (flag || flag2) { ___triggerScript.hoverTip = _previousHoverTip; ___triggerScript.disabledHoverTip = ((string.IsNullOrEmpty(_previousDisabledHoverTip) && !_previousInteractableState) ? _previousHoverTip : _previousDisabledHoverTip); ___triggerScript.interactable = _previousInteractableState; _justWroteInteractableState = false; } } [HarmonyPatch("BeginHoldingInteractOnLever")] [HarmonyPostfix] public static void OnHoldLeverPatch(StartMatchLever __instance) { if (_shouldOverrideLeverState) { __instance.triggerScript.timeToHold = 4f; if (!HasShownReadyWarning) { HUDManager.Instance.DisplayTip("HALT!", "The lobby is not ready!", true, false, "LC_Tip1"); HasShownReadyWarning = true; __instance.hasDisplayedTimeWarning = false; } } else if (ReadyHandler.InVotingPhase && TimeOfDay.Instance.daysUntilDeadline > 0) { __instance.triggerScript.timeToHold = 0.7f; } } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPriority(500)] [HarmonyWrapSafe] internal class StartOfRoundPatches { [HarmonyPatch("OnPlayerDC")] [HarmonyPostfix] public static void OnClientDisconnectedPatch() { if (LNetworkUtils.IsConnected && LNetworkUtils.IsHostOrServer) { ReadyHandler.OnClientDisconnected(); } } [HarmonyPatch("SetShipReadyToLand")] [HarmonyPatch("StartGame")] [HarmonyPatch("SwitchMapMonitorPurpose")] [HarmonyPatch("SceneManager_OnLoad")] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void NeedsResetPatches() { if (LNetworkUtils.IsConnected) { ReadyHandler.ResetReadyUp(); } if (!ReadyHandler.InVotingPhase && (Object)(object)HUDManager.Instance != (Object)null) { ((Behaviour)HUDManager.Instance.spectatorTipText).enabled = false; } } [HarmonyPatch("ArriveAtLevel")] [HarmonyPostfix] public static void OnShipArriveAtLevelPatch() { if (LNetworkUtils.IsConnected && LNetworkUtils.IsHostOrServer) { ReadyHandler.UpdateShipLever(ReadyHandler.ReadyStatus.Value); } } } } namespace ReadyCompany.Config { public enum InteractionPreset { Hold, LongHold, Press, DoubleTap, TripleTap, Custom } public class ReadyCompanyConfig : SyncedConfig2 { internal const string FEATURES_STRING = "Features"; internal const string CUSTOMIZATION_STRING = "Customization"; internal const string INTERACTION_STRING = "Interaction"; [field: SyncedEntryField] public SyncedEntry RequireReadyToStart { get; private set; } [field: SyncedEntryField] public SyncedEntry AutoStartWhenReady { get; private set; } [field: SyncedEntryField] public SyncedEntry PercentageForReady { get; private set; } [field: SyncedEntryField] public SyncedEntry DeadPlayersCanVote { get; private set; } public ConfigEntry StatusColor { get; private set; } public ConfigEntry StatusPlacement { get; private set; } public ConfigEntry ShowPopup { get; private set; } public ConfigEntry PlaySound { get; private set; } public ConfigEntry SoundVolume { get; private set; } public ConfigEntry ReadyBarColor { get; private set; } public ConfigEntry ReadyInteractionPreset { get; private set; } public ConfigEntry CustomReadyInteractionString { get; private set; } public ConfigEntry UnreadyBarColor { get; private set; } public ConfigEntry UnreadyInteractionPreset { get; private set; } public ConfigEntry CustomUnreadyInteractionString { get; private set; } internal List CustomPopupSounds { get; private set; } = new List(); internal List CustomLobbyReadySounds { get; private set; } = new List(); public ReadyCompanyConfig(ConfigFile cfg) : base("Enova.ReadyCompany") { //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) RequireReadyToStart = SyncedBindingExtensions.BindSyncedEntry(cfg, "Features", "RequireReadyToStart", false, "Require the lobby to be Ready to pull the ship lever."); AutoStartWhenReady = SyncedBindingExtensions.BindSyncedEntry(cfg, "Features", "AutoStartWhenReady", false, "Automatically pull the ship lever when the lobby is Ready."); PercentageForReady = SyncedBindingExtensions.BindSyncedEntry(cfg, "Features", "PercentageForReady", 100, "What percentage of ready players is needed for the lobby to be considered \"Ready\"."); DeadPlayersCanVote = SyncedBindingExtensions.BindSyncedEntry(cfg, "Features", "DeadPlayersCanVote", true, "Whether or not dead players are allowed to participate in the ready check or are forced to be ready. (During Company visits)"); RequireReadyToStart.Changed += delegate { ReadyHandler.UpdateReadyMap(); }; AutoStartWhenReady.Changed += delegate { ReadyHandler.UpdateReadyMap(); }; RequireReadyToStart.Changed += delegate { ReadyHandler.UpdateReadyMap(); }; DeadPlayersCanVote.Changed += delegate { ReadyHandler.UpdateReadyMap(); }; StatusColor = cfg.Bind("Customization", "StatusColor", new Color(0.9528f, 0.3941f, 0f, 1f), "The color of the ready status text."); StatusPlacement = cfg.Bind("Customization", "StatusPlacement", global::ReadyCompany.Config.StatusPlacement.AboveHotbar, "Where to place the text showing the ready status."); ShowPopup = cfg.Bind("Customization", "ShowPopup", false, "Whether or not to show a popup when the ready status changes."); PlaySound = cfg.Bind("Customization", "PlaySound", true, "Whether or not to play a sound when the ready status changes."); SoundVolume = cfg.Bind("Customization", "SoundVolume", 100, "The volume of the popup sound."); StatusPlacement.SettingChanged += delegate { HUDPatches.UpdatePlacementBasedOnConfig(StatusPlacement.Value); }; ReadyBarColor = cfg.Bind("Interaction", "ReadyBarColor", Color.white, "What color the bar should be when holding the bind."); UnreadyBarColor = cfg.Bind("Interaction", "UnreadyBarColor", Color.red, "What color the bar should be when holding the bind."); ReadyInteractionPreset = cfg.Bind("Interaction", "ReadyInteractionPreset", InteractionPreset.LongHold, "How you want to press the ready bind to ready up."); UnreadyInteractionPreset = cfg.Bind("Interaction", "UnreadyInteractionPreset", InteractionPreset.TripleTap, "How you want to press the unready bind to unready."); CustomReadyInteractionString = cfg.Bind("Interaction", "CustomReadyInteractionString", "hold(duration = 1.5)", "Specify a custom interaction type for this input."); CustomUnreadyInteractionString = cfg.Bind("Interaction", "CustomUnreadyInteractionString", "multiTap(tapTime = 0.2, tapCount = 3)", "Specify a custom interaction type for this input."); ReadyInteractionPreset.SettingChanged += delegate { SetInteractionStringBasedOnPreset(CustomReadyInteractionString, ReadyInteractionPreset.Value); }; UnreadyInteractionPreset.SettingChanged += delegate { SetInteractionStringBasedOnPreset(CustomUnreadyInteractionString, UnreadyInteractionPreset.Value); }; CustomReadyInteractionString.SettingChanged += delegate { UpdateBindingsInteractions(); }; CustomUnreadyInteractionString.SettingChanged += delegate { UpdateBindingsInteractions(); }; LoadCustomSounds(); ConfigManager.Register((SyncedConfig2)(object)this); } internal void LoadCustomSounds() { CustomPopupSounds.Clear(); CustomLobbyReadySounds.Clear(); DirectoryInfo directoryInfo = Directory.CreateDirectory(Path.Combine(Paths.ConfigPath, "Enova.ReadyCompany", "CustomSounds")); DirectoryInfo folder = directoryInfo.CreateSubdirectory("LobbyReady"); foreach (FileInfo item in directoryInfo.EnumerateFiles("*.*", SearchOption.AllDirectories)) { if (new string[3] { ".wav", ".mp3", ".ogg" }.Contains(item.Extension)) { AudioClip audioClip = AudioUtility.GetAudioClip(item.FullName); if ((Object)(object)audioClip == (Object)null) { ReadyCompany.Logger.LogError((object)$"Failed to load audio clip: {item}"); continue; } if (item.IsInside(folder)) { CustomLobbyReadySounds.Add(audioClip); continue; } ReadyCompany.Logger.LogDebug((object)$"Loading audioclip {item}"); CustomPopupSounds.Add(audioClip); } } } internal void UpdateCustomInteractionStringsBasedOnPresets() { SetInteractionStringBasedOnPreset(CustomReadyInteractionString, ReadyInteractionPreset.Value); SetInteractionStringBasedOnPreset(CustomUnreadyInteractionString, UnreadyInteractionPreset.Value); } private void SetInteractionStringBasedOnPreset(ConfigEntry config, InteractionPreset value) { config.Value = GetInteractionStringBasedOnPreset(value) ?? config.Value; } private string? GetInteractionStringBasedOnPreset(InteractionPreset value) { if (1 == 0) { } string result = value switch { InteractionPreset.Hold => "hold(duration = 0.75)", InteractionPreset.LongHold => "hold(duration = 1.5)", InteractionPreset.Press => "press", InteractionPreset.DoubleTap => "multiTap(tapTime = 0.2, tapCount = 2)", InteractionPreset.TripleTap => "multiTap(tapTime = 0.2, tapCount = 3)", InteractionPreset.Custom => null, _ => throw new ArgumentOutOfRangeException("value", value, null), }; if (1 == 0) { } return result; } internal void UpdateBindingsInteractions() { if (ReadyCompany.InputActions != null) { ReadyCompany.Logger.LogDebug((object)"Update bindings!"); UpdateBindingInteraction(ReadyCompany.InputActions.ReadyInput, CustomReadyInteractionString.Value); UpdateBindingInteraction(ReadyCompany.InputActions.UnreadyInput, CustomUnreadyInteractionString.Value); } } internal void UpdateBindingInteraction(InputAction action, string interactions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Enumerator enumerator = action.bindings.GetEnumerator(); try { while (enumerator.MoveNext()) { InputBinding current = enumerator.Current; BindingSyntax val = InputActionSetupExtensions.ChangeBinding(action, current); InputBinding val2 = current; ((InputBinding)(ref val2)).interactions = interactions; ((BindingSyntax)(ref val)).To(val2); } } finally { ((IDisposable)enumerator).Dispose(); } } } public class ReadyInputs : LcInputActions { [InputAction(/*Could not decode attribute arguments.*/)] public InputAction ReadyInput { get; set; } = null; [InputAction(/*Could not decode attribute arguments.*/)] public InputAction UnreadyInput { get; set; } = null; internal int CurrentBinding { get { StartOfRound instance = StartOfRound.Instance; return (instance != null && instance.localPlayerUsingController) ? 1 : 0; } } public string ReadyInputName { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) InputBinding val = ReadyInput.bindings[CurrentBinding]; return ((InputBinding)(ref val)).ToDisplayString((DisplayStringOptions)0, (InputControl)null); } } public string UnreadyInputName { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) InputBinding val = UnreadyInput.bindings[CurrentBinding]; return ((InputBinding)(ref val)).ToDisplayString((DisplayStringOptions)0, (InputControl)null); } } } public enum StatusPlacement { AboveHotbar, BelowHotbar, RightHotbar, LeftHotbar, TopScreen, BottomRightScreen, BottomLeftScreen } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }