using System; using System.Collections; using System.Collections.Generic; 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Internal; using GameNetcodeStuff; using GeneralImprovements; using GeneralImprovements.API; using HarmonyLib; using IL.GameNetcodeStuff; using LethalLib.Modules; using LittleCompany.modifications; using LittleCompany.patches; using MattyFixes; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using Newtonsoft.Json; using SelfSortingStorage.Cupboard; using SelfSortingStorage.NetcodePatcher; using SelfSortingStorage.Utils; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")] [assembly: IgnoresAccessChecksTo("LittleCompany")] [assembly: IgnoresAccessChecksTo("Matty's Fixes")] [assembly: AssemblyCompany("SelfSortingStorage")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d8b341d957aa214af494a30206658d40ec2d4bed")] [assembly: AssemblyProduct("SelfSortingStorage")] [assembly: AssemblyTitle("SelfSortingStorage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace SelfSortingStorage { internal class Config { public readonly Dictionary rowsOrder = new Dictionary(); public readonly List itemsBlacklist = new List(); public readonly List scrapsWhitelist = new List(); public readonly List<(string, int)> permanentItems = new List<(string, int)>(); public readonly ConfigEntry enableSaving; public readonly ConfigEntry allowScrapItems; public readonly ConfigEntry scanNode; public readonly ConfigEntry cupboardColor; public readonly ConfigEntry boxPosition; public readonly ConfigEntry rescaleItems; public readonly ConfigEntry perfectRescale; public readonly ConfigEntry rowsOrderStr; public readonly ConfigEntry blacklistStr; public readonly ConfigEntry whitelistStr; public readonly ConfigEntry cupboardPrice; public readonly ConfigEntry permanentStr; public readonly ConfigEntry resetButtonHostOnly; public readonly ConfigEntry wideVersion; public readonly ConfigEntry cozyLights; public readonly ConfigEntry resetButton; public readonly ConfigEntry customScreenPos; public readonly ConfigEntry quantityCursortipActive; public readonly ConfigEntry quantityDisplayActive; public readonly ConfigEntry verboseLogging; public Config(ConfigFile cfg) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown cfg.SaveOnConfigSet = false; enableSaving = cfg.Bind("General", "Save items", true, "Allows stored items to be saved in the host player's current save file."); allowScrapItems = cfg.Bind("General", "Allow Scrap items", true, "Allows scrap items to be stored in the Smart Cupboard."); scanNode = cfg.Bind("General", "Scan Node", true, "Adds a scan node on the storage box."); cupboardColor = cfg.Bind("General", "Cupboard Color", "#000E57", "Customize the color of the storage, default color is dark blue."); boxPosition = cfg.Bind("Storage", "Box position", "R", new ConfigDescription("Adjust the position of the storage box, this can be 'L' for left or 'R' for right.", (AcceptableValueBase)(object)new AcceptableValueList(new string[2] { "L", "R" }), Array.Empty())); rescaleItems = cfg.Bind("Storage", "Rescale big items", true, "Big items will be rescaled when stored in the Smart Cupboard (based on their collider volume)."); perfectRescale = cfg.Bind("Storage", "Perfect rescale", true, "Change the rescale algorithm to have items perfectly rescaled when stored (based on their collider max size)."); rowsOrderStr = cfg.Bind("Storage", "Rows order", "1,2,3,4", "Specify the order of items placement in the storage. Each number represents a shelve of the storage from top to bottom and the first one to be filled will be the number '1'.\nExample: Having an order of '1,2,3,4' will fill items from top to bottom, and having '3,1,2,4' will fill the middle shelves first.\nDON'T CHANGE THIS CONFIG WHEN THE SSS IS ALREADY UNLOCKED, a fresh save is required to avoid bad things happening (or press the Reset Button)."); blacklistStr = cfg.Bind("Storage", "Items Blacklist", "clipboard,Sticky note,Utility Belt", "Comma separated list of items names that will be rejected from the storage."); whitelistStr = cfg.Bind("Storage", "Scraps Whitelist", "", "Comma separated list of scrap items names that will be accepted by the storage when 'Allow Scrap items' is disabled.\nThis can be used to force allow specific scraps in the storage while every other scraps are not accepeted when 'Allow Scrap items' is false."); cupboardPrice = cfg.Bind("Shop", "Price", 20, "The price of the Smart Cupboard in the store."); permanentStr = cfg.Bind("Misc", "Permanent items", "", "Comma separated list of items that will be permanently stored in the SSS, you can optionally provide a quantity if wanted (if not it will default to 10000).\nThe accepted format for an item is 'origin/name/quantity' where 'name' is the name of the item and 'origin' is the mod's name that contains this item (write 'LethalCompanyGame' for a vanilla item).\nThis LethalCompanyGame/Walkie-talkie,premiumscraps/The talking orb,LethalCompanyGame/Pro-flashlight/10,code_rebirth/Wayfarer's Wallet/4 is a valid example.\nPLEASE NOTE that without DawnLib installed the mod will instead use LethalLib for the mod's names and that can result in different strings, for example 'comgithubbiodiversitylcbiodiversity' will become 'com.github.biodiversitylc.Biodiversity'."); resetButtonHostOnly = cfg.Bind("Misc", "Reset Button Host Only", false, "When true, only the host player will be able to press the Reset Button (needs Reset Button upgrade config to be enabled)."); wideVersion = cfg.Bind("Upgrades", "Wide Cupboard", false, "Activate the S4 upgrade, turns the Smart Cupboard into a wider version.\nDON'T CHANGE THIS CONFIG WHEN THE SSS IS ALREADY UNLOCKED, a fresh save is required to avoid bad things happening (or press the Reset Button)."); cozyLights = cfg.Bind("Upgrades", "Cozy Lights", true, "Activate the cozy lights upgrade, adds some lights on the shelves and a button to turn them on and off."); resetButton = cfg.Bind("Upgrades", "Reset Button", false, "Activate the soft reset upgrade, adds the 'button of death' on the side of the storage that you can press to clear every stored items in the SSS.\nPressing this button will effectively destroy everything so you shouldn't have the need to activate this unless you really want a way to reset the storage without being fired."); customScreenPos = cfg.Bind("Upgrades", "SSS Screen position", 0, "If GeneralImprovements is installed and this value is not 0, then this mod will display SSS items on the desired screen. In GI config you need to set 'UseBetterMonitors = true', then set to 'None' the screen that will display the SSS items, then provide the screen position here to make it work."); quantityCursortipActive = cfg.Bind("Upgrades", "Quantity Cursortip", false, "When true, shows the quantity of the item stack on the cursortip UI when hovering an item stored in the Smart Cupboard."); quantityDisplayActive = cfg.Bind("Upgrades", "Quantity Display", false, "When true, adds a small 'card' at the bottom of each item placement displaying the current item quantity."); verboseLogging = cfg.Bind("Logs", "Verbose logs", false, "Enable more explicit logs in the console (for debug reasons)."); cfg.Save(); cfg.SaveOnConfigSet = true; } public void SetupCustomConfigs() { Compatibility.CheckInstalledPlugins(); Compatibility.CompatibilityModsAreValid = Compatibility.CheckCompatibilitySSS(registerPopup: true); if (!string.IsNullOrEmpty(blacklistStr.Value)) { foreach (string item in from s in blacklistStr.Value.Split(',') select s.Trim()) { itemsBlacklist.Add(item); } if (itemsBlacklist.Count != 0) { RegisterBlacklist(); } } if (!allowScrapItems.Value && !string.IsNullOrEmpty(whitelistStr.Value)) { foreach (string item2 in from s in whitelistStr.Value.Split(',') select s.Trim()) { scrapsWhitelist.Add(item2); } } if (!string.IsNullOrEmpty(permanentStr.Value)) { foreach (string item3 in from s in permanentStr.Value.Split(',') select s.Trim()) { int num = 0; string text = ""; int num2 = 10000; foreach (string item4 in from s in item3.Split("/") select s.Trim()) { switch (num) { case 0: text += item4; break; case 1: text = text + "/" + item4; break; case 2: { if (int.TryParse(item4, out var result)) { num2 = result; } break; } } num++; } if (text != "" && text.Contains('/') && num2 >= 1) { permanentItems.Add((text, num2)); } } } if (rowsOrderStr.Value == (string)((ConfigEntryBase)rowsOrderStr).DefaultValue) { return; } int num3 = 0; foreach (string item5 in from s in rowsOrderStr.Value.Split(',') select s.Trim()) { if (!int.TryParse(item5, out var result2) || result2 <= 0 || result2 > 4 || num3 >= 4) { break; } rowsOrder[result2] = num3++; } if (rowsOrder.Count != 4 || rowsOrder.Keys.Distinct().Count() != 4) { Plugin.logger.LogWarning((object)"Invalid 'Rows order' config value. Default order will be used."); rowsOrder.Clear(); } } private void RegisterBlacklist() { SmartCupboard.AddTriggerValidation(BlacklistValidation, "[Item rejected]"); } private bool BlacklistValidation(PlayerControllerB player) { GrabbableObject item = player.currentlyHeldObjectServer; if (itemsBlacklist.Exists((string i) => i == item.itemProperties.itemName)) { return false; } return true; } internal bool IsScrapForcedWhitelisted(string itemName) { if (allowScrapItems.Value) { return true; } if (scrapsWhitelist.Count == 0) { return false; } return scrapsWhitelist.Contains(itemName); } } [BepInPlugin("zigzag.SelfSortingStorage", "SelfSortingStorage", "1.5.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string GUID = "zigzag.SelfSortingStorage"; private const string NAME = "SelfSortingStorage"; private const string VERSION = "1.5.1"; public static Plugin instance; public static ManualLogSource logger; private readonly Harmony harmony = new Harmony("zigzag.SelfSortingStorage"); internal const string VANILLA_NAME = "LethalCompanyGame"; internal static readonly List<(Func, string)> spTriggerValidations = new List<(Func, string)>(); internal static Config config { get; private set; } = null; internal int ROWS_LENGTH { get; private set; } = 4; private void HarmonyPatchAll() { harmony.CreateClassProcessor(typeof(SavingPatchVanilla), true).Patch(); harmony.CreateClassProcessor(typeof(StartOfRoundPatch), true).Patch(); harmony.CreateClassProcessor(typeof(RoundManagerPatch), true).Patch(); harmony.CreateClassProcessor(typeof(BeltBagItemPatch), true).Patch(); harmony.CreateClassProcessor(typeof(MenuManagerPatch), true).Patch(); if (Compatibility.LittleCompanyInstalled) { harmony.CreateClassProcessor(typeof(ShipBuildModeManagerLittleCompanyPatch), true).Patch(); } else { harmony.CreateClassProcessor(typeof(ShipBuildModeManagerPatch), true).Patch(); } if (config.quantityCursortipActive.Value) { CursortipMonoPatch.Load(); } } private void ReplaceTransform(GameObject prefab, string originName, string destinationName) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Transform val = prefab.transform.Find(originName); Transform val2 = prefab.transform.Find(destinationName); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { val.position = val2.position; val.rotation = val2.rotation; } } private void Awake() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) instance = this; logger = ((BaseUnityPlugin)this).Logger; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "selfsortingstorage"); AssetBundle val = AssetBundle.LoadFromFile(text); string text2 = "Assets/Data/_Misc/"; UnlockableItem val2 = val.LoadAsset(text2 + "SSS_Module/SSSModuleUnlockableList.asset").unlockables[0]; config = new Config(((BaseUnityPlugin)this).Config); config.SetupCustomConfigs(); Effects.SetupNetwork(); if (!Compatibility.LethalLibInstalled && !Compatibility.DawnLibInstalled) { throw new FileNotFoundException("SelfSortingStorage could not be loaded due to a missing dependency."); } if (config.wideVersion.Value) { GameObject prefabObject = val.LoadAsset(text2 + "SSS_Module/SSS_Module_WideVariant.prefab"); val2.prefabObject = prefabObject; ROWS_LENGTH = 7; } GameObject prefabObject2 = val2.prefabObject; Color color = default(Color); if (ColorUtility.TryParseHtmlString(config.cupboardColor.Value, ref color)) { ((Renderer)prefabObject2.GetComponent()).materials[0].color = color; } if (!config.scanNode.Value) { Transform val3 = prefabObject2.transform.Find("ChutePosition/ActualPos/ScanNode"); if (val3 != null) { ((Component)val3).gameObject.SetActive(false); } } if (!config.resetButton.Value) { Transform val4 = prefabObject2.transform.Find("DeathButtonPosition"); if (val4 != null) { ((Component)val4).gameObject.SetActive(false); } } if (!config.cozyLights.Value) { Transform val5 = prefabObject2.transform.Find("Lights"); if (val5 != null) { ((Component)val5).gameObject.SetActive(false); } } if (!config.quantityDisplayActive.Value) { Transform val6 = prefabObject2.transform.Find("Quantities"); if (val6 != null) { ((Component)val6).gameObject.SetActive(false); } } if (config.boxPosition.Value == "R") { ReplaceTransform(prefabObject2, "ChutePosition/ActualPos", "ChutePosition/Pos2"); if (config.resetButton.Value) { ReplaceTransform(prefabObject2, "DeathButtonPosition/ActualPos", "DeathButtonPosition/Pos2"); } if (config.cozyLights.Value) { ReplaceTransform(prefabObject2, "Lights/LightsButtonPosition/ActualPos", "Lights/LightsButtonPosition/Pos2"); } } if (DateTime.Today.Month == 12) { Transform val7 = prefabObject2.transform.Find("Christmas"); if (val7 != null) { ((Component)val7).gameObject.SetActive(true); } } if (Compatibility.DawnLibInstalled) { Effects.DawnLibRegisterSSS(val2); } else if (Compatibility.LethalLibInstalled) { Effects.LethalLibRegisterSSS(val2); } HarmonyPatchAll(); logger.LogInfo((object)"SelfSortingStorage is loaded !"); } } } namespace SelfSortingStorage.Utils { internal class Compatibility { public static bool CompatibilityModsAreValid; public static bool LethalLibInstalled; public static bool DawnLibInstalled; public static bool GeneralImprovementsInstalled; public static bool MattyFixesInstalled; public static bool LittleCompanyInstalled; public static void CheckInstalledPlugins() { LethalLibInstalled = IsPluginInstalled("evaisa.lethallib"); DawnLibInstalled = IsPluginInstalled("com.github.teamxiaolan.dawnlib"); GeneralImprovementsInstalled = IsPluginInstalled("ShaosilGaming.GeneralImprovements"); MattyFixesInstalled = IsPluginInstalled("mattymatty.MattyFixes"); LittleCompanyInstalled = IsPluginInstalled("Toybox.LittleCompany"); } private static bool IsPluginInstalled(string pluginGUID, string? pluginVersion = null) { return Chainloader.PluginInfos.ContainsKey(pluginGUID) && (pluginVersion == null || new Version(pluginVersion).CompareTo(Chainloader.PluginInfos[pluginGUID].Metadata.Version) <= 0); } public static bool CheckCompatibilitySSS(bool registerPopup = false, bool displayTip = false) { int num = 0; bool flag = true; if (!LethalLibInstalled && !DawnLibInstalled) { Plugin.logger.LogError((object)"This mod requires a library to register it's content to the game : please install DawnLib or LethalLib."); return false; } if (!GeneralImprovementsInstalled && !MattyFixesInstalled) { if (DawnLibInstalled && Effects.GetConfigDL(0)) { Plugin.logger.LogError((object)"'Item Saving' config in DawnLib needs to stay false ! Or else it will disable the item saving system."); flag = false; num = 6000; } else if (!DawnLibInstalled) { Plugin.logger.LogError((object)"An additional mod is required for this mod to work properly : GeneralImprovements OR MattyFixes, please install one of these two before playing ! Without it the mod will still work but you may notice some item rotation issues."); flag = false; num = 6001; } } else if (GeneralImprovementsInstalled && !Effects.GetConfigGI(2)) { Plugin.logger.LogError((object)"ShipPlaceablesCollide config in GeneralImprovements needs to be enabled !"); flag = false; num = 6002; } else { if (DawnLibInstalled && !Effects.GetConfigDL(0)) { return true; } if (!GeneralImprovementsInstalled && MattyFixesInstalled && !Effects.GetConfigMF(0)) { Plugin.logger.LogError((object)"OutOfBounds.Enabled config in MattyFixes needs to be enabled !"); flag = false; num = 6003; } else if (GeneralImprovementsInstalled && MattyFixesInstalled && Effects.GetConfigGI(1) == Effects.GetConfigMF(0)) { Plugin.logger.LogError((object)("FixItemsFallingThrough config in GeneralImprovements and OutOfBounds.Enabled config in MattyFixes are both " + (Effects.GetConfigMF(0) ? "enabled" : "disabled") + " ! You need one of the two to be enabled and the other to be disabled (I suggest to keep the one in GeneralImprovements).")); flag = false; num = 6004; } else if (GeneralImprovementsInstalled && !MattyFixesInstalled && (!Effects.GetConfigGI(0) || !Effects.GetConfigGI(1)) && (!DawnLibInstalled || Effects.GetConfigDL(0))) { Plugin.logger.LogError((object)"FixItemsLoadingSameRotation and FixItemsFallingThrough configs in GeneralImprovements both needs to be enabled !"); flag = false; num = 6005; } } if (!flag) { if (registerPopup) { switch (num) { case 6000: Effects.MenuPopupMessages.Add("Configs not valid. 'Item Saving' in DawnLib needs to stay false! (so the system will be enabled)\nError code: " + num); break; case 6001: Effects.MenuPopupMessages.Add("An additional mod is required. Please install either GeneralImprovements OR MattyFixes before playing!\nError code: " + num); break; case 6002: Effects.MenuPopupMessages.Add("Configs not valid. ShipPlaceablesCollide in GeneralImprovements needs to be enabled!\nError code: " + num); break; case 6003: Effects.MenuPopupMessages.Add("Configs not valid. OutOfBounds.Enabled in MattyFixes needs to be enabled!\nError code: " + num); break; case 6004: Effects.MenuPopupMessages.Add("Configs missmatch. FixItemsFallingThrough in GeneralImprovements and OutOfBounds.Enabled in MattyFixes can't be both enabled at the same time!\nError code: " + num); break; case 6005: Effects.MenuPopupMessages.Add("Configs not valid. FixItemsLoadingSameRotation and FixItemsFallingThrough in GeneralImprovements both needs to be enabled!\nError code: " + num); break; } } if (displayTip) { Effects.Message("SelfSortingStorage", "Mods conflicts detected ! Please check your logs. Error code: " + num, warning: true); } } return flag; } } internal static class CursortipMonoPatch { public static void Load() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PlayerControllerB.SetHoverTipAndCurrentInteractTrigger += new Manipulator(DisplayQuantityOnCursortip); } private static void DisplayQuantityOnCursortip(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "cursorIcon"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "grabItemIcon"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "set_sprite") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)delegate(PlayerControllerB self) { if (!((Object)(object)self == (Object)null) && SmartCupboard.SpawnedInShip && SmartCupboard.StoredInstanceQuantities.Count != 0) { GrabbableObject component = ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null) && SmartCupboard.StoredInstanceQuantities.ContainsKey(((NetworkBehaviour)component).NetworkObjectId)) { TextMeshProUGUI cursorTip = self.cursorTip; ((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + $" ({SmartCupboard.StoredInstanceQuantities[((NetworkBehaviour)component).NetworkObjectId]})"; } } }); } } internal static class DestroyItemInSlotMonoPatch { public static void Load() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PlayerControllerB.DestroyItemInSlot += new Manipulator(DestroyItemInUtilitySlot); } private static void DestroyItemInUtilitySlot(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)0, new Func[6] { (Instruction x) => ILPatternMatchingExt.MatchCall(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "itemSlotIcons"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdelemRef(x), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "set_enabled") }); val.RemoveRange(6); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Action)delegate(int itemSlot) { if (itemSlot == 50) { ((Behaviour)HUDManager.Instance.itemOnlySlotIcon).enabled = false; } else { ((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false; } }); } } internal class Effects { public class ItemNetworkReference { public NetworkObjectReference netObjectRef; public int value; public int save; public ItemNetworkReference(NetworkObjectReference netObjectRef, int value, int save) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) this.netObjectRef = netObjectRef; this.value = value; this.save = save; } } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioSource source; public float time; public bool specialStop; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = source.volume; break; case 2: <>1__state = -1; break; } if (source.volume > 0f) { AudioSource obj = source; obj.volume -= 5__1 * Time.deltaTime / time; if (!specialStop || !(source.volume <= 0.04f)) { <>2__current = null; <>1__state = 2; return true; } } source.Stop(); source.volume = 5__1; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference itemRef; public SmartCupboard cupboard; public int spawnIndex; public int value; public int save; private NetworkObject 5__1; private float 5__2; private GrabbableObject 5__3; private Vector3 5__4; private Transform 5__5; private Vector3 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; 5__2 = Time.realtimeSinceStartup; goto IL_0064; case 1: <>1__state = -1; goto IL_0064; case 2: { <>1__state = -1; 5__3 = ((Component)5__1).GetComponent(); if (((NetworkBehaviour)5__3).IsServer) { 5__4 = Vector3.zero + 5__3.itemProperties.verticalOffset * new Vector3(0f, 0f, 1f); ((Component)5__3).transform.localPosition = 5__4; 5__3.targetFloorPosition = 5__4; } else { cupboard.GetPlacePosition(spawnIndex, out 5__5, out Vector3 _, out Quaternion _); 5__6 = Vector3.zero + 5__3.itemProperties.verticalOffset * new Vector3(0f, 0f, 1f); 5__3.parentObject = null; ((Component)5__3).transform.SetParent(5__5 ?? StartOfRound.Instance.elevatorTransform, true); 5__3.startFallingPosition = 5__6; ((Component)5__3).transform.localPosition = 5__6; 5__3.targetFloorPosition = 5__6; 5__3.reachedFloorTarget = true; 5__3.hasHitGround = true; 5__5 = null; } 5__3.isInElevator = true; 5__3.isInShipRoom = true; 5__3.fallTime = 0f; if (5__3.itemProperties.isScrap) { 5__3.SetScrapValue(value); } if (5__3.itemProperties.saveItemVariable) { 5__3.LoadItemSaveData(save); } return false; } IL_0064: if (Time.realtimeSinceStartup - 5__2 < 8f && !((NetworkObjectReference)(ref itemRef)).TryGet(ref 5__1, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } if ((Object)(object)5__1 == (Object)null) { Plugin.logger.LogError((object)"Error while trying to sync the item."); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly List MenuPopupMessages = new List(); public static void SetupNetwork() { IEnumerable enumerable; try { enumerable = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { enumerable = ex.Types.Where((Type t) => t != null); } foreach (Type item in enumerable) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static void Message(string title, string bottom, bool warning = false) { HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip(title, bottom, warning, false, "LC_Tip1"); } } public static void DawnLibRegisterSSS(UnlockableItem sssUnlockable) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) DawnLib.RegisterNetworkPrefab(sssUnlockable.prefabObject); UnlockableInfoBuilder val = new UnlockableInfoBuilder(NamespacedKey.From("self_sorting_storage", "smart_cupboard"), sssUnlockable); val.SetCost(Plugin.config.cupboardPrice.Value); val._placeableObjectInfo = new PlaceableObjectBuilder(val).SetShipUpgrade().Build(); DawnUnlockableItemInfo val2 = ((BaseInfoBuilder)(object)val).Build(); UnlockableItemExtensions.SetDawnInfo(sssUnlockable, val2); ((Registry)(object)LethalContent.Unlockables).Register(val2); } public static void LethalLibRegisterSSS(UnlockableItem sssUnlockable) { NetworkPrefabs.RegisterNetworkPrefab(sssUnlockable.prefabObject); Unlockables.RegisterUnlockable(sssUnlockable, Plugin.config.cupboardPrice.Value, (StoreType)1); } public static void FillUpCacheFromDawnLib(Dictionary cache) { foreach (DawnItemInfo value in ((Registry)(object)LethalContent.Items).Values) { if (!((NamespacedKey)((DawnBaseInfo)(object)value).TypedKey).IsVanilla()) { cache.TryAdd(((NamespacedKey)((DawnBaseInfo)(object)value).TypedKey).Namespace + "/" + value.Item.itemName, value.Item); } } } public static void FillUpCacheFromLethalLib(Dictionary cache) { foreach (ScrapItem scrapItem in Items.scrapItems) { cache.TryAdd(scrapItem.modName + "/" + scrapItem.item.itemName, scrapItem.item); } foreach (ShopItem shopItem in Items.shopItems) { cache.TryAdd(shopItem.modName + "/" + shopItem.item.itemName, shopItem.item); } foreach (PlainItem plainItem in Items.plainItems) { cache.TryAdd(plainItem.modName + "/" + plainItem.item.itemName, plainItem.item); } } public static bool GetConfigDL(int wantedConfigID) { if (1 == 0) { } bool result = wantedConfigID == 0 && DawnConfig.DisableDawnItemSaving.Value; if (1 == 0) { } return result; } public static bool GetConfigGI(int wantedConfigID) { if (1 == 0) { } bool result = wantedConfigID switch { 0 => Plugin.FixItemsLoadingSameRotation.Value, 1 => Plugin.FixItemsFallingThrough.Value, 2 => Plugin.ShipPlaceablesCollide.Value, _ => false, }; if (1 == 0) { } return result; } public static bool GetConfigMF(int wantedConfigID) { if (1 == 0) { } bool result = wantedConfigID == 0 && OutOfBounds.Enabled.Value; if (1 == 0) { } return result; } public static void SetScreenText(int screenID, string text) { MonitorInfo monitorAtIndex = MonitorsAPI.GetMonitorAtIndex(screenID); if (monitorAtIndex != null) { monitorAtIndex.QueueRender(text); } } [IteratorStateMachine(typeof(d__12))] public static IEnumerator FadeOutAudio(AudioSource source, float time, bool specialStop = false) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { source = source, time = time, specialStop = specialStop }; } public static bool IsTriggerValid(PlayerControllerB player, out string notValidText) { notValidText = "[Nothing to store]"; if (player.isHoldingObject && !player.isGrabbingObjectAnimation && (Object)(object)player.currentlyHeldObjectServer != (Object)null) { if (!StartOfRound.Instance.inShipPhase && (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded)) { notValidText = "[Wait for ship to " + (StartOfRound.Instance.shipIsLeaving ? "leave" : "land") + "]"; return false; } if (player.currentlyHeldObjectServer.itemProperties.itemName == "Body" || ((Object)(object)((Component)player.currentlyHeldObjectServer).gameObject != (Object)null && (Object)(object)((Component)player.currentlyHeldObjectServer).gameObject.GetComponent() != (Object)null)) { notValidText = "[It doesn't fit]"; return false; } if (player.currentlyHeldObjectServer.itemProperties.itemName == "Stun grenade") { GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; StunGrenadeItem val = (StunGrenadeItem)(object)((currentlyHeldObjectServer is StunGrenadeItem) ? currentlyHeldObjectServer : null); if (val != null && val.hasExploded) { notValidText = "[Exploded grenades are illegal]"; return false; } } if (player.currentlyHeldObjectServer.itemProperties.itemName == "Belt bag") { notValidText = "[Belt bags not compatible]"; return false; } if (!Plugin.config.allowScrapItems.Value && player.currentlyHeldObjectServer.itemProperties.isScrap && !Plugin.config.IsScrapForcedWhitelisted(player.currentlyHeldObjectServer.itemProperties.itemName)) { notValidText = "[Scraps not allowed]"; return false; } foreach (var spTriggerValidation in Plugin.spTriggerValidations) { if (!spTriggerValidation.Item1(player)) { notValidText = spTriggerValidation.Item2; return false; } } return true; } return false; } public static Item? GetItem(string id) { string[] idParts = id.Split('/'); if (idParts == null || idParts.Length <= 1) { return null; } if (idParts[0] == "LethalCompanyGame") { return ((IEnumerable)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func)((Item i) => i.itemName.Equals(idParts[1]))); } return SmartMemory.CacheItems.GetValueOrDefault(id); } public static ItemNetworkReference SpawnItem(Item item, SmartCupboard cupboard, int spawnIndex, int value = 0, int save = 0) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) cupboard.GetPlacePosition(spawnIndex, out Transform parent, out Vector3 position, out Quaternion rotation); GameObject val = Object.Instantiate(item.spawnPrefab, position, rotation, parent ?? StartOfRound.Instance.elevatorTransform); GrabbableObject component = val.GetComponent(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); ((Component)component).transform.localRotation = rotation; component.fallTime = 1f; component.hasHitGround = true; component.reachedFloorTarget = true; component.isInElevator = true; component.isInShipRoom = true; if (component.itemProperties.isScrap) { component.SetScrapValue(value); } if (component.itemProperties.saveItemVariable) { component.LoadItemSaveData(save); } ((NetworkBehaviour)component).NetworkObject.Spawn(false); return new ItemNetworkReference(NetworkObjectReference.op_Implicit(val.GetComponent()), value, component.itemProperties.saveItemVariable ? component.GetItemDataToSave() : save); } [IteratorStateMachine(typeof(d__16))] public static IEnumerator SyncItem(NetworkObjectReference itemRef, SmartCupboard cupboard, int spawnIndex, int value, int save) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { itemRef = itemRef, cupboard = cupboard, spawnIndex = spawnIndex, value = value, save = save }; } private static bool ShouldRescale(Vector3 size, out float factor) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) factor = 100f; if (Plugin.config.perfectRescale.Value) { float num = ((size.x > size.y && size.x > size.z) ? size.x : ((size.y > size.x && size.y > size.z) ? size.y : size.z)); if (num > 0.25f) { factor = 21f / num; return true; } } else { float num2 = size.x * 2f * (size.y * 2f) * (size.z * 2f); if (num2 > 0.08f) { factor = ((num2 < 0.5f) ? (7f / num2) : 20f); return true; } } return false; } public static void RescaleItemIfTooBig(GrabbableObject component) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) BoxCollider component2 = ((Component)component).GetComponent(); if (!((Object)(object)component2 == (Object)null)) { Bounds bounds = ((Collider)component2).bounds; RescaleItemIfTooBig(component, ((Bounds)(ref bounds)).extents); } } public static void RescaleItemIfTooBig(GrabbableObject component, Vector3 size) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (ShouldRescale(size, out var factor)) { ((Component)component).transform.localScale = factor * ((Component)component).transform.localScale / 100f; Vector3 val = Vector3.zero + factor * component.itemProperties.verticalOffset / 100f * new Vector3(0f, 0f, 1f); ((Component)component).transform.localPosition = val; component.targetFloorPosition = val; if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogInfo((object)"Item was rescaled"); } } } public static void ScaleBackItem(GrabbableObject component) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ((Component)component).transform.localScale = component.originalScale; } public static void OverrideOriginalScale(GrabbableObject component, Vector3 value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) component.originalScale = value; } public static void ReParentItemToCupboard(GrabbableObject component, SmartCupboard cupboard, int spawnIndex, bool overridePosRot = false, Vector3 syncedPos = default(Vector3), Quaternion syncedRot = default(Quaternion)) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_007b: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (spawnIndex >= 0) { cupboard.GetPlacePosition(spawnIndex, out Transform parent, out Vector3 _, out Quaternion _); Vector3 val = (overridePosRot ? syncedPos : (Vector3.zero + component.itemProperties.verticalOffset * new Vector3(0f, 0f, 1f))); component.parentObject = null; ((Component)component).transform.SetParent(parent ?? StartOfRound.Instance.elevatorTransform, true); ((Component)component).transform.localPosition = val; component.targetFloorPosition = val; if (overridePosRot) { ((Component)component).transform.localRotation = syncedRot; } component.reachedFloorTarget = true; component.hasHitGround = true; } } } [HarmonyPatch] internal class SavingPatchVanilla { [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "SaveItemsInShip")] public static void SaveSmartCupboard() { if (Plugin.config.enableSaving.Value && !((Object)(object)StartOfRound.Instance == (Object)null) && ((NetworkBehaviour)StartOfRound.Instance).IsServer) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; SavingModule.Save(currentSaveFileName); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadShipGrabbableItems")] public static void LoadSmartCupboard() { if (Plugin.config.enableSaving.Value && !((Object)(object)StartOfRound.Instance == (Object)null) && ((NetworkBehaviour)StartOfRound.Instance).IsServer) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; SavingModule.Load(currentSaveFileName); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void SetSmartCupboardDefaultScreen() { if (!SmartCupboard.SpawnedInShip && Compatibility.GeneralImprovementsInstalled && Plugin.config.customScreenPos.Value > 0 && Plugin.config.customScreenPos.Value <= 14) { Effects.SetScreenText(Plugin.config.customScreenPos.Value - 1, "Smart Cupboard:\n$" + Plugin.config.cupboardPrice.Value + ""); } } [HarmonyPostfix] [HarmonyPatch("ResetShip")] public static void ResetSmartCupboard() { if ((Object)(object)StartOfRound.Instance == (Object)null || !((NetworkBehaviour)StartOfRound.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0) { return; } SmartCupboard smartCupboard = Object.FindObjectOfType(); if (!((Object)(object)smartCupboard == (Object)null)) { SmartMemory.Instance.ClearAll(); smartCupboard.placedItems.Clear(); if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogInfo((object)"Smart Cupboard was reseted due to a game over."); } } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPostfix] [HarmonyPatch("DespawnPropsAtEndOfRound")] public static void ResetSmartCupboardIfAllDeads() { if ((Object)(object)RoundManager.Instance == (Object)null || !((NetworkBehaviour)RoundManager.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0 || (Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.allPlayersDead) { return; } int num = 0; SmartCupboard smartCupboard = Object.FindObjectOfType(); if ((Object)(object)smartCupboard == (Object)null) { return; } foreach (List item in SmartMemory.Instance.ItemList) { foreach (SmartMemory.Data item2 in item) { if (item2.IsValid() && item2.Values[0] != 0) { item2.Id = "INVALID"; SmartMemory.Instance.Size--; smartCupboard.placedItems.Remove(num); } num++; } } if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogInfo((object)"Smart Cupboard stored scraps were removed due to all players being dead."); } } } [HarmonyPatch(typeof(BeltBagItem))] internal class BeltBagItemPatch { [HarmonyPrefix] [HarmonyPatch("TryAddObjectToBagServerRpc")] public static bool TryAddObjectToBagServerRpcPatch(BeltBagItem __instance, NetworkObjectReference netObjectRef, int playerWhoAdded) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null || !((NetworkBehaviour)StartOfRound.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0) { return true; } SmartCupboard smartCupboard = Object.FindObjectOfType(); if ((Object)(object)smartCupboard == (Object)null || smartCupboard.placedItems.Count == 0) { return true; } NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val, (NetworkManager)null)) { GrabbableObject component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && !component.isHeld && !component.heldByPlayerOnServer && !component.isHeldByEnemy) { foreach (var (_, val3) in smartCupboard.placedItems) { if (component.itemProperties.itemName == val3.itemProperties.itemName && ((Component)component).transform.position == ((Component)val3).transform.position) { __instance.CancelAddObjectToBagClientRpc(playerWhoAdded); return false; } } } } return true; } } [HarmonyPatch(typeof(ShipBuildModeManager))] internal class ShipBuildModeManagerPatch { [HarmonyPrefix] [HarmonyPatch("CreateGhostObjectAndHighlight")] public static bool CreateGhostObjectAndHighlightPatch(ShipBuildModeManager __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.placingObject == (Object)null || ((Object)__instance.placingObject.parentObject).name != "SSS_Module_WideVariant(Clone)") { return true; } ((Behaviour)HUDManager.Instance.buildModeControlTip).enabled = true; if (StartOfRound.Instance.localPlayerUsingController) { ((TMP_Text)HUDManager.Instance.buildModeControlTip).text = "Confirm: [Y] | Rotate: [L-shoulder] | Store: [B]"; } else { ((TMP_Text)HUDManager.Instance.buildModeControlTip).text = "Confirm: [B] | Rotate: [R] | Store: [X]"; } HUDManager.Instance.UIAudio.PlayOneShot(__instance.beginPlacementSFX); ((Component)__instance.ghostObject).transform.eulerAngles = ((Component)__instance.placingObject.mainMesh).transform.eulerAngles; __instance.ghostObjectMesh.mesh = __instance.placingObject.mainMesh.mesh; ((Component)__instance.ghostObjectMesh).transform.localScale = ((Component)__instance.placingObject.mainMesh).transform.localScale; ((Component)__instance.ghostObjectMesh).transform.position = __instance.ghostObject.position + (((Component)__instance.placingObject.mainMesh).transform.position - ((Component)__instance.placingObject.placeObjectCollider).transform.position); ((Component)__instance.ghostObjectMesh).transform.localEulerAngles = Vector3.zero; ((Renderer)__instance.ghostObjectRenderer).enabled = true; __instance.selectionOutlineMesh.mesh = __instance.placingObject.mainMesh.mesh; ((Component)__instance.selectionOutlineMesh).transform.localScale = ((Component)__instance.placingObject.mainMesh).transform.localScale; ((Component)__instance.selectionOutlineMesh).transform.localScale = ((Component)__instance.selectionOutlineMesh).transform.localScale * 1.04f; ((Component)__instance.selectionOutlineMesh).transform.position = ((Component)__instance.placingObject.mainMesh).transform.position; ((Component)__instance.selectionOutlineMesh).transform.eulerAngles = ((Component)__instance.placingObject.mainMesh).transform.eulerAngles; ((Renderer)__instance.selectionOutlineRenderer).enabled = true; return false; } } [HarmonyPatch(typeof(ShipBuildModeManagerPatch))] internal class ShipBuildModeManagerLittleCompanyPatch { [HarmonyPrefix] [HarmonyPatch("CreateGhostObjectAndHighlight_PostFix")] public static bool CreateGhostObjectAndHighlightPatch(object[] __args) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) ShipBuildModeManager val = (ShipBuildModeManager)__args[0]; if ((Object)(object)val.placingObject == (Object)null || ((Object)val.placingObject.parentObject).name != "SSS_Module_WideVariant(Clone)") { return true; } ShipObjectModification.ScalingOf(val.placingObject); Vector3 localScale = ((Component)val.placingObject.mainMesh).transform.localScale; ((Component)val.ghostObjectMesh).transform.localScale = localScale; ((Component)val.selectionOutlineMesh).transform.localScale = localScale * 1.04f; return false; } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] public static void AwakePatch() { foreach (string menuPopupMessage in Effects.MenuPopupMessages) { GameObject val = GameObject.Find("/Canvas/MenuContainer/"); GameObject val2 = GameObject.Find("Canvas/MenuContainer/LANWarning/"); if ((Object)(object)val2 == (Object)null) { break; } GameObject val3 = Object.Instantiate(val2, val.transform); ((Object)val3).name = "SSS_ModsIncompatibility"; val3.SetActive(true); Transform val4 = val3.transform.Find("Panel/NotificationText"); TextMeshProUGUI component = ((Component)val4).GetComponent(); ((TMP_Text)component).text = menuPopupMessage; } } } } namespace SelfSortingStorage.Cupboard { internal class SavingModule { public const string SaveKey = "SmartCupboardItems"; public static void Save(string saveFile) { if (!GetItems(out SmartMemory.Data[] items)) { ES3.DeleteKey("SmartCupboardItems", saveFile); return; } ES3.Save("SmartCupboardItems", JsonConvert.SerializeObject((object)items), saveFile); Plugin.logger.LogInfo((object)"SmartCupboard items saved."); } public static void Load(string saveFile) { if (!ES3.KeyExists("SmartCupboardItems", saveFile) || SmartMemory.Instance == null) { return; } SmartCupboard smartCupboard = Object.FindObjectOfType(); string text = ES3.Load("SmartCupboardItems", saveFile); IEnumerable enumerable = JsonConvert.DeserializeObject>(text); if (enumerable == null || (Object)(object)smartCupboard == (Object)null) { Plugin.logger.LogError((object)"Items from SmartCupboard could not be loaded."); return; } int num = 0; SmartMemory.Data[] array = enumerable.ToArray(); SmartMemory.Data[] array2 = array; foreach (SmartMemory.Data data in array2) { if (data.IsValid()) { SmartMemory.Instance.StoreData(data, out var _, freeSpaceOnly: true); } else { SmartMemory.Instance.IgnoreSpaces.Add(num); } num++; } if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)SmartMemory.Instance.ToString()); } SmartMemory.Instance.IgnoreSpaces.Clear(); ((MonoBehaviour)smartCupboard).StartCoroutine(smartCupboard.ReloadPlacedItems()); Plugin.logger.LogInfo((object)"SmartCupboard items loaded."); } private static bool GetItems(out SmartMemory.Data[]? items) { items = null; if (SmartMemory.Instance == null || SmartMemory.Instance.Size == 0) { return false; } List list = new List(); for (int i = 0; i < 4; i++) { for (int j = 0; j < Plugin.instance.ROWS_LENGTH; j++) { SmartMemory.Data item = SmartMemory.Instance.ItemList[i][j]; list.Add(item); } } items = list.ToArray(); return true; } } public class SmartCupboard : NetworkBehaviour { [CompilerGenerated] private sealed class d__46 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SmartCupboard <>4__this; private int 5__1; private int 5__2; private StringBuilder 5__3; private int 5__4; private SmartMemory.Data 5__5; private bool 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; break; case 1: <>1__state = -1; 5__3 = null; break; case 2: <>1__state = -1; break; } while (SmartMemory.Instance != null) { if (<>4__this.memory.Size != 0) { 5__2 = 0; 5__3 = new StringBuilder(); 5__4 = 5__1; while (5__4 < <>4__this.memory.Capacity) { 5__5 = <>4__this.memory.RetrieveData(5__4, updateQuantity: false); if (5__5 != null) { 5__3.Append(<>4__this.GetItemScreenText(5__5)); 5__2++; } 5__6 = 5__2 == <>4__this.memory.Size || 5__4 + 1 >= <>4__this.memory.Capacity; if ((5__2 == 4) | 5__6) { 5__1 = ((!5__6) ? (5__4 + 1) : 0); break; } 5__5 = null; 5__4++; } if (5__2 == 0) { continue; } <>4__this.SetScreenTextServerRpc(5__3.ToString()); <>2__current = (object)new WaitForSeconds(10f); <>1__state = 1; return true; } <>4__this.SetScreenTextServerRpc("No items in Smart Cupboard"); <>2__current = (object)new WaitUntil((Func)(() => <>4__this.memory.Size != 0)); <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SmartCupboard <>4__this; private List<(string, int)>.Enumerator <>s__1; private (string, int) 5__2; private Item 5__3; private GrabbableObject 5__4; private SmartMemory.Data 5__5; private int 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List<(string, int)>.Enumerator); 5__2 = default((string, int)); 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.isRespawningFromSave) { return false; } <>s__1 = Plugin.config.permanentItems.GetEnumerator(); try { while (<>s__1.MoveNext()) { 5__2 = <>s__1.Current; 5__3 = Effects.GetItem(5__2.Item1); if ((Object)(object)5__3 == (Object)null || (Object)(object)5__3.spawnPrefab == (Object)null) { Plugin.logger.LogError((object)("The " + 5__2.Item1 + " is not a valid item. Have you entered the item name correctly ?")); continue; } 5__4 = 5__3.spawnPrefab.GetComponent(); if (!((Object)(object)5__4 == (Object)null)) { 5__5 = new SmartMemory.Data(5__4) { Quantity = 5__2.Item2 }; 5__5.Values.AddRange(Enumerable.Repeat(5__5.Values[0], 5__5.Quantity - 1)); 5__5.Saves.AddRange(Enumerable.Repeat(5__5.Saves[0], 5__5.Quantity - 1)); if (<>4__this.memory.StoreData(5__5, out 5__6)) { <>4__this.SpawnItem(5__5, 5__6); } if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)<>4__this.memory.ToString()); } 5__3 = null; 5__4 = null; 5__5 = null; 5__2 = default((string, int)); } } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(List<(string, int)>.Enumerator); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__23 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SmartCupboard <>4__this; private int 5__1; private float 5__2; private GrabbableObject[] 5__3; private List>.Enumerator <>s__4; private List 5__5; private List.Enumerator <>s__6; private SmartMemory.Data 5__7; private int 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; <>s__4 = default(List>.Enumerator); 5__5 = null; <>s__6 = default(List.Enumerator); 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isRespawningFromSave = true; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = 0; 5__2 = 1f; 5__3 = Object.FindObjectsByType((FindObjectsSortMode)0); <>s__4 = <>4__this.memory.ItemList.GetEnumerator(); try { while (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; <>s__6 = 5__5.GetEnumerator(); try { while (<>s__6.MoveNext()) { 5__7 = <>s__6.Current; if (5__7.IsValid()) { 5__8 = 0; while (5__8 < 5__3.Length) { if (5__3[5__8].itemProperties.itemName == 5__7.Id.Split('/')[1] && Vector3.Distance(<>4__this.placePositions[5__1].position, ((Component)5__3[5__8]).transform.position) <= 5__2) { Effects.ReParentItemToCupboard(5__3[5__8], <>4__this, 5__1); if (Plugin.config.rescaleItems.Value) { Effects.RescaleItemIfTooBig(5__3[5__8]); } if (Plugin.config.quantityCursortipActive.Value) { StoredInstanceQuantities.Add(((NetworkBehaviour)5__3[5__8]).NetworkObjectId, 5__7.Quantity); } if (Plugin.config.quantityDisplayActive.Value) { <>4__this.UpdateDisplayedQuantity(5__1, 5__7.Quantity); } <>4__this.placedItems[5__1] = 5__3[5__8]; } 5__8++; } } 5__1++; 5__7 = null; } } finally { ((IDisposable)<>s__6).Dispose(); } <>s__6 = default(List.Enumerator); 5__5 = null; } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(List>.Enumerator); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__33 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference itemRef; public bool scaleMode; public Vector3 size; public bool syncedFromHost; public int spawnIndex; public Vector3 syncedPos; public Quaternion syncedRot; public SmartCupboard <>4__this; private NetworkObject 5__1; private GrabbableObject 5__2; private NetworkObject 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00d6: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (scaleMode) { goto IL_005b; } if (((NetworkObjectReference)(ref itemRef)).TryGet(ref 5__3, (NetworkManager)null)) { Effects.ScaleBackItem(((Component)5__3).GetComponent()); } 5__3 = null; break; case 1: <>1__state = -1; goto IL_005b; case 2: { <>1__state = -1; goto IL_00a7; } IL_005b: if (!((NetworkObjectReference)(ref itemRef)).TryGet(ref 5__1, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } 5__2 = ((Component)5__1).GetComponent(); goto IL_00a7; IL_00a7: if (5__2.originalScale == Vector3.zero) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 2; return true; } if (!syncedFromHost) { Effects.RescaleItemIfTooBig(5__2, size); } else { if (Plugin.config.rescaleItems.Value) { Effects.OverrideOriginalScale(5__2, size); } Effects.ReParentItemToCupboard(5__2, <>4__this, spawnIndex, overridePosRot: true, syncedPos, syncedRot); } 5__1 = null; 5__2 = null; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__42 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SmartCupboard <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogInfo((object)"Syncing Cupboard from host player"); } break; case 1: <>1__state = -1; break; } if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } <>4__this.SyncServerRpc(((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).OwnerClientId); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__30 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference itemRef; public int value; public int save; public int quantity; public int spawnIndex; public bool isStacked; public SmartCupboard <>4__this; private NetworkObject 5__1; private GrabbableObject 5__2; private BoxCollider 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = Effects.SyncItem(itemRef, <>4__this, spawnIndex, value, save); <>1__state = 1; return true; case 1: <>1__state = -1; if (((NetworkObjectReference)(ref itemRef)).TryGet(ref 5__1, (NetworkManager)null)) { 5__2 = ((Component)5__1).GetComponent(); if (!isStacked) { 5__2.PlayDropSFX(); } if (Plugin.config.quantityCursortipActive.Value) { StoredInstanceQuantities.Add(((NetworkBehaviour)5__2).NetworkObjectId, quantity); } if (Plugin.config.quantityDisplayActive.Value) { <>4__this.UpdateDisplayedQuantity(spawnIndex, quantity); } if (((NetworkBehaviour)<>4__this).IsServer) { <>4__this.placedItems[spawnIndex] = 5__2; if (Plugin.config.rescaleItems.Value) { 5__3 = ((Component)5__2).GetComponent(); if ((Object)(object)5__3 == (Object)null) { return false; } SmartCupboard smartCupboard = <>4__this; NetworkObjectReference val = itemRef; Bounds bounds = ((Collider)5__3).bounds; smartCupboard.ScaleItemClientRpc(val, scaleMode: true, ((Bounds)(ref bounds)).extents); 5__3 = null; } } 5__2 = null; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__37 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference itemRef; public int quantity; public SmartCupboard <>4__this; private NetworkObject 5__1; private GrabbableObject 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!((NetworkObjectReference)(ref itemRef)).TryGet(ref 5__1, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } 5__2 = ((Component)5__1).GetComponent(); StoredInstanceQuantities.Add(((NetworkBehaviour)5__2).NetworkObjectId, quantity); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public NetworkObject parentObject; public InteractTrigger triggerScript; public Transform[] placePositions; public TMP_Text[] quantitiesTexts; public SmartMemory memory = new SmartMemory(); public readonly Dictionary placedItems = new Dictionary(); private readonly List indexToRemove = new List(); private GrabbableObject? awaitingObject = null; private bool responseOnAwaiting = false; private bool isRespawningFromSave = false; public static bool SpawnedInShip { get; private set; } = false; public static Dictionary StoredInstanceQuantities { get; } = new Dictionary(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); memory.SetupInitialState(); if (((NetworkBehaviour)this).IsServer) { memory.InitializeCache(); if (Compatibility.GeneralImprovementsInstalled && Plugin.config.customScreenPos.Value > 0 && Plugin.config.customScreenPos.Value <= 14) { ((MonoBehaviour)this).StartCoroutine(DisplayOnScreen()); } GameObject val = GameObject.Find("/Environment/HangarShip"); if ((Object)(object)val != (Object)null) { ((Component)parentObject).transform.SetParent(val.transform, true); } } SpawnedInShip = true; PreparePlacePositions(); if (((NetworkBehaviour)this).IsServer && Plugin.config.permanentItems.Count != 0) { ((MonoBehaviour)this).StartCoroutine(ForceStorePermanentItems()); } if (!Compatibility.CompatibilityModsAreValid) { Compatibility.CheckCompatibilitySSS(registerPopup: false, displayTip: true); } if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(SyncCupboard()); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); SpawnedInShip = false; StoredInstanceQuantities.Clear(); } private void PreparePlacePositions() { if (Plugin.config.rowsOrder.Count != 4) { return; } Transform[] array = (Transform[])(object)new Transform[placePositions.Length]; placePositions.CopyTo(array, 0); foreach (KeyValuePair item in Plugin.config.rowsOrder) { item.Deconstruct(out var key, out var value); int num = key; int num2 = value; int num3 = num2 * Plugin.instance.ROWS_LENGTH; int num4 = (num - 1) * Plugin.instance.ROWS_LENGTH; for (int i = num4; i < num4 + Plugin.instance.ROWS_LENGTH; i++) { placePositions[i] = array[num3++]; } } } public void Update() { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { if (CheckIsFull(GameNetworkManager.Instance.localPlayerController)) { triggerScript.interactable = false; triggerScript.disabledHoverTip = "[Full!]"; } else { triggerScript.interactable = Effects.IsTriggerValid(GameNetworkManager.Instance.localPlayerController, out string notValidText); if (!triggerScript.interactable) { triggerScript.disabledHoverTip = notValidText; } } if (!((NetworkBehaviour)this).IsServer && (Object)(object)awaitingObject != (Object)null && ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)(object)awaitingObject)) { responseOnAwaiting = false; awaitingObject = null; } } if (!((NetworkBehaviour)this).IsServer) { return; } foreach (var (num2, val2) in placedItems) { if (val2.isHeld || val2.isHeldByEnemy) { if (Plugin.config.rescaleItems.Value) { ScaleItemClientRpc(NetworkObjectReference.op_Implicit(((Component)val2).gameObject.GetComponent()), scaleMode: false); } if (Plugin.config.quantityCursortipActive.Value) { UpdateNetworkQuantityClientRpc(((NetworkBehaviour)val2).NetworkObjectId, shouldRemove: true); } SmartMemory.Data data = memory.RetrieveData(num2); if (!memory.IsFull()) { SetSizeClientRpc(memory.Size); } indexToRemove.Add(num2); if (data != null && data.Quantity >= 1) { SpawnItem(data, num2, isStacked: true); } else if (Plugin.config.quantityDisplayActive.Value) { UpdateDisplayedQuantityClientRpc(num2, 0); } } } if (indexToRemove.Count == 0) { return; } foreach (int item in indexToRemove) { placedItems.Remove(item); } indexToRemove.Clear(); } public static void AddTriggerValidation(Func func, string notValidText) { Plugin.spTriggerValidations.Add((func, notValidText)); } [IteratorStateMachine(typeof(d__23))] public IEnumerator ReloadPlacedItems() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__23(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__24))] private IEnumerator ForceStorePermanentItems() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this }; } public void StoreObject(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && player.isHoldingObject && !player.isGrabbingObjectAnimation && !((Object)(object)player.currentlyHeldObjectServer == (Object)null)) { StoreDataServerRpc(player.playerClientId); player.DestroyItemInSlotAndSync(player.currentItemSlot); } } public void GetPlacePosition(int spawnIndex, out Transform parent, out Vector3 position, out Quaternion rotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) parent = placePositions[spawnIndex]; position = parent.position; rotation = parent.rotation * Quaternion.Euler(0f, 0f, 180f); } [ServerRpc(RequireOwnership = false)] private void StoreDataServerRpc(ulong playerId) { //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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3359588108u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3359588108u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val3 == (Object)null) { return; } GrabbableObject currentlyHeldObjectServer = val3.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer == (Object)null) { return; } SmartMemory.Data data = new SmartMemory.Data(currentlyHeldObjectServer); int spawnIndex; bool flag = memory.StoreData(data, out spawnIndex); if (memory.IsFull()) { SetSizeClientRpc(memory.Size); } GrabbableObject value; if (flag) { SpawnItem(data, spawnIndex); } else if (placedItems.TryGetValue(spawnIndex, out value)) { PlayDropSFXClientRpc(NetworkObjectReference.op_Implicit(((Component)value).gameObject.GetComponent())); if (Plugin.config.quantityCursortipActive.Value) { UpdateNetworkQuantityClientRpc(((NetworkBehaviour)value).NetworkObjectId); } if (Plugin.config.quantityDisplayActive.Value && int.TryParse(quantitiesTexts[spawnIndex].text, out var result)) { UpdateDisplayedQuantityClientRpc(spawnIndex, result + 1); } } if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)memory.ToString()); } } private void SpawnItem(SmartMemory.Data itemData, int spawnIndex, bool isStacked = false) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (itemData.IsValid()) { Item item = Effects.GetItem(itemData.Id); if ((Object)(object)item != (Object)null) { Effects.ItemNetworkReference itemNetworkReference = Effects.SpawnItem(item, this, spawnIndex, itemData.Values[0], itemData.Saves[0]); SyncItemClientRpc(itemNetworkReference.netObjectRef, itemNetworkReference.value, itemNetworkReference.save, itemData.Quantity, spawnIndex, isStacked); } } } [ClientRpc] private void SyncItemClientRpc(NetworkObjectReference itemRef, int value, int save, int quantity, int spawnIndex, bool isStacked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3221388649u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, value); BytePacker.WriteValueBitPacked(val2, save); BytePacker.WriteValueBitPacked(val2, quantity); BytePacker.WriteValueBitPacked(val2, spawnIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isStacked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3221388649u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(SyncItem(itemRef, value, save, quantity, spawnIndex, isStacked)); } } } [IteratorStateMachine(typeof(d__30))] private IEnumerator SyncItem(NetworkObjectReference itemRef, int value, int save, int quantity, int spawnIndex, bool isStacked) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { <>4__this = this, itemRef = itemRef, value = value, save = save, quantity = quantity, spawnIndex = spawnIndex, isStacked = isStacked }; } [ClientRpc] private void PlayDropSFXClientRpc(NetworkObjectReference itemRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4245719167u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4245719167u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().PlayDropSFX(); } } } [ClientRpc] private void ScaleItemClientRpc(NetworkObjectReference itemRef, bool scaleMode, Vector3 size = default(Vector3)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2689687125u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref itemRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref scaleMode, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref size); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2689687125u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (Plugin.config.rescaleItems.Value) { ((MonoBehaviour)this).StartCoroutine(ScaleItem(itemRef, scaleMode, size)); } } } [IteratorStateMachine(typeof(d__33))] private IEnumerator ScaleItem(NetworkObjectReference itemRef, bool scaleMode, Vector3 size, bool syncedFromHost = false, int spawnIndex = -1, Vector3 syncedPos = default(Vector3), Quaternion syncedRot = default(Quaternion)) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__33(0) { <>4__this = this, itemRef = itemRef, scaleMode = scaleMode, size = size, syncedFromHost = syncedFromHost, spawnIndex = spawnIndex, syncedPos = syncedPos, syncedRot = syncedRot }; } [ClientRpc] private void UpdateNetworkQuantityClientRpc(ulong networkIdToRemove, bool shouldRemove = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2644479221u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, networkIdToRemove); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref shouldRemove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2644479221u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (Plugin.config.quantityCursortipActive.Value && StoredInstanceQuantities.ContainsKey(networkIdToRemove)) { if (shouldRemove) { StoredInstanceQuantities.Remove(networkIdToRemove); } else { StoredInstanceQuantities[networkIdToRemove]++; } } } private void UpdateDisplayedQuantity(int spawnIndex, int quantity) { quantitiesTexts[spawnIndex].text = ((quantity <= 0) ? "" : ((quantity > 99) ? "99" : quantity.ToString())); } [ClientRpc] private void UpdateDisplayedQuantityClientRpc(int spawnIndex, int quantity) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1627032038u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, spawnIndex); BytePacker.WriteValueBitPacked(val2, quantity); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1627032038u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdateDisplayedQuantity(spawnIndex, quantity); } } } [IteratorStateMachine(typeof(d__37))] private IEnumerator SyncNetworkQuantity(NetworkObjectReference itemRef, int quantity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(0) { <>4__this = this, itemRef = itemRef, quantity = quantity }; } private bool CheckIsFull(PlayerControllerB player) { if (!memory.IsFull()) { return false; } if (!player.isHoldingObject || player.isGrabbingObjectAnimation || (Object)(object)player.currentlyHeldObjectServer == (Object)null) { return true; } if (((NetworkBehaviour)this).IsServer) { return ServerCheckingIsFull(player); } if (responseOnAwaiting) { return false; } if ((Object)(object)awaitingObject != (Object)null) { return true; } awaitingObject = player.currentlyHeldObjectServer; AskServerCheckIsFullServerRpc(player.playerClientId, ((NetworkBehaviour)player).OwnerClientId); return true; } [ServerRpc(RequireOwnership = false)] private void AskServerCheckIsFullServerRpc(ulong playerId, ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3104039900u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3104039900u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; bool response = (Object)(object)val3 == (Object)null || (Object)(object)val3.currentlyHeldObjectServer == (Object)null || ServerCheckingIsFull(val3); ClientRpcParams val4 = default(ClientRpcParams); val4.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientId } }; ClientRpcParams clientRpcParams = val4; ServerResponseCheckIsFullClientRpc(response, clientRpcParams); } } } private bool ServerCheckingIsFull(PlayerControllerB player) { foreach (var (_, val2) in placedItems) { if (player.currentlyHeldObjectServer.itemProperties.itemName == val2.itemProperties.itemName && ((Object)player.currentlyHeldObjectServer.itemProperties).name == ((Object)val2.itemProperties).name) { return false; } } return true; } [ClientRpc] private void ServerResponseCheckIsFullClientRpc(bool response, 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2155821034u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref response, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2155821034u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!response) { responseOnAwaiting = true; } } } [IteratorStateMachine(typeof(d__42))] private IEnumerator SyncCupboard() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__42(0) { <>4__this = this }; } [ServerRpc(RequireOwnership = false)] private void SyncServerRpc(ulong clientId) { //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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2989470694u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2989470694u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (memory.IsFull()) { SetSizeClientRpc(memory.Size); } if (memory.Size == 0) { SetScreenTextServerRpc("No items in Smart Cupboard"); } if (placedItems.Count == 0) { return; } ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientId } }; ClientRpcParams clientRpcParams = val3; foreach (var (num2, val5) in placedItems) { if (!val5.isHeld && !val5.isHeldByEnemy) { int quantity = 0; int value; if (Plugin.config.quantityDisplayActive.Value && int.TryParse(quantitiesTexts[num2].text, out var result)) { quantity = result; } else if (Plugin.config.quantityCursortipActive.Value && StoredInstanceQuantities.TryGetValue(((NetworkBehaviour)val5).NetworkObjectId, out value)) { quantity = value; } Vector3 targetFloorPosition = val5.targetFloorPosition; Quaternion localRotation = ((Component)val5).transform.localRotation; SyncClientRpc(NetworkObjectReference.op_Implicit(((Component)val5).gameObject.GetComponent()), quantity, num2, val5.originalScale, targetFloorPosition, localRotation, clientRpcParams); } } } [ClientRpc] private void SyncClientRpc(NetworkObjectReference itemRef, int quantity, int spawnIndex, Vector3 originalScale, Vector3 syncedPos, Quaternion syncedRot, 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3699506666u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref itemRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, quantity); BytePacker.WriteValueBitPacked(val, spawnIndex); ((FastBufferWriter)(ref val)).WriteValueSafe(ref originalScale); ((FastBufferWriter)(ref val)).WriteValueSafe(ref syncedPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref syncedRot); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3699506666u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(ScaleItem(itemRef, scaleMode: true, originalScale, syncedFromHost: true, spawnIndex, syncedPos, syncedRot)); if (Plugin.config.quantityCursortipActive.Value) { ((MonoBehaviour)this).StartCoroutine(SyncNetworkQuantity(itemRef, quantity)); } if (Plugin.config.quantityDisplayActive.Value) { UpdateDisplayedQuantity(spawnIndex, quantity); } } } [ClientRpc] private void SetSizeClientRpc(int size) { //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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1820484504u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, size); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1820484504u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; memory.Size = size; } } } [IteratorStateMachine(typeof(d__46))] private IEnumerator DisplayOnScreen() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__46(0) { <>4__this = this }; } private string GetItemScreenText(SmartMemory.Data item) { string text = item.Id.Split('/')[1]; int num = ((item.Quantity >= 100) ? 99 : item.Quantity); int num2 = ((num < 10) ? 6 : 5); string text2 = ((text.Length >= num2 + 1) ? text.Substring(0, num2) : text); return text2 + " x" + num + "\n"; } [ServerRpc(RequireOwnership = false)] private void SetScreenTextServerRpc(string text) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(958684778u, val, (RpcDelivery)0); bool flag = text != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(text, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 958684778u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetScreenTextClientRpc(text); } } [ClientRpc] private void SetScreenTextClientRpc(string text) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3117903183u, val, (RpcDelivery)0); bool flag = text != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(text, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3117903183u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (Compatibility.GeneralImprovementsInstalled && Plugin.config.customScreenPos.Value > 0 && Plugin.config.customScreenPos.Value <= 14) { Effects.SetScreenText(Plugin.config.customScreenPos.Value - 1, text); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3359588108u, new RpcReceiveHandler(__rpc_handler_3359588108), "StoreDataServerRpc"); ((NetworkBehaviour)this).__registerRpc(3221388649u, new RpcReceiveHandler(__rpc_handler_3221388649), "SyncItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(4245719167u, new RpcReceiveHandler(__rpc_handler_4245719167), "PlayDropSFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(2689687125u, new RpcReceiveHandler(__rpc_handler_2689687125), "ScaleItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(2644479221u, new RpcReceiveHandler(__rpc_handler_2644479221), "UpdateNetworkQuantityClientRpc"); ((NetworkBehaviour)this).__registerRpc(1627032038u, new RpcReceiveHandler(__rpc_handler_1627032038), "UpdateDisplayedQuantityClientRpc"); ((NetworkBehaviour)this).__registerRpc(3104039900u, new RpcReceiveHandler(__rpc_handler_3104039900), "AskServerCheckIsFullServerRpc"); ((NetworkBehaviour)this).__registerRpc(2155821034u, new RpcReceiveHandler(__rpc_handler_2155821034), "ServerResponseCheckIsFullClientRpc"); ((NetworkBehaviour)this).__registerRpc(2989470694u, new RpcReceiveHandler(__rpc_handler_2989470694), "SyncServerRpc"); ((NetworkBehaviour)this).__registerRpc(3699506666u, new RpcReceiveHandler(__rpc_handler_3699506666), "SyncClientRpc"); ((NetworkBehaviour)this).__registerRpc(1820484504u, new RpcReceiveHandler(__rpc_handler_1820484504), "SetSizeClientRpc"); ((NetworkBehaviour)this).__registerRpc(958684778u, new RpcReceiveHandler(__rpc_handler_958684778), "SetScreenTextServerRpc"); ((NetworkBehaviour)this).__registerRpc(3117903183u, new RpcReceiveHandler(__rpc_handler_3117903183), "SetScreenTextClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3359588108(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) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).StoreDataServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3221388649(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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference itemRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRef, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); int save = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref save); int quantity = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref quantity); int spawnIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref spawnIndex); bool isStacked = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isStacked, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SyncItemClientRpc(itemRef, value, save, quantity, spawnIndex, isStacked); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4245719167(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference itemRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).PlayDropSFXClientRpc(itemRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2689687125(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference itemRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRef, default(ForNetworkSerializable)); bool scaleMode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scaleMode, default(ForPrimitives)); Vector3 size = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref size); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).ScaleItemClientRpc(itemRef, scaleMode, size); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2644479221(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong networkIdToRemove = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref networkIdToRemove); bool shouldRemove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref shouldRemove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).UpdateNetworkQuantityClientRpc(networkIdToRemove, shouldRemove); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1627032038(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int spawnIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref spawnIndex); int quantity = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref quantity); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).UpdateDisplayedQuantityClientRpc(spawnIndex, quantity); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3104039900(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).AskServerCheckIsFullServerRpc(playerId, clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2155821034(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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool response = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref response, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).ServerResponseCheckIsFullClientRpc(response, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2989470694(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SyncServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3699506666(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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference itemRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRef, default(ForNetworkSerializable)); int quantity = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref quantity); int spawnIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref spawnIndex); Vector3 originalScale = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref originalScale); Vector3 syncedPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedPos); Quaternion syncedRot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedRot); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SyncClientRpc(itemRef, quantity, spawnIndex, originalScale, syncedPos, syncedRot, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1820484504(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 sizeClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sizeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SetSizeClientRpc(sizeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_958684778(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string screenTextServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref screenTextServerRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SetScreenTextServerRpc(screenTextServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3117903183(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string screenTextClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref screenTextClientRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((SmartCupboard)(object)target).SetScreenTextClientRpc(screenTextClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SmartCupboard"; } } public class SmartMemory { [Serializable] public class Data { public string Id = "INVALID"; public List Values = new List(); public List Saves = new List(); public int Quantity = 1; public Data() { } public Data(GrabbableObject item) { Id = ConvertID(item.itemProperties); Values.Add(item.itemProperties.isScrap ? item.scrapValue : 0); Saves.Add(item.itemProperties.saveItemVariable ? item.GetItemDataToSave() : 0); } public bool IsValid() { return Id != "INVALID"; } public void Update(Data data) { Id = data.Id; Values.Clear(); Values.AddRange(data.Values); Saves.Clear(); Saves.AddRange(data.Saves); Quantity = data.Quantity; } private string ConvertID(Item sourceItem) { foreach (var (result, val2) in CacheItems) { if ((Object)(object)val2 == (Object)(object)sourceItem) { return result; } } return "LethalCompanyGame/" + sourceItem.itemName; } public unsafe void NetworkerSerialize(BufferSerializer serializer) where T : IReaderWriter { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) serializer.SerializeValue(ref Id, false); if (serializer.IsWriter) { FastBufferWriter fastBufferWriter = serializer.GetFastBufferWriter(); int count = Values.Count; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(ref count, default(ForPrimitives)); foreach (int value in Values) { int current = value; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(ref current, default(ForPrimitives)); } count = Saves.Count; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(ref count, default(ForPrimitives)); foreach (int safe in Saves) { int current2 = safe; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(ref current2, default(ForPrimitives)); } } if (serializer.IsReader) { FastBufferReader fastBufferReader = serializer.GetFastBufferReader(); int num = default(int); ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref num, default(ForPrimitives)); int item = default(int); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref item, default(ForPrimitives)); Values.Add(item); } ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref num, default(ForPrimitives)); int item2 = default(int); for (int j = 0; j < num; j++) { ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref item2, default(ForPrimitives)); Saves.Add(item2); } } ((BufferSerializer*)(&serializer))->SerializeValue(ref Quantity, default(ForPrimitives)); } } public static SmartMemory? Instance; public int Size = 0; public readonly List IgnoreSpaces = new List(); public readonly List> ItemList = new List>(4); public static readonly Dictionary CacheItems = new Dictionary(); public int Capacity { get; private set; } = 16; public bool IsFull() { return Size == Capacity; } public void SetupInitialState() { if (Plugin.instance.ROWS_LENGTH == 7) { Capacity = 28; } ClearAll(resetData: false); } public void ClearAll(bool resetData = true) { if (resetData) { ItemList.ForEach(delegate(List x) { x.Clear(); }); ItemList.Clear(); Size = 0; } for (int i = 0; i < 4; i++) { List list = new List(Plugin.instance.ROWS_LENGTH); for (int j = 0; j < Plugin.instance.ROWS_LENGTH; j++) { list.Add(new Data()); } ItemList.Add(list); } } public void InitializeCache() { Instance = this; if (Compatibility.DawnLibInstalled) { Effects.FillUpCacheFromDawnLib(CacheItems); } else if (Compatibility.LethalLibInstalled) { Effects.FillUpCacheFromLethalLib(CacheItems); } } public bool StoreData(Data data, out int spawnIndex, bool freeSpaceOnly = false) { if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)ToString()); Plugin.logger.LogWarning((object)("Storing: " + data.Id)); } spawnIndex = 0; int lastFreeSpaceId = -1; foreach (List item in ItemList) { foreach (Data item2 in item) { if (!item2.IsValid() && lastFreeSpaceId == -1) { lastFreeSpaceId = spawnIndex; if (IgnoreSpaces.Count > 0 && IgnoreSpaces.Exists((int e) => e == lastFreeSpaceId)) { lastFreeSpaceId = -1; } else if (freeSpaceOnly) { break; } } else if (!freeSpaceOnly && item2.IsValid() && item2.Id == data.Id) { if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)"Found a similar item"); } item2.Values.Add(data.Values[0]); item2.Saves.Add(data.Saves[0]); item2.Quantity++; return false; } spawnIndex++; } if (freeSpaceOnly && lastFreeSpaceId != -1) { break; } } if (lastFreeSpaceId != -1) { if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogWarning((object)"Found 1 free space"); } spawnIndex = lastFreeSpaceId; int num = (int)((float)lastFreeSpaceId / (float)Plugin.instance.ROWS_LENGTH); int index = lastFreeSpaceId - num * Plugin.instance.ROWS_LENGTH; ItemList[num][index].Update(data); Size++; return true; } Plugin.logger.LogError((object)("SmartCupboard was full when " + data.Id + " tried to be stored.")); return false; } public Data? RetrieveData(int spawnIndex, bool updateQuantity = true) { if (Plugin.config.verboseLogging.Value && updateQuantity) { Plugin.logger.LogWarning((object)ToString()); Plugin.logger.LogWarning((object)("Retrieving item at position: " + spawnIndex)); } int num = (int)((float)spawnIndex / (float)Plugin.instance.ROWS_LENGTH); int num2 = spawnIndex - num * Plugin.instance.ROWS_LENGTH; if (num >= 4 || num2 >= Plugin.instance.ROWS_LENGTH) { return null; } Data data = ItemList[num][num2]; if (!data.IsValid()) { return null; } if (updateQuantity) { data.Values.RemoveAt(0); data.Saves.RemoveAt(0); data.Quantity--; if (data.Quantity <= 0) { Size--; ItemList[num][num2] = new Data(); } } if (Plugin.config.verboseLogging.Value && updateQuantity) { Plugin.logger.LogWarning((object)ToString()); } return data; } public override string ToString() { int num = 0; StringBuilder stringBuilder = new StringBuilder().Append("Stored items:\n"); if (Size == 0) { return stringBuilder.Append("None\n").ToString(); } foreach (List item in ItemList) { foreach (Data item2 in item) { if (item2.IsValid()) { stringBuilder.Append(num + ": " + item2.Id + " x" + item2.Quantity + "\n"); } num++; } } return stringBuilder.ToString(); } } } namespace SelfSortingStorage.Buttons { public class DeathButton : NetworkBehaviour { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DeathButton <>4__this; private GameObject 5__1; private Dictionary.Enumerator <>s__2; private GrabbableObject 5__3; private NetworkObject 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>s__2 = default(Dictionary.Enumerator); 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = Effects.FadeOutAudio(<>4__this.buttonAudio, 0.1f, specialStop: true); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.2f); <>1__state = 3; return true; case 3: <>1__state = -1; if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } 5__1 = Object.Instantiate(StartOfRound.Instance.explosionPrefab, <>4__this.explosionPosition.position, Quaternion.Euler(-90f, 0f, 0f)); 5__1.SetActive(true); <>4__this.triggerScript.hoverTip = "Reset : [LMB]"; <>4__this.smartCupboardScript.memory.Size = 0; <>4__this.isAboutToClear = false; if (((NetworkBehaviour)<>4__this).IsServer) { <>s__2 = <>4__this.smartCupboardScript.placedItems.GetEnumerator(); try { while (<>s__2.MoveNext()) { <>s__2.Current.Deconstruct(out int _, out GrabbableObject value); 5__3 = value; 5__4 = ((Component)5__3).gameObject.GetComponent(); if ((Object)(object)5__4 != (Object)null && 5__4.IsSpawned) { 5__4.Despawn(true); } 5__4 = null; 5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(Dictionary.Enumerator); <>4__this.smartCupboardScript.memory.ClearAll(); <>4__this.smartCupboardScript.placedItems.Clear(); if (Plugin.config.verboseLogging.Value) { Plugin.logger.LogInfo((object)"Smart Cupboard was reseted because of the Death Button."); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DeathButton <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } <>4__this.SyncServerRpc(((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).OwnerClientId); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public InteractTrigger triggerScript; public Transform explosionPosition; public AudioSource buttonAudio; public AudioClip buttonAlarm; public SmartCupboard smartCupboardScript; private readonly float alarmTime = 5.5f; private float actualTime = 0f; private bool inAlarmPhase = false; private bool isAboutToClear = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (Plugin.config.resetButton.Value && !((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(SyncButton()); if (Plugin.config.resetButtonHostOnly.Value) { triggerScript.interactable = false; triggerScript.disabledHoverTip = "[Must be server host]"; } } } public void Press(bool _) { if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !isAboutToClear) { if (inAlarmPhase) { isAboutToClear = true; inAlarmPhase = false; actualTime = 0f; triggerScript.hoverTip = ""; ((MonoBehaviour)this).StartCoroutine(ClearSSS()); } else { inAlarmPhase = true; buttonAudio.PlayOneShot(buttonAlarm, 1.5f); triggerScript.hoverTip = "Confirm ? : [LMB]"; } } } [IteratorStateMachine(typeof(d__12))] private IEnumerator ClearSSS() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } public void Update() { if (inAlarmPhase) { actualTime += Time.deltaTime; if (actualTime >= alarmTime) { inAlarmPhase = false; actualTime = 0f; triggerScript.hoverTip = "Reset : [LMB]"; } } } [IteratorStateMachine(typeof(d__14))] private IEnumerator SyncButton() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } [ServerRpc(RequireOwnership = false)] private void SyncServerRpc(ulong clientId) { //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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3185432469u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3185432469u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (isAboutToClear || inAlarmPhase) { ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientId } }; ClientRpcParams clientRpcParams = val3; SyncClientRpc(isAboutToClear, inAlarmPhase, actualTime, triggerScript.hoverTip, clientRpcParams); } } } [ClientRpc] private void SyncClientRpc(bool aboutToClear, bool alarmPhase, float time, string tip, 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2686590570u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref aboutToClear, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref alarmPhase, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref time, default(ForPrimitives)); bool flag = tip != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(tip, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2686590570u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; isAboutToClear = aboutToClear; inAlarmPhase = alarmPhase; actualTime = time; triggerScript.hoverTip = tip; } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3185432469u, new RpcReceiveHandler(__rpc_handler_3185432469), "SyncServerRpc"); ((NetworkBehaviour)this).__registerRpc(2686590570u, new RpcReceiveHandler(__rpc_handler_2686590570), "SyncClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3185432469(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((DeathButton)(object)target).SyncServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2686590570(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00e6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool aboutToClear = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref aboutToClear, default(ForPrimitives)); bool alarmPhase = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref alarmPhase, default(ForPrimitives)); float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string tip = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref tip, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((DeathButton)(object)target).SyncClientRpc(aboutToClear, alarmPhase, time, tip, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DeathButton"; } } public class LightButton : NetworkBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LightButton <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } <>4__this.SyncServerRpc(((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).OwnerClientId); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public MeshRenderer[] bulbs; public Light[] lights; private bool isOn = false; private Color originalBulbColor; public override void OnNetworkSpawn() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); if (Plugin.config.cozyLights.Value) { originalBulbColor = ((Renderer)bulbs[0]).materials[0].GetColor("_EmissiveColor"); SwitchLights(on: false); if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(SyncButton()); } } } public void Press(bool _) { if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { isOn = !isOn; SwitchLights(isOn); } } private void SwitchLights(bool on) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Color val = (on ? originalBulbColor : Color.black); MeshRenderer[] array = bulbs; foreach (MeshRenderer val2 in array) { ((Renderer)val2).materials[0].SetColor("_EmissiveColor", val); } Light[] array2 = lights; foreach (Light val3 in array2) { ((Behaviour)val3).enabled = on; } } [IteratorStateMachine(typeof(d__8))] private IEnumerator SyncButton() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this }; } [ServerRpc(RequireOwnership = false)] private void SyncServerRpc(ulong clientId) { //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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2917181032u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2917181032u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (isOn) { ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientId } }; ClientRpcParams clientRpcParams = val3; SyncClientRpc(isOn, clientRpcParams); } } } [ClientRpc] private void SyncClientRpc(bool on, 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(142653971u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref on, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 142653971u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; isOn = on; SwitchLights(isOn); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2917181032u, new RpcReceiveHandler(__rpc_handler_2917181032), "SyncServerRpc"); ((NetworkBehaviour)this).__registerRpc(142653971u, new RpcReceiveHandler(__rpc_handler_142653971), "SyncClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2917181032(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightButton)(object)target).SyncServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_142653971(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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool on = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref on, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((LightButton)(object)target).SyncClientRpc(on, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LightButton"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace SelfSortingStorage.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }