using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Artifacts;
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: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ItemsGalore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ItemsGalore")]
[assembly: AssemblyTitle("ItemsGalore")]
[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 ItemsGalore
{
public enum CommandMode
{
[Description("Duplicates the command item itself, letting you choose multiple different items.")]
CommandItems,
[Description("Duplicates the item you chose in the command menu.")]
ReceivedItems
}
public class CommandPickupMenu : NetworkBehaviour
{
}
public static class Extensions
{
public static ItemCategory GetCategory(this PickupIndex pickup)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected I4, but got Unknown
PickupDef pickupDef = ((PickupIndex)(ref pickup)).pickupDef;
if ((int)pickupDef.equipmentIndex != -1)
{
return ItemCategory.Equipment;
}
if ((int)pickupDef.miscPickupIndex != -1)
{
return ItemCategory.Misc;
}
if ((int)pickupDef.artifactIndex != -1)
{
return ItemCategory.Artifact;
}
if (pickupDef.isLunar)
{
return ItemCategory.Lunar;
}
if (pickupDef.isBoss)
{
return ItemCategory.Boss;
}
ItemTier itemTier = pickupDef.itemTier;
if (1 == 0)
{
}
ItemCategory result;
switch ((int)itemTier)
{
case 0:
result = ItemCategory.White;
break;
case 1:
result = ItemCategory.Green;
break;
case 2:
result = ItemCategory.Red;
break;
case 6:
result = ItemCategory.VoidWhite;
break;
case 7:
result = ItemCategory.VoidGreen;
break;
case 8:
result = ItemCategory.VoidRed;
break;
case 4:
case 9:
result = ItemCategory.Boss;
break;
case 3:
result = ItemCategory.Lunar;
break;
default:
result = ItemCategory.Unknown;
break;
}
if (1 == 0)
{
}
return result;
}
public static int GetExtraCount(this ItemCategory category)
{
if (1 == 0)
{
}
int result = category switch
{
ItemCategory.White => CheckedCount(ModConfig.Drops.ExtraWhiteItemsCount, ModConfig.Drops.UseCustomWhiteItems),
ItemCategory.Green => CheckedCount(ModConfig.Drops.ExtraGreenItemsCount, ModConfig.Drops.UseCustomGreenItems),
ItemCategory.Red => CheckedCount(ModConfig.Drops.ExtraRedItemsCount, ModConfig.Drops.UseCustomRedItems),
ItemCategory.VoidWhite => CheckedVoidCount(ModConfig.Drops.ExtraVoidWhiteItemsCount, ModConfig.Drops.UseCustomVoidWhiteItems, ModConfig.Drops.ExtraWhiteItemsCount, ModConfig.Drops.UseCustomWhiteItems),
ItemCategory.VoidGreen => CheckedVoidCount(ModConfig.Drops.ExtraVoidGreenItemsCount, ModConfig.Drops.UseCustomVoidGreenItems, ModConfig.Drops.ExtraGreenItemsCount, ModConfig.Drops.UseCustomGreenItems),
ItemCategory.VoidRed => CheckedVoidCount(ModConfig.Drops.ExtraVoidRedItemsCount, ModConfig.Drops.UseCustomVoidRedItems, ModConfig.Drops.ExtraRedItemsCount, ModConfig.Drops.UseCustomRedItems),
ItemCategory.Lunar => CheckedCount(ModConfig.Drops.ExtraLunarItemsCount, ModConfig.Drops.UseCustomLunarItems),
ItemCategory.Boss => CheckedCount(ModConfig.Drops.ExtraBossItemsCount, ModConfig.Drops.UseCustomBossItems),
ItemCategory.Misc => CheckedCount(ModConfig.Drops.ExtraMiscItemsCount, ModConfig.Drops.UseCustomMiscItems),
ItemCategory.Equipment => CheckedCount(ModConfig.Drops.ExtraEquipmentItemsCount, ModConfig.Drops.UseCustomEquipmentItems),
_ => ModConfig.General.ExtraItemsCount.Value,
};
if (1 == 0)
{
}
return result;
}
private static int CheckedCount(ConfigEntry<int> value, ConfigEntry<bool> toggle)
{
return toggle.Value ? value.Value : ModConfig.General.ExtraItemsCount.Value;
}
private static int CheckedVoidCount(ConfigEntry<int> value, ConfigEntry<bool> toggle, ConfigEntry<int> normalValue, ConfigEntry<bool> normalToggle)
{
return toggle.Value ? value.Value : (normalToggle.Value ? normalValue.Value : ModConfig.General.ExtraItemsCount.Value);
}
}
public enum ItemCategory
{
White,
Green,
Red,
VoidWhite,
VoidGreen,
VoidRed,
Lunar,
Boss,
Misc,
Equipment,
Artifact,
Unknown
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("RedstoneWizard08.ItemsGalore", "ItemsGalore", "2.0.0")]
public class ItemsGalorePlugin : BaseUnityPlugin
{
private const string PluginGuid = "RedstoneWizard08.ItemsGalore";
private const string PluginAuthor = "RedstoneWizard08";
private const string PluginName = "ItemsGalore";
private const string PluginVersion = "2.0.0";
public static ItemsGalorePlugin Instance { get; private set; }
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
Instance = this;
ModConfig.Init(((BaseUnityPlugin)this).Config);
ModHooks.Init();
ModCommands.Init();
}
}
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);
}
}
public static class ModCommands
{
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void CommandReloadConfig(ConCommandArgs args)
{
((BaseUnityPlugin)ItemsGalorePlugin.Instance).Config.Reload();
}
public static void Init()
{
}
}
public static class ModConfig
{
public static class General
{
public static ConfigEntry<bool> Enable { get; private set; }
public static ConfigEntry<int> ExtraItemsCount { get; private set; }
public static ConfigEntry<CommandMode> CommandMode { get; private set; }
public static void Setup(ConfigFile config)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
Enable = config.Bind<bool>("General", "Enable", true, "Enable the mod.");
ExtraItemsCount = config.Bind<int>("General", "ExtraItemsCount", 0, "How many extra items to spawn when an item drops.");
CommandMode = config.Bind<CommandMode>("General", "CommandMode", ItemsGalore.CommandMode.ReceivedItems, "The way items will duplicate when the command artifact is enabled.");
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Enable));
ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ExtraItemsCount, new IntSliderConfig
{
min = 0,
max = 100
}));
ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)CommandMode));
}
}
public static class Drops
{
public static ConfigEntry<bool> UseCustomWhiteItems { get; private set; }
public static ConfigEntry<int> ExtraWhiteItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomGreenItems { get; private set; }
public static ConfigEntry<int> ExtraGreenItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomBossItems { get; private set; }
public static ConfigEntry<int> ExtraBossItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomEquipmentItems { get; private set; }
public static ConfigEntry<int> ExtraEquipmentItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomRedItems { get; private set; }
public static ConfigEntry<int> ExtraRedItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomLunarItems { get; private set; }
public static ConfigEntry<int> ExtraLunarItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomMiscItems { get; private set; }
public static ConfigEntry<int> ExtraMiscItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomVoidWhiteItems { get; private set; }
public static ConfigEntry<int> ExtraVoidWhiteItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomVoidGreenItems { get; private set; }
public static ConfigEntry<int> ExtraVoidGreenItemsCount { get; private set; }
public static ConfigEntry<bool> UseCustomVoidRedItems { get; private set; }
public static ConfigEntry<int> ExtraVoidRedItemsCount { get; private set; }
public static void Setup(ConfigFile config)
{
UseCustomWhiteItems = config.Bind<bool>("Drops", "UseCustomWhiteItems", false, "Use the custom value for white item drops instead of the global value.");
ExtraWhiteItemsCount = config.Bind<int>("Drops", "ExtraWhiteItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomWhiteItems, ExtraWhiteItemsCount);
UseCustomGreenItems = config.Bind<bool>("Drops", "UseCustomGreenItems", false, "Use the custom value for green item drops instead of the global value.");
ExtraGreenItemsCount = config.Bind<int>("Drops", "ExtraGreenItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomGreenItems, ExtraGreenItemsCount);
UseCustomRedItems = config.Bind<bool>("Drops", "UseCustomRedItems", false, "Use the custom value for red item drops instead of the global value.");
ExtraRedItemsCount = config.Bind<int>("Drops", "ExtraRedItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomRedItems, ExtraRedItemsCount);
UseCustomBossItems = config.Bind<bool>("Drops", "UseCustomBossItems", true, "Use the custom value for boss item drops instead of the global value. Due to potential framerate issues, this is enabled by default.");
ExtraBossItemsCount = config.Bind<int>("Drops", "ExtraBossItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomBossItems, ExtraBossItemsCount);
UseCustomEquipmentItems = config.Bind<bool>("Drops", "UseCustomEquipmentItems", true, "Use the custom value for equipment item drops instead of the global value. Due to potential framerate issues, this is enabled by default.");
ExtraEquipmentItemsCount = config.Bind<int>("Drops", "ExtraEquipmentItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomEquipmentItems, ExtraEquipmentItemsCount);
UseCustomLunarItems = config.Bind<bool>("Drops", "UseCustomLunarItems", true, "Use the custom value for lunar item drops instead of the global value. Due to potential framerate issues, this is enabled by default.");
ExtraLunarItemsCount = config.Bind<int>("Drops", "ExtraLunarItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomLunarItems, ExtraLunarItemsCount);
UseCustomMiscItems = config.Bind<bool>("Drops", "UseCustomMiscItems", true, "Use the custom value for misc item drops instead of the global value. Due to potential framerate issues, this is enabled by default.");
ExtraMiscItemsCount = config.Bind<int>("Drops", "ExtraMiscItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled.");
FinishSetup(UseCustomMiscItems, ExtraMiscItemsCount);
UseCustomVoidWhiteItems = config.Bind<bool>("Drops", "UseCustomVoidWhiteItems", false, "Use the custom value for void white item drops instead of the global value. This will fall back to the non-void variant's settings.");
ExtraVoidWhiteItemsCount = config.Bind<int>("Drops", "ExtraVoidWhiteItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled. This will fall back to the non-void variant's settings.");
FinishSetup(UseCustomVoidWhiteItems, ExtraVoidWhiteItemsCount);
UseCustomVoidGreenItems = config.Bind<bool>("Drops", "UseCustomVoidGreenItems", false, "Use the custom value for void green item drops instead of the global value. This will fall back to the non-void variant's settings.");
ExtraVoidGreenItemsCount = config.Bind<int>("Drops", "ExtraVoidGreenItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled. This will fall back to the non-void variant's settings.");
FinishSetup(UseCustomVoidGreenItems, ExtraVoidGreenItemsCount);
UseCustomVoidRedItems = config.Bind<bool>("Drops", "UseCustomVoidRedItems", false, "Use the custom value for void red item drops instead of the global value. This will fall back to the non-void variant's settings.");
ExtraVoidRedItemsCount = config.Bind<int>("Drops", "ExtraVoidRedItemsCount", 0, "The number of extra items that will spawn when dropped, when its respective custom setting is enabled. This will fall back to the non-void variant's settings.");
FinishSetup(UseCustomVoidRedItems, ExtraVoidRedItemsCount);
}
private static void FinishSetup(ConfigEntry<bool> toggle, ConfigEntry<int> value)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(toggle));
ModSettingsManager.AddOption((BaseOption)new IntSliderOption(value, new IntSliderConfig
{
min = 0,
max = 100
}));
}
}
public static void Init(ConfigFile config)
{
ModSettingsManager.SetModDescription("Gives you the ability to duplicate items when they spawn!");
General.Setup(config);
Drops.Setup(config);
}
}
public static class ModHooks
{
[CompilerGenerated]
private static class <>O
{
public static hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 <0>__AddExtraItemsToDroplet;
public static hook_SetOptionsFromPickupForCommandArtifact <1>__AddCommandPickupMenuComponent;
public static hook_CreatePickup_PickupIndex <2>__AddExtraCommandItems;
}
private static bool IsAltCommandMode()
{
return CommandArtifactManager.IsCommandArtifactEnabled && ModConfig.General.CommandMode.Value != CommandMode.CommandItems;
}
private static void AddExtraItemsToDroplet(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(pickupInfo, position, velocity);
if (!ModConfig.General.Enable.Value || IsAltCommandMode())
{
return;
}
int extraCount = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex.GetCategory().GetExtraCount();
if (extraCount > 0)
{
Log.Info($"Spawning {extraCount} extra items...");
for (int i = 0; i < extraCount; i++)
{
orig.Invoke(pickupInfo, position, velocity);
}
Log.Info("Spawned all extra items!");
}
}
private static void AddCommandPickupMenuComponent(orig_SetOptionsFromPickupForCommandArtifact orig, PickupPickerController self, PickupIndex pickupIndex)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, pickupIndex);
if (ModConfig.General.Enable.Value && IsAltCommandMode())
{
((Component)self).gameObject.AddComponent<CommandPickupMenu>();
}
}
private static void AddExtraCommandItems(orig_CreatePickup_PickupIndex orig, PickupPickerController self, PickupIndex pickupIndex)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, pickupIndex);
if (!ModConfig.General.Enable.Value || !IsAltCommandMode() || (Object)(object)((Component)self).gameObject.GetComponent<CommandPickupMenu>() == (Object)null)
{
return;
}
int extraCount = pickupIndex.GetCategory().GetExtraCount();
if (extraCount > 0)
{
Log.Info($"Spawning {extraCount} extra items...");
for (int i = 0; i < extraCount; i++)
{
orig.Invoke(self, pickupIndex);
}
Log.Info("Spawned all extra items!");
}
}
public static void Init()
{
//IL_0011: 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_001c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
object obj = <>O.<0>__AddExtraItemsToDroplet;
if (obj == null)
{
hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 val = AddExtraItemsToDroplet;
<>O.<0>__AddExtraItemsToDroplet = val;
obj = (object)val;
}
PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += (hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3)obj;
object obj2 = <>O.<1>__AddCommandPickupMenuComponent;
if (obj2 == null)
{
hook_SetOptionsFromPickupForCommandArtifact val2 = AddCommandPickupMenuComponent;
<>O.<1>__AddCommandPickupMenuComponent = val2;
obj2 = (object)val2;
}
PickupPickerController.SetOptionsFromPickupForCommandArtifact += (hook_SetOptionsFromPickupForCommandArtifact)obj2;
object obj3 = <>O.<2>__AddExtraCommandItems;
if (obj3 == null)
{
hook_CreatePickup_PickupIndex val3 = AddExtraCommandItems;
<>O.<2>__AddExtraCommandItems = val3;
obj3 = (object)val3;
}
PickupPickerController.CreatePickup_PickupIndex += (hook_CreatePickup_PickupIndex)obj3;
}
}
}