Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of itolib v0.9.3
BepInEx/plugins/itolib.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BepinControl; using Dawn; using DunGen; using DunGen.Graph; using DunGen.Tags; using FacilityMeltdown; using FacilityMeltdown.API; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using LethalLib.Modules; using Microsoft.CodeAnalysis; using PizzaTowerEscapeMusic; using TMPro; using TVLoader.Patches; using TVLoader.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.Video; using WeatherRegistry; using WeatherRegistry.Networking; using WeatherTweaks.Definitions; using itolib.Behaviours.Detectors; using itolib.Behaviours.Grabbables; using itolib.Behaviours.Helpers; using itolib.Behaviours.Networking; using itolib.Compatibility; using itolib.Compatibility.Moons; using itolib.Enums; using itolib.Extensions; using itolib.Interfaces; using itolib.NetcodePatcher; using itolib.Patches; using itolib.PlayZone; using itolib.ScriptableObjects; using itolib.Structs; using itolib.Util; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("BepInEx")] [assembly: IgnoresAccessChecksTo("CrowdControl")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("FacilityMeltdown")] [assembly: IgnoresAccessChecksTo("LethalLevelLoader")] [assembly: IgnoresAccessChecksTo("PizzaTowerEscapeMusic")] [assembly: IgnoresAccessChecksTo("TVLoader")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("itolib")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Wondrous gizmos and gadgets for the restless mind.")] [assembly: AssemblyFileVersion("0.9.3.0")] [assembly: AssemblyInformationalVersion("0.9.3+becc423ba14c19c64959b08c976ea271bd3b68e7")] [assembly: AssemblyProduct("itolib")] [assembly: AssemblyTitle("itolib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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 itolib { public class Config { public Config(ConfigFile cfg) { cfg.SaveOnConfigSet = false; cfg.OrphanedEntries.Clear(); cfg.SaveOnConfigSet = true; cfg.Save(); } } [BepInDependency("imabatby.lethallevelloader", "1.5.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(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("pacoito.itolib", "itolib", "0.9.3")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "pacoito.itolib"; public const string PLUGIN_NAME = "itolib"; public const string VERSION = "0.9.3"; internal static ManualLogSource StaticLogger { get; private set; } internal static Harmony Harmony { get; private set; } private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown StaticLogger = ((BaseUnityPlugin)this).Logger; try { Harmony = new Harmony("pacoito.itolib"); SerializeNetworkVariables(); Harmony.PatchAll(typeof(ApparatusPatches)); Harmony.PatchAll(typeof(LoadPatch)); if (WeatherRegistryCompatibility.Enabled) { Harmony.PatchAll(typeof(WeatherRegistryCompatibility)); } BerunahCompatibility.RegisterCompat(); StaticLogger.LogInfo((object)"itolib v0.9.3 loaded!"); } catch (Exception arg) { StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "itolib", arg)); } } private static void SerializeNetworkVariables() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<ItemInfo>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<ItemInfo>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<HiveInfo>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<HiveInfo>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<NetworkObjectReference>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkObjectReference>(); } } } namespace itolib.Util { public static class SearchContent { public static bool TryFindItem(out Item item, string itemName, bool checkObjectName = false) { string itemName2 = itemName; item = null; if (itemName2.IsNullOrEmpty()) { return false; } ExtendedItem val = PatchedContent.ExtendedItems.Find((ExtendedItem extendedItem) => checkObjectName ? ((Object)extendedItem.Item).name.CompareOrdinal(itemName2) : extendedItem.Item.itemName.CompareOrdinal(itemName2)); if ((Object)(object)val != (Object)null) { item = val.Item; return true; } if (LethalLibCompatibility.Enabled) { Item lethalLibItem = LethalLibCompatibility.GetLethalLibItem(itemName2, checkObjectName); if ((Object)(object)lethalLibItem != (Object)null) { item = lethalLibItem; return true; } } if (DawnLibCompatibility.Enabled) { Item dawnItem = DawnLibCompatibility.GetDawnItem(itemName2, checkObjectName); if ((Object)(object)dawnItem != (Object)null) { item = dawnItem; return true; } } return false; } public static bool TryFindEnemy(out EnemyType enemy, string enemyName, bool checkObjectName = false) { string enemyName2 = enemyName; enemy = null; if (enemyName2.IsNullOrEmpty()) { return false; } ExtendedEnemyType val = PatchedContent.ExtendedEnemyTypes.Find((ExtendedEnemyType extendedEnemy) => checkObjectName ? ((Object)extendedEnemy.EnemyType).name.CompareOrdinal(enemyName2) : extendedEnemy.EnemyType.enemyName.CompareOrdinal(enemyName2)); if ((Object)(object)val != (Object)null) { enemy = val.EnemyType; return true; } if (LethalLibCompatibility.Enabled) { EnemyType lethalLibEnemyType = LethalLibCompatibility.GetLethalLibEnemyType(enemyName2, checkObjectName); if ((Object)(object)lethalLibEnemyType != (Object)null) { enemy = lethalLibEnemyType; return true; } } if (DawnLibCompatibility.Enabled) { EnemyType dawnEnemyType = DawnLibCompatibility.GetDawnEnemyType(enemyName2, checkObjectName); if ((Object)(object)dawnEnemyType != (Object)null) { enemy = dawnEnemyType; return true; } } return false; } public static bool TryFindLevel(out SelectableLevel level, string levelName) { string levelName2 = levelName; level = null; if (levelName2.IsNullOrEmpty()) { return false; } ExtendedLevel val = PatchedContent.ExtendedLevels.Find((ExtendedLevel extendedLevel) => extendedLevel.SelectableLevel.GetNumberlessPlanetName().CompareOrdinal(levelName2)); if ((Object)(object)val != (Object)null) { level = val.SelectableLevel; return true; } return false; } public static bool TryFindDungeon(out DungeonFlow dungeon, string dungeonName) { string dungeonName2 = dungeonName; dungeon = null; if (dungeonName2.IsNullOrEmpty()) { return false; } ExtendedDungeonFlow val = PatchedContent.ExtendedDungeonFlows.Find((ExtendedDungeonFlow extendedDungeon) => ((Object)extendedDungeon.DungeonFlow).name.CompareOrdinal(dungeonName2)); if ((Object)(object)val != (Object)null) { dungeon = val.DungeonFlow; return true; } return false; } } internal sealed class SimulateAnomaly : ISeededScript<SimulateAnomaly> { [CompilerGenerated] private static Item? <SingleItem>k__BackingField; private static bool? _isSingleItemDay; public static Item? SingleItem { get { if (!_isSingleItemDay.HasValue) { ISeededScript<SimulateAnomaly>.SeedOffset = 5; SelectableLevel selectableLevel = LevelManager.CurrentExtendedLevel.SelectableLevel; Random anomalyRandom = ISeededScript<SimulateAnomaly>.SeededRandom; SimulateChallengeFile(ref anomalyRandom, selectableLevel); int num = SimulateSpawnScrap(ref anomalyRandom, selectableLevel); <SingleItem>k__BackingField = ((num != -1 && selectableLevel.spawnableScrap?[num] != null) ? selectableLevel.spawnableScrap[num].spawnableItem : null); _isSingleItemDay = (Object)(object)<SingleItem>k__BackingField != (Object)null; LevelManager.GlobalLevelEvents.onLevelLoaded.AddListener((Action)ResetItem); } return <SingleItem>k__BackingField; } [CompilerGenerated] private set { <SingleItem>k__BackingField = value; } } public ISeededScript<SimulateAnomaly> SeededSelf { get { throw new InvalidOperationException("SimulateAnomaly should have no instance."); } } private static void SimulateChallengeFile(ref Random anomalyRandom, SelectableLevel currentLevel) { if (!StartOfRound.Instance.isChallengeFile) { return; } int[] array = new int[5]; for (int i = 0; i < array.Length; i++) { array[i] = anomalyRandom.Next(0, 100); } if (array[0] < 45) { anomalyRandom.Next(0, currentLevel.Enemies.Count); if (currentLevel.Enemies[RoundManager.Instance.increasedInsideEnemySpawnRateIndex].enemyType.spawningDisabled) { anomalyRandom.Next(0, currentLevel.Enemies.Count); } } if (array[1] < 45) { anomalyRandom.Next(0, currentLevel.OutsideEnemies.Count); } if (array[2] < 45) { anomalyRandom.Next(0, currentLevel.indoorMapHazards.Length); } if (array[3] < 45) { anomalyRandom.Next(0, currentLevel.spawnableOutsideObjects.Length); } if (array[4] < 45) { anomalyRandom.Next(0, currentLevel.spawnableScrap.Count); } } private static int SimulateSpawnScrap(ref Random anomalyRandom, SelectableLevel currentLevel) { anomalyRandom.Next(currentLevel.minScrap, currentLevel.maxScrap); _ = RoundManager.Instance.scrapAmountMultiplier; if (StartOfRound.Instance.isChallengeFile) { anomalyRandom.Next(10, 30); } int num = -1; if (anomalyRandom.Next(0, 500) <= 20) { List<SpawnableItemWithRarity> spawnableScrap = currentLevel.spawnableScrap; num = anomalyRandom.Next(0, spawnableScrap.Count); bool flag = false; for (int i = 0; i < 2; i++) { if (spawnableScrap[num].rarity >= 5 && !spawnableScrap[num].spawnableItem.twoHanded) { flag = true; break; } num = anomalyRandom.Next(0, spawnableScrap.Count); } if (!flag && anomalyRandom.Next(0, 100) < 60) { num = -1; } } return num; } private static void ResetItem() { LevelManager.GlobalLevelEvents.onLevelLoaded.RemoveListener((Action)ResetItem); SingleItem = null; _isSingleItemDay = null; } } public static class Yielders { private static readonly Dictionary<float, WaitForSeconds> cachedYielders = new Dictionary<float, WaitForSeconds>(); public static WaitForEndOfFrame WaitForEndOfFrame { get; } = new WaitForEndOfFrame(); public static WaitForSeconds WaitForSeconds(float seconds) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (!cachedYielders.TryGetValue(seconds, out WaitForSeconds value)) { value = new WaitForSeconds(seconds); cachedYielders.Add(seconds, value); } return value; } } } namespace itolib.Structs { [Serializable] public struct HitInfo : INetworkSerializable { [Header("Hit Info")] [Tooltip("")] public int damage; [Tooltip("")] public Vector3 direction; [Tooltip("")] public WeaponHitID hitID; [HideInInspector] public bool hitByPlayer; [HideInInspector] public NetworkBehaviourReference playerReference; public HitInfo() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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) damage = 1; direction = Vector3.zero; hitID = WeaponHitID.Shovel; hitByPlayer = false; playerReference = default(NetworkBehaviourReference); } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_000a: 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_002d: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref damage, default(ForPrimitives)); serializer.SerializeValue(ref direction); ((BufferSerializer<WeaponHitID>*)(&serializer))->SerializeValue<WeaponHitID>(ref hitID, default(ForEnums)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref hitByPlayer, default(ForPrimitives)); if (hitByPlayer) { ((BufferSerializer<NetworkBehaviourReference>*)(&serializer))->SerializeValue<NetworkBehaviourReference>(ref playerReference, default(ForNetworkSerializable)); } } } [Serializable] public struct HiveInfo : INetworkSerializable, IEquatable<HiveInfo> { [Header("Hive Info")] [Tooltip("")] public ItemInfo itemInfo; [Tooltip("")] public NetworkBehaviourReference beesReference; [Space(5f)] [Header("Hive Override")] [Tooltip("")] public bool overrideHive; [Tooltip("")] public NetworkBehaviourReference hiveReference; public HiveInfo() { //IL_0012: 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) itemInfo = default(ItemInfo); beesReference = default(NetworkBehaviourReference); overrideHive = false; hiveReference = default(NetworkBehaviourReference); } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_004a: 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) itemInfo.NetworkSerialize<T>(serializer); ((BufferSerializer<NetworkBehaviourReference>*)(&serializer))->SerializeValue<NetworkBehaviourReference>(ref beesReference, default(ForNetworkSerializable)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref overrideHive, default(ForPrimitives)); if (overrideHive) { ((BufferSerializer<NetworkBehaviourReference>*)(&serializer))->SerializeValue<NetworkBehaviourReference>(ref hiveReference, default(ForNetworkSerializable)); } } public readonly bool Equals(HiveInfo other) { //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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (itemInfo == other.itemInfo) { NetworkBehaviourReference val = beesReference; if (((NetworkBehaviourReference)(ref val)).Equals(other.beesReference) && overrideHive == other.overrideHive) { val = hiveReference; return ((NetworkBehaviourReference)(ref val)).Equals(other.hiveReference); } } return false; } public override readonly bool Equals(object obj) { if (obj is HiveInfo other) { return Equals(other); } return false; } public static bool operator ==(HiveInfo left, HiveInfo right) { return left.Equals(right); } public static bool operator !=(HiveInfo left, HiveInfo right) { return !(left == right); } public override readonly int GetHashCode() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return HashCode.Combine<ItemInfo, NetworkBehaviourReference, bool, NetworkBehaviourReference>(itemInfo, beesReference, overrideHive, hiveReference); } } [Serializable] public struct ItemInfo : INetworkSerializable, IEquatable<ItemInfo> { [Header("Item Info")] [Tooltip("")] public TransformInfo transformInfo; [Tooltip("")] public NetworkBehaviourReference itemReference; [Tooltip("")] [Min(0f)] public int scrapValue; [Tooltip("")] [Min(-1f)] public int meshVariant; [Tooltip("")] [Min(-1f)] public int materialVariant; public ItemInfo() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) transformInfo = default(TransformInfo); itemReference = default(NetworkBehaviourReference); scrapValue = 0; meshVariant = -1; materialVariant = -1; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) transformInfo.NetworkSerialize<T>(serializer); ((BufferSerializer<NetworkBehaviourReference>*)(&serializer))->SerializeValue<NetworkBehaviourReference>(ref itemReference, default(ForNetworkSerializable)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref scrapValue, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref meshVariant, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref materialVariant, default(ForPrimitives)); } public readonly bool Equals(ItemInfo other) { //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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (transformInfo == other.transformInfo) { NetworkBehaviourReference val = itemReference; if (((NetworkBehaviourReference)(ref val)).Equals(other.itemReference) && scrapValue == other.scrapValue && meshVariant == other.meshVariant) { return materialVariant == other.materialVariant; } } return false; } public override readonly bool Equals(object obj) { if (obj is ItemInfo other) { return Equals(other); } return false; } public static bool operator ==(ItemInfo left, ItemInfo right) { return left.Equals(right); } public static bool operator !=(ItemInfo left, ItemInfo right) { return !(left == right); } public override readonly int GetHashCode() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HashCode.Combine<TransformInfo, NetworkBehaviourReference, int, int, int>(transformInfo, itemReference, scrapValue, meshVariant, materialVariant); } } [Serializable] internal struct ReverbTriggerInfo { public AudioReverbTrigger reverbTrigger; public Vector3 localPosition; public Quaternion localRotation; public Vector3 localScale; public bool triggerEnabled; public ReverbPreset? reverbPreset; public int usePreset; public switchToAudio[] audioChanges; public bool elevatorTriggerForProps; public bool setInElevatorTrigger; public bool isShipRoom; public bool toggleLocalFog; public float fogEnabledAmount; public LocalVolumetricFog localFog; public Terrain terrainObj; public bool setInsideAtmosphere; public bool insideLighting; public int weatherEffect; public bool effectEnabled; public bool disableAllWeather; public bool enableCurrentLevelWeather; public bool spectatedClientTriggered; public ReverbTriggerInfo(AudioReverbTrigger reverbTrigger, BoxCollider triggerCollider) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) this.reverbTrigger = reverbTrigger; localPosition = ((Component)reverbTrigger).transform.localPosition; localRotation = ((Component)reverbTrigger).transform.localRotation; localScale = ((Component)reverbTrigger).transform.localScale; triggerEnabled = ((Collider)triggerCollider).enabled; reverbPreset = reverbTrigger.reverbPreset; usePreset = reverbTrigger.usePreset; audioChanges = reverbTrigger.audioChanges.ToArray(); elevatorTriggerForProps = reverbTrigger.elevatorTriggerForProps; setInElevatorTrigger = reverbTrigger.setInElevatorTrigger; isShipRoom = reverbTrigger.isShipRoom; toggleLocalFog = reverbTrigger.toggleLocalFog; fogEnabledAmount = reverbTrigger.fogEnabledAmount; localFog = reverbTrigger.localFog; terrainObj = reverbTrigger.terrainObj; setInsideAtmosphere = reverbTrigger.setInsideAtmosphere; insideLighting = reverbTrigger.insideLighting; weatherEffect = reverbTrigger.weatherEffect; effectEnabled = reverbTrigger.effectEnabled; disableAllWeather = reverbTrigger.disableAllWeather; enableCurrentLevelWeather = reverbTrigger.enableCurrentLevelWeather; spectatedClientTriggered = reverbTrigger.spectatedClientTriggered; } public readonly void ApplyValuesTo(AudioReverbTrigger? reverbTrigger) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)reverbTrigger == (Object)null)) { ((Component)reverbTrigger).transform.SetLocalPositionAndRotation(localPosition, localRotation); ((Component)reverbTrigger).transform.localScale = localScale; BoxCollider val = default(BoxCollider); if (((Component)reverbTrigger).TryGetComponent<BoxCollider>(ref val)) { ((Collider)val).enabled = triggerEnabled; } reverbTrigger.reverbPreset = reverbPreset; reverbTrigger.usePreset = usePreset; reverbTrigger.audioChanges = audioChanges; reverbTrigger.elevatorTriggerForProps = elevatorTriggerForProps; reverbTrigger.setInElevatorTrigger = setInElevatorTrigger; reverbTrigger.isShipRoom = isShipRoom; reverbTrigger.toggleLocalFog = toggleLocalFog; reverbTrigger.fogEnabledAmount = fogEnabledAmount; reverbTrigger.localFog = localFog; reverbTrigger.terrainObj = terrainObj; reverbTrigger.setInsideAtmosphere = setInsideAtmosphere; reverbTrigger.insideLighting = insideLighting; reverbTrigger.weatherEffect = weatherEffect; reverbTrigger.effectEnabled = effectEnabled; reverbTrigger.disableAllWeather = disableAllWeather; reverbTrigger.enableCurrentLevelWeather = enableCurrentLevelWeather; reverbTrigger.spectatedClientTriggered = spectatedClientTriggered; } } } [Serializable] public struct RotationPivot { [Header("Rotation Pivot")] [Tooltip("Pivot Transform to apply the rotation to.")] public Transform? pivot; [Tooltip("Additional offset to apply to the final rotation.")] public Vector3 offset; [Tooltip("Direction to consider upwards when applying the rotation. Default is 'Vector3.up', or '(0,1,0)'.")] public Vector3 worldUp; [Tooltip("Approximate time for the rotation to be fully complete, in seconds.")] [Min(0f)] public float rotationTime; [Space(5f)] [Tooltip("Whether to freeze rotation for the X-axis or not.")] public bool freezeX; [Tooltip("Whether to freeze rotation for the Y-axis or not.")] public bool freezeY; [Tooltip("Whether to freeze rotation for the Z-axis or not.")] public bool freezeZ; public RotationPivot() { //IL_000d: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) pivot = null; offset = default(Vector3); rotationTime = 0f; freezeX = false; freezeY = false; freezeZ = false; worldUp = Vector3.up; } public readonly void Apply(Vector3 targetPosition, ref Vector3 pivotVelocity) { //IL_0027: 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) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pivot != (Object)null) { float num = (freezeX ? pivot.position.x : targetPosition.x); float num2 = (freezeY ? pivot.position.y : targetPosition.y); float num3 = (freezeZ ? pivot.position.z : targetPosition.z); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, num3); Quaternion val2 = Quaternion.LookRotation(val - pivot.position, worldUp) * Quaternion.Euler(offset); pivot.rotation = ((rotationTime == 0f) ? val2 : pivot.rotation.SmoothDamp(val2, ref pivotVelocity, rotationTime)); } } } [Serializable] public struct ScanNodeInfo : INetworkSerializable { [Header("Scan Node Info")] [Tooltip("")] public string headerText; [Tooltip("")] public string subText; [Tooltip("")] [Min(0f)] public int minRange; [Tooltip("")] [Min(0f)] public int maxRange; [Tooltip("")] [Min(-1f)] public int creatureScanID; [Tooltip("")] [Min(-1f)] public int nodeType; [Tooltip("")] public bool requiresLineOfSight; public ScanNodeInfo() { nodeType = 0; headerText = string.Empty; subText = string.Empty; minRange = 5; maxRange = 7; creatureScanID = -1; requiresLineOfSight = true; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006e: 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_0084: Unknown result type (might be due to invalid IL or missing references) serializer.SerializeValue(ref headerText, false); serializer.SerializeValue(ref subText, false); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref minRange, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref maxRange, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref creatureScanID, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref nodeType, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref requiresLineOfSight, default(ForPrimitives)); } } [Serializable] public struct TransformInfo : INetworkSerializable, IEquatable<TransformInfo> { [Header("Transform Info")] [Tooltip("")] public Vector3 position; [Tooltip("")] public Quaternion rotation; public TransformInfo() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; rotation = Quaternion.identity; } public TransformInfo(Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) //IL_0024: 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) position = Vector3.zero; rotation = Quaternion.identity; position = transform.position; rotation = transform.rotation; } public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { serializer.SerializeValue(ref position); serializer.SerializeValue(ref rotation); } public readonly bool Equals(TransformInfo other) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (position == other.position) { return rotation == other.rotation; } return false; } public override readonly bool Equals(object obj) { if (obj is TransformInfo other) { return Equals(other); } return false; } public static bool operator ==(TransformInfo left, TransformInfo right) { return left.Equals(right); } public static bool operator !=(TransformInfo left, TransformInfo right) { return !(left == right); } public override readonly int GetHashCode() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HashCode.Combine<Vector3, Quaternion>(position, rotation); } } } namespace itolib.ScriptableObjects { [Serializable] public struct BoolEntry : IScriptableConfigEntry<bool> { [field: SerializeField] public string Section { get; set; } [field: SerializeField] public string Key { get; set; } [field: SerializeField] public string Description { get; set; } [field: SerializeField] public bool DefaultValue { get; set; } public BoolEntry() { Section = string.Empty; Key = string.Empty; Description = string.Empty; DefaultValue = false; } } [CreateAssetMenu(fileName = "ScriptableEvent", menuName = "itolib/Config/ScriptableConfig")] public class ScriptableConfig : ScriptableObject { [Header("Scriptable Config")] [Tooltip("")] public string authorName = ""; [Tooltip("")] public string modName = ""; [Tooltip("")] public List<BoolEntry> boolEntries = new List<BoolEntry>(); public ConfigFile Config { get; private set; } public List<ConfigEntryBase> ConfigEntries { get; private set; } = new List<ConfigEntryBase>(); public void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown string text = (Application.isEditor ? "." : Paths.ConfigPath); Config = new ConfigFile(Utility.CombinePaths(new string[2] { text, authorName + "." + modName + ".cfg" }), false, (BepInPlugin)null) { SaveOnConfigSet = false }; foreach (BoolEntry boolEntry in boolEntries) { ConfigEntry<bool> item = Config.Bind<bool>(boolEntry.Section, boolEntry.Key, boolEntry.DefaultValue, boolEntry.Description); ConfigEntries.Add((ConfigEntryBase)(object)item); } Config.OrphanedEntries?.Clear(); Config.SaveOnConfigSet = true; Config.Save(); } } [CreateAssetMenu(fileName = "ScriptableEvent", menuName = "itolib/Events/ScriptableEvent")] public sealed class ScriptableEvent : ScriptableObject { [CompilerGenerated] [Tooltip("Name of the event. Object name will be used as fallback if the field is left blank.")] [SerializeField] private string <EventName>k__BackingField = string.Empty; private Guid guid = Guid.Empty; internal static Dictionary<Guid, ScriptableEvent> AllEvents { get; } = new Dictionary<Guid, ScriptableEvent>(); [field: Header("Scriptable Event")] [field: Tooltip("Source of the event (e.g. mod, moon, interior), to avoid conflicting event names.")] [field: SerializeField] public string EventSource { get; private set; } = string.Empty; public string EventName { get { if (<EventName>k__BackingField.IsNullOrEmpty()) { <EventName>k__BackingField = ((Object)this).name; } return <EventName>k__BackingField; } } private event Action? OnEventRaise; private void Awake() { string value = EventSource + ":" + EventName; if (value.TryComputeGUID(out guid)) { AllEvents.TryAdd(guid, this); } } public void RaiseEvent() { if (guid != Guid.Empty && AllEvents.TryGetValue(guid, out ScriptableEvent value) && (Object)(object)value != (Object)null) { value.OnEventRaise?.Invoke(); } } public void AddListener(Action listener) { if (guid != Guid.Empty && AllEvents.TryGetValue(guid, out ScriptableEvent value) && (Object)(object)value != (Object)null) { value.OnEventRaise += listener; } } public void RemoveListener(Action listener) { if (guid != Guid.Empty && AllEvents.TryGetValue(guid, out ScriptableEvent value) && (Object)(object)value != (Object)null) { value.OnEventRaise -= listener; } } public void ClearListeners() { if (guid != Guid.Empty && AllEvents.TryGetValue(guid, out ScriptableEvent value) && (Object)(object)value != (Object)null) { value.OnEventRaise = null; } } } [CreateAssetMenu(fileName = "ScriptableNetworkPrefab", menuName = "itolib/Networking/ScriptableNetworkPrefab")] public sealed class ScriptableNetworkPrefab : ScriptableObject { [SerializeField] private NetworkObject[]? prefabsToRegister; private static Dictionary<string, NetworkObject> RegisteredPrefabs { get; } = new Dictionary<string, NetworkObject>(); private void Awake() { for (int i = 0; i < prefabsToRegister?.Length; i++) { NetworkObject val = prefabsToRegister[i]; if ((Object)(object)val != (Object)null) { LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(((Component)val).gameObject); RegisteredPrefabs.TryAdd(((Object)val).name, val); } } } public static bool TryGetPrefab(out NetworkObject prefab, string name) { prefab = null; if (!name.IsNullOrEmpty()) { return RegisteredPrefabs.TryGetValue(name, out prefab); } return false; } } } namespace itolib.PlayZone { public class PlayZoneElevator : NetworkBehaviour { [CompilerGenerated] private sealed class <DeactivateElevatorDelayed>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayZoneElevator <>4__this; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DeactivateElevatorDelayed>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; PlayZoneElevator playZoneElevator = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = Yielders.WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; playZoneElevator.SwitchState(ElevatorState.Deactivated); 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(); } } private static readonly int openID = Animator.StringToHash("Open"); private static readonly int elevatorGoingUpID = Animator.StringToHash("ElevatorGoingUp"); private static readonly int deactivatedID = Animator.StringToHash("Deactivated"); [Header("PlayZone Elevator")] [Tooltip("")] [SerializeField] private Animator? elevatorAnimator; [Tooltip("")] [SerializeField] private Animator? doorAnimatorUpper; [Tooltip("")] [SerializeField] private Animator? doorAnimatorLower; [Header("Buttons")] [Tooltip("")] [SerializeField] private InteractTrigger? callElevatorUpper; [Tooltip("")] [SerializeField] private InteractTrigger? callElevatorLower; [Header("Audio")] [Tooltip("")] [SerializeField] private AudioSource? elevatorSource; [Tooltip("")] [SerializeField] private AudioSource? doorSourceUpper; [Tooltip("")] [SerializeField] private AudioSource? doorSourceLower; [Tooltip("")] [SerializeField] private AudioClip? elevatorAudioFinish; [Tooltip("")] [SerializeField] private AudioClip? doorAudioOpen; [Tooltip("")] [SerializeField] private AudioClip? doorAudioClose; [Header("Events")] [Tooltip("")] [SerializeField] private UnityEvent<bool> onElevatorTravelStart = new UnityEvent<bool>(); [Tooltip("")] [SerializeField] private UnityEvent<bool> onElevatorTravelFinish = new UnityEvent<bool>(); [Tooltip("")] [SerializeField] private UnityEvent onTopReached = new UnityEvent(); [Tooltip("")] [SerializeField] private UnityEvent onBottomReached = new UnityEvent(); [Tooltip("")] [SerializeField] private UnityEvent onDeactivate = new UnityEvent(); [Tooltip("")] [SerializeField] private UnityEvent<bool> onDoorsOpen = new UnityEvent<bool>(); [Tooltip("")] [SerializeField] private UnityEvent<bool> onDoorsClose = new UnityEvent<bool>(); public ElevatorState CurrentState { get; private set; } = ElevatorState.IdleDown; public void SwitchState(ElevatorState newState) { if (CurrentState != newState && CurrentState != ElevatorState.Deactivated) { SwitchStateLocal(newState); if (((NetworkBehaviour)this).IsSpawned) { SwitchStateRpc(newState); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SwitchStateRpc(ElevatorState newState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2402193886u, val2, val, (SendTo)5, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe<ElevatorState>(ref newState, default(ForEnums)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 2402193886u, val2, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SwitchStateLocal(newState); } } } public void SwitchStateLocal(ElevatorState newState) { if (CurrentState == newState) { return; } switch (newState) { case ElevatorState.IdleUp: case ElevatorState.IdleDown: { bool flag = newState == ElevatorState.IdleUp; if ((Object)(object)elevatorAudioFinish != (Object)null && (Object)(object)elevatorSource != (Object)null) { elevatorSource.Stop(); elevatorSource.PlayOneShot(elevatorAudioFinish); } if ((Object)(object)callElevatorUpper != (Object)null && (Object)(object)callElevatorLower != (Object)null) { callElevatorUpper.hoverTip = (flag ? "Open door : [LMB]" : "Call : [LMB]"); callElevatorLower.hoverTip = (flag ? "Call : [LMB]" : "Open door : [LMB]"); } CurrentState = newState; if (flag) { onTopReached.Invoke(); } else { onBottomReached.Invoke(); } onElevatorTravelFinish.Invoke(flag); break; } case ElevatorState.GoingUp: case ElevatorState.GoingDown: { bool flag = newState == ElevatorState.GoingUp; if ((Object)(object)elevatorAudioFinish != (Object)null && (Object)(object)elevatorSource != (Object)null) { elevatorSource.Play(); } if ((Object)(object)elevatorAnimator != (Object)null) { elevatorAnimator.SetBool(elevatorGoingUpID, flag); } onElevatorTravelStart.Invoke(flag); CurrentState = newState; break; } case ElevatorState.Deactivated: if ((Object)(object)elevatorAnimator != (Object)null) { elevatorAnimator.SetTrigger(deactivatedID); } CurrentState = newState; break; } } public void CallElevator(bool up) { switch (CurrentState) { case ElevatorState.IdleUp: if (!up) { SwitchState(ElevatorState.GoingDown); } else { ToggleDoors(open: true); } break; case ElevatorState.IdleDown: if (up) { SwitchState(ElevatorState.GoingUp); } else { ToggleDoors(open: true); } break; case ElevatorState.GoingUp: case ElevatorState.GoingDown: case ElevatorState.Deactivated: break; } } public void CallElevatorLocal(bool up) { switch (CurrentState) { case ElevatorState.IdleUp: if (!up) { SwitchStateLocal(ElevatorState.GoingDown); } else { ToggleDoorsLocal(open: true); } break; case ElevatorState.IdleDown: if (up) { SwitchStateLocal(ElevatorState.GoingUp); } else { ToggleDoorsLocal(open: true); } break; case ElevatorState.GoingUp: case ElevatorState.GoingDown: case ElevatorState.Deactivated: break; } } public void ToggleDoors(bool open) { if (CurrentState != ElevatorState.Deactivated) { ToggleDoorsLocal(open); if (((NetworkBehaviour)this).IsSpawned) { ToggleDoorsRpc(open); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void ToggleDoorsRpc(bool open) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(4028709194u, val2, val, (SendTo)5, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref open, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 4028709194u, val2, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ToggleDoorsLocal(open); } } } public void ToggleDoorsLocal(bool open) { switch (CurrentState) { case ElevatorState.IdleUp: if ((Object)(object)doorAnimatorUpper != (Object)null && doorAnimatorUpper.GetBool(openID) == !open) { if ((Object)(object)doorSourceUpper != (Object)null && (Object)(object)doorAudioOpen != (Object)null) { doorSourceUpper.PlayOneShot(doorAudioOpen); } doorAnimatorUpper.SetBool(openID, open); if (open) { onDoorsOpen.Invoke(true); } else { onDoorsClose.Invoke(true); } } break; case ElevatorState.IdleDown: if ((Object)(object)doorAnimatorLower != (Object)null && doorAnimatorLower.GetBool(openID) == !open) { if ((Object)(object)doorSourceLower != (Object)null && (Object)(object)doorAudioOpen != (Object)null) { doorSourceLower.PlayOneShot(doorAudioOpen); } doorAnimatorLower.SetBool(openID, open); if (open) { onDoorsOpen.Invoke(false); } else { onDoorsClose.Invoke(false); } } break; case ElevatorState.GoingUp: case ElevatorState.GoingDown: case ElevatorState.Deactivated: break; } } public void DeactivateElevator() { switch (CurrentState) { case ElevatorState.IdleUp: SwitchState(ElevatorState.GoingDown); break; case ElevatorState.IdleDown: SwitchState(ElevatorState.GoingUp); break; } if ((Object)(object)doorAnimatorLower != (Object)null && doorAnimatorLower.GetBool(openID)) { doorAnimatorLower.SetBool(openID, false); if ((Object)(object)doorSourceLower != (Object)null && (Object)(object)doorAudioOpen != (Object)null) { doorSourceLower.PlayOneShot(doorAudioClose); } } if ((Object)(object)doorAnimatorUpper != (Object)null && doorAnimatorUpper.GetBool(openID)) { doorAnimatorUpper.SetBool(openID, false); if ((Object)(object)doorSourceUpper != (Object)null && (Object)(object)doorAudioOpen != (Object)null) { doorSourceUpper.PlayOneShot(doorAudioClose); } } ((MonoBehaviour)this).StartCoroutine(DeactivateElevatorDelayed()); } [IteratorStateMachine(typeof(<DeactivateElevatorDelayed>d__34))] private IEnumerator DeactivateElevatorDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DeactivateElevatorDelayed>d__34(0) { <>4__this = this }; } public void OnDeactivate() { onDeactivate.Invoke(); if ((Object)(object)elevatorAudioFinish != (Object)null && (Object)(object)elevatorSource != (Object)null) { elevatorSource.Stop(); elevatorSource.PlayOneShot(elevatorAudioFinish); } if ((Object)(object)doorSourceLower != (Object)null && (Object)(object)doorAudioOpen != (Object)null) { doorSourceLower.PlayOneShot(doorAudioOpen); } if ((Object)(object)doorAnimatorLower != (Object)null && (Object)(object)doorAnimatorUpper != (Object)null) { doorAnimatorLower.SetBool(openID, true); doorAnimatorUpper.SetBool(openID, false); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2402193886u, new RpcReceiveHandler(__rpc_handler_2402193886), "SwitchStateRpc"); ((NetworkBehaviour)this).__registerRpc(4028709194u, new RpcReceiveHandler(__rpc_handler_4028709194), "ToggleDoorsRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2402193886(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ElevatorState newState = default(ElevatorState); ((FastBufferReader)(ref reader)).ReadValueSafe<ElevatorState>(ref newState, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PlayZoneElevator)(object)target).SwitchStateRpc(newState); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4028709194(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool open = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref open, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PlayZoneElevator)(object)target).ToggleDoorsRpc(open); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string? __getTypeName() { return "PlayZoneElevator"; } } public class TwinApparatus : EventfulApparatus { [CompilerGenerated] private sealed class <HandleDisconnect>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TwinApparatus <>4__this; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <HandleDisconnect>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TwinApparatus twinApparatus = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)twinApparatus.apparatusAudio != (Object)null) { twinApparatus.apparatusAudio.Stop(); if (twinApparatus.playDisconnectSFX) { twinApparatus.apparatusAudio.PlayOneShot(((LungProp)twinApparatus).disconnectSFX, 0.7f); } } twinApparatus.OnDisconnectEarly.Invoke(); <>2__current = Yielders.WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (twinApparatus.playSparkPFX) { ((LungProp)twinApparatus).sparkParticle.SetActive(true); } if ((Object)(object)twinApparatus.apparatusAudio != (Object)null && twinApparatus.playRemoveFromMachineSFX) { twinApparatus.apparatusAudio.PlayOneShot(((LungProp)twinApparatus).removeFromMachineSFX); } if (twinApparatus.modifyEnemySpawns && ((NetworkBehaviour)twinApparatus).IsHost && Random.Range(0, 100) < 70 && ((LungProp)twinApparatus).roundManager.minEnemiesToSpawn < 2) { ((LungProp)twinApparatus).roundManager.minEnemiesToSpawn = ((!twinApparatus.bothPulled) ? 1 : 2); } twinApparatus.OnDisconnect.Invoke(); <>2__current = Yielders.WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; if (twinApparatus.flickerLights) { ((LungProp)twinApparatus).roundManager.FlickerLights(false, false); } twinApparatus.OnLightsFlicker.Invoke(); <>2__current = Yielders.WaitForSeconds(2.5f); <>1__state = 3; return true; case 3: <>1__state = -1; if (twinApparatus.shutOffPower) { ((LungProp)twinApparatus).roundManager.SwitchPower(false); ((LungProp)twinApparatus).roundManager.powerOffPermanently = twinApparatus.shutOffPowerPermanently && twinApparatus.bothPulled; } twinApparatus.OnLightsOff.Invoke(); <>2__current = Yielders.WaitForSeconds(0.75f); <>1__state = 4; return true; case 4: <>1__state = -1; if (!twinApparatus.bothPulled) { if (twinApparatus.shutOffPower) { ((LungProp)twinApparatus).roundManager.SwitchPower(true); twinApparatus.DimLights(); } return false; } if (twinApparatus.displayRadiationWarning) { HUDManager.Instance.RadiationWarningHUD(); } twinApparatus.OnDisplayWarning.Invoke(); if (twinApparatus.awakenOldBirds && twinApparatus.bothPulled && ((NetworkBehaviour)twinApparatus).IsHost && (Object)(object)((LungProp)twinApparatus).radMechEnemyType != (Object)null) { EnemyAINestSpawnObject[] array = Object.FindObjectsByType<EnemyAINestSpawnObject>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].enemyType == (Object)(object)((LungProp)twinApparatus).radMechEnemyType) { ((LungProp)twinApparatus).roundManager.SpawnEnemyGameObject(((LungProp)twinApparatus).roundManager.outsideAINodes[i].transform.position, 0f, -1, ((LungProp)twinApparatus).radMechEnemyType); } } } 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(); } } private static readonly int DimID = Animator.StringToHash("Dim"); private bool bothPulled; public TwinApparatus? LongLostTwin { get; private set; } protected override void HandleCompatibility() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (FacilityMeltdownCompatibility.Enabled) { FacilityMeltdownCompatibility.HalveTwinValue(this); if (triggerFacilityMeltdown) { base.OnDisconnectEarly.AddListener((UnityAction)delegate { if (bothPulled) { FacilityMeltdownCompatibility.InitiateMeltdown(); } }); } } if (PizzaTowerEscapeMusicCompatibility.Enabled) { base.OnDisconnectEarly.AddListener((UnityAction)delegate { PizzaTowerEscapeMusicCompatibility.SwitchApparatus(triggerEscapeMusic ? LongLostTwin : null); }); } } [IteratorStateMachine(typeof(<HandleDisconnect>d__7))] protected override IEnumerator HandleDisconnect() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <HandleDisconnect>d__7(0) { <>4__this = this }; } public override void EquipItem() { if (((LungProp)this).isLungDocked) { ((LungProp)this).isLungDocked = false; ((LungProp)this).isLungPowered = false; if (((LungProp)this).disconnectAnimation != null) { ((MonoBehaviour)this).StopCoroutine(((LungProp)this).disconnectAnimation); } bothPulled = (Object)(object)LongLostTwin != (Object)null && !((LungProp)LongLostTwin).isLungDocked && !((LungProp)LongLostTwin).isLungPowered; ((LungProp)this).disconnectAnimation = ((MonoBehaviour)this).StartCoroutine(HandleDisconnect()); if (bothPulled) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.DungeonEvents.onApparatusTaken.Invoke((LungProp)(object)this); DungeonManager.GlobalDungeonEvents.onApparatusTaken.Invoke((LungProp)(object)this); } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LevelManager.CurrentExtendedLevel.LevelEvents.onApparatusTaken.Invoke((LungProp)(object)this); LevelManager.GlobalLevelEvents.onApparatusTaken.Invoke((LungProp)(object)this); } } } base.EquipItem(); } public void AssignTwin(GrabbableObject possibleTwin) { if ((Object)(object)LongLostTwin == (Object)null && possibleTwin is TwinApparatus twinApparatus) { LongLostTwin = twinApparatus; twinApparatus.LongLostTwin = this; } } private void DimLights() { for (int i = 0; i < ((LungProp)this).roundManager.allPoweredLightsAnimators.Count; i++) { Animator val = ((LungProp)this).roundManager.allPoweredLightsAnimators[i]; val.SetBool(DimID, true); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string? __getTypeName() { return "TwinApparatus"; } } } namespace itolib.Patches { [HarmonyPatch] internal static class ApparatusPatches { internal static event Action? OnRadiationWarningHUD; [HarmonyPatch(typeof(HUDManager), "RadiationWarningHUD")] [HarmonyPrefix] private static void RadiationWarningHUDPre() { ApparatusPatches.OnRadiationWarningHUD?.Invoke(); } } [HarmonyPatch] internal static class DoorwayPatch { internal static bool? specificDoorwayActive; [HarmonyPrepare] private static void PrepareDoorwayPatch(MethodBase original) { if (original == null) { ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onBeforeDungeonGenerate).AddListener((Action)delegate { specificDoorwayActive = null; }); } } [HarmonyPatch(typeof(DoorwayPairFinder), "IsValidDoorwayPairing")] [HarmonyPostfix] private static void IsValidDoorwayPairingPost(ref bool __result, DoorwayProxy a, DoorwayProxy b, TileProxy previousTile, ref float weight) { if (!__result || specificDoorwayActive == false) { return; } bool valueOrDefault = specificDoorwayActive.GetValueOrDefault(); if (!specificDoorwayActive.HasValue) { valueOrDefault = a.DoorwayComponent is SpecificDoorway; specificDoorwayActive = valueOrDefault; } if (specificDoorwayActive == false) { return; } if (a.DoorwayComponent is SpecificDoorway specificDoorway) { Tag[]? doorwayConnectionTags = specificDoorway.DoorwayConnectionTags; if (doorwayConnectionTags != null && doorwayConnectionTags.Length != 0 && ValidateDoorwayTagConnection(specificDoorway, b.DoorwayComponent)) { __result = false; weight = 0f; return; } if (specificDoorway.AllowSwap) { foreach (DoorwayProxy usedDoorway in previousTile.UsedDoorways) { if (usedDoorway != a && usedDoorway.DoorwayComponent is SpecificDoorway specificDoorway2 && specificDoorway2.AllowSwap && specificDoorway2.DoorwayType == specificDoorway.DoorwayType) { __result = false; weight = 0f; return; } } } __result = ModifyWeights(specificDoorway, next: false, ref weight); if (!__result) { return; } } if (b.DoorwayComponent is SpecificDoorway specificDoorway3) { Tag[]? doorwayConnectionTags2 = specificDoorway3.DoorwayConnectionTags; if (doorwayConnectionTags2 != null && doorwayConnectionTags2.Length != 0 && ValidateDoorwayTagConnection(specificDoorway3, a.DoorwayComponent)) { __result = false; weight = 0f; } else { __result = ModifyWeights(specificDoorway3, next: true, ref weight); } } } private static bool ModifyWeights(SpecificDoorway doorway, bool next, ref float weight) { if (doorway.DoorwayType == DoorwayType.Neither || (next && doorway.DoorwayType == DoorwayType.Exit && !doorway.AllowSwap) || (!next && doorway.DoorwayType == DoorwayType.Entrance)) { weight = 0f; return false; } if (doorway.WeightOverride > 0f) { weight = doorway.WeightOverride * ((weight >= 1f) ? 100f : 1f); } if (doorway.WeightMultiplier != 1f) { weight *= doorway.WeightMultiplier; } return true; } private static bool ValidateDoorwayTagConnection(SpecificDoorway doorwayA, Doorway doorwayB) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 bool flag = false; for (int i = 0; i < doorwayA.DoorwayConnectionTags?.Length; i++) { if (doorwayB.Tags.HasTag(doorwayA.DoorwayConnectionTags[i])) { flag = true; break; } } if ((int)doorwayA.DoorwayTagConnectionMode != 0) { return (int)doorwayA.DoorwayTagConnectionMode == 1 && flag; } return !flag; } } [HarmonyPatch] internal static class LoadPatch { private static bool firstLoad = true; [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPrefix] private static void MenuManagerStartPre() { if (firstLoad) { firstLoad = false; if (CrowdControlCompatibility.Enabled) { Plugin.Harmony.PatchAll(typeof(CrowdControlCompatibility)); } if (FacilityMeltdownCompatibility.Enabled) { Plugin.Harmony.PatchAll(typeof(FacilityMeltdownCompatibility)); } } } } } namespace itolib.Interfaces { public interface IActivationScript : IDungeonCompleteReceiver { IActivationScript ActivationSelf { get; } ActivationTime ActivationTime { get; set; } bool PerformedActivation { get; set; } void Initialize() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown if (PerformedActivation) { return; } switch (ActivationTime) { case ActivationTime.Immediate: PerformActivation(); break; case ActivationTime.SyncedSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedSyncedObjects).AddListener((Action)PerformActivation); break; case ActivationTime.ScrapSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedScrapObjects).AddListener((Action)PerformActivation); break; case ActivationTime.HazardSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedMapObjects).AddListener((Action)PerformActivation); break; case ActivationTime.StartOfRound: if ((Object)(object)StartOfRound.Instance != (Object)null) { ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(PerformActivation)); } break; case ActivationTime.DungeonComplete: case ActivationTime.Manual: break; } } void PerformActivation(ActivationTime activationTime); private void PerformActivation() { UnsubscribeFromEvents(); if (!PerformedActivation && ActivationTime != ActivationTime.Manual) { PerformActivation(ActivationTime); PerformedActivation = true; } } void UnsubscribeFromEvents() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown switch (ActivationTime) { case ActivationTime.SyncedSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedSyncedObjects).RemoveListener((Action)PerformActivation); break; case ActivationTime.ScrapSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedScrapObjects).RemoveListener((Action)PerformActivation); break; case ActivationTime.HazardSpawn: ((ExtendedEvent)DungeonManager.GlobalDungeonEvents.onSpawnedMapObjects).RemoveListener((Action)PerformActivation); break; case ActivationTime.StartOfRound: if ((Object)(object)StartOfRound.Instance != (Object)null) { ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).RemoveListener(new UnityAction(PerformActivation)); } break; case ActivationTime.Immediate: case ActivationTime.DungeonComplete: case ActivationTime.Manual: break; } } void OnDungeonComplete() { if (ActivationTime == ActivationTime.DungeonComplete) { PerformActivation(); } } } public interface IEventfulItem { UnityEvent<bool, bool> OnActivate { get; set; } UnityEvent<Collider> OnActivatePhysicsTrigger { get; set; } UnityEvent OnBatteryCharge { get; set; } UnityEvent OnBatteryDrain { get; set; } UnityEvent OnCollect { get; set; } UnityEvent OnCollectEarly { get; set; } UnityEvent<PlayerControllerB> OnDestroyHeldEarly { get; set; } UnityEvent OnDiscard { get; set; } UnityEvent OnDiscardEarly { get; set; } UnityEvent OnDiscardSFX { get; set; } UnityEvent OnDiscardSFXEarly { get; set; } UnityEvent<EnemyAI> OnEnemyGrab { get; set; } UnityEvent OnEnemyDiscard { get; set; } UnityEvent OnEquip { get; set; } UnityEvent OnEquipEarly { get; set; } UnityEvent OnGrab { get; set; } UnityEvent OnGroundReached { get; set; } UnityEvent<int> OnGroundReachedVariant { get; set; } UnityEvent OnInspect { get; set; } UnityEvent OnInspectEarly { get; set; } UnityEvent OnInteract { get; set; } UnityEvent OnInteractLeft { get; set; } UnityEvent OnInteractRight { get; set; } UnityEvent OnPlace { get; set; } UnityEvent OnPocket { get; set; } UnityEvent OnPocketEarly { get; set; } UnityEvent OnReactToSellCounter { get; set; } Action? FallWithCurveOverride { get; set; } bool HideOnPocket { get; set; } bool SaveMaterialVariant { get; set; } bool SaveMeshVariant { get; set; } int VariantIndex { get; set; } void ResetCurveOverride() { FallWithCurveOverride = null; } void ResetCurveOverride(EnemyAI _) { ResetCurveOverride(); } } public interface IPooledObject<T> { int ObjectID { get; set; } T TakenBy { get; set; } IPooledObject<T> NextPooledObject { get; set; } IPooledObject<T> CreateInstance(); bool TryAssignInstance(T taker, int maxInstances, out IPooledObject<T> pooledObject) { pooledObject = null; if (TakenBy == null || (object)taker == (object)TakenBy) { pooledObject = this; } else if (NextPooledObject == null && ObjectID < maxInstances) { NextPooledObject = CreateInstance(); NextPooledObject.ObjectID = ObjectID + 1; pooledObject = NextPooledObject; } if (pooledObject != null) { pooledObject.TakenBy = taker; return true; } if (NextPooledObject != null) { return NextPooledObject.TryAssignInstance(taker, maxInstances, out pooledObject); } return false; } bool TryFreeInstance(T possibleOwner, out IPooledObject<T> pooledObject) { pooledObject = null; if ((object)possibleOwner == (object)TakenBy) { pooledObject = this; TakenBy = default(T); return true; } if (NextPooledObject != null) { return NextPooledObject.TryFreeInstance(possibleOwner, out pooledObject); } return false; } void PrepareInstances(int instancesLeft) { if (instancesLeft != 0) { NextPooledObject = CreateInstance(); NextPooledObject.ObjectID = ObjectID + 1; NextPooledObject.PrepareInstances(instancesLeft - 1); } } } public interface IScriptableConfigEntry<T> { string Section { get; set; } string Key { get; set; } T DefaultValue { get; set; } string Description { get; set; } } public interface ISeededScript<T> where T : ISeededScript<T> { private static int? _seedOffset; ISeededScript<T> SeededSelf { get; } static Random SeededRandom { get { if ((Object)(object)StartOfRound.Instance != (Object)null && <SeededRandom>k__BackingField == null) { <SeededRandom>k__BackingField = new Random(StartOfRound.Instance.randomMapSeed + SeedOffset); LevelManager.GlobalLevelEvents.onLevelLoaded.AddListener((Action)ResetRandom); } return <SeededRandom>k__BackingField ?? new Random(); } [CompilerGenerated] private set { <SeededRandom>k__BackingField = value; } } static int SeedOffset { get { int valueOrDefault = _seedOffset.GetValueOrDefault(); if (!_seedOffset.HasValue) { valueOrDefault = ComputeSeedOffset(); _seedOffset = valueOrDefault; } return _seedOffset.GetValueOrDefault(); } set { _seedOffset = value; } } private static int ComputeSeedOffset() { byte[] value = SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(typeof(T).Name ?? "")); return BitConverter.ToInt32(value, 0); } private static void ResetRandom() { LevelManager.GlobalLevelEvents.onLevelLoaded.RemoveListener((Action)ResetRandom); SeededRandom = null; } Random GetSeededRandom() { return SeededRandom; } } public interface IWeightedEntry { int Weight { get; set; } bool SingleUse { get; set; } } public interface IWeightedScript<T> where T : IWeightedEntry { IWeightedScript<T> WeightedSelf { get; } T[]? WeightedEntries { get; set; } int[]? CumulativeWeights { get; set; } int TotalWeight { get; set; } bool InitializedWeights { get; set; } void InitializeWeights() { if (InitializedWeights) { return; } T[]? weightedEntries = WeightedEntries; if (weightedEntries != null && weightedEntries.Length != 0) { int[] array = new int[WeightedEntries.Length]; for (int i = 0; i < WeightedEntries.Length; i++) { TotalWeight += WeightedEntries[i].Weight; array[i] = TotalWeight; } CumulativeWeights = array; } InitializedWeights = true; } void AddWeight(T entry) { TotalWeight += entry.Weight; T[]? weightedEntries = WeightedEntries; object weightedEntries2; if (weightedEntries == null || weightedEntries.Length == 0) { weightedEntries2 = new T[1] { entry }; } else { T[] weightedEntries3 = WeightedEntries; int num = 0; T[] array = new T[1 + weightedEntries3.Length]; ReadOnlySpan<T> readOnlySpan = new ReadOnlySpan<T>(weightedEntries3); readOnlySpan.CopyTo(new Span<T>(array).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; array[num] = entry; weightedEntries2 = array; } WeightedEntries = (T[]?)weightedEntries2; int[]? cumulativeWeights = CumulativeWeights; object cumulativeWeights2; if (cumulativeWeights == null || cumulativeWeights.Length == 0) { cumulativeWeights2 = new int[1] { TotalWeight }; } else { int[] cumulativeWeights3 = CumulativeWeights; int num = 0; int[] array2 = new int[1 + cumulativeWeights3.Length]; ReadOnlySpan<int> readOnlySpan2 = new ReadOnlySpan<int>(cumulativeWeights3); readOnlySpan2.CopyTo(new Span<int>(array2).Slice(num, readOnlySpan2.Length)); num += readOnlySpan2.Length; array2[num] = TotalWeight; cumulativeWeights2 = array2; } CumulativeWeights = (int[]?)cumulativeWeights2; } void AddWeights(T[]? entries) { if (entries != null && entries.Length != 0) { int[] array = new int[entries.Length]; for (int i = 0; i < entries.Length; i++) { TotalWeight += entries[i].Weight; array[i] = TotalWeight; } T[]? weightedEntries = WeightedEntries; T[] weightedEntries2; if (weightedEntries == null || weightedEntries.Length == 0) { weightedEntries2 = entries; } else { T[] weightedEntries3 = WeightedEntries; int num = 0; T[] array2 = new T[weightedEntries3.Length + entries.Length]; ReadOnlySpan<T> readOnlySpan = new ReadOnlySpan<T>(weightedEntries3); readOnlySpan.CopyTo(new Span<T>(array2).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; ReadOnlySpan<T> readOnlySpan2 = new ReadOnlySpan<T>(entries); readOnlySpan2.CopyTo(new Span<T>(array2).Slice(num, readOnlySpan2.Length)); num += readOnlySpan2.Length; weightedEntries2 = array2; } WeightedEntries = weightedEntries2; int[]? cumulativeWeights = CumulativeWeights; int[] cumulativeWeights2; if (cumulativeWeights == null || cumulativeWeights.Length == 0) { cumulativeWeights2 = array; } else { int[] cumulativeWeights3 = CumulativeWeights; int[] array3 = array; int num = 0; int[] array4 = new int[cumulativeWeights3.Length + array3.Length]; ReadOnlySpan<int> readOnlySpan3 = new ReadOnlySpan<int>(cumulativeWeights3); readOnlySpan3.CopyTo(new Span<int>(array4).Slice(num, readOnlySpan3.Length)); num += readOnlySpan3.Length; ReadOnlySpan<int> readOnlySpan4 = new ReadOnlySpan<int>(array3); readOnlySpan4.CopyTo(new Span<int>(array4).Slice(num, readOnlySpan4.Length)); num += readOnlySpan4.Length; cumulativeWeights2 = array4; } CumulativeWeights = cumulativeWeights2; InitializedWeights = true; } } void RemoveWeight(int index) { if (CumulativeWeights == null || index < 0 || index > CumulativeWeights.Length) { return; } if (index > 0) { int num = CumulativeWeights[index] - CumulativeWeights[index - 1]; if (num > 0) { ModifyWeight(index, -num); } } else if (CumulativeWeights[index] > 0) { ModifyWeight(index, -CumulativeWeights[index]); } } void ModifyWeight(int index, int weight) { if (weight != 0 && index >= 0 && CumulativeWeights != null && index < CumulativeWeights.Length) { if (CumulativeWeights[index] + weight < 0) { weight = -CumulativeWeights[index]; } TotalWeight += weight; for (int i = index; i < CumulativeWeights.Length; i++) { CumulativeWeights[i] += weight; } } } bool TryObtainEntry(out T entry, int weightIndex) { entry = default(T); if (weightIndex >= 0 && weightIndex < WeightedEntries?.Length) { entry = WeightedEntries[weightIndex]; if (entry.SingleUse) { RemoveWeight(weightIndex); } return true; } return false; } bool TryObtainRandomEntry(out T entry, Random? random = null) { entry = default(T); if (!TryObtainRandomEntryIndex(out var weightIndex, random)) { return false; } entry = WeightedEntries[weightIndex]; if (entry.SingleUse) { RemoveWeight(weightIndex); } return true; } bool TryObtainRandomEntryIndex(out int weightIndex, Random? random = null) { weightIndex = -1; if (CumulativeWeights == null || CumulativeWeights.Length == 0) { return false; } int randomWeight = random?.Next(0, TotalWeight + 1) ?? Random.RandomRangeInt(0, TotalWeight + 1); weightIndex = Array.FindIndex(CumulativeWeights, (int weight) => randomWeight <= weight); if (weightIndex >= 0) { return weightIndex < CumulativeWeights.Length; } return false; } } } namespace itolib.Extensions { public static class ColliderExtensions { public static Vector3 GetPointWithin(this BoxCollider collider, Random? seededRandom = null) { //IL_0001: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008a: 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_001b: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) Vector3 val = collider.size * 0.5f; return (seededRandom != null) ? new Vector3(seededRandom.Next(0f - val.x, val.x), seededRandom.Next(0f - val.y, val.y), seededRandom.Next(0f - val.z, val.z)) : new Vector3(Random.Range(0f - val.x, val.x), Random.Range(0f - val.y, val.y), Random.Range(0f - val.z, val.z)); } } public static class ContentTagExtensions { public static bool CompareTag(this ContentTag tagA, ContentTag tagB) { return tagA.contentTagName.CompareOrdinal(tagB.contentTagName); } } public static class PlayerExtensions { public static bool IsLocalClient(this PlayerControllerB player) { return player.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId; } public static bool IsSpectatedClient(this PlayerControllerB player) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isPlayerDead && (Object)(object)StartOfRound.Instance != (Object)null && !StartOfRound.Instance.overrideSpectateCamera && (Object)(object)localPlayerController.spectatedPlayerScript != (Object)null) { return localPlayerController.spectatedPlayerScript.actualClientId == player.actualClientId; } return false; } public static bool HasLineOfSightToPosition(this PlayerControllerB player, Vector3 pos, float width = 45f, float range = 60f, float proximityAwareness = -1f, LayerMask layerMask = default(LayerMask)) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006e: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)player.playerEye).transform; Vector3 val = ((Component)player).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < range * range && ((proximityAwareness > 0f && sqrMagnitude < proximityAwareness * proximityAwareness) || Vector3.Angle(transform.forward, pos - ((Component)player.gameplayCamera).transform.position) < width)) { return !Physics.Linecast(transform.position, pos, ref player.hit, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)1); } return false; } public static bool HasLineOfSightToPosition(this PlayerControllerB player, Vector3 pos, float distance, float width = 45f, float range = 60f, float proximityAwareness = -1f, LayerMask layerMask = default(LayerMask)) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)player.playerEye).transform; if (distance < range && (distance < proximityAwareness || Vector3.Angle(transform.forward, pos - ((Component)player.gameplayCamera).transform.position) < width)) { return !Physics.Linecast(transform.position, pos, ref player.hit, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)1); } return false; } public static bool TryFindMovementAction(this PlayerControllerB player, out InputAction playerAction, string actionId) { playerAction = null; if (player.playerActions != null && player.playerActions.m_Movement != null) { playerAction = player.playerActions.m_Movement.FindAction(actionId, false); return true; } return false; } public static void DiscardHeldObject(this PlayerControllerB player, int slot) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (slot <= -1 || slot >= player.ItemSlots.Length) { return; } GrabbableObject val = player.ItemSlots[slot]; if ((Object)(object)val == (Object)null) { return; } val.parentObject = null; val.heldByPlayerOnServer = false; Transform transform = ((Component)val).transform; if (val.isInElevator) { transform.SetParent(player.playersManager.elevatorTransform, true); } else { transform.SetParent(player.playersManager.propsContainer, true); } player.SetItemInElevator(player.isInHangarShipRoom, player.isInElevator, val); val.EnablePhysics(true); val.EnableItemMeshes(true); transform.localScale = val.originalScale; val.isHeld = false; val.isPocketed = false; val.startFallingPosition = transform.GetParent().InverseTransformPoint(transform.position); val.FallToGround(true, false, default(Vector3)); val.fallTime = Random.Range(-0.3f, 0.05f); player.ItemSlots[slot] = null; if (player.IsLocalClient()) { val.DiscardItemOnClient(); if ((Object)(object)HUDManager.Instance != (Object)null) { ((Behaviour)HUDManager.Instance.itemSlotIcons[slot]).enabled = false; } } else if (!val.itemProperties.syncDiscardFunction) { val.playerHeldBy = null; } } } public static class QuaternionExtensions { public static Quaternion SmoothDamp(this Quaternion current, Quaternion target, ref Vector3 currentVelocity, float smoothTime) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3 eulerAngles = ((Quaternion)(ref current)).eulerAngles; Vector3 eulerAngles2 = ((Quaternion)(ref target)).eulerAngles; return Quaternion.Euler(Mathf.SmoothDampAngle(eulerAngles.x, eulerAngles2.x, ref currentVelocity.x, smoothTime), Mathf.SmoothDampAngle(eulerAngles.y, eulerAngles2.y, ref currentVelocity.y, smoothTime), Mathf.SmoothDampAngle(eulerAngles.z, eulerAngles2.z, ref currentVelocity.z, smoothTime)); } } public static class RandomExtensions { public static float Next(this Random random, float minValue, float maxValue) { return (float)(random.NextDouble() * (double)(maxValue - minValue) + (double)minValue); } public static double Next(this Random random, double minValue, double maxValue) { return random.NextDouble() * (maxValue - minValue) + minValue; } } public static class SelectableLevelExtensions { public static string GetNumberlessPlanetName(this SelectableLevel level) { if (level.PlanetName.Length == 0) { return string.Empty; } bool flag = false; char[] array = new char[level.PlanetName.Length]; for (int i = 0; i < array.Length; i++) { char c = level.PlanetName[i]; if (!flag) { if (!char.IsLetter(c)) { continue; } flag = true; } array[i] = c; } return new string(array).Trim('\0'); } } public static class StringExtensions { public static bool CompareOrdinal(this string strA, string strB) { return string.CompareOrdinal(strA, strB) == 0; } public static bool IsNullOrEmpty(this string str) { return string.IsNullOrEmpty(str); } public static bool IsNullOrWhiteSpace(this string str) { return string.IsNullOrWhiteSpace(str); } public static bool TryComputeGUID(this string value, out Guid result) { result = Guid.Empty; if (value.IsNullOrEmpty()) { return false; } byte[] array = SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(value)); result = new Guid(array[..16]); return true; } } } namespace itolib.Enums { public enum ActivationTime { [Tooltip("Activate immediately, as soon as possible.")] Immediate = -1, [Tooltip("Activate once the Dungeon finishes generating.")] DungeonComplete = 0, [Tooltip("Activate right before SpawnSyncedObjects begin spawning. NOTE: If used in a prefab spawned through a SpawnSyncedObject, 'Immediate' should be used instead.")] SyncedSpawn = 5, [Tooltip("Activate right before scrap begins to spawn.")] ScrapSpawn = 1, [Tooltip("Activate right before map objects (hazards) begin to spawn.")] HazardSpawn = 2, [Tooltip("Activate once the round begins proper.")] StartOfRound = 3, [Tooltip("Activate manually.")] Manual = 4 } public enum ContentCategoryType { [Tooltip("")] None = -1, [Tooltip("")] Plugin, [Tooltip("")] Item, [Tooltip("")] Enemy, [Tooltip("")] Level, [Tooltip("")] Dungeon } public enum DoorwayType { [Tooltip("No specified type for this specific Doorway, meaning it can be chosen as an entrance, exit, or neither (branch path).")] Unspecified = -1, [Tooltip("An entrance to the Tile, meaning the path is eligible to generate through this specific Doorway and into the Tile.")] Entrance, [Tooltip("An exit to the Tile, meaning the path is eligible to generate past this specific Doorway and out of the Tile.")] Exit, [Tooltip("Neither an entrance nor an exit to the Tile, meaning only branch paths are eligible to generate past this specific Doorway.")] Neither } public enum ElevatorState { [Tooltip("")] IdleUp, [Tooltip("")] IdleDown, [Tooltip("")] GoingUp, [Tooltip("")] GoingDown, [Tooltip("")] Deactivated } public enum MessageType { [Tooltip("Tip alert message (yellow).")] Tip, [Tooltip("Warning message (red).")] Warning, [Tooltip("Notification message (blue).")] Notification } public enum PlayerRagdollVariant { [Tooltip("Normal player body ragdoll.")] Normal, [Tooltip("Headless player body ragdoll, with head burst animation (Ghost girl).")] HeadBurst, [Tooltip("Spring head body ragdoll (Coil-head).")] Spring, [Tooltip("Electrocuted body ragdoll (Circuit Bees).")] Electrocuted, [Tooltip("Masked player body ragdoll (Comedy).")] ComedyMask, [Tooltip("Masked player body ragdoll (Tragedy).")] TragedyMask, [Tooltip("Burnt player body ragdoll (Old Bird blowtorch).")] Burnt, [Tooltip("Torso player body ragdoll (Barber).")] SlicedInHalf, [Tooltip("Headless player body ragdoll, without head burst animation (Kidnapper Fox).")] HeadGone, [Tooltip("Various body parts ragdoll (Giant Sapsucker).")] Pieces } public enum RotationSource { [Tooltip("")] Player, [Tooltip("")] Launcher, [Tooltip("")] Absolute } public enum WeaponHitID { [Tooltip("ID for a hit dealt by a Shovel.")] Shovel = 1, [Tooltip("ID for a hit dealt by a Knife.")] Knife = 5, [Tooltip("Invalid or missing ID.")] None = -1 } public enum WearablePosition { [Tooltip("Attach to a specific bone, or none at all.")] Custom = -1, [Tooltip("Attach to the player's head costume container.")] Head, [Tooltip("Attach to the player's lower torso costume container.")] Belt } } namespace itolib.Compatibility { [HarmonyPatch] internal sealed class CrowdControlCompatibility { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("WarpWorld.CrowdControl"); _enabled = valueOrDefault; } return _enabled.Value; } } public static LevelWeatherType CurrentWeather { get; internal set; } internal static event Action<LevelWeatherType, LevelWeatherType>? OnCCWeatherChanged; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] [HarmonyPatch(typeof(LethalCompanyControl), "CrowdControlCommands")] [HarmonyPostfix] internal static void CCWeatherCheck() { //IL_0029: 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) //IL_0040: 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_0063: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TimeOfDay.Instance != (Object)null && (Object)(object)TimeOfDay.Instance.currentLevel != (Object)null && TimeOfDay.Instance.currentLevel.currentWeather != CurrentWeather) { CrowdControlCompatibility.OnCCWeatherChanged?.Invoke(CurrentWeather, TimeOfDay.Instance.currentLevel.currentWeather); CurrentWeather = TimeOfDay.Instance.currentLevel.currentWeather; } } } internal sealed class DawnLibCompatibility { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static EnemyType? GetDawnEnemyType(string enemyName, bool checkObjectName = false) { foreach (DawnEnemyInfo value in ((Registry<DawnEnemyInfo>)(object)LethalContent.Enemies).Values) { if (!((DawnBaseInfo<DawnEnemyInfo>)(object)value).Key.IsVanilla() && !((DawnBaseInfo<DawnEnemyInfo>)(object)value).HasTag(DawnLibTags.IsExternal) && (Object)(object)value.EnemyType != (Object)null && ((!checkObjectName) ? value.EnemyType.enemyName.CompareOrdinal(enemyName) : ((Object)value.EnemyType).name.CompareOrdinal(enemyName))) { return value.EnemyType; } } return null; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static Item? GetDawnItem(string itemName, bool checkObjectName = false) { foreach (DawnItemInfo value in ((Registry<DawnItemInfo>)(object)LethalContent.Items).Values) { if (!((DawnBaseInfo<DawnItemInfo>)(object)value).Key.IsVanilla() && !((DawnBaseInfo<DawnItemInfo>)(object)value).HasTag(DawnLibTags.IsExternal) && (Object)(object)value.Item != (Object)null && ((!checkObjectName) ? value.Item.itemName.CompareOrdinal(itemName) : ((Object)value.Item).name.CompareOrdinal(itemName))) { return value.Item; } } return null; } } [HarmonyPatch] internal sealed class FacilityMeltdownCompatibility { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("me.loaforc.facilitymeltdown"); _enabled = valueOrDefault; } return _enabled.Value; } } internal static event Action? OnMeltdownLightsOn; internal static event Action? OnMeltdownLightsOff; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void HalveTwinValue(TwinApparatus twinApparatus) { if (MeltdownPlugin.config.OverrideApparatusValue) { ((GrabbableObject)twinApparatus).SetScrapValue((int)((double)((GrabbableObject)twinApparatus).scrapValue * 0.5)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void InitiateMeltdown() { if (NetworkManager.Singleton.IsHost) { MeltdownAPI.StartMeltdown("pacoito.itolib"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void RegisterMeltdownListener(Action listener, bool remove = false) { if (!remove) { MeltdownAPI.OnMeltdownStart = (Action)Delegate.Combine(MeltdownAPI.OnMeltdownStart, listener); } else { MeltdownAPI.OnMeltdownStart = (Action)Delegate.Remove(MeltdownAPI.OnMeltdownStart, listener); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] internal static IEnumerable<CodeInstruction> EmergencyLightsTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_007