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 PartialInventorySortSystem v1.0.0
PartialInventorySort.dll
Decompiled 4 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2.UI; using R2API.Utils; using RoR2; using RoR2.UI; using UnityEngine; [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 = "")] [assembly: AssemblyCompany("PartialInventorySort")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PartialInventorySort")] [assembly: AssemblyTitle("PartialInventorySort")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace PartialInventorySort { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.PartialInventorySortSystem", "PartialInventorySortSystem", "1.0.0")] public class PartialInventorySortPlugin : BaseUnityPlugin { public static PluginInfo PInfo; public const string guid = "com.RiskOfBrainrot.PartialInventorySortSystem"; public const string teamName = "RiskOfBrainrot"; public const string modName = "PartialInventorySortSystem"; public const string version = "1.0.0"; public static SortMode questItemSortMode = SortMode.VeryFirst; public static SortMode scrapItemSortMode = SortMode.BeforeUnsorted; public static SortMode lunarItemSortMode = SortMode.VeryFirst; public static void AddHooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Inventory.SetItemAcquiredServer += new Manipulator(ChangeItemAcquisitionOrder); } public static void ChangeItemAcquisitionOrder(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<Inventory>(x, "itemAcquisitionOrder"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1) })) { DebugBreakpoint("ChangeItemAcquisitionOrder"); return; } val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<List<ItemIndex>, ItemIndex, Inventory>>((Action<List<ItemIndex>, ItemIndex, Inventory>)delegate(List<ItemIndex> acquisitionOrder, ItemIndex itemIndexToAdd, Inventory inventory) { //IL_003c: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_005f: 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_0074: 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) if (lunarItemSortMode == SortMode.Unsorted && questItemSortMode == SortMode.Unsorted && scrapItemSortMode == SortMode.Unsorted) { acquisitionOrder.Add(itemIndexToAdd); } else { List<ItemIndex> list = new List<ItemIndex>(); List<ItemIndex> list2 = new List<ItemIndex>(); ItemDef itemDef2 = ItemCatalog.GetItemDef(itemIndexToAdd); SortMode sortMode = GetSortMode(itemIndexToAdd); foreach (ItemIndex item in acquisitionOrder) { SortMode sortMode2 = GetSortMode(item); if (sortMode2 > sortMode) { list2.Add(item); } else { list.Add(item); } } inventory.itemAcquisitionOrder = new List<ItemIndex>(); inventory.itemAcquisitionOrder.AddRange(list); inventory.itemAcquisitionOrder.Add(itemIndexToAdd); inventory.itemAcquisitionOrder.AddRange(list2); } }); static SortMode GetSortMode(ItemIndex indexToSort) { //IL_0001: 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_0017: Invalid comparison between Unknown and I4 ItemDef itemDef = ItemCatalog.GetItemDef(indexToSort); if (lunarItemSortMode != SortMode.Unsorted && (int)itemDef.deprecatedTier == 3) { return lunarItemSortMode; } if (questItemSortMode != SortMode.Unsorted && itemDef.ContainsTag((ItemTag)33)) { return questItemSortMode; } if (scrapItemSortMode != SortMode.Unsorted && (itemDef.ContainsTag((ItemTag)10) || itemDef.ContainsTag((ItemTag)14))) { return scrapItemSortMode; } return SortMode.Unsorted; } } public static void SortInventoryDisplay(orig_UpdateDisplay orig, ItemInventoryDisplay self) { if ((Object)(object)self == (Object)null || (Object)(object)Run.instance == (Object)null || !Run.instance.isRunning) { orig.Invoke(self); } } private void Awake() { AddHooks(); } public static void DebugBreakpoint(string methodName, int breakpointNumber = -1) { string text = "(PartialInventorySortSystem) " + methodName + " IL hook failed!"; if (breakpointNumber >= 0) { text += $" (breakpoint {breakpointNumber})"; } Debug.LogError((object)text); } } public enum SortMode { VeryFirst, BeforeUnsorted, Unsorted, AfterUnsorted, VeryLast } } namespace PartialInventorySort.Modules { public static class Tools { internal static bool isLoaded(string modguid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } } public static class Assets { internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PartialInventorySortPlugin.PInfo.Location), bundleName)); loadedBundles[bundleName] = val; return val; } } public static class Bindings { internal static bool AprilFools; internal static ConfigFile CustomConfigFile { get; set; } public static bool BindSection(string sectionName) { return CustomConfigFile.Bind<bool>("Bad Item Academy : Full Section Config", sectionName, true, "Vanilla is FALSE. Set to false if you wish to disable changes made to an entire item or group of items.").Value; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\PartialInventorySortSystem.cfg", true); CustomConfigFile.SaveOnConfigSet = false; } public static void Save() { CustomConfigFile.SaveOnConfigSet = true; CustomConfigFile.Save(); } } }