using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 HarmonyLib; using InteractableTruckDoor.Patch; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using TMPro; using UnityEngine; 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: AssemblyCompany("UnloadedHangar")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("TBD")] [assembly: AssemblyFileVersion("0.4.7.0")] [assembly: AssemblyInformationalVersion("0.4.7+75e95b7d38c16d78266d6b3452ddfb59cc4fbbc1")] [assembly: AssemblyProduct("InteractableTruckDoor")] [assembly: AssemblyTitle("InteractableTruckDoor")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: InternalsVisibleTo("TaxmansOrdersExtremeEdition")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.7.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 InteractableTruckDoor { internal class AnimationHandler : MonoBehaviour { internal AnimationCurve curve; internal float eval = 1f; internal float startYPosition; internal float doorOpenSpeed = 1f; internal float doorCloseSpeed = 1f; internal float doorTimer; internal float doorTimerText = 0.3f; internal float doorCloseTime = 20f; internal float doorTimerRegenDuration = 0.22f; internal TruckDoor TruckDoor; private Vector3 TempVector3; internal static AnimationHandler Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } TruckDoor = ((Component)this).GetComponent(); } private void Start() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown curve = new AnimationCurve(); curve.CopyFrom(TruckDoor.doorCurve); if (Helper.Instance.SpawnDatabase.TryGetValue(((Object)Object.FindObjectOfType()).name, out TempVector3)) { startYPosition = TempVector3.y + 4.7855f; } else { startYPosition = 5.4405f; } } private void Update() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) if (eval < 1f) { float num = curve.Evaluate(eval); eval += doorCloseSpeed * Time.deltaTime; ((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, startYPosition - 2.5f * num, ((Component)this).transform.position.z); } if (Helper.isDoorClosed && (SemiFunc.RunIsLevel() | SemiFunc.RunIsShop())) { if (doorTimer > 0f) { doorTimer = Mathf.Clamp(doorTimer - Time.deltaTime / doorCloseTime, 0f, 1f); doorTimerText = Mathf.Clamp(doorTimerText - Time.deltaTime / (doorCloseTime * 1.4f), 0f, 0.3f); } else if (doorTimer >= 0f) { ButtonControler.Instance.OnTimerRanOut(); } } else if (doorTimer != 1f && !Helper.isDoorClosed && (SemiFunc.RunIsLevel() | SemiFunc.RunIsShop())) { doorTimer = Mathf.Clamp(doorTimer + Time.deltaTime / (doorCloseTime * doorTimerRegenDuration), 0f, 1f); doorTimerText = Mathf.Clamp(doorTimerText + Time.deltaTime / doorCloseTime, 0f, 1f); } } internal void OpenDoor() { if (PhotonNetwork.IsConnected) { Net.Instance.OpenDoorNetworked(); Net.Instance.TransmitRPC("OpenDoorNetworked", (RpcTarget)0); } else if (!PhotonNetwork.IsConnected) { Net.Instance.OpenDoorNetworked(); } } internal void CloseDoor() { if (PhotonNetwork.IsConnected) { Net.Instance.TransmitRPC("CloseDoorNetworked", (RpcTarget)0); } else if (!PhotonNetwork.IsConnected) { Net.Instance.CloseDoorNetworked(); } } } internal class ButtonControler : MonoBehaviour { [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private WaitUntil <>2__current; public ButtonControler <>4__this; WaitUntil IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Helper.isDoorMoving = true; AnimationHandler.Instance.CloseDoor(); <>2__current = new WaitUntil((Func)(() => AnimationHandler.Instance.eval >= 1f)); <>1__state = 1; return true; case 1: <>1__state = -1; Helper.isDoorClosed = true; Helper.isDoorMoving = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private WaitUntil <>2__current; public ButtonControler <>4__this; WaitUntil IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Helper.isDoorMoving = true; AnimationHandler.Instance.OpenDoor(); <>2__current = new WaitUntil((Func)(() => AnimationHandler.Instance.TruckDoor.doorEval >= 1f)); <>1__state = 1; return true; case 1: <>1__state = -1; Helper.isDoorClosed = false; Helper.isDoorMoving = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static bool didThrow; private bool _buttonAnimation; internal float _buttonAnimationEval; public Transform ButtonVisualTransform; internal ExtractionPoint _extractionPoint = Object.FindAnyObjectByType(); public TextMeshProUGUI doorPowerText; public TextMeshProUGUI ITDMDCC_Version; public TextMeshProUGUI RemoteControlStateText; public GameObject PhysGrabObjectGrabAreaGameObject; internal static ButtonControler Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } ((TMP_Text)ITDMDCC_Version).text = "0.4.7"; } private void Start() { ((Component)((Component)Instance).gameObject.transform.GetChild(1)).GetComponent().ViewID = PhotonView.Get((Component)(object)Instance).ViewID + 1; if (PhotonNetwork.IsConnected) { Net.Instance.TransmitRPC("ResetDoor", (RpcTarget)0); } else if (!PhotonNetwork.IsConnected) { Net.Instance.ResetDoor(); } Helper.Instance.CheckForCorrectZ(); if (Compatibility.REPO_LibPresent && InteractableTruckDoor.ConfigManager.EnableRemote.Value) { ((TMP_Text)RemoteControlStateText).text = "ONLINE"; } } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) ButtonAnimation(); ((TMP_Text)doorPowerText).text = $"{Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f)}%"; if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 90 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 89) { ((Graphic)doorPowerText).color = new Color(0.5f, 1f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 88 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 79) { ((Graphic)doorPowerText).color = new Color(0.6666666f, 1f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 78 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 69) { ((Graphic)doorPowerText).color = new Color(5f / 6f, 1f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 68 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 59) { ((Graphic)doorPowerText).color = new Color(1f, 1f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 58 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 49) { ((Graphic)doorPowerText).color = new Color(1f, 0.8333334f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 48 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 39) { ((Graphic)doorPowerText).color = new Color(1f, 2f / 3f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 38 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 29) { ((Graphic)doorPowerText).color = new Color(1f, 0.5f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 28 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 19) { ((Graphic)doorPowerText).color = new Color(1f, 0.3333333f, 0f, 1f); } else if (Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 18 || Mathf.RoundToInt(AnimationHandler.Instance.doorTimer * 100f) >= 9) { ((Graphic)doorPowerText).color = new Color(1f, 0.1666667f, 0f, 1f); } else { ((Graphic)doorPowerText).color = new Color(1f, 0f, 0f, 1f); } } public void OnClick() { if (PhotonNetwork.IsConnected) { Net.Instance.TransmitRPC("OnClickRPC", (RpcTarget)0); } else if (!PhotonNetwork.IsConnected) { Net.Instance.OnClickRPC(); } } public void OnTimerRanOut() { if (PhotonNetwork.IsConnected) { Net.Instance.TransmitRPC("OnTimerRanOutNetworked", (RpcTarget)0); } else if (!PhotonNetwork.IsConnected) { Net.Instance.OnTimerRanOutNetworked(); } } [IteratorStateMachine(typeof(d__10))] internal IEnumerator CloseDoorInternal() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__11))] internal IEnumerator OpenDoorInternal() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this }; } private void ButtonAnimation() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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) if (!((Object)(object)_extractionPoint == (Object)null) && _buttonAnimation) { _buttonAnimationEval += Time.deltaTime * 2f; _buttonAnimationEval = Mathf.Clamp01(_buttonAnimationEval); float num = _extractionPoint.buttonPressAnimationCurve.Evaluate(_buttonAnimationEval); Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.5f, 0f, 1f); ((Renderer)((Component)ButtonVisualTransform).GetComponent()).material.SetColor("_EmissionColor", Color.Lerp(val, Color.white, num)); num = Mathf.Clamp(num, 0.5f, 1f); ButtonVisualTransform.localScale = new Vector3(1f, num, 1f); if (_buttonAnimationEval >= 1f) { _buttonAnimation = false; _buttonAnimationEval = 0f; } } } internal void ButtonPushVisualsStart() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_extractionPoint == (Object)null) && !_buttonAnimation) { ButtonVisualTransform.localScale = new Vector3(1f, 0.1f, 1f); _extractionPoint.soundButton.Play(ButtonVisualTransform.position, 1f, 1f, 1f, 1f); _buttonAnimationEval = 0f; _buttonAnimation = true; } } } internal static class Compatibility { internal static bool REPO_LibPresent; internal static bool InvalidConfigurationPresent; internal static void CheckChainloader() { try { if (IsModPresent("REPOLib", "REPOLib detected... Lifting restricted mode!")) { REPO_LibPresent = true; } if (IsInvalidModPresent("com.feralelf.sonic", new InvalidConfigurationException())) { InvalidConfigurationPresent = true; } } catch (Exception ex) { InteractableTruckDoor.logger.LogError((object)ex); } } private static Assembly GetAssembly(string name) { if (Chainloader.PluginInfos.ContainsKey(name)) { return ((object)Chainloader.PluginInfos[name].Instance).GetType().Assembly; } return null; } private static bool IsModPresent(string name, string logMessage) { bool flag = Chainloader.PluginInfos.ContainsKey(name); if (flag) { InteractableTruckDoor.logger.LogInfo((object)(name + " is present. " + logMessage)); } return flag; } private static bool IsInvalidModPresent(string name, Exception logErrorMessage) { bool flag = Chainloader.PluginInfos.ContainsKey(name); if (flag) { InteractableTruckDoor.logger.LogFatal((object)logErrorMessage.Source); } return flag; } } internal class ConfigManager { public ExtendedConfigEntry EnableConfiguration; public ExtendedConfigEntry DoorCloseSpeed; public ExtendedConfigEntry DoorOpenSpeed; public ExtendedConfigEntry DoorCloseTime; public ExtendedConfigEntry DoorTimerRegenDuration; public ExtendedConfigEntry EnableRemote; public ConfigManager() { BindConfigs(); ClearUnusedEntries(); } private void BindConfigs() { EnableConfiguration = new ExtendedConfigEntry("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used."); DoorCloseSpeed = new ExtendedConfigEntry("General Settings", "DoorCloseSpeed", 1.5f, "How fast will the truck door close.", useEnableConfiguration: true); DoorOpenSpeed = new ExtendedConfigEntry("General Settings", "DoorOpenSpeed", 1.5f, "How fast will the truck door open.", useEnableConfiguration: true); DoorCloseTime = new ExtendedConfigEntry("General Settings", "DoorCloseTime", 20f, "How long will the truck door remain closed.", useEnableConfiguration: true); DoorTimerRegenDuration = new ExtendedConfigEntry("General Settings", "DoorTimerRegenDuration", 0.22f, "How long will it take for the door timer to regenerate.", useEnableConfiguration: true); EnableRemote = new ExtendedConfigEntry("General Settings", "EnableRemote", defaultValue: true, "WARNING! Disabling this will remove all purchased Remote Control Items! Whether the truck door remote is enabled. REPOLib required!", useEnableConfiguration: true); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)InteractableTruckDoor.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary dictionary = (Dictionary)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal class Content { public static GameObject[] AssetsList; public static Item[] ItemList; public static List ItemAttributesList; public static ItemAttributes tempData; public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)InteractableTruckDoor.Instance).Info.Location); string text = Path.Combine(directoryName, "interactabletruckdoorassets"); AssetBundle val = AssetBundle.LoadFromFile(text); AssetsList = val.LoadAllAssets(); ItemList = val.LoadAllAssets(); if (Compatibility.REPO_LibPresent && InteractableTruckDoor.ConfigManager.EnableRemote.Value) { ExtraContent.RegisterExtraContent(); } else { InteractableTruckDoor.logger.LogError((object)"REPOLib not detected! Executing immediate restricted mode!"); } InteractableTruckDoor.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); if (Compatibility.InvalidConfigurationPresent) { val.Unload(true); InteractableTruckDoor.logger.LogFatal((object)new UnauthorizedAccessException("Internally triggered unload!", new TaintedInstanceException())); } } catch (Exception arg) { InteractableTruckDoor.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}"); } } } internal static class ExtraContent { internal static void RegisterExtraContent() { Content.ItemAttributesList = new List(); Content.ItemAttributesList.Add(Content.AssetsList[1].gameObject.GetComponent()); Content.tempData = Content.ItemAttributesList[0]; Items.RegisterItem(Content.tempData); CollectionExtensions.AddItem((IEnumerable)Content.ItemAttributesList, Content.tempData); } } internal sealed class InvalidConfigurationException : Exception { internal InvalidConfigurationException() { Source = "InvalidConfigurationException: The provided configuration is not valid!"; } internal InvalidConfigurationException(string message) { Source = message; } private static void Throw() { throw new InvalidConfigurationException(); } } internal sealed class TaintedInstanceException : Exception { internal TaintedInstanceException() { Source = "TaintedInstanceException: The current plugin instance is tainted!"; } internal TaintedInstanceException(string message) { Source = message; } private static void Throw() { throw new TaintedInstanceException(); } } public class ExtendedConfigEntry { public ConfigEntry ConfigEntry; public Func GetValue; public Action SetValue; public bool UseEnableConfiguration = false; public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue; public T Value { get { return GetValue(); } set { SetValue(value); } } public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = false) { ConfigEntry = ((BaseUnityPlugin)InteractableTruckDoor.Instance).Config.Bind(section, key, defaultValue, description); UseEnableConfiguration = useEnableConfiguration; Initialize(); } public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = false) { ConfigEntry = ((BaseUnityPlugin)InteractableTruckDoor.Instance).Config.Bind(section, key, defaultValue, configDescription); UseEnableConfiguration = useEnableConfiguration; Initialize(); } private void Initialize() { if (GetValue == null) { GetValue = () => (UseEnableConfiguration && !InteractableTruckDoor.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value; } if (SetValue == null) { SetValue = delegate(T value) { ConfigEntry.Value = value; }; } } public void ResetToDefault() { ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue; } } public class Helper : MonoBehaviour { internal static bool isDoorClosed = false; internal static bool isDoorMoving = false; private bool hasRan = false; private static readonly List ItemBoundList = new List(); internal Dictionary SpawnDatabase = new Dictionary { { "Start Room - Manor - Small Room(Clone)", new Vector3(3f, 0.655f, -13.5217f) }, { "Module - Minecraft - Start(Clone)", new Vector3(3f, 0.655f, -19.7219f) }, { "Start Room - Museum - Emergency Exit(Clone)", new Vector3(3f, 0.655f, -12.2217f) }, { "Start Room - Museum - Storage Room(Clone)", new Vector3(3f, 0.655f, -13.1217f) }, { "Start Room - Museum - Side Door(Clone)", new Vector3(3f, 0.655f, -13.5217f) }, { "S - Clearing(Clone)", new Vector3(9.9f, 0.655f, -35.9436f) }, { "Start Room - Bank - Board Room(Clone)", new Vector3(3f, 0.655f, -15.8217f) }, { "Start Room - Bank - Vault(Clone)", new Vector3(3f, 0.655f, -20.9217f) }, { "Start Room - Damp Mine - Lobby1(Clone)", new Vector3(3.0052f, 4.7009f, -24.6749f) }, { "Start Room - Damp Mine - Lobby2(Clone)", new Vector3(-2.0474f, 6.7009f, -23.4551f) }, { "Start - Hallway(Clone)", new Vector3(3f, 0.655f, -30.9218f) }, { "Start - Lobby(Clone)", new Vector3(3f, 0.655f, -18.4217f) }, { "Start - Bottleneck(Clone)", new Vector3(3f, 0.655f, -25.9216f) }, { "Start - Signin(Clone)", new Vector3(-2.1f, 0.655f, -20.9217f) }, { "Start Room - Bank - Waiting Room(Clone)", new Vector3(3f, 0.655f, -15.8217f) }, { "Start Room - Damp Mine - Lobby3(Clone)", new Vector3(3f, 0.655f, -28.6382f) }, { "Start Room - Damp Mine - Lobby4(Clone)", new Vector3(3f, 1.155f, -29.6382f) } }; public static Helper Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } internal void DebugSpawnButton(Transform Parent, bool WorldPositionStays) { GameObject val = Object.Instantiate(Content.AssetsList[0], Parent, WorldPositionStays); PhotonView componentInChildren = val.gameObject.GetComponentInChildren(true); componentInChildren.ViewID = 756454; } internal void DebugAssignObject(Transform ObjectToBeAssigned, Transform Parent) { ((Component)ObjectToBeAssigned).transform.parent = Parent; } internal void Sync() { if (PhotonNetwork.IsConnected && PhotonNetwork.IsMasterClient && (SemiFunc.RunIsLevel() | SemiFunc.RunIsShop())) { PhotonView val = PhotonView.Get((Component)(object)Instance); val.RPC("SendDataToClients", (RpcTarget)0, new object[4] { InteractableTruckDoor.ConfigManager.DoorOpenSpeed.Value, InteractableTruckDoor.ConfigManager.DoorCloseSpeed.Value, InteractableTruckDoor.ConfigManager.DoorCloseTime.Value, InteractableTruckDoor.ConfigManager.DoorTimerRegenDuration.Value }); } else if (!PhotonNetwork.IsConnected && (SemiFunc.RunIsLevel() | SemiFunc.RunIsShop())) { SendDataToClients(InteractableTruckDoor.ConfigManager.DoorOpenSpeed.Value, InteractableTruckDoor.ConfigManager.DoorCloseSpeed.Value, InteractableTruckDoor.ConfigManager.DoorCloseTime.Value, InteractableTruckDoor.ConfigManager.DoorTimerRegenDuration.Value); } } [PunRPC] private void SendDataToClients(float doorOpenSpeedInternal, float doorCloseSpeedInternal, float doorCloseTime, float doorTimerRegenDuration) { AnimationHandler.Instance.doorOpenSpeed = Mathf.Clamp(doorOpenSpeedInternal, 0.1f, 10f); AnimationHandler.Instance.doorCloseSpeed = Mathf.Clamp(doorCloseSpeedInternal, 0.1f, 10f); AnimationHandler.Instance.doorCloseTime = Mathf.Clamp(doorCloseTime, 1f, 30f); AnimationHandler.Instance.doorTimerRegenDuration = Mathf.Clamp(doorTimerRegenDuration, 0.1f, 10f); InteractableTruckDoor.logger.LogInfo((object)$"Received data from MasterClient! Data -> DoorOpenSpeed: {AnimationHandler.Instance.doorOpenSpeed}, DoorCloseSpeed: {AnimationHandler.Instance.doorCloseSpeed}, DoorCloseTime: {AnimationHandler.Instance.doorCloseTime}, DoorTimerRegenDuration: {AnimationHandler.Instance.doorTimerRegenDuration}"); } internal void CheckForCorrectZ() { try { if (!SemiFunc.RunIsLevel() && SemiFunc.RunIsShop()) { if (PerformCalculation() != 0.2863016f) { InteractableTruckDoor.logger.LogWarning((object)"Calculation error! Truck door console is at the wrong position!"); } else { InteractableTruckDoor.logger.LogInfo((object)"Calculation successful! No action required."); } } } catch (Exception ex) { InteractableTruckDoor.logger.LogError((object)ex); } static float PerformCalculation() { //IL_001a: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.RunIsLevel()) { return ((Component)ButtonControler.Instance).gameObject.transform.position.z - ((Component)((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform.GetChild(1)).transform.position.z; } if (SemiFunc.RunIsShop()) { return ((Component)ButtonControler.Instance).gameObject.transform.position.z - ((Component)((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform.GetChild(0)).transform.position.z; } return 0f; } } } internal class Net : MonoBehaviour { internal static Net Instance { get; private set; } internal static PhotonView view { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } private void Start() { if ((Object)(object)view == (Object)null) { ((Component)Instance).gameObject.AddComponent().ViewID = 387548396; view = ((Component)Instance).gameObject.GetComponent(); } } internal void TransmitRPC(string methodName, RpcTarget target, params object[] parameters) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) view.RPC(methodName, target, parameters); } [PunRPC] internal void CloseDoorNetworked() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) AnimationHandler.Instance.eval = 0f; AnimationHandler.Instance.TruckDoor.doorLoopEnd.Play(((Component)AnimationHandler.Instance).transform.position, 1f, 1f, 1f, 1f); AnimationHandler.Instance.TruckDoor.doorSound.Play(((Component)AnimationHandler.Instance).transform.position, 1f, 1f, 1f, 1f); } [PunRPC] internal void OpenDoorNetworked() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) AnimationHandler.Instance.TruckDoor.doorEval = 0f; AnimationHandler.Instance.TruckDoor.doorLoopEnd.Play(((Component)AnimationHandler.Instance).transform.position, 1f, 1f, 1f, 1f); AnimationHandler.Instance.TruckDoor.doorSound.Play(((Component)AnimationHandler.Instance).transform.position, 1f, 1f, 1f, 1f); } [PunRPC] internal void ResetDoor() { Helper.isDoorMoving = false; Helper.isDoorClosed = false; ButtonControler.didThrow = false; } [PunRPC] internal void OnTimerRanOutNetworked() { if (Helper.isDoorMoving || !Helper.isDoorClosed) { return; } if ((Object)(object)ButtonControler.Instance != (Object)null) { ButtonControler instance = ButtonControler.Instance; if (instance != null) { ((MonoBehaviour)instance).StartCoroutine((IEnumerator)ButtonControler.Instance.OpenDoorInternal()); } } else if (!ButtonControler.didThrow) { InteractableTruckDoor.logger.LogError((object)"Coroutine 'OpenDoorInternal' could NOT be started! ButtonControler object does NOT exist! If this error was thrown while loading to another level then it's fine."); ButtonControler.didThrow = true; } } [PunRPC] internal void OnClickRPC() { ButtonControler.Instance.ButtonPushVisualsStart(); if (!Helper.isDoorMoving && !Helper.isDoorClosed) { ((MonoBehaviour)ButtonControler.Instance).StartCoroutine((IEnumerator)ButtonControler.Instance.CloseDoorInternal()); } else if (!Helper.isDoorMoving && Helper.isDoorClosed) { ((MonoBehaviour)ButtonControler.Instance).StartCoroutine((IEnumerator)ButtonControler.Instance.OpenDoorInternal()); } } } [BepInProcess("REPO.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("InteractableTruckDoor-UnloadedHangar", "InteractableTruckDoor", "0.4.7")] public class InteractableTruckDoor : BaseUnityPlugin { public static class PluginInfo { public const string Guid = "InteractableTruckDoor-UnloadedHangar"; public const string Name = "InteractableTruckDoor"; public const string Ver = "0.4.7"; } internal static ManualLogSource logger; internal static InteractableTruckDoor Instance; internal static ConfigManager ConfigManager; internal Harmony _harmony; private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("InteractableTruckDoor-UnloadedHangar"); logger.LogInfo((object)"InteractableTruckDoor-UnloadedHangar loaded"); ConfigManager = new ConfigManager(); Compatibility.CheckChainloader(); Content.Load(); if (!Compatibility.InvalidConfigurationPresent) { _harmony = new Harmony("InteractableTruckDoor-UnloadedHangar"); _harmony.PatchAll(typeof(Patches)); } } } public class RemoteControler : MonoBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RemoteControler <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.itemToggle.itemEquippable = <>4__this.itemEquippable; <>4__this.itemToggle.photonView = <>4__this.view; <>4__this.itemToggle.physGrabObject = <>4__this.physGrabObject; <>2__current = (object)new WaitUntil((Func)(() => Object.op_Implicit((Object)(object)ButtonControler.Instance))); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)ButtonControler.Instance)) { <>4__this.itemToggle.onToggle = ButtonControler.Instance.PhysGrabObjectGrabAreaGameObject.GetComponent().grabAreas[0].grabAreaEventOnHolding; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public PhotonView view; public PhysGrabObject physGrabObject; public ItemToggle itemToggle; public ItemBattery itemBattery; public Rigidbody rb; public ItemEquippable itemEquippable; public Transform batteryTransform; public void Start() { rb = ((Component)this).GetComponent(); physGrabObject = ((Component)this).GetComponent(); itemToggle = ((Component)this).GetComponent(); itemBattery = ((Component)this).GetComponent(); view = ((Component)this).GetComponent(); itemEquippable = ((Component)this).GetComponent(); ((MonoBehaviour)this).StartCoroutine(FixItemToggle()); FixItemEquippable(); } [IteratorStateMachine(typeof(d__8))] private IEnumerator FixItemToggle() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this }; } private void FixItemEquippable() { itemEquippable.physGrabObject = physGrabObject; } public void Update() { } public void FixedUpdate() { } } } namespace InteractableTruckDoor.Patch { [HarmonyPatch] internal class Patches : MonoBehaviour { private static Vector3 TempVector3; [HarmonyPrefix] [HarmonyPatch(typeof(SemiFunc), "OnLevelGenDone")] private static void SpawnButton() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) try { if (SemiFunc.RunIsLevel()) { if (Helper.Instance.SpawnDatabase.TryGetValue(((Object)Object.FindObjectOfType()).name, out TempVector3)) { GameObject val = Object.Instantiate(Content.AssetsList[0], TempVector3, Content.AssetsList[0].transform.rotation, ((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform); PhotonView componentInChildren = val.gameObject.GetComponentInChildren(true); componentInChildren.ViewID = 756454; } else { GameObject val2 = Object.Instantiate(Content.AssetsList[0], new Vector3(3f, 0.655f, -15.8217f), Content.AssetsList[0].transform.rotation, ((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform); PhotonView componentInChildren2 = val2.gameObject.GetComponentInChildren(true); componentInChildren2.ViewID = 756454; } } else if (SemiFunc.RunIsShop()) { GameObject val3 = Object.Instantiate(Content.AssetsList[0], new Vector3(3f, 0.655f, -5.8217f), Content.AssetsList[0].transform.rotation, ((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform); PhotonView componentInChildren3 = val3.gameObject.GetComponentInChildren(true); componentInChildren3.ViewID = 756454; } } catch (Exception ex) { InteractableTruckDoor.logger.LogError((object)ex); } } [HarmonyPrefix] [HarmonyPatch(typeof(TruckDoor), "Start")] private static void AssignComponent() { ((Component)Object.FindObjectOfType()).gameObject.AddComponent(); } [HarmonyPrefix] [HarmonyPatch(typeof(GameDirector), "Start")] private static void ObjectSpawnPatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown GameObject val = new GameObject("InteractableTruckDoorHelper"); val.AddComponent(); val.AddComponent().ViewID = 780546346; GameObject val2 = new GameObject("InteractableTruckDoorNet"); val2.AddComponent(); } [HarmonyPostfix] [HarmonyPatch(typeof(SemiFunc), "OnLevelGenDone")] private static void OnLevelGenDonePatch() { try { Helper.Instance.Sync(); } catch (Exception ex) { InteractableTruckDoor.logger.LogError((object)ex); } } [HarmonyPrefix] [HarmonyPatch(typeof(TruckDoor), "Update")] private static bool UpdatePatch(TruckDoor __instance) { //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) if (__instance.timeToCheck) { if (__instance.playerInTruckCheckTimer > 0f) { __instance.playerInTruckCheckTimer -= Time.deltaTime; } else { __instance.playerInTruckCheckTimer = 0.5f; if (!__instance.introActivationDone && !SemiFunc.PlayersAllInTruck()) { __instance.introActivationDone = true; if (!TutorialDirector.instance.tutorialActive) { __instance.extractionPointNearest.ActivateTheFirstExtractionPointAutomaticallyWhenAPlayerLeaveTruck(); } } } } if (__instance.doorDelay > 0f && SemiFunc.LevelGenDone()) { __instance.doorDelay -= Time.deltaTime; } if (__instance.doorDelay <= 0f && __instance.doorEval < 1f) { if (!__instance.doorOpen) { __instance.doorOpen = true; if (SemiFunc.RunIsShop()) { SemiFunc.UIFocusText("Buy stuff in the shop", Color.white, AssetManager.instance.colorYellow, 3f); } GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 8f, ((Component)__instance).transform.position, 0.1f); __instance.doorLoopStart.Play(((Component)__instance).transform.position, 1f, 1f, 1f, 1f); } float num = __instance.doorCurve.Evaluate(__instance.doorEval); __instance.doorEval += AnimationHandler.Instance.doorOpenSpeed * Time.deltaTime; ((Component)__instance).transform.position = new Vector3(((Component)__instance).transform.position.x, __instance.startYPosition + 2.5f * num, ((Component)__instance).transform.position.z); } if (__instance.doorEval >= 1f && !__instance.fullyOpen) { __instance.fullyOpen = true; GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 8f, ((Component)__instance).transform.position, 0.1f); __instance.doorLoopEnd.Play(((Component)__instance).transform.position, 1f, 1f, 1f, 1f); __instance.doorSound.Play(((Component)__instance).transform.position, 1f, 1f, 1f, 1f); } return false; } } }