using System.Collections.Generic;
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 On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
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 = "")]
[assembly: AssemblyCompany("FruityCradles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FruityCradles")]
[assembly: AssemblyTitle("FruityCradles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FruityCradles;
internal class FruityCradleBehavior : OptionChestBehavior
{
internal PurchaseInteraction purchaseInteraction;
public GameObject voidExecuteEffect => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/CritGlassesVoid/CritGlassesVoidExecuteEffect.prefab").WaitForCompletion();
private void Start()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
if (NetworkServer.active)
{
if ((Object)(object)purchaseInteraction == (Object)null)
{
purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>();
}
if ((Object)(object)purchaseInteraction != (Object)null)
{
((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)SoTrue);
}
base.rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong);
((OptionChestBehavior)this).Roll();
}
}
private void VoidCancel(TeleporterInteraction obj)
{
//IL_003e: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
TeleporterInteraction.onTeleporterBeginChargingGlobal -= VoidCancel;
if (Object.op_Implicit((Object)(object)((Component)this).gameObject))
{
if ((Object)(object)voidExecuteEffect != (Object)null)
{
EffectManager.SpawnEffect(voidExecuteEffect, new EffectData
{
origin = ((Component)this).transform.position,
scale = 3f
}, true);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void SoTrue(Interactor interactor)
{
((OptionChestBehavior)this).Open();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.RiskOfBrainrot.FruityCradles", "FruityCradles", "1.0.4")]
public class FruityCradlesPlugin : BaseUnityPlugin
{
public const string guid = "com.RiskOfBrainrot.FruityCradles";
public const string teamName = "RiskOfBrainrot";
public const string modName = "FruityCradles";
public const string version = "1.0.4";
private GameObject voidPotentialPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/OptionPickup/OptionPickup.prefab").WaitForCompletion();
private GameObject voidCradlePrefab;
public static float cradleHealthCost = 0.2f;
public static PluginInfo PInfo { get; private set; }
internal static ConfigFile CustomConfigFile { get; set; }
public static ConfigEntry<bool> DoCradleSoulCost { get; set; }
public static ConfigEntry<float> CradleSoulPayCost { get; set; }
public static ConfigEntry<bool> DoCradlePotential { get; set; }
private void Awake()
{
//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 + "\\FruityCradles.cfg", true);
DoCradleSoulCost = CustomConfigFile.Bind<bool>("FruityCradles: Reworks", "Change Cradle To Soul Cost", true, "");
DoCradlePotential = CustomConfigFile.Bind<bool>("FruityCradles: Reworks", "Change Cradle To Drop Potentials", true, "");
CradleSoulPayCost = CustomConfigFile.Bind<float>("FruityCradles: Reworks", "Cradle Pay Cost", cradleHealthCost, "Expressed as a decimal, i.e 0.2 is 20%. Rounded to the nearest 10%");
VoidCradleRework();
}
private void VoidCradleRework()
{
//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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_0070: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
voidCradlePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidChest/VoidChest.prefab").WaitForCompletion();
if (!Object.op_Implicit((Object)(object)voidCradlePrefab))
{
return;
}
PurchaseInteraction component = voidCradlePrefab.GetComponent<PurchaseInteraction>();
if (Object.op_Implicit((Object)(object)component))
{
component.cost = Mathf.RoundToInt(cradleHealthCost * 10f) * 10;
if (DoCradleSoulCost.Value)
{
component.costType = (CostTypeIndex)15;
component.setUnavailableOnTeleporterActivated = true;
component.saleStarCompatible = false;
}
}
if (DoCradlePotential.Value)
{
ChestBehavior component2 = voidCradlePrefab.GetComponent<ChestBehavior>();
FruityCradleBehavior fruityCradleBehavior = voidCradlePrefab.AddComponent<FruityCradleBehavior>();
OptionChestBehavior.Roll += new hook_Roll(DoOptionCradleBehavior);
if (Object.op_Implicit((Object)(object)component2))
{
fruityCradleBehavior.purchaseInteraction = component;
((OptionChestBehavior)fruityCradleBehavior).dropTable = component2.dropTable;
((OptionChestBehavior)fruityCradleBehavior).displayTier = (ItemTier)6;
((OptionChestBehavior)fruityCradleBehavior).dropUpVelocityStrength = 20f;
((OptionChestBehavior)fruityCradleBehavior).dropForwardVelocityStrength = 0f;
((OptionChestBehavior)fruityCradleBehavior).openState = component2.openState;
((OptionChestBehavior)fruityCradleBehavior).pickupPrefab = voidPotentialPrefab;
((OptionChestBehavior)fruityCradleBehavior).numOptions = 1;
Object.Destroy((Object)(object)component2);
}
}
}
private void DoOptionCradleBehavior(orig_Roll orig, OptionChestBehavior self)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
if (self is FruityCradleBehavior)
{
if (!NetworkServer.active)
{
Debug.LogWarning((object)"[Server] function 'System.Void RoR2.OptionChestBehavior::Roll()' called on client");
return;
}
List<PickupIndex> list = new List<PickupIndex>();
PickupIndex val = self.dropTable.GenerateDrop(self.rng);
list.Add(val);
Pair[] array = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem];
Pair[] array2 = array;
foreach (Pair val2 in array2)
{
PickupIndex val3 = PickupCatalog.FindPickupIndex(val2.itemDef2.itemIndex);
if (!(val3 != val))
{
if ((int)val2.itemDef2.tier == 8)
{
break;
}
PickupIndex item = PickupCatalog.FindPickupIndex(val2.itemDef1.itemIndex);
list.Add(item);
}
}
self.generatedDrops = list.ToArray();
}
else
{
orig.Invoke(self);
}
}
}