Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RoR2ItemDraft v1.0.0
RoR2ItemDraft.dll
Decompiled 2 years agousing System; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; 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.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("RoR2ItemDraft")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoR2ItemDraft")] [assembly: AssemblyTitle("RoR2ItemDraft")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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 ExamplePlugin { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace ChestItems { [BepInPlugin("itemdraftplugin", "Item Draft Plugin", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ItemDraftPlugin : BaseUnityPlugin { private GameObject CommandCubePrefab; private const string ModGuid = "itemdraftplugin"; private ConfigEntry<int> NumItem; public void Awake() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown NumItem = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Number Of Items", 3, "How many items you can draft from"); CommandCubePrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/CommandCube"); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(NumItem)); } PickupDropletController.onDropletHitGroundServer += new PickupDropletHitGroundDelegate(OnDropletHitGroundServer); SceneDirector.onGenerateInteractableCardSelection += OnGenerateInteractableCardSelection; PickupPickerController.GetOptionsFromPickupIndex += new hook_GetOptionsFromPickupIndex(PickupPickerController_GetOptionsFromPickupIndex); } private Option[] PickupPickerController_GetOptionsFromPickupIndex(orig_GetOptionsFromPickupIndex orig, PickupIndex pickupIndex) { //IL_0002: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) Option[] array = orig.Invoke(pickupIndex); int num = array.Length; Random random = new Random(); for (int i = 0; i < num - 1; i++) { int num2 = random.Next(i, num); if (num2 != i) { Option val = array[i]; array[i] = array[num2]; array[num2] = val; } } for (int j = 0; j < NumItem.Value; j++) { array[j].available = true; } return array.Take(NumItem.Value).ToArray(); } private void OnDropletHitGroundServer(ref CreatePickupInfo createPickupInfo, ref bool shouldSpawn) { //IL_0002: 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_0008: 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_0019: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0040: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 PickupIndex pickupIndex = ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex; PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1 || (int)pickupDef.itemTier != 5)) { GameObject val = Object.Instantiate<GameObject>(CommandCubePrefab, createPickupInfo.position, createPickupInfo.rotation); val.GetComponent<PickupIndexNetworker>().NetworkpickupIndex = pickupIndex; val.GetComponent<PickupPickerController>().SetOptionsFromPickupForCommandArtifact(pickupIndex); NetworkServer.Spawn(val); shouldSpawn = false; } } private static void OnGenerateInteractableCardSelection(SceneDirector sceneDirector, DirectorCardCategorySelection dccs) { dccs.RemoveCardsThatFailFilter((Predicate<DirectorCard>)DoesNotOfferChoice); static bool DoesNotOfferChoice(DirectorCard card) { return !OffersChoice(card); } static bool OffersChoice(DirectorCard card) { GameObject prefab = card.spawnCard.prefab; return Object.op_Implicit((Object)(object)prefab.GetComponent<ShopTerminalBehavior>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<MultiShopController>()) || Object.op_Implicit((Object)(object)prefab.GetComponent<ScrapperController>()); } } } }