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 InventoryYeeter v1.0.3
InventoryYeeter.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace InventoryYeeter { [BepInPlugin("com.custom.inventoryyeeter", "Inventory Yeeter", "1.0.3")] public class YeeterPlugin : BaseUnityPlugin { public static ConfigEntry<KeyboardShortcut> YeetHotkey; public static ConfigEntry<bool> OnlyYeetNonEquipped; public static ConfigEntry<float> WeightThreshold; public static ConfigEntry<bool> AddMapMarker; public static ConfigEntry<string> MapPinText; public static ConfigEntry<string> CenterMessageText; public static ConfigEntry<int> MaxDropEvents; public static ConfigEntry<bool> ProtectHotbar; public static ConfigEntry<bool> PreventPinSpam; private float _lastYeetTime = -999f; private static List<Vector3> _yeetedPinPositions = new List<Vector3>(); private Player _lastPlayerRef; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) YeetHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "YeetHotkey", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), "The button to jettison weight. Supports Mouse3, Mouse4, and modifiers like LeftShift + G."); OnlyYeetNonEquipped = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ProtectEquipped", true, "If true, the mod will never drop armor, weapons, or tools currently being worn."); WeightThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("General", "WeightThreshold", 10f, "Minimum weight (per stack) to be considered for jettisoning. Keeps your food/wood safe."); AddMapMarker = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AddMapMarker", true, "If true, places an 'X' on your map at the drop location."); MapPinText = ((BaseUnityPlugin)this).Config.Bind<string>("General", "MapPinText", "Yeeted:", "The custom text that appears on the map pin before the item name."); CenterMessageText = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CenterMessageText", "PANIC! Jettisoned {0} drops ({1}kg). RUN!", "The message displayed on the center of the screen when items are yeeted. Use {0} for the number of drops and {1} for the total weight released."); MaxDropEvents = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxDropEvents", 10, "Maximum number of item stacks that can be jettisoned in a single panic press. Prevents accidentally dropping everything you own."); ProtectHotbar = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ProtectHotbar", true, "If true, items on your hotbar (top row) will never be jettisoned."); PreventPinSpam = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PreventPinSpam", true, "If true, skips adding a map pin if one already exists within 10 meters of the drop location."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Inventory Yeeter: Armed and Ready!"); } private void Update() { //IL_0099: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } if ((Object)(object)_lastPlayerRef != (Object)(object)Player.m_localPlayer) { _yeetedPinPositions.Clear(); _lastPlayerRef = Player.m_localPlayer; } Chat instance = Chat.instance; if ((instance != null && instance.HasFocus()) || Console.IsVisible() || Menu.IsVisible()) { return; } TextViewer instance2 = TextViewer.instance; if ((instance2 != null && instance2.IsVisible()) || TextInput.IsVisible() || StoreGui.IsVisible() || InventoryGui.IsVisible() || Time.time - _lastYeetTime < 1f) { return; } KeyboardShortcut value = YeetHotkey.Value; if (!Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { return; } bool flag = true; value = YeetHotkey.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { flag = false; break; } } if (flag) { _lastYeetTime = Time.time; YeetTheWeight(Player.m_localPlayer); } } public static void YeetTheWeight(Player player) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } float maxCarryWeight = player.GetMaxCarryWeight(); float totalWeight = inventory.GetTotalWeight(); if (totalWeight <= maxCarryWeight) { ((Character)player).Message((MessageType)1, "You aren't even encumbered!", 0, (Sprite)null); return; } List<ItemData> list = (from item in inventory.GetAllItems() where !OnlyYeetNonEquipped.Value || !item.m_equipped where !ProtectHotbar.Value || (item.m_gridPos.y > 0 && item.m_gridPos.y < 10) where item.m_shared.m_weight * (float)item.m_stack >= WeightThreshold.Value orderby item.m_shared.m_weight * (float)item.m_stack descending, item.m_shared.m_teleportable descending select item).ToList(); if (list.Count == 0) { ((Character)player).Message((MessageType)1, "Nothing heavy enough to jettison!", 0, (Sprite)null); return; } int num = 0; float num2 = 0f; string text = Localization.instance.Localize(list[0].m_shared.m_name); Vector3 dropPosition = ((Component)player).transform.position; float num3 = totalWeight; foreach (ItemData item in list) { if (num3 <= maxCarryWeight || num >= MaxDropEvents.Value) { break; } float weight = item.m_shared.m_weight; int num4 = item.m_stack; if (weight > 0f) { int num5 = Mathf.CeilToInt((num3 - maxCarryWeight) / weight); if (num5 < item.m_stack) { num4 = num5; } } float num6 = weight * (float)num4; ((Humanoid)player).DropItem(inventory, item, num4); num3 -= num6; num2 += num6; num++; } if (num <= 0) { return; } if (AddMapMarker.Value && (Object)(object)Minimap.instance != (Object)null && (!PreventPinSpam.Value || !_yeetedPinPositions.Exists((Vector3 pos) => Vector3.Distance(pos, dropPosition) < 10f))) { string text2 = MapPinText.Value + " " + text; if (num > 1) { text2 += $" (+{num - 1} more)"; } Minimap.instance.AddPin(dropPosition, (PinType)6, text2, true, false, 0L, default(PlatformUserID)); _yeetedPinPositions.Add(dropPosition); } ((Character)player).Message((MessageType)2, string.Format(CenterMessageText.Value, num, num2), 0, (Sprite)null); } } }