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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InteractableTruckDoor.Patch;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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.0.0")]
[assembly: AssemblyInformationalVersion("1.7.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.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.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 TruckDoor TruckDoor;
internal static AnimationHandler Instance { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
TruckDoor = ((Component)this).GetComponent<TruckDoor>();
}
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);
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 * 0.22f), 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 <CloseDoorInternal>d__10 : IEnumerator<WaitUntil>, IEnumerator, IDisposable
{
private int <>1__state;
private WaitUntil <>2__current;
public ButtonControler <>4__this;
WaitUntil IEnumerator<WaitUntil>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CloseDoorInternal>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<bool>)(() => 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 <OpenDoorInternal>d__11 : IEnumerator<WaitUntil>, IEnumerator, IDisposable
{
private int <>1__state;
private WaitUntil <>2__current;
public ButtonControler <>4__this;
WaitUntil IEnumerator<WaitUntil>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <OpenDoorInternal>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<bool>)(() => 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<ExtractionPoint>();
public TextMeshProUGUI doorPowerText;
public TextMeshProUGUI ITDMDCC_Version;
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.0";
}
private void Start()
{
((Component)((Component)Instance).gameObject.transform.GetChild(1)).GetComponent<PhotonView>().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();
}
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(<CloseDoorInternal>d__10))]
internal IEnumerator<WaitUntil> CloseDoorInternal()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CloseDoorInternal>d__10(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<OpenDoorInternal>d__11))]
internal IEnumerator<WaitUntil> OpenDoorInternal()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <OpenDoorInternal>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<MeshRenderer>()).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 class ConfigManager
{
public ExtendedConfigEntry<bool> EnableConfiguration;
public ExtendedConfigEntry<float> DoorCloseSpeed;
public ExtendedConfigEntry<float> DoorOpenSpeed;
public ConfigManager()
{
BindConfigs();
ClearUnusedEntries();
}
private void BindConfigs()
{
EnableConfiguration = new ExtendedConfigEntry<bool>("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<float>("General Settings", "DoorCloseSpeed", 1.5f, "How fast will the truck door close", useEnableConfiguration: true);
DoorOpenSpeed = new ExtendedConfigEntry<float>("General Settings", "DoorOpenSpeed", 1.5f, "How fast will the truck door open", useEnableConfiguration: true);
}
private void ClearUnusedEntries()
{
ConfigFile config = ((BaseUnityPlugin)InteractableTruckDoor.Instance).Config;
PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
dictionary.Clear();
config.Save();
}
}
internal class Content
{
public static GameObject[] AssetsList;
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<GameObject>();
InteractableTruckDoor.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
}
catch (Exception arg)
{
InteractableTruckDoor.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}");
}
}
}
public class ExtendedConfigEntry<T>
{
public ConfigEntry<T> ConfigEntry;
public Func<T> GetValue;
public Action<T> 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<T>(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<T>(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;
internal static bool isDoorMoving;
private bool hasRan = false;
internal Dictionary<string, Vector3> SpawnDatabase = new Dictionary<string, Vector3>
{
{
"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)
}
};
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<GameObject>(Content.AssetsList[0], Parent, WorldPositionStays);
PhotonView componentInChildren = val.gameObject.GetComponentInChildren<PhotonView>(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[2]
{
InteractableTruckDoor.ConfigManager.DoorOpenSpeed.Value,
InteractableTruckDoor.ConfigManager.DoorCloseSpeed.Value
});
}
else if (!PhotonNetwork.IsConnected && (SemiFunc.RunIsLevel() | SemiFunc.RunIsShop()))
{
SendDataToClients(InteractableTruckDoor.ConfigManager.DoorOpenSpeed.Value, InteractableTruckDoor.ConfigManager.DoorCloseSpeed.Value);
}
}
[PunRPC]
private void SendDataToClients(float doorOpenSpeedInternal, float doorCloseSpeedInternal)
{
AnimationHandler.Instance.doorOpenSpeed = Mathf.Clamp(doorOpenSpeedInternal, 0.1f, 10f);
AnimationHandler.Instance.doorCloseSpeed = Mathf.Clamp(doorCloseSpeedInternal, 0.1f, 10f);
InteractableTruckDoor.logger.LogInfo((object)$"Received data from MasterClient! Data -> DoorOpenSpeed: {Mathf.Clamp(doorOpenSpeedInternal, 0.1f, 10f)}, DoorCloseSpeed: {Mathf.Clamp(doorCloseSpeedInternal, 0.1f, 10f)}");
}
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<PhotonView>().ViewID = 387548396;
view = ((Component)Instance).gameObject.GetComponent<PhotonView>();
}
}
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")]
[BepInPlugin("InteractableTruckDoor-UnloadedHangar", "InteractableTruckDoor", "0.4.0")]
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.0";
}
internal static ManualLogSource logger;
internal static InteractableTruckDoor Instance;
internal static ConfigManager ConfigManager;
private Harmony _harmony;
private void Awake()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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();
Content.Load();
_harmony = new Harmony("InteractableTruckDoor-UnloadedHangar");
_harmony.PatchAll(typeof(Patches));
}
}
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct SafeHSV
{
public static Color HSVToRGBSafe(float H, float S, float V, bool hdr = true)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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)
if (H > 1f || S > 1f || V > 1f)
{
InteractableTruckDoor.logger.LogError((object)("Provided data inside method '" + MethodBase.GetCurrentMethod().Name + "' are out of range!"));
}
return Color.HSVToRGB(Mathf.Clamp(H, 0f, 1f), Mathf.Clamp(S, 0f, 1f), Mathf.Clamp(V, 0f, 1f), hdr);
}
}
}
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<StartRoom>()).name, out TempVector3))
{
GameObject val = Object.Instantiate<GameObject>(Content.AssetsList[0], TempVector3, Content.AssetsList[0].transform.rotation, ((Component)((Component)TruckScreenText.instance).gameObject.transform.parent).transform);
PhotonView componentInChildren = val.gameObject.GetComponentInChildren<PhotonView>(true);
componentInChildren.ViewID = 756454;
}
else
{
GameObject val2 = Object.Instantiate<GameObject>(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<PhotonView>(true);
componentInChildren2.ViewID = 756454;
}
}
else if (SemiFunc.RunIsShop())
{
GameObject val3 = Object.Instantiate<GameObject>(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<PhotonView>(true);
componentInChildren3.ViewID = 756454;
}
}
catch (Exception ex)
{
InteractableTruckDoor.logger.LogError((object)ex);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TruckDoor), "Start")]
private static void AssignComponent()
{
((Component)Object.FindObjectOfType<TruckDoor>()).gameObject.AddComponent<AnimationHandler>();
}
[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<Helper>();
val.AddComponent<PhotonView>().ViewID = 780546346;
GameObject val2 = new GameObject("InteractableTruckDoorNet");
val2.AddComponent<Net>();
}
[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;
}
}
}