using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using ShipInventoryUpdated.Configurations; using ShipInventoryUpdated.Helpers.API; using ShipInventoryUpdated.Objects; using ShipInventoryUpdated.Scripts; using Steamworks; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; using com.github.zehsteam.SellMyScrap.Commands; using com.github.zehsteam.SellMyScrap.Data; using com.github.zehsteam.SellMyScrap.Dependencies; using com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy; using com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Extensions; using com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Objects; using com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Patches; using com.github.zehsteam.SellMyScrap.Dependencies.Vanilla; using com.github.zehsteam.SellMyScrap.Extensions; using com.github.zehsteam.SellMyScrap.Helpers; using com.github.zehsteam.SellMyScrap.Helpers.ScrapMatchAlgorithms; using com.github.zehsteam.SellMyScrap.Managers; using com.github.zehsteam.SellMyScrap.MonoBehaviours; using com.github.zehsteam.SellMyScrap.Objects; using com.github.zehsteam.SellMyScrap.Patches; using com.github.zehsteam.SellMyScrap.ScrapEaters; using com.github.zehsteam.SellMyScrap.v40-v72.NetcodePatcher; using com.github.zehsteam.TakeyPlush.Managers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("ShipInventoryUpdated")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Zehs")] [assembly: AssemblyDescription("[v40/v72] Adds a few terminal commands to sell your scrap from the ship or cruiser. Highly Configurable. Compatible with the ShipInventoryUpdated mod. SellFromTerminal +")] [assembly: AssemblyFileVersion("1.15.3.0")] [assembly: AssemblyInformationalVersion("1.15.3+ce02e090196b7cde0bc9863c7c029afde99ae47e")] [assembly: AssemblyProduct("SellMyScrap v40-v72")] [assembly: AssemblyTitle("com.github.zehsteam.SellMyScrap.v40-v72")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.15.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class { static () { } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } 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 com.github.zehsteam.SellMyScrap { internal static class Assets { public static GameObject NetworkHandlerPrefab { get; private set; } public static GameObject OctolarScrapEaterPrefab { get; private set; } public static GameObject TakeyScrapEaterPrefab { get; private set; } public static GameObject MaxwellScrapEaterPrefab { get; private set; } public static GameObject YippeeScrapEaterPrefab { get; private set; } public static GameObject CookieFumoScrapEaterPrefab { get; private set; } public static GameObject PsychoScrapEaterPrefab { get; private set; } public static GameObject ZombiesScrapEaterPrefab { get; private set; } public static GameObject WolfyScrapEaterPrefab { get; private set; } public static GameObject GlitchScrapEaterPrefab { get; private set; } public static AudioClip BrainRotIntroSpeechSFX { get; private set; } public static void Load() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = "sellmyscrap_assets"; string text2 = Path.Combine(directoryName, text); if (!File.Exists(text2)) { Logger.LogFatal("Failed to load assets. AssetBundle file could not be found at path \"" + text2 + "\". Make sure the \"" + text + "\" file is in the same folder as the mod's DLL file."); } else { AssetBundle val = AssetBundle.LoadFromFile(text2); if ((Object)(object)val == (Object)null) { Logger.LogFatal("Failed to load assets. AssetBundle is null."); } else { HandleAssetBundleLoaded(val); } } } private static void HandleAssetBundleLoaded(AssetBundle assetBundle) { NetworkHandlerPrefab = LoadAsset("NetworkHandler", assetBundle); NetworkHandlerPrefab.AddComponent(); OctolarScrapEaterPrefab = LoadAsset("OctolarScrapEater", assetBundle); TakeyScrapEaterPrefab = LoadAsset("TakeyScrapEater", assetBundle); MaxwellScrapEaterPrefab = LoadAsset("MaxwellScrapEater", assetBundle); YippeeScrapEaterPrefab = LoadAsset("YippeeScrapEater", assetBundle); CookieFumoScrapEaterPrefab = LoadAsset("CookieFumoScrapEater", assetBundle); PsychoScrapEaterPrefab = LoadAsset("PsychoScrapEater", assetBundle); ZombiesScrapEaterPrefab = LoadAsset("ZombiesScrapEater", assetBundle); WolfyScrapEaterPrefab = LoadAsset("WolfyScrapEater", assetBundle); GlitchScrapEaterPrefab = LoadAsset("GlitchScrapEater", assetBundle); BrainRotIntroSpeechSFX = LoadAsset("BrainRotIntroSpeechSFX", assetBundle); } private static T LoadAsset(string name, AssetBundle assetBundle) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" from AssetBundle. Name is null or whitespace."); return default(T); } if ((Object)(object)assetBundle == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null."); return default(T); } T val = assetBundle.LoadAsset(name); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. No asset found with that type and name."); return default(T); } return val; } private static bool TryLoadAsset(string name, AssetBundle assetBundle, out T asset) where T : Object { asset = LoadAsset(name, assetBundle); return (Object)(object)asset != (Object)null; } } internal static class Logger { public static ManualLogSource ManualLogSource { get; private set; } public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void LogDebug(object data) { Log((LogLevel)32, data); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogMessage(object data, bool extended = false) { Log((LogLevel)8, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } public static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!extended || IsExtendedLoggingEnabled()) { ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } public static bool IsExtendedLoggingEnabled() { if (ConfigManager.ExtendedLogging == null) { return false; } return ConfigManager.ExtendedLogging.Value; } } internal static class ConfigManager { public static ConfigFile ConfigFile { get; private set; } public static ConfigEntry ExtendedLogging { get; private set; } public static SyncedConfigEntry SellGifts { get; private set; } public static SyncedConfigEntry SellShotguns { get; private set; } public static SyncedConfigEntry SellAmmo { get; private set; } public static SyncedConfigEntry SellKnives { get; private set; } public static SyncedConfigEntry SellPickles { get; private set; } public static SyncedConfigEntry SellScrapWorthZero { get; private set; } public static SyncedConfigEntry OnlySellScrapOnFloor { get; private set; } public static SyncedConfigEntry PrioritySellList { get; private set; } public static SyncedConfigEntry DontSellList { get; private set; } public static SyncedConfigEntry SellList { get; private set; } public static string[] PrioritySellListArray { get { return PrioritySellList.Value.StringToCollection().ToArray(); } set { PrioritySellList.Value = value.CollectionToString(); } } public static string[] DontSellListArray { get { return DontSellList.Value.StringToCollection().ToArray(); } set { DontSellList.Value = value.CollectionToString(); } } public static string[] SellListArray { get { return SellList.Value.StringToCollection().ToArray(); } set { SellList.Value = value.CollectionToString(); } } public static ConfigEntry OverrideWelcomeMessage { get; private set; } public static ConfigEntry OverrideHelpMessage { get; private set; } public static ConfigEntry ShowFoundItems { get; private set; } public static ConfigEntry SortFoundItemsPrice { get; private set; } public static ConfigEntry AlignFoundItemsPrice { get; private set; } public static ConfigEntry SpeakInShip { get; private set; } public static ConfigEntry RareVoiceLineChance { get; private set; } public static ConfigEntry ShowQuotaWarning { get; private set; } public static ConfigEntry ScrapEaterChance { get; private set; } public static ConfigEntry OctolarSpawnWeight { get; private set; } public static ConfigEntry TakeySpawnWeight { get; private set; } public static ConfigEntry MaxwellSpawnWeight { get; private set; } public static ConfigEntry YippeeSpawnWeight { get; private set; } public static ConfigEntry CookieFumoSpawnWeight { get; private set; } public static ConfigEntry PsychoSpawnWeight { get; private set; } public static ConfigEntry ZombiesSpawnWeight { get; private set; } public static ConfigEntry WolfySpawnWeight { get; private set; } public static ConfigEntry GlitchSpawnWeight { get; private set; } public static void Initialize(ConfigFile configFile) { ConfigFile = configFile; BindConfigs(); } private static void BindConfigs() { ConfigHelper.SkipAutoGen(); ExtendedLogging = ConfigHelper.Bind("General", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging."); SellGifts = ConfigHelper.BindSynced("Sell", "SellGifts", defaultValue: false, "Do you want to sell Gifts?"); SellShotguns = ConfigHelper.BindSynced("Sell", "SellShotguns", defaultValue: false, "Do you want to sell Shotguns?"); SellAmmo = ConfigHelper.BindSynced("Sell", "SellAmmo", defaultValue: false, "Do you want to sell Ammo?"); SellKnives = ConfigHelper.BindSynced("Sell", "SellKnives", defaultValue: false, "Do you want to sell Kitchen knives?"); SellPickles = ConfigHelper.BindSynced("Sell", "SellPickles", defaultValue: true, "Do you want to sell Jar of pickles?"); SellScrapWorthZero = ConfigHelper.BindSynced("Advanced Sell", "SellScrapWorthZero", defaultValue: false, "Do you want to sell scrap worth zero?"); OnlySellScrapOnFloor = ConfigHelper.BindSynced("Advanced Sell", "OnlySellScrapOnFloor", defaultValue: false, "Do you want to sell scrap that is only on the floor?"); PrioritySellList = ConfigHelper.BindSynced("Advanced Sell", "PrioritySellList", "Tragedy, Comedy, Whoopie cushion, Easter egg, Clock, Soccer ball", GetPrioritySellListDescription()); DontSellList = ConfigHelper.BindSynced("Advanced Sell", "DontSellList", "", GetDontSellListDescription()); SellList = ConfigHelper.BindSynced("Advanced Sell", "SellList", "Whoopie cushion, Easter egg, Tragedy, Comedy", GetSellListDescription()); OverrideWelcomeMessage = ConfigHelper.Bind("Terminal", "OverrideWelcomeMessage", defaultValue: true, requiresRestart: false, "Overrides the terminal welcome message to add additional info."); OverrideHelpMessage = ConfigHelper.Bind("Terminal", "OverrideHelpMessage", defaultValue: true, requiresRestart: false, "Overrides the terminal help message to add additional info."); ShowFoundItems = ConfigHelper.Bind("Terminal", "ShowFoundItems", defaultValue: true, requiresRestart: false, "Show found items on the confirmation screen."); SortFoundItemsPrice = ConfigHelper.Bind("Terminal", "SortFoundItemsPrice", defaultValue: true, requiresRestart: false, "Sorts found items from most to least expensive."); AlignFoundItemsPrice = ConfigHelper.Bind("Terminal", "AlignFoundItemsPrice", defaultValue: true, requiresRestart: false, "Align all prices of found items."); SpeakInShip = ConfigHelper.Bind("Misc", "SpeakInShip", defaultValue: true, requiresRestart: false, "The Company will speak inside your ship after selling from the terminal."); RareVoiceLineChance = ConfigHelper.Bind("Misc", "RareVoiceLineChance", 5f, requiresRestart: false, "The percent chance the Company will say a rare microphone voice line after selling.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); ShowQuotaWarning = ConfigHelper.Bind("Misc", "ShowQuotaWarning", defaultValue: true, requiresRestart: false, "If enabled, will show a warning when you try to pull the ship's lever when the quota hasn't been fulfilled at the Company building with 0 days left."); ScrapEaterChance = ConfigHelper.Bind("Scrap Eater", "ScrapEaterChance", 0, requiresRestart: false, "The percent chance a scrap eater will spawn?!", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); OctolarSpawnWeight = ConfigHelper.Bind("Scrap Eater", "OctolarSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Octolar will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); TakeySpawnWeight = ConfigHelper.Bind("Scrap Eater", "TakeySpawnWeight", 1, requiresRestart: false, "The spawn chance weight Takey will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); MaxwellSpawnWeight = ConfigHelper.Bind("Scrap Eater", "MaxwellSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Maxwell will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); YippeeSpawnWeight = ConfigHelper.Bind("Scrap Eater", "YippeeSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Yippee will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); CookieFumoSpawnWeight = ConfigHelper.Bind("Scrap Eater", "CookieFumoSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Cookie Fumo will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); PsychoSpawnWeight = ConfigHelper.Bind("Scrap Eater", "PsychoSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Psycho will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); ZombiesSpawnWeight = ConfigHelper.Bind("Scrap Eater", "ZombiesSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Zombies will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); WolfySpawnWeight = ConfigHelper.Bind("Scrap Eater", "WolfySpawnWeight", 1, requiresRestart: false, "The spawn chance weight Wolfy will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); GlitchSpawnWeight = ConfigHelper.Bind("Scrap Eater", "GlitchSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Glitch will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100)); } private static string GetPrioritySellListDescription() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Array of item names to prioritize when selling."); stringBuilder.AppendLine("Each entry should be separated by a comma."); stringBuilder.AppendLine("Item names are not case-sensitive but, spaces do matter."); return stringBuilder.ToString(); } private static string GetDontSellListDescription() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Array of item names to not sell."); stringBuilder.AppendLine("Each entry should be separated by a comma."); stringBuilder.AppendLine("Item names are not case-sensitive but, spaces do matter."); return stringBuilder.ToString(); } private static string GetSellListDescription() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Array of item names to sell when using the `sell list` command."); stringBuilder.AppendLine("Each entry should be separated by a comma."); stringBuilder.AppendLine("Item names are not case-sensitive but, spaces do matter."); return stringBuilder.ToString(); } } [BepInPlugin("com.github.zehsteam.SellMyScrap.v40-v72", "SellMyScrap v40-v72", "1.15.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("com.github.zehsteam.SellMyScrap.v40-v72"); private const string TargetUnityVersion = "2022.3.9"; internal static Plugin Instance { get; private set; } private void Awake() { Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.SellMyScrap.v40-v72")); if (!Utils.IsUnityVersion("2022.3.9")) { Logger.LogWarning("Skipping SellMyScrap v40-v72 because it targets a different version of Unity (2022.3.9)"); return; } Instance = this; Logger.LogInfo("SellMyScrap v40-v72 has awoken!"); _harmony.PatchAll(typeof(GameNetworkManagerPatch)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(TimeOfDayPatch)); _harmony.PatchAll(typeof(HUDManagerPatch)); _harmony.PatchAll(typeof(TerminalPatch)); _harmony.PatchAll(typeof(DepositItemsDeskPatch)); _harmony.PatchAll(typeof(StartMatchLeverPatch)); _harmony.PatchAll(typeof(InteractTriggerPatch)); if (ShipInventoryProxy.Enabled) { ShipInventoryProxy.PatchAll(_harmony); } Assets.Load(); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); ScrapEaterManager.Initialize(); NetcodePatcherAwake(); } private void NetcodePatcherAwake() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { try { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { try { methodInfo.Invoke(null, null); } catch (TargetInvocationException ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to invoke method " + methodInfo.Name + ": " + ex.Message)); } } } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Error processing method " + methodInfo.Name + " in type " + type.Name + ": " + ex2.Message)); } } } } catch (Exception ex3) { ((BaseUnityPlugin)this).Logger.LogError((object)("An error occurred in NetcodePatcherAwake: " + ex3.Message)); } } public static void HandleLocalDisconnect() { CommandManager.OnLocalDisconnect(); SellManager.CancelSellRequest(); } public static void HandleTerminalQuit() { CommandManager.OnTerminalQuit(); SellManager.CancelSellRequest(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.SellMyScrap.v40-v72"; public const string PLUGIN_NAME = "SellMyScrap v40-v72"; public const string PLUGIN_VERSION = "1.15.3"; } } namespace com.github.zehsteam.SellMyScrap.ScrapEaters { public class ScrapEater { public GameObject SpawnPrefab; public Func GetSpawnWeight; public ScrapEater(GameObject spawnPrefab, Func getSpawnWeight) { SpawnPrefab = spawnPrefab; GetSpawnWeight = getSpawnWeight; } } public static class ScrapEaterManager { public static List ScrapEaters { get; private set; } = new List(); internal static void Initialize() { ScrapEaters = new List(9) { new ScrapEater(Assets.OctolarScrapEaterPrefab, () => ConfigManager.OctolarSpawnWeight.Value), new ScrapEater(Assets.TakeyScrapEaterPrefab, () => ConfigManager.TakeySpawnWeight.Value), new ScrapEater(Assets.MaxwellScrapEaterPrefab, () => ConfigManager.MaxwellSpawnWeight.Value), new ScrapEater(Assets.YippeeScrapEaterPrefab, () => ConfigManager.YippeeSpawnWeight.Value), new ScrapEater(Assets.CookieFumoScrapEaterPrefab, () => ConfigManager.CookieFumoSpawnWeight.Value), new ScrapEater(Assets.PsychoScrapEaterPrefab, () => ConfigManager.PsychoSpawnWeight.Value), new ScrapEater(Assets.ZombiesScrapEaterPrefab, () => ConfigManager.ZombiesSpawnWeight.Value), new ScrapEater(Assets.WolfyScrapEaterPrefab, () => ConfigManager.WolfySpawnWeight.Value), new ScrapEater(Assets.GlitchScrapEaterPrefab, () => ConfigManager.GlitchSpawnWeight.Value) }; } internal static bool CanUseScrapEater() { int value = ConfigManager.ScrapEaterChance.Value; return Utils.RollPercentChance(value); } internal static bool HasScrapEater(int index) { if (ScrapEaters.Count == 0) { return false; } if (index < 0 || index > ScrapEaters.Count - 1) { return false; } return true; } public static void AddScrapEater(GameObject spawnPrefab, Func GetSpawnWeight) { ScrapEaters.Add(new ScrapEater(spawnPrefab, GetSpawnWeight)); } internal static void StartRandomScrapEaterOnServer(List scrap, int variantIndex = -1) { if (NetworkUtils.IsServer) { int randomScrapEaterIndex = GetRandomScrapEaterIndex(); if (randomScrapEaterIndex != -1) { StartScrapEaterOnServer(randomScrapEaterIndex, scrap, variantIndex); } } } internal static void StartScrapEaterOnServer(int index, List scrap, int variantIndex = -1) { //IL_001a: 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) if (NetworkUtils.IsServer) { GameObject spawnPrefab = ScrapEaters[index].SpawnPrefab; GameObject val = Object.Instantiate(spawnPrefab, Vector3.zero, Quaternion.identity); NetworkObject component = val.GetComponent(); component.Spawn(true); ScrapEaterBehaviour component2 = val.GetComponent(); component2.SetData(scrap, variantIndex); Logger.LogInfo($"Spawned scrap eater #{index + 1}"); } } private static int GetRandomScrapEaterIndex() { return Utils.GetRandomIndexFromWeightList(ScrapEaters.Select((ScrapEater x) => x.GetSpawnWeight()).ToList()); } } } namespace com.github.zehsteam.SellMyScrap.Patches { [HarmonyPatch(typeof(DepositItemsDesk))] internal static class DepositItemsDeskPatch { public static int ClipIndex = -1; public static bool SpeakInShip = false; [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(ref DepositItemsDesk __instance) { DepositItemsDeskHelper.SetInstance(__instance); } [HarmonyPatch("SellItemsOnServer")] [HarmonyPrefix] private static bool SellItemsOnServerPatch(ref DepositItemsDesk __instance) { if (__instance.itemsOnCounter.Count == 0) { return false; } if (NetworkUtils.IsServer) { SetMicrophoneSpeakData_Server(SpeakInShip); } return true; } [HarmonyPatch("MicrophoneSpeak")] [HarmonyPrefix] private static bool MicrophoneSpeakPatch(ref DepositItemsDesk __instance) { AudioClip[] microphoneAudios = __instance.microphoneAudios; AudioClip[] rareMicrophoneAudios = __instance.rareMicrophoneAudios; List list = new List(microphoneAudios.Length + rareMicrophoneAudios.Length); list.AddRange(microphoneAudios); list.AddRange(rareMicrophoneAudios); List list2 = list; if (ClipIndex == -1) { ClipIndex = GetRandomAudioClipIndex(); } AudioClip val = list2[ClipIndex]; __instance.speakerAudio.PlayOneShot(val, 1f); if (SpeakInShip && ConfigManager.SpeakInShip.Value) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(val, 1f); } SpeakInShip = false; ClipIndex = -1; return false; } private static int GetRandomAudioClipIndex() { if (Utils.RollPercentChance(ConfigManager.RareVoiceLineChance.Value)) { return Random.Range(0, DepositItemsDeskHelper.Instance.rareMicrophoneAudios.Length) + DepositItemsDeskHelper.Instance.microphoneAudios.Length; } return Random.Range(0, DepositItemsDeskHelper.Instance.microphoneAudios.Length); } public static void SetMicrophoneSpeakData_LocalClient(bool speakInShip, int clipIndex) { SpeakInShip = speakInShip; ClipIndex = clipIndex; } private static void SetMicrophoneSpeakData_Server(bool speakInShip) { SpeakInShip = speakInShip; ClipIndex = GetRandomAudioClipIndex(); PluginNetworkBehaviour.Instance.SetMicrophoneSpeakDataClientRpc(speakInShip, ClipIndex); } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { AddNetworkPrefabs(); } private static void AddNetworkPrefabs() { AddNetworkPrefab(Assets.NetworkHandlerPrefab); foreach (ScrapEater scrapEater in ScrapEaterManager.ScrapEaters) { AddNetworkPrefab(scrapEater.SpawnPrefab); } } private static void AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to register network prefab. GameObject is null."); return; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Logger.LogInfo("Registered \"" + ((Object)prefab).name + "\" network prefab."); } } [HarmonyPatch(typeof(HUDManager))] internal static class HUDManagerPatch { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Scrollbar rewardsScrollbar; public float duration; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 0f; rewardsScrollbar.value = 1f; break; case 2: <>1__state = -1; 5__2 += Time.deltaTime; break; } if (5__2 < duration) { if (5__2 > duration) { 5__2 = duration; } float num = 1f / duration * 5__2; rewardsScrollbar.value = 1f - num; <>2__current = null; <>1__state = 2; return true; } rewardsScrollbar.value = 0f; 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(); } } [HarmonyPatch("DisplayCreditsEarning")] [HarmonyPrefix] [HarmonyPriority(800)] private static bool DisplayCreditsEarningPatch(ref HUDManager __instance, int creditsEarned, GrabbableObject[] objectsSold, int newGroupCredits, ref Coroutine ___scrollRewardTextCoroutine) { Logger.LogInfo($"Earned ${creditsEarned}; sold {objectsSold.Length} items; new credits amount: ${newGroupCredits}"); string text = ScrapHelper.GetScrapMessage(objectsSold.ToList()); int num = text.Split('\n').Length; int num2 = ((num < 8) ? (8 - num) : 0); for (int i = 0; i < num2; i++) { text += "\n\t"; } ((TMP_Text)__instance.moneyRewardsListText).text = text; ((TMP_Text)__instance.moneyRewardsTotalText).text = $"TOTAL: ${creditsEarned}"; __instance.moneyRewardsAnimator.SetTrigger("showRewards"); __instance.rewardsScrollbar.value = 1f; if (num >= 9) { if (___scrollRewardTextCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(___scrollRewardTextCoroutine); } ___scrollRewardTextCoroutine = ((MonoBehaviour)__instance).StartCoroutine(ScrollRewardsListText(__instance.rewardsScrollbar)); } return false; } [IteratorStateMachine(typeof(d__1))] private static IEnumerator ScrollRewardsListText(Scrollbar rewardsScrollbar, float duration = 3f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { rewardsScrollbar = rewardsScrollbar, duration = duration }; } } [HarmonyPatch(typeof(InteractTrigger))] internal static class InteractTriggerPatch { [HarmonyPatch("StopInteraction")] [HarmonyPostfix] private static void StopInteractionPatch(ref InteractTrigger __instance) { if ((Object)(object)StartMatchLeverPatch.InteractTrigger == (Object)(object)__instance) { StartMatchLeverPatch.DisplayedSellWarning = false; } } } [HarmonyPatch(typeof(StartMatchLever))] internal static class StartMatchLeverPatch { public static InteractTrigger InteractTrigger; public static bool DisplayedSellWarning; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartMatchLever __instance) { InteractTrigger = ((Component)__instance).GetComponent(); DisplayedSellWarning = false; } [HarmonyPatch("BeginHoldingInteractOnLever")] [HarmonyPostfix] private static void BeginHoldingInteractOnLeverPatch(ref StartMatchLever __instance) { if (TimeOfDay.Instance.daysUntilDeadline > 0 || !ConfigManager.ShowQuotaWarning.Value) { if (__instance.triggerScript.timeToHold == 4.01f) { __instance.triggerScript.timeToHold = 0.7f; } } else if (!((Object)(object)DepositItemsDeskHelper.Instance == (Object)null) && StartOfRound.Instance.shipHasLanded) { if (TimeOfDay.Instance.quotaFulfilled >= TimeOfDay.Instance.profitQuota) { __instance.triggerScript.timeToHold = 0.7f; } else if (!DisplayedSellWarning) { DisplayedSellWarning = true; __instance.triggerScript.timeToHold = 4.01f; HUDManager.Instance.DisplayTip("HALT!", "You did not sell enough scrap to fulfill the profit quota.", true, false, "LC_Tip1"); } } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { SpawnNetworkHandler(); } private static void SpawnNetworkHandler() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { GameObject val = Object.Instantiate(Assets.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { RemoveMapPropsContainerForTesting(); } private static void RemoveMapPropsContainerForTesting() { GameObject val = GameObject.Find("Environment/MapPropsContainerForTesting"); if (!((Object)(object)val == (Object)null)) { val.SetActive(false); } } [HarmonyPatch("firstDayAnimation")] [HarmonyPrefix] [HarmonyPriority(800)] private static void FirstDayAnimationPatchPrefix() { if (DateTime.Today.Month == 4 && DateTime.Today.Day == 1) { StartOfRound.Instance.shipIntroSpeechSFX = Assets.BrainRotIntroSpeechSFX; } } [HarmonyPatch("OnClientConnect")] [HarmonyPrefix] private static void OnClientConnectPatch(ref ulong clientId) { if (NetworkUtils.IsServer) { SyncedConfigEntryBase.SendConfigsToClient(clientId); } } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPrefix] private static void OnLocalDisconnectPatch() { Plugin.HandleLocalDisconnect(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { private static bool _hasOverrideTerminalNodes; public static Terminal Instance { get; private set; } [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(Terminal __instance) { Instance = __instance; } [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatchPrefix(ref Terminal __instance) { TerminalHelper.SetInstance(__instance); } [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(0)] private static void StartPatchPostfix(ref TerminalNodesList ___terminalNodes) { OverrideTerminalNodes(___terminalNodes); } private static void OverrideTerminalNodes(TerminalNodesList terminalNodes) { if (!_hasOverrideTerminalNodes) { _hasOverrideTerminalNodes = true; if (ConfigManager.OverrideWelcomeMessage.Value) { OverrideWelcomeTerminalNode(terminalNodes); } if (ConfigManager.OverrideHelpMessage.Value) { OverrideHelpTerminalNode(terminalNodes); } } } private static void OverrideWelcomeTerminalNode(TerminalNodesList terminalNodes) { int index = 1; string displayText = terminalNodes.specialNodes[index].displayText; string text = "Type \"Help\" for a list of commands."; string displayText2 = displayText.Replace(text, text + "\n\n[SellMyScrap v40-v72]\nType \"Sell\" for a list of commands."); terminalNodes.specialNodes[index].displayText = displayText2; } private static void OverrideHelpTerminalNode(TerminalNodesList terminalNodes) { int index = 13; string displayText = terminalNodes.specialNodes[index].displayText; string text = ">OTHER\nTo see the list of other commands"; string displayText2 = displayText.Replace(text, text + ".\n\n>SELL\nTo see the list of SellMyScrap v40-v72 commands."); terminalNodes.specialNodes[index].displayText = displayText2; } [HarmonyPatch("QuitTerminal")] [HarmonyPostfix] private static void QuitTerminalPatch() { Plugin.HandleTerminalQuit(); } [HarmonyPatch("ParsePlayerSentence")] [HarmonyPrefix] [HarmonyPriority(800)] private static bool ParsePlayerSentencePatch(ref Terminal __instance, ref TerminalNode __result) { string[] array = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded).Split(' ', StringSplitOptions.RemoveEmptyEntries); if (CommandManager.TryExecuteCommand(array, out var terminalNode)) { if ((Object)(object)terminalNode == (Object)null) { __result = TerminalHelper.CreateTerminalNode("TerminalNode is null!\n\n"); return false; } __result = terminalNode; return false; } return true; } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatch { private static int _daysUntilDeadline = 3; private static int _preDaysUntilDeadline = 3; private static int _postDaysUntilDeadline = 3; [HarmonyPatch("SetBuyingRateForDay")] [HarmonyPrefix] private static void SetBuyingRateForDayPatchPrefix() { _preDaysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; } [HarmonyPatch("SetBuyingRateForDay")] [HarmonyPostfix] private static void SetBuyingRateForDayPatchPostfix() { _postDaysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; SetDaysUntilDeadline(); } private static void SetDaysUntilDeadline() { if (_postDaysUntilDeadline == 0) { if (_preDaysUntilDeadline == 0) { _daysUntilDeadline = 0; } else { _daysUntilDeadline = -1; } } else { _daysUntilDeadline = _postDaysUntilDeadline; } } public static int GetDaysUntilDeadline() { return _daysUntilDeadline; } } } namespace com.github.zehsteam.SellMyScrap.Data { public enum SellType { None, Amount, Quota, All, Item, List } public enum ConfirmationStatus { None, AwaitingConfirmation, Confirmed } public class SellRequest { public SellType SellType; public int ScrapValue; public int RequestedScrapValue; public ConfirmationStatus ConfirmationStatus; public int ScrapEaterIndex; public int ScrapEaterVariantIndex; public int RealScrapValue => ScrapHelper.GetRealValue(ScrapValue); public SellRequest(SellType sellType, int scrapValue, int requestedScrapValue, ConfirmationStatus confirmationStatus, int scrapEaterIndex = -2, int scrapEaterVariantIndex = -1) { SellType = sellType; ScrapValue = scrapValue; RequestedScrapValue = requestedScrapValue; ConfirmationStatus = confirmationStatus; ScrapEaterIndex = scrapEaterIndex; ScrapEaterVariantIndex = scrapEaterVariantIndex; } } } namespace com.github.zehsteam.SellMyScrap.Objects { public enum ItemLocation { Ship, Vehicle, ShipInventory } public class ItemData { public GrabbableObject GrabbableObject { get; set; } public SI_ItemDataProxy SI_ItemDataProxy { get; set; } public ItemLocation ItemLocation { get; set; } public string ItemName => GetItemName(); public int ScrapValue => GetScrapValue(); public ItemData(GrabbableObject grabbableObject, ItemLocation itemLocation) { GrabbableObject = grabbableObject; ItemLocation = itemLocation; } public ItemData(SI_ItemDataProxy si_ItemDataProxy, ItemLocation itemLocation) { SI_ItemDataProxy = si_ItemDataProxy; ItemLocation = itemLocation; } private string GetItemName() { if ((Object)(object)GrabbableObject != (Object)null) { return GrabbableObject.itemProperties.itemName; } if (ShipInventoryProxy.Enabled && SI_ItemDataProxy.IsValid()) { return SI_ItemDataProxy.ItemName; } return "Unknown Item"; } private int GetScrapValue() { if ((Object)(object)GrabbableObject != (Object)null) { return GrabbableObject.scrapValue; } if (ShipInventoryProxy.Enabled && SI_ItemDataProxy.IsValid()) { return SI_ItemDataProxy.ScrapValue; } return 0; } } [Serializable] public class ScrapToSell : INetworkSerializable { public NetworkObjectReference[] ShipNetworkObjectReferences = Array.Empty(); public NetworkObjectReference[] VehicleNetworkObjectReferences = Array.Empty(); public SI_ItemDataProxy[] ShipInventoryItems = Array.Empty(); private List _itemDataList = new List(); private bool _setItemDataList; private List _shipGrabbableObjects = new List(); private bool _setShipGrabbableObjects; private List _vehicleGrabbableObjects = new List(); private bool _setVehicleGrabbableObjects; public List ItemDataList { get { if (!_setItemDataList) { SetItemDataList(); } return _itemDataList; } set { _itemDataList = value; _setItemDataList = true; } } public List GrabbableObjects { get { List shipGrabbableObjects = ShipGrabbableObjects; List vehicleGrabbableObjects = VehicleGrabbableObjects; List list = new List(shipGrabbableObjects.Count + vehicleGrabbableObjects.Count); list.AddRange(shipGrabbableObjects); list.AddRange(vehicleGrabbableObjects); return list; } } public List ShipGrabbableObjects { get { if (!_setShipGrabbableObjects) { SetShipGrabbableObjects(); } return _shipGrabbableObjects; } set { _shipGrabbableObjects = value; _setShipGrabbableObjects = true; } } public List VehicleGrabbableObjects { get { if (!_setVehicleGrabbableObjects) { SetVehicleGrabbableObjects(); } return _vehicleGrabbableObjects; } set { _vehicleGrabbableObjects = value; _setVehicleGrabbableObjects = true; } } public int ItemCount => GetItemCount(); public int TotalScrapValue => GetTotalScrapValue(); public int RealTotalScrapValue => ScrapHelper.GetRealValue(TotalScrapValue); public ScrapToSell() { } public ScrapToSell(List items) { ItemDataList = items; ShipGrabbableObjects = (from x in items where (Object)(object)x.GrabbableObject != (Object)null && x.ItemLocation == ItemLocation.Ship select x.GrabbableObject).ToList(); VehicleGrabbableObjects = (from x in items where (Object)(object)x.GrabbableObject != (Object)null && x.ItemLocation == ItemLocation.Vehicle select x.GrabbableObject).ToList(); ShipInventoryItems = (from x in items where x.SI_ItemDataProxy.IsValid() select x.SI_ItemDataProxy).ToArray(); SetShipNetworkObjectReferences(); SetVehicleNetworkObjectReferences(); } private void SetShipNetworkObjectReferences() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) List list = new List(); NetworkObject val = default(NetworkObject); foreach (GrabbableObject shipGrabbableObject in ShipGrabbableObjects) { if (((Component)shipGrabbableObject).TryGetComponent(ref val)) { list.Add(NetworkObjectReference.op_Implicit(val)); } } ShipNetworkObjectReferences = list.ToArray(); } private void SetVehicleNetworkObjectReferences() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) List list = new List(); NetworkObject val = default(NetworkObject); foreach (GrabbableObject vehicleGrabbableObject in VehicleGrabbableObjects) { if (((Component)vehicleGrabbableObject).TryGetComponent(ref val)) { list.Add(NetworkObjectReference.op_Implicit(val)); } } VehicleNetworkObjectReferences = list.ToArray(); } private void SetItemDataList() { ItemDataList = ScrapHelper.GetItemDataList(ShipGrabbableObjects, VehicleGrabbableObjects, ShipInventoryItems); } private void SetShipGrabbableObjects() { //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) ShipGrabbableObjects = new List(); NetworkObjectReference[] shipNetworkObjectReferences = ShipNetworkObjectReferences; NetworkObject val2 = default(NetworkObject); GrabbableObject item = default(GrabbableObject); for (int i = 0; i < shipNetworkObjectReferences.Length; i++) { NetworkObjectReference val = shipNetworkObjectReferences[i]; if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) && ((Component)val2).TryGetComponent(ref item)) { ShipGrabbableObjects.Add(item); } } } private void SetVehicleGrabbableObjects() { //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) VehicleGrabbableObjects = new List(); NetworkObjectReference[] vehicleNetworkObjectReferences = VehicleNetworkObjectReferences; NetworkObject val2 = default(NetworkObject); GrabbableObject item = default(GrabbableObject); for (int i = 0; i < vehicleNetworkObjectReferences.Length; i++) { NetworkObjectReference val = vehicleNetworkObjectReferences[i]; if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) && ((Component)val2).TryGetComponent(ref item)) { VehicleGrabbableObjects.Add(item); } } } private int GetItemCount() { return GrabbableObjects.Count + ShipInventoryItems.Length; } private int GetTotalScrapValue() { return GrabbableObjects.Sum((GrabbableObject x) => x.scrapValue) + ShipInventoryItems.Sum((SI_ItemDataProxy x) => x.ScrapValue); } public unsafe void NetworkSerialize(BufferSerializer 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_0020: 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_0036: 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) ((BufferSerializer*)(&serializer))->SerializeValue(ref ShipNetworkObjectReferences, default(ForNetworkSerializable)); ((BufferSerializer*)(&serializer))->SerializeValue(ref VehicleNetworkObjectReferences, default(ForNetworkSerializable)); ((BufferSerializer*)(&serializer))->SerializeValue(ref ShipInventoryItems, default(ForNetworkSerializable)); } } public class SellCommandRequest { [CompilerGenerated] private int P; public int Value => P; public bool OnlyAllowedScrap { get; set; } public bool WithOvertimeBonus { get; set; } public bool OnlyUseShipInventory { get; set; } public BaseScrapMatchAlgorithm ScrapMatchAlgorithm { get; set; } public int TargetValue { get { if (!WithOvertimeBonus) { return GetSellValue(Value); } return GetSellValueWithOvertime(); } } public SellCommandRequest(int value) { P = value; OnlyAllowedScrap = true; ScrapMatchAlgorithm = BaseScrapMatchAlgorithm.Default; base..ctor(); } public ScrapToSell GetScrapToSell(List items) { if (Value == int.MaxValue) { return new ScrapToSell(items); } return new ScrapToSell(ScrapMatchAlgorithm.FindMatch(items, TargetValue, ConfigManager.PrioritySellListArray)); } private int GetSellValue(int value) { if (value == int.MaxValue) { return value; } return Mathf.CeilToInt((float)value / StartOfRound.Instance.companyBuyingRate); } private int GetSellValueWithOvertime() { int profitQuota = TimeOfDay.Instance.profitQuota; int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; int num = quotaFulfilled + Value - profitQuota; if (num <= 0) { return GetSellValue(Value); } int value = Value; int num2 = Mathf.Max(profitQuota - quotaFulfilled, 0); value -= (TimeOfDayPatch.GetDaysUntilDeadline() + 1) * 15; int value2 = Mathf.CeilToInt((float)(5 * value + num2 + 75) / 6f); return GetSellValue(value2); } } public class SyncedConfigEntry : SyncedConfigEntryBase { private ConfigEntry _configEntry; private T _serverValue; public T Value { get { return GetValue(); } set { SetValue(value); } } public T DefaultValue => (T)((ConfigEntryBase)_configEntry).DefaultValue; public override string Section => ((ConfigEntryBase)_configEntry).Definition.Section; public override string Key => ((ConfigEntryBase)_configEntry).Definition.Key; public event Action SettingChanged; public SyncedConfigEntry(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, ConfigFile configFile = null) { SyncedConfigEntryBase.AddInstance(this); _configEntry = ConfigHelper.Bind(section, key, defaultValue, requiresRestart: false, description, acceptableValues, null, configFile); _configEntry.SettingChanged += SettingChangedInternal; } public T GetValue() { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { return _serverValue; } return _configEntry.Value; } public void SetValue(T value) { if (!NetworkUtils.IsConnected || NetworkUtils.IsServer) { _configEntry.Value = value; } } public void ResetToDefault() { if (!NetworkUtils.IsConnected || NetworkUtils.IsServer) { _configEntry.Value = DefaultValue; } } private void SettingChangedInternal(object sender, EventArgs e) { if (NetworkUtils.IsConnected && NetworkUtils.IsServer) { this.SettingChanged?.Invoke(Value); SendConfigToClients(); } } private void SendConfigToClients() { //IL_003b: 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 (NetworkUtils.IsConnected && NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(Section, Key, Value.ToString()); } } public override void SendConfigToClient(ulong clientId) { //IL_0011: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsConnected && NetworkUtils.IsServer) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(Section, Key, Value.ToString(), clientRpcParams); } } public override void SetValueFromServer(string value) { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { if (!value.TryConvertTo(out var result)) { throw new InvalidOperationException($"Failed to parse value: \"{value}\" for type {typeof(T)}"); } _serverValue = result; Logger.LogInfo("Set synced config entry value from server. (Section: \"" + Section + "\", Key: \"" + Key + "\", Value: \"" + value + "\")", extended: true); this.SettingChanged?.Invoke(result); } } } public abstract class SyncedConfigEntryBase { private static readonly object _instancesLock = new object(); public static List Instances { get; private set; } = new List(); public abstract string Section { get; } public abstract string Key { get; } public static void AddInstance(SyncedConfigEntryBase instance) { lock (_instancesLock) { Instances.Add(instance); } } public static void RemoveInstance(SyncedConfigEntryBase instance) { lock (_instancesLock) { Instances.Remove(instance); } } public abstract void SendConfigToClient(ulong clientId); public abstract void SetValueFromServer(string value); public static void SendConfigsToClient(ulong clientId) { if (!NetworkUtils.IsConnected || !NetworkUtils.IsServer || NetworkUtils.IsLocalClientId(clientId)) { return; } foreach (SyncedConfigEntryBase instance in Instances) { instance.SendConfigToClient(clientId); } } public static void SetValueFromServer(string section, string key, string value) { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { SyncedConfigEntryBase syncedConfigEntryBase = Instances.Find((SyncedConfigEntryBase x) => x.Section == section && x.Key == key); if (syncedConfigEntryBase == null) { Logger.LogWarning("No matching synced config entry found for section: \"" + section + "\", key: \"" + key + "\""); } else { syncedConfigEntryBase.SetValueFromServer(value); } } } } } namespace com.github.zehsteam.SellMyScrap.MonoBehaviours { public class CookieFumoScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CookieFumoScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; CookieFumoScrapEaterBehaviour cookieFumoScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.fallSFX); <>2__current = ((MonoBehaviour)cookieFumoScrapEaterBehaviour).StartCoroutine(cookieFumoScrapEaterBehaviour.MoveToPosition(cookieFumoScrapEaterBehaviour.spawnPosition, cookieFumoScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; cookieFumoScrapEaterBehaviour.StopAudioSource(cookieFumoScrapEaterBehaviour.soundEffectsAudio); cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.landSFX, cookieFumoScrapEaterBehaviour.landIndex); cookieFumoScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; cookieFumoScrapEaterBehaviour.PlayAudioSource(cookieFumoScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)cookieFumoScrapEaterBehaviour).StartCoroutine(cookieFumoScrapEaterBehaviour.MoveToPosition(cookieFumoScrapEaterBehaviour.startPosition, cookieFumoScrapEaterBehaviour.endPosition, cookieFumoScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; cookieFumoScrapEaterBehaviour.StopAudioSource(cookieFumoScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.pauseDuration / 2f); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.beforeEatSFX)); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.pauseDuration / 2f); <>1__state = 6; return true; case 6: <>1__state = -1; cookieFumoScrapEaterBehaviour.MoveTargetScrapToTargetTransform(cookieFumoScrapEaterBehaviour.mouthTransform, cookieFumoScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.suckDuration); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.eatSFX)); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.voiceLineSFX, cookieFumoScrapEaterBehaviour._voiceLineIndex)); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(cookieFumoScrapEaterBehaviour.pauseDuration / 2f); <>1__state = 10; return true; case 10: <>1__state = -1; cookieFumoScrapEaterBehaviour.PlayAudioSource(cookieFumoScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)cookieFumoScrapEaterBehaviour).StartCoroutine(cookieFumoScrapEaterBehaviour.MoveToPosition(cookieFumoScrapEaterBehaviour.endPosition, cookieFumoScrapEaterBehaviour.startPosition, cookieFumoScrapEaterBehaviour.movementDuration)); <>1__state = 11; return true; case 11: <>1__state = -1; cookieFumoScrapEaterBehaviour.StopAudioSource(cookieFumoScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; case 12: <>1__state = -1; cookieFumoScrapEaterBehaviour.PlayOneShotSFX(cookieFumoScrapEaterBehaviour.takeOffSFX); <>2__current = ((MonoBehaviour)cookieFumoScrapEaterBehaviour).StartCoroutine(cookieFumoScrapEaterBehaviour.MoveToPosition(cookieFumoScrapEaterBehaviour.startPosition, cookieFumoScrapEaterBehaviour.spawnPosition, 2f)); <>1__state = 13; return true; case 13: <>1__state = -1; 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(); } } [Space(20f)] [Header("Cookie Fumo")] [Space(5f)] public AudioClip fallSFX; public AudioClip beforeEatSFX; public AudioClip[] voiceLineSFX = Array.Empty(); private int _voiceLineIndex; protected override void Start() { if (NetworkUtils.IsServer) { _voiceLineIndex = Random.Range(0, voiceLineSFX.Length); SetDataClientRpc(_voiceLineIndex); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int voiceLineIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3624265567u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, voiceLineIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3624265567u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _voiceLineIndex = voiceLineIndex; } } } [IteratorStateMachine(typeof(d__6))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { <>4__this = this }; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CookieFumoScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3624265567u, new RpcReceiveHandler(__rpc_handler_3624265567)); } private static void __rpc_handler_3624265567(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int dataClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((CookieFumoScrapEaterBehaviour)(object)target).SetDataClientRpc(dataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CookieFumoScrapEaterBehaviour"; } } internal class CoroutineRunner : MonoBehaviour { public static CoroutineRunner Instance { get; private set; } public static void Spawn() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance != (Object)null)) { new GameObject("SellMyScrap v40-v72 CoroutineRunner", new Type[1] { typeof(CoroutineRunner) }); } } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; ((Object)this).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)this); } public static Coroutine Start(IEnumerator routine) { if ((Object)(object)Instance == (Object)null) { Spawn(); } CoroutineRunner instance = Instance; return ((instance != null) ? ((MonoBehaviour)instance).StartCoroutine(routine) : null) ?? null; } public static void Stop(IEnumerator routine) { if (!((Object)(object)Instance == (Object)null)) { ((MonoBehaviour)Instance).StopCoroutine(routine); } } public static void Stop(Coroutine routine) { if (!((Object)(object)Instance == (Object)null)) { ((MonoBehaviour)Instance).StopCoroutine(routine); } } } public class DestroyAfterTimeBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DestroyAfterTimeBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown int num = <>1__state; DestroyAfterTimeBehaviour destroyAfterTimeBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(destroyAfterTimeBehaviour.duration); <>1__state = 1; return true; case 1: <>1__state = -1; Object.Destroy((Object)(object)((Component)destroyAfterTimeBehaviour).gameObject); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public float duration = 5f; private void Start() { ((MonoBehaviour)this).StartCoroutine(DestoryAfterTime()); } [IteratorStateMachine(typeof(d__2))] private IEnumerator DestoryAfterTime() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { <>4__this = this }; } } public class GlitchScrapEater : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GlitchScrapEater <>4__this; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00b8: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown int num = <>1__state; GlitchScrapEater glitchScrapEater = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = ((MonoBehaviour)glitchScrapEater).StartCoroutine(glitchScrapEater.MoveToPosition(glitchScrapEater.spawnPosition, glitchScrapEater.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; glitchScrapEater.PlayOneShotSFX(glitchScrapEater.landSFX, glitchScrapEater.landIndex); glitchScrapEater.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; glitchScrapEater.PlayAudioSource(glitchScrapEater.movementAudio); <>2__current = ((MonoBehaviour)glitchScrapEater).StartCoroutine(glitchScrapEater.MoveToPosition(glitchScrapEater.startPosition, glitchScrapEater.endPosition, glitchScrapEater.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; glitchScrapEater.StopAudioSource(glitchScrapEater.movementAudio); <>2__current = (object)new WaitForSeconds(glitchScrapEater.pauseDuration / 2f); <>1__state = 4; return true; case 4: { <>1__state = -1; AudioClip[] audioClips = (glitchScrapEater._playLunxaraSFX ? glitchScrapEater._beforeEatLunxaraSFX : glitchScrapEater._beforeEatSFX); <>2__current = (object)new WaitForSeconds(glitchScrapEater.PlayOneShotSFX(audioClips, glitchScrapEater._beforeEatSFXIndex)); <>1__state = 5; return true; } case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(glitchScrapEater.pauseDuration / 2f); <>1__state = 6; return true; case 6: <>1__state = -1; glitchScrapEater.MoveTargetScrapToTargetTransform(glitchScrapEater.mouthTransform, glitchScrapEater.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(glitchScrapEater.suckDuration); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(glitchScrapEater.PlayOneShotSFX(glitchScrapEater.eatSFX)); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(glitchScrapEater.PlayOneShotSFX(glitchScrapEater._afterEatSFX)); <>1__state = 9; return true; case 9: { <>1__state = -1; 5__2 = glitchScrapEater._flashbangExplodeSFX.length; Vector3 position = glitchScrapEater.mouthTransform.position; Object.Instantiate(glitchScrapEater._flashbangParticlePrefab, position, Quaternion.identity); StunGrenadeItem.StunExplosion(position, true, 1f, 7.5f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f); glitchScrapEater.PlayOneShotSFX(glitchScrapEater._flashbangExplodeSFX); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 10; return true; } case 10: <>1__state = -1; glitchScrapEater.modelObject.SetActive(false); <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 11; return true; case 11: <>1__state = -1; 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(); } } [Space(20f)] [Header("Glitch")] [Space(5f)] [SerializeField] private AudioClip[] _beforeEatSFX = Array.Empty(); [SerializeField] private AudioClip[] _beforeEatLunxaraSFX = Array.Empty(); [SerializeField] private AudioClip _afterEatSFX; private int _beforeEatSFXIndex; private bool _playLunxaraSFX; private AudioClip _flashbangExplodeSFX; private GameObject _flashbangParticlePrefab; protected override void Start() { if (NetworkUtils.IsServer) { if (PlayerUtils.HasPlayerLunxara()) { _playLunxaraSFX = Utils.RollPercentChance(50f); } if (_playLunxaraSFX) { _beforeEatSFXIndex = Random.Range(0, _beforeEatLunxaraSFX.Length); } else { _beforeEatSFXIndex = Random.Range(0, _beforeEatSFX.Length); } SetDataClientRpc(_beforeEatSFXIndex, _playLunxaraSFX); } FindFlashbangAssets(); base.Start(); } [ClientRpc] private void SetDataClientRpc(int beforeEatSFXIndex, bool playLunxaraSFX) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1454171327u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, beforeEatSFXIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playLunxaraSFX, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1454171327u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _beforeEatSFXIndex = beforeEatSFXIndex; _playLunxaraSFX = playLunxaraSFX; } } } private void FindFlashbangAssets() { Item val = ((IEnumerable)TerminalPatch.Instance.buyableItemsList).FirstOrDefault((Func)((Item x) => x.itemName.Equals("Stun grenade", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val == (Object)null) { Logger.LogError("[GlitchScrapEater] Failed to find Stun Grenade item."); return; } StunGrenadeItem val2 = default(StunGrenadeItem); if (!val.spawnPrefab.TryGetComponent(ref val2)) { Logger.LogError("[GlitchScrapEater] Failed to find StunGrenadeItem component on Stun Grenade item prefab."); return; } _flashbangExplodeSFX = val2.explodeSFX; _flashbangParticlePrefab = val2.stunGrenadeExplosion; } [IteratorStateMachine(typeof(d__10))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this }; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_GlitchScrapEater() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1454171327u, new RpcReceiveHandler(__rpc_handler_1454171327)); } private static void __rpc_handler_1454171327(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int beforeEatSFXIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref beforeEatSFXIndex); bool playLunxaraSFX = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playLunxaraSFX, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((GlitchScrapEater)(object)target).SetDataClientRpc(beforeEatSFXIndex, playLunxaraSFX); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GlitchScrapEater"; } } public class MaxwellScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MaxwellScrapEaterBehaviour <>4__this; public float duration; private PlayerControllerB 5__2; private Vector3 5__3; private Vector3 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) //IL_00c8: 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) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MaxwellScrapEaterBehaviour maxwellScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = PlayerUtils.GetLocalPlayerScript(); maxwellScrapEaterBehaviour._isTarget = true; PlayerUtils.SetLocalPlayerMovementEnabled(enabled: false); PlayerUtils.SetLocalPlayerAllowDeathEnabled(enabled: false); 5__3 = ((Component)5__2).transform.position; 5__4 = maxwellScrapEaterBehaviour.mouthTransform.position; 5__4.x += 1f; 5__4.y = ((Component)maxwellScrapEaterBehaviour).transform.position.y; 5__5 = 0f; break; case 1: <>1__state = -1; 5__5 += Time.deltaTime; break; } if (5__5 < duration) { float num2 = 1f / duration * 5__5; Vector3 position = 5__3 + (5__4 - 5__3) * num2; ((Component)5__2).transform.position = position; <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MaxwellScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0063: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MaxwellScrapEaterBehaviour maxwellScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; maxwellScrapEaterBehaviour.SetAnimationIdle(); <>2__current = ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.MoveToPosition(maxwellScrapEaterBehaviour.spawnPosition, maxwellScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; maxwellScrapEaterBehaviour.PlayOneShotSFX(maxwellScrapEaterBehaviour.landSFX, maxwellScrapEaterBehaviour.landIndex); maxwellScrapEaterBehaviour.PlayOneShotSFX(maxwellScrapEaterBehaviour.meowSFX, maxwellScrapEaterBehaviour._meowIndex); maxwellScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; maxwellScrapEaterBehaviour.PlayAudioSource(maxwellScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.MoveToPosition(maxwellScrapEaterBehaviour.startPosition, maxwellScrapEaterBehaviour.endPosition, maxwellScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; maxwellScrapEaterBehaviour.StopAudioSource(maxwellScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.pauseDuration / 3f); <>1__state = 4; return true; case 4: <>1__state = -1; maxwellScrapEaterBehaviour.SetAnimationDance(); <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.pauseDuration / 3f * 2f); <>1__state = 5; return true; case 5: <>1__state = -1; if (maxwellScrapEaterBehaviour._isTarget) { ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.MoveLocalPlayerToMaxwell(maxwellScrapEaterBehaviour.suckDuration - 0.1f)); } maxwellScrapEaterBehaviour.MoveTargetScrapToTargetTransform(maxwellScrapEaterBehaviour.mouthTransform, maxwellScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.suckDuration); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.PlayOneShotSFX(maxwellScrapEaterBehaviour.eatSFX)); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.pauseDuration / 3f * 2f); <>1__state = 8; return true; case 8: <>1__state = -1; maxwellScrapEaterBehaviour.SetAnimationIdle(); <>2__current = (object)new WaitForSeconds(maxwellScrapEaterBehaviour.pauseDuration / 3f); <>1__state = 9; return true; case 9: <>1__state = -1; if (maxwellScrapEaterBehaviour._isTarget) { PlayerUtils.SetLocalPlayerAllowDeathEnabled(enabled: true); } if (maxwellScrapEaterBehaviour._isEvil) { <>2__current = ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.StartEvilMaxwell()); <>1__state = 10; return true; } if (maxwellScrapEaterBehaviour._isTarget) { PlayerUtils.SetLocalPlayerMovementEnabled(enabled: true); } maxwellScrapEaterBehaviour.PlayAudioSource(maxwellScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.MoveToPosition(maxwellScrapEaterBehaviour.endPosition, maxwellScrapEaterBehaviour.startPosition, maxwellScrapEaterBehaviour.movementDuration)); <>1__state = 12; return true; case 10: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 11; return true; case 11: <>1__state = -1; return false; case 12: <>1__state = -1; maxwellScrapEaterBehaviour.StopAudioSource(maxwellScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 13; return true; case 13: <>1__state = -1; maxwellScrapEaterBehaviour.PlayOneShotSFX(maxwellScrapEaterBehaviour.takeOffSFX); <>2__current = ((MonoBehaviour)maxwellScrapEaterBehaviour).StartCoroutine(maxwellScrapEaterBehaviour.MoveToPosition(maxwellScrapEaterBehaviour.startPosition, maxwellScrapEaterBehaviour.spawnPosition, 2f)); <>1__state = 14; return true; case 14: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MaxwellScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; MaxwellScrapEaterBehaviour maxwellScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; maxwellScrapEaterBehaviour.bodyObject.SetActive(false); maxwellScrapEaterBehaviour.evilObject.SetActive(true); maxwellScrapEaterBehaviour.purrAudio.Stop(); maxwellScrapEaterBehaviour.PlayOneShotSFX(maxwellScrapEaterBehaviour.evilNoise); <>2__current = (object)new WaitForSeconds(1.25f); <>1__state = 1; return true; case 1: <>1__state = -1; if (maxwellScrapEaterBehaviour._isTarget) { PlayerUtils.SetLocalPlayerMovementEnabled(enabled: true); } <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; case 2: { <>1__state = -1; Vector3 position = ((Component)maxwellScrapEaterBehaviour).transform.position; position.y += 0.31f; Utils.CreateExplosion(position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3); maxwellScrapEaterBehaviour.evilObject.transform.SetParent((Transform)null); maxwellScrapEaterBehaviour.evilObject.AddComponent().duration = 15f; Rigidbody[] componentsInChildren = maxwellScrapEaterBehaviour.evilObject.GetComponentsInChildren(); foreach (Rigidbody val in componentsInChildren) { val.isKinematic = false; val.AddExplosionForce(1000f, maxwellScrapEaterBehaviour.evilObject.transform.position, 100f); } PlayerUtils.ReviveDeadPlayersAfterTime(5f); 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(); } } [Space(20f)] [Header("Maxwell")] [Space(5f)] public GameObject bodyObject; public GameObject evilObject; public Animator danceAnimator; public AudioSource purrAudio; public AudioSource danceAudio; public AudioClip[] meowSFX = Array.Empty(); public AudioClip evilNoise; private bool _isEvil; private int _meowIndex; private bool _isTarget; protected override void Start() { if (NetworkUtils.IsServer) { if (PlayerUtils.HasPlayerMagoroku() || PlayerUtils.HasPlayerPsychoHypnotic()) { _isEvil = Utils.RollPercentChance(80f); } else { _isEvil = Utils.RollPercentChance(50f); } _meowIndex = Random.Range(0, meowSFX.Length); SetDataClientRpc(_isEvil, _meowIndex); } base.Start(); } [ClientRpc] private void SetDataClientRpc(bool isEvil, int meowIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1025003959u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isEvil, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, meowIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1025003959u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _isEvil = isEvil; _meowIndex = meowIndex; if (PlayerUtils.IsLocalPlayerMagoroku() && (Utils.RollPercentChance(40f) || (isEvil && Utils.RollPercentChance(80f)))) { _isTarget = true; } } } [IteratorStateMachine(typeof(d__12))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__13))] private IEnumerator MoveLocalPlayerToMaxwell(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, duration = duration }; } [IteratorStateMachine(typeof(d__14))] private IEnumerator StartEvilMaxwell() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } private void SetAnimationDance() { danceAnimator.Play("dingusDance"); purrAudio.Stop(); danceAudio.Play(); } private void SetAnimationIdle() { danceAnimator.Play("dingusIdle"); purrAudio.Play(); danceAudio.Stop(); } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MaxwellScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1025003959u, new RpcReceiveHandler(__rpc_handler_1025003959)); } private static void __rpc_handler_1025003959(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isEvil = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isEvil, default(ForPrimitives)); int meowIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref meowIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MaxwellScrapEaterBehaviour)(object)target).SetDataClientRpc(isEvil, meowIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "MaxwellScrapEaterBehaviour"; } } public class OctolarScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OctolarScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0067: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; OctolarScrapEaterBehaviour octolarScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.fallSFX); <>2__current = ((MonoBehaviour)octolarScrapEaterBehaviour).StartCoroutine(octolarScrapEaterBehaviour.MoveToPosition(octolarScrapEaterBehaviour.spawnPosition, octolarScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; octolarScrapEaterBehaviour.StopAudioSource(octolarScrapEaterBehaviour.soundEffectsAudio); octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.landSFX, octolarScrapEaterBehaviour.landIndex); octolarScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; octolarScrapEaterBehaviour.PlayAudioSource(octolarScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)octolarScrapEaterBehaviour).StartCoroutine(octolarScrapEaterBehaviour.MoveToPosition(octolarScrapEaterBehaviour.startPosition, octolarScrapEaterBehaviour.endPosition, octolarScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; octolarScrapEaterBehaviour.StopAudioSource(octolarScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(octolarScrapEaterBehaviour.pauseDuration); <>1__state = 4; return true; case 4: <>1__state = -1; octolarScrapEaterBehaviour.SetMaterial(octolarScrapEaterBehaviour.suckMaterial); octolarScrapEaterBehaviour.MoveTargetScrapToTargetTransform(octolarScrapEaterBehaviour.mouthTransform, octolarScrapEaterBehaviour.suckDuration); octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.suckSFX); <>2__current = (object)new WaitForSeconds(octolarScrapEaterBehaviour.suckDuration); <>1__state = 5; return true; case 5: <>1__state = -1; octolarScrapEaterBehaviour.SetMaterialVariant(octolarScrapEaterBehaviour._materialVariantIndex); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (object)new WaitForSeconds(octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.eatSFX)); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.afterEatSFX)); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(octolarScrapEaterBehaviour.pauseDuration); <>1__state = 9; return true; case 9: <>1__state = -1; octolarScrapEaterBehaviour.PlayAudioSource(octolarScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)octolarScrapEaterBehaviour).StartCoroutine(octolarScrapEaterBehaviour.MoveToPosition(octolarScrapEaterBehaviour.endPosition, octolarScrapEaterBehaviour.startPosition, octolarScrapEaterBehaviour.movementDuration)); <>1__state = 10; return true; case 10: <>1__state = -1; octolarScrapEaterBehaviour.StopAudioSource(octolarScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 11; return true; case 11: <>1__state = -1; octolarScrapEaterBehaviour.PlayOneShotSFX(octolarScrapEaterBehaviour.takeOffSFX); <>2__current = ((MonoBehaviour)octolarScrapEaterBehaviour).StartCoroutine(octolarScrapEaterBehaviour.MoveToPosition(octolarScrapEaterBehaviour.startPosition, octolarScrapEaterBehaviour.spawnPosition, 2f)); <>1__state = 12; return true; case 12: <>1__state = -1; 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(); } } [Space(20f)] [Header("Octolar")] [Space(5f)] public MeshRenderer meshRenderer; public Material[] materialVariants = Array.Empty(); public Material suckMaterial; public AudioClip fallSFX; public AudioClip suckSFX; public AudioClip afterEatSFX; private int _materialVariantIndex; protected override void Start() { if (NetworkUtils.IsServer && materialVariants.Length != 0) { _materialVariantIndex = Random.Range(0, materialVariants.Length); SetDataClientRpc(_materialVariantIndex); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int materialVariantIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1308763114u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, materialVariantIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1308763114u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _materialVariantIndex = materialVariantIndex; SetMaterialVariant(materialVariantIndex); } } } [IteratorStateMachine(typeof(d__9))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this }; } private void SetMaterial(Material material) { if (!((Object)(object)meshRenderer == (Object)null) && !((Object)(object)material == (Object)null)) { ((Renderer)meshRenderer).material = material; } } private void SetMaterialVariant(int index) { if (index >= 0 && index <= materialVariants.Length - 1) { SetMaterial(materialVariants[index]); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_OctolarScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1308763114u, new RpcReceiveHandler(__rpc_handler_1308763114)); } private static void __rpc_handler_1308763114(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int dataClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((OctolarScrapEaterBehaviour)(object)target).SetDataClientRpc(dataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "OctolarScrapEaterBehaviour"; } } internal class PluginNetworkBehaviour : NetworkBehaviour { public static PluginNetworkBehaviour Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } else { Instance = this; } } private void Start() { NyawrServerRpc("Networking works! YIPPEE!"); } [ServerRpc(RequireOwnership = false)] private void NyawrServerRpc(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2333518927u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2333518927u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { NyawrClientRpc(message); } } [ClientRpc] private void NyawrClientRpc(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4247106616u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4247106616u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Logger.LogMessage("Nyawr: " + message); } } [ClientRpc] public void SetSyncedConfigValueClientRpc(string section, string key, string value, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1035539730u, clientRpcParams, (RpcDelivery)0); bool flag = section != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(section, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(key, false); } bool flag3 = value != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(value, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1035539730u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsServer) { SyncedConfigEntryBase.SetValueFromServer(section, key, value); } } [ServerRpc(RequireOwnership = false)] public void PerformSellServerRpc(ScrapToSell scrapToSell, SellType sellType, int scrapEaterIndex = -2, int scrapEaterVariantIndex = -1, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(631730937u, serverRpcParams, (RpcDelivery)0); bool flag = scrapToSell != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(ref scrapToSell, default(ForNetworkSerializable)); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref sellType, default(ForEnums)); BytePacker.WriteValueBitPacked(val, scrapEaterIndex); BytePacker.WriteValueBitPacked(val, scrapEaterVariantIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 631730937u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { PlayerControllerB playerScriptByClientId = PlayerUtils.GetPlayerScriptByClientId(senderClientId); if ((Object)(object)playerScriptByClientId == (Object)null) { Logger.LogError("Failed to perform sell server rpc. PlayerControllerB is null."); return; } string text = $"{playerScriptByClientId.playerUsername} requested to sell {sellType} {scrapToSell.ItemCount} items for ${scrapToSell.RealTotalScrapValue}"; Logger.LogInfo(text); HUDManager.Instance.DisplayGlobalNotification(text); SellManager.PerformSellOnServerFromClient(scrapToSell, sellType, scrapEaterIndex, scrapEaterVariantIndex); } } [ClientRpc] public void PlaceItemsOnCounterClientRpc(NetworkObjectReference[] networkObjectReferences) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4051419495u, val, (RpcDelivery)0); bool flag = networkObjectReferences != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(networkObjectReferences, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4051419495u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsServer) { DepositItemsDeskHelper.PlaceItemsOnCounter(NetworkUtils.GetGrabbableObjects(networkObjectReferences)); } } [ClientRpc] public void SetMicrophoneSpeakDataClientRpc(bool speakInShip, int clipIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3796402752u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref speakInShip, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3796402752u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsServer) { DepositItemsDeskPatch.SetMicrophoneSpeakData_LocalClient(speakInShip, clipIndex); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PluginNetworkBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2333518927u, new RpcReceiveHandler(__rpc_handler_2333518927)); NetworkManager.__rpc_func_table.Add(4247106616u, new RpcReceiveHandler(__rpc_handler_4247106616)); NetworkManager.__rpc_func_table.Add(1035539730u, new RpcReceiveHandler(__rpc_handler_1035539730)); NetworkManager.__rpc_func_table.Add(631730937u, new RpcReceiveHandler(__rpc_handler_631730937)); NetworkManager.__rpc_func_table.Add(4051419495u, new RpcReceiveHandler(__rpc_handler_4051419495)); NetworkManager.__rpc_func_table.Add(3796402752u, new RpcReceiveHandler(__rpc_handler_3796402752)); } private static void __rpc_handler_2333518927(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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).NyawrServerRpc(message); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4247106616(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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PluginNetworkBehaviour)(object)target).NyawrClientRpc(message); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1035539730(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_0067: 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_009f: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string section = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref section, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag3, default(ForPrimitives)); string value = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((PluginNetworkBehaviour)(object)target).SetSyncedConfigValueClientRpc(section, key, value, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_631730937(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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); ScrapToSell scrapToSell = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref scrapToSell, default(ForNetworkSerializable)); } SellType sellType = default(SellType); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sellType, default(ForEnums)); int scrapEaterIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapEaterIndex); int scrapEaterVariantIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapEaterVariantIndex); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).PerformSellServerRpc(scrapToSell, sellType, scrapEaterIndex, scrapEaterVariantIndex, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4051419495(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_006e: 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_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); NetworkObjectReference[] networkObjectReferences = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReferences, default(ForNetworkSerializable)); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PluginNetworkBehaviour)(object)target).PlaceItemsOnCounterClientRpc(networkObjectReferences); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3796402752(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool speakInShip = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref speakInShip, default(ForPrimitives)); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((PluginNetworkBehaviour)(object)target).SetMicrophoneSpeakDataClientRpc(speakInShip, clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PluginNetworkBehaviour"; } } public class PsychoScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PsychoScrapEaterBehaviour <>4__this; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown int num = <>1__state; PsychoScrapEaterBehaviour psychoScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; float length = psychoScrapEaterBehaviour.raidSFX.length; float num2 = 3.36f; 5__2 = length - num2 - 0.5f; psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.raidSFX); <>2__current = (object)new WaitForSeconds(num2); <>1__state = 1; return true; } case 1: <>1__state = -1; psychoScrapEaterBehaviour.SetMaterial(psychoScrapEaterBehaviour.suckMaterial); psychoScrapEaterBehaviour.potatoesParticleSystem.Play(); <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 2; return true; case 2: <>1__state = -1; psychoScrapEaterBehaviour.potatoesParticleSystem.Stop(); ((Component)psychoScrapEaterBehaviour.potatoesParticleSystem).transform.SetParent((Transform)null); ((Component)psychoScrapEaterBehaviour.potatoesParticleSystem).gameObject.AddComponent().duration = 15f; psychoScrapEaterBehaviour.SetMaterial(psychoScrapEaterBehaviour.normalMaterial); <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.pauseDuration); <>1__state = 3; return true; case 3: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PsychoScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0059: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PsychoScrapEaterBehaviour psychoScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = ((MonoBehaviour)psychoScrapEaterBehaviour).StartCoroutine(psychoScrapEaterBehaviour.MoveToPosition(psychoScrapEaterBehaviour.spawnPosition, psychoScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.landSFX, psychoScrapEaterBehaviour.landIndex); psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.hohSFX); psychoScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; psychoScrapEaterBehaviour.PlayAudioSource(psychoScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)psychoScrapEaterBehaviour).StartCoroutine(psychoScrapEaterBehaviour.MoveToPosition(psychoScrapEaterBehaviour.startPosition, psychoScrapEaterBehaviour.endPosition, psychoScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; psychoScrapEaterBehaviour.StopAudioSource(psychoScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.pauseDuration); <>1__state = 4; return true; case 4: <>1__state = -1; psychoScrapEaterBehaviour.SetMaterial(psychoScrapEaterBehaviour.suckMaterial); psychoScrapEaterBehaviour.MoveTargetScrapToTargetTransform(psychoScrapEaterBehaviour.mouthTransform, psychoScrapEaterBehaviour.suckDuration); psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.suckSFX); <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.suckDuration); <>1__state = 5; return true; case 5: <>1__state = -1; psychoScrapEaterBehaviour.SetMaterial(psychoScrapEaterBehaviour.normalMaterial); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.eatSFX)); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.hohSFX)); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(psychoScrapEaterBehaviour.pauseDuration / 2f); <>1__state = 9; return true; case 9: <>1__state = -1; if (psychoScrapEaterBehaviour._raid) { <>2__current = ((MonoBehaviour)psychoScrapEaterBehaviour).StartCoroutine(psychoScrapEaterBehaviour.RaidAnimation()); <>1__state = 10; return true; } goto IL_0277; case 10: <>1__state = -1; goto IL_0277; case 11: <>1__state = -1; psychoScrapEaterBehaviour.StopAudioSource(psychoScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; case 12: <>1__state = -1; psychoScrapEaterBehaviour.PlayOneShotSFX(psychoScrapEaterBehaviour.TakeyOffSFXList, psychoScrapEaterBehaviour._takeOffSFXListIndex); <>2__current = ((MonoBehaviour)psychoScrapEaterBehaviour).StartCoroutine(psychoScrapEaterBehaviour.MoveToPosition(psychoScrapEaterBehaviour.startPosition, psychoScrapEaterBehaviour.spawnPosition, 2f)); <>1__state = 13; return true; case 13: { <>1__state = -1; return false; } IL_0277: psychoScrapEaterBehaviour.PlayAudioSource(psychoScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)psychoScrapEaterBehaviour).StartCoroutine(psychoScrapEaterBehaviour.MoveToPosition(psychoScrapEaterBehaviour.endPosition, psychoScrapEaterBehaviour.startPosition, psychoScrapEaterBehaviour.movementDuration)); <>1__state = 11; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Psycho")] [Space(5f)] public MeshRenderer meshRenderer; public Material normalMaterial; public Material suckMaterial; public AudioClip hohSFX; public AudioClip suckSFX; public AudioClip raidSFX; public AudioClip[] TakeyOffSFXList = Array.Empty(); public ParticleSystem potatoesParticleSystem; private int _takeOffSFXListIndex; private bool _raid; protected override void Start() { SetMaterial(normalMaterial); if ((Object)(object)suckSFX != (Object)null) { suckDuration = suckSFX.length; } if (NetworkUtils.IsServer) { _takeOffSFXListIndex = Random.Range(0, TakeyOffSFXList.Length); _raid = Utils.RollPercentChance(100f); SetDataClientRpc(_takeOffSFXListIndex, _raid); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int takeOffSFXListIndex, bool raid) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2404007170u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, takeOffSFXListIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref raid, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2404007170u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _takeOffSFXListIndex = takeOffSFXListIndex; _raid = raid; } } } [IteratorStateMachine(typeof(d__12))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__13))] private IEnumerator RaidAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } private void SetMaterial(Material material) { if (!((Object)(object)meshRenderer == (Object)null) && !((Object)(object)material == (Object)null)) { ((Renderer)meshRenderer).material = material; } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PsychoScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2404007170u, new RpcReceiveHandler(__rpc_handler_2404007170)); } private static void __rpc_handler_2404007170(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int takeOffSFXListIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref takeOffSFXListIndex); bool raid = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref raid, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PsychoScrapEaterBehaviour)(object)target).SetDataClientRpc(takeOffSFXListIndex, raid); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PsychoScrapEaterBehaviour"; } } public class ScrapEaterAnimationEventBehaviour : MonoBehaviour { public ScrapEaterBehaviour scrapEaterBehaviour; public void ShowModel() { scrapEaterBehaviour.modelObject.SetActive(true); } public void HideMode() { scrapEaterBehaviour.modelObject.SetActive(false); } } public abstract class ScrapEaterBehaviour : NetworkBehaviour { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ScrapEaterBehaviour scrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; scrapEaterBehaviour.modelObject.SetActive(true); <>2__current = ((MonoBehaviour)scrapEaterBehaviour).StartCoroutine(scrapEaterBehaviour.StartAnimation()); <>1__state = 1; return true; case 1: <>1__state = -1; scrapEaterBehaviour.modelObject.SetActive(false); scrapEaterBehaviour.AddTargetScrapToDepositItemsDesk(); scrapEaterBehaviour.AnimationFinishedServerRpc(); 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(); } } [Header("Scrap Eater")] [Space(5f)] public GameObject modelObject; [HideInInspector] public List targetScrap = new List(); [HideInInspector] public int TargetVariantIndex = -1; private int _clientsReceivedTargetScrap; private int _clientsFinishedAnimation; protected virtual void Start() { modelObject.SetActive(false); if (NetworkUtils.IsServer) { if (GameNetworkManager.Instance.connectedPlayers > 1) { SetTargetScrapClientRpc(NetworkUtils.GetNetworkObjectReferences(targetScrap)); } else { ((MonoBehaviour)this).StartCoroutine(StartEventOnLocalClient()); } } } public void SetData(List targetScrap, int variantIndex = -1) { this.targetScrap = targetScrap; this.targetScrap.ForEach(delegate(GrabbableObject item) { item.grabbable = false; }); TargetVariantIndex = variantIndex; } [ClientRpc] protected void SetTargetScrapClientRpc(NetworkObjectReference[] networkObjectReferences) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1207916376u, val, (RpcDelivery)0); bool flag = networkObjectReferences != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(networkObjectReferences, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1207916376u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (NetworkUtils.IsServer) { ReceivedTargetScrapServerRpc(); return; } targetScrap = NetworkUtils.GetGrabbableObjects(networkObjectReferences); targetScrap.ForEach(delegate(GrabbableObject item) { item.grabbable = false; }); ReceivedTargetScrapServerRpc(); } [ServerRpc(RequireOwnership = false)] protected void ReceivedTargetScrapServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3663001823u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3663001823u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _clientsReceivedTargetScrap++; if (_clientsReceivedTargetScrap >= GameNetworkManager.Instance.connectedPlayers) { _clientsReceivedTargetScrap = 0; OnAllClientsReceivedTargetScrap(); } } } protected virtual void OnAllClientsReceivedTargetScrap() { StartEventClientRpc(); } [ClientRpc] protected virtual void StartEventClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3643583003u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3643583003u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(StartEventOnLocalClient()); } } } [IteratorStateMachine(typeof(d__11))] protected virtual IEnumerator StartEventOnLocalClient() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__12))] protected virtual IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0); } [ServerRpc(RequireOwnership = false)] protected void AnimationFinishedServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1452900636u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1452900636u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _clientsFinishedAnimation++; if (_clientsFinishedAnimation >= GameNetworkManager.Instance.connectedPlayers) { _clientsFinishedAnimation = 0; OnAllClientsFinishedAnimation(); } } } protected virtual void OnAllClientsFinishedAnimation() { SellTargetScrapOnServer(); ((Component)this).GetComponent().Despawn(true); } protected void AddTargetScrapToDepositItemsDesk() { if (targetScrap.Count != 0) { DepositItemsDeskHelper.PlaceItemsOnCounter(targetScrap); targetScrap.Clear(); } } protected void SellTargetScrapOnServer() { if (NetworkUtils.IsServer) { DepositItemsDeskHelper.SellItems_Server(); } } protected Transform GetHangarShipTransform() { return ScrapHelper.ShipTransform; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1207916376u, new RpcReceiveHandler(__rpc_handler_1207916376)); NetworkManager.__rpc_func_table.Add(3663001823u, new RpcReceiveHandler(__rpc_handler_3663001823)); NetworkManager.__rpc_func_table.Add(3643583003u, new RpcReceiveHandler(__rpc_handler_3643583003)); NetworkManager.__rpc_func_table.Add(1452900636u, new RpcReceiveHandler(__rpc_handler_1452900636)); } private static void __rpc_handler_1207916376(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_006e: 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_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); NetworkObjectReference[] targetScrapClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetScrapClientRpc, default(ForNetworkSerializable)); } target.__rpc_exec_stage = (__RpcExecStage)2; ((ScrapEaterBehaviour)(object)target).SetTargetScrapClientRpc(targetScrapClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3663001823(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ScrapEaterBehaviour)(object)target).ReceivedTargetScrapServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3643583003(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((ScrapEaterBehaviour)(object)target).StartEventClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1452900636(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ScrapEaterBehaviour)(object)target).AnimationFinishedServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScrapEaterBehaviour"; } } public class ScrapEaterExtraBehaviour : ScrapEaterBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass19_0 { public Transform targetTransform; internal float b__0(GrabbableObject x) { //IL_0006: 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) return Vector3.Distance(targetTransform.position, ((Component)x).transform.position); } } [CompilerGenerated] private sealed class d__19 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Transform targetTransform; public ScrapEaterExtraBehaviour <>4__this; public float duration; private <>c__DisplayClass19_0 <>8__1; public float suckDuration; private List 5__2; private float 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown int num = <>1__state; ScrapEaterExtraBehaviour scrapEaterExtraBehaviour = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_010b; } <>1__state = -1; <>8__1 = new <>c__DisplayClass19_0(); <>8__1.targetTransform = targetTransform; 5__2 = scrapEaterExtraBehaviour.targetScrap.OrderBy((GrabbableObject x) => Vector3.Distance(<>8__1.targetTransform.position, ((Component)x).transform.position)).ToList(); 5__3 = duration / (float)5__2.Count; 5__4 = 0; goto IL_011b; IL_010b: 5__4++; goto IL_011b; IL_011b: if (5__4 < 5__2.Count) { if (!((Object)(object)5__2[5__4] == (Object)null)) { SuckBehaviour suckBehaviour = ((Component)5__2[5__4]).gameObject.AddComponent(); suckBehaviour.StartEvent(<>8__1.targetTransform, suckDuration); if (5__4 <= 5__2.Count - 2) { <>2__current = (object)new WaitForSeconds(5__3); <>1__state = 1; return true; } } goto IL_010b; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__20 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScrapEaterExtraBehaviour <>4__this; public Vector3 from; public float duration; public Vector3 to; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0068: 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_0079: 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) int num = <>1__state; ScrapEaterExtraBehaviour scrapEaterExtraBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; ((Component)scrapEaterExtraBehaviour).transform.localPosition = from; 5__2 = 0f; break; case 1: <>1__state = -1; 5__2 += Time.deltaTime; break; } if (5__2 < duration) { float num2 = 1f / duration * 5__2; Vector3 localPosition = from + (to - from) * num2; ((Component)scrapEaterExtraBehaviour).transform.localPosition = localPosition; <>2__current = null; <>1__state = 1; return true; } ((Component)scrapEaterExtraBehaviour).transform.localPosition = to; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScrapEaterExtraBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00d4: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ScrapEaterExtraBehaviour scrapEaterExtraBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = ((MonoBehaviour)scrapEaterExtraBehaviour).StartCoroutine(scrapEaterExtraBehaviour.MoveToPosition(scrapEaterExtraBehaviour.spawnPosition, scrapEaterExtraBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; scrapEaterExtraBehaviour.PlayOneShotSFX(scrapEaterExtraBehaviour.landSFX, scrapEaterExtraBehaviour.landIndex); scrapEaterExtraBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; scrapEaterExtraBehaviour.PlayAudioSource(scrapEaterExtraBehaviour.movementAudio); <>2__current = ((MonoBehaviour)scrapEaterExtraBehaviour).StartCoroutine(scrapEaterExtraBehaviour.MoveToPosition(scrapEaterExtraBehaviour.startPosition, scrapEaterExtraBehaviour.endPosition, scrapEaterExtraBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; scrapEaterExtraBehaviour.StopAudioSource(scrapEaterExtraBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(scrapEaterExtraBehaviour.pauseDuration); <>1__state = 4; return true; case 4: <>1__state = -1; scrapEaterExtraBehaviour.MoveTargetScrapToTargetTransform(scrapEaterExtraBehaviour.mouthTransform, scrapEaterExtraBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(scrapEaterExtraBehaviour.suckDuration); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(scrapEaterExtraBehaviour.PlayOneShotSFX(scrapEaterExtraBehaviour.eatSFX)); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (object)new WaitForSeconds(scrapEaterExtraBehaviour.pauseDuration); <>1__state = 7; return true; case 7: <>1__state = -1; scrapEaterExtraBehaviour.PlayAudioSource(scrapEaterExtraBehaviour.movementAudio); <>2__current = ((MonoBehaviour)scrapEaterExtraBehaviour).StartCoroutine(scrapEaterExtraBehaviour.MoveToPosition(scrapEaterExtraBehaviour.endPosition, scrapEaterExtraBehaviour.startPosition, scrapEaterExtraBehaviour.movementDuration)); <>1__state = 8; return true; case 8: <>1__state = -1; scrapEaterExtraBehaviour.StopAudioSource(scrapEaterExtraBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 9; return true; case 9: <>1__state = -1; scrapEaterExtraBehaviour.PlayOneShotSFX(scrapEaterExtraBehaviour.takeOffSFX); <>2__current = ((MonoBehaviour)scrapEaterExtraBehaviour).StartCoroutine(scrapEaterExtraBehaviour.MoveToPosition(scrapEaterExtraBehaviour.startPosition, scrapEaterExtraBehaviour.spawnPosition, 2f)); <>1__state = 10; return true; case 10: <>1__state = -1; 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(); } } [Space(20f)] [Header("Extra")] [Space(5f)] public Vector3 spawnPosition = new Vector3(-8.9f, 150f, -3.2f); public Vector3 spawnRotationOffset = new Vector3(0f, 90f, 0f); public Vector3 startPosition = new Vector3(-8.9f, 0f, -3.2f); public Vector3 endPosition = new Vector3(-8.9f, 0f, -6.72f); [Space(5f)] public Transform mouthTransform; public AudioSource soundEffectsAudio; public AudioSource movementAudio; [Space(5f)] public float movementDuration = 4f; public float suckDuration = 3.5f; public float pauseDuration = 2f; [Space(5f)] public AudioClip[] landSFX = Array.Empty(); public AudioClip eatSFX; public AudioClip takeOffSFX; protected int landIndex; protected override void Start() { //IL_0018: 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_0039: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetParent(GetHangarShipTransform()); ((Component)this).transform.localPosition = spawnPosition; ((Component)this).transform.localRotation = Quaternion.identity; ((Component)this).transform.Rotate(spawnRotationOffset, (Space)1); if (NetworkUtils.IsServer) { landIndex = Random.Range(0, landSFX.Length); SetExtraDataClientRpc(landIndex); } base.Start(); } [ClientRpc] protected void SetExtraDataClientRpc(int landIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1486476132u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, landIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1486476132u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { this.landIndex = landIndex; } } } [IteratorStateMachine(typeof(d__16))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } protected virtual void MoveTargetScrapToTargetTransform(Transform targetTransform, float duration) { MoveTargetScrapToTargetTransform(targetScrap, targetTransform, duration); } protected virtual void MoveTargetScrapToTargetTransform(List items, Transform targetTransform, float duration) { foreach (GrabbableObject item in items) { if (!((Object)(object)item == (Object)null)) { SuckBehaviour suckBehaviour = ((Component)item).gameObject.AddComponent(); suckBehaviour.StartEvent(targetTransform, duration); } } } [IteratorStateMachine(typeof(d__19))] protected virtual IEnumerator MoveTargetScrapToTargetTransformDelayed(Transform targetTransform, float suckDuration, float duration = 10f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(0) { <>4__this = this, targetTransform = targetTransform, suckDuration = suckDuration, duration = duration }; } [IteratorStateMachine(typeof(d__20))] protected IEnumerator MoveToPosition(Vector3 from, Vector3 to, float duration) { //IL_000e: 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_0015: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { <>4__this = this, from = from, to = to, duration = duration }; } protected float PlayOneShotSFX(AudioClip audioClip, float volumeScale = 1f) { return PlayOneShotSFX(soundEffectsAudio, audioClip, volumeScale); } protected float PlayOneShotSFX(AudioClip[] audioClips, int index, float volumeScale = 1f) { if (audioClips == null || audioClips.Length == 0) { return 0f; } if (index < 0 || index > audioClips.Length - 1) { return 0f; } if ((Object)(object)audioClips[index] == (Object)null) { return 0f; } PlayOneShotSFX(audioClips[index], volumeScale); return audioClips[index].length; } protected float PlayOneShotSFX(AudioSource audioSource, AudioClip audioClip, float volumeScale = 1f) { if ((Object)(object)audioSource == (Object)null || (Object)(object)audioClip == (Object)null) { return 0f; } audioSource.PlayOneShot(audioClip, volumeScale); return audioClip.length; } protected void PlayAudioSource(AudioSource audioSource) { if (!((Object)(object)audioSource == (Object)null)) { audioSource.Play(); } } protected void StopAudioSource(AudioSource audioSource) { if (!((Object)(object)audioSource == (Object)null)) { audioSource.Stop(); } } protected void ShakeCamera(float bigShakeDistance = 8f, float smallShakeDistance = 18f) { //IL_000f: 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) float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position); if (num <= bigShakeDistance) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num <= smallShakeDistance) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ScrapEaterExtraBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1486476132u, new RpcReceiveHandler(__rpc_handler_1486476132)); } private static void __rpc_handler_1486476132(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int extraDataClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref extraDataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((ScrapEaterExtraBehaviour)(object)target).SetExtraDataClientRpc(extraDataClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScrapEaterExtraBehaviour"; } } public class SuckBehaviour : MonoBehaviour { [CompilerGenerated] private sealed class d__5 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SuckBehaviour <>4__this; public float duration; public Transform targetTransform; private Transform 5__2; private Vector3 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SuckBehaviour suckBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)suckBehaviour._ragdollGrabbableObject == (Object)null || !suckBehaviour._ragdollGrabbableObject.foundRagdollObject) { Logger.LogError("RagdollGrabbableObject is null or the ragdoll object was not found."); <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; } 5__2 = ((Component)suckBehaviour._ragdollGrabbableObject.ragdoll).transform; 5__3 = 5__2.position; 5__4 = 0f; break; case 1: <>1__state = -1; return false; case 2: <>1__state = -1; 5__4 += Time.deltaTime; break; case 3: <>1__state = -1; 5__4 += Time.deltaTime; break; } if (5__4 < duration) { if ((Object)(object)targetTransform == (Object)null) { <>2__current = null; <>1__state = 2; return true; } float num2 = 1f / duration * 5__4; Vector3 position = 5__3 + (targetTransform.position - 5__3) * num2; 5__2.position = position; <>2__current = null; <>1__state = 3; return true; } if ((Object)(object)targetTransform != (Object)null) { 5__2.position = targetTransform.position; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SuckBehaviour <>4__this; public Transform targetTransform; public float duration; private Vector3 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_011f: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SuckBehaviour suckBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = ((Component)suckBehaviour).transform.position; 5__3 = 0f; break; case 1: <>1__state = -1; 5__3 += Time.deltaTime; break; case 2: <>1__state = -1; 5__3 += Time.deltaTime; break; } if (5__3 < duration) { if ((Object)(object)targetTransform == (Object)null) { <>2__current = null; <>1__state = 1; return true; } float num2 = 1f / duration * 5__3; Vector3 position = 5__2 + (targetTransform.position - 5__2) * num2; ((Component)suckBehaviour).transform.position = position; <>2__current = null; <>1__state = 2; return true; } if ((Object)(object)targetTransform != (Object)null) { ((Component)suckBehaviour).transform.position = targetTransform.position; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SuckBehaviour <>4__this; public Transform targetTransform; public float duration; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; SuckBehaviour suckBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)suckBehaviour._ragdollGrabbableObject == (Object)null) { <>2__current = ((MonoBehaviour)suckBehaviour).StartCoroutine(suckBehaviour.MoveToPosition(targetTransform, duration)); <>1__state = 1; return true; } <>2__current = ((MonoBehaviour)suckBehaviour).StartCoroutine(suckBehaviour.MoveRagdollToPosition(targetTransform, duration)); <>1__state = 2; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } suckBehaviour.PlaceItemOnCounter(); 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(); } } protected GrabbableObject _grabbableObject; protected RagdollGrabbableObject _ragdollGrabbableObject; public virtual void StartEvent(Transform targetTransform, float duration) { _grabbableObject = ((Component)this).GetComponent(); _grabbableObject.grabbable = false; _grabbableObject.parentObject = null; _grabbableObject.EnablePhysics(false); _ragdollGrabbableObject = ((Component)this).GetComponent(); ((MonoBehaviour)this).StartCoroutine(StartAnimation(targetTransform, duration)); } [IteratorStateMachine(typeof(d__3))] protected virtual IEnumerator StartAnimation(Transform targetTransform, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { <>4__this = this, targetTransform = targetTransform, duration = duration }; } [IteratorStateMachine(typeof(d__4))] protected virtual IEnumerator MoveToPosition(Transform targetTransform, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { <>4__this = this, targetTransform = targetTransform, duration = duration }; } [IteratorStateMachine(typeof(d__5))] protected virtual IEnumerator MoveRagdollToPosition(Transform targetTransform, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this, targetTransform = targetTransform, duration = duration }; } protected void PlaceItemOnCounter() { if ((Object)(object)_ragdollGrabbableObject == (Object)null) { DepositItemsDeskHelper.PlaceItemOnCounter(_grabbableObject); } else { DepositItemsDeskHelper.PlaceRagdollOnCounter(_ragdollGrabbableObject); } } } public enum TakeyVariantType { Default, Gazmi, Shady, Captain, Gamble, ChickenDance, DinkDonk, FightClub, Cute, Feels, Stabby, LUBBERS, ALOO, Gift, Cake, Dracula, Pumpkin, Pilgrim, Santa, Nutcracker } public class TakeyScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__54 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyScrapEaterBehaviour <>4__this; private List> 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__54(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown int num = <>1__state; TakeyScrapEaterBehaviour takeyScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = takeyScrapEaterBehaviour.targetScrap.OrderBy((GrabbableObject x) => x.scrapValue).ToList().SplitList(3); <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.DinkDonkSpecialLine1SFX)); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 2: <>1__state = -1; takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.DinkDonkSpecialLine2SFX); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; case 3: <>1__state = -1; takeyScrapEaterBehaviour.MoveTargetScrapToTargetTransform(5__2[0], takeyScrapEaterBehaviour.mouthTransform, takeyScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.suckDuration); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.eatSFX)); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 6; return true; case 6: <>1__state = -1; takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.DinkDonkSpecialLine3SFX); <>2__current = (object)new WaitForSeconds(1.2f); <>1__state = 7; return true; case 7: <>1__state = -1; takeyScrapEaterBehaviour.MoveTargetScrapToTargetTransform(5__2[1], takeyScrapEaterBehaviour.mouthTransform, takeyScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.suckDuration); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.eatSFX)); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 10; return true; case 10: <>1__state = -1; takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.DinkDonkSpecialLine4SFX); <>2__current = (object)new WaitForSeconds(2.1f); <>1__state = 11; return true; case 11: <>1__state = -1; takeyScrapEaterBehaviour.MoveTargetScrapToTargetTransform(5__2[2], takeyScrapEaterBehaviour.mouthTransform, takeyScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.suckDuration); <>1__state = 12; return true; case 12: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.eatSFX)); <>1__state = 13; return true; case 13: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__55 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyScrapEaterBehaviour <>4__this; public float duration; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__55(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeyScrapEaterBehaviour takeyScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; takeyScrapEaterBehaviour.jetpackObject.SetActive(true); takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.takeOffSFX); takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.soundEffectsAudioFar, takeyScrapEaterBehaviour.takeOffSFXFar); takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.jetpackAudio, takeyScrapEaterBehaviour.jetpackThrustStartSFX); takeyScrapEaterBehaviour.jetpackBeepAudio.Play(); <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; takeyScrapEaterBehaviour.flameEffectsObject.SetActive(true); takeyScrapEaterBehaviour.jetpackThrustAudio.Play(); takeyScrapEaterBehaviour._flySpeed = takeyScrapEaterBehaviour.startFlySpeed; 5__2 = 0f; break; case 2: <>1__state = -1; 5__2 += Time.deltaTime; break; } if (5__2 < duration) { if (5__2 >= 0.3f && !takeyScrapEaterBehaviour.smokeTrailParticleSystem.isPlaying) { takeyScrapEaterBehaviour.smokeTrailParticleSystem.Play(); } takeyScrapEaterBehaviour._flySpeed += takeyScrapEaterBehaviour.flySpeedMultiplier * Time.deltaTime; if (takeyScrapEaterBehaviour._flySpeed > takeyScrapEaterBehaviour.maxFlySpeed) { takeyScrapEaterBehaviour._flySpeed = takeyScrapEaterBehaviour.maxFlySpeed; } Vector3 localPosition = ((Component)takeyScrapEaterBehaviour).transform.localPosition; localPosition.y += takeyScrapEaterBehaviour._flySpeed * Time.deltaTime; ((Component)takeyScrapEaterBehaviour).transform.localPosition = localPosition; <>2__current = null; <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__52 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyScrapEaterBehaviour <>4__this; private HangarShipDoor 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__52(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Expected O, but got Unknown //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Expected O, but got Unknown //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Expected O, but got Unknown //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Expected O, but got Unknown //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Expected O, but got Unknown //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Expected O, but got Unknown //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeyScrapEaterBehaviour takeyScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = Object.FindFirstObjectByType(); if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.Gazmi) && (Object)(object)5__2 != (Object)null) { 5__2.PlayDoorAnimation(false); 5__2.SetDoorButtonsEnabled(false); } if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.ChickenDance)) { takeyScrapEaterBehaviour.ChickenAnimator.SetBool("Animate", false); } if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk)) { takeyScrapEaterBehaviour.DinkDonkAnimator.SetBool("Animate", true); takeyScrapEaterBehaviour.DinkDonkAudio.Play(); takeyScrapEaterBehaviour.TriggerTakeyPlushDinkDonkScrapEaterSpawnedEvent(); } if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.Feels)) { takeyScrapEaterBehaviour.FeelsAnimator.SetBool("Animate", true); } if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.LUBBERS)) { takeyScrapEaterBehaviour.LUBBERSAnimator.SetBool("Animate", true); } <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.MoveToPosition(takeyScrapEaterBehaviour.spawnPosition, takeyScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.landSFX, takeyScrapEaterBehaviour.landIndex); takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.takeySitSFX); if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk)) { takeyScrapEaterBehaviour.DinkDonkAnimator.SetBool("Animate", false); takeyScrapEaterBehaviour.DinkDonkAudio.Stop(); takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.DinkDonkDropSFX); } takeyScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; takeyScrapEaterBehaviour.PlayAudioSource(takeyScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.MoveToPosition(takeyScrapEaterBehaviour.startPosition, takeyScrapEaterBehaviour.endPosition, takeyScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; takeyScrapEaterBehaviour.StopAudioSource(takeyScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 4; return true; case 4: <>1__state = -1; if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.ChickenDance)) { takeyScrapEaterBehaviour.ChickenAnimator.SetBool("Animate", true); takeyScrapEaterBehaviour.ChickenAudio.Play(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 5; return true; } goto IL_02a3; case 5: <>1__state = -1; goto IL_02a3; case 6: <>1__state = -1; if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk)) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 7; return true; } goto IL_031a; case 7: <>1__state = -1; takeyScrapEaterBehaviour.DinkDonkAnimator.SetBool("Animate", true); takeyScrapEaterBehaviour.DinkDonkAudio.Play(); goto IL_031a; case 8: <>1__state = -1; 5__3 = false; if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.ChickenDance)) { 5__3 = true; <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.MoveTargetScrapToTargetTransformDelayed(takeyScrapEaterBehaviour.mouthTransform, takeyScrapEaterBehaviour.suckDuration - 0.1f, 15f)); <>1__state = 9; return true; } goto IL_03dd; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.suckDuration); <>1__state = 10; return true; case 10: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.eatSFX)); <>1__state = 11; return true; case 11: <>1__state = -1; goto IL_03dd; case 12: <>1__state = -1; goto IL_0441; case 13: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.eatSFX)); <>1__state = 14; return true; case 14: <>1__state = -1; goto IL_04b0; case 15: <>1__state = -1; goto IL_04f6; case 16: <>1__state = -1; if (takeyScrapEaterBehaviour._voiceLineIndex == 2 && PlayerUtils.IsLocalPlayerPsychoHypnotic()) { HUDManager.Instance.DisplayTip("SellMyScrap", "This is NOT a reference to The Wolf of Wall Street", false, false, "LC_Tip1"); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 17; return true; case 17: <>1__state = -1; goto IL_0585; case 18: <>1__state = -1; goto IL_05cb; case 19: <>1__state = -1; takeyScrapEaterBehaviour.StopAudioSource(takeyScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 20; return true; case 20: <>1__state = -1; if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk)) { takeyScrapEaterBehaviour.DinkDonkAnimator.SetBool("Animate", true); takeyScrapEaterBehaviour.DinkDonkAudio.Play(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 21; return true; } goto IL_067f; case 21: <>1__state = -1; goto IL_067f; case 22: { <>1__state = -1; takeyScrapEaterBehaviour.EndSmokeTrail(); if (takeyScrapEaterBehaviour._explode) { Utils.CreateExplosion(((Component)takeyScrapEaterBehaviour).transform.position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3); } takeyScrapEaterBehaviour.flameEffectsObject.SetActive(false); takeyScrapEaterBehaviour.jetpackObject.SetActive(false); return false; } IL_04b0: if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk)) { takeyScrapEaterBehaviour.DinkDonkAnimator.SetBool("Animate", false); takeyScrapEaterBehaviour.DinkDonkAudio.Stop(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 15; return true; } goto IL_04f6; IL_04f6: if (!(takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk) & 5__3)) { <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.voiceLineSFX, takeyScrapEaterBehaviour._voiceLineIndex)); <>1__state = 16; return true; } goto IL_0585; IL_067f: if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.Gazmi) && (Object)(object)5__2 != (Object)null) { 5__2.SetDoorButtonsEnabled(true); } <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.JetpackFly(6f)); <>1__state = 22; return true; IL_0585: if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.ChickenDance)) { takeyScrapEaterBehaviour.ChickenAnimator.SetBool("Animate", false); takeyScrapEaterBehaviour.ChickenAudio.Stop(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 18; return true; } goto IL_05cb; IL_05cb: takeyScrapEaterBehaviour.PlayAudioSource(takeyScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.MoveToPosition(takeyScrapEaterBehaviour.endPosition, takeyScrapEaterBehaviour.startPosition, takeyScrapEaterBehaviour.movementDuration)); <>1__state = 19; return true; IL_03dd: if (takeyScrapEaterBehaviour.IsVariantType(TakeyVariantType.DinkDonk) && takeyScrapEaterBehaviour.targetScrap.Sum((GrabbableObject x) => x.scrapValue) >= 1000) { 5__3 = true; <>2__current = ((MonoBehaviour)takeyScrapEaterBehaviour).StartCoroutine(takeyScrapEaterBehaviour.DinkDonkSpecialSuckAnimation()); <>1__state = 12; return true; } goto IL_0441; IL_031a: <>2__current = (object)new WaitForSeconds(1f); <>1__state = 8; return true; IL_0441: if (!5__3) { takeyScrapEaterBehaviour.MoveTargetScrapToTargetTransform(takeyScrapEaterBehaviour.mouthTransform, takeyScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.suckDuration); <>1__state = 13; return true; } goto IL_04b0; IL_02a3: <>2__current = (object)new WaitForSeconds(takeyScrapEaterBehaviour.PlayOneShotSFX(takeyScrapEaterBehaviour.beforeEatSFX, takeyScrapEaterBehaviour._beforeEatIndex)); <>1__state = 6; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Takey")] [Space(5f)] public AudioSource soundEffectsAudioFar; public AudioClip takeOffSFXFar; public AudioClip takeySitSFX; public AudioClip[] beforeEatSFX = Array.Empty(); public AudioClip[] voiceLineSFX = Array.Empty(); public TakeyVariant[] Variants = Array.Empty(); [Space(10f)] [Header("Jetpack")] [Space(5f)] public GameObject jetpackObject; public GameObject flameEffectsObject; public ParticleSystem smokeTrailParticleSystem; public AudioSource jetpackAudio; public AudioSource jetpackThrustAudio; public AudioSource jetpackBeepAudio; public AudioClip jetpackThrustStartSFX; public float startFlySpeed = 0.5f; public float maxFlySpeed = 100f; public float flySpeedMultiplier = 5f; [Space(10f)] [Header("Gamble Variant")] [Space(5f)] public MeshFilter CardMeshFilter; public Mesh[] CardMeshes = Array.Empty(); [Space(10f)] [Header("Peepo Chicken Variant")] [Space(5f)] public Animator ChickenAnimator; public AudioSource ChickenAudio; [Space(10f)] [Header("Donk Dink Variant")] [Space(5f)] public Animator DinkDonkAnimator; public AudioSource DinkDonkAudio; public AudioClip DinkDonkDropSFX; public AudioClip DinkDonkSpecialLine1SFX; public AudioClip DinkDonkSpecialLine2SFX; public AudioClip DinkDonkSpecialLine3SFX; public AudioClip DinkDonkSpecialLine4SFX; [Space(10f)] [Header("Feels Variant")] [Space(5f)] public Animator FeelsAnimator; [Space(10f)] [Header("LUBBERS Variant")] [Space(5f)] public Animator LUBBERSAnimator; [Space(10f)] [Header("Party Hat")] [Space(5f)] public GameObject[] PartyHatObjects = Array.Empty(); public Material[] PartyHatMaterials = Array.Empty(); [Space(10f)] [Header("Cake Variant")] [Space(5f)] public MeshRenderer CakeMeshRenderer; public Material[] CakeMaterials = Array.Empty(); private float _flySpeed; private int _variantIndex; private int _cardMeshIndex; private bool _explode; private int _beforeEatIndex; private int _voiceLineIndex; private int _partyHatMaterialIndex; private int _cakeMaterialIndex; protected override void Start() { flameEffectsObject.SetActive(false); jetpackObject.SetActive(false); if (NetworkUtils.IsServer) { _variantIndex = GetRandomVariantIndex(); _cardMeshIndex = Random.Range(0, CardMeshes.Length); _partyHatMaterialIndex = Random.Range(0, PartyHatMaterials.Length); _cakeMaterialIndex = Random.Range(0, CakeMaterials.Length); UpdateVariantOnLocalClient(); _explode = Utils.RollPercentChance(50f); _voiceLineIndex = Random.Range(0, voiceLineSFX.Length); _beforeEatIndex = Random.Range(0, beforeEatSFX.Length); SetDataClientRpc(_variantIndex, _cardMeshIndex, _explode, _voiceLineIndex, _beforeEatIndex, _partyHatMaterialIndex, _cakeMaterialIndex); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int variantIndex, int cardMeshIndex, bool explode, int voiceLineIndex, int beforeEatIndex, int partyHatMaterialIndex, int cakeMaterialIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(520362367u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); BytePacker.WriteValueBitPacked(val2, cardMeshIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref explode, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, voiceLineIndex); BytePacker.WriteValueBitPacked(val2, beforeEatIndex); BytePacker.WriteValueBitPacked(val2, partyHatMaterialIndex); BytePacker.WriteValueBitPacked(val2, cakeMaterialIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 520362367u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsServer) { _variantIndex = variantIndex; _cardMeshIndex = cardMeshIndex; _explode = explode; _voiceLineIndex = voiceLineIndex; _beforeEatIndex = beforeEatIndex; _partyHatMaterialIndex = partyHatMaterialIndex; _cakeMaterialIndex = cakeMaterialIndex; UpdateVariantOnLocalClient(); } } } private int GetRandomVariantIndex() { if (TargetVariantIndex > -1) { return Mathf.Clamp(TargetVariantIndex, 0, Variants.Length - 1); } return Utils.GetRandomIndexFromWeightList(Variants.Select((TakeyVariant x) => x.Weight).ToList()); } private void UpdateVariantOnLocalClient() { for (int i = 0; i < Variants.Length; i++) { Variants[i].ModelObject.SetActive(i == _variantIndex); } TakeyVariant variant = GetVariant(); if ((Object)(object)variant.MouthTransform != (Object)null) { mouthTransform = variant.MouthTransform; } if (variant.BeforeEatSFX.Length != 0) { beforeEatSFX = variant.BeforeEatSFX; } if (IsVariantType(TakeyVariantType.Gamble)) { CardMeshFilter.mesh = CardMeshes[_cardMeshIndex]; } if (IsVariantType(TakeyVariantType.ChickenDance)) { ChickenAnimator.SetBool("Animate", false); } if (IsVariantType(TakeyVariantType.Gift, TakeyVariantType.Cake)) { SetPartyHatMaterials(); } if (IsVariantType(TakeyVariantType.Cake)) { SetCakeMaterial(); } } private TakeyVariant GetVariant() { return Variants[_variantIndex]; } private TakeyVariantType GetVariantType() { return GetVariant().Type; } public bool IsVariantType(TakeyVariantType type) { return GetVariantType() == type; } public bool IsVariantType(params TakeyVariantType[] types) { foreach (TakeyVariantType type in types) { if (IsVariantType(type)) { return true; } } return false; } public int GetVariantIndex(TakeyVariantType type) { for (int i = 0; i < Variants.Length; i++) { if (Variants[i].Type == type) { return i; } } return Random.Range(0, Variants.Length); } private void SetPartyHatMaterials() { if (_partyHatMaterialIndex < 0 || _partyHatMaterialIndex > PartyHatMaterials.Length - 1) { return; } Material val = PartyHatMaterials[_partyHatMaterialIndex]; if ((Object)(object)val == (Object)null) { return; } GameObject[] partyHatObjects = PartyHatObjects; foreach (GameObject val2 in partyHatObjects) { MeshRenderer[] componentsInChildren = val2.GetComponentsInChildren(); foreach (MeshRenderer val3 in componentsInChildren) { ((Renderer)val3).sharedMaterial = val; } } } private void SetCakeMaterial() { if (_cakeMaterialIndex >= 0 && _cakeMaterialIndex <= CakeMaterials.Length - 1) { Material val = CakeMaterials[_cakeMaterialIndex]; if (!((Object)(object)val == (Object)null)) { ((Renderer)CakeMeshRenderer).sharedMaterial = val; } } } [IteratorStateMachine(typeof(d__52))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__52(0) { <>4__this = this }; } private void TriggerTakeyPlushDinkDonkScrapEaterSpawnedEvent() { if (IsVariantType(TakeyVariantType.DinkDonk) && TakeyPlushProxy.Enabled) { TakeyPlushProxy.TriggerDinkDonkScrapEaterSpawnedEvent(); } } [IteratorStateMachine(typeof(d__54))] private IEnumerator DinkDonkSpecialSuckAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__54(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__55))] private IEnumerator JetpackFly(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__55(0) { <>4__this = this, duration = duration }; } private void EndSmokeTrail() { smokeTrailParticleSystem.Stop(); ((Component)smokeTrailParticleSystem).transform.SetParent((Transform)null); ((Component)smokeTrailParticleSystem).gameObject.AddComponent().duration = 10f; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_TakeyScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(520362367u, new RpcReceiveHandler(__rpc_handler_520362367)); } private static void __rpc_handler_520362367(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: 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_0058: 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_0072: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndex); int cardMeshIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cardMeshIndex); bool explode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref explode, default(ForPrimitives)); int voiceLineIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref voiceLineIndex); int beforeEatIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref beforeEatIndex); int partyHatMaterialIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref partyHatMaterialIndex); int cakeMaterialIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cakeMaterialIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((TakeyScrapEaterBehaviour)(object)target).SetDataClientRpc(variantIndex, cardMeshIndex, explode, voiceLineIndex, beforeEatIndex, partyHatMaterialIndex, cakeMaterialIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TakeyScrapEaterBehaviour"; } } [Serializable] public class TakeyVariant { public TakeyVariantType Type; [Range(0f, 500f)] public int Weight = 25; public GameObject ModelObject; public Transform MouthTransform; public AudioClip[] BeforeEatSFX = Array.Empty(); } public class WolfyScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public WolfyScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0059: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; WolfyScrapEaterBehaviour wolfyScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = ((MonoBehaviour)wolfyScrapEaterBehaviour).StartCoroutine(wolfyScrapEaterBehaviour.MoveToPosition(wolfyScrapEaterBehaviour.spawnPosition, wolfyScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; wolfyScrapEaterBehaviour.PlayOneShotSFX(wolfyScrapEaterBehaviour.landSFX, wolfyScrapEaterBehaviour.landIndex); wolfyScrapEaterBehaviour.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; wolfyScrapEaterBehaviour.PlayAudioSource(wolfyScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)wolfyScrapEaterBehaviour).StartCoroutine(wolfyScrapEaterBehaviour.MoveToPosition(wolfyScrapEaterBehaviour.startPosition, wolfyScrapEaterBehaviour.endPosition, wolfyScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; wolfyScrapEaterBehaviour.StopAudioSource(wolfyScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.pauseDuration); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.PlayOneShotSFX(wolfyScrapEaterBehaviour.BeforeEatSFX, wolfyScrapEaterBehaviour._beforeEatIndex)); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.pauseDuration); <>1__state = 6; return true; case 6: <>1__state = -1; wolfyScrapEaterBehaviour.MoveTargetScrapToTargetTransform(wolfyScrapEaterBehaviour.mouthTransform, wolfyScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.suckDuration); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.PlayOneShotSFX(wolfyScrapEaterBehaviour.eatSFX)); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.PlayOneShotSFX(wolfyScrapEaterBehaviour.AfterEatSFX, wolfyScrapEaterBehaviour._afterEatIndex)); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(wolfyScrapEaterBehaviour.pauseDuration); <>1__state = 10; return true; case 10: <>1__state = -1; wolfyScrapEaterBehaviour.PlayAudioSource(wolfyScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)wolfyScrapEaterBehaviour).StartCoroutine(wolfyScrapEaterBehaviour.MoveToPosition(wolfyScrapEaterBehaviour.endPosition, wolfyScrapEaterBehaviour.startPosition, wolfyScrapEaterBehaviour.movementDuration)); <>1__state = 11; return true; case 11: <>1__state = -1; wolfyScrapEaterBehaviour.StopAudioSource(wolfyScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; case 12: <>1__state = -1; wolfyScrapEaterBehaviour.PlayOneShotSFX(wolfyScrapEaterBehaviour.takeOffSFX); <>2__current = ((MonoBehaviour)wolfyScrapEaterBehaviour).StartCoroutine(wolfyScrapEaterBehaviour.MoveToPosition(wolfyScrapEaterBehaviour.startPosition, wolfyScrapEaterBehaviour.spawnPosition, 2f)); <>1__state = 13; return true; case 13: <>1__state = -1; 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(); } } [Space(20f)] [Header("Wolfy")] [Space(5f)] public AudioClip[] BeforeEatSFX = Array.Empty(); public AudioClip[] AfterEatSFX = Array.Empty(); private int _beforeEatIndex; private int _afterEatIndex; protected override void Start() { if (NetworkUtils.IsServer) { _beforeEatIndex = Random.Range(0, BeforeEatSFX.Length); _afterEatIndex = Random.Range(0, AfterEatSFX.Length); SetDataClientRpc(_beforeEatIndex, _afterEatIndex); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int beforeEatIndex, int afterEatIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(81049637u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, beforeEatIndex); BytePacker.WriteValueBitPacked(val2, afterEatIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 81049637u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _beforeEatIndex = beforeEatIndex; _afterEatIndex = afterEatIndex; } } } [IteratorStateMachine(typeof(d__6))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { <>4__this = this }; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_WolfyScrapEaterBehaviour() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(81049637u, new RpcReceiveHandler(__rpc_handler_81049637)); } private static void __rpc_handler_81049637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int beforeEatIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref beforeEatIndex); int afterEatIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref afterEatIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((WolfyScrapEaterBehaviour)(object)target).SetDataClientRpc(beforeEatIndex, afterEatIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WolfyScrapEaterBehaviour"; } } public class YippeeScrapEaterBehaviour : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public YippeeScrapEaterBehaviour <>4__this; public float duration; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; YippeeScrapEaterBehaviour yippeeScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; yippeeScrapEaterBehaviour._flySpeed = yippeeScrapEaterBehaviour.startFlySpeed; 5__2 = 0f; break; case 1: <>1__state = -1; 5__2 += Time.deltaTime; break; } if (5__2 < duration) { yippeeScrapEaterBehaviour._flySpeed += yippeeScrapEaterBehaviour.flySpeedMultiplier * Time.deltaTime; if (yippeeScrapEaterBehaviour._flySpeed > yippeeScrapEaterBehaviour.maxFlySpeed) { yippeeScrapEaterBehaviour._flySpeed = yippeeScrapEaterBehaviour.maxFlySpeed; } Vector3 localPosition = ((Component)yippeeScrapEaterBehaviour).transform.localPosition; localPosition.y += yippeeScrapEaterBehaviour._flySpeed * Time.deltaTime; ((Component)yippeeScrapEaterBehaviour).transform.localPosition = localPosition; <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public YippeeScrapEaterBehaviour <>4__this; public Vector3 from; public Vector3 to; public float duration; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: 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) int num = <>1__state; YippeeScrapEaterBehaviour yippeeScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.SetAnimationVelocityX(isStarting: true, 0.15f, 0.8f)); <>2__current = ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.MoveToPosition(from, to, duration)); <>1__state = 1; return true; case 1: <>1__state = -1; ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.SetAnimationVelocityX(isStarting: false, 0.15f, 0.8f)); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool isStarting; public YippeeScrapEaterBehaviour <>4__this; public float speedMultiplier; public float duration; private float 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; YippeeScrapEaterBehaviour yippeeScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = (isStarting ? 0f : 1f); 5__3 = (isStarting ? 1f : 0f); yippeeScrapEaterBehaviour.animator.SetFloat("WalkingSpeedMultiplier", speedMultiplier); yippeeScrapEaterBehaviour.animator.SetFloat("VelocityX", 5__2); 5__4 = 0f; break; case 1: <>1__state = -1; 5__4 += Time.deltaTime; break; } if (5__4 < duration) { float num2 = 1f / duration * 5__4; float num3 = 5__2 + (5__3 - 5__2) * num2; yippeeScrapEaterBehaviour.animator.SetFloat("VelocityX", num3); <>2__current = null; <>1__state = 1; return true; } yippeeScrapEaterBehaviour.animator.SetFloat("VelocityX", 5__3); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public YippeeScrapEaterBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_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) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown int num = <>1__state; YippeeScrapEaterBehaviour yippeeScrapEaterBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; yippeeScrapEaterBehaviour.SetAnimationFlying(enabled: true); <>2__current = ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.MoveToPosition(yippeeScrapEaterBehaviour.spawnPosition, yippeeScrapEaterBehaviour.startPosition, 2f)); <>1__state = 1; return true; case 1: <>1__state = -1; yippeeScrapEaterBehaviour.SetAnimationFlying(enabled: false); yippeeScrapEaterBehaviour.PlayOneShotSFX(yippeeScrapEaterBehaviour.landSFX, yippeeScrapEaterBehaviour.landIndex); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; yippeeScrapEaterBehaviour.PlayAudioSource(yippeeScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.MoveToPositionWithEffects(yippeeScrapEaterBehaviour.startPosition, yippeeScrapEaterBehaviour.endPosition, yippeeScrapEaterBehaviour.movementDuration)); <>1__state = 3; return true; case 3: <>1__state = -1; yippeeScrapEaterBehaviour.StopAudioSource(yippeeScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(yippeeScrapEaterBehaviour.pauseDuration); <>1__state = 4; return true; case 4: <>1__state = -1; yippeeScrapEaterBehaviour.MoveTargetScrapToTargetTransform(yippeeScrapEaterBehaviour.mouthTransform, yippeeScrapEaterBehaviour.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(yippeeScrapEaterBehaviour.suckDuration); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(yippeeScrapEaterBehaviour.PlayOneShotSFX(yippeeScrapEaterBehaviour.eatSFX)); <>1__state = 6; return true; case 6: <>1__state = -1; yippeeScrapEaterBehaviour.PlayOneShotSFX(yippeeScrapEaterBehaviour.voiceAudio, yippeeScrapEaterBehaviour.afterEatSFX); <>2__current = (object)new WaitForSeconds(yippeeScrapEaterBehaviour.pauseDuration); <>1__state = 7; return true; case 7: <>1__state = -1; yippeeScrapEaterBehaviour.PlayAudioSource(yippeeScrapEaterBehaviour.movementAudio); <>2__current = ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.MoveToPositionWithEffects(yippeeScrapEaterBehaviour.endPosition, yippeeScrapEaterBehaviour.startPosition, yippeeScrapEaterBehaviour.movementDuration)); <>1__state = 8; return true; case 8: <>1__state = -1; yippeeScrapEaterBehaviour.StopAudioSource(yippeeScrapEaterBehaviour.movementAudio); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 9; return true; case 9: <>1__state = -1; yippeeScrapEaterBehaviour.PlayOneShotSFX(yippeeScrapEaterBehaviour.takeOffSFX); yippeeScrapEaterBehaviour.SetAnimationFlying(enabled: true); <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 10; return true; case 10: <>1__state = -1; <>2__current = ((MonoBehaviour)yippeeScrapEaterBehaviour).StartCoroutine(yippeeScrapEaterBehaviour.FlyAway(6f)); <>1__state = 11; return true; case 11: <>1__state = -1; 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(); } } [Space(20f)] [Header("Yippee")] [Space(5f)] public Animator animator; public AudioSource voiceAudio; public AudioSource flyAudio; public AudioClip afterEatSFX; public float startFlySpeed = 1f; public float maxFlySpeed = 100f; public float flySpeedMultiplier = 10f; private float _flySpeed; [IteratorStateMachine(typeof(d__8))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this }; } private void SetAnimationFlying(bool enabled) { animator.SetBool("Chase", enabled); if (enabled) { flyAudio.Play(); } else { flyAudio.Stop(); } } [IteratorStateMachine(typeof(d__10))] private IEnumerator MoveToPositionWithEffects(Vector3 from, Vector3 to, float duration) { //IL_000e: 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_0015: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, from = from, to = to, duration = duration }; } [IteratorStateMachine(typeof(d__11))] private IEnumerator SetAnimationVelocityX(bool isStarting, float duration = 0.15f, float speedMultiplier = 1f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this, isStarting = isStarting, duration = duration, speedMultiplier = speedMultiplier }; } [IteratorStateMachine(typeof(d__12))] private IEnumerator FlyAway(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, duration = duration }; } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "YippeeScrapEaterBehaviour"; } } public enum ZombiesVariantType { Happy, Scared, Angry, Drunk, Heart, Dead, Panda, Clown, Sunburnt, Party } public class ZombiesScrapEater : ScrapEaterExtraBehaviour { [CompilerGenerated] private sealed class d__25 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ZombiesScrapEater <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00cd: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ZombiesScrapEater zombiesScrapEater = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; Vector3 from = default(Vector3); ((Vector3)(ref from))..ctor(zombiesScrapEater.endPosition.x, zombiesScrapEater.spawnPosition.y, zombiesScrapEater.endPosition.z); <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.MoveToPosition(from, zombiesScrapEater.endPosition, 2f)); <>1__state = 1; return true; } case 1: <>1__state = -1; zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.landSFX, zombiesScrapEater.landIndex); zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.FallDamageSFX); zombiesScrapEater.ShakeCamera(); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.DieSFX); zombiesScrapEater.PlayDeathAnimation(); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 3; return true; case 3: <>1__state = -1; ((Component)zombiesScrapEater).transform.position = zombiesScrapEater.spawnPosition; zombiesScrapEater.ShowModel(); zombiesScrapEater.PlayIdleAnimation(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ZombiesScrapEater <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ZombiesScrapEater zombiesScrapEater = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (zombiesScrapEater._playDieAnimation) { <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.PlayZombieDeathAnimationCoroutine()); <>1__state = 1; return true; } goto IL_0087; case 1: <>1__state = -1; goto IL_0087; case 2: <>1__state = -1; zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.landSFX, zombiesScrapEater.landIndex); zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.FallDamageSFX); zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.HurtSFX, zombiesScrapEater._hurtSFXIndex); zombiesScrapEater.ShakeCamera(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; case 3: <>1__state = -1; zombiesScrapEater.StartWalkAudio(); <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.MoveToPosition(zombiesScrapEater.startPosition, zombiesScrapEater.endPosition, zombiesScrapEater.movementDuration)); <>1__state = 4; return true; case 4: <>1__state = -1; zombiesScrapEater.StopWalkAudio(); <>2__current = (object)new WaitForSeconds(zombiesScrapEater.pauseDuration / 2f); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.BeforeEatSFX, zombiesScrapEater._beforeEatIndex)); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.pauseDuration / 2f); <>1__state = 7; return true; case 7: <>1__state = -1; zombiesScrapEater.MoveTargetScrapToTargetTransform(zombiesScrapEater.mouthTransform, zombiesScrapEater.suckDuration - 0.1f); <>2__current = (object)new WaitForSeconds(zombiesScrapEater.suckDuration); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.eatSFX)); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.pauseDuration / 2f); <>1__state = 10; return true; case 10: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.VoiceLineSFX, zombiesScrapEater._voiceLineIndex)); <>1__state = 11; return true; case 11: <>1__state = -1; <>2__current = (object)new WaitForSeconds(zombiesScrapEater.pauseDuration / 2f); <>1__state = 12; return true; case 12: <>1__state = -1; zombiesScrapEater.StartWalkAudio(); <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.MoveToPosition(zombiesScrapEater.endPosition, zombiesScrapEater.startPosition, zombiesScrapEater.movementDuration)); <>1__state = 13; return true; case 13: <>1__state = -1; zombiesScrapEater.StopWalkAudio(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 14; return true; case 14: <>1__state = -1; zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.takeOffSFX); <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.MoveToPosition(zombiesScrapEater.startPosition, zombiesScrapEater.spawnPosition, 2f)); <>1__state = 15; return true; case 15: { <>1__state = -1; return false; } IL_0087: <>2__current = ((MonoBehaviour)zombiesScrapEater).StartCoroutine(zombiesScrapEater.MoveToPosition(zombiesScrapEater.spawnPosition, zombiesScrapEater.startPosition, 2f)); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__26 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ZombiesScrapEater <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown int num = <>1__state; ZombiesScrapEater zombiesScrapEater = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } zombiesScrapEater.PlayOneShotSFX(zombiesScrapEater.movementAudio, zombiesScrapEater.StepSFX[Random.Range(0, zombiesScrapEater.StepSFX.Length)]); <>2__current = (object)new WaitForSeconds(zombiesScrapEater.InbetweenStepDuration); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Zombies")] [Space(5f)] public AudioClip[] BeforeEatSFX = Array.Empty(); public AudioClip[] VoiceLineSFX = Array.Empty(); public ZombiesVariant[] Variants = Array.Empty(); public Animator Animator; public AudioClip FallDamageSFX; public AudioClip DieSFX; public AudioClip[] HurtSFX = Array.Empty(); public AudioClip[] StepSFX = Array.Empty(); public float InbetweenStepDuration = 0.5f; private int _variantIndex; private int _beforeEatIndex; private int _voiceLineIndex; private int _hurtSFXIndex; private bool _playDieAnimation; private Coroutine _walkAudioCoroutine; protected override void Start() { if (NetworkUtils.IsServer) { _variantIndex = GetRandomVariantIndex(); UpdateVariantOnLocalClient(); _beforeEatIndex = Random.Range(0, BeforeEatSFX.Length); _voiceLineIndex = Random.Range(0, VoiceLineSFX.Length); _hurtSFXIndex = Random.Range(0, HurtSFX.Length); _playDieAnimation = Utils.RollPercentChance(90f); SetDataClientRpc(_variantIndex, _beforeEatIndex, _voiceLineIndex, _hurtSFXIndex, _playDieAnimation); } base.Start(); } [ClientRpc] private void SetDataClientRpc(int variantIndex, int beforeEatIndex, int voiceLineIndex, int hurtSFXIndex, bool playDieAnimation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1044317251u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); BytePacker.WriteValueBitPacked(val2, beforeEatIndex); BytePacker.WriteValueBitPacked(val2, voiceLineIndex); BytePacker.WriteValueBitPacked(val2, hurtSFXIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playDieAnimation, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1044317251u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsServer) { _variantIndex = variantIndex; _beforeEatIndex = beforeEatIndex; _voiceLineIndex = voiceLineIndex; _hurtSFXIndex = hurtSFXIndex; _playDieAnimation = playDieAnimation; UpdateVariantOnLocalClient(); } } } private int GetRandomVariantIndex() { if (TargetVariantIndex > -1) { return Mathf.Clamp(TargetVariantIndex, 0, Variants.Length - 1); } return Utils.GetRandomIndexFromWeightList(Variants.Select((ZombiesVariant x) => x.Weight).ToList()); } private void UpdateVariantOnLocalClient() { for (int i = 0; i < Variants.Length; i++) { Variants[i].ModelObject.SetActive(i == _variantIndex); } ZombiesVariant variant = GetVariant(); if ((Object)(object)variant.MouthTransform != (Object)null) { mouthTransform = variant.MouthTransform; } if (variant.VoiceLineSFX.Length != 0) { VoiceLineSFX = variant.VoiceLineSFX; } } private ZombiesVariant GetVariant() { return Variants[_variantIndex]; } private ZombiesVariantType GetVariantType() { return GetVariant().Type; } public bool IsVariantType(ZombiesVariantType type) { return GetVariantType() == type; } public bool IsVariantType(params ZombiesVariantType[] types) { foreach (ZombiesVariantType type in types) { if (IsVariantType(type)) { return true; } } return false; } public int GetVariantIndex(ZombiesVariantType type) { for (int i = 0; i < Variants.Length; i++) { if (Variants[i].Type == type) { return i; } } return Random.Range(0, Variants.Length); } [IteratorStateMachine(typeof(d__24))] protected override IEnumerator StartAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__25))] private IEnumerator PlayZombieDeathAnimationCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__25(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__26))] private IEnumerator WalkAudioCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__26(0) { <>4__this = this }; } private void StartWalkAudio() { StopWalkAudio(); _walkAudioCoroutine = ((MonoBehaviour)this).StartCoroutine(WalkAudioCoroutine()); } private void StopWalkAudio() { if (_walkAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_walkAudioCoroutine); } } private void PlayDeathAnimation() { Animator.Play("Die"); } private void PlayIdleAnimation() { Animator.Play("Idle"); } private void ShowModel() { modelObject.SetActive(true); } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ZombiesScrapEater() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1044317251u, new RpcReceiveHandler(__rpc_handler_1044317251)); } private static void __rpc_handler_1044317251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_003d: 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_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndex); int beforeEatIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref beforeEatIndex); int voiceLineIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref voiceLineIndex); int hurtSFXIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref hurtSFXIndex); bool playDieAnimation = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playDieAnimation, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((ZombiesScrapEater)(object)target).SetDataClientRpc(variantIndex, beforeEatIndex, voiceLineIndex, hurtSFXIndex, playDieAnimation); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ZombiesScrapEater"; } } [Serializable] public class ZombiesVariant { public ZombiesVariantType Type; [Range(0f, 500f)] public int Weight = 25; public GameObject ModelObject; public Transform MouthTransform; public AudioClip[] VoiceLineSFX = Array.Empty(); } } namespace com.github.zehsteam.SellMyScrap.Managers { internal static class SellManager { [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private int 5__2; private int 5__3; private List 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (ScrapToSell == null || SellRequest == null) { <>2__current = null; <>1__state = 1; return true; } goto IL_004f; case 1: <>1__state = -1; goto IL_004f; case 2: <>1__state = -1; goto IL_0073; case 3: <>1__state = -1; if (ShipInventoryProxy.SpawnItemsStatus == SpawnItemsStatus.Success) { 5__4.AddRange(ShipInventoryProxy.GetSpawnedGrabbableObjects()); ShipInventoryProxy.ClearSpawnedGrabbableObjectsCache(); } else if (ShipInventoryProxy.SpawnItemsStatus == SpawnItemsStatus.Failed) { ShipInventoryProxy.ClearSpawnedGrabbableObjectsCache(); HUDManager.Instance.DisplayTip("SellMyScrap", "Failed to spawn items from ShipInventory!", true, false, "LC_Tip1"); return false; } goto IL_0169; case 4: { <>1__state = -1; DepositItemsDeskHelper.SellItems_Server(); ScrapToSell = null; return false; } IL_004f: if (SellRequest.ConfirmationStatus != ConfirmationStatus.Confirmed) { <>2__current = null; <>1__state = 2; return true; } goto IL_0073; IL_0073: if ((Object)(object)DepositItemsDeskHelper.Instance == (Object)null) { Logger.LogError("Could not find depositItemsDesk. Are you landed at The Company building?"); return false; } 5__2 = SellRequest.ScrapEaterIndex; 5__3 = SellRequest.ScrapEaterVariantIndex; 5__4 = ScrapToSell.GrabbableObjects; if (ShipInventoryProxy.Enabled && ScrapToSell.ShipInventoryItems.Length != 0) { ShipInventoryProxy.SpawnItems_Server(ScrapToSell.ShipInventoryItems); <>2__current = (object)new WaitUntil((Func)(() => !ShipInventoryProxy.IsSpawning)); <>1__state = 3; return true; } goto IL_0169; IL_0169: if (5__4.Count == 0) { Logger.LogError("Something went wrong when selling! No items found."); HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("SellMyScrap", "Something went wrong! Not items found", true, false, "LC_Tip1"); } ScrapToSell = null; return false; } if (!StartOfRound.Instance.shipIsLeaving) { if (5__2 == -1) { ScrapEaterManager.StartRandomScrapEaterOnServer(5__4, 5__3); return false; } if (5__2 > -1 && ScrapEaterManager.HasScrapEater(5__2)) { ScrapEaterManager.StartScrapEaterOnServer(5__2, 5__4, 5__3); return false; } if (ScrapEaterManager.CanUseScrapEater()) { ScrapEaterManager.StartRandomScrapEaterOnServer(5__4, 5__3); return false; } } DepositItemsDeskHelper.PlaceItemsOnCounter(5__4); PluginNetworkBehaviour.Instance.PlaceItemsOnCounterClientRpc(NetworkUtils.GetNetworkObjectReferences(5__4)); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 4; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ScrapToSell ScrapToSell { get; private set; } public static SellRequest SellRequest { get; private set; } public static ScrapToSell GetScrapToSell(SellCommandRequest sellRequest) { ScrapToSell = ScrapHelper.GetScrapToSell(sellRequest); return ScrapToSell; } public static ScrapToSell GetScrapToSell(string[] sellList, bool onlyUseShipInventory = false) { ScrapToSell = ScrapHelper.GetScrapToSell(sellList); return ScrapToSell; } public static ScrapToSell SetScrapToSell(List items) { ScrapToSell = new ScrapToSell(items); return ScrapToSell; } public static void CreateSellRequest(SellType sellType, int value, int requestedValue, ConfirmationStatus confirmationType, int scrapEaterIndex = -2, int scrapEaterVariantIndex = -1) { SellRequest = new SellRequest(sellType, value, requestedValue, confirmationType, scrapEaterIndex, scrapEaterVariantIndex); string text = $"Created sell request. {ScrapToSell.ItemCount} items for ${value}."; if (scrapEaterIndex >= 0) { text += $" (ScrapEaterIndex: {scrapEaterIndex}, ScrapEaterVariantIndex: {scrapEaterVariantIndex})"; } Logger.LogInfo(text); } public static void ConfirmSellRequest() { if (ScrapToSell != null && SellRequest != null) { SellRequest.ConfirmationStatus = ConfirmationStatus.Confirmed; Logger.LogInfo($"Attempting to sell {ScrapToSell.ItemCount} items for ${ScrapToSell.TotalScrapValue}."); if (NetworkUtils.IsServer) { ConfirmSellRequestOnServer(); } else { ConfirmSellRequestOnClient(); } SellRequest = null; } } private static void ConfirmSellRequestOnServer() { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(PerformSellOnServer()); } private static void ConfirmSellRequestOnClient() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) PluginNetworkBehaviour.Instance.PerformSellServerRpc(ScrapToSell, SellRequest.SellType, SellRequest.ScrapEaterIndex); } public static void CancelSellRequest() { SellRequest = null; ScrapToSell = null; } public static void PerformSellOnServerFromClient(ScrapToSell scrapToSell, SellType sellType, int scrapEaterIndex = -2, int scrapEaterVariantIndex = -1) { ScrapToSell = scrapToSell; CreateSellRequest(sellType, ScrapToSell.TotalScrapValue, ScrapToSell.TotalScrapValue, ConfirmationStatus.AwaitingConfirmation, scrapEaterIndex, scrapEaterVariantIndex); ConfirmSellRequest(); } [IteratorStateMachine(typeof(d__17))] public static IEnumerator PerformSellOnServer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0); } } } namespace com.github.zehsteam.SellMyScrap.Helpers { public static class ConfigHelper { public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public static void AddButton(string section, string name, string description, string buttonText, Action callback) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton(section, name, description, buttonText, callback); } } public static ConfigEntry Bind(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } ConfigEntry configEntry = ((acceptableValues == null) ? configFile.Bind(section, key, defaultValue, description) : configFile.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty()))); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(configEntry, requiresRestart); } return configEntry; } public static SyncedConfigEntry BindSynced(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { SyncedConfigEntry syncedConfigEntry = new SyncedConfigEntry(section, key, defaultValue, description, acceptableValues, configFile); if (settingChanged != null) { syncedConfigEntry.SettingChanged += settingChanged; } return syncedConfigEntry; } public static Dictionary GetOrphanedConfigEntries(ConfigFile configFile = null) { if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); return (Dictionary)property.GetValue(configFile, null); } public static void SetConfigEntryValue(ConfigEntry configEntry, string value) { if (typeof(T) == typeof(int) && int.TryParse(value, out var result)) { configEntry.Value = (T)(object)result; return; } if (typeof(T) == typeof(float) && float.TryParse(value, out var result2)) { configEntry.Value = (T)(object)result2; return; } if (typeof(T) == typeof(double) && double.TryParse(value, out var result3)) { configEntry.Value = (T)(object)result3; return; } if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result4)) { configEntry.Value = (T)(object)result4; return; } if (typeof(T) == typeof(string)) { configEntry.Value = (T)(object)value; return; } throw new InvalidOperationException($"Unsupported type: {typeof(T)}"); } public static void SetConfigEntryValue(SyncedConfigEntry syncedConfigEntry, string value) { if (typeof(T) == typeof(int) && int.TryParse(value, out var result)) { syncedConfigEntry.Value = (T)(object)result; return; } if (typeof(T) == typeof(float) && float.TryParse(value, out var result2)) { syncedConfigEntry.Value = (T)(object)result2; return; } if (typeof(T) == typeof(double) && double.TryParse(value, out var result3)) { syncedConfigEntry.Value = (T)(object)result3; return; } if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result4)) { syncedConfigEntry.Value = (T)(object)result4; return; } if (typeof(T) == typeof(string)) { syncedConfigEntry.Value = (T)(object)value; return; } throw new InvalidOperationException($"Unsupported type: {typeof(T)}"); } public static void ClearUnusedEntries(ConfigFile configFile = null) { if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } Dictionary orphanedConfigEntries = GetOrphanedConfigEntries(configFile); if (orphanedConfigEntries != null) { orphanedConfigEntries.Clear(); configFile.Save(); } } } internal static class DepositItemsDeskHelper { public static DepositItemsDesk Instance { get; private set; } public static void SetInstance(DepositItemsDesk instance) { Instance = instance; } public static void SellItems_Server() { if (!((Object)(object)Instance == (Object)null)) { DepositItemsDeskPatch.SpeakInShip = true; Instance.SellItemsOnServer(); } } public static void PlaceItemsOnCounter(List grabbableObjects) { if (!((Object)(object)Instance == (Object)null)) { grabbableObjects.ForEach(PlaceItemOnCounter); } } public static void PlaceItemOnCounter(GrabbableObject grabbableObject) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && !((Object)(object)grabbableObject == (Object)null) && !Instance.itemsOnCounter.Contains(grabbableObject)) { Instance.itemsOnCounter.Add(grabbableObject); NetworkObject component = ((Component)grabbableObject).gameObject.GetComponent(); Instance.itemsOnCounterNetworkObjects.Add(component); grabbableObject.EnablePhysics(false); grabbableObject.EnableItemMeshes(false); ((Component)grabbableObject).transform.SetParent(((Component)Instance.deskObjectsContainer).transform); ((Component)grabbableObject).transform.localPosition = Vector3.zero; } } public static void PlaceRagdollOnCounter(RagdollGrabbableObject ragdollGrabbableObject) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && !((Object)(object)ragdollGrabbableObject == (Object)null) && !Instance.itemsOnCounter.Contains((GrabbableObject)(object)ragdollGrabbableObject)) { Instance.itemsOnCounter.Add((GrabbableObject)(object)ragdollGrabbableObject); NetworkObject component = ((Component)ragdollGrabbableObject).gameObject.GetComponent(); Instance.itemsOnCounterNetworkObjects.Add(component); ((GrabbableObject)ragdollGrabbableObject).EnablePhysics(false); ((GrabbableObject)ragdollGrabbableObject).EnableItemMeshes(false); Transform transform = ((Component)ragdollGrabbableObject.ragdoll).transform; MeshRenderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { ((Renderer)val).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)transform).GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } transform.SetParent(((Component)Instance.deskObjectsContainer).transform); transform.localPosition = Vector3.zero; } } } internal static class EnemyAIHelper { public static void HitEnemyOnLocalClient(EnemyAI enemyAI, int force = 1, Vector3 hitDirection = default(Vector3), PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemyAI == (Object)null) { Logger.LogError("EnemyAI instance is null!"); return; } MethodInfo method = typeof(EnemyAI).GetMethod("HitEnemyOnLocalClient", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { Logger.LogError("HitEnemyOnLocalClient method not found on EnemyAI!"); return; } ParameterInfo[] parameters = method.GetParameters(); object[] parameters2; if (parameters.Length == 5) { parameters2 = new object[5] { force, hitDirection, playerWhoHit, playHitSFX, hitID }; } else { if (parameters.Length != 4) { Debug.LogError((object)"Unexpected HitEnemyOnLocalClient method signature!"); return; } parameters2 = new object[4] { force, hitDirection, playerWhoHit, playHitSFX }; } method.Invoke(enemyAI, parameters2); } public static void HitFromExplosion(EnemyAI enemyAI, float distance) { if ((Object)(object)enemyAI == (Object)null) { Logger.LogError("EnemyAI instance is null!"); return; } MethodInfo method = typeof(EnemyAI).GetMethod("HitFromExplosion", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { Logger.LogWarning("HitFromExplosion method not found on EnemyAI!"); return; } object[] parameters = new object[1] { distance }; method.Invoke(enemyAI, parameters); } } public static class NetworkUtils { public static bool IsConnected { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return false; } return singleton.IsConnectedClient; } } public static bool IsServer { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return false; } return singleton.IsServer; } } public static bool IsHost { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return false; } return singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } public static NetworkObjectReference[] GetNetworkObjectReferences(List grabbableObjects) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (grabbableObjects == null || grabbableObjects.Count == 0) { return Array.Empty(); } List list = new List(); NetworkObject val = default(NetworkObject); foreach (GrabbableObject grabbableObject in grabbableObjects) { if (((Component)grabbableObject).TryGetComponent(ref val)) { list.Add(NetworkObjectReference.op_Implicit(val)); } } return list.ToArray(); } public static List GetGrabbableObjects(NetworkObjectReference[] networkObjectReferences) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (networkObjectReferences == null || networkObjectReferences.Length == 0) { return new List(); } List list = new List(); NetworkObject val2 = default(NetworkObject); GrabbableObject item = default(GrabbableObject); for (int i = 0; i < networkObjectReferences.Length; i++) { NetworkObjectReference val = networkObjectReferences[i]; if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) && ((Component)val2).TryGetComponent(ref item)) { list.Add(item); } } return list; } } internal static class PlayerUtils { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float time; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; case 1: <>1__state = -1; if (AreAllPlayersDead()) { StartOfRound.Instance.ReviveDeadPlayers(); } 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 float _previousPlayerMovementSpeed; private static float _previousPlayerJumpForce; public static PlayerControllerB GetLocalPlayerScript() { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return null; } return GameNetworkManager.Instance.localPlayerController; } public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)playerScript == (Object)(object)GetLocalPlayerScript(); } public static PlayerControllerB GetPlayerScriptByClientId(ulong clientId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == clientId) { return val; } } return null; } public static bool AreAllPlayersDead() { bool result = true; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead) { result = false; } } return result; } public static void SetLocalPlayerMovementEnabled(bool enabled) { PlayerControllerB localPlayerScript = GetLocalPlayerScript(); if (enabled) { if (_previousPlayerMovementSpeed == 0f) { _previousPlayerMovementSpeed = 4.6f; } if (_previousPlayerJumpForce == 0f) { _previousPlayerJumpForce = 13f; } localPlayerScript.movementSpeed = _previousPlayerMovementSpeed; localPlayerScript.jumpForce = _previousPlayerJumpForce; } else { if (localPlayerScript.movementSpeed > 0f) { _previousPlayerMovementSpeed = localPlayerScript.movementSpeed; } if (localPlayerScript.jumpForce > 0f) { _previousPlayerJumpForce = localPlayerScript.jumpForce; } localPlayerScript.movementSpeed = 0f; localPlayerScript.jumpForce = 0f; } } public static void SetLocalPlayerAllowDeathEnabled(bool enabled) { if (!((Object)(object)StartOfRound.Instance == (Object)null)) { FieldInfo field = typeof(StartOfRound).GetField("allowLocalPlayerDeath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field == null)) { field.SetValue(StartOfRound.Instance, enabled); } } } public static void ReviveDeadPlayersAfterTime(float time) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ReviveDeadPlayersAfterTimeCO(time)); } [IteratorStateMachine(typeof(d__9))] private static IEnumerator ReviveDeadPlayersAfterTimeCO(float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { time = time }; } public static bool IsLocalPlayer(string username, ulong steamId) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (!(SteamClient.Name == username)) { return SteamId.op_Implicit(SteamClient.SteamId) == steamId; } return true; } public static bool HasPlayer(string username, ulong steamId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerUsername == username) { return true; } if (val.playerSteamId == steamId) { return true; } } return false; } public static bool IsLocalPlayerMagoroku() { return IsLocalPlayer(GetMagorokuInfo().Item1, GetMagorokuInfo().Item2); } public static bool HasPlayerMagoroku() { return HasPlayer(GetMagorokuInfo().Item1, GetMagorokuInfo().Item2); } public static bool HasPlayerLunxara() { return HasPlayer(GetLunxaraInfo().Item1, GetMagorokuInfo().Item2); } public static bool IsLocalPlayerPsychoHypnotic() { return IsLocalPlayer(GetPsychoHypnoticInfo().Item1, GetPsychoHypnoticInfo().Item2); } public static bool HasPlayerPsychoHypnotic() { return HasPlayer(GetPsychoHypnoticInfo().Item1, GetPsychoHypnoticInfo().Item2); } private static (string, ulong) GetMagorokuInfo() { return ("Magoroku", 76561197982837475uL); } private static (string, ulong) GetPsychoHypnoticInfo() { return ("PsychoHypnotic", 76561197970440803uL); } private static (string, ulong) GetLunxaraInfo() { return ("Lunxara", 76561198086325047uL); } } internal static class ScrapHelper { public static Transform ShipTransform => StartOfRound.Instance.elevatorTransform; private static List GetValidScrap(IEnumerable grabbableObjects, bool onlyAllowedScrap, bool includeScrapWorthZero = false) { if (grabbableObjects == null) { return new List(); } return grabbableObjects.Where((GrabbableObject x) => IsValidScrap(x, onlyAllowedScrap, includeScrapWorthZero)).ToList(); } public static List GetScrapFromShip(bool onlyAllowedScrap = true, bool includeScrapWorthZero = false) { if ((Object)(object)ShipTransform == (Object)null) { return new List(); } List list = ((Component)ShipTransform).GetComponentsInChildren().ToList(); list.AddRange(GetGrabbableObjectsFromShipPlaceableObjects()); return GetValidScrap(list, onlyAllowedScrap, includeScrapWorthZero); } private static List GetGrabbableObjectsFromShipPlaceableObjects() { List list = new List(); AutoParentToShip[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (AutoParentToShip val in array) { if (!((Object)(object)((Component)val).transform.parent != (Object)null)) { list.AddRange(((Component)val).GetComponentsInChildren()); } } return list; } public static List GetScrapFromVehicle(bool onlyAllowedScrap = true, bool includeScrapWorthZero = false) { if (VehicleControllerProxy.Enabled) { return GetValidScrap(VehicleControllerProxy.GetGrabbableObjects(), onlyAllowedScrap, includeScrapWorthZero); } return new List(); } public static List GetItemDataList(List shipGrabbableObjects, List vehicleGrabbableObjects, SI_ItemDataProxy[] shipInventoryItems) { List list = new List(); foreach (GrabbableObject shipGrabbableObject in shipGrabbableObjects) { list.Add(new ItemData(shipGrabbableObject, ItemLocation.Ship)); } foreach (GrabbableObject vehicleGrabbableObject in vehicleGrabbableObjects) { list.Add(new ItemData(vehicleGrabbableObject, ItemLocation.Vehicle)); } foreach (SI_ItemDataProxy si_ItemDataProxy in shipInventoryItems) { list.Add(new ItemData(si_ItemDataProxy, ItemLocation.ShipInventory)); } return list; } public static List GetAllScrap(bool onlyAllowedScrap = true, bool onlyUseShipInventory = false, bool includeScrapWorthZero = false) { SI_ItemDataProxy[] shipInventoryItems = Array.Empty(); if (ShipInventoryProxy.Enabled) { shipInventoryItems = (from x in ShipInventoryProxy.GetItemsAsProxies() where IsValidScrap(x, onlyAllowedScrap, includeScrapWorthZero) select x).ToArray(); if (onlyUseShipInventory) { return GetItemDataList(new List(), new List(), shipInventoryItems); } } return GetItemDataList(GetScrapFromShip(onlyAllowedScrap, includeScrapWorthZero), GetScrapFromVehicle(onlyAllowedScrap, includeScrapWorthZero), shipInventoryItems); } public static List GetAllScrapByItemName(string itemName, bool matchCase = false, bool onlyAllowedScrap = false, bool onlyUseShipInventory = false) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); return (from item in GetAllScrap(onlyAllowedScrap, onlyUseShipInventory) where item.ItemName.Contains(itemName, comparisonType) select item).ToList(); } public static List GetAllScrapByItemNames(string[] itemNames, bool matchCase = false, bool onlyAllowedScrap = false, bool onlyUseShipInventory = false) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); return GetAllScrap(onlyAllowedScrap, onlyUseShipInventory).Where(delegate(ItemData item) { string[] array = itemNames; foreach (string value in array) { if (item.ItemName.Contains(value, comparisonType)) { return true; } } return false; }).ToList(); } public static List GetAllScrapItems() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return new List(); } return StartOfRound.Instance.allItemsList.itemsList.Where(IsScrap).ToList(); } public static bool IsScrap(GrabbableObject grabbableObject) { if ((Object)(object)grabbableObject == (Object)null) { return false; } if (!IsScrap(grabbableObject.itemProperties)) { return false; } if (grabbableObject.isHeld || !grabbableObject.grabbable) { return false; } return true; } public static bool IsScrap(Item item) { if ((Object)(object)item == (Object)null) { return false; } return item.isScrap; } public static bool IsAllowedScrap(GrabbableObject grabbableObject, string[] dontSellList, bool matchCase = false) { if ((Object)(object)grabbableObject == (Object)null) { return false; } return IsAllowedScrap(grabbableObject.itemProperties, dontSellList, matchCase); } public static bool IsAllowedScrap(Item item, string[] dontSellItemNames, bool matchCase = false) { if ((Object)(object)item == (Object)null) { return false; } return IsAllowedScrap(item.itemName, dontSellItemNames, matchCase); } public static bool IsAllowedScrap(SI_ItemDataProxy SI_ItemDataProxy, string[] dontSellItemNames, bool matchCase = false) { if (!SI_ItemDataProxy.IsValid()) { return false; } return IsAllowedScrap(SI_ItemDataProxy.ItemName, dontSellItemNames, matchCase); } public static bool IsAllowedScrap(string itemName, string[] dontSellItemNames, bool matchCase = false) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); if (itemName.Equals("Gift", comparisonType) && !ConfigManager.SellGifts.Value) { return false; } if (itemName.Equals("Shotgun", comparisonType) && !ConfigManager.SellShotguns.Value) { return false; } if (itemName.Equals("Ammo", comparisonType) && !ConfigManager.SellAmmo.Value) { return false; } if (itemName.Equals("Kitchen knife", comparisonType) && !ConfigManager.SellKnives.Value) { return false; } if (itemName.Equals("Jar of pickles", comparisonType) && !ConfigManager.SellPickles.Value) { return false; } foreach (string value in dontSellItemNames) { if (itemName.Contains(value, comparisonType)) { return false; } } return true; } public static bool IsValidScrap(GrabbableObject grabbableObject, bool onlyAllowedScrap, bool includeScrapWorthZero = false) { if ((Object)(object)grabbableObject == (Object)null) { return false; } if (!IsScrap(grabbableObject)) { return false; } if (!includeScrapWorthZero && !ConfigManager.SellScrapWorthZero.Value && grabbableObject.scrapValue <= 0) { return false; } if (ConfigManager.OnlySellScrapOnFloor.Value && !grabbableObject.IsOnShipFloor()) { return false; } if (onlyAllowedScrap && !IsAllowedScrap(grabbableObject, ConfigManager.DontSellListArray)) { return false; } return true; } public static bool IsValidScrap(SI_ItemDataProxy SI_ItemDataProxy, bool onlyAllowedScrap, bool includeScrapWorthZero = false) { if (!SI_ItemDataProxy.IsValid()) { return false; } if (!includeScrapWorthZero && !ConfigManager.SellScrapWorthZero.Value && SI_ItemDataProxy.ScrapValue <= 0) { return false; } if (onlyAllowedScrap && !IsAllowedScrap(SI_ItemDataProxy, ConfigManager.DontSellListArray)) { return false; } return true; } public static ScrapToSell GetScrapToSell(SellCommandRequest sellRequest) { List allScrap = GetAllScrap(sellRequest.OnlyAllowedScrap, sellRequest.OnlyUseShipInventory); return sellRequest.GetScrapToSell(allScrap); } public static ScrapToSell GetScrapToSell(string[] sellList, bool onlyAllowedScrap = false, bool onlyUseShipInventory = false) { return new ScrapToSell(GetAllScrapByItemNames(sellList, onlyAllowedScrap, onlyUseShipInventory)); } public static int GetRealValue(int value) { return (int)((float)value * StartOfRound.Instance.companyBuyingRate); } public static string GetScrapMessage(List items) { return GetScrapMessage(items, ConfigManager.SortFoundItemsPrice.Value, ConfigManager.AlignFoundItemsPrice.Value); } public static string GetScrapMessage(List items, bool sortFoundItemsPrice, bool alignFoundItemsPrice) { string[] itemNames = items.Select((ItemData x) => x.ItemName).ToArray(); int[] scrapValues = items.Select((ItemData x) => x.ScrapValue).ToArray(); ItemLocation[] itemLocations = items.Select((ItemData x) => x.ItemLocation).ToArray(); return GetScrapMessage(itemNames, scrapValues, itemLocations, sortFoundItemsPrice, alignFoundItemsPrice, "#007f00"); } public static string GetScrapMessage(List grabbableObjects) { return GetScrapMessage(grabbableObjects, ConfigManager.SortFoundItemsPrice.Value, ConfigManager.AlignFoundItemsPrice.Value); } public static string GetScrapMessage(List grabbableObjects, bool sortFoundItemsPrice, bool alignFoundItemsPrice) { string[] array = grabbableObjects.Select((GrabbableObject x) => x.itemProperties.itemName).ToArray(); int[] scrapValues = grabbableObjects.Select((GrabbableObject x) => x.scrapValue).ToArray(); ItemLocation[] itemLocations = Enumerable.Repeat(ItemLocation.Ship, array.Length).ToArray(); return GetScrapMessage(array, scrapValues, itemLocations, sortFoundItemsPrice, alignFoundItemsPrice, string.Empty); } public static string GetScrapMessage(string[] itemNames, int[] scrapValues, ItemLocation[] itemLocations, bool sortFoundItemsPrice, bool alignFoundItemsPrice, string color2) { var list = (from i in itemNames.Select((string item, int index) => new { Item = item, Value = scrapValues[index], Location = itemLocations[index] }) group i by new { i.Item, i.Location } into g select new { ItemName = g.Key.Item, Count = g.Count(), TotalValue = g.Sum(i => i.Value), Location = g.Key.Location }).ToList(); if (list.Count == 0) { return "No scrap found."; } if (sortFoundItemsPrice) { list = list.OrderByDescending(item => item.TotalValue).ToList(); } int totalWidth = list.Select(item => GetFormattedItemName(item.ItemName, item.Count, color2).Length).Max(); int maxPriceLength = list.Select(item => $"${item.TotalValue}").Max((string p) => p.Length); StringBuilder stringBuilder = new StringBuilder(); foreach (var item in list) { string formattedItemName = GetFormattedItemName(item.ItemName, item.Count, color2); string formattedPriceWithLocation = GetFormattedPriceWithLocation(item.TotalValue, item.Location, maxPriceLength); if (alignFoundItemsPrice) { string text = formattedItemName.PadRight(totalWidth); stringBuilder.AppendLine(text + " " + formattedPriceWithLocation); } else { stringBuilder.AppendLine(formattedItemName + " " + formattedPriceWithLocation); } } return stringBuilder.ToString().Trim(); } private static string GetFormattedItemName(string itemName, int count, string color) { if (string.IsNullOrWhiteSpace(color)) { return $"{itemName} (x{count}) :"; } return $"{itemName} (x{count})"; } private static string GetLocationText(ItemLocation location) { return location switch { ItemLocation.Vehicle => " (Vehicle)", ItemLocation.ShipInventory => " (ShipInventory)", _ => string.Empty, }; } private static string GetFormattedPriceWithLocation(int totalValue, ItemLocation location, int maxPriceLength) { string text = $"${totalValue}"; string locationText = GetLocationText(location); return text.PadRight(maxPriceLength) + (string.IsNullOrWhiteSpace(locationText) ? "" : locationText); } public static string GetScrapItemMessage(List scrapItems, int columns = 1, int padding = 25) { if (scrapItems == null || scrapItems.Count == 0) { return string.Empty; } int num = Mathf.CeilToInt((float)scrapItems.Count / (float)columns); StringBuilder[] array = new StringBuilder[num]; for (int i = 0; i < num; i++) { array[i] = new StringBuilder(); } for (int j = 0; j < columns; j++) { for (int k = 0; k < num; k++) { int num2 = num * j + k; if (num2 >= scrapItems.Count) { break; } string text = scrapItems[num2]?.itemName; if (!string.IsNullOrEmpty(text)) { array[k].Append(text.PadRight(padding)); } } } StringBuilder stringBuilder = new StringBuilder(); StringBuilder[] array2 = array; foreach (StringBuilder stringBuilder2 in array2) { stringBuilder.AppendLine(stringBuilder2.ToString().Trim()); } return stringBuilder.ToString().Trim(); } } internal static class TerminalHelper { public const string GreenColor2 = "#007f00"; public const string GrayColor = "#7f7f7f"; public const string RedColor = "#ff0000"; public static Terminal Instance { get; private set; } public static void SetInstance(Terminal instance) { Instance = instance; } public static TerminalNode CreateTerminalNode(string message, bool clearPreviousText = true, int maxCharactersToType = 50) { TerminalNode val = ScriptableObject.CreateInstance(); val.displayText = message; val.clearPreviousText = clearPreviousText; val.maxCharactersToType = maxCharactersToType; return val; } } internal static class Utils { public static bool IsUnityVersion(string targetUnityVersion) { return Application.unityVersion.StartsWith(targetUnityVersion, StringComparison.OrdinalIgnoreCase); } public static string GetPluginPersistentDataPath() { return Path.Combine(Application.persistentDataPath, "SellMyScrap v40-v72"); } public static ConfigFile CreateConfigFile(BaseUnityPlugin plugin, string path, string name = null, bool saveOnInit = false) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown BepInPlugin metadata = MetadataHelper.GetMetadata((object)plugin); if (name == null) { name = metadata.GUID; } name += ".cfg"; return new ConfigFile(Path.Combine(path, name), saveOnInit, metadata); } public static ConfigFile CreateLocalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false) { return CreateConfigFile(plugin, Paths.ConfigPath, name, saveOnInit); } public static ConfigFile CreateGlobalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false) { string pluginPersistentDataPath = GetPluginPersistentDataPath(); if (name == null) { name = "global"; } return CreateConfigFile(plugin, pluginPersistentDataPath, name, saveOnInit); } public static bool RollPercentChance(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f <= percent; } public static bool ArrayContains(string[] array, string value, bool matchCase = false) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (string text in array) { if (text.Equals(value, comparisonType)) { return true; } } return false; } public static int GetOvertimeBonus(int value) { int profitQuota = TimeOfDay.Instance.profitQuota; int num = TimeOfDay.Instance.quotaFulfilled + value; if (num <= profitQuota) { return 0; } int num2 = num - profitQuota; int num3 = num2 / 5 + 15 * TimeOfDayPatch.GetDaysUntilDeadline(); return Mathf.Max(num3, 0); } public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 80, float minDamageRange = 0f, float maxDamageRange = 6.4f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //IL_0080: 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_0055: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { Object.Instantiate(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); } float num = Vector3.Distance(((Component)PlayerUtils.GetLocalPlayerScript()).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val2 = null; Rigidbody val3 = default(Rigidbody); for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } Vector3 hitDirection; if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); hitDirection = ((Component)val2).transform.position - explosionPosition; Vector3 normalized = ((Vector3)(ref hitDirection)).normalized; if (((Component)val2).TryGetComponent(ref val3)) { val3.AddForce(normalized * 500f); } Vector3 val4 = Vector3.Normalize((((Component)val2).transform.position + Vector3.up * 0.75f - explosionPosition) * 100f) * 30f; val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, val4); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Logger.LogInfo("Setting off other mine", extended: true); ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { EnemyAI mainScript = componentInChildren2.mainScript; hitDirection = default(Vector3); EnemyAIHelper.HitEnemyOnLocalClient(mainScript, enemyHitForce, hitDirection, attacker); EnemyAIHelper.HitFromExplosion(componentInChildren2.mainScript, num2); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); Rigidbody val5 = default(Rigidbody); for (int j = 0; j < array.Length; j++) { if (((Component)array[j]).TryGetComponent(ref val5)) { val5.AddExplosionForce(70f, explosionPosition, 10f); } } } public static int GetRandomIndexFromWeightList(IEnumerable weights) { if (weights == null) { throw new ArgumentNullException("weights"); } int num = 0; int num2 = 0; foreach (int weight in weights) { if (weight < 0) { throw new ArgumentException("Weights must be non-negative."); } num += weight; } if (num == 0) { throw new ArgumentException("At least one weight must be greater than zero."); } int num3 = Random.Range(0, num); int num4 = 0; num2 = 0; foreach (int weight2 in weights) { num4 += weight2; if (num3 < num4) { return num2; } num2++; } return num2 - 1; } } } namespace com.github.zehsteam.SellMyScrap.Helpers.ScrapMatchAlgorithms { public abstract class BaseScrapMatchAlgorithm { protected List items; protected int targetValue; protected HashSet prioritySet; public abstract int FlagIndex { get; } public static BaseScrapMatchAlgorithm Default => new DefaultScrapMatchAlgorithm(); public List FindMatch(List items, int targetValue, string[] priorityList = null) { this.items = items; this.targetValue = targetValue; prioritySet = new HashSet(priorityList ?? Array.Empty(), StringComparer.OrdinalIgnoreCase); if (items.Count == 0 || targetValue == int.MaxValue) { return items; } ItemData itemData = items.OrderBy((ItemData item) => item.ScrapValue).First(); if (targetValue <= itemData.ScrapValue) { return new List(1) { itemData }; } int num = items.Sum((ItemData item) => item.ScrapValue); if (num < targetValue) { return items; } return RunScrapMatchAlgorithm(num); } protected bool IsPriority(ItemData item) { return prioritySet.Contains(item.ItemName); } protected abstract List RunScrapMatchAlgorithm(int totalScrapValue); public static BaseScrapMatchAlgorithm GetAlgorithmByFlag(int flagIndex) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); foreach (Type item in types.Where(typeof(BaseScrapMatchAlgorithm).IsAssignableFrom)) { if (!item.IsAbstract) { BaseScrapMatchAlgorithm baseScrapMatchAlgorithm = (BaseScrapMatchAlgorithm)Activator.CreateInstance(item); if (flagIndex == baseScrapMatchAlgorithm.FlagIndex) { return baseScrapMatchAlgorithm; } } } return Default; } } public class BruteForceMatchAlgorithm : BaseScrapMatchAlgorithm { private class ScrapCombination { public int TotalScrap { get; private set; } public ItemData TheoreticalLastItem { get; private set; } public int TotalScrapWithLastItem => TotalScrap + (TheoreticalLastItem?.ScrapValue ?? 0); public int LastIndex { get { List indeces = Indeces; return indeces[indeces.Count - 1]; } } private List Items { get; } = new List(); private List Indeces { get; } = new List(); public int Count => Items.Count; public ScrapCombination() { } protected ScrapCombination(ScrapCombination other) : this() { TotalScrap = other.TotalScrap; TheoreticalLastItem = other.TheoreticalLastItem; Items = new List(other.Items); Indeces = new List(other.Indeces); } public void Add(ItemData item, int itemIndex) { Items.Add(item); Indeces.Add(itemIndex); TotalScrap += item.ScrapValue; TheoreticalLastItem = null; } public void RemoveLast() { List items = Items; ItemData itemData = items[items.Count - 1]; Items.RemoveAt(Count - 1); Indeces.RemoveAt(Indeces.Count - 1); TotalScrap -= itemData.ScrapValue; TheoreticalLastItem = null; } public void UpdateIfBetterWith(ItemData item) { if (TheoreticalLastItem == null || TheoreticalLastItem.ScrapValue > item.ScrapValue) { TheoreticalLastItem = item; } } public ScrapCombination SaveBest(ScrapCombination other) { if (other.TotalScrapWithLastItem < TotalScrapWithLastItem) { return new ScrapCombination(other); } return this; } public static implicit operator List(ScrapCombination sc) { List list = new List(sc.Items); if (sc.TheoreticalLastItem != null) { list.Add(sc.TheoreticalLastItem); } return list; } } private ItemData[] orderedItems; private ScrapCombination bestCombination; public override int FlagIndex => 2; protected override List RunScrapMatchAlgorithm(int totalScrapValue) { List list = new List(); orderedItems = items.OrderBy(base.IsPriority).ThenByDescending((ItemData i) => i.ScrapValue).ToArray(); bestCombination = new ScrapCombination(); return RecursiveScrapSearch(bestCombination); } private ScrapCombination RecursiveScrapSearch(ScrapCombination itemsToSell) { int num = 0; while (itemsToSell.Count != 0 || num != orderedItems.Length - 1) { for (int i = num; i < orderedItems.Length; i++) { ItemData itemData = orderedItems[i]; if (itemsToSell.TotalScrap + itemData.ScrapValue == targetValue) { itemsToSell.Add(itemData, i); bestCombination = itemsToSell; return itemsToSell; } if (itemsToSell.TotalScrap + itemData.ScrapValue < targetValue) { itemsToSell.Add(itemData, i); } else { itemsToSell.UpdateIfBetterWith(itemData); } } bestCombination = bestCombination.SaveBest(itemsToSell); num = itemsToSell.LastIndex + 1; itemsToSell.RemoveLast(); } return bestCombination; } } public class DefaultScrapMatchAlgorithm : BaseScrapMatchAlgorithm { public override int FlagIndex => 1; protected override List RunScrapMatchAlgorithm(int totalScrapValue) { int[] array = new int[totalScrapValue + 1]; List[] array2 = new List[totalScrapValue + 1]; int[] array3 = new int[totalScrapValue + 1]; for (int i = 0; i <= totalScrapValue; i++) { array[i] = int.MaxValue; array2[i] = new List(); array3[i] = 0; } array[0] = 0; foreach (ItemData item in items) { bool flag = IsPriority(item); int num = (flag ? 1 : 0); for (int num2 = totalScrapValue; num2 >= item.ScrapValue; num2--) { int num3 = num2 - item.ScrapValue; if (array[num3] != int.MaxValue) { int num4 = array[num3] + item.ScrapValue; int num5 = array3[num3] + num; if (num4 < array[num2] || (num4 == array[num2] && num5 > array3[num2])) { array[num2] = num4; array2[num2] = new List(array2[num3]) { item }; array3[num2] = num5; } } } } if (array[targetValue] != int.MaxValue) { return array2[targetValue]; } for (int j = targetValue + 1; j <= totalScrapValue; j++) { if (array[j] != int.MaxValue) { return array2[j]; } } return items; } } public class SuperFastScrapMatchAlgorithm : BaseScrapMatchAlgorithm { public override int FlagIndex => 3; protected override List RunScrapMatchAlgorithm(int totalScrapValue) { int currentSellValue = 0; List list = new List(); IOrderedEnumerable orderedEnumerable = items.OrderBy((ItemData i) => i.ItemName); List second = orderedEnumerable.Where(base.IsPriority).ToList(); AddToSellWhileNotFulfilled(second, ref currentSellValue, list); if (currentSellValue >= targetValue) { return list; } List list2 = orderedEnumerable.Except(second).ToList(); AddToSellWhileNotFulfilled(list2, ref currentSellValue, list); return list; } private void AddToSellWhileNotFulfilled(List items, ref int currentSellValue, List itemsToSell) { for (int i = 0; i < items.Count; i++) { if (currentSellValue >= targetValue) { break; } currentSellValue += items[i].ScrapValue; itemsToSell.Add(items[i]); } } } } namespace com.github.zehsteam.SellMyScrap.Extensions { internal static class CollectionExtensions { public static IEnumerable StringToCollection(this string s, string separator = ",") { if (string.IsNullOrEmpty(s)) { return Array.Empty(); } T result; return from x in s.Split(separator, StringSplitOptions.RemoveEmptyEntries) where !string.IsNullOrWhiteSpace(x) select x.Trim() into x select (!x.TryConvertTo(out result)) ? default(T) : result into x where x != null select x; } public static string CollectionToString(this IEnumerable value, string separator = ", ") { if (value == null || !value.Any()) { return string.Empty; } return string.Join(separator, from x in value where x != null && !string.IsNullOrWhiteSpace(x.ToString()) select x.ToString().Trim()); } public static List> SplitList(this List list, int numberOfLists) { List> list2 = new List>(); int count = list.Count; int num = Mathf.CeilToInt((float)count / (float)numberOfLists); for (int i = 0; i < numberOfLists; i++) { List range = list.GetRange(i * num, Mathf.Min(num, count - i * num)); list2.Add(range); } return list2; } } internal static class GrabbableObjectExtensions { public static bool IsOnShipFloor(this GrabbableObject grabbableObject) { //IL_0012: 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) float verticalOffset = grabbableObject.itemProperties.verticalOffset; float num = ((Component)grabbableObject).transform.position.y - verticalOffset; Transform shipTransform = ScrapHelper.ShipTransform; float y = shipTransform.position.y; float num2 = num - y; float num3 = -0.1f; float num4 = 0.1f; if (num2 >= num3) { return num2 <= num4; } return false; } } internal static class StringExtensions { public static T ConvertTo(this string s) { Type typeFromHandle = typeof(T); if ((object)typeFromHandle != null) { Type type = typeFromHandle; object obj; if (type == typeof(int) && int.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { obj = result; } else { Type type2 = typeFromHandle; if (type2 == typeof(float) && float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { obj = result2; } else { Type type3 = typeFromHandle; if (type3 == typeof(double) && double.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { obj = result3; } else { Type type4 = typeFromHandle; if (type4 == typeof(bool) && bool.TryParse(s, out var result4)) { obj = result4; } else { Type type5 = typeFromHandle; if (type5 == typeof(string)) { obj = s; } else { Type type6 = typeFromHandle; if (!type6.IsEnum || !Enum.TryParse(type6, s, ignoreCase: true, out object result5)) { goto IL_0121; } obj = result5; } } } } } object obj2 = obj; return (T)obj2; } goto IL_0121; IL_0121: throw new NotSupportedException($"Unsupported value type: {typeof(T)}"); } public static bool TryConvertTo(this string s, out T result) { try { result = s.ConvertTo(); return true; } catch { result = default(T); return false; } } public static bool EqualsAny(this string s, string[] values, StringComparison comparisonType = StringComparison.CurrentCulture) { return values.Any((string value) => s.Equals(value, comparisonType)); } public static bool ContainsAny(this string s, string[] values, StringComparison comparisonType = StringComparison.CurrentCulture) { return values.Any((string value) => s.Contains(value, comparisonType)); } public static bool StartsWithAny(this string s, string[] values, StringComparison comparisonType = StringComparison.CurrentCulture) { return values.Any((string value) => s.StartsWith(value, comparisonType)); } } } namespace com.github.zehsteam.SellMyScrap.Dependencies { internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SkipAutoGen() { LethalConfigManager.SkipAutoGen(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry configEntry, bool requiresRestart = false) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues; if (acceptableValues != null) { if (acceptableValues is AcceptableValueRange || acceptableValues is AcceptableValueRange) { AddConfigSlider(configEntry, requiresRestart); return; } if (acceptableValues is AcceptableValueList) { AddConfigDropdown(configEntry, requiresRestart); return; } } if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { if (!(configEntry is ConfigEntry val3)) { if (!(configEntry is ConfigEntry val4)) { throw new NotSupportedException($"Unsupported type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigSlider(ConfigEntry configEntry, bool requiresRestart = false) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { throw new NotSupportedException($"Slider not supported for type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigDropdown(ConfigEntry configEntry, bool requiresRestart = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (configEntry is ConfigEntry val) { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextDropDownConfigItem(val, requiresRestart)); return; } throw new NotSupportedException($"Dropdown not supported for type: {typeof(T)}"); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddButton(string section, string name, string description, string buttonText, Action callback) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { callback?.Invoke(); })); } } internal static class TakeyPlushProxy { public const string PLUGIN_GUID = "com.github.zehsteam.TakeyPlush"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.github.zehsteam.TakeyPlush"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TriggerDinkDonkScrapEaterSpawnedEvent() { try { Events.InvokeOnDinkDonkScrapEaterSpawned(); } catch (Exception arg) { Logger.LogError($"Failed to invoke OnDinkDonkScrapEaterSpawned event in TakeyPlush. {arg}"); } } } } namespace com.github.zehsteam.SellMyScrap.Dependencies.Vanilla { internal static class VehicleControllerProxy { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = GetEnabledState(); _enabled = valueOrDefault; } return _enabled.Value; } } private static bool GetEnabledState() { try { Assembly assembly = typeof(StartOfRound).Assembly; return assembly.GetType("VehicleController") != null; } catch (Exception arg) { Logger.LogError($"Failed to get enabled state from VehicleControllerProxy. {arg}"); return false; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static GrabbableObject[] GetGrabbableObjects() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return Array.Empty(); } try { VehicleController attachedVehicle = StartOfRound.Instance.attachedVehicle; if ((Object)(object)attachedVehicle == (Object)null) { return Array.Empty(); } return ((Component)attachedVehicle).GetComponentsInChildren(); } catch (Exception arg) { Logger.LogError($"Failed to get GrabbableObjects from attached vehicle. {arg}"); return Array.Empty(); } } } } namespace com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy { internal enum SpawnItemsStatus { None, Spawning, Success, Failed } internal class ShipInventoryProxy { [CompilerGenerated] private sealed class <>c__DisplayClass14_0 { public float startTime; public ItemData[] items; public float maxWaitTime; internal bool b__1() { if (new Func(ChuteRetrievePatch.Instance.SpawnCoroutine) != null && ChuteRetrievePatch.SpawnedGrabbableObjects.Count < items.Length) { return getElapsedTime() >= maxWaitTime; } return true; float getElapsedTime() { return Time.realtimeSinceStartup - startTime; } } } [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SI_ItemDataProxy[] proxyItems; private <>c__DisplayClass14_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass14_0(); SpawnItemsStatus = SpawnItemsStatus.Spawning; <>8__1.items = GetValidItemsFromProxies(proxyItems); if (<>8__1.items.Length == 0) { Logger.LogError("[ShipInventoryProxy] Failed to spawn ShipInventory items. No items to spawn."); SpawnItemsStatus = SpawnItemsStatus.Failed; return false; } if (proxyItems.Length != <>8__1.items.Length) { Logger.LogWarning($"[ShipInventoryProxy] Received {proxyItems.Length} proxy items, but only {<>8__1.items.Length} are valid!"); } Logger.LogInfo($"[ShipInventoryProxy] Server scheduled to spawn {<>8__1.items.Count()} items!"); ChuteRetrievePatch.StartCapturingSpawnedItems(<>8__1.items); Inventory.Remove(<>8__1.items); <>8__1.startTime = Time.realtimeSinceStartup; float value = Configuration.Instance.Inventory.RetrieveSpeed.Value; <>8__1.maxWaitTime = (float)ChuteRetrievePatch.Instance._spawnQueue.Count * value + 5f; <>2__current = (object)new WaitUntil((Func)(() => new Func(ChuteRetrievePatch.Instance.SpawnCoroutine) == null || ChuteRetrievePatch.SpawnedGrabbableObjects.Count >= <>8__1.items.Length || getElapsedTime() >= <>8__1.maxWaitTime)); <>1__state = 1; return true; } case 1: { <>1__state = -1; ChuteRetrievePatch.StopCapturingSpawnItems(); List spawnedGrabbableObjects = GetSpawnedGrabbableObjects(); if (spawnedGrabbableObjects.Count != <>8__1.items.Length) { Logger.LogError($"[ShipInventoryProxy] Something went wrong when spawning items. Found {spawnedGrabbableObjects.Count} GrabbableObject(s), but expected {<>8__1.items.Length}."); SpawnItemsStatus = SpawnItemsStatus.Failed; return false; } ChuteRetrievePatch.StopCapturingSpawnItems(); Logger.LogInfo($"[ShipInventoryProxy] Successfully spawned {spawnedGrabbableObjects.Count} items from ShipInventory!"); SpawnItemsStatus = SpawnItemsStatus.Success; return false; } } float getElapsedTime() { return Time.realtimeSinceStartup - ((<>c__DisplayClass14_0)this).startTime; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PLUGIN_GUID = "org.lethalcompanymodding.shipinventoryupdated"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("org.lethalcompanymodding.shipinventoryupdated"); _enabled = valueOrDefault; } return _enabled.Value; } } public static bool IsSpawning => SpawnItemsStatus == SpawnItemsStatus.Spawning; public static SpawnItemsStatus SpawnItemsStatus { get; private set; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchAll(Harmony harmony) { try { harmony.PatchAll(typeof(ChuteRetrievePatch)); } catch (Exception arg) { Logger.LogError($"[ShipInventoryProxy] Failed to apply patches. {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static SI_ItemDataProxy[] GetItemsAsProxies() { //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_003f: Unknown result type (might be due to invalid IL or missing references) List list = new List(); try { foreach (ItemData item in Inventory.Items.Where((ItemData x) => x.IsScrap())) { list.Add(new SI_ItemDataProxy(item)); } } catch (Exception arg) { Logger.LogError($"Failed to get ShipInventory items. {arg}"); } return list.ToArray(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static ItemData[] GetValidItemsFromProxies(SI_ItemDataProxy[] proxyItems) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003d: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = Inventory.Items.ToList(); foreach (SI_ItemDataProxy sI_ItemDataProxy in proxyItems) { ItemData item = sI_ItemDataProxy.CreateItemData(); if (list2.Contains(item)) { list2.Remove(item); list.Add(item); } } return list.ToArray(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SpawnItems_Server(SI_ItemDataProxy[] proxyItems) { if (NetworkUtils.IsServer) { CoroutineRunner.Start(SpawnItems_ServerCoroutine(proxyItems)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] [IteratorStateMachine(typeof(d__14))] private static IEnumerator SpawnItems_ServerCoroutine(SI_ItemDataProxy[] proxyItems) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { proxyItems = proxyItems }; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static List GetSpawnedGrabbableObjects() { return ChuteRetrievePatch.SpawnedGrabbableObjects; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ClearSpawnedGrabbableObjectsCache() { ChuteRetrievePatch.ClearSpawnedGrabbableObjectsCache(); } } } namespace com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Patches { [HarmonyPatch(typeof(ChuteRetrieve))] internal static class ChuteRetrievePatch { private static List _itemsToCapture = new List(); public static ChuteRetrieve Instance { get; private set; } public static List SpawnedGrabbableObjects { get; private set; } = new List(); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(ChuteRetrieve __instance) { Instance = __instance; } [HarmonyPatch("SpawnItemServer")] [HarmonyPostfix] private static void SpawnItemServerPatch(ItemData data, NetworkObject __result) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (_itemsToCapture.Count != 0 && _itemsToCapture.Contains(data)) { _itemsToCapture.Remove(data); GrabbableObject item = default(GrabbableObject); if (((Component)__result).TryGetComponent(ref item)) { SpawnedGrabbableObjects.Add(item); } } } public static void StartCapturingSpawnedItems(ItemData[] items) { ClearSpawnedGrabbableObjectsCache(); _itemsToCapture = items.ToList(); } public static void StopCapturingSpawnItems() { _itemsToCapture.Clear(); } public static void ClearSpawnedGrabbableObjectsCache() { SpawnedGrabbableObjects.Clear(); } } } namespace com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Objects { [Serializable] public struct SI_ItemDataProxy : INetworkSerializable, IEquatable { public FixedString32Bytes Id; public int ScrapValue; public int SaveData; public bool PersistedThroughRounds; public string ItemName => GetItem()?.itemName ?? "Unknown Item"; public bool IsScrap => GetItem()?.isScrap ?? false; public SI_ItemDataProxy(FixedString32Bytes id, int scrapValue, int saveData, bool persistedThroughRounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Id = id; ScrapValue = scrapValue; SaveData = saveData; PersistedThroughRounds = persistedThroughRounds; } public Item? GetItem() { return ItemIdentifier.GetItem(((FixedString32Bytes)(ref Id)).Value); } public bool IsValid() { return !string.IsNullOrEmpty(((FixedString32Bytes)(ref Id)).Value); } public unsafe void NetworkSerialize(BufferSerializer 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_0020: 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_0036: 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_004c: 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) ((BufferSerializer*)(&serializer))->SerializeValue(ref Id, default(ForFixedStrings)); ((BufferSerializer*)(&serializer))->SerializeValue(ref ScrapValue, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref SaveData, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref PersistedThroughRounds, default(ForPrimitives)); } public bool Equals(SI_ItemDataProxy other) { if ((ref Id) != (ref other.Id)) { return false; } if (ScrapValue != other.ScrapValue) { return false; } if (SaveData != other.SaveData) { return false; } if (PersistedThroughRounds != other.PersistedThroughRounds) { return false; } return true; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public SI_ItemDataProxy(ItemData itemData) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: 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) Id = default(FixedString32Bytes); ScrapValue = 0; SaveData = 0; PersistedThroughRounds = false; try { Id = itemData.ID; ScrapValue = itemData.SCRAP_VALUE; SaveData = itemData.SAVE_DATA; PersistedThroughRounds = itemData.PERSISTED_THROUGH_ROUNDS; } catch (Exception arg) { Logger.LogError($"Failed to properly construct {GetType().Name}. {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public bool Equals(ItemData other) { //IL_001e: 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_0042: Unknown result type (might be due to invalid IL or missing references) try { if ((ref Id) != (ref other.ID)) { return false; } if (ScrapValue != other.SCRAP_VALUE) { return false; } if (SaveData != other.SAVE_DATA) { return false; } if (PersistedThroughRounds != other.PERSISTED_THROUGH_ROUNDS) { return false; } return true; } catch (Exception arg) { Logger.LogError(string.Format("Failed to compare {0} to {1}. {2}", GetType().Name, "SI_ItemData", arg)); return false; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public ItemData CreateItemData() { //IL_0002: 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_003c: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) try { ItemData result = default(ItemData); result.ID = Id; result.SCRAP_VALUE = ScrapValue; result.SAVE_DATA = SaveData; result.PERSISTED_THROUGH_ROUNDS = PersistedThroughRounds; return result; } catch (Exception arg) { Logger.LogError(string.Format("Failed to convert {0} to {1}. {2}", GetType().Name, "SI_ItemData", arg)); return default(ItemData); } } } } namespace com.github.zehsteam.SellMyScrap.Dependencies.ShipInventoryProxy.Extensions { internal static class SI_ItemDataExtensions { [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsScrap(this ItemData itemData) { return ((ItemData)(ref itemData)).GetItem().isScrap; } } } namespace com.github.zehsteam.SellMyScrap.Commands { public abstract class Command { public TerminalNode PreviousTerminalNode; private Dictionary _parsedFlags = new Dictionary(); public bool AwaitingConfirmation { get { return CommandManager.AwaitingConfirmationCommand == this; } set { CommandManager.AwaitingConfirmationCommand = (value ? this : null); } } public virtual bool IsCommand(ref string[] args) { return false; } protected bool MatchesPattern(ref string[] args, params string[] pattern) { if (args.Length < pattern.Length) { return false; } for (int i = 0; i < pattern.Length; i++) { if (!args[i].Equals(pattern[i], StringComparison.OrdinalIgnoreCase)) { return false; } } args = ParseFlags(args.Skip(pattern.Length).ToArray()); return true; } public virtual TerminalNode Execute(string[] args) { return TerminalHelper.CreateTerminalNode("Execute override was not found.\n\n"); } public virtual TerminalNode ExecuteConfirmation(string[] args) { string text = args[0].ToLower(); if ("confirm".Contains(text) && text.Length > 0) { return OnConfirm(args); } if ("deny".Contains(text) && text.Length > 0) { return OnDeny(args); } return OnInvalidInput(args); } protected virtual TerminalNode OnConfirm(string[] args) { return TerminalHelper.CreateTerminalNode("OnConfirm override was not found.\n\n"); } protected virtual TerminalNode OnDeny(string[] args) { return TerminalHelper.CreateTerminalNode("OnDeny override was not found.\n\n"); } protected virtual TerminalNode OnInvalidInput(string[] args) { return PreviousTerminalNode; } protected string[] ParseFlags(string[] args) { _parsedFlags.Clear(); List list = new List(); foreach (string text in args) { Match match = Regex.Match(text, "-(\\w+)(?::(.+))?"); if (match.Success) { string key = match.Groups[1].Value.ToLower(); string value = (match.Groups[2].Success ? match.Groups[2].Value : string.Empty); _parsedFlags[key] = value; } else { list.Add(text); } } return list.ToArray(); } protected T GetFlagData(string flagKey, T defaultValue = default(T)) { if (_parsedFlags.TryGetValue(flagKey.ToLower(), out var value) && !string.IsNullOrEmpty(value)) { try { return (T)Convert.ChangeType(value, typeof(T)); } catch (InvalidCastException) { throw new ArgumentException($"Flag {flagKey} could not be parsed as {typeof(T)}"); } } return defaultValue; } protected bool TryGetFlagData(string flagKey, out T flagData) { flagData = default(T); if (_parsedFlags.TryGetValue(flagKey.ToLower(), out var value) && !string.IsNullOrEmpty(value)) { try { flagData = (T)Convert.ChangeType(value, typeof(T)); return true; } catch (InvalidCastException) { throw new ArgumentException($"Flag {flagKey} could not be parsed as {typeof(T)}"); } } return false; } protected bool HasFlag(string flagKey) { return _parsedFlags.ContainsKey(flagKey.ToLower()); } } internal static class CommandManager { private static List _commands; public static Command AwaitingConfirmationCommand; static CommandManager() { _commands = new List(); _commands = new List(11) { new HelpCommand(), new SellQuotaCommand(), new SellAllCommand(), new SellItemCommand(), new SellListCommand(), new SellAmountCommand(), new ViewScrapCommand(), new ViewAllScrapCommand(), new ViewOvertimeCommand(), new ViewConfigCommand(), new EditConfigCommand() }; AwaitingConfirmationCommand = null; } public static bool TryExecuteCommand(string[] array, out TerminalNode terminalNode) { terminalNode = null; string[] args = GetArgs(array, 5); Command awaitingConfirmationCommand; if (AwaitingConfirmationCommand != null) { awaitingConfirmationCommand = AwaitingConfirmationCommand; terminalNode = awaitingConfirmationCommand.ExecuteConfirmation(args); awaitingConfirmationCommand.PreviousTerminalNode = terminalNode; return true; } awaitingConfirmationCommand = GetCommand(ref args); if (awaitingConfirmationCommand == null) { return false; } terminalNode = awaitingConfirmationCommand.Execute(GetArgs(args, 5)); awaitingConfirmationCommand.PreviousTerminalNode = terminalNode; return true; } public static void OnLocalDisconnect() { AwaitingConfirmationCommand = null; } public static void OnTerminalQuit() { AwaitingConfirmationCommand = null; } private static string[] GetArgs(string[] array, int expectedLength) { if (array.Length >= expectedLength) { return array; } return array.Concat(Enumerable.Repeat(string.Empty, expectedLength - array.Length)).ToArray(); } private static Command GetCommand(ref string[] args) { foreach (Command command in _commands) { if (command.IsCommand(ref args)) { return command; } } return null; } } internal class EditConfigCommand : Command { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "edit", "config")) { return true; } if (MatchesPattern(ref args, "edit-config")) { return true; } return false; } public override TerminalNode Execute(string[] args) { return TerminalHelper.CreateTerminalNode("The SellMyScrap config editor has been removed. Please use the LethalConfig mod to edit the config settings in-game.\n\n"); } } internal class HelpCommand : Command { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell", "")) { return true; } if (MatchesPattern(ref args, "sell", "help")) { return true; } if (MatchesPattern(ref args, "sell-help")) { return true; } if (MatchesPattern(ref args, "sellmyscrap")) { return true; } if (MatchesPattern(ref args, "sell", "my", "scrap")) { return true; } if (MatchesPattern(ref args, "sms")) { return true; } return false; } public override TerminalNode Execute(string[] args) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SellMyScrap v40-v72 v1.15.3\n"); stringBuilder.AppendLine("The following commands are available:\n"); stringBuilder.AppendLine("sell sell-amount "); stringBuilder.AppendLine("sell quota sell-quota"); stringBuilder.AppendLine("sell all sell-all"); stringBuilder.AppendLine("sell item sell-item "); stringBuilder.AppendLine("sell list sell-list"); stringBuilder.AppendLine("view overtime view-overtime"); stringBuilder.AppendLine("view scrap view-scrap"); stringBuilder.AppendLine("view all scrap view-all-scrap\n\n"); return TerminalHelper.CreateTerminalNode(stringBuilder.ToString()); } } internal class SellAllCommand : SellCommand { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell", "all")) { return true; } if (MatchesPattern(ref args, "sell-all")) { return true; } if (MatchesPattern(ref args, "sell", "everything")) { return true; } if (MatchesPattern(ref args, "sell-everything", "everything")) { return true; } return false; } public override TerminalNode Execute(string[] args) { if (!SellCommand.CanUseCommand(out var failReason)) { return failReason; } ScrapToSell scrapToSell = SellManager.GetScrapToSell(new SellCommandRequest(int.MaxValue) { OnlyUseShipInventory = OnlyUseShipInventory() }); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found to sell.\n\n"); } SellManager.CreateSellRequest(SellType.All, scrapToSell.TotalScrapValue, scrapToSell.TotalScrapValue, ConfirmationStatus.AwaitingConfirmation, GetScrapEaterIndex(), GetScrapEaterVariantIndex()); base.AwaitingConfirmation = true; string message = GetMessage(scrapToSell); return TerminalHelper.CreateTerminalNode(message); } private string GetMessage(ScrapToSell scrapToSell) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.RealTotalScrapValue}"); stringBuilder.AppendLine(SellCommand.GetQuotaFulfilledString(scrapToSell.RealTotalScrapValue)); stringBuilder.Append(SellCommand.GetOvertimeBonusString(scrapToSell.RealTotalScrapValue)); stringBuilder.AppendLine($"The Company is buying at %{SellCommand.CompanyBuyingRate}\n"); if (ConfigManager.ShowFoundItems.Value) { stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n"); } stringBuilder.AppendLine("Please CONFIRM or DENY.\n\n"); return stringBuilder.ToString(); } } internal class SellAmountCommand : SellCommand { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell") && args[0] != string.Empty) { return true; } if (MatchesPattern(ref args, "sell", "amount")) { return true; } if (MatchesPattern(ref args, "sell-amount")) { return true; } return false; } public override TerminalNode Execute(string[] args) { if (!SellCommand.CanUseCommand(out var failReason)) { return failReason; } string expression = string.Join(" ", args).Trim(); string s = string.Empty; try { DataTable dataTable = new DataTable(); s = dataTable.Compute(expression, "").ToString(); } catch { Logger.LogError("Error: failed to evalute expression for sell "); } if (!int.TryParse(s, out var result) || result <= 0) { return TerminalHelper.CreateTerminalNode(GetSellAmountInvalidMessage()); } ScrapToSell scrapToSell = SellManager.GetScrapToSell(new SellCommandRequest(result) { WithOvertimeBonus = WithOvertimeBonus(), OnlyUseShipInventory = OnlyUseShipInventory(), ScrapMatchAlgorithm = GetScrapMatchAlgorithm() }); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found to sell.\n\n"); } SellManager.CreateSellRequest(SellType.Amount, scrapToSell.TotalScrapValue, result, ConfirmationStatus.AwaitingConfirmation, GetScrapEaterIndex(), GetScrapEaterVariantIndex()); base.AwaitingConfirmation = true; string message = GetMessage(scrapToSell, result, WithOvertimeBonus()); return TerminalHelper.CreateTerminalNode(message); } private string GetMessage(ScrapToSell scrapToSell, int requestedValue, bool withOvertimeBonus) { string value; string arg; if (withOvertimeBonus) { value = SellCommand.GetOvertimeBonusWithValueString(scrapToSell.RealTotalScrapValue, requestedValue, out var hasEnoughWithOvertimeBonus); arg = ((scrapToSell.RealTotalScrapValue >= requestedValue || hasEnoughWithOvertimeBonus) ? "green" : "red"); } else { value = SellCommand.GetOvertimeBonusString(scrapToSell.RealTotalScrapValue); arg = ((scrapToSell.RealTotalScrapValue >= requestedValue) ? "green" : "red"); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.RealTotalScrapValue}"); stringBuilder.AppendLine($"Requested value: ${requestedValue}"); stringBuilder.AppendLine(SellCommand.GetQuotaFulfilledString(scrapToSell.RealTotalScrapValue)); stringBuilder.Append(value); stringBuilder.AppendLine($"The Company is buying at %{SellCommand.CompanyBuyingRate}\n"); if (ConfigManager.ShowFoundItems.Value) { stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n"); } stringBuilder.AppendLine("Please CONFIRM or DENY.\n\n"); return stringBuilder.ToString(); } private string GetSellAmountInvalidMessage() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Error: sell amount is invalid.\n"); stringBuilder.AppendLine("Usage:"); stringBuilder.AppendLine("sell "); stringBuilder.AppendLine("sell -o\n"); stringBuilder.AppendLine("Where is a positive integer or math expression.\n"); stringBuilder.AppendLine("Flags:"); stringBuilder.AppendLine(" -o Will sell for a less amount so (less amount + overtime bonus) = initial amount.\n"); stringBuilder.AppendLine("Usage examples:"); stringBuilder.AppendLine(" sell 500"); stringBuilder.AppendLine(" sell 110 * 5 - 50"); stringBuilder.AppendLine(" sell 550 -o\n\n"); return stringBuilder.ToString(); } } internal class SellCommand : Command { protected static int CompanyBuyingRate => (int)(StartOfRound.Instance.companyBuyingRate * 100f); protected override TerminalNode OnConfirm(string[] args) { string message = $"Sell confirmed. Processing {SellManager.SellRequest.RealScrapValue}...\n\n"; SellManager.ConfirmSellRequest(); base.AwaitingConfirmation = false; return TerminalHelper.CreateTerminalNode(message); } protected override TerminalNode OnDeny(string[] args) { SellManager.CancelSellRequest(); base.AwaitingConfirmation = false; return TerminalHelper.CreateTerminalNode("Sell aborted.\n\n"); } protected int GetScrapEaterIndex() { if (TryGetFlagData("se", out var flagData)) { return Mathf.Clamp(flagData - 1, 0, ScrapEaterManager.ScrapEaters.Count - 1); } if (!HasFlag("se")) { return -2; } return -1; } protected int GetScrapEaterVariantIndex() { if (TryGetFlagData("variant", out var flagData)) { return Mathf.Max(flagData - 1, 0); } return -1; } protected bool WithOvertimeBonus() { return HasFlag("o"); } protected bool OnlyUseShipInventory() { if (!ShipInventoryProxy.Enabled) { return false; } if (HasFlag("inv")) { return true; } if (HasFlag("inventory")) { return true; } if (HasFlag("shipinv")) { return true; } if (HasFlag("shipinventory")) { return true; } return false; } protected BaseScrapMatchAlgorithm GetScrapMatchAlgorithm() { if (TryGetFlagData("a", out var flagData)) { return BaseScrapMatchAlgorithm.GetAlgorithmByFlag(flagData); } return BaseScrapMatchAlgorithm.Default; } protected static bool CanUseCommand(out TerminalNode failReason) { failReason = null; if (StartOfRound.Instance.inShipPhase) { failReason = TerminalHelper.CreateTerminalNode("You must be landed on a moon that allows selling.\n\n"); return false; } if ((Object)(object)DepositItemsDeskHelper.Instance == (Object)null) { failReason = TerminalHelper.CreateTerminalNode("You cannot sell on this moon.\n\n"); return false; } return true; } protected static string GetQuotaFulfilledString(int valueFound) { int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; int profitQuota = TimeOfDay.Instance.profitQuota; int num = Mathf.Max(profitQuota - quotaFulfilled, 0); if (num == 0) { return $"Quota fulfilled: ${quotaFulfilled} / ${profitQuota}"; } string text = ((valueFound >= num) ? "#007f00" : "red"); return $"Quota fulfilled: ${quotaFulfilled} / ${profitQuota} (Need: ${num})"; } protected static string GetOvertimeBonusString(int value) { int overtimeBonus = Utils.GetOvertimeBonus(value); if (overtimeBonus == 0) { return string.Empty; } return string.Format("Overtime bonus: ${0} (With value: ${2})\n", overtimeBonus, "#007f00", value + overtimeBonus); } protected static string GetOvertimeBonusWithValueString(int value, int targetValue, out bool hasEnoughWithOvertimeBonus) { int overtimeBonus = Utils.GetOvertimeBonus(value); hasEnoughWithOvertimeBonus = value + overtimeBonus >= targetValue; if (overtimeBonus <= 0) { return string.Empty; } string arg = (hasEnoughWithOvertimeBonus ? "#007f00" : "red"); return $"Overtime bonus: ${overtimeBonus} (With value: ${value + overtimeBonus})\n"; } } internal class SellItemCommand : SellCommand { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell", "item")) { return true; } if (MatchesPattern(ref args, "sell-item")) { return true; } return false; } public override TerminalNode Execute(string[] args) { if (!SellCommand.CanUseCommand(out var failReason)) { return failReason; } string text = string.Join(" ", args).Trim(); if (string.IsNullOrWhiteSpace(text)) { return TerminalHelper.CreateTerminalNode(GetSellItemInvalidMessage()); } ScrapToSell scrapToSell = SellManager.SetScrapToSell(ScrapHelper.GetAllScrapByItemName(text, matchCase: false, onlyAllowedScrap: false, OnlyUseShipInventory())); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found to sell.\n\n"); } SellManager.CreateSellRequest(SellType.Item, scrapToSell.TotalScrapValue, scrapToSell.TotalScrapValue, ConfirmationStatus.AwaitingConfirmation, GetScrapEaterIndex(), GetScrapEaterVariantIndex()); base.AwaitingConfirmation = true; string message = GetMessage(scrapToSell); return TerminalHelper.CreateTerminalNode(message); } private static string GetMessage(ScrapToSell scrapToSell) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.RealTotalScrapValue}"); stringBuilder.AppendLine(SellCommand.GetQuotaFulfilledString(scrapToSell.RealTotalScrapValue)); stringBuilder.Append(SellCommand.GetOvertimeBonusString(scrapToSell.RealTotalScrapValue)); stringBuilder.AppendLine($"The Company is buying at %{SellCommand.CompanyBuyingRate}\n"); stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n"); stringBuilder.AppendLine("Please CONFIRM or DENY.\n\n"); return stringBuilder.ToString(); } private string GetSellItemInvalidMessage() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Error: sell item name is invalid.\n"); stringBuilder.AppendLine("Usage:"); stringBuilder.AppendLine("sell item \n"); stringBuilder.AppendLine("Where is an item name.\n"); stringBuilder.AppendLine("Usage examples:"); stringBuilder.AppendLine(" sell item Whoopie cushion"); stringBuilder.AppendLine(" sell item Whoopie"); stringBuilder.AppendLine(" sell item Whoo\n\n"); return stringBuilder.ToString(); } } internal class SellListCommand : SellCommand { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell", "list")) { return true; } if (MatchesPattern(ref args, "sell-list")) { return true; } return false; } public override TerminalNode Execute(string[] args) { if (!SellCommand.CanUseCommand(out var failReason)) { return failReason; } ScrapToSell scrapToSell = SellManager.GetScrapToSell(ConfigManager.SellListArray, OnlyUseShipInventory()); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found to sell.\n\n"); } SellManager.CreateSellRequest(SellType.List, scrapToSell.TotalScrapValue, scrapToSell.TotalScrapValue, ConfirmationStatus.AwaitingConfirmation, GetScrapEaterIndex(), GetScrapEaterVariantIndex()); base.AwaitingConfirmation = true; string message = GetMessage(scrapToSell); return TerminalHelper.CreateTerminalNode(message); } private string GetMessage(ScrapToSell scrapToSell) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.RealTotalScrapValue}"); stringBuilder.AppendLine(SellCommand.GetQuotaFulfilledString(scrapToSell.RealTotalScrapValue)); stringBuilder.Append(SellCommand.GetOvertimeBonusString(scrapToSell.RealTotalScrapValue)); stringBuilder.AppendLine($"The Company is buying at %{SellCommand.CompanyBuyingRate}\n"); if (ConfigManager.ShowFoundItems.Value) { stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n"); } stringBuilder.AppendLine("Please CONFIRM or DENY.\n\n"); return stringBuilder.ToString(); } } internal class SellQuotaCommand : SellCommand { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "sell", "quota")) { return true; } if (MatchesPattern(ref args, "sell-quota")) { return true; } return false; } public override TerminalNode Execute(string[] args) { if (!SellCommand.CanUseCommand(out var failReason)) { return failReason; } int profitQuota = TimeOfDay.Instance.profitQuota; int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; int num = profitQuota - quotaFulfilled; if (num <= 0) { return TerminalHelper.CreateTerminalNode("Quota has already been fulfilled.\n\n"); } ScrapToSell scrapToSell = SellManager.GetScrapToSell(new SellCommandRequest(num) { OnlyUseShipInventory = OnlyUseShipInventory(), ScrapMatchAlgorithm = GetScrapMatchAlgorithm() }); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found to sell.\n\n"); } SellManager.CreateSellRequest(SellType.Quota, scrapToSell.TotalScrapValue, num, ConfirmationStatus.AwaitingConfirmation, GetScrapEaterIndex(), GetScrapEaterVariantIndex()); base.AwaitingConfirmation = true; string message = GetMessage(scrapToSell, num); return TerminalHelper.CreateTerminalNode(message); } private string GetMessage(ScrapToSell scrapToSell, int requestedValue) { string arg = ((scrapToSell.RealTotalScrapValue >= requestedValue) ? "green" : "red"); string value = $"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.RealTotalScrapValue}"; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(value); stringBuilder.AppendLine(SellCommand.GetQuotaFulfilledString(scrapToSell.RealTotalScrapValue)); stringBuilder.Append(SellCommand.GetOvertimeBonusString(scrapToSell.RealTotalScrapValue)); stringBuilder.AppendLine($"The Company is buying at %{SellCommand.CompanyBuyingRate}\n"); if (ConfigManager.ShowFoundItems.Value) { stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n"); } stringBuilder.AppendLine("Please CONFIRM or DENY.\n\n"); return stringBuilder.ToString(); } } internal class ViewAllScrapCommand : Command { private List _scrapItems = new List(); private int _itemsPerPage = 50; private int _pages; private int _pageIndex; public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "view", "all", "scrap")) { return true; } if (MatchesPattern(ref args, "sell-all-scrap")) { return true; } return false; } public override TerminalNode Execute(string[] args) { _scrapItems = ScrapHelper.GetAllScrapItems(); _pages = Mathf.CeilToInt((float)_scrapItems.Count / (float)_itemsPerPage); _pageIndex = 0; string message = GetMessage(); Logger.LogInfo("\n\n" + ScrapHelper.GetScrapItemMessage(_scrapItems) + "\n"); base.AwaitingConfirmation = true; return TerminalHelper.CreateTerminalNode(message); } public override TerminalNode ExecuteConfirmation(string[] args) { string[] source = new string[6] { "exit", "quit", "q", "close", "leave", "back" }; if (source.Contains(args[0].ToLower())) { base.AwaitingConfirmation = false; return TerminalHelper.CreateTerminalNode("Closed view all scrap.\n\n"); } if ("next".Contains(args[0], StringComparison.OrdinalIgnoreCase)) { _pageIndex++; _pageIndex = Mathf.Clamp(_pageIndex, 0, _pages - 1); return TerminalHelper.CreateTerminalNode(GetMessage()); } if ("previous".Contains(args[0], StringComparison.OrdinalIgnoreCase)) { _pageIndex--; _pageIndex = Mathf.Clamp(_pageIndex, 0, _pages - 1); return TerminalHelper.CreateTerminalNode(GetMessage()); } if (!"page".Contains(args[0], StringComparison.OrdinalIgnoreCase)) { return TerminalHelper.CreateTerminalNode(GetMessage("Error: invalid command.\n\n")); } if (!int.TryParse(args[1], out var result)) { return TerminalHelper.CreateTerminalNode(GetMessage("Error: invalid page number.\n\n")); } result = Mathf.Clamp(result, 1, _pages); _pageIndex = result - 1; return TerminalHelper.CreateTerminalNode(GetMessage()); } private string GetMessage(string additionMessage = "") { int num = _pageIndex * _itemsPerPage; int columns = 2; int count = Mathf.Min(_scrapItems.Count - num, _itemsPerPage); List range = _scrapItems.GetRange(num, count); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {_scrapItems.Count} total items from all moons. (Page {_pageIndex + 1} / {_pages})\n"); stringBuilder.AppendLine(ScrapHelper.GetScrapItemMessage(range, columns, 26) + "\n"); stringBuilder.AppendLine("The following commands are available:\n"); stringBuilder.AppendLine("page "); stringBuilder.AppendLine("next"); stringBuilder.AppendLine("prev"); stringBuilder.AppendLine("exit\n"); stringBuilder.Append(additionMessage); return stringBuilder.ToString(); } } internal class ViewConfigCommand : Command { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "view", "config")) { return true; } if (MatchesPattern(ref args, "view-config")) { return true; } return false; } public override TerminalNode Execute(string[] args) { return TerminalHelper.CreateTerminalNode("The SellMyScrap config viewer has been removed. Please use the LethalConfig mod to view the config settings in-game.\n\n"); } } internal class ViewOvertimeCommand : Command { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "overtime")) { return true; } if (MatchesPattern(ref args, "overtime", "bonus")) { return true; } if (MatchesPattern(ref args, "overtime-bonus")) { return true; } if (MatchesPattern(ref args, "view", "overtime")) { return true; } if (MatchesPattern(ref args, "view-overtime")) { return true; } if (MatchesPattern(ref args, "view", "overtime", "bonus")) { return true; } if (MatchesPattern(ref args, "view-overtime-bonus")) { return true; } if (MatchesPattern(ref args, "view", "overtimebonus")) { return true; } if (MatchesPattern(ref args, "view-overtimebonus")) { return true; } return false; } public override TerminalNode Execute(string[] args) { int overtimeBonus = Utils.GetOvertimeBonus(0); int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; int profitQuota = TimeOfDay.Instance.profitQuota; int num = TerminalHelper.Instance.groupCredits + overtimeBonus; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Your current overtime bonus is ${overtimeBonus}"); stringBuilder.AppendLine($"Quota fulfilled: ${quotaFulfilled} / ${profitQuota}"); stringBuilder.AppendLine($"Your new total credits will be ${num}\n\n"); return TerminalHelper.CreateTerminalNode(stringBuilder.ToString()); } } internal class ViewScrapCommand : Command { public override bool IsCommand(ref string[] args) { if (MatchesPattern(ref args, "view", "scrap")) { return true; } if (MatchesPattern(ref args, "view-scrap")) { return true; } return false; } public override TerminalNode Execute(string[] args) { ScrapToSell scrapToSell = new ScrapToSell(ScrapHelper.GetAllScrap(onlyAllowedScrap: false, OnlyUseShipInventory(), includeScrapWorthZero: true)); if (scrapToSell.ItemCount == 0) { return TerminalHelper.CreateTerminalNode("No items found.\n\n"); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Found {scrapToSell.ItemCount} items with a total value of ${scrapToSell.TotalScrapValue}\n"); stringBuilder.AppendLine(ScrapHelper.GetScrapMessage(scrapToSell.ItemDataList) + "\n\n"); return TerminalHelper.CreateTerminalNode(stringBuilder.ToString()); } private bool OnlyUseShipInventory() { if (!ShipInventoryProxy.Enabled) { return false; } if (HasFlag("inv")) { return true; } if (HasFlag("inventory")) { return true; } if (HasFlag("shipinv")) { return true; } if (HasFlag("shipinventory")) { return true; } return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace com.github.zehsteam.SellMyScrap.v40-v72.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }