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 BetterCommandArtifact v1.5.3
BetterCommand.dll
Decompiled 4 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Artifacts; using RoR2; using RoR2.Items; using UnityEngine; using UnityEngine.Networking; [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: AssemblyCompany("ArtifactPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e5bbd9dbdda16b2b65fc4f8847457eed7e8fe3a6")] [assembly: AssemblyProduct("ArtifactPlugin")] [assembly: AssemblyTitle("ArtifactPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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 BetterCommandArtifact { [BepInPlugin("Boooooop.BetterCommandArtifact", "BetterCommandArtifact", "1.5.3")] public class BetterCommandArtifact : BaseUnityPlugin { public const string PluginGUID = "Boooooop.BetterCommandArtifact"; public const string PluginAuthor = "Boooooop"; public const string PluginName = "BetterCommandArtifact"; public const string PluginVersion = "1.5.3"; public static ConfigFile configFile = new ConfigFile(Paths.ConfigPath + "\\BetterCommandArtifact.cfg", true); public static ConfigEntry<bool> allowTemp { get; set; } public static ConfigEntry<int> itemAmount { get; set; } public static ConfigEntry<bool> allowBoss { get; set; } public static ConfigEntry<bool> enablePrinter { get; set; } public static ConfigEntry<bool> perTierEnabled { get; set; } public static ConfigEntry<int> whiteAmount { get; set; } public static ConfigEntry<int> greenAmount { get; set; } public static ConfigEntry<int> redAmount { get; set; } public static ConfigEntry<int> yellowAmount { get; set; } public static ConfigEntry<int> foodAmount { get; set; } public static ConfigEntry<int> defaultAmount { get; set; } public static ConfigEntry<int> equipmentAmount { get; set; } public static ConfigEntry<int> equipmentLunarAmount { get; set; } public static ConfigEntry<int> whiteVoidAmount { get; set; } public static ConfigEntry<int> greenVoidAmount { get; set; } public static ConfigEntry<int> redVoidAmount { get; set; } public static ConfigEntry<int> yellowVoidAmount { get; set; } public static ConfigEntry<int> lunarAmount { get; set; } public void OnEnable() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Expected O, but got Unknown //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown allowTemp = configFile.Bind<bool>("BetterCommandArtifact", "Allow Temporary ITems", false, new ConfigDescription("Allow Temporary items to be selected?", (AcceptableValueBase)null, Array.Empty<object>())); itemAmount = configFile.Bind<int>("BetterCommandArtifact", "itemAmount", 3, new ConfigDescription("Set the amount of items shown when opening a command artifact drop. \n Value must be Greater Than 0.", (AcceptableValueBase)null, Array.Empty<object>())); allowBoss = configFile.Bind<bool>("BetterCommandArtifact", "Allow Boss", false, new ConfigDescription("Allow boss items to have multiple options? \n Ignored if Per-tier config is enabled.", (AcceptableValueBase)null, Array.Empty<object>())); enablePrinter = configFile.Bind<bool>("BetterCommandArtifact", "Enable Printers and Scrappers", true, new ConfigDescription("Allow printers and scrappers to spawn while Command is enabled? Vanilla is false.", (AcceptableValueBase)null, Array.Empty<object>())); perTierEnabled = configFile.Bind<bool>("BetterCommandArtifact", "Use Per-tier Config", false, new ConfigDescription("Enables the per-tier section of the config.", (AcceptableValueBase)null, Array.Empty<object>())); whiteAmount = configFile.Bind<int>("Tier Settings", "T1 White", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); whiteVoidAmount = configFile.Bind<int>("Tier Settings", "T1 White (Void)", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); greenAmount = configFile.Bind<int>("Tier Settings", "T2 Green", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); greenVoidAmount = configFile.Bind<int>("Tier Settings", "T2 Green (Void)", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); redAmount = configFile.Bind<int>("Tier Settings", "T3 Red", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); redVoidAmount = configFile.Bind<int>("Tier Settings", "T3 Red (Void)", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); yellowAmount = configFile.Bind<int>("Tier Settings", "Yellow", 1, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); yellowVoidAmount = configFile.Bind<int>("Tier Settings", "Yellow (Void)", 1, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); foodAmount = configFile.Bind<int>("Tier Settings", "Food", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); defaultAmount = configFile.Bind<int>("Tier Settings", "Default", 3, new ConfigDescription("How many options for items that fall outside of the listed tiers.", (AcceptableValueBase)null, Array.Empty<object>())); equipmentAmount = configFile.Bind<int>("Tier Settings", "Equipment", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); lunarAmount = configFile.Bind<int>("Tier Settings", "Lunar", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); equipmentLunarAmount = configFile.Bind<int>("Tier Settings", "Lunar Equipment", 3, new ConfigDescription("How many options this tier has.", (AcceptableValueBase)null, Array.Empty<object>())); PickupPickerController.SetOptionsFromPickupForCommandArtifact_PickupIndex += new hook_SetOptionsFromPickupForCommandArtifact_PickupIndex(PickupPickerController_SetOptionsFromPickupForCommandArtifact_PickupIndex); PickupPickerController.SetOptionsFromPickupForCommandArtifact_UniquePickup += new hook_SetOptionsFromPickupForCommandArtifact_UniquePickup(PickupPickerController_SetOptionsFromPickupForCommandArtifact_UniquePickup); CommandArtifactManager.OnGenerateInteractableCardSelection += new hook_OnGenerateInteractableCardSelection(CommandArtifactManager_OnGenerateInteractableCardSelection); PickupDropletController.CreateCommandCube += new hook_CreateCommandCube(CreateCommandCube); } private void CommandArtifactManager_OnGenerateInteractableCardSelection(orig_OnGenerateInteractableCardSelection orig, SceneDirector sceneDirector, DirectorCardCategorySelection dccs) { if (!enablePrinter.Value) { orig.Invoke(sceneDirector, dccs); } } public void OnDisable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown PickupPickerController.SetOptionsFromPickupForCommandArtifact_PickupIndex -= new hook_SetOptionsFromPickupForCommandArtifact_PickupIndex(PickupPickerController_SetOptionsFromPickupForCommandArtifact_PickupIndex); PickupPickerController.SetOptionsFromPickupForCommandArtifact_UniquePickup -= new hook_SetOptionsFromPickupForCommandArtifact_UniquePickup(PickupPickerController_SetOptionsFromPickupForCommandArtifact_UniquePickup); CommandArtifactManager.OnGenerateInteractableCardSelection -= new hook_OnGenerateInteractableCardSelection(CommandArtifactManager_OnGenerateInteractableCardSelection); PickupDropletController.CreateCommandCube -= new hook_CreateCommandCube(CreateCommandCube); } private void CreateCommandCube(orig_CreateCommandCube orig, PickupDropletController self) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) UniquePickup pickup = ((CreatePickupInfo)(ref self.createPickupInfo)).pickup; bool flag = ((UniquePickup)(ref pickup)).isTempItem && !allowTemp.Value; int extraItemCount = GetExtraItemCount(((CreatePickupInfo)(ref self.createPickupInfo)).pickup.pickupIndex); if (extraItemCount <= 0 || flag) { GenericPickupController.CreatePickup(ref self.createPickupInfo); } else { orig.Invoke(self); } } private void PickupPickerController_SetOptionsFromPickupForCommandArtifact_PickupIndex(orig_SetOptionsFromPickupForCommandArtifact_PickupIndex orig, PickupPickerController self, PickupIndex pickupIndex) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0012: Unknown result type (might be due to invalid IL or missing references) self.SetOptionsFromPickupForCommandArtifact(new UniquePickup { pickupIndex = pickupIndex }); } private void PickupPickerController_SetOptionsFromPickupForCommandArtifact_UniquePickup(orig_SetOptionsFromPickupForCommandArtifact_UniquePickup orig, PickupPickerController self, UniquePickup pickup) { //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) //IL_0020: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } Option[] optionsFromPickupState = PickupPickerController.GetOptionsFromPickupState(pickup); Option[] array; if (optionsFromPickupState == null) { array = (Option[])(object)new Option[1] { new Option { available = true, pickup = pickup } }; } else if (optionsFromPickupState.Length == 1) { array = optionsFromPickupState; } else { Random rnd = new Random(); List<Option> list = new List<Option>(); int num = itemAmount.Value; if (pickup.pickupIndex != PickupIndex.none) { num = GetExtraItemCount(pickup.pickupIndex); if (num > 0) { list.Add(new Option { pickup = pickup }); } } if (num > 0) { List<Option> collection = (from x in optionsFromPickupState.ToList() orderby rnd.Next() select x).Where(delegate(Option x) { //IL_0008: 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_0021: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) bool flag = Run.instance.IsPickupAvailable(((Option)(ref x)).pickupIndex) && ((Option)(ref x)).pickupIndex != pickup.pickupIndex; PickupDef pickupDef = PickupCatalog.GetPickupDef(((Option)(ref x)).pickupIndex); if (pickupDef != null && (int)pickupDef.itemIndex != -1 && (Object)(object)SuppressedItemManager.suppressedInventory != (Object)null) { flag = flag && SuppressedItemManager.suppressedInventory.GetItemCountEffective(pickupDef.itemIndex) <= 0; } return flag; }).Take(num).ToList(); list.AddRange(collection); } array = (Option[])(object)new Option[list.Count]; for (int i = 0; i < list.Count; i++) { Option val = list[i]; array[i] = new Option { available = Run.instance.IsPickupAvailable(((Option)(ref val)).pickupIndex), pickup = val.pickup }; } } self.SetOptionsServer(array); } public static int GetExtraItemCount(PickupIndex pickupIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002e: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_006b: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected I4, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_01d8: 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_00a8: Invalid comparison between Unknown and I4 if (pickupIndex != PickupIndex.none) { PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null) { bool flag = (int)pickupDef.equipmentIndex != -1; bool flag2 = (int)pickupDef.itemIndex != -1; if (flag || flag2) { int result = itemAmount.Value - 1; if (flag2) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (!perTierEnabled.Value) { if ((Object)(object)itemDef != (Object)null && ((int)itemDef.tier == 4 || (int)itemDef.tier == 9) && !allowBoss.Value) { result = 0; } } else { ItemTier tier = itemDef.tier; ItemTier val = tier; result = (int)val switch { 0 => whiteAmount.Value, 1 => greenAmount.Value, 2 => redAmount.Value, 4 => yellowAmount.Value, 6 => whiteVoidAmount.Value, 7 => greenVoidAmount.Value, 8 => redVoidAmount.Value, 9 => yellowVoidAmount.Value, 3 => lunarAmount.Value, 10 => foodAmount.Value, 5 => 1, _ => defaultAmount.Value, } - 1; } } else if (flag && perTierEnabled.Value) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); result = ((!equipmentDef.isLunar) ? (equipmentAmount.Value - 1) : (equipmentLunarAmount.Value - 1)); } return result; } } } return 0; } } } namespace R2API.Utils { [AttributeUsage(AttributeTargets.Assembly)] public class ManualNetworkRegistrationAttribute : Attribute { } }