using 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 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+e7fd865b52cb8b50ca390b55f51f193c62355df9")]
[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.4.1")]
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.4.1";
public static ConfigFile configFile = new ConfigFile(Paths.ConfigPath + "\\BetterCommandArtifact.cfg", true);
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> 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_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Expected O, but got Unknown
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Expected O, but got Unknown
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Expected O, but got Unknown
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>()));
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 += new hook_SetOptionsFromPickupForCommandArtifact(SetOptions);
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
PickupPickerController.SetOptionsFromPickupForCommandArtifact -= new hook_SetOptionsFromPickupForCommandArtifact(SetOptions);
}
private void CreateCommandCube(orig_CreateCommandCube orig, PickupDropletController self)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
int extraItemCount = GetExtraItemCount(((CreatePickupInfo)(ref self.createPickupInfo)).pickupIndex);
if (extraItemCount <= 0)
{
GenericPickupController.CreatePickup(ref self.createPickupInfo);
}
else
{
orig.Invoke(self);
}
}
private void SetOptions(orig_SetOptionsFromPickupForCommandArtifact orig, PickupPickerController self, PickupIndex pickupIndex)
{
//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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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)
if (!NetworkServer.active)
{
return;
}
PickupIndex[] groupFromPickupIndex = PickupTransmutationManager.GetGroupFromPickupIndex(pickupIndex);
Option[] array;
if (groupFromPickupIndex == null)
{
array = (Option[])(object)new Option[1]
{
new Option
{
available = true,
pickupIndex = pickupIndex
}
};
}
else
{
Random rnd = new Random();
List<PickupIndex> list = new List<PickupIndex>();
int num = itemAmount.Value;
if (pickupIndex != PickupIndex.none)
{
num = GetExtraItemCount(pickupIndex);
if (num > 0)
{
list.Add(pickupIndex);
}
}
if (num > 0)
{
List<PickupIndex> collection = (from x in groupFromPickupIndex.ToList()
orderby rnd.Next()
where Run.instance.IsPickupAvailable(x) && x != pickupIndex
select x).Take(num).ToList();
list.AddRange(collection);
}
array = (Option[])(object)new Option[list.Count];
for (int i = 0; i < list.Count; i++)
{
PickupIndex val = list[i];
array[i] = new Option
{
available = Run.instance.IsPickupAvailable(val),
pickupIndex = val
};
}
}
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_0108: 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_01b8: 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.deprecatedTier == 4 || (int)itemDef.deprecatedTier == 9) && !allowBoss.Value)
{
result = 0;
}
}
else
{
ItemTier deprecatedTier = itemDef.deprecatedTier;
ItemTier val = deprecatedTier;
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,
_ => itemAmount.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
{
}
}