using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ChumBucket.Bucket; using ChumBucket.Input; using ChumBucket.Net; using FishNet.Object; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ChumBucket")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Azumatt")] [assembly: AssemblyProduct("ChumBucket")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("AAB794F9-C222-428E-A7EB-C5140C9DCA16")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class ExtensionMarkerAttribute : Attribute { public ExtensionMarkerAttribute(string name) { } } } namespace ChumBucket { [BepInPlugin("Azumatt.ChumBucket", "ChumBucket", "1.0.0")] public class ChumBucketPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } internal const string ModName = "ChumBucket"; internal const string ModVersion = "1.0.0"; internal const string Author = "Azumatt"; private const string ModGUID = "Azumatt.ChumBucket"; private const string ConfigFileName = "Azumatt.ChumBucket.cfg"; private static readonly string ConfigFileFullPath; internal static readonly ManualLogSource ChumBucketLogger; private readonly Harmony harmony = new Harmony("Azumatt.ChumBucket"); internal static ConfigEntry modEnabled; internal static ConfigEntry placeKey; internal static ConfigEntry bucketSize; internal static ConfigEntry placeDistance; internal static ConfigEntry headroom; internal static ConfigEntry bucketColor; internal static ConfigEntry buttonColor; internal static ConfigEntry maxSellDistance; internal static ConfigEntry maxSellBoxSize; private static string sizeRaw; private static Vector3 size; internal static bool IsEnabled { get { ConfigEntry val = modEnabled; if (val != null) { return val.Value == Toggle.On; } return false; } } internal static Vector3 Size { get { //IL_0025: 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_0040: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) string value = bucketSize.Value; if (value == sizeRaw) { return size; } sizeRaw = value; Vector3 val = ParseVector(value); size = new Vector3(Mathf.Max(0.4f, val.x), Mathf.Max(0.3f, val.y), Mathf.Max(0.4f, val.z)); return size; } } public void Awake() { //IL_004a: 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_00b0: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; AddColorConverter(); modEnabled = config("1 - General", "Enabled", Toggle.On, "Turn the whole mod off without unloading it."); placeKey = config("1 - General", "Place Key", new KeyboardShortcut((KeyCode)106, Array.Empty()), "Key that drops the bucket in front of you and picks it back up. Modifiers work, so 'J + LeftAlt' is fine. Vanilla already owns WASD, QEFRZXCVB, 1-9, space, tab, shift, ctrl and escape."); bucketSize = config("2 - Bucket", "Bucket Size", "1.4, 0.8, 1.4", "Outer x, y, z of the bucket in meters. Bigger holds more fish and is more of an eyesore."); placeDistance = config("2 - Bucket", "Place Distance", 1.2f, new ConfigDescription("How far in front of you the bucket lands.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 4f), Array.Empty())); headroom = config("2 - Bucket", "Headroom", 0.25f, new ConfigDescription("How far above the rim still counts as inside. A fish poking out of the top sells with the rest.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); bucketColor = config("2 - Bucket", "Bucket Color", new Color(0.22f, 0.26f, 0.3f), "Color of the walls and floor."); buttonColor = config("2 - Bucket", "Button Color", new Color(0.85f, 0.68f, 0.15f), "Color of the sell button on the rim."); maxSellDistance = config("3 - Host", "Max Sell Distance", 8f, new ConfigDescription("Host side. A sell request is dropped unless a player is standing this close to the box being sold. Only the host's value matters.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 50f), Array.Empty())); maxSellBoxSize = config("3 - Host", "Max Sell Box Size", 6f, new ConfigDescription("Host side. Biggest half extent a client is allowed to ask us to sell, in meters. Stops a modified client selling the whole island. Only the host's value matters.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 20f), Array.Empty())); Assembly executingAssembly = Assembly.GetExecutingAssembly(); harmony.PatchAll(executingAssembly); SetupWatcher(); if (saveOnConfigSet) { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet; ((BaseUnityPlugin)this).Config.Save(); } } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, "Azumatt.ChumBucket.cfg"); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { ((BaseUnityPlugin)this).Config.Reload(); } catch { ChumBucketLogger.LogError((object)"There was an issue loading your Azumatt.ChumBucket.cfg"); ChumBucketLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private static Vector3 ParseVector(string raw) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) string[] array = raw.Split(new char[1] { ',' }); Vector3 zero = Vector3.zero; for (int i = 0; i < 3 && i < array.Length; i++) { if (float.TryParse(array[i].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { ((Vector3)(ref zero))[i] = result; } } return zero; } private ConfigEntry config(string group, string name, T value, ConfigDescription description) { return ((BaseUnityPlugin)this).Config.Bind(group, name, value, description); } private ConfigEntry config(string group, string name, T value, string description) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty())); } private static void AddColorConverter() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0070: Expected O, but got Unknown if (!TomlTypeConverter.CanConvert(typeof(Color))) { Color val = default(Color); TomlTypeConverter.AddConverter(typeof(Color), new TypeConverter { ConvertToString = (object value, Type _) => "#" + ColorUtility.ToHtmlStringRGBA((Color)value), ConvertToObject = (string value, Type _) => ColorUtility.TryParseHtmlString(value.Trim(), ref val) ? val : Color.white }); } } static ChumBucketPlugin() { //IL_007b: 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) string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + "Azumatt.ChumBucket.cfg"; ChumBucketLogger = Logger.CreateLogSource("ChumBucket"); modEnabled = null; placeKey = null; bucketSize = null; placeDistance = null; headroom = null; bucketColor = null; buttonColor = null; maxSellDistance = null; maxSellBoxSize = null; sizeRaw = null; size = new Vector3(1.4f, 0.8f, 1.4f); } } public static class Patches { [HarmonyPatch(typeof(Server), "RpcLogic___SendChatMessage___3264264606")] private static class SwallowSellRequest { private static bool Prefix(string __1) { return !SellRequest.TryHandle(__1); } } [HarmonyPatch(typeof(OnlineChatManager), "RpcLogic___SendChatMessage___3264264606")] private static class HideRelayedSellRequest { private static bool Prefix(string __1) { return !SellRequest.IsRequest(__1); } } [HarmonyPatch(typeof(Player), "InitializePlayer")] private static class SpawnBucketSpawner { private static bool spawned; private static void Postfix() { if (!spawned) { spawned = true; BucketSpawner.Create(); } } } } } namespace ChumBucket.Net { internal static class SellRequest { internal const string Prefix = "!chumbucket "; private const int FieldCount = 7; private static readonly List Sellable = new List(); internal static void Send(ChumBucket.Bucket.Bucket bucket) { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0050: 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_0038: 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) if (Object.op_Implicit((Object)(object)Server.Instance)) { Vector3 interiorCenter = bucket.InteriorCenter; Vector3 interiorHalfExtents = bucket.InteriorHalfExtents; float y = ((Component)bucket).transform.eulerAngles.y; if (((NetworkBehaviour)Server.Instance).IsServerInitialized) { Execute(interiorCenter, interiorHalfExtents, y); } else { Server.Instance.SendChatMessage(SteamUser.GetSteamID().m_SteamID, Encode(interiorCenter, interiorHalfExtents, y)); } } } internal static bool IsRequest(string? message) { return message?.StartsWith("!chumbucket ", StringComparison.Ordinal) ?? false; } internal static bool TryHandle(string message) { //IL_0075: 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) if (!IsRequest(message)) { return false; } if (!ChumBucketPlugin.IsEnabled) { return true; } string[] array = message.Substring("!chumbucket ".Length).Split(new char[1] { ' ' }); if (array.Length < 7) { return true; } float[] array2 = new float[7]; for (int i = 0; i < 7; i++) { if (!float.TryParse(array[i], NumberStyles.Float, CultureInfo.InvariantCulture, out array2[i])) { return true; } } Execute(new Vector3(array2[0], array2[1], array2[2]), new Vector3(array2[3], array2[4], array2[5]), array2[6]); return true; } private static string Encode(Vector3 center, Vector3 halfExtents, float yaw) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; return "!chumbucket " + string.Join(" ", center.x.ToString("R", invariantCulture), center.y.ToString("R", invariantCulture), center.z.ToString("R", invariantCulture), halfExtents.x.ToString("R", invariantCulture), halfExtents.y.ToString("R", invariantCulture), halfExtents.z.ToString("R", invariantCulture), yaw.ToString("R", invariantCulture)); } private static void Execute(Vector3 center, Vector3 halfExtents, float yaw) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Server.Instance) || !((NetworkBehaviour)Server.Instance).IsServerInitialized) { return; } float value = ChumBucketPlugin.maxSellBoxSize.Value; ((Vector3)(ref halfExtents))..ctor(Mathf.Clamp(halfExtents.x, 0f, value), Mathf.Clamp(halfExtents.y, 0f, value), Mathf.Clamp(halfExtents.z, 0f, value)); float value2 = ChumBucketPlugin.maxSellDistance.Value; Player nearestAlivePlayer = PlayerManager.GetNearestAlivePlayer(center); if (Object.op_Implicit((Object)(object)nearestAlivePlayer)) { Vector3 val = nearestAlivePlayer.Transform.position - center; if (!(((Vector3)(ref val)).sqrMagnitude > value2 * value2)) { ChumBucket.Bucket.Bucket.CollectContents(center, halfExtents, Quaternion.Euler(0f, yaw, 0f), Sellable); foreach (Item item in Sellable) { MoneyManager.SellItem(item); item.DestroyItem((byte)0, byte.MaxValue); } Sellable.Clear(); return; } } ChumBucketPlugin.ChumBucketLogger.LogWarning((object)$"Dropped a sell request at {center}, nobody is standing near it"); } } } namespace ChumBucket.Input { public static class KeyboardExtensions { [SpecialName] public sealed class $8D1D3E80A18AA9715780B6CB7003B2F1 { [SpecialName] public static class $895AB635D4D087636CF1C26BA650BA11 { } [ExtensionMarker("$895AB635D4D087636CF1C26BA650BA11")] public bool IsKeyDown() { throw null; } [ExtensionMarker("$895AB635D4D087636CF1C26BA650BA11")] public bool IsKeyHeld() { throw null; } [ExtensionMarker("$895AB635D4D087636CF1C26BA650BA11")] public string? VanillaAction() { throw null; } } private static readonly Dictionary Keys = BuildKeyLookup(); public static bool IsKeyDown(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) KeyControl val = Control(((KeyboardShortcut)(ref shortcut)).MainKey); if (val != null && ((ButtonControl)val).wasPressedThisFrame) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All(IsHeld); } return false; } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) KeyControl val = Control(((KeyboardShortcut)(ref shortcut)).MainKey); if (val != null && ((ButtonControl)val).isPressed) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All(IsHeld); } return false; } public static string? VanillaAction(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_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) KeyControl val = Control(((KeyboardShortcut)(ref shortcut)).MainKey); if (val == null || !Object.op_Implicit((Object)(object)GameInfo._instance) || !Object.op_Implicit((Object)(object)GameInfo.Input) || !Object.op_Implicit((Object)(object)GameInfo.Input.actions)) { return null; } foreach (InputAction action in GameInfo.Input.actions) { Enumerator enumerator2 = action.bindings.GetEnumerator(); try { while (enumerator2.MoveNext()) { InputBinding current2 = enumerator2.Current; if (!((InputBinding)(ref current2)).isComposite && InputControlPath.Matches(((InputBinding)(ref current2)).effectivePath, (InputControl)(object)val)) { return action.name; } } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } } return null; } private static KeyControl? Control(KeyCode code) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null || !Keys.TryGetValue(code, out var value)) { return null; } return current[value]; } private static bool IsHeld(KeyCode code) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) KeyControl val = Control(code); if (val != null) { return ((ButtonControl)val).isPressed; } return false; } private static Dictionary BuildKeyLookup() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { string text = ((object)value/*cast due to .constrained prefix*/).ToString(); if (text.StartsWith("Alpha")) { text = "Digit" + text.Substring(5); } else if (text.StartsWith("Keypad")) { text = "Numpad" + text.Substring(6); } else { string text2; switch (text) { case "Return": text2 = "Enter"; break; case "LeftControl": text2 = "LeftCtrl"; break; case "RightControl": text2 = "RightCtrl"; break; case "LeftWindows": case "LeftCommand": case "LeftApple": text2 = "LeftMeta"; break; case "RightWindows": case "RightCommand": case "RightApple": text2 = "RightMeta"; break; case "BackQuote": text2 = "Backquote"; break; case "Print": text2 = "PrintScreen"; break; default: text2 = text; break; } text = text2; } if (Enum.TryParse(text, ignoreCase: true, out Key result) && (int)result != 0) { dictionary[value] = result; } } return dictionary; } } } namespace ChumBucket.Bucket { public class Bucket : MonoBehaviour { private const float WallThickness = 0.06f; private const float ScanInterval = 0.1f; internal static Bucket? Local; private static Collider[] hits = (Collider[])(object)new Collider[128]; private static Shader? litShader; private static Material? panelMaterial; private static Material? buttonMaterial; private readonly List contents = new List(); private Vector3 interiorCenterLocal; private float nextScan; internal int Count { get; private set; } internal int Worth { get; private set; } internal Vector3 InteriorCenter => ((Component)this).transform.TransformPoint(interiorCenterLocal); internal Vector3 InteriorHalfExtents { get; private set; } internal static Material PanelMaterial => Tint(ref panelMaterial, ChumBucketPlugin.bucketColor.Value); internal static Material ButtonMaterial => Tint(ref buttonMaterial, ChumBucketPlugin.buttonColor.Value); internal static Bucket Build(Vector3 pos, Quaternion rot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_0036: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0082: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) //IL_013e: 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_0154: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown Vector3 size = ChumBucketPlugin.Size; float num = size.y - 0.06f; float value = ChumBucketPlugin.headroom.Value; GameObject val = new GameObject("ChumBucket"); val.SetActive(false); val.transform.SetPositionAndRotation(pos, rot); Material mat = PanelMaterial; int layer = LayerMask.NameToLayer("Level"); Panel(val, mat, layer, new Vector3(0f, 0.03f, 0f), new Vector3(size.x, 0.06f, size.z)); Panel(val, mat, layer, new Vector3(0f, 0.06f + num * 0.5f, (size.z - 0.06f) * 0.5f), new Vector3(size.x, num, 0.06f)); Panel(val, mat, layer, new Vector3(0f, 0.06f + num * 0.5f, (0f - (size.z - 0.06f)) * 0.5f), new Vector3(size.x, num, 0.06f)); Panel(val, mat, layer, new Vector3((size.x - 0.06f) * 0.5f, 0.06f + num * 0.5f, 0f), new Vector3(0.06f, num, size.z - 0.12f)); Panel(val, mat, layer, new Vector3((0f - (size.x - 0.06f)) * 0.5f, 0.06f + num * 0.5f, 0f), new Vector3(0.06f, num, size.z - 0.12f)); Bucket bucket = val.AddComponent(); bucket.interiorCenterLocal = new Vector3(0f, 0.06f + (num + value) * 0.5f, 0f); bucket.InteriorHalfExtents = new Vector3((size.x - 0.12f) * 0.5f, (num + value) * 0.5f, (size.z - 0.12f) * 0.5f); SellButton.Attach(val, bucket, new Vector3(0f, size.y + 0.08f, 0f - (size.z * 0.5f + 0.04f))); val.SetActive(true); return bucket; } private static GameObject Panel(GameObject parent, Material mat, int layer, Vector3 localPos, Vector3 localScale) { //IL_002a: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Panel"; val.transform.SetParent(parent.transform, false); val.transform.localPosition = localPos; val.transform.localScale = localScale; if (layer >= 0) { val.layer = layer; } MeshRenderer val2 = default(MeshRenderer); if (val.TryGetComponent(ref val2)) { ((Renderer)val2).sharedMaterial = mat; } return val; } private static Material Tint(ref Material? material, Color color) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)material)) { if (!Object.op_Implicit((Object)(object)litShader)) { litShader = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Sprites/Default"); } material = new Material(litShader); } material.color = color; if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", color); } return material; } internal static void ApplyColors() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)panelMaterial)) { Tint(ref panelMaterial, ChumBucketPlugin.bucketColor.Value); } if (Object.op_Implicit((Object)(object)buttonMaterial)) { Tint(ref buttonMaterial, ChumBucketPlugin.buttonColor.Value); } } internal static void RebuildLocal() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Local)) { Transform transform = ((Component)Local).transform; Vector3 position = transform.position; Quaternion rotation = transform.rotation; Object.Destroy((Object)(object)((Component)Local).gameObject); Local = Build(position, rotation); } } internal static void CollectContents(Vector3 center, Vector3 halfExtents, Quaternion rotation, List into) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) into.Clear(); int num; for (num = Physics.OverlapBoxNonAlloc(center, halfExtents, hits, rotation, LayerMask.op_Implicit(GameInfo.ItemLayer)); num == hits.Length; num = Physics.OverlapBoxNonAlloc(center, halfExtents, hits, rotation, LayerMask.op_Implicit(GameInfo.ItemLayer))) { hits = (Collider[])(object)new Collider[hits.Length * 2]; } for (int i = 0; i < num; i++) { Collider val = hits[i]; if (((Component)((Component)val).transform).CompareTag("Item")) { Item val2 = ItemManager.Get(val); if (Object.op_Implicit((Object)(object)val2) && !Object.op_Implicit((Object)(object)val2.Holder) && !val2.IsDestroying && !((NetworkBehaviour)val2).IsDeinitializing && !Object.op_Implicit((Object)(object)val2.DeadPlayer) && (!Object.op_Implicit((Object)(object)val2.Creature) || val2.Creature.IsDead) && !into.Contains(val2)) { into.Add(val2); } } } } internal void Refresh() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime < nextScan) { return; } nextScan = Time.unscaledTime + 0.1f; CollectContents(InteriorCenter, InteriorHalfExtents, ((Component)this).transform.rotation, contents); int num = 0; foreach (Item content in contents) { num += content.TotalWorth; } Count = contents.Count; Worth = num; } private void OnDestroy() { if ((Object)(object)Local == (Object)(object)this) { Local = null; } } } public class BucketSpawner : MonoBehaviour { internal static void Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("BucketSpawner"); Object.DontDestroyOnLoad((Object)val); val.AddComponent(); WarnOnVanillaKey(); ChumBucketPlugin.placeKey.SettingChanged += delegate { WarnOnVanillaKey(); }; ChumBucketPlugin.bucketColor.SettingChanged += delegate { Bucket.ApplyColors(); }; ChumBucketPlugin.buttonColor.SettingChanged += delegate { Bucket.ApplyColors(); }; ChumBucketPlugin.bucketSize.SettingChanged += delegate { Bucket.RebuildLocal(); }; ChumBucketPlugin.headroom.SettingChanged += delegate { Bucket.RebuildLocal(); }; } private static void WarnOnVanillaKey() { //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) string text = ChumBucketPlugin.placeKey.Value.VanillaAction(); if (text != null) { ChumBucketPlugin.ChumBucketLogger.LogWarning((object)$"Place Key is {ChumBucketPlugin.placeKey.Value}, which the game already uses for '{text}'. Both will fire. Pick something else in the config."); } } private void Update() { //IL_000d: 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_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_0063: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0085: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!ChumBucketPlugin.IsEnabled || !ChumBucketPlugin.placeKey.Value.IsKeyDown()) { return; } Player localPlayer = Player.LocalPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || localPlayer.BlockInputs) { return; } if (Object.op_Implicit((Object)(object)Bucket.Local)) { Object.Destroy((Object)(object)((Component)Bucket.Local).gameObject); Bucket.Local = null; return; } Vector3 val = localPlayer.CurPlayerRot * Vector3.forward; Vector3 val2 = localPlayer.Transform.position + val * ChumBucketPlugin.placeDistance.Value; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 1.5f, Vector3.down, ref val3, 4f, LayerMask.op_Implicit(GameInfo.LevelLayer))) { val2 = ((RaycastHit)(ref val3)).point; } Bucket.Local = Bucket.Build(val2, Quaternion.LookRotation(val, Vector3.up)); } } public class SellButton : Interactable { private Bucket bucket; private string hoverText = ""; private int shownWorth = -1; private int shownCount = -1; internal static SellButton Attach(GameObject root, Bucket bucket, Vector3 localPos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SellButton"); val.SetActive(false); val.transform.SetParent(root.transform, false); val.transform.localPosition = localPos; val.layer = LayerMask.NameToLayer("Interactable"); val.tag = "Interactable"; BoxCollider val2 = val.AddComponent(); val2.size = new Vector3(0.22f, 0.16f, 0.1f); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val3).name = "Mesh"; val3.transform.SetParent(val.transform, false); val3.transform.localScale = new Vector3(0.2f, 0.14f, 0.08f); Object.Destroy((Object)(object)val3.GetComponent()); MeshRenderer val4 = default(MeshRenderer); if (val3.TryGetComponent(ref val4)) { ((Renderer)val4).sharedMaterial = Bucket.ButtonMaterial; } SellButton sellButton = val.AddComponent(); sellButton.bucket = bucket; ((Interactable)sellButton)._interactCol = (Collider)(object)val2; ((Interactable)sellButton)._textTarget = val.transform; ((Interactable)sellButton)._modelsToOutline = (GameObject[])(object)new GameObject[1] { val3 }; val.SetActive(true); return sellButton; } public override void Hover() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) bucket.Refresh(); if (!base._isHovering) { shownWorth = -1; shownCount = -1; hoverText = BuildText(); PlayerUI.SetLookAtText(hoverText, ((Interactable)this).TextTarget, default(Vector3), false); } ((Interactable)this).Hover(); RefreshText(); } public override void UnHover() { PlayerUI.HideLookAtText(hoverText); ((Interactable)this).UnHover(); } public override void Interact(Player player) { ((Interactable)this).Interact(player); if (bucket.Count > 0) { SellRequest.Send(bucket); } PlayerUI.HideLookAtText(hoverText); } private void RefreshText() { if (bucket.Worth != shownWorth || bucket.Count != shownCount) { hoverText = BuildText(); PlayerUI.UpdateLookAtText(hoverText); } } private string BuildText() { shownWorth = bucket.Worth; shownCount = bucket.Count; if (shownCount == 0) { return "Empty bucket"; } string text = ((shownCount == 1) ? "" : "s"); return $"Sell {shownCount} item{text} - ${shownWorth}\n{SpriteManager.GetPickUpInput()}"; } } }