Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DedicatedStorageQOL v1.1.0
BepInEx/plugins/DedicatedStorageQOL.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DedicatedStorageQOL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DedicatedStorageQOL")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b2e5b92d-d5b6-438a-b57d-220451b8fd65")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("YubinYankinov.DedicatedStorageQOL", "DedicatedStorageQOL", "1.0.3")] public class DedicatedStorageQOL : BaseUnityPlugin { [CompilerGenerated] private sealed class <ShowAnimatedMessage>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public string message; private float <delay>5__2; private int <repeat>5__3; private int <i>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShowAnimatedMessage>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <delay>5__2 = 0.15f; <repeat>5__3 = 3; <i>5__4 = 0; goto IL_00ba; case 1: <>1__state = -1; ((Character)player).Message((MessageType)2, "", 0, (Sprite)null); <>2__current = (object)new WaitForSeconds(<delay>5__2); <>1__state = 2; return true; case 2: <>1__state = -1; <i>5__4++; goto IL_00ba; case 3: { <>1__state = -1; ((Character)player).Message((MessageType)2, "", 0, (Sprite)null); return false; } IL_00ba: if (<i>5__4 < <repeat>5__3) { ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); <>2__current = (object)new WaitForSeconds(<delay>5__2); <>1__state = 1; return true; } ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 3; 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(); } } internal static ManualLogSource Logger; private static ConfigEntry<float> TransferRadius; private static ConfigEntry<KeyCode> ModKey1; private static ConfigEntry<KeyCode> ModKey2; private const string GitHubOwner = "yubinyankinov"; private const string GitHubRepo = "DedicatedStorageQOL"; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; TransferRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TransferRadius", 10f, "Max distance (meters) to scan for storage boxes."); ModKey1 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "PrimaryKey", (KeyCode)306, "First modifier key for quick transfer."); ModKey2 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "SecondaryKey", (KeyCode)101, "Second modifier key for quick transfer."); Logger.LogInfo((object)"DedicatedStorageQOL loaded successfully!"); } private void Update() { //IL_0015: 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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && ZInput.GetKey(ModKey1.Value, true) && ZInput.GetKeyDown(ModKey2.Value, true)) { TryTransferToNearbyStorage(localPlayer); } } private void TryTransferToNearbyStorage(Player player) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) GameObject hoverObject = ((Humanoid)player).GetHoverObject(); Container val = ((hoverObject != null) ? hoverObject.GetComponentInParent<Container>() : null); Collider[] array = Physics.OverlapSphere(((Component)player).transform.position, TransferRadius.Value); List<Container> list = new List<Container>(); Collider[] array2 = array; for (int i = 0; i < array2.Length; i++) { Container componentInParent = ((Component)array2[i]).GetComponentInParent<Container>(); if ((Object)(object)componentInParent != (Object)null) { ZNetView component = ((Component)componentInParent).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { list.Add(componentInParent); } } } if ((Object)(object)val != (Object)null && !list.Contains(val)) { list.Add(val); } AutoTransferItems(player, list); } private void AutoTransferItems(Player player, List<Container> containers) { if ((Object)(object)player == (Object)null || containers == null || containers.Count == 0) { return; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } List<ItemData> list = new List<ItemData>(inventory.GetAllItems()); int num = 0; foreach (ItemData item in list) { if (inventory.GetEquippedItems().Contains(item) || inventory.GetHotbar(false).Contains(item)) { continue; } foreach (Container container in containers) { Inventory inventory2 = container.GetInventory(); if (inventory2 != null && inventory2.GetAllItems().Any((ItemData i) => i.m_shared.m_name == item.m_shared.m_name)) { ItemData val = item.Clone(); val.m_stack = item.m_stack; if (inventory2.AddItem(val)) { inventory.RemoveItem(item); num++; break; } } } } if (num > 0) { string message = string.Format("<color=#00FF00>✅ Transferred {0} item{1}!</color>", num, (num > 1) ? "s" : ""); ((MonoBehaviour)this).StartCoroutine(ShowAnimatedMessage(player, message)); } } [IteratorStateMachine(typeof(<ShowAnimatedMessage>d__10))] private IEnumerator ShowAnimatedMessage(Player player, string message) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShowAnimatedMessage>d__10(0) { player = player, message = message }; } }