Decompiled source of SellMyScrap KR Patch v1.0.0
com.github.zehsteam.SellMyScrap.dll
Decompiled 5 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using 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 Newtonsoft.Json; using Newtonsoft.Json.Linq; using ShipInventory; using ShipInventory.Helpers; using ShipInventory.Objects; using Steamworks; using TMPro; 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.Patches; using com.github.zehsteam.SellMyScrap.Helpers; using com.github.zehsteam.SellMyScrap.Helpers.ScrapMatchAlgorithms; using com.github.zehsteam.SellMyScrap.MonoBehaviours; using com.github.zehsteam.SellMyScrap.NetcodePatcher; using com.github.zehsteam.SellMyScrap.Patches; using com.github.zehsteam.SellMyScrap.ScrapEaters; using com.github.zehsteam.TakeyPlush; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.zehsteam.SellMyScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds a few terminal commands to sell your scrap from the ship. Highly Configurable. Compatible with the ShipInventory mod. SellFromTerminal +")] [assembly: AssemblyFileVersion("1.11.1.0")] [assembly: AssemblyInformationalVersion("1.11.1+858b806bea8f2cad1aae27fcdcddc654d145a7d9")] [assembly: AssemblyProduct("SellMyScrap")] [assembly: AssemblyTitle("com.github.zehsteam.SellMyScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.11.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 class ConfigManager { public ConfigEntry<bool> ExtendedLogging { get; private set; } public SyncedConfigEntry<bool> SellGifts { get; private set; } public SyncedConfigEntry<bool> SellShotguns { get; private set; } public SyncedConfigEntry<bool> SellAmmo { get; private set; } public SyncedConfigEntry<bool> SellKnives { get; private set; } public SyncedConfigEntry<bool> SellPickles { get; private set; } public SyncedConfigEntry<bool> SellScrapWorthZero { get; private set; } public SyncedConfigEntry<bool> OnlySellScrapOnFloor { get; private set; } public SyncedConfigEntry<string> PrioritySellList { get; private set; } public SyncedConfigEntry<string> DontSellList { get; private set; } public SyncedConfigEntry<string> SellList { get; private set; } public string[] PrioritySellListArray { get { return Utils.StringToArray<string>(PrioritySellList.Value); } set { PrioritySellList.Value = Utils.ArrayToString(value); } } public string[] DontSellListArray { get { return Utils.StringToArray<string>(DontSellList.Value); } set { DontSellList.Value = Utils.ArrayToString(value); } } public string[] SellListArray { get { return Utils.StringToArray<string>(SellList.Value); } set { SellList.Value = Utils.ArrayToString(value); } } public ConfigEntry<bool> OverrideWelcomeMessage { get; private set; } public ConfigEntry<bool> OverrideHelpMessage { get; private set; } public ConfigEntry<bool> ShowFoundItems { get; private set; } public ConfigEntry<bool> SortFoundItemsPrice { get; private set; } public ConfigEntry<bool> AlignFoundItemsPrice { get; private set; } public ConfigEntry<bool> SpeakInShip { get; private set; } public ConfigEntry<float> RareVoiceLineChance { get; private set; } public ConfigEntry<bool> ShowQuotaWarning { get; private set; } public ConfigEntry<int> ScrapEaterChance { get; private set; } public ConfigEntry<int> OctolarSpawnWeight { get; private set; } public ConfigEntry<int> TakeySpawnWeight { get; private set; } public ConfigEntry<int> MaxwellSpawnWeight { get; private set; } public ConfigEntry<int> YippeeSpawnWeight { get; private set; } public ConfigEntry<int> CookieFumoSpawnWeight { get; private set; } public ConfigEntry<int> PsychoSpawnWeight { get; private set; } public ConfigEntry<int> ZombiesSpawnWeight { get; private set; } public ConfigEntry<int> WolfySpawnWeight { get; private set; } public ConfigManager() { BindConfigs(); MigrateOldConfigSettings(); ConfigHelper.ClearUnusedEntries(); } private 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<float>(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", 75, requiresRestart: false, "The percent chance a scrap eater will spawn?!", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); OctolarSpawnWeight = ConfigHelper.Bind("Scrap Eater", "OctolarSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Octolar will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); TakeySpawnWeight = ConfigHelper.Bind("Scrap Eater", "TakeySpawnWeight", 1, requiresRestart: false, "The spawn chance weight Takey will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); MaxwellSpawnWeight = ConfigHelper.Bind("Scrap Eater", "MaxwellSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Maxwell will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); YippeeSpawnWeight = ConfigHelper.Bind("Scrap Eater", "YippeeSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Yippee will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(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<int>(0, 100)); PsychoSpawnWeight = ConfigHelper.Bind("Scrap Eater", "PsychoSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Psycho will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); ZombiesSpawnWeight = ConfigHelper.Bind("Scrap Eater", "ZombiesSpawnWeight", 1, requiresRestart: false, "The spawn chance weight Zombies will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); WolfySpawnWeight = ConfigHelper.Bind("Scrap Eater", "WolfySpawnWeight", 1, requiresRestart: false, "The spawn chance weight Wolfy will spawn?! (scrap eater)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100)); } private 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 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 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(); } private void MigrateOldConfigSettings() { foreach (KeyValuePair<ConfigDefinition, string> orphanedConfigEntry in ConfigHelper.GetOrphanedConfigEntries()) { MigrateOldConfigSetting(orphanedConfigEntry.Key.Section, orphanedConfigEntry.Key.Key, orphanedConfigEntry.Value); } } private void MigrateOldConfigSetting(string section, string key, string value) { StringComparison comparisonType = StringComparison.OrdinalIgnoreCase; if (section.Equals("Sell Settings", comparisonType)) { if (key.Equals("SellGifts", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellGifts, value); return; } if (key.Equals("SellShotguns", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellShotguns, value); return; } if (key.Equals("SellAmmo", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellAmmo, value); return; } if (key.Equals("SellKnives", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellKnives, value); return; } if (key.Equals("SellPickles", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellPickles, value); return; } } if (section.Equals("Advanced Sell Settings", comparisonType)) { if (key.Equals("SellScrapWorthZero", comparisonType)) { ConfigHelper.SetConfigEntryValue(SellScrapWorthZero, value); return; } if (key.Equals("OnlySellScrapOnFloor", comparisonType)) { ConfigHelper.SetConfigEntryValue(OnlySellScrapOnFloor, value); return; } if (Utils.StringEquals(key, new string[2] { "PrioritySellList", "PrioritySellListJson" }, matchCase: false)) { ConfigHelper.SetConfigEntryValue(PrioritySellList, value.Replace("\\", "")); } if (Utils.StringEquals(key, new string[2] { "DontSellList", "DontSellListJson" }, matchCase: false)) { ConfigHelper.SetConfigEntryValue(DontSellList, value.Replace("\\", "")); } if (Utils.StringEquals(key, new string[2] { "SellList", "SellListJson" }, matchCase: false)) { ConfigHelper.SetConfigEntryValue(SellList, value.Replace("\\", "")); } } if (section.Equals("Terminal Settings", comparisonType)) { if (key.Equals("OverrideWelcomeMessage", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(OverrideWelcomeMessage, value); return; } if (key.Equals("OverrideHelpMessage", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(OverrideHelpMessage, value); return; } if (key.Equals("ShowFoundItems", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(ShowFoundItems, value); return; } if (key.Equals("SortFoundItemsPrice", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(SortFoundItemsPrice, value); return; } if (key.Equals("AlignFoundItemsPrice", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(AlignFoundItemsPrice, value); return; } } if (section.Equals("Misc Settings", comparisonType)) { if (key.Equals("SpeakInShip", comparisonType)) { ConfigHelper.SetConfigEntryValue<bool>(SpeakInShip, value); return; } if (key.Equals("RareVoiceLineChance", comparisonType)) { ConfigHelper.SetConfigEntryValue<float>(RareVoiceLineChance, value); return; } } if (section.Equals("Scrap Eater Settings", comparisonType)) { if (key.Equals("ScrapEaterChance", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(ScrapEaterChance, value); } else if (key.Equals("OctolarSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(OctolarSpawnWeight, value); } else if (key.Equals("TakeySpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(TakeySpawnWeight, value); } else if (key.Equals("MaxwellSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(MaxwellSpawnWeight, value); } else if (key.Equals("YippeeSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(YippeeSpawnWeight, value); } else if (key.Equals("CookieFumoSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(CookieFumoSpawnWeight, value); } else if (key.Equals("PsychoSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(PsychoSpawnWeight, value); } else if (key.Equals("ZombiesSpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(ZombiesSpawnWeight, value); } else if (key.Equals("WolfySpawnWeight", comparisonType)) { ConfigHelper.SetConfigEntryValue<int>(WolfySpawnWeight, value); } } } internal void TrySetCustomValues() { if (!SteamUtils.IsLocalClient(PlayerName.Insym)) { TrySetCustomValuesForThorlar(); TrySetCustomValuesForTakerst(); if (ScrapEaterChance.Value == 0 && DontSellListArray.Length == 1 && DontSellListArray[0].Equals("gold bar", StringComparison.OrdinalIgnoreCase) && !SaveHelper.LoadValue("ResetScrapEaterChance", SaveLocation.Modpack, defaultValue: false)) { ScrapEaterChance.Value = (int)((ConfigEntryBase)ScrapEaterChance).DefaultValue; SaveHelper.SaveValue("ResetScrapEaterChance", value: true, SaveLocation.Modpack); } } } private void TrySetCustomValuesForThorlar() { if (SteamUtils.IsLocalClient(PlayerName.Thorlar) && TakeySpawnWeight.Value > 0 && !SaveHelper.LoadValue("RemovedTakeyScrapEaterSpawnWeight", SaveLocation.Modpack, defaultValue: false)) { TakeySpawnWeight.Value = 0; SaveHelper.SaveValue("RemovedTakeyScrapEaterSpawnWeight", value: true, SaveLocation.Modpack); } } private void TrySetCustomValuesForTakerst() { if (SteamUtils.IsLocalClient(PlayerName.Takerst)) { if (!Utils.ArrayContains(DontSellListArray, "Smol Takey")) { List<string> list = DontSellListArray.ToList(); list.Add("Smol Takey"); DontSellListArray = list.ToArray(); } if (!Utils.ArrayContains(DontSellListArray, "Takey Box")) { List<string> list2 = DontSellListArray.ToList(); list2.Add("Takey Box"); DontSellListArray = list2.ToArray(); } if (!Utils.ArrayContains(DontSellListArray, "Takey Mug")) { List<string> list3 = DontSellListArray.ToList(); list3.Add("Takey Mug"); DontSellListArray = list3.ToArray(); } } } } internal static class Content { 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 AudioClip BrainRotIntroSpeechSFX { get; private set; } public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { AssetBundle val = LoadAssetBundle("sellmyscrap_assets"); if (!((Object)(object)val == (Object)null)) { NetworkHandlerPrefab = LoadAssetFromAssetBundle<GameObject>("NetworkHandler", val); NetworkHandlerPrefab.AddComponent<PluginNetworkBehaviour>(); OctolarScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("OctolarScrapEater", val); TakeyScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("TakeyScrapEater", val); MaxwellScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("MaxwellScrapEater", val); YippeeScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("YippeeScrapEater", val); CookieFumoScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("CookieFumoScrapEater", val); PsychoScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("PsychoScrapEater", val); ZombiesScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("ZombiesScrapEater", val); WolfyScrapEaterPrefab = LoadAssetFromAssetBundle<GameObject>("WolfyScrapEater", val); BrainRotIntroSpeechSFX = LoadAssetFromAssetBundle<AudioClip>("BrainRotIntroSpeechSFX", val); Plugin.Logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } } private static AssetBundle LoadAssetBundle(string fileName) { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, fileName); return AssetBundle.LoadFromFile(text); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to load AssetBundle \"{fileName}\". {arg}"); } return null; } private static T LoadAssetFromAssetBundle<T>(string name, AssetBundle assetBundle) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Plugin.Logger.LogError((object)("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) { Plugin.Logger.LogError((object)("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null.")); return default(T); } T val = assetBundle.LoadAsset<T>(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)("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; } } public static class NetworkUtils { public static bool IsConnected { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsConnectedClient; } } public static bool IsServer { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsServer; } } public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } public static NetworkObjectReference[] GetNetworkObjectReferences(List<GrabbableObject> grabbableObjects) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (grabbableObjects == null || grabbableObjects.Count == 0) { return Array.Empty<NetworkObjectReference>(); } List<NetworkObjectReference> list = new List<NetworkObjectReference>(); NetworkObject val = default(NetworkObject); foreach (GrabbableObject grabbableObject in grabbableObjects) { if (((Component)grabbableObject).TryGetComponent<NetworkObject>(ref val)) { list.Add(NetworkObjectReference.op_Implicit(val)); } } return list.ToArray(); } public static List<GrabbableObject> GetGrabbableObjects(NetworkObjectReference[] networkObjectReferences) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (networkObjectReferences == null || networkObjectReferences.Length == 0) { return new List<GrabbableObject>(); } List<GrabbableObject> list = new List<GrabbableObject>(); 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<GrabbableObject>(ref item)) { list.Add(item); } } return list; } } internal static class PlayerUtils { 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 bool IsLocalPlayer(PlayerName playerName) { return SteamUtils.IsLocalClient(playerName); } public static bool IsLocalPlayer(params PlayerName[] playerNames) { foreach (PlayerName playerName in playerNames) { if (SteamUtils.IsLocalClient(playerName)) { return true; } } return false; } public static bool IsPlayer(PlayerControllerB playerScript, PlayerName playerName) { if ((Object)(object)playerScript == (Object)null) { return false; } return SteamUtils.IsPlayer(playerName, playerScript.playerUsername, playerScript.playerSteamId); } public static bool HasPlayer(PlayerName playerName) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB playerScript in allPlayerScripts) { if (IsPlayer(playerScript, playerName)) { return true; } } return false; } public static bool HasPlayer(params PlayerName[] playerNames) { foreach (PlayerName playerName in playerNames) { if (HasPlayer(playerName)) { return true; } } return false; } public static PlayerControllerB GetPlayerScript(PlayerName playerName) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayer(val, playerName)) { return val; } } return null; } 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) { StartOfRound.Instance.allowLocalPlayerDeath = enabled; } public static void ReviveDeadPlayersAfterTime(float time) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ReviveDeadPlayersAfterTimeCO(time)); } private static IEnumerator ReviveDeadPlayersAfterTimeCO(float time) { yield return (object)new WaitForSeconds(time); if (AreAllPlayersDead()) { StartOfRound.Instance.ReviveDeadPlayers(); } } } [BepInPlugin("com.github.zehsteam.SellMyScrap", "SellMyScrap", "1.11.1")] [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"); internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static ConfigManager ConfigManager { get; private set; } public ScrapToSell ScrapToSell { get; private set; } public SellRequest SellRequest { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = Logger.CreateLogSource("com.github.zehsteam.SellMyScrap"); Logger.LogInfo((object)"SellMyScrap 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); } ConfigManager = new ConfigManager(); Content.Load(); 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) { Logger.LogWarning((object)("Failed to invoke method " + methodInfo.Name + ": " + ex.Message)); } } } catch (Exception ex2) { Logger.LogWarning((object)("Error processing method " + methodInfo.Name + " in type " + type.Name + ": " + ex2.Message)); } } } } catch (Exception ex3) { Logger.LogError((object)("An error occurred in NetcodePatcherAwake: " + ex3.Message)); } } public void OnLocalDisconnect() { CommandManager.OnLocalDisconnect(); CancelSellRequest(); } public void OnTerminalQuit() { CommandManager.OnTerminalQuit(); CancelSellRequest(); } public ScrapToSell GetScrapToSell(SellCommandRequest sellRequest) { ScrapToSell = ScrapHelper.GetScrapToSell(sellRequest); return ScrapToSell; } public ScrapToSell GetScrapToSell(string[] sellList, bool onlyUseShipInventory = false) { ScrapToSell = ScrapHelper.GetScrapToSell(sellList); return ScrapToSell; } public ScrapToSell SetScrapToSell(List<ItemData> items) { ScrapToSell = new ScrapToSell(items); return ScrapToSell; } public 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((object)text); } public void ConfirmSellRequest() { if (ScrapToSell != null && SellRequest != null) { SellRequest.ConfirmationStatus = ConfirmationStatus.Confirmed; Logger.LogInfo((object)$"Attempting to sell {ScrapToSell.ItemCount} items for ${ScrapToSell.TotalScrapValue}."); if (NetworkUtils.IsServer) { ConfirmSellRequestOnServer(); } else { ConfirmSellRequestOnClient(); } SellRequest = null; } } private void ConfirmSellRequestOnServer() { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(PerformSellOnServer()); } private void ConfirmSellRequestOnClient() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) PluginNetworkBehaviour.Instance.PerformSellServerRpc(ScrapToSell, SellRequest.SellType, SellRequest.ScrapEaterIndex); } public void CancelSellRequest() { SellRequest = null; ScrapToSell = null; } public 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(); } public IEnumerator PerformSellOnServer() { if (ScrapToSell == null || SellRequest == null) { yield return null; } if (SellRequest.ConfirmationStatus != ConfirmationStatus.Confirmed) { yield return null; } if ((Object)(object)DepositItemsDeskHelper.Instance == (Object)null) { Logger.LogError((object)"Could not find depositItemsDesk. Are you landed at The Company building?"); yield break; } int scrapEaterIndex = SellRequest.ScrapEaterIndex; int scrapEaterVariantIndex = SellRequest.ScrapEaterVariantIndex; List<GrabbableObject> grabbableObjects = ScrapToSell.GrabbableObjects; if (ShipInventoryProxy.Enabled && ScrapToSell.ShipInventoryItems.Length != 0) { ShipInventoryProxy.SpawnItemsOnServer(ScrapToSell.ShipInventoryItems); yield return (object)new WaitUntil((Func<bool>)(() => !ShipInventoryProxy.IsSpawning)); if (ShipInventoryProxy.SpawnItemsStatus == SpawnItemsStatus.Success) { grabbableObjects.AddRange(ShipInventoryProxy.GetSpawnedGrabbableObjects()); ShipInventoryProxy.ClearSpawnedGrabbableObjectsCache(); } else { if (ShipInventoryProxy.SpawnItemsStatus == SpawnItemsStatus.Failed) { HUDManager.Instance.DisplayTip("SellMyScrap", "Failed to spawn items from ShipInventory!", true, false, "LC_Tip1"); yield break; } if (ShipInventoryProxy.SpawnItemsStatus == SpawnItemsStatus.Busy) { HUDManager.Instance.DisplayTip("SellMyScrap", "Failed to spawn items from ShipInventory! Chute is busy.", true, false, "LC_Tip1"); yield break; } } } if (!StartOfRound.Instance.shipIsLeaving) { if (scrapEaterIndex == -1) { ScrapEaterManager.StartRandomScrapEaterOnServer(grabbableObjects, scrapEaterVariantIndex); yield break; } if (scrapEaterIndex > -1 && ScrapEaterManager.HasScrapEater(scrapEaterIndex)) { ScrapEaterManager.StartScrapEaterOnServer(scrapEaterIndex, grabbableObjects, scrapEaterVariantIndex); yield break; } if (ScrapEaterManager.CanUseScrapEater()) { ScrapEaterManager.StartRandomScrapEaterOnServer(grabbableObjects, scrapEaterVariantIndex); yield break; } } DepositItemsDeskHelper.PlaceItemsOnCounter(grabbableObjects); PluginNetworkBehaviour.Instance.PlaceItemsOnCounterClientRpc(NetworkUtils.GetNetworkObjectReferences(grabbableObjects)); yield return (object)new WaitForSeconds(0.5f); DepositItemsDeskHelper.SellItems_Server(); ScrapToSell = null; } public void LogInfoExtended(object data) { LogExtended((LogLevel)16, data); } public void LogWarningExtended(object data) { LogExtended((LogLevel)4, data); } public void LogExtended(LogLevel level, object data) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (ConfigManager == null || ConfigManager.ExtendedLogging == null) { Logger.Log(level, data); } else if (ConfigManager.ExtendedLogging.Value) { Logger.Log(level, data); } } } internal enum PlayerName { CritHaxXoG, Takerst, Insym, Thorlar, PsychoHypnotic, Magoroku, ZombiesAteMyChannel, WolfsMyChocolate, Hiccubz, Lunxara, PANDAM0NIEM, Jxshkins, SpookyTug, Raqaizal, MaestroSpooks, VanoraDarkWolf, TetraFlash, XSuperBeefyx, Ariesgoddess168, LustStings, TIMETELL, IElucian, Irishdev13, Oopsmyleg, Reapermitsuki, Yinisin, AGlitchedNpc } internal static class SteamUtils { public static List<PlayerData> PlayersData { get; private set; } static SteamUtils() { PlayersData = new List<PlayerData>(); PlayersData = new List<PlayerData>(27) { new PlayerData(PlayerName.CritHaxXoG, "CritHaxXoG", 76561198993712632uL), new PlayerData(PlayerName.Takerst, "Takerst", 76561197980238122uL), new PlayerData(PlayerName.Insym, "Insym", 76561198008109303uL), new PlayerData(PlayerName.Thorlar, "Thorlar", 76561197964616102uL), new PlayerData(PlayerName.PsychoHypnotic, "PsychoHypnotic", 76561197970440803uL), new PlayerData(PlayerName.Magoroku, "Magoroku", 76561197982837475uL), new PlayerData(PlayerName.ZombiesAteMyChannel, "ZombieAteMyChannel", 76561197990822861uL), new PlayerData(PlayerName.WolfsMyChocolate, new string[2] { "WolfsMyChocolate", "wolfyfook" }, new ulong[2] { 76561199112488706uL, 76561199589529626uL }), new PlayerData(PlayerName.Hiccubz, "Hiccubz", 76561199090697084uL), new PlayerData(PlayerName.Lunxara, "Lunxara", 76561198086325047uL), new PlayerData(PlayerName.PANDAM0NIEM, "PANDAM0NIEM", 76561199169070660uL), new PlayerData(PlayerName.Jxshkins, "jxshkins", 76561199004549621uL), new PlayerData(PlayerName.SpookyTug, "SpookyTug", 76561198053549767uL), new PlayerData(PlayerName.Raqaizal, "Raqaizal", 76561198047992629uL), new PlayerData(PlayerName.MaestroSpooks, "MaestroSpooks", 76561198150757587uL), new PlayerData(PlayerName.VanoraDarkWolf, "Vanora", 76561198064529684uL), new PlayerData(PlayerName.TetraFlash, "TetraFlash", 76561197993458924uL), new PlayerData(PlayerName.XSuperBeefyx, "xSuperBeefyx", 76561197964982016uL), new PlayerData(PlayerName.Ariesgoddess168, "NewAgeAries", 76561198174632877uL), new PlayerData(PlayerName.LustStings, "lustings", 76561198053068793uL), new PlayerData(PlayerName.TIMETELL, "TIMETELL", 76561197967817500uL), new PlayerData(PlayerName.IElucian, "iElucian", 76561197962979730uL), new PlayerData(PlayerName.Irishdev13, "TTV_Irishdev13", 76561198123000350uL), new PlayerData(PlayerName.Oopsmyleg, "Oopsmyleg", 76561198113371889uL), new PlayerData(PlayerName.Reapermitsuki, "reaper-mitsuki", 76561198281494776uL), new PlayerData(PlayerName.Yinisin, "Yinisin", 76561199582073183uL), new PlayerData(PlayerName.AGlitchedNpc, "a glitched npc", 76561198984467725uL) }; } public static bool IsPlayer(PlayerName playerName, string username, ulong steamId) { return GetPlayerData(playerName)?.IsPlayer(username, steamId) ?? false; } public static PlayerData GetLocalClientPlayerData() { foreach (PlayerData playersDatum in PlayersData) { if (playersDatum.IsLocalClient()) { return playersDatum; } } return null; } public static PlayerData GetPlayerData(PlayerName playerName) { foreach (PlayerData playersDatum in PlayersData) { if (playersDatum.PlayerName == playerName) { return playersDatum; } } return null; } public static bool IsLocalClient(PlayerName playerName) { return GetPlayerData(playerName)?.IsLocalClient() ?? false; } public static bool IsLocalClient(string username, ulong steamId) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { return false; } if (!SteamClient.IsLoggedOn) { return false; } if (SteamClient.Name.Equals(username, StringComparison.OrdinalIgnoreCase)) { return true; } if (SteamId.op_Implicit(SteamClient.SteamId) == steamId) { return true; } return false; } } internal class PlayerData { public PlayerName PlayerName { get; private set; } public string[] Username { get; private set; } public ulong[] SteamId { get; private set; } public PlayerData(PlayerName playerName, string username, ulong steamId) { PlayerName = playerName; Username = new string[1] { username }; SteamId = new ulong[1] { steamId }; } public PlayerData(PlayerName playerName, string[] username, ulong[] steamId) { PlayerName = playerName; Username = username; SteamId = steamId; } public bool IsLocalClient() { for (int i = 0; i < Username.Length; i++) { if (SteamUtils.IsLocalClient(Username[i], SteamId[i])) { return true; } } return false; } public bool IsPlayer(string username, ulong steamId) { for (int i = 0; i < Username.Length; i++) { if (Username[i].Equals(username, StringComparison.OrdinalIgnoreCase)) { return true; } if (SteamId[i] == steamId) { return true; } } return false; } } internal static class Utils { public static string GetEnumName<T>(T e) where T : Enum { return Enum.GetName(typeof(T), e) ?? string.Empty; } public static string GetPluginDirectoryPath() { return Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); } public static string GetConfigDirectoryPath() { return Paths.ConfigPath; } public static string GetGlobalConfigDirectoryPath() { return Path.Combine(Application.persistentDataPath, "SellMyScrap"); } public static ConfigFile CreateConfigFile(string directoryPath, string name = null, bool saveOnInit = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown BepInPlugin metadata = MetadataHelper.GetMetadata((object)Plugin.Instance); if (name == null) { name = metadata.GUID; } name += ".cfg"; return new ConfigFile(Path.Combine(directoryPath, name), saveOnInit, metadata); } public static ConfigFile CreateLocalConfigFile(string name = null, bool saveOnInit = false) { if (name == null) { name = "com.github.zehsteam.SellMyScrap-" + name; } return CreateConfigFile(Paths.ConfigPath, name, saveOnInit); } public static ConfigFile CreateGlobalConfigFile(string name = null, bool saveOnInit = false) { if (name == null) { name = "global"; } return CreateConfigFile(GetGlobalConfigDirectoryPath(), name, saveOnInit); } public static bool RandomPercent(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f <= percent; } public static string GetStringWithSpacingInBetween(string a, string b, int maxLength) { return a + new string(' ', maxLength - a.Length) + " " + b; } public static string GetLongestStringFromArray(string[] array) { string text = string.Empty; foreach (string text2 in array) { if (text2.Length > text.Length) { text = text2; } } return text; } public static string[] GetArrayToLower(string[] array) { return array.Select((string x) => x.ToLower()).ToArray(); } public static string GetItemFromList(List<string> list, string item) { foreach (string item2 in list) { if (item2.ToLower() == item.ToLower()) { return item2; } } return string.Empty; } 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) 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<GameObject>(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 val4 = 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 val3; if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); val3 = ((Component)val2).transform.position - explosionPosition; Vector3 normalized = ((Vector3)(ref val3)).normalized; if (((Component)val2).TryGetComponent<Rigidbody>(ref val4)) { val4.AddForce(normalized * 500f); } Vector3 val5 = Vector3.Normalize((((Component)val2).transform.position + Vector3.up * 0.75f - explosionPosition) * 100f) * 30f; val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, val5); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Plugin.Instance.LogInfoExtended("Setting off other mine"); ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { EnemyAI mainScript = componentInChildren2.mainScript; val3 = default(Vector3); mainScript.HitEnemyOnLocalClient(enemyHitForce, val3, attacker, false, -1); componentInChildren2.mainScript.HitFromExplosion(num2); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); Rigidbody val6 = default(Rigidbody); for (int j = 0; j < array.Length; j++) { if (((Component)array[j]).TryGetComponent<Rigidbody>(ref val6)) { val6.AddExplosionForce(70f, explosionPosition, 10f); } } } public static int GetRandomIndexFromWeightList(List<int> weightList) { List<(int, int)> list = new List<(int, int)>(); for (int i = 0; i < weightList.Count; i++) { int num = weightList[i]; if (num > 0) { list.Add((i, num)); } } int num2 = 0; foreach (var item4 in list) { int item = item4.Item2; num2 += item; } if (num2 == 0) { return -1; } int num3 = Random.Range(0, num2); int num4 = 0; foreach (var item5 in list) { int item2 = item5.Item1; int item3 = item5.Item2; num4 += item3; if (num3 < num4) { return item2; } } throw new InvalidOperationException("Weights are not properly specified."); } public static List<List<T>> SplitList<T>(List<T> items, int numberOfLists) { List<List<T>> list = new List<List<T>>(); int count = items.Count; int num = Mathf.CeilToInt((float)count / (float)numberOfLists); for (int i = 0; i < numberOfLists; i++) { List<T> range = items.GetRange(i * num, Mathf.Min(num, count - i * num)); list.Add(range); } return list; } public static Coroutine StartCoroutine(IEnumerator routine) { if ((Object)(object)Plugin.Instance != (Object)null) { return ((MonoBehaviour)Plugin.Instance).StartCoroutine(routine); } if ((Object)(object)GameNetworkManager.Instance != (Object)null) { return ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(routine); } Plugin.Logger.LogError((object)("Failed to start coroutine. " + routine)); return null; } public static string GetStringWithColor(string text, string colorHex) { return "<color=" + colorHex + ">" + text + "</color>"; } public static bool TryParseValue<T>(string value, out T result) { try { if (typeof(T) == typeof(int) && int.TryParse(value, out var result2)) { result = (T)(object)result2; return true; } if (typeof(T) == typeof(float) && float.TryParse(value, out var result3)) { result = (T)(object)result3; return true; } if (typeof(T) == typeof(double) && double.TryParse(value, out var result4)) { result = (T)(object)result4; return true; } if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result5)) { result = (T)(object)result5; return true; } if (typeof(T) == typeof(string)) { result = (T)(object)value; return true; } } catch { } result = default(T); return false; } public static T[] StringToArray<T>(string value) { if (string.IsNullOrEmpty(value)) { return Array.Empty<T>(); } try { return (from x in value.Split(',') select (T)Convert.ChangeType(x.Trim(), typeof(T))).ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to convert string to array of type {typeof(T)}. \"{value}\". {arg}"); } return Array.Empty<T>(); } public static string ArrayToString<T>(T[] value) { if (value == null || value.Length == 0) { return string.Empty; } return string.Join(", ", value.Select((T x) => x.ToString())); } public static bool StringEquals(string input, string[] values, bool matchCase = true) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (string value in values) { if (input.Equals(value, comparisonType)) { return true; } } return false; } public static bool StringContains(string input, string[] values, bool matchCase = true) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (string value in values) { if (input.Contains(value, comparisonType)) { return true; } } return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.SellMyScrap"; public const string PLUGIN_NAME = "SellMyScrap"; public const string PLUGIN_VERSION = "1.11.1"; } } namespace com.github.zehsteam.SellMyScrap.ScrapEaters { public class ScrapEater { public GameObject SpawnPrefab; public Func<int> GetSpawnWeight; public ScrapEater(GameObject spawnPrefab, Func<int> getSpawnWeight) { SpawnPrefab = spawnPrefab; GetSpawnWeight = getSpawnWeight; } } public static class ScrapEaterManager { public static List<ScrapEater> ScrapEaters { get; private set; } = new List<ScrapEater>(); internal static void Initialize() { ConfigManager configManager = Plugin.ConfigManager; ScrapEaters = new List<ScrapEater>(8) { new ScrapEater(Content.OctolarScrapEaterPrefab, () => configManager.OctolarSpawnWeight.Value), new ScrapEater(Content.TakeyScrapEaterPrefab, () => configManager.TakeySpawnWeight.Value), new ScrapEater(Content.MaxwellScrapEaterPrefab, () => configManager.MaxwellSpawnWeight.Value), new ScrapEater(Content.YippeeScrapEaterPrefab, () => configManager.YippeeSpawnWeight.Value), new ScrapEater(Content.CookieFumoScrapEaterPrefab, () => configManager.CookieFumoSpawnWeight.Value), new ScrapEater(Content.PsychoScrapEaterPrefab, () => configManager.PsychoSpawnWeight.Value), new ScrapEater(Content.ZombiesScrapEaterPrefab, () => configManager.ZombiesSpawnWeight.Value), new ScrapEater(Content.WolfyScrapEaterPrefab, () => configManager.WolfySpawnWeight.Value) }; } internal static bool CanUseScrapEater() { int value = Plugin.ConfigManager.ScrapEaterChance.Value; return Utils.RandomPercent(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<int> GetSpawnWeight) { ScrapEaters.Add(new ScrapEater(spawnPrefab, GetSpawnWeight)); } internal static void StartRandomScrapEaterOnServer(List<GrabbableObject> scrap, int variantIndex = -1) { if (NetworkUtils.IsServer) { int randomScrapEaterIndex = GetRandomScrapEaterIndex(); if (randomScrapEaterIndex != -1) { StartScrapEaterOnServer(randomScrapEaterIndex, scrap, variantIndex); } } } internal static void StartScrapEaterOnServer(int index, List<GrabbableObject> scrap, int variantIndex = -1) { //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) if (NetworkUtils.IsServer) { GameObject spawnPrefab = ScrapEaters[index].SpawnPrefab; GameObject val = Object.Instantiate<GameObject>(spawnPrefab, Vector3.zero, Quaternion.identity); NetworkObject component = val.GetComponent<NetworkObject>(); component.Spawn(true); ScrapEaterBehaviour component2 = val.GetComponent<ScrapEaterBehaviour>(); component2.SetData(scrap, variantIndex); Plugin.Logger.LogInfo((object)$"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<AudioClip> list = new List<AudioClip>(microphoneAudios.Length + rareMicrophoneAudios.Length); list.AddRange(microphoneAudios); list.AddRange(rareMicrophoneAudios); List<AudioClip> list2 = list; if (ClipIndex == -1) { ClipIndex = GetRandomAudioClipIndex(); } AudioClip val = list2[ClipIndex]; __instance.speakerAudio.PlayOneShot(val, 1f); if (SpeakInShip && Plugin.ConfigManager.SpeakInShip.Value) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(val, 1f); } SpeakInShip = false; ClipIndex = -1; return false; } private static int GetRandomAudioClipIndex() { if (Utils.RandomPercent(Plugin.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(Content.NetworkHandlerPrefab); foreach (ScrapEater scrapEater in ScrapEaterManager.ScrapEaters) { AddNetworkPrefab(scrapEater.SpawnPrefab); } } private static void AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Plugin.Logger.LogError((object)"Failed to register network prefab. GameObject is null."); return; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Plugin.Logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab.")); } } [HarmonyPatch(typeof(HUDManager))] internal static class HUDManagerPatch { [HarmonyPatch("DisplayCreditsEarning")] [HarmonyPrefix] [HarmonyPriority(800)] private static bool DisplayCreditsEarningPatch(ref HUDManager __instance, int creditsEarned, GrabbableObject[] objectsSold, int newGroupCredits, ref Coroutine ___scrollRewardTextCoroutine) { Plugin.Logger.LogInfo((object)$"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; } private static IEnumerator ScrollRewardsListText(Scrollbar rewardsScrollbar, float duration = 3f) { yield return (object)new WaitForSeconds(1.5f); float timer = 0f; rewardsScrollbar.value = 1f; for (; timer < duration; timer += Time.deltaTime) { if (timer > duration) { timer = duration; } float percent = 1f / duration * timer; rewardsScrollbar.value = 1f - percent; yield return null; } rewardsScrollbar.value = 0f; } } [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<InteractTrigger>(); DisplayedSellWarning = false; } [HarmonyPatch("BeginHoldingInteractOnLever")] [HarmonyPostfix] private static void BeginHoldingInteractOnLeverPatch(ref StartMatchLever __instance) { if (TimeOfDay.Instance.daysUntilDeadline > 0 || !Plugin.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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { GameObject val = Object.Instantiate<GameObject>(Content.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { Plugin.ConfigManager.TrySetCustomValues(); RemoveMapPropsContainerForTesting(); } private static void RemoveMapPropsContainerForTesting() { GameObject val = GameObject.Find("Environment/MapPropsContainerForTesting"); if (!((Object)(object)val == (Object)null)) { val.SetActive(false); } } [HarmonyPatch("OnClientConnect")] [HarmonyPrefix] private static void OnClientConnectPatch(ref ulong clientId) { if (NetworkUtils.IsServer) { SyncedConfigEntryBase.SendConfigsToClient(clientId); } } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPrefix] private static void OnLocalDisconnectPatch() { Plugin.Instance.OnLocalDisconnect(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { private static bool _hasOverrideTerminalNodes; [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 (Plugin.ConfigManager.OverrideWelcomeMessage.Value) { OverrideWelcomeTerminalNode(terminalNodes); } if (Plugin.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]\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 commands."); terminalNodes.specialNodes[index].displayText = displayText2; } [HarmonyPatch("QuitTerminal")] [HarmonyPostfix] private static void QuitTerminalPatch() { Plugin.Instance.OnTerminalQuit(); } [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.MonoBehaviours { public class CookieFumoScrapEaterBehaviour : ScrapEaterExtraBehaviour { [Space(20f)] [Header("Cookie Fumo")] [Space(5f)] public AudioClip fallSFX; public AudioClip beforeEatSFX; public AudioClip[] voiceLineSFX = Array.Empty<AudioClip>(); 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(3160276146u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, voiceLineIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3160276146u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _voiceLineIndex = voiceLineIndex; } } } protected override IEnumerator StartAnimation() { PlayOneShotSFX(fallSFX); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(spawnPosition, startPosition, 2f)); StopAudioSource(soundEffectsAudio); PlayOneShotSFX(landSFX, landIndex); ShakeCamera(); yield return (object)new WaitForSeconds(1f); PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, endPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(pauseDuration / 2f); yield return (object)new WaitForSeconds(PlayOneShotSFX(beforeEatSFX)); yield return (object)new WaitForSeconds(pauseDuration / 2f); MoveTargetScrapToTargetTransform(mouthTransform, suckDuration - 0.1f); yield return (object)new WaitForSeconds(suckDuration); yield return (object)new WaitForSeconds(PlayOneShotSFX(eatSFX)); yield return (object)new WaitForSeconds(PlayOneShotSFX(voiceLineSFX, _voiceLineIndex)); yield return (object)new WaitForSeconds(pauseDuration / 2f); PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(endPosition, startPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(1f); PlayOneShotSFX(takeOffSFX); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, spawnPosition, 2f)); } 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(3160276146u, new RpcReceiveHandler(__rpc_handler_3160276146)); } private static void __rpc_handler_3160276146(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"; } } public class DestroyAfterTimeBehaviour : MonoBehaviour { public float duration = 5f; private void Start() { ((MonoBehaviour)this).StartCoroutine(DestoryAfterTime()); } private IEnumerator DestoryAfterTime() { yield return (object)new WaitForSeconds(duration); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class MaxwellScrapEaterBehaviour : ScrapEaterExtraBehaviour { [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<AudioClip>(); public AudioClip evilNoise; private bool _isEvil; private int _meowIndex; private bool _isTarget; protected override void Start() { if (NetworkUtils.IsServer) { if (PlayerUtils.HasPlayer(PlayerName.Magoroku, PlayerName.PsychoHypnotic)) { _isEvil = Utils.RandomPercent(80f); } else { _isEvil = Utils.RandomPercent(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(2957132727u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEvil, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, meowIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2957132727u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _isEvil = isEvil; _meowIndex = meowIndex; if (PlayerUtils.IsLocalPlayer(PlayerName.Magoroku) && (Utils.RandomPercent(40f) || (isEvil && Utils.RandomPercent(80f)))) { _isTarget = true; } } } protected override IEnumerator StartAnimation() { SetAnimationIdle(); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(spawnPosition, startPosition, 2f)); PlayOneShotSFX(landSFX, landIndex); PlayOneShotSFX(meowSFX, _meowIndex); ShakeCamera(); yield return (object)new WaitForSeconds(1f); PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, endPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(pauseDuration / 3f); SetAnimationDance(); yield return (object)new WaitForSeconds(pauseDuration / 3f * 2f); if (_isTarget) { ((MonoBehaviour)this).StartCoroutine(MoveLocalPlayerToMaxwell(suckDuration - 0.1f)); } MoveTargetScrapToTargetTransform(mouthTransform, suckDuration - 0.1f); yield return (object)new WaitForSeconds(suckDuration); yield return (object)new WaitForSeconds(PlayOneShotSFX(eatSFX)); yield return (object)new WaitForSeconds(pauseDuration / 3f * 2f); SetAnimationIdle(); yield return (object)new WaitForSeconds(pauseDuration / 3f); if (_isTarget) { PlayerUtils.SetLocalPlayerAllowDeathEnabled(enabled: true); } if (_isEvil) { yield return ((MonoBehaviour)this).StartCoroutine(StartEvilMaxwell()); yield return (object)new WaitForSeconds(3f); yield break; } if (_isTarget) { PlayerUtils.SetLocalPlayerMovementEnabled(enabled: true); } PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(endPosition, startPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(1f); PlayOneShotSFX(takeOffSFX); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, spawnPosition, 2f)); } private IEnumerator MoveLocalPlayerToMaxwell(float duration) { PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript(); _isTarget = true; PlayerUtils.SetLocalPlayerMovementEnabled(enabled: false); PlayerUtils.SetLocalPlayerAllowDeathEnabled(enabled: false); Vector3 startPosition = ((Component)localPlayerScript).transform.position; Vector3 endPosition = mouthTransform.position; endPosition.x += 1f; endPosition.y = ((Component)this).transform.position.y; for (float timer = 0f; timer < duration; timer += Time.deltaTime) { float percent = 1f / duration * timer; Vector3 newPosition = startPosition + (endPosition - startPosition) * percent; ((Component)localPlayerScript).transform.position = newPosition; yield return null; } } private IEnumerator StartEvilMaxwell() { bodyObject.SetActive(false); evilObject.SetActive(true); purrAudio.Stop(); PlayOneShotSFX(evilNoise); yield return (object)new WaitForSeconds(1.25f); if (_isTarget) { PlayerUtils.SetLocalPlayerMovementEnabled(enabled: true); } yield return (object)new WaitForSeconds(0.25f); Vector3 position = ((Component)this).transform.position; position.y += 0.31f; Utils.CreateExplosion(position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3); evilObject.transform.SetParent((Transform)null); evilObject.AddComponent<DestroyAfterTimeBehaviour>().duration = 15f; Rigidbody[] componentsInChildren = evilObject.GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody rb in componentsInChildren) { rb.isKinematic = false; rb.AddExplosionForce(1000f, evilObject.transform.position, 100f); } PlayerUtils.ReviveDeadPlayersAfterTime(5f); } 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(2957132727u, new RpcReceiveHandler(__rpc_handler_2957132727)); } private static void __rpc_handler_2957132727(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<bool>(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 { [Space(20f)] [Header("Octolar")] [Space(5f)] public MeshRenderer meshRenderer; public Material[] materialVariants = Array.Empty<Material>(); 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(897014116u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, materialVariantIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 897014116u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _materialVariantIndex = materialVariantIndex; SetMaterialVariant(materialVariantIndex); } } } protected override IEnumerator StartAnimation() { PlayOneShotSFX(fallSFX); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(spawnPosition, startPosition, 2f)); StopAudioSource(soundEffectsAudio); PlayOneShotSFX(landSFX, landIndex); ShakeCamera(); yield return (object)new WaitForSeconds(1f); PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, endPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(pauseDuration); SetMaterial(suckMaterial); MoveTargetScrapToTargetTransform(mouthTransform, suckDuration); PlayOneShotSFX(suckSFX); yield return (object)new WaitForSeconds(suckDuration); SetMaterialVariant(_materialVariantIndex); yield return (object)new WaitForSeconds(0.1f); yield return (object)new WaitForSeconds(PlayOneShotSFX(eatSFX)); yield return (object)new WaitForSeconds(PlayOneShotSFX(afterEatSFX)); yield return (object)new WaitForSeconds(pauseDuration); PlayAudioSource(movementAudio); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(endPosition, startPosition, movementDuration)); StopAudioSource(movementAudio); yield return (object)new WaitForSeconds(1f); PlayOneShotSFX(takeOffSFX); yield return ((MonoBehaviour)this).StartCoroutine(MoveToPosition(startPosition, spawnPosition, 2f)); } 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(897014116u, new RpcReceiveHandler(__rpc_handler_897014116)); } private static void __rpc_handler_897014116(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; } } [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(3195794390u, clientRpcParams, (RpcDelivery)0); bool flag = section != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(section, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(key, false); } bool flag3 = value != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(value, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3195794390u, 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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(2639481324u, serverRpcParams, (RpcDelivery)0); bool flag = scrapToSell != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<ScrapToSell>(ref scrapToSell, default(ForNetworkSerializable)); } ((FastBufferWriter)(ref val)).WriteValueSafe<SellType>(ref sellType, default(ForEnums)); BytePacker.WriteValueBitPacked(val, scrapEaterIndex); BytePacker.WriteValueBitPacked(val, scrapEaterVariantIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2639481324u, 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) { Plugin.Logger.LogError((object)"Failed to perform sell server rpc. PlayerControllerB is null."); return; } string text = $"{playerScriptByClientId.playerUsername} requested to sell {Utils.GetEnumName(sellType)} {scrapToSell.ItemCount} items for ${scrapToSell.RealTotalScrapValue}"; Plugin.Logger.LogInfo((object)text); HUDManager.Instance.DisplayGlobalNotification(text); Plugin.Instance.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(3291996946u, val, (RpcDelivery)0); bool flag = networkObjectReferences != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(networkObjectReferences, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3291996946u, 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(3014968241u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref speakInShip, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3014968241u, 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 NetworkManager.__rpc_func_table.Add(3195794390u, new RpcReceiveHandler(__rpc_handler_3195794390)); NetworkManager.__rpc_func_table.Add(2639481324u, new RpcReceiveHandler(__rpc_handler_2639481324)); NetworkManager.__rpc_func_table.Add(3291996946u, new RpcReceiveHandler(__rpc_handler_3291996946)); NetworkManager.__rpc_func_table.Add(3014968241u, new RpcReceiveHandler